UNPKG

@remotion/studio

Version:

APIs for interacting with the Remotion Studio

21 lines (20 loc) 1.07 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ZodBooleanEditor = void 0; const jsx_runtime_1 = require("react/jsx-runtime"); const react_1 = require("react"); const Checkbox_1 = require("../../Checkbox"); const Fieldset_1 = require("./Fieldset"); const SchemaLabel_1 = require("./SchemaLabel"); const fullWidth = { width: '100%', }; const ZodBooleanEditor = ({ jsonPath, value, setValue, onRemove, mayPad }) => { const onToggle = (0, react_1.useCallback)((e) => { setValue(() => e.target.checked, { shouldSave: true }); }, [setValue]); return (jsx_runtime_1.jsxs(Fieldset_1.Fieldset, { shouldPad: mayPad, children: [ jsx_runtime_1.jsx(SchemaLabel_1.SchemaLabel, { handleClick: null, jsonPath: jsonPath, onRemove: onRemove, valid: true, suffix: null }), jsx_runtime_1.jsx("div", { style: fullWidth, children: jsx_runtime_1.jsx(Checkbox_1.Checkbox, { name: jsonPath.join('.'), checked: value, onChange: onToggle, disabled: false }) }) ] })); }; exports.ZodBooleanEditor = ZodBooleanEditor;