UNPKG

@strawbinary-io/api-video-strapi-5-plugin

Version:

A powerful Strapi plugin to easily manage your videos and integrate them in your project

86 lines (85 loc) 2.16 kB
import { getFetchClient } from "@strapi/strapi/admin"; import { P as PLUGIN_ID } from "./index-Cf19Igd1.mjs"; import { jsxs, jsx, Fragment } from "react/jsx-runtime"; import styled from "styled-components"; import { Field, Flex, Box, Link, Toggle as Toggle$1 } from "@strapi/design-system"; const settingsRequests = { get: async () => { const { get } = getFetchClient(); return await get(`/${PLUGIN_ID}/settings`); }, update: async (body) => { const { post } = getFetchClient(); return await post(`/${PLUGIN_ID}/settings`, { body }); } }; styled(Field.Label)` width: 100%; & > div { width: max-content; } `; const FieldComp = ({ name, label, value, isPassword, placeholder, description, tooltip, detailsLink, error, required, onChange = () => { }, editable }) => { return /* @__PURE__ */ jsxs(Field.Root, { required, name, hint: description, error, children: [ /* @__PURE__ */ jsxs(Flex, { width: "100%", children: [ /* @__PURE__ */ jsx(Field.Label, { width: "100%", children: label }), /* @__PURE__ */ jsx(Box, { paddingLeft: 2 }), detailsLink && /* @__PURE__ */ jsx(Flex, { width: "100%", justifyContent: "flex-end", children: /* @__PURE__ */ jsx(Link, { isExternal: true, href: detailsLink, children: "Details" }) }) ] }), /* @__PURE__ */ jsx( Field.Input, { disabled: editable === void 0 ? false : !editable, placeholder, value, type: isPassword ? "password" : "text", onChange } ), /* @__PURE__ */ jsx(Field.Hint, {}), /* @__PURE__ */ jsx(Field.Error, {}) ] }); }; const Toggle = ({ label, required, checked, onLabel, offLabel, onChange = () => { } }) => { return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(Field.Root, { required, children: [ /* @__PURE__ */ jsx(Field.Label, { children: label }), /* @__PURE__ */ jsx( Toggle$1, { checked, onLabel: onLabel ?? "", offLabel: offLabel ?? "", onChange } ) ] }) }); }; export { FieldComp as F, Toggle as T, settingsRequests as s };