@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,47 @@
1
+ import React, { DragEvent, ChangeEvent, InputHTMLAttributes } from 'react';
2
+
3
+ type FileMetadata = {
4
+ name: string;
5
+ size: number;
6
+ type: string;
7
+ url: string;
8
+ id: string;
9
+ };
10
+ type FileWithPreview = {
11
+ file: File | FileMetadata;
12
+ id: string;
13
+ preview?: string;
14
+ };
15
+ type FileUploadOptions = {
16
+ maxFiles?: number;
17
+ maxSize?: number;
18
+ accept?: string;
19
+ multiple?: boolean;
20
+ initialFiles?: FileMetadata[];
21
+ onFilesChange?: (files: FileWithPreview[]) => void;
22
+ onFilesAdded?: (addedFiles: FileWithPreview[]) => void;
23
+ onError?: (errors: string[]) => void;
24
+ };
25
+ type FileUploadState = {
26
+ files: FileWithPreview[];
27
+ isDragging: boolean;
28
+ errors: string[];
29
+ };
30
+ type FileUploadActions = {
31
+ addFiles: (files: FileList | File[]) => void;
32
+ removeFile: (id: string) => void;
33
+ clearFiles: () => void;
34
+ clearErrors: () => void;
35
+ handleDragEnter: (e: DragEvent<HTMLElement>) => void;
36
+ handleDragLeave: (e: DragEvent<HTMLElement>) => void;
37
+ handleDragOver: (e: DragEvent<HTMLElement>) => void;
38
+ handleDrop: (e: DragEvent<HTMLElement>) => void;
39
+ handleFileChange: (e: ChangeEvent<HTMLInputElement>) => void;
40
+ openFileDialog: () => void;
41
+ getInputProps: (props?: InputHTMLAttributes<HTMLInputElement>) => InputHTMLAttributes<HTMLInputElement> & {
42
+ ref: React.Ref<HTMLInputElement>;
43
+ };
44
+ };
45
+ declare const useFileUpload: (options?: FileUploadOptions) => [FileUploadState, FileUploadActions];
46
+
47
+ export { type FileMetadata, type FileUploadActions, type FileUploadOptions, type FileUploadState, type FileWithPreview, useFileUpload };
@@ -0,0 +1,47 @@
1
+ import React, { DragEvent, ChangeEvent, InputHTMLAttributes } from 'react';
2
+
3
+ type FileMetadata = {
4
+ name: string;
5
+ size: number;
6
+ type: string;
7
+ url: string;
8
+ id: string;
9
+ };
10
+ type FileWithPreview = {
11
+ file: File | FileMetadata;
12
+ id: string;
13
+ preview?: string;
14
+ };
15
+ type FileUploadOptions = {
16
+ maxFiles?: number;
17
+ maxSize?: number;
18
+ accept?: string;
19
+ multiple?: boolean;
20
+ initialFiles?: FileMetadata[];
21
+ onFilesChange?: (files: FileWithPreview[]) => void;
22
+ onFilesAdded?: (addedFiles: FileWithPreview[]) => void;
23
+ onError?: (errors: string[]) => void;
24
+ };
25
+ type FileUploadState = {
26
+ files: FileWithPreview[];
27
+ isDragging: boolean;
28
+ errors: string[];
29
+ };
30
+ type FileUploadActions = {
31
+ addFiles: (files: FileList | File[]) => void;
32
+ removeFile: (id: string) => void;
33
+ clearFiles: () => void;
34
+ clearErrors: () => void;
35
+ handleDragEnter: (e: DragEvent<HTMLElement>) => void;
36
+ handleDragLeave: (e: DragEvent<HTMLElement>) => void;
37
+ handleDragOver: (e: DragEvent<HTMLElement>) => void;
38
+ handleDrop: (e: DragEvent<HTMLElement>) => void;
39
+ handleFileChange: (e: ChangeEvent<HTMLInputElement>) => void;
40
+ openFileDialog: () => void;
41
+ getInputProps: (props?: InputHTMLAttributes<HTMLInputElement>) => InputHTMLAttributes<HTMLInputElement> & {
42
+ ref: React.Ref<HTMLInputElement>;
43
+ };
44
+ };
45
+ declare const useFileUpload: (options?: FileUploadOptions) => [FileUploadState, FileUploadActions];
46
+
47
+ export { type FileMetadata, type FileUploadActions, type FileUploadOptions, type FileUploadState, type FileWithPreview, useFileUpload };
@@ -0,0 +1,340 @@
1
+ "use client";
2
+ "use strict";
3
+ "use client";
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+
22
+ // src/hooks/use-file-upload/index.ts
23
+ var use_file_upload_exports = {};
24
+ __export(use_file_upload_exports, {
25
+ useFileUpload: () => useFileUpload
26
+ });
27
+ module.exports = __toCommonJS(use_file_upload_exports);
28
+ var import_i18n2 = require("@kopexa/i18n");
29
+ var import_shared_utils = require("@kopexa/shared-utils");
30
+ var import_react = require("react");
31
+
32
+ // src/hooks/use-file-upload/messages.ts
33
+ var import_i18n = require("@kopexa/i18n");
34
+ var messages = (0, import_i18n.defineMessages)({
35
+ file_exceeds_max: {
36
+ id: "use_file_upload.file_exceeds_max",
37
+ defaultMessage: `File "{name}" exceeds the maximum size of {max}.`,
38
+ description: "Shown when a single file is larger than allowed"
39
+ },
40
+ file_not_accepted: {
41
+ id: "use_file_upload.file_not_accepted",
42
+ defaultMessage: `File "{name}" is not an accepted file type.`,
43
+ description: "Shown when file type/extension doesn't match accept"
44
+ },
45
+ too_many_files: {
46
+ id: "file_upload.too_many_files",
47
+ defaultMessage: "You can only upload a maximum of {max} files.",
48
+ description: "Shown when maxFiles would be exceeded"
49
+ }
50
+ });
51
+
52
+ // src/hooks/use-file-upload/index.ts
53
+ var useFileUpload = (options = {}) => {
54
+ const {
55
+ maxFiles = Number.POSITIVE_INFINITY,
56
+ maxSize = Number.POSITIVE_INFINITY,
57
+ accept = "*",
58
+ multiple = false,
59
+ initialFiles = [],
60
+ onFilesChange,
61
+ onFilesAdded,
62
+ onError
63
+ } = options;
64
+ const t = (0, import_i18n2.useSafeIntl)();
65
+ const [state, setState] = (0, import_react.useState)({
66
+ files: initialFiles.map((file) => ({
67
+ file,
68
+ id: file.id,
69
+ preview: file.url
70
+ })),
71
+ isDragging: false,
72
+ errors: []
73
+ });
74
+ const inputRef = (0, import_react.useRef)(null);
75
+ const validateFile = (0, import_react.useCallback)(
76
+ (file) => {
77
+ if (file instanceof File) {
78
+ if (file.size > maxSize) {
79
+ return t.formatMessage(messages.file_exceeds_max, {
80
+ name: file.name,
81
+ max: (0, import_shared_utils.formatBytes)(maxSize)
82
+ });
83
+ }
84
+ } else {
85
+ if (file.size > maxSize) {
86
+ return t.formatMessage(messages.file_exceeds_max, {
87
+ name: file.name,
88
+ max: (0, import_shared_utils.formatBytes)(maxSize)
89
+ });
90
+ }
91
+ }
92
+ if (accept !== "*") {
93
+ const acceptedTypes = accept.split(",").map((type) => type.trim());
94
+ const fileType = file instanceof File ? file.type || "" : file.type;
95
+ const fileExtension = `.${file instanceof File ? file.name.split(".").pop() : file.name.split(".").pop()}`;
96
+ const isAccepted = acceptedTypes.some((type) => {
97
+ if (type.startsWith(".")) {
98
+ return fileExtension.toLowerCase() === type.toLowerCase();
99
+ }
100
+ if (type.endsWith("/*")) {
101
+ const baseType = type.split("/")[0];
102
+ return fileType.startsWith(`${baseType}/`);
103
+ }
104
+ return fileType === type;
105
+ });
106
+ if (!isAccepted) {
107
+ return t.formatMessage(messages.file_not_accepted, {
108
+ name: file instanceof File ? file.name : file.name
109
+ });
110
+ }
111
+ }
112
+ return null;
113
+ },
114
+ [accept, maxSize, t.formatMessage]
115
+ );
116
+ const createPreview = (0, import_react.useCallback)(
117
+ (file) => {
118
+ if (file instanceof File) {
119
+ return URL.createObjectURL(file);
120
+ }
121
+ return file.url;
122
+ },
123
+ []
124
+ );
125
+ const generateUniqueId = (0, import_react.useCallback)((file) => {
126
+ if (file instanceof File) {
127
+ return `${file.name}-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
128
+ }
129
+ return file.id;
130
+ }, []);
131
+ const clearFiles = (0, import_react.useCallback)(() => {
132
+ setState((prev) => {
133
+ for (const file of prev.files) {
134
+ if (file.preview && file.file instanceof File && file.file.type.startsWith("image/")) {
135
+ URL.revokeObjectURL(file.preview);
136
+ }
137
+ }
138
+ if (inputRef.current) {
139
+ inputRef.current.value = "";
140
+ }
141
+ const newState = {
142
+ ...prev,
143
+ files: [],
144
+ errors: []
145
+ };
146
+ onFilesChange == null ? void 0 : onFilesChange(newState.files);
147
+ return newState;
148
+ });
149
+ }, [onFilesChange]);
150
+ const addFiles = (0, import_react.useCallback)(
151
+ (newFiles) => {
152
+ if (!newFiles || newFiles.length === 0) return;
153
+ const newFilesArray = Array.from(newFiles);
154
+ const errors = [];
155
+ setState((prev) => ({ ...prev, errors: [] }));
156
+ if (!multiple) {
157
+ clearFiles();
158
+ }
159
+ if (multiple && maxFiles !== Number.POSITIVE_INFINITY && state.files.length + newFilesArray.length > maxFiles) {
160
+ errors.push(
161
+ t.formatMessage(messages.too_many_files, {
162
+ max: maxFiles
163
+ })
164
+ );
165
+ onError == null ? void 0 : onError(errors);
166
+ setState((prev) => ({ ...prev, errors }));
167
+ return;
168
+ }
169
+ const validFiles = [];
170
+ for (const file of newFilesArray) {
171
+ if (multiple) {
172
+ const isDuplicate = state.files.some(
173
+ (existingFile) => existingFile.file.name === file.name && existingFile.file.size === file.size
174
+ );
175
+ if (isDuplicate) {
176
+ return;
177
+ }
178
+ }
179
+ if (file.size > maxSize) {
180
+ errors.push(
181
+ multiple ? `Some files exceed the maximum size of ${(0, import_shared_utils.formatBytes)(maxSize)}.` : `File exceeds the maximum size of ${(0, import_shared_utils.formatBytes)(maxSize)}.`
182
+ );
183
+ continue;
184
+ }
185
+ const error = validateFile(file);
186
+ if (error) {
187
+ errors.push(error);
188
+ } else {
189
+ validFiles.push({
190
+ file,
191
+ id: generateUniqueId(file),
192
+ preview: createPreview(file)
193
+ });
194
+ }
195
+ }
196
+ if (validFiles.length > 0) {
197
+ onFilesAdded == null ? void 0 : onFilesAdded(validFiles);
198
+ setState((prev) => {
199
+ const newFiles2 = !multiple ? validFiles : [...prev.files, ...validFiles];
200
+ onFilesChange == null ? void 0 : onFilesChange(newFiles2);
201
+ return {
202
+ ...prev,
203
+ files: newFiles2,
204
+ errors
205
+ };
206
+ });
207
+ } else if (errors.length > 0) {
208
+ onError == null ? void 0 : onError(errors);
209
+ setState((prev) => ({
210
+ ...prev,
211
+ errors
212
+ }));
213
+ }
214
+ if (inputRef.current) {
215
+ inputRef.current.value = "";
216
+ }
217
+ },
218
+ [
219
+ onError,
220
+ state.files,
221
+ maxFiles,
222
+ multiple,
223
+ maxSize,
224
+ validateFile,
225
+ createPreview,
226
+ generateUniqueId,
227
+ clearFiles,
228
+ onFilesChange,
229
+ onFilesAdded,
230
+ t.formatMessage
231
+ ]
232
+ );
233
+ const removeFile = (0, import_react.useCallback)(
234
+ (id) => {
235
+ setState((prev) => {
236
+ const fileToRemove = prev.files.find((file) => file.id === id);
237
+ if ((fileToRemove == null ? void 0 : fileToRemove.preview) && fileToRemove.file instanceof File && fileToRemove.file.type.startsWith("image/")) {
238
+ URL.revokeObjectURL(fileToRemove.preview);
239
+ }
240
+ const newFiles = prev.files.filter((file) => file.id !== id);
241
+ onFilesChange == null ? void 0 : onFilesChange(newFiles);
242
+ return {
243
+ ...prev,
244
+ files: newFiles,
245
+ errors: []
246
+ };
247
+ });
248
+ },
249
+ [onFilesChange]
250
+ );
251
+ const clearErrors = (0, import_react.useCallback)(() => {
252
+ setState((prev) => ({
253
+ ...prev,
254
+ errors: []
255
+ }));
256
+ }, []);
257
+ const handleDragEnter = (0, import_react.useCallback)((e) => {
258
+ e.preventDefault();
259
+ e.stopPropagation();
260
+ setState((prev) => ({ ...prev, isDragging: true }));
261
+ }, []);
262
+ const handleDragLeave = (0, import_react.useCallback)((e) => {
263
+ e.preventDefault();
264
+ e.stopPropagation();
265
+ if (e.currentTarget.contains(e.relatedTarget)) {
266
+ return;
267
+ }
268
+ setState((prev) => ({ ...prev, isDragging: false }));
269
+ }, []);
270
+ const handleDragOver = (0, import_react.useCallback)((e) => {
271
+ e.preventDefault();
272
+ e.stopPropagation();
273
+ }, []);
274
+ const handleDrop = (0, import_react.useCallback)(
275
+ (e) => {
276
+ var _a;
277
+ e.preventDefault();
278
+ e.stopPropagation();
279
+ setState((prev) => ({ ...prev, isDragging: false }));
280
+ if ((_a = inputRef.current) == null ? void 0 : _a.disabled) {
281
+ return;
282
+ }
283
+ if (e.dataTransfer.files && e.dataTransfer.files.length > 0) {
284
+ if (!multiple) {
285
+ const file = e.dataTransfer.files[0];
286
+ addFiles([file]);
287
+ } else {
288
+ addFiles(e.dataTransfer.files);
289
+ }
290
+ }
291
+ },
292
+ [addFiles, multiple]
293
+ );
294
+ const handleFileChange = (0, import_react.useCallback)(
295
+ (e) => {
296
+ if (e.target.files && e.target.files.length > 0) {
297
+ addFiles(e.target.files);
298
+ }
299
+ },
300
+ [addFiles]
301
+ );
302
+ const openFileDialog = (0, import_react.useCallback)(() => {
303
+ if (inputRef.current) {
304
+ inputRef.current.click();
305
+ }
306
+ }, []);
307
+ const getInputProps = (0, import_react.useCallback)(
308
+ (props = {}) => {
309
+ return {
310
+ ...props,
311
+ type: "file",
312
+ onChange: handleFileChange,
313
+ accept: props.accept || accept,
314
+ multiple: props.multiple !== void 0 ? props.multiple : multiple,
315
+ ref: inputRef
316
+ };
317
+ },
318
+ [accept, multiple, handleFileChange]
319
+ );
320
+ return [
321
+ state,
322
+ {
323
+ addFiles,
324
+ removeFile,
325
+ clearFiles,
326
+ clearErrors,
327
+ handleDragEnter,
328
+ handleDragLeave,
329
+ handleDragOver,
330
+ handleDrop,
331
+ handleFileChange,
332
+ openFileDialog,
333
+ getInputProps
334
+ }
335
+ ];
336
+ };
337
+ // Annotate the CommonJS export names for ESM import in node:
338
+ 0 && (module.exports = {
339
+ useFileUpload
340
+ });
@@ -0,0 +1,9 @@
1
+ "use client";
2
+ "use client";
3
+ import {
4
+ useFileUpload
5
+ } from "../../chunk-DWZQIPCX.mjs";
6
+ import "../../chunk-FBTSAODG.mjs";
7
+ export {
8
+ useFileUpload
9
+ };
@@ -0,0 +1,19 @@
1
+ declare const messages: {
2
+ file_exceeds_max: {
3
+ id: string;
4
+ defaultMessage: string;
5
+ description: string;
6
+ };
7
+ file_not_accepted: {
8
+ id: string;
9
+ defaultMessage: string;
10
+ description: string;
11
+ };
12
+ too_many_files: {
13
+ id: string;
14
+ defaultMessage: string;
15
+ description: string;
16
+ };
17
+ };
18
+
19
+ export { messages };
@@ -0,0 +1,19 @@
1
+ declare const messages: {
2
+ file_exceeds_max: {
3
+ id: string;
4
+ defaultMessage: string;
5
+ description: string;
6
+ };
7
+ file_not_accepted: {
8
+ id: string;
9
+ defaultMessage: string;
10
+ description: string;
11
+ };
12
+ too_many_files: {
13
+ id: string;
14
+ defaultMessage: string;
15
+ description: string;
16
+ };
17
+ };
18
+
19
+ export { messages };
@@ -0,0 +1,48 @@
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/hooks/use-file-upload/messages.ts
22
+ var messages_exports = {};
23
+ __export(messages_exports, {
24
+ messages: () => messages
25
+ });
26
+ module.exports = __toCommonJS(messages_exports);
27
+ var import_i18n = require("@kopexa/i18n");
28
+ var messages = (0, import_i18n.defineMessages)({
29
+ file_exceeds_max: {
30
+ id: "use_file_upload.file_exceeds_max",
31
+ defaultMessage: `File "{name}" exceeds the maximum size of {max}.`,
32
+ description: "Shown when a single file is larger than allowed"
33
+ },
34
+ file_not_accepted: {
35
+ id: "use_file_upload.file_not_accepted",
36
+ defaultMessage: `File "{name}" is not an accepted file type.`,
37
+ description: "Shown when file type/extension doesn't match accept"
38
+ },
39
+ too_many_files: {
40
+ id: "file_upload.too_many_files",
41
+ defaultMessage: "You can only upload a maximum of {max} files.",
42
+ description: "Shown when maxFiles would be exceeded"
43
+ }
44
+ });
45
+ // Annotate the CommonJS export names for ESM import in node:
46
+ 0 && (module.exports = {
47
+ messages
48
+ });
@@ -0,0 +1,7 @@
1
+ "use client";
2
+ import {
3
+ messages
4
+ } from "../../chunk-FBTSAODG.mjs";
5
+ export {
6
+ messages
7
+ };
package/dist/index.d.mts CHANGED
@@ -4,25 +4,20 @@ export { Conversation, ConversationContent, ConversationContentProps, Conversati
4
4
  export { AuditInfo, AuditInfoProps, auditInfoMessages } from '@kopexa/audit-info';
5
5
  export { Autocomplete, AutocompleteProps } from '@kopexa/autocomplete';
6
6
  export * from '@kopexa/avatar';
7
- export * from '@kopexa/blankstate';
8
7
  export * from '@kopexa/button';
9
8
  export * from '@kopexa/calendar';
10
9
  export * from '@kopexa/callout';
11
10
  export { Card, CardBody, CardBodyProps, CardFooter, CardFooterProps, CardHeader, CardHeaderProps, CardHeading, CardHeadingProps, CardRoot, CardRootProps, CardSubtitle, CardSubtitleProps, CardTitle, CardTitleProps, CardToolbar, CardToolbarProps } from '@kopexa/card';
12
11
  export * from '@kopexa/checkbox';
13
12
  export { Chip, ChipProps, RelatedControlChip, RelatedControlChipProps, StandardChip, StandardChipProps } from '@kopexa/chip';
14
- export * from '@kopexa/code';
15
13
  export * from '@kopexa/color-picker';
16
14
  export { Combobox, ComboboxArrowProps, ComboboxBackdropProps, ComboboxChipProps, ComboboxChipRemoveProps, ComboboxChipsProps, ComboboxClearProps, ComboboxCollectionProps, ComboboxContentProps, ComboboxControlProps, ComboboxEmptyProps, ComboboxGroupLabelProps, ComboboxGroupProps, ComboboxIconProps, ComboboxInputProps, ComboboxItemIndicatorProps, ComboboxItemProps, ComboboxListProps, ComboboxPopupProps, ComboboxPortalProps, ComboboxPositionerProps, ComboboxProps, ComboboxRowProps, ComboboxSeparatorProps, ComboboxStatusProps, ComboboxTriggerProps, ComboboxValueProps } from '@kopexa/combobox';
17
15
  export * from '@kopexa/command';
18
16
  export { DataGrid, DataGridProps } from '@kopexa/data-grid';
19
- export * from '@kopexa/data-table';
20
17
  export * from '@kopexa/date-picker';
21
- export * from '@kopexa/dialog';
22
18
  export * from '@kopexa/drawer';
23
19
  export * from '@kopexa/dropdown-menu';
24
20
  export { EditableText, EditableTextProps } from '@kopexa/editable-text';
25
- export { AvatarUpload, AvatarUploadProps } from '@kopexa/file-upload';
26
21
  export { Filter, FilterActive, FilterActiveProps, FilterBar, FilterBarCustomRendererProps, FilterBarFieldConfig, FilterBarFieldType, FilterBarI18nConfig, FilterBarInputValue, FilterBarOperator, FilterBarOption, FilterBarProps, FilterBarValidation, FilterBarValue, FilterContextValue, FilterEditorRenderProps, FilterFieldConfig, FilterFieldType, FilterGroup, FilterGroupProps, FilterItem, FilterItemProps, FilterMenu, FilterMenuProps, FilterMenuSeparator, FilterOperator, FilterOption, FilterProps, FilterTrigger, FilterTriggerProps, FilterValue, FilterValueEditor, FilterValueRenderProps, SearchFilterBar, SearchFilterBarProps, filterBarMessages, filterMessages, useFilterContext } from '@kopexa/filter';
27
22
  export * from '@kopexa/heading';
28
23
  export * from '@kopexa/hover-card';
@@ -47,15 +42,26 @@ export { Select, SelectProps } from '@kopexa/select';
47
42
  export * from '@kopexa/separator';
48
43
  export { cn } from '@kopexa/shared-utils';
49
44
  export * from '@kopexa/sidebar';
50
- export * from '@kopexa/skeleton';
51
45
  export * from '@kopexa/spinner';
52
46
  export * from '@kopexa/split-page-layout';
53
- export { Stat, StatDownIndicator, StatDownIndicatorProps, StatGroup, StatGroupProps, StatHelpText, StatHelpTextProps, StatLabel, StatLabelProps, StatRoot, StatRootProps, StatUpIndicator, StatUpIndicatorProps, StatValueText, StatValueTextProps, StatValueUnit, StatValueUnitProps } from '@kopexa/stat';
54
47
  export { Switch, SwitchProps } from '@kopexa/switch';
55
48
  export * from '@kopexa/tab-nav';
56
49
  export * from '@kopexa/table';
57
50
  export { Tabs, TabsProps } from '@kopexa/tabs';
58
- export { Textarea, TextareaProps } from '@kopexa/textarea';
59
51
  export { ToggleRow, ToggleRowProps } from '@kopexa/toggle-row';
60
52
  export { Toolbar, ToolbarButton, ToolbarButtonProps, ToolbarGroup, ToolbarGroupProps, ToolbarProps, ToolbarSeparator, ToolbarSeparatorProps } from '@kopexa/toolbar';
61
53
  export * from '@kopexa/tooltip';
54
+ export { Blankstate, BlankstateProps } from './components/blankstate/blankstate.mjs';
55
+ export { Code, CodeProps } from './components/code/code.mjs';
56
+ export { Dialog } from './components/dialog/index.mjs';
57
+ export { AvatarUpload, AvatarUploadProps } from './components/file-upload/avatar-upload.mjs';
58
+ export { Skeleton, SkeletonProps } from './components/skeleton/skeleton.mjs';
59
+ export { SkeletonAvatar, SkeletonAvatarProps } from './components/skeleton/skeleton-avatar.mjs';
60
+ export { Stat, StatDownIndicator, StatDownIndicatorProps, StatGroup, StatGroupProps, StatHelpText, StatHelpTextProps, StatLabel, StatLabelProps, StatRoot, StatRootProps, StatUpIndicator, StatUpIndicatorProps, StatValueText, StatValueTextProps, StatValueUnit, StatValueUnitProps } from './components/stat/stat.mjs';
61
+ export { Textarea, TextareaProps } from './components/textarea/textarea.mjs';
62
+ export { FileMetadata, FileUploadActions, FileUploadOptions, FileUploadState, FileWithPreview, useFileUpload } from './hooks/use-file-upload/index.mjs';
63
+ export { DialogBody, DialogBodyProps, DialogClose, DialogCloseProps, DialogCloseTrigger, DialogCloseTriggerProps, DialogContent, DialogContentProps, DialogDescription, DialogDescriptionProps, DialogFooter, DialogFooterProps, DialogHeader, DialogHeaderProps, DialogOverlay, DialogOverlayProps, DialogPortal, DialogPortalProps, DialogRoot, DialogRootProps, DialogTitle, DialogTitleProps, DialogTrigger, DialogTriggerProps, useDialogContext } from './components/dialog/dialog.mjs';
64
+ import 'react/jsx-runtime';
65
+ import '@kopexa/theme';
66
+ import 'react';
67
+ import '@base-ui/react/dialog';
package/dist/index.d.ts CHANGED
@@ -4,25 +4,20 @@ export { Conversation, ConversationContent, ConversationContentProps, Conversati
4
4
  export { AuditInfo, AuditInfoProps, auditInfoMessages } from '@kopexa/audit-info';
5
5
  export { Autocomplete, AutocompleteProps } from '@kopexa/autocomplete';
6
6
  export * from '@kopexa/avatar';
7
- export * from '@kopexa/blankstate';
8
7
  export * from '@kopexa/button';
9
8
  export * from '@kopexa/calendar';
10
9
  export * from '@kopexa/callout';
11
10
  export { Card, CardBody, CardBodyProps, CardFooter, CardFooterProps, CardHeader, CardHeaderProps, CardHeading, CardHeadingProps, CardRoot, CardRootProps, CardSubtitle, CardSubtitleProps, CardTitle, CardTitleProps, CardToolbar, CardToolbarProps } from '@kopexa/card';
12
11
  export * from '@kopexa/checkbox';
13
12
  export { Chip, ChipProps, RelatedControlChip, RelatedControlChipProps, StandardChip, StandardChipProps } from '@kopexa/chip';
14
- export * from '@kopexa/code';
15
13
  export * from '@kopexa/color-picker';
16
14
  export { Combobox, ComboboxArrowProps, ComboboxBackdropProps, ComboboxChipProps, ComboboxChipRemoveProps, ComboboxChipsProps, ComboboxClearProps, ComboboxCollectionProps, ComboboxContentProps, ComboboxControlProps, ComboboxEmptyProps, ComboboxGroupLabelProps, ComboboxGroupProps, ComboboxIconProps, ComboboxInputProps, ComboboxItemIndicatorProps, ComboboxItemProps, ComboboxListProps, ComboboxPopupProps, ComboboxPortalProps, ComboboxPositionerProps, ComboboxProps, ComboboxRowProps, ComboboxSeparatorProps, ComboboxStatusProps, ComboboxTriggerProps, ComboboxValueProps } from '@kopexa/combobox';
17
15
  export * from '@kopexa/command';
18
16
  export { DataGrid, DataGridProps } from '@kopexa/data-grid';
19
- export * from '@kopexa/data-table';
20
17
  export * from '@kopexa/date-picker';
21
- export * from '@kopexa/dialog';
22
18
  export * from '@kopexa/drawer';
23
19
  export * from '@kopexa/dropdown-menu';
24
20
  export { EditableText, EditableTextProps } from '@kopexa/editable-text';
25
- export { AvatarUpload, AvatarUploadProps } from '@kopexa/file-upload';
26
21
  export { Filter, FilterActive, FilterActiveProps, FilterBar, FilterBarCustomRendererProps, FilterBarFieldConfig, FilterBarFieldType, FilterBarI18nConfig, FilterBarInputValue, FilterBarOperator, FilterBarOption, FilterBarProps, FilterBarValidation, FilterBarValue, FilterContextValue, FilterEditorRenderProps, FilterFieldConfig, FilterFieldType, FilterGroup, FilterGroupProps, FilterItem, FilterItemProps, FilterMenu, FilterMenuProps, FilterMenuSeparator, FilterOperator, FilterOption, FilterProps, FilterTrigger, FilterTriggerProps, FilterValue, FilterValueEditor, FilterValueRenderProps, SearchFilterBar, SearchFilterBarProps, filterBarMessages, filterMessages, useFilterContext } from '@kopexa/filter';
27
22
  export * from '@kopexa/heading';
28
23
  export * from '@kopexa/hover-card';
@@ -47,15 +42,26 @@ export { Select, SelectProps } from '@kopexa/select';
47
42
  export * from '@kopexa/separator';
48
43
  export { cn } from '@kopexa/shared-utils';
49
44
  export * from '@kopexa/sidebar';
50
- export * from '@kopexa/skeleton';
51
45
  export * from '@kopexa/spinner';
52
46
  export * from '@kopexa/split-page-layout';
53
- export { Stat, StatDownIndicator, StatDownIndicatorProps, StatGroup, StatGroupProps, StatHelpText, StatHelpTextProps, StatLabel, StatLabelProps, StatRoot, StatRootProps, StatUpIndicator, StatUpIndicatorProps, StatValueText, StatValueTextProps, StatValueUnit, StatValueUnitProps } from '@kopexa/stat';
54
47
  export { Switch, SwitchProps } from '@kopexa/switch';
55
48
  export * from '@kopexa/tab-nav';
56
49
  export * from '@kopexa/table';
57
50
  export { Tabs, TabsProps } from '@kopexa/tabs';
58
- export { Textarea, TextareaProps } from '@kopexa/textarea';
59
51
  export { ToggleRow, ToggleRowProps } from '@kopexa/toggle-row';
60
52
  export { Toolbar, ToolbarButton, ToolbarButtonProps, ToolbarGroup, ToolbarGroupProps, ToolbarProps, ToolbarSeparator, ToolbarSeparatorProps } from '@kopexa/toolbar';
61
53
  export * from '@kopexa/tooltip';
54
+ export { Blankstate, BlankstateProps } from './components/blankstate/blankstate.js';
55
+ export { Code, CodeProps } from './components/code/code.js';
56
+ export { Dialog } from './components/dialog/index.js';
57
+ export { AvatarUpload, AvatarUploadProps } from './components/file-upload/avatar-upload.js';
58
+ export { Skeleton, SkeletonProps } from './components/skeleton/skeleton.js';
59
+ export { SkeletonAvatar, SkeletonAvatarProps } from './components/skeleton/skeleton-avatar.js';
60
+ export { Stat, StatDownIndicator, StatDownIndicatorProps, StatGroup, StatGroupProps, StatHelpText, StatHelpTextProps, StatLabel, StatLabelProps, StatRoot, StatRootProps, StatUpIndicator, StatUpIndicatorProps, StatValueText, StatValueTextProps, StatValueUnit, StatValueUnitProps } from './components/stat/stat.js';
61
+ export { Textarea, TextareaProps } from './components/textarea/textarea.js';
62
+ export { FileMetadata, FileUploadActions, FileUploadOptions, FileUploadState, FileWithPreview, useFileUpload } from './hooks/use-file-upload/index.js';
63
+ export { DialogBody, DialogBodyProps, DialogClose, DialogCloseProps, DialogCloseTrigger, DialogCloseTriggerProps, DialogContent, DialogContentProps, DialogDescription, DialogDescriptionProps, DialogFooter, DialogFooterProps, DialogHeader, DialogHeaderProps, DialogOverlay, DialogOverlayProps, DialogPortal, DialogPortalProps, DialogRoot, DialogRootProps, DialogTitle, DialogTitleProps, DialogTrigger, DialogTriggerProps, useDialogContext } from './components/dialog/dialog.js';
64
+ import 'react/jsx-runtime';
65
+ import '@kopexa/theme';
66
+ import 'react';
67
+ import '@base-ui/react/dialog';