@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 @@ require("./MobileBottomSheet-HzfAr8dE.cjs");
7
7
  require("./static-dict-adapter-BCgoKiVT.cjs");
8
8
  require("./SearchSort-9Blo6zOI.cjs");
9
9
  require("./use-share-link-CwfwFW1s.cjs");
10
- const require_ShareablesScreen = require("./ShareablesScreen-BLdfT_j5.cjs");
10
+ const require_ShareablesScreen = require("./ShareablesScreen-BeIlj0JK.cjs");
11
11
  require("./translation-api-context-factory-mbsJk2UU.cjs");
12
12
  require("./src-DPBCDigp.cjs");
13
13
  require("./MobileActionSheet-Diex9dkG.cjs");
@@ -37,6 +37,26 @@ const damQueryKeys = {
37
37
  params
38
38
  ]
39
39
  };
40
+ /**
41
+ * Methods the picker's switchers offer, derived from
42
+ * {@link PICKER_METHOD_IMPLEMENTED} so the two cannot drift.
43
+ */
44
+ const IMPLEMENTED_PICKER_METHODS = Object.entries({
45
+ dam: true,
46
+ media: true,
47
+ pages: true,
48
+ products: true,
49
+ enrollment_packs: true,
50
+ upload: true,
51
+ url: true,
52
+ unsplash: true,
53
+ computer: false,
54
+ "google-drive": false,
55
+ instagram: false,
56
+ facebook: false,
57
+ tiktok: false,
58
+ dropbox: false
59
+ }).filter(([, implemented]) => implemented).map(([method]) => method);
40
60
  const filePickerConfigSchema = z.object({
41
61
  accept: z.array(z.string()).optional(),
42
62
  maxFiles: z.number().min(1).optional().default(1),
@@ -6550,27 +6570,18 @@ DamLibrary.displayName = "DamLibrary";
6550
6570
  const FilePickerSidebar = ({ currentStep, activeMethod, onMethodChange, methods }) => {
6551
6571
  if (currentStep !== "select") return null;
6552
6572
  return /* @__PURE__ */ jsx("div", {
6553
- className: "flex hidden h-full w-64 flex-col rounded-tl-lg border-r border-gray-200 bg-gray-50 md:flex",
6573
+ className: "hidden h-full w-64 flex-col rounded-tl-lg border-r border-gray-200 bg-gray-50 md:flex",
6554
6574
  children: /* @__PURE__ */ jsxs("div", {
6555
6575
  className: "flex min-h-0 flex-1 flex-col gap-2 overflow-auto p-2",
6556
6576
  children: [/* @__PURE__ */ jsx("div", {
6557
6577
  className: "flex flex-col gap-2 pt-3",
6558
6578
  children: /* @__PURE__ */ jsx("h3", {
6559
6579
  className: "text-sm font-semibold text-gray-900",
6560
- children: "Select File"
6580
+ children: "Choose source"
6561
6581
  })
6562
6582
  }), /* @__PURE__ */ jsx("div", {
6563
6583
  className: "flex w-full min-w-0 flex-col gap-1 p-2",
6564
- children: methods.filter((method) => [
6565
- "dam",
6566
- "media",
6567
- "pages",
6568
- "products",
6569
- "enrollment_packs",
6570
- "upload",
6571
- "url",
6572
- "unsplash"
6573
- ].includes(method.id)).map((method) => /* @__PURE__ */ jsxs(Button, {
6584
+ children: methods.filter((method) => IMPLEMENTED_PICKER_METHODS.includes(method.id)).map((method) => /* @__PURE__ */ jsxs(Button, {
6574
6585
  variant: "ghost",
6575
6586
  onClick: () => onMethodChange(method.id),
6576
6587
  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"}`,
@@ -6653,22 +6664,44 @@ const FilePickerFiltersPanel = ({ filters, onFiltersChange, onClear, onDone }) =
6653
6664
  FilePickerFiltersPanel.displayName = "FilePickerFiltersPanel";
6654
6665
  //#endregion
6655
6666
  //#region ../../file-picker/ui/src/components/FilePickerHeader.tsx
6656
- 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 }) => {
6667
+ 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 }) => {
6657
6668
  const [filtersOpen, setFiltersOpen] = useState(false);
6658
6669
  const [folderActionsOpen, setFolderActionsOpen] = useState(false);
6659
6670
  const [sortOpen, setSortOpen] = useState(false);
6671
+ const [methodsOpen, setMethodsOpen] = useState(false);
6660
6672
  const isMobile = useIsMobile();
6661
6673
  const showMediaToolbar = currentStep === "select" && (activeMethod === "dam" || activeMethod === "media");
6662
6674
  const showUnsplashToolbar = currentStep === "select" && activeMethod === "unsplash";
6675
+ const title = currentStep === "select" ? methods.find((method) => method.id === activeMethod)?.label || "Select Files" : "Media Details";
6676
+ const switchableMethods = methods.filter((method) => IMPLEMENTED_PICKER_METHODS.includes(method.id));
6663
6677
  return /* @__PURE__ */ jsxs("div", {
6664
6678
  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",
6665
6679
  children: [
6666
6680
  /* @__PURE__ */ jsxs("div", {
6667
6681
  className: "flex min-w-0 flex-1 items-center gap-4",
6668
6682
  children: [
6669
- /* @__PURE__ */ jsx("span", {
6683
+ isMobile && currentStep === "select" && onMethodChange !== void 0 && switchableMethods.length > 1 ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(Button, {
6684
+ variant: "ghost",
6685
+ type: "button",
6686
+ "data-testid": "file-picker-method-switcher",
6687
+ "aria-haspopup": "dialog",
6688
+ "aria-expanded": methodsOpen,
6689
+ onClick: () => setMethodsOpen(true),
6690
+ className: "h-8 shrink-0 gap-1 px-2 text-lg font-semibold text-gray-900 hover:bg-gray-100",
6691
+ children: [title, /* @__PURE__ */ jsx(ChevronDownIcon, { className: "h-4 w-4 text-gray-500" })]
6692
+ }), /* @__PURE__ */ jsx(MobileActionSheet, {
6693
+ open: methodsOpen,
6694
+ onOpenChange: setMethodsOpen,
6695
+ title: "Choose source",
6696
+ actions: switchableMethods.map((method) => ({
6697
+ id: method.id,
6698
+ label: method.label,
6699
+ selected: method.id === activeMethod,
6700
+ onSelect: () => onMethodChange?.(method.id)
6701
+ }))
6702
+ })] }) : /* @__PURE__ */ jsx("span", {
6670
6703
  className: "shrink-0 text-lg font-semibold text-gray-900",
6671
- children: currentStep === "select" ? methods.find((method) => method.id === activeMethod)?.label || "Select Files" : "Media Details"
6704
+ children: title
6672
6705
  }),
6673
6706
  showMediaToolbar && /* @__PURE__ */ jsxs("div", {
6674
6707
  className: "relative max-w-md min-w-0 flex-1",
@@ -8235,7 +8268,7 @@ const UrlUpload = ({ config, onFileSelected, enableShareableOption = false, shar
8235
8268
  }
8236
8269
  };
8237
8270
  return /* @__PURE__ */ jsxs("div", {
8238
- className: "mx-auto max-w-5xl space-y-6 overflow-y-auto md:px-10 md:py-8",
8271
+ className: "mx-auto max-w-5xl space-y-6 overflow-y-auto px-4 py-6 md:px-10 md:py-8",
8239
8272
  children: [
8240
8273
  /* @__PURE__ */ jsxs("div", {
8241
8274
  className: "text-center",
@@ -8249,7 +8282,7 @@ const UrlUpload = ({ config, onFileSelected, enableShareableOption = false, shar
8249
8282
  }),
8250
8283
  /* @__PURE__ */ jsxs("form", {
8251
8284
  onSubmit: handleSubmit,
8252
- className: "mx-auto w-1/2 space-y-5",
8285
+ className: "mx-auto w-full space-y-5 md:w-1/2",
8253
8286
  children: [
8254
8287
  /* @__PURE__ */ jsxs("div", {
8255
8288
  className: "flex gap-2",
@@ -8327,7 +8360,7 @@ const UrlUpload = ({ config, onFileSelected, enableShareableOption = false, shar
8327
8360
  config.showProgress && uploadProgress.length > 0 && (selectedFilesCount === void 0 || selectedFilesCount > 0 || isUploading) && /* @__PURE__ */ jsx("div", {
8328
8361
  className: "space-y-4",
8329
8362
  children: uploadProgress.map((progress, index) => /* @__PURE__ */ jsx("div", {
8330
- className: "mx-auto w-1/2 overflow-hidden rounded-xl border border-gray-200 bg-white shadow-sm",
8363
+ className: "mx-auto w-full overflow-hidden rounded-xl border border-gray-200 bg-white shadow-sm md:w-1/2",
8331
8364
  children: /* @__PURE__ */ jsxs("div", {
8332
8365
  className: "p-4",
8333
8366
  children: [
@@ -8375,7 +8408,7 @@ const UrlUpload = ({ config, onFileSelected, enableShareableOption = false, shar
8375
8408
  }, index))
8376
8409
  }),
8377
8410
  enableShareableOption && /* @__PURE__ */ jsx("div", {
8378
- className: "mx-auto flex w-1/2 items-center justify-between",
8411
+ className: "mx-auto flex w-full items-center justify-between md:w-1/2",
8379
8412
  children: /* @__PURE__ */ jsxs("div", {
8380
8413
  className: "flex items-center gap-2",
8381
8414
  children: [/* @__PURE__ */ jsx(Switch, {
@@ -8923,10 +8956,10 @@ const ComputerUpload = ({ config, onFilesSelected, enableShareableOption = false
8923
8956
  onDragLeave: () => setDragActive(false)
8924
8957
  });
8925
8958
  return /* @__PURE__ */ jsxs("div", {
8926
- className: "mx-auto max-w-7xl space-y-6 overflow-y-auto md:px-10 md:py-8",
8959
+ className: "mx-auto max-w-7xl space-y-6 overflow-y-auto px-4 py-6 md:px-10 md:py-8",
8927
8960
  children: [
8928
8961
  /* @__PURE__ */ jsx(Card, {
8929
- className: "mx-auto w-1/2 border-none shadow-none",
8962
+ className: "mx-auto w-full border-none shadow-none md:w-1/2",
8930
8963
  children: /* @__PURE__ */ jsx(CardContent, {
8931
8964
  className: "p-6",
8932
8965
  children: /* @__PURE__ */ jsxs("div", {
@@ -8960,7 +8993,7 @@ const ComputerUpload = ({ config, onFilesSelected, enableShareableOption = false
8960
8993
  config.showProgress && uploadProgress.length > 0 && (selectedFilesCount === void 0 || selectedFilesCount > 0 || isUploading) && /* @__PURE__ */ jsx("div", {
8961
8994
  className: "space-y-4",
8962
8995
  children: uploadProgress.map((progress) => /* @__PURE__ */ jsx("div", {
8963
- className: "mx-auto w-1/2 overflow-hidden rounded-xl border border-gray-200 bg-white shadow-sm",
8996
+ className: "mx-auto w-full overflow-hidden rounded-xl border border-gray-200 bg-white shadow-sm md:w-1/2",
8964
8997
  children: /* @__PURE__ */ jsxs("div", {
8965
8998
  className: "p-4",
8966
8999
  children: [
@@ -9008,7 +9041,7 @@ const ComputerUpload = ({ config, onFilesSelected, enableShareableOption = false
9008
9041
  }, `${progress.file_name}-${progress.status}`))
9009
9042
  }),
9010
9043
  enableShareableOption && /* @__PURE__ */ jsx("div", {
9011
- className: "mx-auto flex w-1/2 items-center justify-between px-4",
9044
+ className: "mx-auto flex w-full items-center justify-between px-4 md:w-1/2",
9012
9045
  children: /* @__PURE__ */ jsxs("div", {
9013
9046
  className: "flex items-center gap-2",
9014
9047
  children: [/* @__PURE__ */ jsx(Switch, {
@@ -9344,7 +9377,7 @@ const SelectionPanel = ({ selectedFiles, onRemoveFile, onClear, onConfirm, share
9344
9377
  }, []);
9345
9378
  if (!isVisible || selectedFiles.length === 0) return null;
9346
9379
  return /* @__PURE__ */ jsxs("div", {
9347
- className: "flex h-full w-72 shrink-0 flex-col border-l border-gray-200 bg-white",
9380
+ 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",
9348
9381
  children: [
9349
9382
  /* @__PURE__ */ jsx("div", {
9350
9383
  className: "border-b border-gray-200 px-4 py-3",
@@ -9895,6 +9928,7 @@ const FilePicker = ({ config: configInput = {}, onFilesSelected, onClose, open,
9895
9928
  currentStep: "select",
9896
9929
  activeMethod,
9897
9930
  methods,
9931
+ onMethodChange: handleMethodChange,
9898
9932
  onClose: () => {
9899
9933
  resetPicker();
9900
9934
  onClose?.();
@@ -9922,7 +9956,7 @@ const FilePicker = ({ config: configInput = {}, onFilesSelected, onClose, open,
9922
9956
  unsplashSearching,
9923
9957
  isUnsplashUploading
9924
9958
  }), /* @__PURE__ */ jsxs("div", {
9925
- className: "flex min-h-0 min-w-0 flex-1 overflow-hidden",
9959
+ className: "flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden md:flex-row",
9926
9960
  children: [
9927
9961
  /* @__PURE__ */ jsx("div", {
9928
9962
  className: "min-h-0 min-w-0 flex-1 overflow-y-auto",
@@ -10129,7 +10163,8 @@ const FilePicker = ({ config: configInput = {}, onFilesSelected, onClose, open,
10129
10163
  }
10130
10164
  },
10131
10165
  children: /* @__PURE__ */ jsxs(DialogContent, {
10132
- 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 || ""}`,
10166
+ showCloseButton: false,
10167
+ 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 || ""}`,
10133
10168
  children: [/* @__PURE__ */ jsx(DialogTitle, {
10134
10169
  className: "sr-only",
10135
10170
  children: "File Picker"
@@ -14991,4 +15026,4 @@ const shareablesScreenPropertySchema = {
14991
15026
  //#endregion
14992
15027
  export { shareablesScreenPropertySchema as n, ShareablesScreen as t };
14993
15028
 
14994
- //# sourceMappingURL=ShareablesScreen-5AXAqF4v.mjs.map
15029
+ //# sourceMappingURL=ShareablesScreen-CjbwoZdH.mjs.map