@chris-bellman/rjsf-mantine-5-theme
Version:
Mantine 5 theme, fields and widgets for react-jsonschema-form. Based on @aokiapp/rjsf-mantine-theme
72 lines (69 loc) • 2 kB
JavaScript
import { jsxs, jsx } from 'react/jsx-runtime';
import { Group } from '@mantine/core';
function ArrayFieldItemTemplate(props) {
const {
children,
className,
disabled,
hasToolbar,
hasCopy,
hasMoveDown,
hasMoveUp,
hasRemove,
index,
onCopyIndexClick,
onDropIndexClick,
onReorderClick,
readonly,
uiSchema,
registry
} = props;
const { CopyButton, MoveDownButton, MoveUpButton, RemoveButton } = registry.templates.ButtonTemplates;
return /* @__PURE__ */ jsxs("div", { className: `armt-template-arrayfielditem ${className}`, children: [
children,
hasToolbar && (hasMoveUp || hasMoveDown || hasRemove || hasCopy) && /* @__PURE__ */ jsxs(Group, { spacing: 0, children: [
(hasMoveUp || hasMoveDown) && /* @__PURE__ */ jsx(
MoveUpButton,
{
className: "armt-template-afit-move-up",
disabled: disabled || readonly || !hasMoveUp,
onClick: onReorderClick(index, index - 1),
uiSchema,
registry
}
),
(hasMoveUp || hasMoveDown) && /* @__PURE__ */ jsx(
MoveDownButton,
{
className: "armt-template-afit-move-down",
disabled: disabled || readonly || !hasMoveDown,
onClick: onReorderClick(index, index + 1),
uiSchema,
registry
}
),
hasCopy && /* @__PURE__ */ jsx(
CopyButton,
{
className: "armt-template-afit-copy",
disabled: disabled || readonly,
onClick: onCopyIndexClick(index),
uiSchema,
registry
}
),
hasRemove && /* @__PURE__ */ jsx(
RemoveButton,
{
className: "armt-template-afit-remove",
disabled: disabled || readonly,
onClick: onDropIndexClick(index),
uiSchema,
registry
}
)
] })
] });
}
export { ArrayFieldItemTemplate as default };
//# sourceMappingURL=ArrayFieldItemTemplate.mjs.map