@rebasepro/studio 0.35.1 → 0.37.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 (93) hide show
  1. package/README.md +1 -1
  2. package/dist/{ApiExplorer-C61w8gCc.js → ApiExplorer-BVQHAjHB.js} +3 -2
  3. package/dist/{ApiExplorer-C61w8gCc.js.map → ApiExplorer-BVQHAjHB.js.map} +1 -1
  4. package/dist/{useRunAsUsers-CF7tkGzj.js → AuthSimulationSelector-XogpkeXC.js} +4 -68
  5. package/dist/AuthSimulationSelector-XogpkeXC.js.map +1 -0
  6. package/dist/{CronJobsView-DUuyzkJK.js → CronJobsView-DyX9MINh.js} +2 -2
  7. package/dist/{CronJobsView-DUuyzkJK.js.map → CronJobsView-DyX9MINh.js.map} +1 -1
  8. package/dist/DatabaseView-Bi0NZS90.js +1897 -0
  9. package/dist/DatabaseView-Bi0NZS90.js.map +1 -0
  10. package/dist/{JSEditor-Bi2Aol-Y.js → JSEditor-B4Lazm-z.js} +4 -3
  11. package/dist/{JSEditor-Bi2Aol-Y.js.map → JSEditor-B4Lazm-z.js.map} +1 -1
  12. package/dist/RLSEditor-CcHkWFNg.js +973 -0
  13. package/dist/RLSEditor-CcHkWFNg.js.map +1 -0
  14. package/dist/{SQLEditor-DRo5kW1h.js → SQLEditorRoute-f5j_ZKdj.js} +1472 -320
  15. package/dist/SQLEditorRoute-f5j_ZKdj.js.map +1 -0
  16. package/dist/SchemaDiagramView-CckQobIZ.js +98 -0
  17. package/dist/SchemaDiagramView-CckQobIZ.js.map +1 -0
  18. package/dist/{StorageView-D0D8z4lI.js → StorageView-DQEIDFvO.js} +592 -447
  19. package/dist/StorageView-DQEIDFvO.js.map +1 -0
  20. package/dist/TableEditorView-BRZNvD6U.js +3615 -0
  21. package/dist/TableEditorView-BRZNvD6U.js.map +1 -0
  22. package/dist/TablePolicies-C1-tbC8x.js +1740 -0
  23. package/dist/TablePolicies-C1-tbC8x.js.map +1 -0
  24. package/dist/{SchemaVisualizer-Dy4kWKT5.js → TablesDiagram-RTJfwVEN.js} +651 -489
  25. package/dist/TablesDiagram-RTJfwVEN.js.map +1 -0
  26. package/dist/{UsersAndRolesView-CKw4SJPj.js → UsersAndRolesView-Cx6xtMVH.js} +2 -2
  27. package/dist/{UsersAndRolesView-CKw4SJPj.js.map → UsersAndRolesView-Cx6xtMVH.js.map} +1 -1
  28. package/dist/{WebhooksView-CFPY-N9h.js → WebhooksView-Bn9KB7xG.js} +2 -2
  29. package/dist/{WebhooksView-CFPY-N9h.js.map → WebhooksView-Bn9KB7xG.js.map} +1 -1
  30. package/dist/{adminFetch-BfOnfRgU.js → adminFetch-C7Ra8rpP.js} +26 -1
  31. package/dist/{adminFetch-BfOnfRgU.js.map → adminFetch-C7Ra8rpP.js.map} +1 -1
  32. package/dist/components/Database/ActivitySection.d.ts +9 -0
  33. package/dist/components/Database/AdvisorsSection.d.ts +17 -0
  34. package/dist/components/Database/DatabaseView.d.ts +13 -0
  35. package/dist/components/Database/ExtensionsSection.d.ts +2 -0
  36. package/dist/components/Database/FunctionsSection.d.ts +2 -0
  37. package/dist/components/Database/QueriesSection.d.ts +3 -0
  38. package/dist/components/Database/TriggersSection.d.ts +2 -0
  39. package/dist/components/Database/TypesSection.d.ts +2 -0
  40. package/dist/components/Database/format.d.ts +6 -0
  41. package/dist/components/Database/links.d.ts +11 -0
  42. package/dist/components/Database/shared.d.ts +35 -0
  43. package/dist/components/Database/source.d.ts +12 -0
  44. package/dist/components/Database/useCatalogList.d.ts +13 -0
  45. package/dist/components/RLSEditor/RLSEditor.d.ts +2 -0
  46. package/dist/components/RLSEditor/TablePolicies.d.ts +54 -0
  47. package/dist/components/SQLEditor/ExplainVisualizer.d.ts +8 -20
  48. package/dist/components/SQLEditor/ResultChart.d.ts +18 -0
  49. package/dist/components/SQLEditor/SQLEditor.d.ts +13 -1
  50. package/dist/components/SQLEditor/SQLEditorRoute.d.ts +13 -0
  51. package/dist/components/SQLEditor/SQLEditorSidebar.d.ts +7 -1
  52. package/dist/components/SQLEditor/SqlParamsPanel.d.ts +16 -0
  53. package/dist/components/SQLEditor/useSqlSnippets.d.ts +47 -0
  54. package/dist/components/SchemaVisualizer/SchemaDiagramView.d.ts +12 -0
  55. package/dist/components/SchemaVisualizer/TablesDiagram.d.ts +23 -0
  56. package/dist/components/SchemaVisualizer/useSchemaGraph.d.ts +32 -1
  57. package/dist/components/StorageView/StorageView.d.ts +5 -0
  58. package/dist/components/TableEditor/CreateTableDialog.d.ts +8 -0
  59. package/dist/components/TableEditor/DdlConfirm.d.ts +23 -0
  60. package/dist/components/TableEditor/SqlBlock.d.ts +7 -0
  61. package/dist/components/TableEditor/TableDdlSheet.d.ts +9 -0
  62. package/dist/components/TableEditor/TableEditorView.d.ts +7 -0
  63. package/dist/components/TableEditor/tableModel.d.ts +210 -0
  64. package/dist/components/TableEditor/tabs/DataTab.d.ts +12 -0
  65. package/dist/components/TableEditor/tabs/PoliciesTab.d.ts +8 -0
  66. package/dist/components/TableEditor/tabs/RelationsTab.d.ts +8 -0
  67. package/dist/components/TableEditor/tabs/SettingsTab.d.ts +11 -0
  68. package/dist/components/TableEditor/tabs/StatsTab.d.ts +8 -0
  69. package/dist/components/TableEditor/tabs/StructureTab.d.ts +12 -0
  70. package/dist/index.es.js +29 -15
  71. package/dist/index.es.js.map +1 -1
  72. package/dist/{sql_utils-CYcgpgam.js → sql_utils-DkMYltfq.js} +27 -3
  73. package/dist/sql_utils-DkMYltfq.js.map +1 -0
  74. package/dist/useRunAsUsers-GPFCxcBC.js +69 -0
  75. package/dist/useRunAsUsers-GPFCxcBC.js.map +1 -0
  76. package/dist/utils/adminFetch.d.ts +1 -0
  77. package/dist/utils/csv_parse.d.ts +11 -0
  78. package/dist/utils/explain_plan.d.ts +70 -0
  79. package/dist/utils/sql_params.d.ts +51 -0
  80. package/dist/utils/sql_utils.d.ts +16 -0
  81. package/package.json +11 -9
  82. package/dist/RLSEditor-CTG3jLE7.js +0 -2572
  83. package/dist/RLSEditor-CTG3jLE7.js.map +0 -1
  84. package/dist/SQLEditor-DRo5kW1h.js.map +0 -1
  85. package/dist/SchemaVisualizer-Dy4kWKT5.js.map +0 -1
  86. package/dist/StorageView-D0D8z4lI.js.map +0 -1
  87. package/dist/TableEditorView-BKhSBG-K.js +0 -1694
  88. package/dist/TableEditorView-BKhSBG-K.js.map +0 -1
  89. package/dist/components/SchemaVisualizer/SchemaVisualizer.d.ts +0 -3
  90. package/dist/policy-presets-CJKzAvQp.js +0 -167
  91. package/dist/policy-presets-CJKzAvQp.js.map +0 -1
  92. package/dist/sql_utils-CYcgpgam.js.map +0 -1
  93. package/dist/useRunAsUsers-CF7tkGzj.js.map +0 -1
@@ -1,8 +1,8 @@
1
- import { a as asStringArray, i as asString, o as isRecord, r as asNumber, s as useAdminFetch, t as asBoolean } from "./adminFetch-BfOnfRgU.js";
1
+ import { a as asStringArray, i as asString, o as isRecord, r as asNumber, s as useAdminFetch, t as asBoolean } from "./adminFetch-C7Ra8rpP.js";
2
2
  import { t as classifyLoadFailure } from "./load-failure-Bd8lFIO7.js";
3
3
  import { ErrorView, useApiBase, useApiConfig, useSnackbarController, useStorageSource, useStorageSources, useTranslation } from "@rebasepro/app";
4
4
  import React, { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
5
- import { Alert, ArrowLeftIcon, BooleanSwitch, BooleanSwitchWithLabel, Button, Card, CheckIcon, Checkbox, Chip, CircularProgress, CopyIcon, Dialog, DialogActions, DialogContent, DialogTitle, DownloadIcon, FileTextIcon, FileUpload, FolderIcon, FolderPlusIcon, IconButton, ImageIcon, LayoutGridIcon, ListIcon, LoadingButton, Music2Icon, PencilIcon, PlusIcon, RefreshCwIcon, Select, SelectItem, ShieldIcon, Tab, Table, TableBody, TableCell, TableHeader, TableRow, Tabs, TextField, Tooltip, Trash2Icon, Typography, UploadCloudIcon, VideoIcon, XIcon, cls, defaultBorderMixin, iconSize, isKeyHandled } from "@rebasepro/ui";
5
+ import { Alert, ArrowLeftIcon, BooleanSwitch, BooleanSwitchWithLabel, Button, Card, CheckIcon, Checkbox, Chip, CircularProgress, CopyIcon, Dialog, DialogActions, DialogContent, DialogTitle, DownloadIcon, FileTextIcon, FileUpload, FolderIcon, FolderPlusIcon, HomeIcon, IconButton, ImageIcon, LayoutGridIcon, ListIcon, LoadingButton, LucideIconByName, Music2Icon, PencilIcon, PlusIcon, RefreshCwIcon, SearchBar, Select, SelectItem, ShieldIcon, Tab, Table, TableBody, TableCell, TableHeader, TableRow, Tabs, TextField, ToggleButtonGroup, Tooltip, Trash2Icon, Typography, UploadCloudIcon, VideoIcon, XIcon, cls, defaultBorderMixin, iconSize, isKeyHandled } from "@rebasepro/ui";
6
6
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
7
7
  import { useSearchParams } from "react-router";
8
8
  import { DEFAULT_STORAGE_SOURCE_KEY, isPublicStorageKey } from "@rebasepro/types";
@@ -700,6 +700,10 @@ function getExtension(name) {
700
700
  return parts.length > 1 ? parts[parts.length - 1].toUpperCase() : "";
701
701
  }
702
702
  /** Whether the grid draws `file` as a thumbnail — which needs a link to it. */
703
+ /** What a file is, in a word: its extension, or the subtype its content type names. */
704
+ function fileTypeLabel(file) {
705
+ return getExtension(file.name) || file.contentType?.split("/")[1]?.toUpperCase() || "—";
706
+ }
703
707
  function isImageFile(file) {
704
708
  return file.contentType?.startsWith("image/") === true || IMAGE_EXTENSIONS.includes(getExtension(file.name).toLowerCase());
705
709
  }
@@ -946,84 +950,87 @@ function FilePreviewPanel({ file, onClose, onDelete, link, mintLink }) {
946
950
  };
947
951
  return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
948
952
  className: cls("flex flex-col h-full border-l", defaultBorderMixin, "bg-surface-card"),
949
- children: [
950
- /* @__PURE__ */ jsxs("div", {
951
- className: cls("flex items-center justify-between h-10 px-3 border-b bg-surface-sheet shrink-0", defaultBorderMixin),
952
- children: [/* @__PURE__ */ jsx(Typography, {
953
- variant: "body2",
954
- className: "font-medium truncate flex-1 mr-2",
955
- children: file.name
956
- }), /* @__PURE__ */ jsxs("div", {
957
- className: "flex items-center gap-0.5",
958
- children: [
959
- link && /* @__PURE__ */ jsx(Tooltip, {
960
- title: t("studio_storage_download"),
961
- children: /* @__PURE__ */ jsx(IconButton, {
962
- "aria-label": t("studio_storage_download"),
963
- size: "small",
964
- onClick: handleDownload,
965
- children: /* @__PURE__ */ jsx(DownloadIcon, { size: iconSize.smallest })
966
- })
967
- }),
968
- /* @__PURE__ */ jsx(Tooltip, {
969
- title: t("studio_storage_delete"),
970
- children: /* @__PURE__ */ jsx(IconButton, {
971
- "aria-label": t("studio_storage_delete"),
972
- size: "small",
973
- onClick: () => setDeleteDialogOpen(true),
974
- className: "text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20",
975
- children: /* @__PURE__ */ jsx(Trash2Icon, { size: iconSize.smallest })
976
- })
977
- }),
978
- /* @__PURE__ */ jsx(IconButton, {
979
- "aria-label": t("close"),
953
+ children: [/* @__PURE__ */ jsxs("div", {
954
+ className: "flex items-center justify-between h-[42px] pl-4 pr-2 shrink-0",
955
+ children: [/* @__PURE__ */ jsx(Typography, {
956
+ variant: "body2",
957
+ className: "text-[13px] font-medium truncate flex-1 mr-2",
958
+ title: file.name,
959
+ children: file.name
960
+ }), /* @__PURE__ */ jsxs("div", {
961
+ className: "flex items-center gap-0.5",
962
+ children: [
963
+ link && /* @__PURE__ */ jsx(Tooltip, {
964
+ title: t("studio_storage_download"),
965
+ children: /* @__PURE__ */ jsx(IconButton, {
966
+ "aria-label": t("studio_storage_download"),
980
967
  size: "small",
981
- onClick: onClose,
982
- children: /* @__PURE__ */ jsx(XIcon, { size: iconSize.smallest })
968
+ onClick: handleDownload,
969
+ children: /* @__PURE__ */ jsx(DownloadIcon, { size: iconSize.smallest })
983
970
  })
984
- ]
985
- })]
986
- }),
987
- /* @__PURE__ */ jsx("div", {
988
- className: "flex-1 overflow-auto",
989
- children: /* @__PURE__ */ jsx("div", {
990
- className: cls("flex flex-col items-center justify-center min-h-[200px] p-4 bg-surface-sheet border-b", defaultBorderMixin),
991
- children: (() => {
992
- const ext = getExtension(file.name)?.toLowerCase() || "";
993
- const isImage = file.contentType?.startsWith("image/") || IMAGE_EXTENSIONS.includes(ext);
994
- const isVideo = file.contentType?.startsWith("video/") || VIDEO_EXTENSIONS.includes(ext);
995
- const isAudio = file.contentType?.startsWith("audio/") || AUDIO_EXTENSIONS.includes(ext);
996
- const previewUrl = link?.url;
997
- if (isImage && previewUrl) return /* @__PURE__ */ jsx("img", {
998
- src: previewUrl,
999
- alt: file.name,
1000
- className: "max-w-full max-h-[400px] object-contain rounded-md shadow-sm"
1001
- });
1002
- else if (isVideo && previewUrl) return /* @__PURE__ */ jsx("video", {
971
+ }),
972
+ /* @__PURE__ */ jsx(Tooltip, {
973
+ title: t("studio_storage_delete"),
974
+ children: /* @__PURE__ */ jsx(IconButton, {
975
+ "aria-label": t("studio_storage_delete"),
976
+ size: "small",
977
+ onClick: () => setDeleteDialogOpen(true),
978
+ className: "text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20",
979
+ children: /* @__PURE__ */ jsx(Trash2Icon, { size: iconSize.smallest })
980
+ })
981
+ }),
982
+ /* @__PURE__ */ jsx(IconButton, {
983
+ "aria-label": t("close"),
984
+ size: "small",
985
+ onClick: onClose,
986
+ children: /* @__PURE__ */ jsx(XIcon, { size: iconSize.smallest })
987
+ })
988
+ ]
989
+ })]
990
+ }), /* @__PURE__ */ jsxs("div", {
991
+ className: "flex-1 overflow-auto",
992
+ children: [/* @__PURE__ */ jsx("div", {
993
+ className: "mx-3 flex flex-col items-center justify-center min-h-[200px] p-4 rounded-lg bg-surface-field",
994
+ children: (() => {
995
+ const ext = getExtension(file.name)?.toLowerCase() || "";
996
+ const isImage = file.contentType?.startsWith("image/") || IMAGE_EXTENSIONS.includes(ext);
997
+ const isVideo = file.contentType?.startsWith("video/") || VIDEO_EXTENSIONS.includes(ext);
998
+ const isAudio = file.contentType?.startsWith("audio/") || AUDIO_EXTENSIONS.includes(ext);
999
+ const previewUrl = link?.url;
1000
+ if (isImage && previewUrl) return /* @__PURE__ */ jsx("img", {
1001
+ src: previewUrl,
1002
+ alt: file.name,
1003
+ className: "max-w-full max-h-[400px] object-contain rounded-md"
1004
+ });
1005
+ else if (isVideo && previewUrl) return /* @__PURE__ */ jsx("video", {
1006
+ src: previewUrl,
1007
+ className: "max-w-full max-h-[400px] rounded-md",
1008
+ controls: true
1009
+ });
1010
+ else if (isAudio && previewUrl) return /* @__PURE__ */ jsxs("div", {
1011
+ className: "flex flex-col items-center gap-4",
1012
+ children: [/* @__PURE__ */ jsx(Music2Icon, {
1013
+ size: 32,
1014
+ className: "text-text-disabled dark:text-text-disabled-dark"
1015
+ }), /* @__PURE__ */ jsx("audio", {
1003
1016
  src: previewUrl,
1004
- className: "max-w-full max-h-[400px] rounded-md",
1005
- controls: true
1006
- });
1007
- else if (isAudio && previewUrl) return /* @__PURE__ */ jsxs("div", {
1008
- className: "flex flex-col items-center gap-4",
1009
- children: [/* @__PURE__ */ jsx(Music2Icon, { className: "text-surface-accent-400 w-10 h-10" }), /* @__PURE__ */ jsx("audio", {
1010
- src: previewUrl,
1011
- controls: true,
1012
- className: "w-full max-w-xs"
1013
- })]
1014
- });
1015
- else return /* @__PURE__ */ jsxs("div", {
1016
- className: "flex flex-col items-center gap-3 text-surface-accent-400",
1017
- children: [/* @__PURE__ */ jsx(FileIconComponent, { className: "w-10 h-10" }), /* @__PURE__ */ jsx(Typography, {
1018
- variant: "caption",
1019
- className: "text-text-disabled dark:text-text-disabled-dark",
1020
- children: t("studio_storage_no_preview")
1021
- })]
1022
- });
1023
- })()
1024
- })
1025
- }),
1026
- /* @__PURE__ */ jsxs("div", {
1017
+ controls: true,
1018
+ className: "w-full max-w-xs"
1019
+ })]
1020
+ });
1021
+ else return /* @__PURE__ */ jsxs("div", {
1022
+ className: "flex flex-col items-center gap-3",
1023
+ children: [/* @__PURE__ */ jsx(FileIconComponent, {
1024
+ size: 32,
1025
+ className: "text-text-disabled dark:text-text-disabled-dark"
1026
+ }), /* @__PURE__ */ jsx(Typography, {
1027
+ variant: "caption",
1028
+ color: "disabled",
1029
+ children: t("studio_storage_no_preview")
1030
+ })]
1031
+ });
1032
+ })()
1033
+ }), /* @__PURE__ */ jsxs("div", {
1027
1034
  className: "p-4 space-y-3",
1028
1035
  children: [
1029
1036
  /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Typography, {
@@ -1037,7 +1044,8 @@ function FilePreviewPanel({ file, onClose, onDelete, link, mintLink }) {
1037
1044
  children: [
1038
1045
  /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(Typography, {
1039
1046
  variant: "caption",
1040
- className: "text-surface-accent-500 text-xs",
1047
+ color: "secondary",
1048
+ className: "block",
1041
1049
  children: t("studio_storage_name")
1042
1050
  }), /* @__PURE__ */ jsx(Typography, {
1043
1051
  variant: "body2",
@@ -1046,7 +1054,8 @@ function FilePreviewPanel({ file, onClose, onDelete, link, mintLink }) {
1046
1054
  })] }),
1047
1055
  /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(Typography, {
1048
1056
  variant: "caption",
1049
- className: "text-surface-accent-500 text-xs",
1057
+ color: "secondary",
1058
+ className: "block",
1050
1059
  children: t("studio_storage_type")
1051
1060
  }), /* @__PURE__ */ jsx(Typography, {
1052
1061
  variant: "body2",
@@ -1055,7 +1064,8 @@ function FilePreviewPanel({ file, onClose, onDelete, link, mintLink }) {
1055
1064
  })] }),
1056
1065
  file.size !== void 0 && /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(Typography, {
1057
1066
  variant: "caption",
1058
- className: "text-surface-accent-500 text-xs",
1067
+ color: "secondary",
1068
+ className: "block",
1059
1069
  children: t("studio_storage_size")
1060
1070
  }), /* @__PURE__ */ jsx(Typography, {
1061
1071
  variant: "body2",
@@ -1064,7 +1074,8 @@ function FilePreviewPanel({ file, onClose, onDelete, link, mintLink }) {
1064
1074
  })] }),
1065
1075
  /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(Typography, {
1066
1076
  variant: "caption",
1067
- className: "text-surface-accent-500 text-xs",
1077
+ color: "secondary",
1078
+ className: "block",
1068
1079
  children: t("studio_storage_extension")
1069
1080
  }), /* @__PURE__ */ jsx(Typography, {
1070
1081
  variant: "body2",
@@ -1075,7 +1086,8 @@ function FilePreviewPanel({ file, onClose, onDelete, link, mintLink }) {
1075
1086
  className: "col-span-2",
1076
1087
  children: [/* @__PURE__ */ jsx(Typography, {
1077
1088
  variant: "caption",
1078
- className: "text-surface-accent-500 text-xs",
1089
+ color: "secondary",
1090
+ className: "block",
1079
1091
  children: t("studio_storage_path")
1080
1092
  }), /* @__PURE__ */ jsx(Typography, {
1081
1093
  variant: "body2",
@@ -1090,11 +1102,12 @@ function FilePreviewPanel({ file, onClose, onDelete, link, mintLink }) {
1090
1102
  children: [
1091
1103
  /* @__PURE__ */ jsx(Typography, {
1092
1104
  variant: "caption",
1093
- className: "text-surface-accent-500 text-xs block mb-1",
1105
+ color: "secondary",
1106
+ className: "block mb-1",
1094
1107
  children: t("studio_storage_url")
1095
1108
  }),
1096
1109
  /* @__PURE__ */ jsxs("div", {
1097
- className: cls("flex items-center gap-2 p-2 rounded cursor-pointer transition-colors", "bg-surface-raised hover:bg-surface-raised-hover"),
1110
+ className: cls("flex items-center gap-2 p-2 rounded-lg cursor-pointer transition-colors", "bg-surface-field hover:bg-surface-hover"),
1098
1111
  onClick: handleCopy,
1099
1112
  children: [/* @__PURE__ */ jsx(Typography, {
1100
1113
  variant: "caption",
@@ -1109,7 +1122,7 @@ function FilePreviewPanel({ file, onClose, onDelete, link, mintLink }) {
1109
1122
  className: "text-green-500"
1110
1123
  }) : /* @__PURE__ */ jsx(CopyIcon, {
1111
1124
  size: 14,
1112
- className: "text-surface-accent-400"
1125
+ className: "text-text-secondary dark:text-text-secondary-dark"
1113
1126
  })
1114
1127
  })
1115
1128
  })]
@@ -1128,8 +1141,8 @@ function FilePreviewPanel({ file, onClose, onDelete, link, mintLink }) {
1128
1141
  ]
1129
1142
  })
1130
1143
  ]
1131
- })
1132
- ]
1144
+ })]
1145
+ })]
1133
1146
  }), /* @__PURE__ */ jsxs(Dialog, {
1134
1147
  open: deleteDialogOpen,
1135
1148
  onOpenChange: setDeleteDialogOpen,
@@ -1162,31 +1175,16 @@ function FilePreviewPanel({ file, onClose, onDelete, link, mintLink }) {
1162
1175
  ]
1163
1176
  })] });
1164
1177
  }
1165
- var StorageView = () => {
1166
- const [tab, setTab] = useState("files");
1167
- const { t } = useTranslation();
1168
- return /* @__PURE__ */ jsxs("div", {
1169
- className: "flex flex-col h-full w-full overflow-hidden",
1170
- children: [/* @__PURE__ */ jsxs(Tabs, {
1171
- value: tab,
1172
- onValueChange: (v) => {
1173
- if (v === "files" || v === "policies") setTab(v);
1174
- },
1175
- variant: "boxy",
1176
- className: "border-b border-hairline px-4 bg-surface-sheet shrink-0",
1177
- children: [/* @__PURE__ */ jsx(Tab, {
1178
- value: "files",
1179
- children: t("studio_storage_tab_files")
1180
- }), /* @__PURE__ */ jsx(Tab, {
1181
- value: "policies",
1182
- children: t("studio_storage_tab_policies")
1183
- })]
1184
- }), /* @__PURE__ */ jsx("div", {
1185
- className: "flex-1 min-h-0 overflow-hidden",
1186
- children: tab === "files" ? /* @__PURE__ */ jsx(StorageFilesBrowser, {}) : /* @__PURE__ */ jsx(StoragePoliciesPanel, {})
1187
- })]
1188
- });
1189
- };
1178
+ /**
1179
+ * The Storage view, laid out as the Tables view is: the source's top-level
1180
+ * folders in a side list, and for the folder open its path, its tabs (the
1181
+ * files, and the access policies), a toolbar and the contents.
1182
+ */
1183
+ var StorageView = () => /* @__PURE__ */ jsx(StorageFilesBrowser, {});
1184
+ /** The name a folder is listed by, without the trailing slash some sources give a prefix. */
1185
+ function folderKey(fullPath) {
1186
+ return fullPath.replace(/\/+$/, "");
1187
+ }
1190
1188
  var StorageFilesBrowser = () => {
1191
1189
  const { t } = useTranslation();
1192
1190
  const defaultStorageSource = useStorageSource();
@@ -1209,6 +1207,19 @@ var StorageFilesBrowser = () => {
1209
1207
  /** The source `files` were listed from: their metadata is read through it, whatever is selected since. */
1210
1208
  const [listedFrom, setListedFrom] = useState(null);
1211
1209
  const [viewMode, setViewMode] = useState("grid");
1210
+ const [tab, setTab] = useState("files");
1211
+ /** What the folder open is narrowed to, by name. A folder opened starts unfiltered. */
1212
+ const [filter, setFilter] = useState("");
1213
+ /**
1214
+ * The source's top-level folders, for the side list, and the source they
1215
+ * were listed from. Kept apart from `folders`: the side list stays while a
1216
+ * folder below is open.
1217
+ */
1218
+ const [rootFolders, setRootFolders] = useState(null);
1219
+ const selectedSourceKeyRef = useRef(selectedSourceKey);
1220
+ useEffect(() => {
1221
+ selectedSourceKeyRef.current = selectedSourceKey;
1222
+ }, [selectedSourceKey]);
1212
1223
  const { metadata, observe: observeFile } = useVisibleFileMetadata(listedFrom, files, useCallback((file) => file.size === void 0 || viewMode === "grid" && isImageFile(file), [viewMode]));
1213
1224
  /** `file` with what its metadata has said so far, over what the listing said. */
1214
1225
  const withMetadata = useCallback((file) => {
@@ -1272,6 +1283,10 @@ var StorageFilesBrowser = () => {
1272
1283
  setFolders(folderItems);
1273
1284
  setFiles(fileItems);
1274
1285
  setListedFrom(source);
1286
+ if (!path) setRootFolders({
1287
+ source: selectedSourceKeyRef.current,
1288
+ folders: folderItems
1289
+ });
1275
1290
  } catch (e) {
1276
1291
  if (!isCurrent()) return;
1277
1292
  console.error("Storage list error:", e);
@@ -1287,6 +1302,34 @@ var StorageFilesBrowser = () => {
1287
1302
  fetchContents,
1288
1303
  selectedSourceKey
1289
1304
  ]);
1305
+ useEffect(() => {
1306
+ if (!currentPath || rootFolders?.source === selectedSourceKey) return;
1307
+ let current = true;
1308
+ const source = storageSourceRef.current;
1309
+ listAllPages(source, "").then((result) => {
1310
+ if (!current) return;
1311
+ setRootFolders({
1312
+ source: selectedSourceKey,
1313
+ folders: result.prefixes.map((ref) => ({
1314
+ name: ref.name,
1315
+ fullPath: ref.fullPath,
1316
+ isFolder: true
1317
+ }))
1318
+ });
1319
+ }).catch(() => {
1320
+ if (current) setRootFolders({
1321
+ source: selectedSourceKey,
1322
+ folders: []
1323
+ });
1324
+ });
1325
+ return () => {
1326
+ current = false;
1327
+ };
1328
+ }, [
1329
+ currentPath,
1330
+ rootFolders?.source,
1331
+ selectedSourceKey
1332
+ ]);
1290
1333
  /** A link to `file`, minted now through the source being browsed — see {@link FileLink}. */
1291
1334
  const mintFileLink = useCallback(async (file) => fileLinkOf(await storageSourceRef.current.getSignedUrl(file.fullPath), file.fullPath), []);
1292
1335
  /** Open `file` in the preview, with a link minted for it now. */
@@ -1322,6 +1365,7 @@ var StorageFilesBrowser = () => {
1322
1365
  return next;
1323
1366
  }, { replace: true });
1324
1367
  clearSelection();
1368
+ setFilter("");
1325
1369
  }, [setSearchParams, clearSelection]);
1326
1370
  const handleSourceChange = useCallback((key) => {
1327
1371
  setSelectedSourceKey(key);
@@ -1332,7 +1376,15 @@ var StorageFilesBrowser = () => {
1332
1376
  parts.pop();
1333
1377
  handleNavigate(parts.join("/"));
1334
1378
  }, [currentPath, handleNavigate]);
1335
- const allItems = useMemo(() => [...folders, ...files], [folders, files]);
1379
+ const query = filter.trim().toLowerCase();
1380
+ const visibleFolders = useMemo(() => query ? folders.filter((folder) => folder.name.toLowerCase().includes(query)) : folders, [folders, query]);
1381
+ const visibleFiles = useMemo(() => query ? files.filter((file) => file.name.toLowerCase().includes(query)) : files, [files, query]);
1382
+ const handleFilter = useCallback((value) => {
1383
+ setFilter(value);
1384
+ setSelectedPaths(/* @__PURE__ */ new Set());
1385
+ lastClickedRef.current = null;
1386
+ }, []);
1387
+ const allItems = useMemo(() => [...visibleFolders, ...visibleFiles], [visibleFolders, visibleFiles]);
1336
1388
  const handleItemClick = useCallback((item, e) => {
1337
1389
  const path = item.fullPath;
1338
1390
  if (e.metaKey || e.ctrlKey) {
@@ -1664,19 +1716,18 @@ var StorageFilesBrowser = () => {
1664
1716
  ]);
1665
1717
  const handleRefresh = useCallback(() => {
1666
1718
  fetchContents(currentPath);
1719
+ if (currentPath) setRootFolders(null);
1667
1720
  }, [currentPath, fetchContents]);
1668
1721
  const segments = breadcrumbSegments(currentPath, t("studio_storage_root"));
1722
+ const sourceLabel = (key) => storageSources.registry[key]?.label ?? (key === DEFAULT_STORAGE_SOURCE_KEY ? t("studio_storage_default_source") : key);
1723
+ const openNewFolder = () => {
1724
+ setNewFolderName("");
1725
+ setNewFolderDialogOpen(true);
1726
+ };
1669
1727
  const renderContents = () => {
1670
1728
  if (loading) return /* @__PURE__ */ jsx("div", {
1671
1729
  className: "flex-grow flex items-center justify-center",
1672
- children: /* @__PURE__ */ jsxs("div", {
1673
- className: "text-center",
1674
- children: [/* @__PURE__ */ jsx(CircularProgress, { size: "medium" }), /* @__PURE__ */ jsx(Typography, {
1675
- variant: "body2",
1676
- className: "mt-4 text-text-secondary dark:text-text-secondary-dark font-mono tracking-tight animate-pulse",
1677
- children: t("studio_storage_loading")
1678
- })]
1679
- })
1730
+ children: /* @__PURE__ */ jsx(CircularProgress, { size: "small" })
1680
1731
  });
1681
1732
  if (failure?.kind === "denied") return /* @__PURE__ */ jsx("div", {
1682
1733
  className: "flex-grow flex items-center justify-center p-6 overflow-auto",
@@ -1690,12 +1741,14 @@ var StorageFilesBrowser = () => {
1690
1741
  }),
1691
1742
  /* @__PURE__ */ jsx(Typography, {
1692
1743
  variant: "body2",
1693
- className: "text-text-secondary dark:text-text-secondary-dark block mt-2",
1744
+ color: "secondary",
1745
+ className: "block mt-2",
1694
1746
  children: t("studio_storage_denied_hint")
1695
1747
  }),
1696
1748
  /* @__PURE__ */ jsx(Typography, {
1697
1749
  variant: "caption",
1698
- className: "text-text-disabled dark:text-text-disabled-dark block mt-3 font-mono break-all",
1750
+ color: "disabled",
1751
+ className: "block mt-3 font-mono break-all",
1699
1752
  children: failure.detail
1700
1753
  })
1701
1754
  ]
@@ -1709,44 +1762,45 @@ var StorageFilesBrowser = () => {
1709
1762
  onRetry: failure.retryable ? handleRefresh : void 0
1710
1763
  })
1711
1764
  });
1765
+ if (folders.length === 0 && files.length === 0) return /* @__PURE__ */ jsxs("div", {
1766
+ className: "flex-grow flex flex-col items-center justify-center p-8 text-center gap-4",
1767
+ children: [
1768
+ /* @__PURE__ */ jsx(FolderIcon, { className: "w-10 h-10 text-text-disabled dark:text-text-disabled-dark" }),
1769
+ /* @__PURE__ */ jsx(Typography, {
1770
+ variant: "body2",
1771
+ color: "secondary",
1772
+ children: t("studio_storage_empty")
1773
+ }),
1774
+ /* @__PURE__ */ jsxs("div", {
1775
+ className: "flex items-center gap-2",
1776
+ children: [/* @__PURE__ */ jsxs(Button, {
1777
+ size: "small",
1778
+ variant: "outlined",
1779
+ onClick: openNewFolder,
1780
+ children: [/* @__PURE__ */ jsx(FolderPlusIcon, { size: iconSize.smallest }), t("studio_storage_new_folder")]
1781
+ }), /* @__PURE__ */ jsxs(Button, {
1782
+ size: "small",
1783
+ variant: "outlined",
1784
+ onClick: () => setUploadDialogOpen(true),
1785
+ children: [/* @__PURE__ */ jsx(UploadCloudIcon, { size: iconSize.smallest }), t("studio_storage_upload_files")]
1786
+ })]
1787
+ })
1788
+ ]
1789
+ });
1712
1790
  if (allItems.length === 0) return /* @__PURE__ */ jsx("div", {
1713
- className: "flex-grow flex items-center justify-center text-text-disabled dark:text-text-disabled-dark",
1714
- children: /* @__PURE__ */ jsxs("div", {
1715
- className: "text-center",
1716
- children: [
1717
- /* @__PURE__ */ jsx("svg", {
1718
- className: "w-12 h-12 mx-auto mb-4 opacity-50",
1719
- fill: "none",
1720
- stroke: "currentColor",
1721
- viewBox: "0 0 24 24",
1722
- children: /* @__PURE__ */ jsx("path", {
1723
- strokeLinecap: "round",
1724
- strokeLinejoin: "round",
1725
- strokeWidth: 1,
1726
- d: "M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"
1727
- })
1728
- }),
1729
- /* @__PURE__ */ jsx(Typography, {
1730
- variant: "body2",
1731
- children: t("studio_storage_empty")
1732
- }),
1733
- /* @__PURE__ */ jsxs("div", {
1734
- className: "flex items-center gap-2 mt-3",
1735
- children: [/* @__PURE__ */ jsxs(Button, {
1736
- variant: "text",
1737
- onClick: () => {
1738
- setNewFolderName("");
1739
- setNewFolderDialogOpen(true);
1740
- },
1741
- children: [/* @__PURE__ */ jsx(FolderPlusIcon, { size: iconSize.smallest }), t("studio_storage_new_folder")]
1742
- }), /* @__PURE__ */ jsxs(Button, {
1743
- onClick: () => setUploadDialogOpen(true),
1744
- children: [/* @__PURE__ */ jsx(PlusIcon, { size: iconSize.smallest }), t("studio_storage_upload_files")]
1745
- })]
1746
- })
1747
- ]
1791
+ className: "flex-grow flex items-center justify-center p-8 text-center",
1792
+ children: /* @__PURE__ */ jsx(Typography, {
1793
+ variant: "body2",
1794
+ color: "secondary",
1795
+ children: t("studio_storage_no_match", { query: filter.trim() })
1748
1796
  })
1749
1797
  });
1798
+ const toggleChecked = (path) => setSelectedPaths((prev) => {
1799
+ const next = new Set(prev);
1800
+ if (next.has(path)) next.delete(path);
1801
+ else next.add(path);
1802
+ return next;
1803
+ });
1750
1804
  if (viewMode === "list") return /* @__PURE__ */ jsx("div", {
1751
1805
  className: "flex-grow overflow-auto",
1752
1806
  children: /* @__PURE__ */ jsxs(Table, {
@@ -1755,7 +1809,7 @@ var StorageFilesBrowser = () => {
1755
1809
  className: "text-xs font-normal text-text-secondary dark:text-text-secondary-dark",
1756
1810
  children: [
1757
1811
  /* @__PURE__ */ jsx(TableCell, {
1758
- className: "pl-3 pr-0 py-2 w-8",
1812
+ className: "pl-4 pr-0 py-2 w-8",
1759
1813
  children: /* @__PURE__ */ jsx(Checkbox, {
1760
1814
  size: "small",
1761
1815
  checked: allItems.length > 0 && selectedPaths.size === allItems.length,
@@ -1779,37 +1833,30 @@ var StorageFilesBrowser = () => {
1779
1833
  ]
1780
1834
  }), /* @__PURE__ */ jsxs(TableBody, {
1781
1835
  variant: "list",
1782
- children: [folders.map((folder) => {
1836
+ children: [visibleFolders.map((folder) => {
1783
1837
  const isChecked = selectedPaths.has(folder.fullPath);
1784
1838
  return /* @__PURE__ */ jsxs(TableRow, {
1785
1839
  "data-storage-item": true,
1786
- className: cls("group", isChecked && "bg-primary/5 dark:bg-primary/10"),
1840
+ className: cls("cursor-pointer", isChecked && "bg-surface-active"),
1787
1841
  onClick: (e) => handleItemClick(folder, e),
1788
1842
  onDoubleClick: () => handleItemDoubleClick(folder),
1789
1843
  children: [
1790
1844
  /* @__PURE__ */ jsx(TableCell, {
1791
- className: "pl-3 pr-0 py-2.5",
1845
+ className: "pl-4 pr-0 py-2",
1792
1846
  onClick: (e) => e.stopPropagation(),
1793
1847
  children: /* @__PURE__ */ jsx(Checkbox, {
1794
1848
  size: "small",
1795
1849
  checked: isChecked,
1796
- onCheckedChange: () => {
1797
- setSelectedPaths((prev) => {
1798
- const next = new Set(prev);
1799
- if (next.has(folder.fullPath)) next.delete(folder.fullPath);
1800
- else next.add(folder.fullPath);
1801
- return next;
1802
- });
1803
- }
1850
+ onCheckedChange: () => toggleChecked(folder.fullPath)
1804
1851
  })
1805
1852
  }),
1806
1853
  /* @__PURE__ */ jsx(TableCell, {
1807
- className: "px-2 py-2.5",
1854
+ className: "px-2 py-2",
1808
1855
  children: /* @__PURE__ */ jsxs("div", {
1809
- className: "flex items-center gap-2",
1856
+ className: "flex items-center gap-2 min-w-0",
1810
1857
  children: [/* @__PURE__ */ jsx(FolderIcon, {
1811
- size: iconSize.smallest,
1812
- className: "text-amber-500 dark:text-amber-400 shrink-0"
1858
+ size: 14,
1859
+ className: "text-text-secondary dark:text-text-secondary-dark shrink-0"
1813
1860
  }), /* @__PURE__ */ jsx(Typography, {
1814
1861
  variant: "body2",
1815
1862
  className: "text-[13px] font-medium truncate",
@@ -1818,25 +1865,25 @@ var StorageFilesBrowser = () => {
1818
1865
  })
1819
1866
  }),
1820
1867
  /* @__PURE__ */ jsx(TableCell, {
1821
- className: "px-4 py-2.5",
1868
+ className: "px-4 py-2",
1822
1869
  children: /* @__PURE__ */ jsx(Typography, {
1823
1870
  variant: "caption",
1824
- className: "text-text-secondary dark:text-text-secondary-dark",
1871
+ color: "secondary",
1825
1872
  children: t("studio_storage_folder")
1826
1873
  })
1827
1874
  }),
1828
1875
  /* @__PURE__ */ jsx(TableCell, {
1829
- className: "px-4 py-2.5 text-right",
1876
+ className: "px-4 py-2 text-right",
1830
1877
  children: /* @__PURE__ */ jsx(Typography, {
1831
1878
  variant: "caption",
1832
- className: "text-text-disabled dark:text-text-disabled-dark",
1879
+ color: "disabled",
1833
1880
  children: "—"
1834
1881
  })
1835
1882
  }),
1836
- /* @__PURE__ */ jsx(TableCell, { className: "px-2 py-2.5" })
1883
+ /* @__PURE__ */ jsx(TableCell, { className: "px-2 py-2" })
1837
1884
  ]
1838
1885
  }, folder.fullPath);
1839
- }), files.map((listed) => {
1886
+ }), visibleFiles.map((listed) => {
1840
1887
  const file = withMetadata(listed);
1841
1888
  const FileIconComp = getFileIcon(file.contentType, file.name);
1842
1889
  const isChecked = selectedPaths.has(file.fullPath);
@@ -1844,33 +1891,26 @@ var StorageFilesBrowser = () => {
1844
1891
  ref: observeFile,
1845
1892
  "data-storage-path": file.fullPath,
1846
1893
  "data-storage-item": true,
1847
- className: cls("group", isChecked && "bg-primary/5 dark:bg-primary/10"),
1894
+ className: cls("cursor-pointer", isChecked && "bg-surface-active"),
1848
1895
  onClick: (e) => handleItemClick(file, e),
1849
1896
  onDoubleClick: () => handleItemDoubleClick(file),
1850
1897
  children: [
1851
1898
  /* @__PURE__ */ jsx(TableCell, {
1852
- className: "pl-3 pr-0 py-2.5",
1899
+ className: "pl-4 pr-0 py-2",
1853
1900
  onClick: (e) => e.stopPropagation(),
1854
1901
  children: /* @__PURE__ */ jsx(Checkbox, {
1855
1902
  size: "small",
1856
1903
  checked: isChecked,
1857
- onCheckedChange: () => {
1858
- setSelectedPaths((prev) => {
1859
- const next = new Set(prev);
1860
- if (next.has(file.fullPath)) next.delete(file.fullPath);
1861
- else next.add(file.fullPath);
1862
- return next;
1863
- });
1864
- }
1904
+ onCheckedChange: () => toggleChecked(file.fullPath)
1865
1905
  })
1866
1906
  }),
1867
1907
  /* @__PURE__ */ jsx(TableCell, {
1868
- className: "px-2 py-2.5",
1908
+ className: "px-2 py-2",
1869
1909
  children: /* @__PURE__ */ jsxs("div", {
1870
- className: "flex items-center gap-2",
1910
+ className: "flex items-center gap-2 min-w-0",
1871
1911
  children: [/* @__PURE__ */ jsx(FileIconComp, {
1872
- size: iconSize.smallest,
1873
- className: "text-surface-accent-400 shrink-0"
1912
+ size: 14,
1913
+ className: "text-text-disabled dark:text-text-disabled-dark shrink-0"
1874
1914
  }), /* @__PURE__ */ jsx(Typography, {
1875
1915
  variant: "body2",
1876
1916
  className: "text-[13px] truncate",
@@ -1879,33 +1919,36 @@ var StorageFilesBrowser = () => {
1879
1919
  })
1880
1920
  }),
1881
1921
  /* @__PURE__ */ jsx(TableCell, {
1882
- className: "px-4 py-2.5",
1922
+ className: "px-4 py-2",
1883
1923
  children: /* @__PURE__ */ jsx(Typography, {
1884
1924
  variant: "caption",
1885
- className: "text-text-secondary dark:text-text-secondary-dark",
1886
- children: getExtension(file.name) || file.contentType?.split("/")[1]?.toUpperCase() || "—"
1925
+ color: "secondary",
1926
+ children: fileTypeLabel(file)
1887
1927
  })
1888
1928
  }),
1889
1929
  /* @__PURE__ */ jsx(TableCell, {
1890
- className: "px-4 py-2.5 text-right",
1930
+ className: "px-4 py-2 text-right",
1891
1931
  children: /* @__PURE__ */ jsx(Typography, {
1892
1932
  variant: "caption",
1893
- className: "text-text-secondary dark:text-text-secondary-dark font-mono text-xs",
1933
+ color: "secondary",
1934
+ className: "font-mono",
1894
1935
  children: file.size !== void 0 ? formatFileSize(file.size) : "—"
1895
1936
  })
1896
1937
  }),
1897
1938
  /* @__PURE__ */ jsx(TableCell, {
1898
- className: "px-2 py-2.5",
1939
+ className: "px-2 py-2",
1899
1940
  onClick: (e) => e.stopPropagation(),
1900
- children: /* @__PURE__ */ jsx(IconButton, {
1901
- "aria-label": t("studio_storage_delete"),
1902
- size: "smallest",
1903
- className: "opacity-0 group-hover:opacity-100 transition-opacity",
1904
- onClick: () => {
1905
- setDeleteDialogTarget(file);
1906
- setDeleteDialogOpen(true);
1907
- },
1908
- children: /* @__PURE__ */ jsx(Trash2Icon, { size: 14 })
1941
+ children: /* @__PURE__ */ jsx(Tooltip, {
1942
+ title: t("studio_storage_delete"),
1943
+ children: /* @__PURE__ */ jsx(IconButton, {
1944
+ "aria-label": t("studio_storage_delete"),
1945
+ size: "smallest",
1946
+ onClick: () => {
1947
+ setDeleteDialogTarget(file);
1948
+ setDeleteDialogOpen(true);
1949
+ },
1950
+ children: /* @__PURE__ */ jsx(Trash2Icon, { size: 14 })
1951
+ })
1909
1952
  })
1910
1953
  })
1911
1954
  ]
@@ -1915,24 +1958,35 @@ var StorageFilesBrowser = () => {
1915
1958
  })
1916
1959
  });
1917
1960
  return /* @__PURE__ */ jsxs("div", {
1918
- className: "flex-grow overflow-auto p-4",
1919
- children: [folders.length > 0 && /* @__PURE__ */ jsxs("div", {
1920
- className: "mb-4",
1961
+ className: "flex-grow overflow-auto px-4 pb-4",
1962
+ children: [visibleFolders.length > 0 && /* @__PURE__ */ jsxs("section", {
1963
+ className: "mb-5",
1921
1964
  children: [/* @__PURE__ */ jsx(Typography, {
1922
1965
  variant: "caption",
1923
- className: "text-[10px] uppercase tracking-wider font-semibold text-text-disabled dark:text-text-disabled-dark mb-2 block",
1966
+ color: "secondary",
1967
+ className: "font-medium block mb-2",
1924
1968
  children: t("studio_storage_folders")
1925
1969
  }), /* @__PURE__ */ jsx("div", {
1926
- className: "grid gap-3 grid-cols-[repeat(auto-fill,minmax(140px,1fr))]",
1927
- children: folders.map((folder) => {
1970
+ className: "grid gap-2 grid-cols-[repeat(auto-fill,minmax(168px,1fr))]",
1971
+ children: visibleFolders.map((folder) => {
1972
+ const isChecked = selectedPaths.has(folder.fullPath);
1928
1973
  return /* @__PURE__ */ jsxs("div", {
1929
1974
  "data-storage-item": true,
1930
- className: cls("rounded-lg p-3 cursor-pointer border", "transition-colors duration-150", defaultBorderMixin, "hover:bg-surface-hover hover:shadow-sm", "flex items-center gap-2", selectedPaths.has(folder.fullPath) && "ring-2 ring-primary bg-primary/5 dark:bg-primary/10"),
1975
+ role: "button",
1976
+ tabIndex: 0,
1977
+ title: folder.name,
1978
+ className: cls("h-10 px-3 rounded-lg flex items-center gap-2 cursor-pointer transition-colors", isChecked ? "bg-surface-active ring-1 ring-primary" : "bg-surface-raised hover:bg-surface-raised-hover"),
1931
1979
  onClick: (e) => handleItemClick(folder, e),
1932
1980
  onDoubleClick: () => handleItemDoubleClick(folder),
1981
+ onKeyDown: (e) => {
1982
+ if (e.key === "Enter") {
1983
+ e.preventDefault();
1984
+ handleItemDoubleClick(folder);
1985
+ }
1986
+ },
1933
1987
  children: [/* @__PURE__ */ jsx(FolderIcon, {
1934
- size: iconSize.smallest,
1935
- className: "text-amber-500 dark:text-amber-400 shrink-0"
1988
+ size: 14,
1989
+ className: "text-text-secondary dark:text-text-secondary-dark shrink-0"
1936
1990
  }), /* @__PURE__ */ jsx(Typography, {
1937
1991
  variant: "body2",
1938
1992
  className: "text-[13px] font-medium truncate",
@@ -1941,46 +1995,74 @@ var StorageFilesBrowser = () => {
1941
1995
  }, folder.fullPath);
1942
1996
  })
1943
1997
  })]
1944
- }), files.length > 0 && /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(Typography, {
1998
+ }), visibleFiles.length > 0 && /* @__PURE__ */ jsxs("section", { children: [/* @__PURE__ */ jsx(Typography, {
1945
1999
  variant: "caption",
1946
- className: "text-[10px] uppercase tracking-wider font-semibold text-text-disabled dark:text-text-disabled-dark mb-2 block",
1947
- children: t("studio_storage_files_heading", { count: files.length })
2000
+ color: "secondary",
2001
+ className: "font-medium block mb-2",
2002
+ children: t("studio_storage_files_heading", { count: visibleFiles.length })
1948
2003
  }), /* @__PURE__ */ jsx("div", {
1949
- className: "grid gap-3 grid-cols-[repeat(auto-fill,minmax(140px,1fr))]",
1950
- children: files.map((listed) => {
2004
+ className: "grid gap-3 grid-cols-[repeat(auto-fill,minmax(168px,1fr))]",
2005
+ children: visibleFiles.map((listed) => {
1951
2006
  const file = withMetadata(listed);
1952
2007
  const FileIconComp = getFileIcon(file.contentType, file.name);
1953
2008
  const isImage = isImageFile(file);
1954
2009
  const isChecked = selectedPaths.has(file.fullPath);
2010
+ const typeLabel = fileTypeLabel(file);
1955
2011
  return /* @__PURE__ */ jsxs("div", {
1956
2012
  ref: observeFile,
1957
2013
  "data-storage-path": file.fullPath,
1958
2014
  "data-storage-item": true,
1959
- className: cls("rounded-lg overflow-hidden cursor-pointer border", "transition-shadow duration-150", defaultBorderMixin, "hover:shadow-md", isChecked && "ring-2 ring-primary"),
2015
+ role: "button",
2016
+ tabIndex: 0,
2017
+ title: file.name,
2018
+ className: cls("rounded-xl overflow-hidden cursor-pointer border transition-colors", isChecked ? "border-primary ring-1 ring-primary bg-surface-active" : cls(defaultBorderMixin, "bg-surface-card hover:bg-surface-card-hover")),
1960
2019
  onClick: (e) => handleItemClick(file, e),
1961
2020
  onDoubleClick: () => handleItemDoubleClick(file),
1962
- children: [/* @__PURE__ */ jsxs("div", {
1963
- className: "aspect-square relative overflow-hidden bg-surface-raised flex items-center justify-center",
1964
- children: [isImage && file.downloadUrl ? /* @__PURE__ */ jsx("img", {
2021
+ onKeyDown: (e) => {
2022
+ if (e.key === "Enter") {
2023
+ e.preventDefault();
2024
+ openPreview(file);
2025
+ }
2026
+ },
2027
+ children: [/* @__PURE__ */ jsx("div", {
2028
+ className: "aspect-[4/3] overflow-hidden bg-surface-field flex flex-col items-center justify-center gap-2",
2029
+ children: isImage && file.downloadUrl ? /* @__PURE__ */ jsx("img", {
1965
2030
  src: file.downloadUrl,
1966
2031
  alt: file.name,
1967
2032
  className: "w-full h-full object-cover",
1968
2033
  loading: "lazy"
1969
- }) : /* @__PURE__ */ jsx(FileIconComp, { className: "text-surface-accent-400 dark:text-surface-accent-500 w-8 h-8" }), getExtension(file.name) && /* @__PURE__ */ jsx("div", {
1970
- className: "absolute bottom-1.5 right-1.5 px-1.5 py-0.5 rounded text-[9px] font-semibold uppercase bg-black/50 text-white backdrop-blur-sm",
1971
- children: getExtension(file.name)
1972
- })]
2034
+ }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(FileIconComp, {
2035
+ size: 24,
2036
+ className: "text-text-disabled dark:text-text-disabled-dark"
2037
+ }), typeLabel !== "—" && /* @__PURE__ */ jsx(Typography, {
2038
+ variant: "caption",
2039
+ color: "disabled",
2040
+ className: "font-mono",
2041
+ children: typeLabel
2042
+ })] })
1973
2043
  }), /* @__PURE__ */ jsxs("div", {
1974
- className: "p-2.5",
2044
+ className: "px-3 py-2",
1975
2045
  children: [/* @__PURE__ */ jsx(Typography, {
1976
2046
  variant: "body2",
1977
- className: "text-[12px] font-medium truncate text-surface-900 dark:text-white",
2047
+ className: "text-[13px] font-medium truncate",
1978
2048
  children: file.name
1979
- }), /* @__PURE__ */ jsx(Typography, {
1980
- variant: "caption",
1981
- color: "secondary",
1982
- className: "truncate block mt-0.5 text-xs",
1983
- children: file.size !== void 0 ? formatFileSize(file.size) : "—"
2049
+ }), /* @__PURE__ */ jsxs("div", {
2050
+ className: "flex items-center gap-1.5 min-w-0",
2051
+ children: [typeLabel !== "—" && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Typography, {
2052
+ variant: "caption",
2053
+ color: "secondary",
2054
+ children: typeLabel
2055
+ }), /* @__PURE__ */ jsx(Typography, {
2056
+ variant: "caption",
2057
+ color: "disabled",
2058
+ "aria-hidden": true,
2059
+ children: "·"
2060
+ })] }), /* @__PURE__ */ jsx(Typography, {
2061
+ variant: "caption",
2062
+ color: "secondary",
2063
+ className: "truncate",
2064
+ children: file.size !== void 0 ? formatFileSize(file.size) : "—"
2065
+ })]
1984
2066
  })]
1985
2067
  })]
1986
2068
  }, file.fullPath);
@@ -1988,234 +2070,297 @@ var StorageFilesBrowser = () => {
1988
2070
  })] })]
1989
2071
  });
1990
2072
  };
2073
+ const rootListed = rootFolders?.source === selectedSourceKey ? rootFolders.folders : null;
2074
+ const openRootKey = currentPath.split("/").filter(Boolean)[0] ?? "";
2075
+ const countLabel = loading || failure ? null : [t("studio_storage_file_count", { count: files.length }), folders.length > 0 ? t("studio_storage_folder_count", { count: folders.length }) : null].filter(Boolean).join(" · ");
2076
+ const sideItemClass = (active) => cls("w-full text-left px-2.5 h-8 rounded-lg flex items-center gap-2 transition-colors cursor-pointer", active ? "bg-surface-active text-text-primary dark:text-text-primary-dark font-medium" : "text-text-secondary dark:text-text-secondary-dark hover:bg-surface-hover hover:text-text-primary dark:hover:text-text-primary-dark");
2077
+ const openFromSide = (path) => {
2078
+ setTab("files");
2079
+ if (path !== currentPath) handleNavigate(path);
2080
+ };
1991
2081
  return /* @__PURE__ */ jsxs("div", {
1992
2082
  className: "flex h-full w-full bg-surface-card overflow-hidden text-text-primary dark:text-text-primary-dark",
1993
2083
  children: [
1994
- /* @__PURE__ */ jsxs("div", {
1995
- className: "flex h-full w-full",
1996
- children: [/* @__PURE__ */ jsxs("div", {
1997
- className: "flex-grow flex flex-col min-w-0 h-full",
1998
- children: [
1999
- /* @__PURE__ */ jsxs("div", {
2000
- className: cls("flex items-center justify-between pr-2 border-b bg-surface-sheet shrink-0 h-10", defaultBorderMixin),
2001
- children: [/* @__PURE__ */ jsxs("div", {
2002
- className: "flex items-center gap-1.5 flex-grow overflow-hidden px-3 py-2",
2003
- children: [
2004
- currentPath && /* @__PURE__ */ jsx(Tooltip, {
2005
- title: t("studio_storage_go_up"),
2006
- children: /* @__PURE__ */ jsx(IconButton, {
2007
- "aria-label": t("studio_storage_go_up"),
2008
- size: "small",
2009
- onClick: handleNavigateUp,
2010
- children: /* @__PURE__ */ jsx(ArrowLeftIcon, { size: iconSize.smallest })
2011
- })
2012
- }),
2013
- /* @__PURE__ */ jsx("div", {
2014
- className: "flex items-center gap-0.5 overflow-x-auto no-scrollbar",
2015
- children: segments.map((seg, i) => /* @__PURE__ */ jsxs(React.Fragment, { children: [i > 0 && /* @__PURE__ */ jsx(Typography, {
2016
- variant: "caption",
2017
- className: "text-text-disabled dark:text-text-disabled-dark mx-0.5",
2084
+ /* @__PURE__ */ jsxs("aside", {
2085
+ className: cls("w-60 shrink-0 flex flex-col border-r bg-surface-card", defaultBorderMixin),
2086
+ children: [
2087
+ /* @__PURE__ */ jsxs("div", {
2088
+ className: cls("h-[42px] px-3 border-b bg-surface-sheet flex items-center justify-between gap-2 shrink-0", defaultBorderMixin),
2089
+ children: [/* @__PURE__ */ jsxs("div", {
2090
+ className: "flex items-center gap-2 min-w-0",
2091
+ children: [/* @__PURE__ */ jsx(LucideIconByName, {
2092
+ name: "HardDrive",
2093
+ size: 14,
2094
+ className: "text-text-secondary dark:text-text-secondary-dark shrink-0"
2095
+ }), /* @__PURE__ */ jsx(Typography, {
2096
+ variant: "caption",
2097
+ className: "font-medium text-text-secondary dark:text-text-secondary-dark truncate",
2098
+ children: t("studio_tool_storage")
2099
+ })]
2100
+ }), /* @__PURE__ */ jsx("div", {
2101
+ className: "flex items-center gap-1",
2102
+ children: /* @__PURE__ */ jsx(Tooltip, {
2103
+ title: t("studio_storage_refresh"),
2104
+ children: /* @__PURE__ */ jsx(IconButton, {
2105
+ size: "small",
2106
+ "aria-label": t("studio_storage_refresh"),
2107
+ onClick: handleRefresh,
2108
+ disabled: loading,
2109
+ children: /* @__PURE__ */ jsx(RefreshCwIcon, { size: iconSize.smallest })
2110
+ })
2111
+ })
2112
+ })]
2113
+ }),
2114
+ /* @__PURE__ */ jsx("div", {
2115
+ className: "px-2 pt-2",
2116
+ children: /* @__PURE__ */ jsx(ToggleButtonGroup, {
2117
+ fullWidth: true,
2118
+ "aria-label": t("studio_storage_view_mode"),
2119
+ value: viewMode,
2120
+ onValueChange: (mode) => {
2121
+ setViewMode(mode);
2122
+ setTab("files");
2123
+ },
2124
+ options: [{
2125
+ value: "grid",
2126
+ label: t("studio_storage_mode_grid"),
2127
+ icon: /* @__PURE__ */ jsx(LayoutGridIcon, { size: iconSize.smallest })
2128
+ }, {
2129
+ value: "list",
2130
+ label: t("studio_storage_mode_list"),
2131
+ icon: /* @__PURE__ */ jsx(ListIcon, { size: iconSize.smallest })
2132
+ }]
2133
+ })
2134
+ }),
2135
+ sourceKeys.length > 1 && /* @__PURE__ */ jsx("div", {
2136
+ className: "px-2 pt-2",
2137
+ children: /* @__PURE__ */ jsx(Select, {
2138
+ size: "small",
2139
+ fullWidth: true,
2140
+ position: "item-aligned",
2141
+ value: selectedSourceKey,
2142
+ onValueChange: (value) => {
2143
+ if (value && value !== selectedSourceKey) handleSourceChange(value);
2144
+ },
2145
+ renderValue: sourceLabel,
2146
+ children: sourceKeys.map((key) => /* @__PURE__ */ jsx(SelectItem, {
2147
+ value: key,
2148
+ children: sourceLabel(key)
2149
+ }, key))
2150
+ })
2151
+ }),
2152
+ /* @__PURE__ */ jsxs("nav", {
2153
+ className: "flex-1 overflow-y-auto px-2 pt-2 pb-3 flex flex-col gap-0.5",
2154
+ "aria-label": t("studio_storage_folders"),
2155
+ children: [/* @__PURE__ */ jsxs("button", {
2156
+ type: "button",
2157
+ className: sideItemClass(tab === "files" && !currentPath),
2158
+ onClick: () => openFromSide(""),
2159
+ children: [/* @__PURE__ */ jsx(HomeIcon, {
2160
+ size: 14,
2161
+ className: "shrink-0 text-text-disabled dark:text-text-disabled-dark"
2162
+ }), /* @__PURE__ */ jsx("span", {
2163
+ className: "truncate text-[13px]",
2164
+ children: t("studio_storage_root")
2165
+ })]
2166
+ }), rootListed === null ? /* @__PURE__ */ jsx("div", {
2167
+ className: "flex items-center justify-center py-6",
2168
+ children: /* @__PURE__ */ jsx(CircularProgress, { size: "small" })
2169
+ }) : rootListed.map((folder) => {
2170
+ const key = folderKey(folder.fullPath);
2171
+ return /* @__PURE__ */ jsxs("button", {
2172
+ type: "button",
2173
+ title: folder.name,
2174
+ className: cls(sideItemClass(tab === "files" && openRootKey === key), "pl-5"),
2175
+ onClick: () => openFromSide(key),
2176
+ children: [/* @__PURE__ */ jsx(FolderIcon, {
2177
+ size: 14,
2178
+ className: "shrink-0 text-text-disabled dark:text-text-disabled-dark"
2179
+ }), /* @__PURE__ */ jsx("span", {
2180
+ className: "truncate text-[13px]",
2181
+ children: folder.name
2182
+ })]
2183
+ }, folder.fullPath);
2184
+ })]
2185
+ })
2186
+ ]
2187
+ }),
2188
+ /* @__PURE__ */ jsxs("main", {
2189
+ className: "flex-1 flex flex-col min-w-0 overflow-hidden",
2190
+ children: [
2191
+ /* @__PURE__ */ jsx("div", {
2192
+ className: "h-[42px] px-4 flex items-center justify-between gap-4 bg-surface-sheet shrink-0",
2193
+ children: /* @__PURE__ */ jsxs("div", {
2194
+ className: "flex items-center gap-2.5 min-w-0",
2195
+ children: [
2196
+ currentPath && /* @__PURE__ */ jsx(Tooltip, {
2197
+ title: t("studio_storage_go_up"),
2198
+ children: /* @__PURE__ */ jsx(IconButton, {
2199
+ "aria-label": t("studio_storage_go_up"),
2200
+ size: "small",
2201
+ onClick: handleNavigateUp,
2202
+ children: /* @__PURE__ */ jsx(ArrowLeftIcon, { size: iconSize.smallest })
2203
+ })
2204
+ }),
2205
+ /* @__PURE__ */ jsx("div", {
2206
+ className: "flex items-center min-w-0 overflow-x-auto no-scrollbar font-mono",
2207
+ children: segments.map((seg, i) => {
2208
+ const last = i === segments.length - 1;
2209
+ return /* @__PURE__ */ jsxs(React.Fragment, { children: [i > 0 && /* @__PURE__ */ jsx(Typography, {
2210
+ variant: "subtitle2",
2211
+ color: "disabled",
2212
+ className: "font-mono px-0.5",
2018
2213
  children: "/"
2019
- }), /* @__PURE__ */ jsx(Button, {
2020
- variant: "text",
2021
- size: "small",
2022
- className: cls("px-1.5 py-0.5 min-h-0 min-w-0 h-6 text-xs whitespace-nowrap normal-case font-normal", i === segments.length - 1 ? "text-text-primary dark:text-text-primary-dark font-medium" : "text-text-secondary dark:text-text-secondary-dark"),
2023
- onClick: () => handleNavigate(seg.path),
2214
+ }), last ? /* @__PURE__ */ jsx(Typography, {
2215
+ variant: "subtitle2",
2216
+ className: "font-mono font-semibold whitespace-nowrap px-1",
2024
2217
  children: seg.label
2025
- })] }, seg.path))
2026
- }),
2027
- /* @__PURE__ */ jsx("div", { className: "flex-1" }),
2028
- selectedPaths.size > 0 ? /* @__PURE__ */ jsxs("div", {
2029
- className: "flex items-center gap-1.5 shrink-0",
2030
- children: [
2031
- /* @__PURE__ */ jsx(Typography, {
2032
- variant: "body2",
2033
- className: "text-[13px] font-medium whitespace-nowrap",
2034
- children: t("studio_storage_selected_count", { count: selectedPaths.size })
2035
- }),
2036
- /* @__PURE__ */ jsxs(Button, {
2037
- size: "small",
2038
- variant: "text",
2039
- onClick: () => {
2040
- setDeleteDialogTarget("selection");
2041
- setDeleteDialogOpen(true);
2042
- },
2043
- children: [/* @__PURE__ */ jsx(Trash2Icon, {
2044
- size: 14,
2045
- className: "mr-1"
2046
- }), t("studio_storage_delete")]
2047
- }),
2048
- /* @__PURE__ */ jsxs(Button, {
2049
- size: "small",
2050
- variant: "text",
2051
- onClick: () => {
2052
- setSelectedPaths(/* @__PURE__ */ new Set());
2053
- setSelectedFile(null);
2054
- setSelectedLink(null);
2055
- },
2056
- children: [/* @__PURE__ */ jsx(XIcon, {
2057
- size: 14,
2058
- className: "mr-1"
2059
- }), t("studio_storage_deselect")]
2218
+ }) : /* @__PURE__ */ jsx("button", {
2219
+ type: "button",
2220
+ className: "px-1 rounded-md whitespace-nowrap hover:bg-surface-hover cursor-pointer",
2221
+ onClick: () => {
2222
+ setTab("files");
2223
+ handleNavigate(seg.path);
2224
+ },
2225
+ children: /* @__PURE__ */ jsx(Typography, {
2226
+ variant: "subtitle2",
2227
+ color: "secondary",
2228
+ className: "font-mono",
2229
+ children: seg.label
2060
2230
  })
2061
- ]
2062
- }) : !loading ? /* @__PURE__ */ jsxs(Chip, {
2063
- size: "small",
2064
- className: "shrink-0 text-xs",
2065
- children: [t("studio_storage_file_count", { count: files.length }), folders.length > 0 ? `, ${t("studio_storage_folder_count", { count: folders.length })}` : ""]
2066
- }) : null
2067
- ]
2068
- }), /* @__PURE__ */ jsxs("div", {
2069
- className: "flex shrink-0 items-center justify-end gap-1.5 pr-1",
2070
- children: [
2071
- sourceKeys.length > 1 && /* @__PURE__ */ jsx(Select, {
2231
+ })] }, seg.path);
2232
+ })
2233
+ }),
2234
+ sourceKeys.length > 1 && /* @__PURE__ */ jsx(Chip, {
2235
+ size: "smallest",
2236
+ className: "shrink-0",
2237
+ children: sourceLabel(selectedSourceKey)
2238
+ }),
2239
+ countLabel && /* @__PURE__ */ jsx(Typography, {
2240
+ variant: "caption",
2241
+ color: "secondary",
2242
+ className: "whitespace-nowrap",
2243
+ children: countLabel
2244
+ })
2245
+ ]
2246
+ })
2247
+ }),
2248
+ /* @__PURE__ */ jsxs(Tabs, {
2249
+ value: tab,
2250
+ onValueChange: (v) => {
2251
+ if (v === "files" || v === "policies") setTab(v);
2252
+ },
2253
+ variant: "boxy",
2254
+ className: "border-b border-hairline px-4 bg-surface-sheet shrink-0",
2255
+ children: [/* @__PURE__ */ jsx(Tab, {
2256
+ value: "files",
2257
+ children: t("studio_storage_tab_files")
2258
+ }), /* @__PURE__ */ jsx(Tab, {
2259
+ value: "policies",
2260
+ children: t("studio_storage_tab_policies")
2261
+ })]
2262
+ }),
2263
+ tab === "policies" ? /* @__PURE__ */ jsx("div", {
2264
+ className: "flex-1 min-h-0 overflow-hidden",
2265
+ children: /* @__PURE__ */ jsx(StoragePoliciesPanel, {})
2266
+ }) : /* @__PURE__ */ jsxs("div", {
2267
+ className: "flex-1 flex min-h-0",
2268
+ children: [/* @__PURE__ */ jsxs("div", {
2269
+ className: "flex-1 flex flex-col min-w-0",
2270
+ children: [/* @__PURE__ */ jsxs("div", {
2271
+ className: "px-4 py-2 flex items-center justify-between gap-3 shrink-0",
2272
+ children: [/* @__PURE__ */ jsxs("div", {
2273
+ className: "flex items-center gap-2 min-w-0",
2274
+ children: [/* @__PURE__ */ jsx(SearchBar, {
2072
2275
  size: "small",
2073
- position: "item-aligned",
2074
- value: selectedSourceKey,
2075
- onValueChange: (value) => {
2076
- if (value && value !== selectedSourceKey) handleSourceChange(value);
2077
- },
2078
- renderValue: (key) => {
2079
- return storageSources.registry[key]?.label ?? (key === DEFAULT_STORAGE_SOURCE_KEY ? t("studio_storage_default_source") : key);
2080
- },
2081
- children: sourceKeys.map((key) => /* @__PURE__ */ jsx(SelectItem, {
2082
- value: key,
2083
- children: storageSources.registry[key]?.label ?? (key === DEFAULT_STORAGE_SOURCE_KEY ? t("studio_storage_default_source") : key)
2084
- }, key))
2085
- }),
2086
- /* @__PURE__ */ jsx(Tooltip, {
2087
- title: t("studio_storage_grid_view"),
2088
- children: /* @__PURE__ */ jsx(IconButton, {
2089
- "aria-label": t("studio_storage_grid_view"),
2090
- size: "small",
2091
- onClick: () => setViewMode("grid"),
2092
- className: cls(viewMode === "grid" && "bg-surface-raised"),
2093
- children: /* @__PURE__ */ jsx(LayoutGridIcon, { size: iconSize.smallest })
2094
- })
2095
- }),
2096
- /* @__PURE__ */ jsx(Tooltip, {
2097
- title: t("studio_storage_list_view"),
2098
- children: /* @__PURE__ */ jsx(IconButton, {
2099
- "aria-label": t("studio_storage_list_view"),
2100
- size: "small",
2101
- onClick: () => setViewMode("list"),
2102
- className: cls(viewMode === "list" && "bg-surface-raised"),
2103
- children: /* @__PURE__ */ jsx(ListIcon, { size: iconSize.smallest })
2104
- })
2105
- }),
2106
- /* @__PURE__ */ jsx("div", { className: cls("h-4 w-px mx-0.5", defaultBorderMixin, "bg-surface-raised") }),
2107
- /* @__PURE__ */ jsx(Tooltip, {
2108
- title: t("studio_storage_refresh"),
2109
- children: /* @__PURE__ */ jsx(IconButton, {
2110
- "aria-label": t("studio_storage_refresh"),
2111
- size: "small",
2112
- onClick: handleRefresh,
2113
- disabled: loading,
2114
- children: /* @__PURE__ */ jsx(RefreshCwIcon, { size: iconSize.smallest })
2115
- })
2116
- }),
2117
- /* @__PURE__ */ jsx(Tooltip, {
2118
- title: t("studio_storage_new_folder"),
2119
- children: /* @__PURE__ */ jsx(IconButton, {
2120
- "aria-label": t("studio_storage_new_folder"),
2276
+ onTextSearch: (value) => handleFilter(value ?? ""),
2277
+ placeholder: t("studio_storage_filter_placeholder")
2278
+ }, `${selectedSourceKey}:${currentPath}`), selectedPaths.size > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
2279
+ /* @__PURE__ */ jsx(Typography, {
2280
+ variant: "body2",
2281
+ className: "text-[13px] font-medium whitespace-nowrap px-1",
2282
+ children: t("studio_storage_selected_count", { count: selectedPaths.size })
2283
+ }),
2284
+ /* @__PURE__ */ jsxs(Button, {
2121
2285
  size: "small",
2286
+ variant: "outlined",
2287
+ color: "error",
2122
2288
  onClick: () => {
2123
- setNewFolderName("");
2124
- setNewFolderDialogOpen(true);
2289
+ setDeleteDialogTarget("selection");
2290
+ setDeleteDialogOpen(true);
2125
2291
  },
2126
- children: /* @__PURE__ */ jsx(FolderPlusIcon, { size: iconSize.smallest })
2292
+ children: [/* @__PURE__ */ jsx(Trash2Icon, { size: iconSize.smallest }), t("studio_storage_delete")]
2293
+ }),
2294
+ /* @__PURE__ */ jsx(Button, {
2295
+ size: "small",
2296
+ variant: "text",
2297
+ onClick: clearSelection,
2298
+ children: t("studio_storage_deselect")
2127
2299
  })
2128
- }),
2129
- /* @__PURE__ */ jsxs(Button, {
2300
+ ] })]
2301
+ }), /* @__PURE__ */ jsxs("div", {
2302
+ className: "flex items-center gap-2 shrink-0",
2303
+ children: [/* @__PURE__ */ jsxs(Button, {
2304
+ size: "small",
2305
+ variant: "outlined",
2306
+ onClick: openNewFolder,
2307
+ children: [/* @__PURE__ */ jsx(FolderPlusIcon, { size: iconSize.smallest }), t("studio_storage_new_folder")]
2308
+ }), /* @__PURE__ */ jsxs(Button, {
2130
2309
  size: "small",
2131
2310
  color: "primary",
2311
+ variant: "filled",
2132
2312
  onClick: () => setUploadDialogOpen(true),
2133
- children: [/* @__PURE__ */ jsx(UploadCloudIcon, {
2134
- size: iconSize.smallest,
2135
- className: "mr-1"
2136
- }), t("studio_storage_upload")]
2313
+ children: [/* @__PURE__ */ jsx(UploadCloudIcon, { size: iconSize.smallest }), t("studio_storage_upload")]
2314
+ })]
2315
+ })]
2316
+ }), /* @__PURE__ */ jsxs("div", {
2317
+ ...getDropRootProps(),
2318
+ className: "flex-grow flex flex-col overflow-hidden min-h-0 relative",
2319
+ onClick: (e) => {
2320
+ if (!e.target.closest("[data-storage-item]") && selectedPaths.size > 0) clearSelection();
2321
+ },
2322
+ children: [
2323
+ /* @__PURE__ */ jsx("input", { ...getDropInputProps() }),
2324
+ renderContents(),
2325
+ isDragActive && /* @__PURE__ */ jsx("div", {
2326
+ className: "absolute inset-0 z-10 flex items-center justify-center bg-surface-scrim",
2327
+ children: /* @__PURE__ */ jsxs("div", {
2328
+ className: cls("flex flex-col items-center gap-2 p-6 rounded-xl border border-dashed bg-surface-card", "border-primary"),
2329
+ children: [
2330
+ /* @__PURE__ */ jsx(UploadCloudIcon, {
2331
+ size: 32,
2332
+ className: "text-primary"
2333
+ }),
2334
+ /* @__PURE__ */ jsx(Typography, {
2335
+ variant: "subtitle2",
2336
+ children: t("studio_storage_drop_to_upload")
2337
+ }),
2338
+ /* @__PURE__ */ jsxs(Typography, {
2339
+ variant: "caption",
2340
+ color: "secondary",
2341
+ className: "font-mono",
2342
+ children: ["/", currentPath]
2343
+ })
2344
+ ]
2345
+ })
2137
2346
  })
2138
2347
  ]
2139
2348
  })]
2140
- }),
2141
- /* @__PURE__ */ jsxs("div", {
2142
- ...getDropRootProps(),
2143
- className: "flex-grow flex flex-col overflow-hidden min-h-0 relative",
2144
- onClick: (e) => {
2145
- if (!e.target.closest("[data-storage-item]") && selectedPaths.size > 0) {
2146
- setSelectedPaths(/* @__PURE__ */ new Set());
2349
+ }), selectedFile && /* @__PURE__ */ jsx("div", {
2350
+ className: "w-80 lg:w-96 shrink-0",
2351
+ children: /* @__PURE__ */ jsx(FilePreviewPanel, {
2352
+ file: withLinkFacts(withMetadata(selectedFile), selectedLink),
2353
+ link: selectedLink,
2354
+ mintLink: refreshPreviewLink,
2355
+ onClose: () => {
2147
2356
  setSelectedFile(null);
2148
2357
  setSelectedLink(null);
2149
- }
2150
- },
2151
- children: [
2152
- /* @__PURE__ */ jsx("input", { ...getDropInputProps() }),
2153
- renderContents(),
2154
- isDragActive && /* @__PURE__ */ jsx("div", {
2155
- className: "absolute inset-0 z-10 flex items-center justify-center bg-primary/5 dark:bg-primary/10 backdrop-blur-[2px]",
2156
- children: /* @__PURE__ */ jsxs("div", {
2157
- className: "flex flex-col items-center gap-2 p-6 rounded-xl border-2 border-dashed border-primary bg-surface-scrim",
2158
- children: [
2159
- /* @__PURE__ */ jsx(UploadCloudIcon, { className: "w-10 h-10 text-primary" }),
2160
- /* @__PURE__ */ jsx(Typography, {
2161
- variant: "subtitle2",
2162
- className: "text-primary font-semibold",
2163
- children: t("studio_storage_drop_to_upload")
2164
- }),
2165
- /* @__PURE__ */ jsxs(Typography, {
2166
- variant: "caption",
2167
- color: "secondary",
2168
- children: [
2169
- t("studio_storage_upload_to"),
2170
- " /",
2171
- currentPath || t("studio_storage_root_folder")
2172
- ]
2173
- })
2174
- ]
2175
- })
2176
- })
2177
- ]
2178
- }),
2179
- /* @__PURE__ */ jsxs("div", {
2180
- className: cls("px-4 py-1.5 border-t bg-surface-sheet flex items-center justify-between shrink-0", defaultBorderMixin),
2181
- children: [/* @__PURE__ */ jsxs("div", {
2182
- className: "flex items-center gap-4 text-xs",
2183
- children: [/* @__PURE__ */ jsx("span", {
2184
- className: "text-text-disabled dark:text-text-disabled-dark font-semibold uppercase tracking-tighter",
2185
- children: t("studio_storage_path")
2186
- }), /* @__PURE__ */ jsxs("span", {
2187
- className: "font-mono text-text-secondary dark:text-text-secondary-dark",
2188
- children: ["/", currentPath || ""]
2189
- })]
2190
- }), selectedPaths.size > 0 ? /* @__PURE__ */ jsx("div", {
2191
- className: "text-xs text-text-secondary dark:text-text-secondary-dark",
2192
- children: t("studio_storage_items_selected", { count: selectedPaths.size })
2193
- }) : selectedFile ? /* @__PURE__ */ jsxs("div", {
2194
- className: "text-xs text-text-secondary dark:text-text-secondary-dark",
2195
- children: [
2196
- t("studio_storage_selected_label"),
2197
- " ",
2198
- /* @__PURE__ */ jsx("span", {
2199
- className: "font-mono",
2200
- children: selectedFile.name
2201
- })
2202
- ]
2203
- }) : null]
2204
- })
2205
- ]
2206
- }), selectedFile && /* @__PURE__ */ jsx("div", {
2207
- className: "w-80 lg:w-96 shrink-0",
2208
- children: /* @__PURE__ */ jsx(FilePreviewPanel, {
2209
- file: withLinkFacts(withMetadata(selectedFile), selectedLink),
2210
- link: selectedLink,
2211
- mintLink: refreshPreviewLink,
2212
- onClose: () => {
2213
- setSelectedFile(null);
2214
- setSelectedLink(null);
2215
- },
2216
- onDelete: () => handleDeleteFile(selectedFile)
2358
+ },
2359
+ onDelete: () => handleDeleteFile(selectedFile)
2360
+ })
2361
+ })]
2217
2362
  })
2218
- })]
2363
+ ]
2219
2364
  }),
2220
2365
  /* @__PURE__ */ jsx(UploadDialog, {
2221
2366
  open: uploadDialogOpen,
@@ -2367,4 +2512,4 @@ var StorageFilesBrowser = () => {
2367
2512
  //#endregion
2368
2513
  export { StorageView };
2369
2514
 
2370
- //# sourceMappingURL=StorageView-D0D8z4lI.js.map
2515
+ //# sourceMappingURL=StorageView-DQEIDFvO.js.map