@raster-app/sanity-plugin-raster
Version:
A Sanity Studio plugin that integrates [Raster](https://raster.app) - a modern Digital Asset Management (DAM) platform that helps teams organize, optimize, and deliver their media assets with powerful AI features and an intuitive interface.
51 lines (50 loc) • 2.03 kB
JavaScript
"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const jsxRuntime = require("react/jsx-runtime");
const index = require("./index-DURHnjeq.cjs");
const rasterToolkit = require("@raster-app/raster-toolkit");
const React = require("react");
const styles = require("./styles-CaGtPwgS.cjs");
function RasterPickerContent(props) {
const { onSelect, config } = props;
const { count, images: selectedPhotos } = rasterToolkit.useSelectedImages();
const handleConfirm = React.useCallback(() => {
if (!selectedPhotos) return;
const assets = selectedPhotos.map((image) => ({
kind: "url",
value: image.url
}));
onSelect(assets);
props.onClose();
}, [onSelect, selectedPhotos, props]);
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: styles.pickerStyles.content, children: [
/* @__PURE__ */ jsxRuntime.jsx(rasterToolkit.RasterLibraries, { config }),
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: styles.pickerStyles.previewContainer, children: [
/* @__PURE__ */ jsxRuntime.jsx(
rasterToolkit.RasterPreview,
{
config,
initialValue: null,
showBorder: false
}
),
/* @__PURE__ */ jsxRuntime.jsx("hr", { style: styles.pickerStyles.divider }),
/* @__PURE__ */ jsxRuntime.jsx(rasterToolkit.RasterImages, { config, isSingleImage: true })
] })
] }),
/* @__PURE__ */ jsxRuntime.jsxs(index.Box, { style: styles.pickerStyles.footer, children: [
/* @__PURE__ */ jsxRuntime.jsx(index.Button, { mode: "ghost", onClick: props.onClose, text: "Cancel" }),
count > 0 && /* @__PURE__ */ jsxRuntime.jsx(
index.Button,
{
tone: "positive",
onClick: handleConfirm,
text: `Confirm (${count})`
}
)
] })
] });
}
exports.default = RasterPickerContent;
//# sourceMappingURL=RasterPickerContent-0T4RSZYw.cjs.map