@aokiapp/rjsf-mantine-corporate
Version:
Corporational variant of theme, based on @aokiapp/rjsf-mantine-theme
38 lines (35 loc) • 1.69 kB
JavaScript
import { jsx, jsxs } from 'react/jsx-runtime';
import { Box, Group, rem } from '@mantine/core';
import { Draggable } from '@hello-pangea/dnd';
import { IconGripVertical } from '@tabler/icons-react';
import classes from './ArrayFieldTemplate.module.css.mjs';
import { useId } from 'react';
function ArrayFieldItemTemplate(props) {
const { children, className, disabled, index, readonly, orderable, removable, registry, uiSchema, onDropIndexClick } = props;
const isDraggable = !disabled && !readonly && orderable;
const key = useId();
const { RemoveButton } = registry.templates.ButtonTemplates;
return /* @__PURE__ */ jsx(Draggable, { index, draggableId: key, isDragDisabled: !isDraggable, children: (provided) => /* @__PURE__ */ jsx(
Box,
{
ref: provided.innerRef,
...provided.draggableProps,
className: `armt-template-arrayfielditem ${className}`,
children: /* @__PURE__ */ jsxs(Group, { style: { flexGrow: 1 }, gap: 0, children: [
isDraggable ? /* @__PURE__ */ jsx("div", { ...provided.dragHandleProps, className: classes.dragHandle, children: /* @__PURE__ */ jsx(IconGripVertical, { style: { width: rem(18), height: rem(18) }, stroke: 1.5 }) }) : removable ? /* @__PURE__ */ jsx(
RemoveButton,
{
className: "armt-template-afit-remove",
disabled: disabled || readonly,
onClick: onDropIndexClick(index),
uiSchema,
registry
}
) : null,
/* @__PURE__ */ jsx(Box, { style: { flexGrow: 1 }, children })
] })
}
) }, key);
}
export { ArrayFieldItemTemplate as default };
//# sourceMappingURL=ArrayFieldItemTemplate.mjs.map