@jmruthers/pace-core 0.5.60 → 0.5.62

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 (195) hide show
  1. package/README.md +2 -2
  2. package/dist/{DataTable-5M6MV2VY.js → DataTable-7BER7PDS.js} +6 -6
  3. package/dist/{DataTable-DqDDvBfI.d.ts → DataTable-D15XipLZ.d.ts} +7 -0
  4. package/dist/{PublicLoadingSpinner-SL8WaQN7.d.ts → PublicLoadingSpinner-CXJ-W9wZ.d.ts} +3 -27
  5. package/dist/{chunk-SFMRBGGK.js → chunk-2LPYEFXI.js} +136 -137
  6. package/dist/chunk-2LPYEFXI.js.map +1 -0
  7. package/dist/{chunk-XMTHMOOM.js → chunk-BTCA3ENN.js} +4 -4
  8. package/dist/{chunk-ESXTFEE6.js → chunk-C7GUF747.js} +3 -3
  9. package/dist/{chunk-W7PPXKTZ.js → chunk-CKNY7HYS.js} +2 -2
  10. package/dist/{chunk-5MLDIGHB.js → chunk-FVDOEGGG.js} +3 -3
  11. package/dist/{chunk-NQ4TOOO6.js → chunk-L3RV2ALE.js} +1 -1
  12. package/dist/chunk-L3RV2ALE.js.map +1 -0
  13. package/dist/{chunk-NMNDTCOR.js → chunk-QVEOQVD4.js} +3 -3
  14. package/dist/{chunk-XDXG6QVH.js → chunk-S66AJVI2.js} +13 -6
  15. package/dist/chunk-S66AJVI2.js.map +1 -0
  16. package/dist/{chunk-E4FPK232.js → chunk-T2MQY57J.js} +2 -2
  17. package/dist/{chunk-ITPVFKDH.js → chunk-T6HVDA24.js} +129 -12
  18. package/dist/chunk-T6HVDA24.js.map +1 -0
  19. package/dist/{chunk-STT7INZR.js → chunk-ULBI5JGB.js} +2 -1
  20. package/dist/{chunk-CGSYCF2W.js → chunk-VTJ5HCZB.js} +2 -2
  21. package/dist/components.d.ts +81 -4
  22. package/dist/components.js +258 -11
  23. package/dist/components.js.map +1 -1
  24. package/dist/hooks.d.ts +2 -61
  25. package/dist/hooks.js +31 -146
  26. package/dist/hooks.js.map +1 -1
  27. package/dist/index.d.ts +4 -3
  28. package/dist/index.js +14 -14
  29. package/dist/index.js.map +1 -1
  30. package/dist/providers.js +4 -4
  31. package/dist/rbac/index.js +6 -6
  32. package/dist/styles/index.d.ts +1 -1
  33. package/dist/styles/index.js +1 -1
  34. package/dist/types.js +1 -1
  35. package/dist/useToast-Bm6TnSK-.d.ts +63 -0
  36. package/dist/utils.d.ts +1 -1
  37. package/dist/utils.js +1 -1
  38. package/docs/README.md +1 -1
  39. package/docs/api/README.md +2 -2
  40. package/docs/api/classes/ErrorBoundary.md +1 -1
  41. package/docs/api/classes/InvalidScopeError.md +1 -1
  42. package/docs/api/classes/MissingUserContextError.md +1 -1
  43. package/docs/api/classes/OrganisationContextRequiredError.md +1 -1
  44. package/docs/api/classes/PermissionDeniedError.md +1 -1
  45. package/docs/api/classes/PublicErrorBoundary.md +1 -1
  46. package/docs/api/classes/RBACAuditManager.md +1 -1
  47. package/docs/api/classes/RBACCache.md +1 -1
  48. package/docs/api/classes/RBACEngine.md +1 -1
  49. package/docs/api/classes/RBACError.md +1 -1
  50. package/docs/api/classes/RBACNotInitializedError.md +1 -1
  51. package/docs/api/classes/SecureSupabaseClient.md +1 -1
  52. package/docs/api/classes/StorageUtils.md +1 -1
  53. package/docs/api/interfaces/AggregateConfig.md +1 -1
  54. package/docs/api/interfaces/ButtonProps.md +1 -1
  55. package/docs/api/interfaces/CardProps.md +1 -1
  56. package/docs/api/interfaces/ColorPalette.md +1 -1
  57. package/docs/api/interfaces/ColorShade.md +1 -1
  58. package/docs/api/interfaces/DataAccessRecord.md +1 -1
  59. package/docs/api/interfaces/DataTableAction.md +1 -1
  60. package/docs/api/interfaces/DataTableColumn.md +1 -1
  61. package/docs/api/interfaces/DataTableProps.md +44 -18
  62. package/docs/api/interfaces/DataTableToolbarButton.md +1 -1
  63. package/docs/api/interfaces/EmptyStateConfig.md +1 -1
  64. package/docs/api/interfaces/EnhancedNavigationMenuProps.md +1 -1
  65. package/docs/api/interfaces/EventContextType.md +1 -1
  66. package/docs/api/interfaces/EventLogoProps.md +1 -1
  67. package/docs/api/interfaces/EventProviderProps.md +1 -1
  68. package/docs/api/interfaces/FileSizeLimits.md +1 -1
  69. package/docs/api/interfaces/FileUploadProps.md +1 -1
  70. package/docs/api/interfaces/FooterProps.md +1 -1
  71. package/docs/api/interfaces/InactivityWarningModalProps.md +1 -1
  72. package/docs/api/interfaces/InputProps.md +1 -1
  73. package/docs/api/interfaces/LabelProps.md +1 -1
  74. package/docs/api/interfaces/LoginFormProps.md +1 -1
  75. package/docs/api/interfaces/NavigationAccessRecord.md +1 -1
  76. package/docs/api/interfaces/NavigationContextType.md +1 -1
  77. package/docs/api/interfaces/NavigationGuardProps.md +1 -1
  78. package/docs/api/interfaces/NavigationItem.md +1 -1
  79. package/docs/api/interfaces/NavigationMenuProps.md +1 -1
  80. package/docs/api/interfaces/NavigationProviderProps.md +1 -1
  81. package/docs/api/interfaces/Organisation.md +1 -1
  82. package/docs/api/interfaces/OrganisationContextType.md +1 -1
  83. package/docs/api/interfaces/OrganisationMembership.md +1 -1
  84. package/docs/api/interfaces/OrganisationProviderProps.md +1 -1
  85. package/docs/api/interfaces/OrganisationSecurityError.md +1 -1
  86. package/docs/api/interfaces/PaceAppLayoutProps.md +1 -1
  87. package/docs/api/interfaces/PaceLoginPageProps.md +1 -1
  88. package/docs/api/interfaces/PageAccessRecord.md +1 -1
  89. package/docs/api/interfaces/PagePermissionContextType.md +1 -1
  90. package/docs/api/interfaces/PagePermissionGuardProps.md +1 -1
  91. package/docs/api/interfaces/PagePermissionProviderProps.md +1 -1
  92. package/docs/api/interfaces/PaletteData.md +1 -1
  93. package/docs/api/interfaces/PermissionEnforcerProps.md +1 -1
  94. package/docs/api/interfaces/PublicErrorBoundaryProps.md +1 -1
  95. package/docs/api/interfaces/PublicErrorBoundaryState.md +1 -1
  96. package/docs/api/interfaces/PublicLoadingSpinnerProps.md +1 -1
  97. package/docs/api/interfaces/PublicPageFooterProps.md +1 -1
  98. package/docs/api/interfaces/PublicPageHeaderProps.md +1 -1
  99. package/docs/api/interfaces/PublicPageLayoutProps.md +1 -1
  100. package/docs/api/interfaces/RBACConfig.md +1 -1
  101. package/docs/api/interfaces/RBACContextType.md +1 -1
  102. package/docs/api/interfaces/RBACLogger.md +1 -1
  103. package/docs/api/interfaces/RBACProviderProps.md +1 -1
  104. package/docs/api/interfaces/RoleBasedRouterContextType.md +1 -1
  105. package/docs/api/interfaces/RoleBasedRouterProps.md +1 -1
  106. package/docs/api/interfaces/RouteAccessRecord.md +1 -1
  107. package/docs/api/interfaces/RouteConfig.md +1 -1
  108. package/docs/api/interfaces/SecureDataContextType.md +1 -1
  109. package/docs/api/interfaces/SecureDataProviderProps.md +1 -1
  110. package/docs/api/interfaces/StorageConfig.md +1 -1
  111. package/docs/api/interfaces/StorageFileInfo.md +1 -1
  112. package/docs/api/interfaces/StorageFileMetadata.md +1 -1
  113. package/docs/api/interfaces/StorageListOptions.md +1 -1
  114. package/docs/api/interfaces/StorageListResult.md +1 -1
  115. package/docs/api/interfaces/StorageUploadOptions.md +1 -1
  116. package/docs/api/interfaces/StorageUploadResult.md +1 -1
  117. package/docs/api/interfaces/StorageUrlOptions.md +1 -1
  118. package/docs/api/interfaces/StyleImport.md +1 -1
  119. package/docs/api/interfaces/ToastActionElement.md +1 -1
  120. package/docs/api/interfaces/ToastProps.md +1 -1
  121. package/docs/api/interfaces/UnifiedAuthContextType.md +1 -1
  122. package/docs/api/interfaces/UnifiedAuthProviderProps.md +1 -1
  123. package/docs/api/interfaces/UseInactivityTrackerOptions.md +1 -1
  124. package/docs/api/interfaces/UseInactivityTrackerReturn.md +1 -1
  125. package/docs/api/interfaces/UsePublicEventLogoOptions.md +1 -1
  126. package/docs/api/interfaces/UsePublicEventLogoReturn.md +1 -1
  127. package/docs/api/interfaces/UsePublicEventOptions.md +1 -1
  128. package/docs/api/interfaces/UsePublicEventReturn.md +1 -1
  129. package/docs/api/interfaces/UsePublicRouteParamsReturn.md +1 -1
  130. package/docs/api/interfaces/UserEventAccess.md +1 -1
  131. package/docs/api/interfaces/UserMenuProps.md +1 -1
  132. package/docs/api/interfaces/UserProfile.md +1 -1
  133. package/docs/api/modules.md +38 -53
  134. package/docs/architecture/README.md +1 -3
  135. package/docs/consuming-app-example.md +3 -3
  136. package/docs/consuming-app-vite-config.md +1 -1
  137. package/docs/documentation-style-checklist.md +2 -2
  138. package/docs/getting-started/examples/basic-auth-app.md +2 -2
  139. package/docs/getting-started/installation.md +2 -2
  140. package/docs/getting-started/quick-start.md +1 -1
  141. package/docs/implementation-guides/data-tables.md +67 -0
  142. package/docs/migration/README.md +6 -6
  143. package/docs/migration/quick-migration-guide.md +3 -3
  144. package/docs/migration/v0.4.15-tailwind-scanning.md +1 -1
  145. package/docs/migration/v0.4.16-css-first-approach.md +1 -1
  146. package/docs/migration/v0.4.17-source-path-fix.md +4 -4
  147. package/docs/migration-guide.md +2 -2
  148. package/docs/quick-reference.md +4 -4
  149. package/docs/styles/README.md +3 -3
  150. package/docs/troubleshooting/README.md +2 -2
  151. package/docs/troubleshooting/common-issues.md +1 -1
  152. package/docs/troubleshooting/styling-issues.md +2 -2
  153. package/docs/troubleshooting/tailwind-content-scanning.md +2 -2
  154. package/docs/usage.md +2 -2
  155. package/package.json +2 -6
  156. package/src/components/DataTable/DataTable.tsx +13 -0
  157. package/src/components/DataTable/__tests__/DataTable.default-state.test.tsx +414 -0
  158. package/src/components/DataTable/components/DataTableCore.tsx +19 -2
  159. package/src/components/DataTable/types.ts +9 -0
  160. package/src/components/Dialog/examples/__tests__/SmartDialogExample.unit.test.tsx +151 -0
  161. package/src/components/Dialog/utils/__tests__/safeHtml.unit.test.ts +611 -0
  162. package/src/components/PaceAppLayout/__tests__/PaceAppLayout.accessibility.test.tsx +287 -0
  163. package/src/components/PaceAppLayout/__tests__/PaceAppLayout.integration.test.tsx +861 -0
  164. package/src/components/PaceAppLayout/__tests__/PaceAppLayout.performance.test.tsx +628 -0
  165. package/src/components/PaceAppLayout/__tests__/PaceAppLayout.security.test.tsx +777 -0
  166. package/src/components/PaceAppLayout/__tests__/PaceAppLayout.unit.test.tsx +901 -0
  167. package/src/components/Toast/Toast.test.tsx +51 -21
  168. package/src/components/Toast/Toast.tsx +13 -35
  169. package/src/components/Toast/index.ts +2 -1
  170. package/src/components/index.ts +15 -1
  171. package/src/hooks/useFileReference.ts +37 -0
  172. package/src/index.ts +1 -1
  173. package/src/rbac/__tests__/rbac-engine-core-logic.test.ts +1 -1
  174. package/src/rbac/__tests__/rbac-engine-simplified.test.ts +1 -1
  175. package/src/styles/core.css +32 -37
  176. package/src/styles/index.ts +1 -1
  177. package/dist/chunk-ITPVFKDH.js.map +0 -1
  178. package/dist/chunk-NQ4TOOO6.js.map +0 -1
  179. package/dist/chunk-SFMRBGGK.js.map +0 -1
  180. package/dist/chunk-XDXG6QVH.js.map +0 -1
  181. package/dist/styles/core.css +0 -242
  182. package/dist/styles/fonts/georama-italic.woff2 +0 -0
  183. package/dist/styles/fonts/georama.woff2 +0 -0
  184. package/dist/styles/fonts/open-sans-italic.woff2 +0 -0
  185. package/dist/styles/fonts/open-sans.woff2 +0 -0
  186. package/dist/styles/fonts/reddit-mono.woff2 +0 -0
  187. /package/dist/{DataTable-5M6MV2VY.js.map → DataTable-7BER7PDS.js.map} +0 -0
  188. /package/dist/{chunk-XMTHMOOM.js.map → chunk-BTCA3ENN.js.map} +0 -0
  189. /package/dist/{chunk-ESXTFEE6.js.map → chunk-C7GUF747.js.map} +0 -0
  190. /package/dist/{chunk-W7PPXKTZ.js.map → chunk-CKNY7HYS.js.map} +0 -0
  191. /package/dist/{chunk-5MLDIGHB.js.map → chunk-FVDOEGGG.js.map} +0 -0
  192. /package/dist/{chunk-NMNDTCOR.js.map → chunk-QVEOQVD4.js.map} +0 -0
  193. /package/dist/{chunk-E4FPK232.js.map → chunk-T2MQY57J.js.map} +0 -0
  194. /package/dist/{chunk-STT7INZR.js.map → chunk-ULBI5JGB.js.map} +0 -0
  195. /package/dist/{chunk-CGSYCF2W.js.map → chunk-VTJ5HCZB.js.map} +0 -0
@@ -52,9 +52,8 @@ import {
52
52
  uploadFile,
53
53
  useFileUpload,
54
54
  usePublicPageContext as usePublicPageContext2,
55
- useStorage,
56
- useToast
57
- } from "./chunk-SFMRBGGK.js";
55
+ useStorage
56
+ } from "./chunk-2LPYEFXI.js";
58
57
  import {
59
58
  Alert,
60
59
  AlertDescription,
@@ -77,22 +76,23 @@ import {
77
76
  SelectSeparator,
78
77
  SelectTrigger,
79
78
  SelectValue
80
- } from "./chunk-XDXG6QVH.js";
79
+ } from "./chunk-S66AJVI2.js";
81
80
  import {
82
81
  useRBAC
83
- } from "./chunk-ESXTFEE6.js";
82
+ } from "./chunk-C7GUF747.js";
84
83
  import "./chunk-NHR52QAQ.js";
85
84
  import "./chunk-B2WTCLCV.js";
86
- import "./chunk-5MLDIGHB.js";
87
- import "./chunk-CGSYCF2W.js";
85
+ import "./chunk-FVDOEGGG.js";
86
+ import "./chunk-VTJ5HCZB.js";
88
87
  import {
89
88
  DefaultPublicErrorFallback,
90
89
  PublicErrorBoundary,
91
90
  PublicPageProvider,
92
91
  useErrorBoundary,
93
92
  useIsPublicPage,
94
- usePublicPageContext
95
- } from "./chunk-ITPVFKDH.js";
93
+ usePublicPageContext,
94
+ useToast
95
+ } from "./chunk-T6HVDA24.js";
96
96
  import "./chunk-YNUBMSMV.js";
97
97
  import {
98
98
  Button,
@@ -117,8 +117,11 @@ import {
117
117
  init_Tooltip2 as init_Tooltip,
118
118
  init_UnifiedAuthProvider,
119
119
  useUnifiedAuth
120
- } from "./chunk-E4FPK232.js";
121
- import "./chunk-STT7INZR.js";
120
+ } from "./chunk-T2MQY57J.js";
121
+ import {
122
+ FileCategory,
123
+ init_file_reference
124
+ } from "./chunk-ULBI5JGB.js";
122
125
  import {
123
126
  LoadingSpinner
124
127
  } from "./chunk-CDQ3PX7L.js";
@@ -699,6 +702,67 @@ function useFileReference(supabase) {
699
702
  clearError
700
703
  };
701
704
  }
705
+ function useFileReferenceForRecord(supabase, table_name, record_id, organisation_id) {
706
+ const {
707
+ isLoading,
708
+ error,
709
+ getFileUrl,
710
+ getFileReference,
711
+ updateFileReference,
712
+ deleteFileReference,
713
+ listFileReferences,
714
+ getFileCount,
715
+ clearError
716
+ } = useFileReference(supabase);
717
+ const [fileUrl, setFileUrl] = useState2(null);
718
+ const [fileReference, setFileReference] = useState2(null);
719
+ const [fileReferences, setFileReferences] = useState2([]);
720
+ const [fileCount, setFileCount] = useState2(0);
721
+ const loadFileReference = useCallback(async () => {
722
+ const reference = await getFileReference(table_name, record_id, organisation_id);
723
+ setFileReference(reference);
724
+ return reference;
725
+ }, [getFileReference, table_name, record_id, organisation_id]);
726
+ const loadFileUrl = useCallback(async () => {
727
+ const url = await getFileUrl(table_name, record_id, organisation_id);
728
+ setFileUrl(url);
729
+ return url;
730
+ }, [getFileUrl, table_name, record_id, organisation_id]);
731
+ const loadFileReferences = useCallback(async () => {
732
+ const references = await listFileReferences(table_name, record_id, organisation_id);
733
+ setFileReferences(references);
734
+ return references;
735
+ }, [listFileReferences, table_name, record_id, organisation_id]);
736
+ const loadFileCount = useCallback(async () => {
737
+ const count = await getFileCount(table_name, record_id, organisation_id);
738
+ setFileCount(count);
739
+ return count;
740
+ }, [getFileCount, table_name, record_id, organisation_id]);
741
+ const deleteFile2 = useCallback(async (delete_file) => {
742
+ const success = await deleteFileReference(table_name, record_id, organisation_id, delete_file);
743
+ if (success) {
744
+ setFileReference(null);
745
+ setFileUrl(null);
746
+ await loadFileCount();
747
+ }
748
+ return success;
749
+ }, [deleteFileReference, table_name, record_id, organisation_id, loadFileCount]);
750
+ return {
751
+ isLoading,
752
+ error,
753
+ fileUrl,
754
+ fileReference,
755
+ fileReferences,
756
+ fileCount,
757
+ loadFileReference,
758
+ loadFileUrl,
759
+ loadFileReferences,
760
+ loadFileCount,
761
+ deleteFile: deleteFile2,
762
+ updateFileReference,
763
+ clearError
764
+ };
765
+ }
702
766
 
703
767
  // src/components/FileUpload.tsx
704
768
  import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
@@ -824,6 +888,185 @@ function FileUpload({
824
888
  }
825
889
  );
826
890
  }
891
+
892
+ // src/components/FileDisplay.tsx
893
+ import { useState as useState4, useEffect as useEffect2 } from "react";
894
+ import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
895
+ function FileDisplay({
896
+ supabase,
897
+ table_name,
898
+ record_id,
899
+ organisation_id,
900
+ category,
901
+ showUpload = false,
902
+ showDelete = false,
903
+ className = "",
904
+ children
905
+ }) {
906
+ const {
907
+ isLoading,
908
+ error,
909
+ fileUrl,
910
+ fileReference,
911
+ fileReferences,
912
+ fileCount,
913
+ loadFileReference,
914
+ loadFileUrl,
915
+ loadFileReferences,
916
+ loadFileCount,
917
+ deleteFile: deleteFile2,
918
+ clearError
919
+ } = useFileReferenceForRecord(supabase, table_name, record_id, organisation_id);
920
+ const [imageError, setImageError] = useState4(false);
921
+ useEffect2(() => {
922
+ loadFileCount();
923
+ if (category) {
924
+ loadFileReference();
925
+ } else {
926
+ loadFileReferences();
927
+ }
928
+ }, [loadFileCount, loadFileReference, loadFileReferences, category]);
929
+ useEffect2(() => {
930
+ if (fileReference) {
931
+ loadFileUrl();
932
+ }
933
+ }, [fileReference, loadFileUrl]);
934
+ const handleDelete = async () => {
935
+ if (window.confirm("Are you sure you want to delete this file?")) {
936
+ const success = await deleteFile2(true);
937
+ if (success) {
938
+ setImageError(false);
939
+ }
940
+ }
941
+ };
942
+ const handleImageError = () => {
943
+ setImageError(true);
944
+ };
945
+ const getFileIcon = (fileType) => {
946
+ if (fileType.startsWith("image/")) return "\u{1F5BC}\uFE0F";
947
+ if (fileType.startsWith("video/")) return "\u{1F3A5}";
948
+ if (fileType.startsWith("audio/")) return "\u{1F3B5}";
949
+ if (fileType.includes("pdf")) return "\u{1F4C4}";
950
+ if (fileType.includes("word")) return "\u{1F4DD}";
951
+ if (fileType.includes("excel") || fileType.includes("spreadsheet")) return "\u{1F4CA}";
952
+ if (fileType.includes("powerpoint") || fileType.includes("presentation")) return "\u{1F4CA}";
953
+ return "\u{1F4C1}";
954
+ };
955
+ const formatFileSize = (bytes) => {
956
+ if (bytes === 0) return "0 Bytes";
957
+ const k = 1024;
958
+ const sizes = ["Bytes", "KB", "MB", "GB"];
959
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
960
+ return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + " " + sizes[i];
961
+ };
962
+ if (isLoading) {
963
+ return /* @__PURE__ */ jsx7("div", { className: `flex items-center justify-center p-4 ${className}`, children: /* @__PURE__ */ jsx7("div", { className: "animate-spin rounded-full h-8 w-8 border-b-2 border-main-500" }) });
964
+ }
965
+ if (error) {
966
+ return /* @__PURE__ */ jsxs6("div", { className: `p-4 bg-acc-50 border border-acc-200 rounded-lg ${className}`, children: [
967
+ /* @__PURE__ */ jsxs6("div", { className: "text-acc-600", children: [
968
+ "Error loading file: ",
969
+ error
970
+ ] }),
971
+ /* @__PURE__ */ jsx7(
972
+ "button",
973
+ {
974
+ onClick: clearError,
975
+ className: "mt-2 text-sm text-acc-700 hover:text-acc-800 underline",
976
+ children: "Try again"
977
+ }
978
+ )
979
+ ] });
980
+ }
981
+ if (fileCount === 0) {
982
+ return /* @__PURE__ */ jsxs6("div", { className: `text-sec-500 text-center p-4 ${className}`, children: [
983
+ "No files found",
984
+ children
985
+ ] });
986
+ }
987
+ if (category && fileReference) {
988
+ const isImage = fileReference.file_metadata.fileType?.startsWith("image/");
989
+ return /* @__PURE__ */ jsxs6("div", { className: `space-y-2 ${className}`, children: [
990
+ isImage && fileUrl && !imageError ? /* @__PURE__ */ jsxs6("div", { className: "relative", children: [
991
+ /* @__PURE__ */ jsx7(
992
+ "img",
993
+ {
994
+ src: fileUrl,
995
+ alt: fileReference.file_metadata.fileName || "File",
996
+ className: "max-w-full h-auto rounded-lg border border-sec-200",
997
+ onError: handleImageError
998
+ }
999
+ ),
1000
+ showDelete && /* @__PURE__ */ jsx7(
1001
+ "button",
1002
+ {
1003
+ onClick: handleDelete,
1004
+ className: "absolute top-2 right-2 bg-acc-500 text-white rounded-full w-6 h-6 flex items-center justify-center text-sm hover:bg-acc-600",
1005
+ title: "Delete file",
1006
+ children: "\xD7"
1007
+ }
1008
+ )
1009
+ ] }) : /* @__PURE__ */ jsxs6("div", { className: "flex items-center space-x-3 p-3 bg-sec-50 rounded-lg border border-sec-200", children: [
1010
+ /* @__PURE__ */ jsx7("span", { className: "text-2xl", children: getFileIcon(fileReference.file_metadata.fileType || "") }),
1011
+ /* @__PURE__ */ jsxs6("div", { className: "flex-1 min-w-0", children: [
1012
+ /* @__PURE__ */ jsx7("div", { className: "font-medium text-sec-900 truncate", children: fileReference.file_metadata.fileName || "Unknown file" }),
1013
+ /* @__PURE__ */ jsxs6("div", { className: "text-sm text-sec-500", children: [
1014
+ fileReference.file_metadata.fileSize && formatFileSize(fileReference.file_metadata.fileSize),
1015
+ fileReference.file_metadata.fileType && ` \u2022 ${fileReference.file_metadata.fileType}`
1016
+ ] })
1017
+ ] }),
1018
+ showDelete && /* @__PURE__ */ jsx7(
1019
+ "button",
1020
+ {
1021
+ onClick: handleDelete,
1022
+ className: "text-acc-500 hover:text-acc-700 p-1",
1023
+ title: "Delete file",
1024
+ children: "\xD7"
1025
+ }
1026
+ )
1027
+ ] }),
1028
+ children
1029
+ ] });
1030
+ }
1031
+ return /* @__PURE__ */ jsxs6("div", { className: `space-y-2 ${className}`, children: [
1032
+ fileReferences.map((fileRef) => {
1033
+ const isImage = fileRef.file_metadata.fileType?.startsWith("image/");
1034
+ const fileUrl2 = fileRef.is_public ? `https://your-supabase-url.supabase.co/storage/v1/object/public/files/${fileRef.file_path}` : null;
1035
+ return /* @__PURE__ */ jsxs6("div", { className: "flex items-center space-x-3 p-3 bg-sec-50 rounded-lg border border-sec-200", children: [
1036
+ isImage && fileUrl2 ? /* @__PURE__ */ jsx7(
1037
+ "img",
1038
+ {
1039
+ src: fileUrl2,
1040
+ alt: fileRef.file_metadata.fileName || "File",
1041
+ className: "w-12 h-12 object-cover rounded",
1042
+ onError: handleImageError
1043
+ }
1044
+ ) : /* @__PURE__ */ jsx7("span", { className: "text-2xl", children: getFileIcon(fileRef.file_metadata.fileType || "") }),
1045
+ /* @__PURE__ */ jsxs6("div", { className: "flex-1 min-w-0", children: [
1046
+ /* @__PURE__ */ jsx7("div", { className: "font-medium text-sec-900 truncate", children: fileRef.file_metadata.fileName || "Unknown file" }),
1047
+ /* @__PURE__ */ jsxs6("div", { className: "text-sm text-sec-500", children: [
1048
+ fileRef.file_metadata.fileSize && formatFileSize(fileRef.file_metadata.fileSize),
1049
+ fileRef.file_metadata.fileType && ` \u2022 ${fileRef.file_metadata.fileType}`,
1050
+ fileRef.file_metadata.category && ` \u2022 ${fileRef.file_metadata.category}`
1051
+ ] })
1052
+ ] }),
1053
+ showDelete && /* @__PURE__ */ jsx7(
1054
+ "button",
1055
+ {
1056
+ onClick: () => deleteFile2(true),
1057
+ className: "text-acc-500 hover:text-acc-700 p-1",
1058
+ title: "Delete file",
1059
+ children: "\xD7"
1060
+ }
1061
+ )
1062
+ ] }, fileRef.id);
1063
+ }),
1064
+ children
1065
+ ] });
1066
+ }
1067
+
1068
+ // src/components/index.ts
1069
+ init_file_reference();
827
1070
  export {
828
1071
  Alert,
829
1072
  AlertDescription,
@@ -858,6 +1101,8 @@ export {
858
1101
  EventLogoCompact,
859
1102
  EventLogoLarge,
860
1103
  EventSelector,
1104
+ FileCategory,
1105
+ FileDisplay,
861
1106
  FileUpload,
862
1107
  Footer,
863
1108
  Form,
@@ -922,6 +1167,8 @@ export {
922
1167
  UnifiedAuthProvider,
923
1168
  UserMenu,
924
1169
  useErrorBoundary,
1170
+ useFileReference,
1171
+ useFileReferenceForRecord,
925
1172
  useFileUpload,
926
1173
  useIsPublicPage,
927
1174
  usePublicPageContext2 as usePublicPageContext,