@fluid-app/portal-sdk 0.1.509 → 0.1.511

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.
@@ -7,7 +7,7 @@ import "./MobileBottomSheet-BKm3ysnd.mjs";
7
7
  import "./static-dict-adapter-DUyazFbx.mjs";
8
8
  import "./SearchSort-BYxlLq4D.mjs";
9
9
  import "./use-share-link-mOe2vbOG.mjs";
10
- import { n as shareablesScreenPropertySchema, t as ShareablesScreen } from "./ShareablesScreen-5AXAqF4v.mjs";
10
+ import { n as shareablesScreenPropertySchema, t as ShareablesScreen } from "./ShareablesScreen-CjbwoZdH.mjs";
11
11
  import "./translation-api-context-factory-BTpIuUF0.mjs";
12
12
  import "./MobileActionSheet-DBKhO5th.mjs";
13
13
  import "./ResponsiveDialog-DOIzvjZV.mjs";
@@ -41,6 +41,38 @@ const damQueryKeys = {
41
41
  ]
42
42
  };
43
43
  //#endregion
44
+ //#region ../../file-picker/core/src/types.ts
45
+ /**
46
+ * Whether each method is worth offering in a switcher. Keyed on
47
+ * {@link PickerMethod} rather than listed, so adding a variant to the union is
48
+ * a compile error here until someone decides which way it goes.
49
+ *
50
+ * `computer` is false because it renders the same tab as `upload` and nothing
51
+ * builds a `computer` entry to switch to. The cloud-storage and social sources
52
+ * are false because their tab bodies are still placeholders.
53
+ */
54
+ const PICKER_METHOD_IMPLEMENTED = {
55
+ dam: true,
56
+ media: true,
57
+ pages: true,
58
+ products: true,
59
+ enrollment_packs: true,
60
+ upload: true,
61
+ url: true,
62
+ unsplash: true,
63
+ computer: false,
64
+ "google-drive": false,
65
+ instagram: false,
66
+ facebook: false,
67
+ tiktok: false,
68
+ dropbox: false
69
+ };
70
+ /**
71
+ * Methods the picker's switchers offer, derived from
72
+ * {@link PICKER_METHOD_IMPLEMENTED} so the two cannot drift.
73
+ */
74
+ const IMPLEMENTED_PICKER_METHODS = Object.entries(PICKER_METHOD_IMPLEMENTED).filter(([, implemented]) => implemented).map(([method]) => method);
75
+ //#endregion
44
76
  //#region ../../file-picker/core/src/schemas/file-picker-config.ts
45
77
  const pickerMethodLiterals = [
46
78
  "upload",
@@ -252794,27 +252826,18 @@ DamLibrary.displayName = "DamLibrary";
252794
252826
  const FilePickerSidebar = ({ currentStep, activeMethod, onMethodChange, methods }) => {
252795
252827
  if (currentStep !== "select") return null;
252796
252828
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
252797
- className: "flex hidden h-full w-64 flex-col rounded-tl-lg border-r border-gray-200 bg-gray-50 md:flex",
252829
+ className: "hidden h-full w-64 flex-col rounded-tl-lg border-r border-gray-200 bg-gray-50 md:flex",
252798
252830
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
252799
252831
  className: "flex min-h-0 flex-1 flex-col gap-2 overflow-auto p-2",
252800
252832
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
252801
252833
  className: "flex flex-col gap-2 pt-3",
252802
252834
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
252803
252835
  className: "text-sm font-semibold text-gray-900",
252804
- children: "Select File"
252836
+ children: "Choose source"
252805
252837
  })
252806
252838
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
252807
252839
  className: "flex w-full min-w-0 flex-col gap-1 p-2",
252808
- children: methods.filter((method) => [
252809
- "dam",
252810
- "media",
252811
- "pages",
252812
- "products",
252813
- "enrollment_packs",
252814
- "upload",
252815
- "url",
252816
- "unsplash"
252817
- ].includes(method.id)).map((method) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.Button, {
252840
+ children: methods.filter((method) => IMPLEMENTED_PICKER_METHODS.includes(method.id)).map((method) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.Button, {
252818
252841
  variant: "ghost",
252819
252842
  onClick: () => onMethodChange(method.id),
252820
252843
  className: `flex h-8 w-full cursor-pointer items-center justify-start gap-2 rounded-md p-2 text-left text-sm transition-colors hover:bg-gray-100 ${activeMethod === method.id ? "bg-gray-100 font-medium text-gray-900" : "text-gray-700"}`,
@@ -252897,22 +252920,44 @@ const FilePickerFiltersPanel = ({ filters, onFiltersChange, onClear, onDone }) =
252897
252920
  FilePickerFiltersPanel.displayName = "FilePickerFiltersPanel";
252898
252921
  //#endregion
252899
252922
  //#region ../../file-picker/ui/src/components/FilePickerHeader.tsx
252900
- const FilePickerHeader = ({ currentStep, activeMethod, methods, onClose, damSearchQuery = "", onDamSearchChange, damSearching = false, thumbnailSize = 100, onThumbnailSizeChange, viewMode = "grid", onViewModeChange, showNamesOnMedia = true, onShowNamesOnMediaChange, hasSelectedFiles = false, damFolders = [], onAddToNewFolder, onAddToExistingFolder, filters, onFiltersChange, onFiltersClear, sortOption, onSortChange, unsplashSearchQuery = "", onUnsplashSearchChange, unsplashSearching = false, isUnsplashUploading = false }) => {
252923
+ const FilePickerHeader = ({ currentStep, activeMethod, methods, onClose, onMethodChange, damSearchQuery = "", onDamSearchChange, damSearching = false, thumbnailSize = 100, onThumbnailSizeChange, viewMode = "grid", onViewModeChange, showNamesOnMedia = true, onShowNamesOnMediaChange, hasSelectedFiles = false, damFolders = [], onAddToNewFolder, onAddToExistingFolder, filters, onFiltersChange, onFiltersClear, sortOption, onSortChange, unsplashSearchQuery = "", onUnsplashSearchChange, unsplashSearching = false, isUnsplashUploading = false }) => {
252901
252924
  const [filtersOpen, setFiltersOpen] = (0, react.useState)(false);
252902
252925
  const [folderActionsOpen, setFolderActionsOpen] = (0, react.useState)(false);
252903
252926
  const [sortOpen, setSortOpen] = (0, react.useState)(false);
252927
+ const [methodsOpen, setMethodsOpen] = (0, react.useState)(false);
252904
252928
  const isMobile = useIsMobile();
252905
252929
  const showMediaToolbar = currentStep === "select" && (activeMethod === "dam" || activeMethod === "media");
252906
252930
  const showUnsplashToolbar = currentStep === "select" && activeMethod === "unsplash";
252931
+ const title = currentStep === "select" ? methods.find((method) => method.id === activeMethod)?.label || "Select Files" : "Media Details";
252932
+ const switchableMethods = methods.filter((method) => IMPLEMENTED_PICKER_METHODS.includes(method.id));
252907
252933
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
252908
252934
  className: "sticky top-0 z-20 flex w-full flex-wrap items-center justify-between gap-3 border-b border-gray-100 bg-white px-6 py-3",
252909
252935
  children: [
252910
252936
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
252911
252937
  className: "flex min-w-0 flex-1 items-center gap-4",
252912
252938
  children: [
252913
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
252939
+ isMobile && currentStep === "select" && onMethodChange !== void 0 && switchableMethods.length > 1 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.Button, {
252940
+ variant: "ghost",
252941
+ type: "button",
252942
+ "data-testid": "file-picker-method-switcher",
252943
+ "aria-haspopup": "dialog",
252944
+ "aria-expanded": methodsOpen,
252945
+ onClick: () => setMethodsOpen(true),
252946
+ className: "h-8 shrink-0 gap-1 px-2 text-lg font-semibold text-gray-900 hover:bg-gray-100",
252947
+ children: [title, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ChevronDownIcon, { className: "h-4 w-4 text-gray-500" })]
252948
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MobileActionSheet.MobileActionSheet, {
252949
+ open: methodsOpen,
252950
+ onOpenChange: setMethodsOpen,
252951
+ title: "Choose source",
252952
+ actions: switchableMethods.map((method) => ({
252953
+ id: method.id,
252954
+ label: method.label,
252955
+ selected: method.id === activeMethod,
252956
+ onSelect: () => onMethodChange?.(method.id)
252957
+ }))
252958
+ })] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
252914
252959
  className: "shrink-0 text-lg font-semibold text-gray-900",
252915
- children: currentStep === "select" ? methods.find((method) => method.id === activeMethod)?.label || "Select Files" : "Media Details"
252960
+ children: title
252916
252961
  }),
252917
252962
  showMediaToolbar && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
252918
252963
  className: "relative max-w-md min-w-0 flex-1",
@@ -254479,7 +254524,7 @@ const UrlUpload = ({ config, onFileSelected, enableShareableOption = false, shar
254479
254524
  }
254480
254525
  };
254481
254526
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
254482
- className: "mx-auto max-w-5xl space-y-6 overflow-y-auto md:px-10 md:py-8",
254527
+ className: "mx-auto max-w-5xl space-y-6 overflow-y-auto px-4 py-6 md:px-10 md:py-8",
254483
254528
  children: [
254484
254529
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
254485
254530
  className: "text-center",
@@ -254493,7 +254538,7 @@ const UrlUpload = ({ config, onFileSelected, enableShareableOption = false, shar
254493
254538
  }),
254494
254539
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("form", {
254495
254540
  onSubmit: handleSubmit,
254496
- className: "mx-auto w-1/2 space-y-5",
254541
+ className: "mx-auto w-full space-y-5 md:w-1/2",
254497
254542
  children: [
254498
254543
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
254499
254544
  className: "flex gap-2",
@@ -254571,7 +254616,7 @@ const UrlUpload = ({ config, onFileSelected, enableShareableOption = false, shar
254571
254616
  config.showProgress && uploadProgress.length > 0 && (selectedFilesCount === void 0 || selectedFilesCount > 0 || isUploading) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
254572
254617
  className: "space-y-4",
254573
254618
  children: uploadProgress.map((progress, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
254574
- className: "mx-auto w-1/2 overflow-hidden rounded-xl border border-gray-200 bg-white shadow-sm",
254619
+ className: "mx-auto w-full overflow-hidden rounded-xl border border-gray-200 bg-white shadow-sm md:w-1/2",
254575
254620
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
254576
254621
  className: "p-4",
254577
254622
  children: [
@@ -254619,7 +254664,7 @@ const UrlUpload = ({ config, onFileSelected, enableShareableOption = false, shar
254619
254664
  }, index))
254620
254665
  }),
254621
254666
  enableShareableOption && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
254622
- className: "mx-auto flex w-1/2 items-center justify-between",
254667
+ className: "mx-auto flex w-full items-center justify-between md:w-1/2",
254623
254668
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
254624
254669
  className: "flex items-center gap-2",
254625
254670
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Switch, {
@@ -255167,10 +255212,10 @@ const ComputerUpload = ({ config, onFilesSelected, enableShareableOption = false
255167
255212
  onDragLeave: () => setDragActive(false)
255168
255213
  });
255169
255214
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
255170
- className: "mx-auto max-w-7xl space-y-6 overflow-y-auto md:px-10 md:py-8",
255215
+ className: "mx-auto max-w-7xl space-y-6 overflow-y-auto px-4 py-6 md:px-10 md:py-8",
255171
255216
  children: [
255172
255217
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Card, {
255173
- className: "mx-auto w-1/2 border-none shadow-none",
255218
+ className: "mx-auto w-full border-none shadow-none md:w-1/2",
255174
255219
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.CardContent, {
255175
255220
  className: "p-6",
255176
255221
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
@@ -255204,7 +255249,7 @@ const ComputerUpload = ({ config, onFilesSelected, enableShareableOption = false
255204
255249
  config.showProgress && uploadProgress.length > 0 && (selectedFilesCount === void 0 || selectedFilesCount > 0 || isUploading) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
255205
255250
  className: "space-y-4",
255206
255251
  children: uploadProgress.map((progress) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
255207
- className: "mx-auto w-1/2 overflow-hidden rounded-xl border border-gray-200 bg-white shadow-sm",
255252
+ className: "mx-auto w-full overflow-hidden rounded-xl border border-gray-200 bg-white shadow-sm md:w-1/2",
255208
255253
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
255209
255254
  className: "p-4",
255210
255255
  children: [
@@ -255252,7 +255297,7 @@ const ComputerUpload = ({ config, onFilesSelected, enableShareableOption = false
255252
255297
  }, `${progress.file_name}-${progress.status}`))
255253
255298
  }),
255254
255299
  enableShareableOption && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
255255
- className: "mx-auto flex w-1/2 items-center justify-between px-4",
255300
+ className: "mx-auto flex w-full items-center justify-between px-4 md:w-1/2",
255256
255301
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
255257
255302
  className: "flex items-center gap-2",
255258
255303
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Switch, {
@@ -255588,7 +255633,7 @@ const SelectionPanel = ({ selectedFiles, onRemoveFile, onClear, onConfirm, share
255588
255633
  }, []);
255589
255634
  if (!isVisible || selectedFiles.length === 0) return null;
255590
255635
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
255591
- className: "flex h-full w-72 shrink-0 flex-col border-l border-gray-200 bg-white",
255636
+ className: "flex max-h-[45%] w-full shrink-0 flex-col border-t border-gray-200 bg-white md:h-full md:max-h-none md:w-72 md:border-t-0 md:border-l",
255592
255637
  children: [
255593
255638
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
255594
255639
  className: "border-b border-gray-200 px-4 py-3",
@@ -256139,6 +256184,7 @@ const FilePicker = ({ config: configInput = {}, onFilesSelected, onClose, open,
256139
256184
  currentStep: "select",
256140
256185
  activeMethod,
256141
256186
  methods,
256187
+ onMethodChange: handleMethodChange,
256142
256188
  onClose: () => {
256143
256189
  resetPicker();
256144
256190
  onClose?.();
@@ -256166,7 +256212,7 @@ const FilePicker = ({ config: configInput = {}, onFilesSelected, onClose, open,
256166
256212
  unsplashSearching,
256167
256213
  isUnsplashUploading
256168
256214
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
256169
- className: "flex min-h-0 min-w-0 flex-1 overflow-hidden",
256215
+ className: "flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden md:flex-row",
256170
256216
  children: [
256171
256217
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
256172
256218
  className: "min-h-0 min-w-0 flex-1 overflow-y-auto",
@@ -256373,7 +256419,8 @@ const FilePicker = ({ config: configInput = {}, onFilesSelected, onClose, open,
256373
256419
  }
256374
256420
  },
256375
256421
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.DialogContent, {
256376
- className: `data-[state=closed]:animate-out! data-[state=closed]:fade-out-0! data-[state=closed]:zoom-out-95! data-[state=open]:animate-in! data-[state=open]:fade-in-0! data-[state=open]:zoom-in-95! z-300! flex! h-[90vh]! max-h-[1000px]! w-[95vw]! max-w-[1600px]! flex-col! gap-0! overflow-y-auto! rounded-lg! border-0! bg-white p-0! data-[state=closed]:duration-150! data-[state=open]:duration-200! ${className || ""}`,
256422
+ showCloseButton: false,
256423
+ className: `data-[state=closed]:animate-out! data-[state=closed]:fade-out-0! data-[state=closed]:zoom-out-95! data-[state=open]:animate-in! data-[state=open]:fade-in-0! data-[state=open]:zoom-in-95! z-300! flex! h-dvh! max-h-none! w-full! max-w-none! flex-col! gap-0! overflow-y-auto! rounded-none! border-0! bg-white p-0! data-[state=closed]:duration-150! data-[state=open]:duration-200! md:h-[90vh]! md:max-h-[1000px]! md:w-[95vw]! md:max-w-[1600px]! md:rounded-lg! ${className || ""}`,
256377
256424
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.DialogTitle, {
256378
256425
  className: "sr-only",
256379
256426
  children: "File Picker"
@@ -261249,4 +261296,4 @@ Object.defineProperty(exports, "shareablesScreenPropertySchema", {
261249
261296
  }
261250
261297
  });
261251
261298
 
261252
- //# sourceMappingURL=ShareablesScreen-BLdfT_j5.cjs.map
261299
+ //# sourceMappingURL=ShareablesScreen-BeIlj0JK.cjs.map