@strawbinary-io/api-video-strapi-5-plugin
Version:
A powerful Strapi plugin to easily manage your videos and integrate them in your project
87 lines (86 loc) • 2.66 kB
JavaScript
;
const admin = require("@strapi/strapi/admin");
const index = require("./index-m2iLaGni.js");
const jsxRuntime = require("react/jsx-runtime");
const styled = require("styled-components");
const designSystem = require("@strapi/design-system");
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
const styled__default = /* @__PURE__ */ _interopDefault(styled);
const settingsRequests = {
get: async () => {
const { get } = admin.getFetchClient();
return await get(`/${index.PLUGIN_ID}/settings`);
},
update: async (body) => {
const { post } = admin.getFetchClient();
return await post(`/${index.PLUGIN_ID}/settings`, {
body
});
}
};
styled__default.default(designSystem.Field.Label)`
width: 100%;
& > div {
width: max-content;
}
`;
const FieldComp = ({
name,
label,
value,
isPassword,
placeholder,
description,
tooltip,
detailsLink,
error,
required,
onChange = () => {
},
editable
}) => {
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { required, name, hint: description, error, children: [
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { width: "100%", children: [
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { width: "100%", children: label }),
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingLeft: 2 }),
detailsLink && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { width: "100%", justifyContent: "flex-end", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Link, { isExternal: true, href: detailsLink, children: "Details" }) })
] }),
/* @__PURE__ */ jsxRuntime.jsx(
designSystem.Field.Input,
{
disabled: editable === void 0 ? false : !editable,
placeholder,
value,
type: isPassword ? "password" : "text",
onChange
}
),
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {}),
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
] });
};
const Toggle = ({
label,
required,
checked,
onLabel,
offLabel,
onChange = () => {
}
}) => {
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { required, children: [
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: label }),
/* @__PURE__ */ jsxRuntime.jsx(
designSystem.Toggle,
{
checked,
onLabel: onLabel ?? "",
offLabel: offLabel ?? "",
onChange
}
)
] }) });
};
exports.FieldComp = FieldComp;
exports.Toggle = Toggle;
exports.settingsRequests = settingsRequests;