@kopexa/sight 17.12.0 → 17.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/dist/chunk-5LLYOCGQ.mjs +153 -0
  2. package/dist/chunk-6IAHC3UK.mjs +1 -0
  3. package/dist/chunk-6XUZNN3X.mjs +1 -0
  4. package/dist/chunk-7KISSD3Q.mjs +1 -0
  5. package/dist/chunk-BJ7QPNKW.mjs +242 -0
  6. package/dist/chunk-CZNF6WPR.mjs +33 -0
  7. package/dist/chunk-DU3OVIBY.mjs +16 -0
  8. package/dist/chunk-DWZQIPCX.mjs +301 -0
  9. package/dist/chunk-EAJ3DTJ3.mjs +59 -0
  10. package/dist/chunk-FBTSAODG.mjs +25 -0
  11. package/dist/chunk-G57FFIKP.mjs +48 -0
  12. package/dist/chunk-GR3VEF4M.mjs +1 -0
  13. package/dist/chunk-HISY6ZIK.mjs +1 -0
  14. package/dist/chunk-HUHVPC6T.mjs +17 -0
  15. package/dist/chunk-HVOS7SXF.mjs +15 -0
  16. package/dist/chunk-PKG2E3MX.mjs +1 -0
  17. package/dist/chunk-POVIOFVF.mjs +18 -0
  18. package/dist/chunk-RK7G2GYB.mjs +45 -0
  19. package/dist/chunk-SHETEVHO.mjs +178 -0
  20. package/dist/chunk-UWC3Z7SY.mjs +1 -0
  21. package/dist/chunk-UWQG4HGJ.mjs +13 -0
  22. package/dist/chunk-XL2RCXMY.mjs +26 -0
  23. package/dist/chunk-XPDEN2RV.mjs +1 -0
  24. package/dist/components/blankstate/blankstate.d.mts +14 -0
  25. package/dist/components/blankstate/blankstate.d.ts +14 -0
  26. package/dist/components/blankstate/blankstate.js +69 -0
  27. package/dist/components/blankstate/blankstate.mjs +7 -0
  28. package/dist/components/blankstate/index.d.mts +4 -0
  29. package/dist/components/blankstate/index.d.ts +4 -0
  30. package/dist/components/blankstate/index.js +71 -0
  31. package/dist/components/blankstate/index.mjs +8 -0
  32. package/dist/components/code/code.d.mts +9 -0
  33. package/dist/components/code/code.d.ts +9 -0
  34. package/dist/components/code/code.js +49 -0
  35. package/dist/components/code/code.mjs +7 -0
  36. package/dist/components/code/index.d.mts +4 -0
  37. package/dist/components/code/index.d.ts +4 -0
  38. package/dist/components/code/index.js +51 -0
  39. package/dist/components/code/index.mjs +8 -0
  40. package/dist/components/dialog/dialog.d.mts +44 -0
  41. package/dist/components/dialog/dialog.d.ts +44 -0
  42. package/dist/components/dialog/dialog.js +213 -0
  43. package/dist/components/dialog/dialog.mjs +31 -0
  44. package/dist/components/dialog/index.d.mts +22 -0
  45. package/dist/components/dialog/index.d.ts +22 -0
  46. package/dist/components/dialog/index.js +232 -0
  47. package/dist/components/dialog/index.mjs +35 -0
  48. package/dist/components/dialog/namespace.d.mts +5 -0
  49. package/dist/components/dialog/namespace.d.ts +5 -0
  50. package/dist/components/dialog/namespace.js +213 -0
  51. package/dist/components/dialog/namespace.mjs +29 -0
  52. package/dist/components/dialog/transition.d.mts +5 -0
  53. package/dist/components/dialog/transition.d.ts +5 -0
  54. package/dist/components/dialog/transition.js +132 -0
  55. package/dist/components/dialog/transition.mjs +106 -0
  56. package/dist/components/file-upload/avatar-upload.d.mts +54 -0
  57. package/dist/components/file-upload/avatar-upload.d.ts +54 -0
  58. package/dist/components/file-upload/avatar-upload.js +841 -0
  59. package/dist/components/file-upload/avatar-upload.mjs +15 -0
  60. package/dist/components/file-upload/index.d.mts +5 -0
  61. package/dist/components/file-upload/index.d.ts +5 -0
  62. package/dist/components/file-upload/index.js +843 -0
  63. package/dist/components/file-upload/index.mjs +16 -0
  64. package/dist/components/file-upload/messages.d.mts +39 -0
  65. package/dist/components/file-upload/messages.d.ts +39 -0
  66. package/dist/components/file-upload/messages.js +68 -0
  67. package/dist/components/file-upload/messages.mjs +7 -0
  68. package/dist/components/file-upload/utils/data-url-to-file.d.mts +3 -0
  69. package/dist/components/file-upload/utils/data-url-to-file.d.ts +3 -0
  70. package/dist/components/file-upload/utils/data-url-to-file.js +38 -0
  71. package/dist/components/file-upload/utils/data-url-to-file.mjs +7 -0
  72. package/dist/components/file-upload/utils/format-accept-types.d.mts +8 -0
  73. package/dist/components/file-upload/utils/format-accept-types.d.ts +8 -0
  74. package/dist/components/file-upload/utils/format-accept-types.js +82 -0
  75. package/dist/components/file-upload/utils/format-accept-types.mjs +7 -0
  76. package/dist/components/file-upload/utils/is-image-like.d.mts +3 -0
  77. package/dist/components/file-upload/utils/is-image-like.d.ts +3 -0
  78. package/dist/components/file-upload/utils/is-image-like.js +36 -0
  79. package/dist/components/file-upload/utils/is-image-like.mjs +7 -0
  80. package/dist/components/index.d.mts +67 -0
  81. package/dist/components/index.d.ts +67 -0
  82. package/dist/components/index.js +1137 -0
  83. package/dist/components/index.mjs +92 -0
  84. package/dist/components/skeleton/index.d.mts +5 -0
  85. package/dist/components/skeleton/index.d.ts +5 -0
  86. package/dist/components/skeleton/index.js +53 -0
  87. package/dist/components/skeleton/index.mjs +12 -0
  88. package/dist/components/skeleton/skeleton-avatar.d.mts +9 -0
  89. package/dist/components/skeleton/skeleton-avatar.d.ts +9 -0
  90. package/dist/components/skeleton/skeleton-avatar.js +51 -0
  91. package/dist/components/skeleton/skeleton-avatar.mjs +8 -0
  92. package/dist/components/skeleton/skeleton.d.mts +7 -0
  93. package/dist/components/skeleton/skeleton.d.ts +7 -0
  94. package/dist/components/skeleton/skeleton.js +39 -0
  95. package/dist/components/skeleton/skeleton.mjs +7 -0
  96. package/dist/components/stat/index.d.mts +4 -0
  97. package/dist/components/stat/index.d.ts +4 -0
  98. package/dist/components/stat/index.js +186 -0
  99. package/dist/components/stat/index.mjs +24 -0
  100. package/dist/components/stat/stat.d.mts +36 -0
  101. package/dist/components/stat/stat.d.ts +36 -0
  102. package/dist/components/stat/stat.js +185 -0
  103. package/dist/components/stat/stat.mjs +24 -0
  104. package/dist/components/textarea/index.d.mts +4 -0
  105. package/dist/components/textarea/index.d.ts +4 -0
  106. package/dist/components/textarea/index.js +42 -0
  107. package/dist/components/textarea/index.mjs +8 -0
  108. package/dist/components/textarea/textarea.d.mts +8 -0
  109. package/dist/components/textarea/textarea.d.ts +8 -0
  110. package/dist/components/textarea/textarea.js +40 -0
  111. package/dist/components/textarea/textarea.mjs +7 -0
  112. package/dist/hooks/index.d.mts +2 -0
  113. package/dist/hooks/index.d.ts +2 -0
  114. package/dist/hooks/index.js +341 -0
  115. package/dist/hooks/index.mjs +9 -0
  116. package/dist/hooks/use-file-upload/index.d.mts +47 -0
  117. package/dist/hooks/use-file-upload/index.d.ts +47 -0
  118. package/dist/hooks/use-file-upload/index.js +340 -0
  119. package/dist/hooks/use-file-upload/index.mjs +9 -0
  120. package/dist/hooks/use-file-upload/messages.d.mts +19 -0
  121. package/dist/hooks/use-file-upload/messages.d.ts +19 -0
  122. package/dist/hooks/use-file-upload/messages.js +48 -0
  123. package/dist/hooks/use-file-upload/messages.mjs +7 -0
  124. package/dist/index.d.mts +14 -8
  125. package/dist/index.d.ts +14 -8
  126. package/dist/index.js +1108 -32
  127. package/dist/index.mjs +82 -18
  128. package/dist/index.ts.backup.d.mts +14 -8
  129. package/dist/index.ts.backup.d.ts +14 -8
  130. package/dist/index.ts.backup.js +1108 -32
  131. package/dist/index.ts.backup.mjs +82 -18
  132. package/package.json +60 -64
@@ -0,0 +1,1137 @@
1
+ "use client";
2
+ "use strict";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/components/index.ts
22
+ var components_exports = {};
23
+ __export(components_exports, {
24
+ AvatarUpload: () => AvatarUpload,
25
+ Blankstate: () => Blankstate,
26
+ Code: () => Code,
27
+ Dialog: () => Dialog,
28
+ DialogBody: () => DialogBody,
29
+ DialogClose: () => DialogClose,
30
+ DialogCloseTrigger: () => DialogCloseTrigger,
31
+ DialogContent: () => DialogContent,
32
+ DialogDescription: () => DialogDescription,
33
+ DialogFooter: () => DialogFooter,
34
+ DialogHeader: () => DialogHeader,
35
+ DialogOverlay: () => DialogOverlay,
36
+ DialogPortal: () => DialogPortal,
37
+ DialogRoot: () => DialogRoot,
38
+ DialogTitle: () => DialogTitle,
39
+ DialogTrigger: () => DialogTrigger,
40
+ Skeleton: () => Skeleton,
41
+ SkeletonAvatar: () => SkeletonAvatar,
42
+ Stat: () => Stat,
43
+ StatDownIndicator: () => StatDownIndicator,
44
+ StatGroup: () => StatGroup,
45
+ StatHelpText: () => StatHelpText,
46
+ StatLabel: () => StatLabel,
47
+ StatRoot: () => StatRoot,
48
+ StatUpIndicator: () => StatUpIndicator,
49
+ StatValueText: () => StatValueText,
50
+ StatValueUnit: () => StatValueUnit,
51
+ Textarea: () => Textarea,
52
+ useDialogContext: () => useDialogContext
53
+ });
54
+ module.exports = __toCommonJS(components_exports);
55
+
56
+ // src/components/blankstate/blankstate.tsx
57
+ var import_shared_utils = require("@kopexa/shared-utils");
58
+ var import_theme = require("@kopexa/theme");
59
+ var import_jsx_runtime = require("react/jsx-runtime");
60
+ var Blankstate = (props) => {
61
+ const {
62
+ className,
63
+ children,
64
+ classNames,
65
+ icon,
66
+ title,
67
+ description,
68
+ size,
69
+ bordered,
70
+ narrow,
71
+ ...rest
72
+ } = props;
73
+ const styles = (0, import_theme.blankstate)({ size, bordered, narrow });
74
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
75
+ "div",
76
+ {
77
+ className: styles.root({ className: (0, import_shared_utils.cn)(classNames == null ? void 0 : classNames.root, className) }),
78
+ ...rest,
79
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: styles.container({ className: classNames == null ? void 0 : classNames.container }), children: [
80
+ icon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: styles.icon({ className: classNames == null ? void 0 : classNames.icon }), children: icon }),
81
+ title && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { className: styles.title({ className: classNames == null ? void 0 : classNames.title }), children: title }),
82
+ description && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
83
+ "div",
84
+ {
85
+ className: styles.description({
86
+ className: classNames == null ? void 0 : classNames.description
87
+ }),
88
+ children: description
89
+ }
90
+ ),
91
+ children && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: styles.actions({ className: classNames == null ? void 0 : classNames.actions }), children })
92
+ ] })
93
+ }
94
+ );
95
+ };
96
+
97
+ // src/components/code/code.tsx
98
+ var import_shared_utils2 = require("@kopexa/shared-utils");
99
+ var import_theme2 = require("@kopexa/theme");
100
+ var import_react = require("react");
101
+ var import_jsx_runtime2 = require("react/jsx-runtime");
102
+ var Code = (originalProps) => {
103
+ const [props, variantProps] = (0, import_shared_utils2.mapPropsVariants)(
104
+ originalProps,
105
+ import_theme2.code.variantKeys
106
+ );
107
+ const { children, className, ...otherProps } = props;
108
+ const styles = (0, import_react.useMemo)(
109
+ () => (0, import_theme2.code)({
110
+ ...variantProps,
111
+ className
112
+ }),
113
+ [(0, import_shared_utils2.objectToDeps)(variantProps), className]
114
+ );
115
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("code", { className: styles, ...otherProps, children });
116
+ };
117
+
118
+ // src/components/dialog/dialog.tsx
119
+ var import_dialog = require("@base-ui/react/dialog");
120
+ var import_icons = require("@kopexa/icons");
121
+ var import_react_utils = require("@kopexa/react-utils");
122
+ var import_shared_utils3 = require("@kopexa/shared-utils");
123
+ var import_theme3 = require("@kopexa/theme");
124
+ var import_use_controllable_state = require("@kopexa/use-controllable-state");
125
+ var import_jsx_runtime3 = require("react/jsx-runtime");
126
+ var [DialogProvider, useDialogContext] = (0, import_react_utils.createContext)();
127
+ var DialogRoot = (props) => {
128
+ const {
129
+ open: openProp,
130
+ onOpenChange,
131
+ size,
132
+ radius,
133
+ placement,
134
+ scrollBehavior,
135
+ ...restProps
136
+ } = props;
137
+ const [open, setOpen] = (0, import_use_controllable_state.useControllableState)({
138
+ value: openProp,
139
+ onChange: onOpenChange,
140
+ defaultValue: false
141
+ });
142
+ const styles = (0, import_theme3.dialog)({ size, radius, placement, scrollBehavior });
143
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(DialogProvider, { value: { styles, open, placement, size, radius }, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
144
+ import_dialog.Dialog.Root,
145
+ {
146
+ "data-slot": "dialog",
147
+ open,
148
+ onOpenChange: (open2) => setOpen(open2),
149
+ ...restProps
150
+ }
151
+ ) });
152
+ };
153
+ function DialogTrigger({ ...props }) {
154
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dialog.Dialog.Trigger, { "data-slot": "dialog-trigger", ...props });
155
+ }
156
+ function DialogPortal({ ...props }) {
157
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dialog.Dialog.Portal, { "data-slot": "dialog-portal", ...props });
158
+ }
159
+ function DialogClose({ ...props }) {
160
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dialog.Dialog.Close, { "data-slot": "dialog-close", ...props });
161
+ }
162
+ function DialogOverlay({ className, ...props }) {
163
+ const { styles } = useDialogContext();
164
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
165
+ import_dialog.Dialog.Backdrop,
166
+ {
167
+ "data-slot": "dialog-overlay",
168
+ className: (0, import_shared_utils3.cn)(styles.overlay(), className),
169
+ ...props
170
+ }
171
+ );
172
+ }
173
+ function DialogContent({
174
+ className,
175
+ children,
176
+ showCloseButton = true,
177
+ ...props
178
+ }) {
179
+ const { styles } = useDialogContext();
180
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(DialogPortal, { "data-slot": "dialog-portal", children: [
181
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(DialogOverlay, {}),
182
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
183
+ import_dialog.Dialog.Popup,
184
+ {
185
+ "data-slot": "dialog-content",
186
+ className: (0, import_shared_utils3.cn)(styles.content(), className),
187
+ ...props,
188
+ children: [
189
+ children,
190
+ showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
191
+ import_dialog.Dialog.Close,
192
+ {
193
+ "data-slot": "dialog-close",
194
+ className: styles.close(),
195
+ children: [
196
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons.CloseIcon, {}),
197
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "sr-only", children: "Close" })
198
+ ]
199
+ }
200
+ )
201
+ ]
202
+ }
203
+ )
204
+ ] });
205
+ }
206
+ function DialogHeader({ className, ...props }) {
207
+ const { styles } = useDialogContext();
208
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
209
+ "div",
210
+ {
211
+ "data-slot": "dialog-header",
212
+ className: styles.header({ className }),
213
+ ...props
214
+ }
215
+ );
216
+ }
217
+ function DialogFooter({ className, ...props }) {
218
+ const { styles } = useDialogContext();
219
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
220
+ "div",
221
+ {
222
+ "data-slot": "dialog-footer",
223
+ className: styles.footer({ className }),
224
+ ...props
225
+ }
226
+ );
227
+ }
228
+ function DialogBody({ className, ...props }) {
229
+ const { styles } = useDialogContext();
230
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
231
+ "div",
232
+ {
233
+ "data-slot": "dialog-body",
234
+ className: styles.body({ className }),
235
+ ...props
236
+ }
237
+ );
238
+ }
239
+ function DialogTitle({ className, ...props }) {
240
+ const { styles } = useDialogContext();
241
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
242
+ import_dialog.Dialog.Title,
243
+ {
244
+ "data-slot": "dialog-title",
245
+ className: (0, import_shared_utils3.cn)(styles.title(), className),
246
+ ...props
247
+ }
248
+ );
249
+ }
250
+ function DialogDescription({
251
+ className,
252
+ ...props
253
+ }) {
254
+ const { styles } = useDialogContext();
255
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
256
+ import_dialog.Dialog.Description,
257
+ {
258
+ "data-slot": "dialog-description",
259
+ className: (0, import_shared_utils3.cn)(styles.description(), className),
260
+ ...props
261
+ }
262
+ );
263
+ }
264
+ function DialogCloseTrigger({
265
+ className,
266
+ ...props
267
+ }) {
268
+ const { styles } = useDialogContext();
269
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
270
+ import_dialog.Dialog.Close,
271
+ {
272
+ "data-slot": "dialog-close-trigger",
273
+ className: (0, import_shared_utils3.cn)(styles.closeTrigger(), className),
274
+ ...props
275
+ }
276
+ );
277
+ }
278
+
279
+ // src/components/dialog/index.ts
280
+ var Dialog = Object.assign(DialogRoot, {
281
+ Root: DialogRoot,
282
+ Body: DialogBody,
283
+ CloseTrigger: DialogCloseTrigger,
284
+ Content: DialogContent,
285
+ Description: DialogDescription,
286
+ Footer: DialogFooter,
287
+ Header: DialogHeader,
288
+ Overlay: DialogOverlay,
289
+ Portal: DialogPortal,
290
+ Title: DialogTitle,
291
+ Trigger: DialogTrigger
292
+ });
293
+
294
+ // src/components/file-upload/avatar-upload.tsx
295
+ var import_button = require("@kopexa/button");
296
+ var import_callout = require("@kopexa/callout");
297
+ var import_i18n4 = require("@kopexa/i18n");
298
+ var import_icons2 = require("@kopexa/icons");
299
+ var import_image_crop = require("@kopexa/image-crop");
300
+ var import_shared_utils5 = require("@kopexa/shared-utils");
301
+ var import_theme4 = require("@kopexa/theme");
302
+ var import_react3 = require("react");
303
+
304
+ // src/hooks/use-file-upload/index.ts
305
+ var import_i18n2 = require("@kopexa/i18n");
306
+ var import_shared_utils4 = require("@kopexa/shared-utils");
307
+ var import_react2 = require("react");
308
+
309
+ // src/hooks/use-file-upload/messages.ts
310
+ var import_i18n = require("@kopexa/i18n");
311
+ var messages = (0, import_i18n.defineMessages)({
312
+ file_exceeds_max: {
313
+ id: "use_file_upload.file_exceeds_max",
314
+ defaultMessage: `File "{name}" exceeds the maximum size of {max}.`,
315
+ description: "Shown when a single file is larger than allowed"
316
+ },
317
+ file_not_accepted: {
318
+ id: "use_file_upload.file_not_accepted",
319
+ defaultMessage: `File "{name}" is not an accepted file type.`,
320
+ description: "Shown when file type/extension doesn't match accept"
321
+ },
322
+ too_many_files: {
323
+ id: "file_upload.too_many_files",
324
+ defaultMessage: "You can only upload a maximum of {max} files.",
325
+ description: "Shown when maxFiles would be exceeded"
326
+ }
327
+ });
328
+
329
+ // src/hooks/use-file-upload/index.ts
330
+ var useFileUpload = (options = {}) => {
331
+ const {
332
+ maxFiles = Number.POSITIVE_INFINITY,
333
+ maxSize = Number.POSITIVE_INFINITY,
334
+ accept = "*",
335
+ multiple = false,
336
+ initialFiles = [],
337
+ onFilesChange,
338
+ onFilesAdded,
339
+ onError
340
+ } = options;
341
+ const t = (0, import_i18n2.useSafeIntl)();
342
+ const [state, setState] = (0, import_react2.useState)({
343
+ files: initialFiles.map((file) => ({
344
+ file,
345
+ id: file.id,
346
+ preview: file.url
347
+ })),
348
+ isDragging: false,
349
+ errors: []
350
+ });
351
+ const inputRef = (0, import_react2.useRef)(null);
352
+ const validateFile = (0, import_react2.useCallback)(
353
+ (file) => {
354
+ if (file instanceof File) {
355
+ if (file.size > maxSize) {
356
+ return t.formatMessage(messages.file_exceeds_max, {
357
+ name: file.name,
358
+ max: (0, import_shared_utils4.formatBytes)(maxSize)
359
+ });
360
+ }
361
+ } else {
362
+ if (file.size > maxSize) {
363
+ return t.formatMessage(messages.file_exceeds_max, {
364
+ name: file.name,
365
+ max: (0, import_shared_utils4.formatBytes)(maxSize)
366
+ });
367
+ }
368
+ }
369
+ if (accept !== "*") {
370
+ const acceptedTypes = accept.split(",").map((type) => type.trim());
371
+ const fileType = file instanceof File ? file.type || "" : file.type;
372
+ const fileExtension = `.${file instanceof File ? file.name.split(".").pop() : file.name.split(".").pop()}`;
373
+ const isAccepted = acceptedTypes.some((type) => {
374
+ if (type.startsWith(".")) {
375
+ return fileExtension.toLowerCase() === type.toLowerCase();
376
+ }
377
+ if (type.endsWith("/*")) {
378
+ const baseType = type.split("/")[0];
379
+ return fileType.startsWith(`${baseType}/`);
380
+ }
381
+ return fileType === type;
382
+ });
383
+ if (!isAccepted) {
384
+ return t.formatMessage(messages.file_not_accepted, {
385
+ name: file instanceof File ? file.name : file.name
386
+ });
387
+ }
388
+ }
389
+ return null;
390
+ },
391
+ [accept, maxSize, t.formatMessage]
392
+ );
393
+ const createPreview = (0, import_react2.useCallback)(
394
+ (file) => {
395
+ if (file instanceof File) {
396
+ return URL.createObjectURL(file);
397
+ }
398
+ return file.url;
399
+ },
400
+ []
401
+ );
402
+ const generateUniqueId = (0, import_react2.useCallback)((file) => {
403
+ if (file instanceof File) {
404
+ return `${file.name}-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
405
+ }
406
+ return file.id;
407
+ }, []);
408
+ const clearFiles = (0, import_react2.useCallback)(() => {
409
+ setState((prev) => {
410
+ for (const file of prev.files) {
411
+ if (file.preview && file.file instanceof File && file.file.type.startsWith("image/")) {
412
+ URL.revokeObjectURL(file.preview);
413
+ }
414
+ }
415
+ if (inputRef.current) {
416
+ inputRef.current.value = "";
417
+ }
418
+ const newState = {
419
+ ...prev,
420
+ files: [],
421
+ errors: []
422
+ };
423
+ onFilesChange == null ? void 0 : onFilesChange(newState.files);
424
+ return newState;
425
+ });
426
+ }, [onFilesChange]);
427
+ const addFiles = (0, import_react2.useCallback)(
428
+ (newFiles) => {
429
+ if (!newFiles || newFiles.length === 0) return;
430
+ const newFilesArray = Array.from(newFiles);
431
+ const errors = [];
432
+ setState((prev) => ({ ...prev, errors: [] }));
433
+ if (!multiple) {
434
+ clearFiles();
435
+ }
436
+ if (multiple && maxFiles !== Number.POSITIVE_INFINITY && state.files.length + newFilesArray.length > maxFiles) {
437
+ errors.push(
438
+ t.formatMessage(messages.too_many_files, {
439
+ max: maxFiles
440
+ })
441
+ );
442
+ onError == null ? void 0 : onError(errors);
443
+ setState((prev) => ({ ...prev, errors }));
444
+ return;
445
+ }
446
+ const validFiles = [];
447
+ for (const file of newFilesArray) {
448
+ if (multiple) {
449
+ const isDuplicate = state.files.some(
450
+ (existingFile) => existingFile.file.name === file.name && existingFile.file.size === file.size
451
+ );
452
+ if (isDuplicate) {
453
+ return;
454
+ }
455
+ }
456
+ if (file.size > maxSize) {
457
+ errors.push(
458
+ multiple ? `Some files exceed the maximum size of ${(0, import_shared_utils4.formatBytes)(maxSize)}.` : `File exceeds the maximum size of ${(0, import_shared_utils4.formatBytes)(maxSize)}.`
459
+ );
460
+ continue;
461
+ }
462
+ const error = validateFile(file);
463
+ if (error) {
464
+ errors.push(error);
465
+ } else {
466
+ validFiles.push({
467
+ file,
468
+ id: generateUniqueId(file),
469
+ preview: createPreview(file)
470
+ });
471
+ }
472
+ }
473
+ if (validFiles.length > 0) {
474
+ onFilesAdded == null ? void 0 : onFilesAdded(validFiles);
475
+ setState((prev) => {
476
+ const newFiles2 = !multiple ? validFiles : [...prev.files, ...validFiles];
477
+ onFilesChange == null ? void 0 : onFilesChange(newFiles2);
478
+ return {
479
+ ...prev,
480
+ files: newFiles2,
481
+ errors
482
+ };
483
+ });
484
+ } else if (errors.length > 0) {
485
+ onError == null ? void 0 : onError(errors);
486
+ setState((prev) => ({
487
+ ...prev,
488
+ errors
489
+ }));
490
+ }
491
+ if (inputRef.current) {
492
+ inputRef.current.value = "";
493
+ }
494
+ },
495
+ [
496
+ onError,
497
+ state.files,
498
+ maxFiles,
499
+ multiple,
500
+ maxSize,
501
+ validateFile,
502
+ createPreview,
503
+ generateUniqueId,
504
+ clearFiles,
505
+ onFilesChange,
506
+ onFilesAdded,
507
+ t.formatMessage
508
+ ]
509
+ );
510
+ const removeFile = (0, import_react2.useCallback)(
511
+ (id) => {
512
+ setState((prev) => {
513
+ const fileToRemove = prev.files.find((file) => file.id === id);
514
+ if ((fileToRemove == null ? void 0 : fileToRemove.preview) && fileToRemove.file instanceof File && fileToRemove.file.type.startsWith("image/")) {
515
+ URL.revokeObjectURL(fileToRemove.preview);
516
+ }
517
+ const newFiles = prev.files.filter((file) => file.id !== id);
518
+ onFilesChange == null ? void 0 : onFilesChange(newFiles);
519
+ return {
520
+ ...prev,
521
+ files: newFiles,
522
+ errors: []
523
+ };
524
+ });
525
+ },
526
+ [onFilesChange]
527
+ );
528
+ const clearErrors = (0, import_react2.useCallback)(() => {
529
+ setState((prev) => ({
530
+ ...prev,
531
+ errors: []
532
+ }));
533
+ }, []);
534
+ const handleDragEnter = (0, import_react2.useCallback)((e) => {
535
+ e.preventDefault();
536
+ e.stopPropagation();
537
+ setState((prev) => ({ ...prev, isDragging: true }));
538
+ }, []);
539
+ const handleDragLeave = (0, import_react2.useCallback)((e) => {
540
+ e.preventDefault();
541
+ e.stopPropagation();
542
+ if (e.currentTarget.contains(e.relatedTarget)) {
543
+ return;
544
+ }
545
+ setState((prev) => ({ ...prev, isDragging: false }));
546
+ }, []);
547
+ const handleDragOver = (0, import_react2.useCallback)((e) => {
548
+ e.preventDefault();
549
+ e.stopPropagation();
550
+ }, []);
551
+ const handleDrop = (0, import_react2.useCallback)(
552
+ (e) => {
553
+ var _a;
554
+ e.preventDefault();
555
+ e.stopPropagation();
556
+ setState((prev) => ({ ...prev, isDragging: false }));
557
+ if ((_a = inputRef.current) == null ? void 0 : _a.disabled) {
558
+ return;
559
+ }
560
+ if (e.dataTransfer.files && e.dataTransfer.files.length > 0) {
561
+ if (!multiple) {
562
+ const file = e.dataTransfer.files[0];
563
+ addFiles([file]);
564
+ } else {
565
+ addFiles(e.dataTransfer.files);
566
+ }
567
+ }
568
+ },
569
+ [addFiles, multiple]
570
+ );
571
+ const handleFileChange = (0, import_react2.useCallback)(
572
+ (e) => {
573
+ if (e.target.files && e.target.files.length > 0) {
574
+ addFiles(e.target.files);
575
+ }
576
+ },
577
+ [addFiles]
578
+ );
579
+ const openFileDialog = (0, import_react2.useCallback)(() => {
580
+ if (inputRef.current) {
581
+ inputRef.current.click();
582
+ }
583
+ }, []);
584
+ const getInputProps = (0, import_react2.useCallback)(
585
+ (props = {}) => {
586
+ return {
587
+ ...props,
588
+ type: "file",
589
+ onChange: handleFileChange,
590
+ accept: props.accept || accept,
591
+ multiple: props.multiple !== void 0 ? props.multiple : multiple,
592
+ ref: inputRef
593
+ };
594
+ },
595
+ [accept, multiple, handleFileChange]
596
+ );
597
+ return [
598
+ state,
599
+ {
600
+ addFiles,
601
+ removeFile,
602
+ clearFiles,
603
+ clearErrors,
604
+ handleDragEnter,
605
+ handleDragLeave,
606
+ handleDragOver,
607
+ handleDrop,
608
+ handleFileChange,
609
+ openFileDialog,
610
+ getInputProps
611
+ }
612
+ ];
613
+ };
614
+
615
+ // src/components/file-upload/messages.ts
616
+ var import_i18n3 = require("@kopexa/i18n");
617
+ var messages2 = (0, import_i18n3.defineMessages)({
618
+ change_avatar: {
619
+ id: "file_upload.change_avatar",
620
+ defaultMessage: "Change Avatar",
621
+ description: "Label for changing the avatar image"
622
+ },
623
+ upload_avatar: {
624
+ id: "file_upload.upload_avatar",
625
+ defaultMessage: "Upload Avatar",
626
+ description: "Label for uploading a new avatar image"
627
+ },
628
+ remove_avatar: {
629
+ id: "file_upload.remove_avatar",
630
+ defaultMessage: "Remove Avatar",
631
+ description: "Label for removing the current avatar image"
632
+ },
633
+ avatar_uploaded: {
634
+ id: "file_upload.avatar_uploaded",
635
+ defaultMessage: "Avatar uploaded",
636
+ description: "Message displayed when the avatar is uploaded successfully"
637
+ },
638
+ accepted_file_types: {
639
+ id: "file_upload.accepted_file_types",
640
+ defaultMessage: "{types}{size, select, none {} other { up to {size}}}",
641
+ description: "Message indicating the accepted file types for upload"
642
+ },
643
+ cancel: {
644
+ id: "file_upload.cancel",
645
+ defaultMessage: "Cancel",
646
+ description: "Label for canceling the file upload"
647
+ },
648
+ apply_crop: {
649
+ id: "file_upload.apply_crop",
650
+ defaultMessage: "Apply",
651
+ description: "Label for applying the crop to the image"
652
+ }
653
+ });
654
+
655
+ // src/components/file-upload/utils/data-url-to-file.ts
656
+ async function dataUrlToFile(dataUrl, fileName, typeHint) {
657
+ const res = await fetch(dataUrl);
658
+ const blob = await res.blob();
659
+ const type = typeHint || blob.type || "image/png";
660
+ const ext = type.includes("jpeg") ? "jpg" : type.split("/")[1] || "png";
661
+ const safeName = fileName.replace(/\.[^.]+$/, "");
662
+ return new File([blob], `${safeName}-cropped.${ext}`, { type });
663
+ }
664
+
665
+ // src/components/file-upload/utils/format-accept-types.ts
666
+ var WILDCARD_GROUPS = {
667
+ "image/*": "common image formats",
668
+ "audio/*": "common audio formats",
669
+ "video/*": "common video formats",
670
+ "application/*": "common document formats"
671
+ };
672
+ var MIME_TO_LABEL = {
673
+ "image/png": "PNG",
674
+ "image/jpeg": "JPG",
675
+ "image/jpg": "JPG",
676
+ "application/pdf": "PDF",
677
+ "text/csv": "CSV",
678
+ "text/plain": "TXT"
679
+ };
680
+ var EXT_TO_LABEL = {
681
+ ".png": "PNG",
682
+ ".jpg": "JPG",
683
+ ".jpeg": "JPG",
684
+ ".pdf": "PDF",
685
+ ".csv": "CSV",
686
+ ".txt": "TXT"
687
+ };
688
+ function normalizeToken(token) {
689
+ return token.trim().toLowerCase();
690
+ }
691
+ function formatAcceptedTypes(accept) {
692
+ var _a, _b;
693
+ if (!accept || typeof accept !== "string") return "";
694
+ const tokens = accept.split(",").map(normalizeToken).filter(Boolean);
695
+ const labels = [];
696
+ for (const token of tokens) {
697
+ if (WILDCARD_GROUPS[token]) {
698
+ labels.push(WILDCARD_GROUPS[token]);
699
+ continue;
700
+ }
701
+ if (token.startsWith(".")) {
702
+ labels.push(
703
+ (_a = EXT_TO_LABEL[token]) != null ? _a : token.replace(/^\./, "").toUpperCase()
704
+ );
705
+ continue;
706
+ }
707
+ if (token.includes("/")) {
708
+ labels.push((_b = MIME_TO_LABEL[token]) != null ? _b : token.split("/")[1].toUpperCase());
709
+ }
710
+ }
711
+ const seen = /* @__PURE__ */ new Set();
712
+ return labels.filter((x) => {
713
+ if (seen.has(x)) return false;
714
+ seen.add(x);
715
+ return true;
716
+ }).join(", ");
717
+ }
718
+
719
+ // src/components/file-upload/utils/is-image-like.ts
720
+ function isImageLike(file) {
721
+ var _a, _b;
722
+ if ((_a = file.type) == null ? void 0 : _a.startsWith("image/")) return true;
723
+ const name = ((_b = file.name) == null ? void 0 : _b.toLowerCase()) || "";
724
+ return name.endsWith(".png") || name.endsWith(".jpg") || name.endsWith(".jpeg") || name.endsWith(".webp");
725
+ }
726
+
727
+ // src/components/file-upload/avatar-upload.tsx
728
+ var import_jsx_runtime4 = require("react/jsx-runtime");
729
+ var defaultMaxSize = 2 * 1024 * 1024;
730
+ var AvatarUpload = (props) => {
731
+ const {
732
+ maxSize = defaultMaxSize,
733
+ className,
734
+ onFileChange,
735
+ defaultAvatar,
736
+ orientation,
737
+ size,
738
+ shape,
739
+ accept = ".png,.jpg",
740
+ cropperEnabled = true,
741
+ cropAspect = 1,
742
+ cropMaxImageSize = defaultMaxSize,
743
+ onCroppedFile,
744
+ ...rest
745
+ } = props;
746
+ const t = (0, import_i18n4.useSafeIntl)();
747
+ const [cropOpen, setCropOpen] = (0, import_react3.useState)(false);
748
+ const [cropSourceFile, setCropSourceFile] = (0, import_react3.useState)(null);
749
+ const pendingOriginalId = (0, import_react3.useRef)(null);
750
+ const [
751
+ { files, isDragging, errors },
752
+ {
753
+ removeFile,
754
+ handleDragEnter,
755
+ handleDragLeave,
756
+ handleDragOver,
757
+ handleDrop,
758
+ openFileDialog,
759
+ getInputProps,
760
+ clearErrors,
761
+ addFiles
762
+ }
763
+ ] = useFileUpload({
764
+ maxFiles: 1,
765
+ maxSize,
766
+ accept,
767
+ multiple: false,
768
+ onFilesChange: (files2) => {
769
+ onFileChange == null ? void 0 : onFileChange(files2[0] || null);
770
+ },
771
+ onFilesAdded: (added) => {
772
+ var _a;
773
+ if (!cropperEnabled) return;
774
+ const raw = (_a = added[0]) == null ? void 0 : _a.file;
775
+ if (raw instanceof File && isImageLike(raw)) {
776
+ pendingOriginalId.current = added[0].id;
777
+ setCropSourceFile(raw);
778
+ setCropOpen(true);
779
+ }
780
+ }
781
+ });
782
+ const currentFile = files[0];
783
+ const previewUrl = (currentFile == null ? void 0 : currentFile.preview) || defaultAvatar;
784
+ const handleRemove = () => {
785
+ if (currentFile) {
786
+ removeFile(currentFile.id);
787
+ clearErrors();
788
+ }
789
+ };
790
+ const styles = (0, import_theme4.avatarUpload)({
791
+ size,
792
+ shape,
793
+ orientation
794
+ });
795
+ const typesLabel = formatAcceptedTypes(accept);
796
+ const handleCropCancel = (0, import_react3.useCallback)(() => {
797
+ setCropOpen(false);
798
+ setCropSourceFile(null);
799
+ pendingOriginalId.current = null;
800
+ }, []);
801
+ const handleCropApply = (0, import_react3.useCallback)(
802
+ async (croppedDataUrl) => {
803
+ if (!croppedDataUrl || !cropSourceFile) {
804
+ handleCropCancel();
805
+ return;
806
+ }
807
+ const newFile = await dataUrlToFile(
808
+ croppedDataUrl,
809
+ cropSourceFile.name,
810
+ cropSourceFile.type
811
+ );
812
+ if (pendingOriginalId.current) {
813
+ removeFile(pendingOriginalId.current);
814
+ pendingOriginalId.current = null;
815
+ }
816
+ addFiles([newFile]);
817
+ onCroppedFile == null ? void 0 : onCroppedFile(newFile);
818
+ setCropOpen(false);
819
+ setCropSourceFile(null);
820
+ },
821
+ [cropSourceFile, addFiles, removeFile, onCroppedFile, handleCropCancel]
822
+ );
823
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
824
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
825
+ "div",
826
+ {
827
+ "data-slot": "avatar-upload",
828
+ className: styles.root({ className }),
829
+ ...rest,
830
+ children: [
831
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: styles.previewAndText(), children: [
832
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: styles.previewContainer(), children: [
833
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
834
+ "button",
835
+ {
836
+ type: "button",
837
+ "aria-label": previewUrl ? t.formatMessage(messages2.change_avatar) : t.formatMessage(messages2.upload_avatar),
838
+ "data-dragging": (0, import_shared_utils5.dataAttr)(isDragging),
839
+ "data-hasimage": (0, import_shared_utils5.dataAttr)(!!previewUrl),
840
+ className: styles.preview(),
841
+ onDragEnter: handleDragEnter,
842
+ onDragLeave: handleDragLeave,
843
+ onDragOver: handleDragOver,
844
+ onDrop: handleDrop,
845
+ onClick: openFileDialog,
846
+ children: [
847
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", { ...getInputProps(), className: "sr-only" }),
848
+ previewUrl ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
849
+ "img",
850
+ {
851
+ src: previewUrl,
852
+ alt: "Avatar",
853
+ className: styles.previewImg()
854
+ }
855
+ ) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: styles.placeholderWrapper(), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons2.UserCircleIcon, { className: styles.placeholder() }) })
856
+ ]
857
+ }
858
+ ),
859
+ currentFile && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
860
+ import_button.IconButton,
861
+ {
862
+ variant: "outline",
863
+ color: "default",
864
+ onClick: handleRemove,
865
+ size: "sm",
866
+ className: styles.removeButton(),
867
+ "aria-label": t.formatMessage(messages2.remove_avatar),
868
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons2.CloseIcon, {})
869
+ }
870
+ )
871
+ ] }),
872
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: styles.instructionsContainer(), children: [
873
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: styles.instructions(), children: currentFile ? t.formatMessage(messages2.avatar_uploaded) : t.formatMessage(messages2.upload_avatar) }),
874
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: styles.acceptedFiles(), children: t.formatMessage(messages2.accepted_file_types, {
875
+ types: typesLabel || "-",
876
+ size: maxSize ? (0, import_shared_utils5.formatBytes)(maxSize) : "none"
877
+ }) })
878
+ ] })
879
+ ] }),
880
+ errors.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_callout.Callout, { variant: "destructive", children: errors.map((error, index) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: styles.errorItem(), children: error }, index.toString())) })
881
+ ]
882
+ }
883
+ ),
884
+ cropperEnabled && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
885
+ Dialog.Root,
886
+ {
887
+ open: cropOpen,
888
+ onOpenChange: (v) => !v ? handleCropCancel() : null,
889
+ size: "2xl",
890
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Dialog.Content, { children: [
891
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Dialog.Header, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Dialog.Title, { children: t.formatMessage(messages2.change_avatar) }) }),
892
+ cropSourceFile && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
893
+ import_image_crop.ImageCrop,
894
+ {
895
+ aspect: cropAspect,
896
+ file: cropSourceFile,
897
+ maxImageSize: cropMaxImageSize,
898
+ onCrop: handleCropApply,
899
+ children: [
900
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Dialog.Body, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_image_crop.ImageCropContent, { className: "max-w-md" }) }),
901
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Dialog.Footer, { children: [
902
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
903
+ Dialog.CloseTrigger,
904
+ {
905
+ render: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
906
+ import_button.Button,
907
+ {
908
+ variant: "ghost",
909
+ color: "default",
910
+ startContent: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons2.CloseIcon, {}),
911
+ children: t.formatMessage(messages2.cancel)
912
+ }
913
+ )
914
+ }
915
+ ),
916
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
917
+ import_image_crop.ImageCropApply,
918
+ {
919
+ color: "primary",
920
+ variant: "solid",
921
+ render: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_button.Button, { startContent: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons2.CropIcon, {}), children: t.formatMessage(messages2.apply_crop) })
922
+ }
923
+ )
924
+ ] })
925
+ ]
926
+ }
927
+ )
928
+ ] })
929
+ }
930
+ )
931
+ ] });
932
+ };
933
+
934
+ // src/components/skeleton/skeleton.tsx
935
+ var import_theme5 = require("@kopexa/theme");
936
+ var import_jsx_runtime5 = require("react/jsx-runtime");
937
+ var Skeleton = (props) => {
938
+ const { className, children, ...rest } = props;
939
+ const styles = (0, import_theme5.skeleton)({
940
+ className
941
+ });
942
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: styles, ...rest, children });
943
+ };
944
+
945
+ // src/components/skeleton/skeleton-avatar.tsx
946
+ var import_shared_utils6 = require("@kopexa/shared-utils");
947
+ var import_theme6 = require("@kopexa/theme");
948
+ var import_jsx_runtime6 = require("react/jsx-runtime");
949
+ var SkeletonAvatar = (props) => {
950
+ const { size, className, ...restProps } = props;
951
+ const baseStyle = (0, import_theme6.skeletonAvatar)({ size });
952
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Skeleton, { ...restProps, className: (0, import_shared_utils6.cn)(baseStyle, className) });
953
+ };
954
+
955
+ // src/components/stat/stat.tsx
956
+ var import_icons3 = require("@kopexa/icons");
957
+ var import_shared_utils7 = require("@kopexa/shared-utils");
958
+ var import_theme7 = require("@kopexa/theme");
959
+ var import_jsx_runtime7 = require("react/jsx-runtime");
960
+ function StatRoot({
961
+ className,
962
+ size,
963
+ trend,
964
+ children,
965
+ ...props
966
+ }) {
967
+ const styles = (0, import_theme7.stat)({ size, trend });
968
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("dl", { "data-slot": "stat", className: (0, import_shared_utils7.cn)(styles.root(), className), ...props, children });
969
+ }
970
+ function StatLabel({ className, children, ...props }) {
971
+ const styles = (0, import_theme7.stat)();
972
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
973
+ "dt",
974
+ {
975
+ "data-slot": "stat-label",
976
+ className: (0, import_shared_utils7.cn)(styles.label(), className),
977
+ ...props,
978
+ children
979
+ }
980
+ );
981
+ }
982
+ function StatValueText({
983
+ className,
984
+ size,
985
+ children,
986
+ ...props
987
+ }) {
988
+ const styles = (0, import_theme7.stat)({ size });
989
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
990
+ "dd",
991
+ {
992
+ "data-slot": "stat-value",
993
+ className: (0, import_shared_utils7.cn)(styles.valueText(), className),
994
+ ...props,
995
+ children
996
+ }
997
+ );
998
+ }
999
+ function StatValueUnit({
1000
+ className,
1001
+ children,
1002
+ ...props
1003
+ }) {
1004
+ const styles = (0, import_theme7.stat)();
1005
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1006
+ "span",
1007
+ {
1008
+ "data-slot": "stat-value-unit",
1009
+ className: (0, import_shared_utils7.cn)(styles.valueUnit(), className),
1010
+ ...props,
1011
+ children
1012
+ }
1013
+ );
1014
+ }
1015
+ function StatHelpText({
1016
+ className,
1017
+ children,
1018
+ ...props
1019
+ }) {
1020
+ const styles = (0, import_theme7.stat)();
1021
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1022
+ "span",
1023
+ {
1024
+ "data-slot": "stat-help-text",
1025
+ className: (0, import_shared_utils7.cn)(styles.helpText(), className),
1026
+ ...props,
1027
+ children
1028
+ }
1029
+ );
1030
+ }
1031
+ function StatUpIndicator({
1032
+ className,
1033
+ icon,
1034
+ children,
1035
+ ...props
1036
+ }) {
1037
+ const styles = (0, import_theme7.stat)({ trend: "up" });
1038
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1039
+ "span",
1040
+ {
1041
+ "data-slot": "stat-indicator",
1042
+ "data-type": "up",
1043
+ className: (0, import_shared_utils7.cn)(styles.indicator(), className),
1044
+ ...props,
1045
+ children: [
1046
+ icon != null ? icon : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_icons3.ArrowUp, {}),
1047
+ children
1048
+ ]
1049
+ }
1050
+ );
1051
+ }
1052
+ function StatDownIndicator({
1053
+ className,
1054
+ icon,
1055
+ children,
1056
+ ...props
1057
+ }) {
1058
+ const styles = (0, import_theme7.stat)({ trend: "down" });
1059
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1060
+ "span",
1061
+ {
1062
+ "data-slot": "stat-indicator",
1063
+ "data-type": "down",
1064
+ className: (0, import_shared_utils7.cn)(styles.indicator(), className),
1065
+ ...props,
1066
+ children: [
1067
+ icon != null ? icon : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_icons3.ArrowDown, {}),
1068
+ children
1069
+ ]
1070
+ }
1071
+ );
1072
+ }
1073
+ function StatGroup({ className, children, ...props }) {
1074
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1075
+ "div",
1076
+ {
1077
+ "data-slot": "stat-group",
1078
+ className: (0, import_shared_utils7.cn)("flex flex-wrap justify-around gap-4", className),
1079
+ ...props,
1080
+ children
1081
+ }
1082
+ );
1083
+ }
1084
+ var Stat = Object.assign(StatRoot, {
1085
+ Root: StatRoot,
1086
+ Label: StatLabel,
1087
+ ValueText: StatValueText,
1088
+ ValueUnit: StatValueUnit,
1089
+ HelpText: StatHelpText,
1090
+ UpIndicator: StatUpIndicator,
1091
+ DownIndicator: StatDownIndicator,
1092
+ Group: StatGroup
1093
+ });
1094
+
1095
+ // src/components/textarea/textarea.tsx
1096
+ var import_theme8 = require("@kopexa/theme");
1097
+ var import_jsx_runtime8 = require("react/jsx-runtime");
1098
+ var Textarea = (props) => {
1099
+ const { className, size, ...rest } = props;
1100
+ const styles = (0, import_theme8.textarea)({
1101
+ className,
1102
+ size
1103
+ });
1104
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("textarea", { "data-slot": "textarea", className: styles, ...rest });
1105
+ };
1106
+ // Annotate the CommonJS export names for ESM import in node:
1107
+ 0 && (module.exports = {
1108
+ AvatarUpload,
1109
+ Blankstate,
1110
+ Code,
1111
+ Dialog,
1112
+ DialogBody,
1113
+ DialogClose,
1114
+ DialogCloseTrigger,
1115
+ DialogContent,
1116
+ DialogDescription,
1117
+ DialogFooter,
1118
+ DialogHeader,
1119
+ DialogOverlay,
1120
+ DialogPortal,
1121
+ DialogRoot,
1122
+ DialogTitle,
1123
+ DialogTrigger,
1124
+ Skeleton,
1125
+ SkeletonAvatar,
1126
+ Stat,
1127
+ StatDownIndicator,
1128
+ StatGroup,
1129
+ StatHelpText,
1130
+ StatLabel,
1131
+ StatRoot,
1132
+ StatUpIndicator,
1133
+ StatValueText,
1134
+ StatValueUnit,
1135
+ Textarea,
1136
+ useDialogContext
1137
+ });