@premieroctet/next-admin
Version:
Next-Admin provides a customizable and turnkey admin dashboard for applications built with Next.js and powered by the Prisma ORM. It aims to simplify the development process by providing a turnkey admin system that can be easily integrated into your proje
27 lines (26 loc) • 1.24 kB
JavaScript
import { jsx } from "react/jsx-runtime";
import { cloneElement } from "react";
import { twMerge } from "tailwind-merge";
import external_BaseInput_mjs_default from "../BaseInput.mjs";
import external_DndItem_mjs_default from "../DndItem.mjs";
import { getClonableElement } from "../../../utils/react19-compat.mjs";
const ScalarArrayFieldItem = ({ value, onChange, disabled, onRemoveClick, id, scalarType, customInput = /*#__PURE__*/ jsx(external_BaseInput_mjs_default, {}) })=>{
const clonableElement = getClonableElement(customInput);
const renderInput = ()=>/*#__PURE__*/ cloneElement(clonableElement, {
...clonableElement.props,
value,
onChange: (evt)=>onChange(evt.target.value),
disabled,
className: twMerge("w-full", clonableElement.props.className),
type: "number" === scalarType ? "number" : "text"
});
return /*#__PURE__*/ jsx(external_DndItem_mjs_default, {
sortable: !disabled,
deletable: !disabled,
onRemoveClick: onRemoveClick,
label: renderInput(),
value: id
});
};
const ScalarArray_ScalarArrayFieldItem = ScalarArrayFieldItem;
export { ScalarArray_ScalarArrayFieldItem as default };