diff --git a/spiffworkflow-frontend/src/routes/TaskShow.tsx b/spiffworkflow-frontend/src/routes/TaskShow.tsx index f08bf9046..de7141a10 100644 --- a/spiffworkflow-frontend/src/routes/TaskShow.tsx +++ b/spiffworkflow-frontend/src/routes/TaskShow.tsx @@ -217,7 +217,7 @@ export default function TaskShow() { return ( - +
= ({ - uiSchema, - ...props -}) => { +// @ts-ignore +import { AddAlt } from '@carbon/icons-react'; + +import IconButton from '../IconButton/IconButton'; + +/** The `AddButton` renders a button that represent the `Add` action on a form + */ +export default function AddButton< + T = any, + S extends StrictRJSFSchema = RJSFSchema, + F extends FormContextType = any +>({ className, onClick, disabled, registry }: IconButtonProps) { return ( - - - +
+

+ +

+
); -}; - -export default AddButton; +} diff --git a/spiffworkflow-frontend/src/themes/carbon/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx b/spiffworkflow-frontend/src/themes/carbon/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx index cf596f982..df8896bfb 100644 --- a/spiffworkflow-frontend/src/themes/carbon/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx +++ b/spiffworkflow-frontend/src/themes/carbon/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx @@ -5,6 +5,11 @@ import { RJSFSchema, StrictRJSFSchema, } from '@rjsf/utils'; +import { + Grid, + Column, + // @ts-ignore +} from '@carbon/react'; /** The `ArrayFieldItemTemplate` component is the template used to render an items of an array. * @@ -33,53 +38,67 @@ export default function ArrayFieldItemTemplate< const { MoveDownButton, MoveUpButton, RemoveButton } = registry.templates.ButtonTemplates; const btnStyle: CSSProperties = { - flex: 1, - paddingLeft: 6, - paddingRight: 6, - fontWeight: 'bold', + marginBottom: '0.5em', }; + const mainColumnWidthSmall = hasToolbar ? 3 : 4; + const mainColumnWidthMedium = hasToolbar ? 6 : 8; + const mainColumnWidthLarge = hasToolbar ? 12 : 16; return (
-
{children}
- {hasToolbar && ( -
-
+ + {children} + + {hasToolbar && ( + - {(hasMoveUp || hasMoveDown) && ( - - )} - {(hasMoveUp || hasMoveDown) && ( - - )} - {hasRemove && ( - - )} -
-
- )} +
+
+
+ {(hasMoveUp || hasMoveDown) && ( + + )} +
+
+ {(hasMoveUp || hasMoveDown) && ( + + )} +
+
+ {hasRemove && ( + + )} +
+
+
+ + )} +
); } diff --git a/spiffworkflow-frontend/src/themes/carbon/IconButton/IconButton.tsx b/spiffworkflow-frontend/src/themes/carbon/IconButton/IconButton.tsx index 825591061..64eb883db 100644 --- a/spiffworkflow-frontend/src/themes/carbon/IconButton/IconButton.tsx +++ b/spiffworkflow-frontend/src/themes/carbon/IconButton/IconButton.tsx @@ -1,55 +1,96 @@ import React from 'react'; -import IconButton, { - IconButtonProps as MuiIconButtonProps, -} from '@mui/material/IconButton'; -import ArrowDownwardIcon from '@mui/icons-material/ArrowDownward'; -import ArrowUpwardIcon from '@mui/icons-material/ArrowUpward'; -import RemoveIcon from '@mui/icons-material/Remove'; -import { IconButtonProps } from '@rjsf/utils'; +import { + FormContextType, + IconButtonProps, + RJSFSchema, + StrictRJSFSchema, +} from '@rjsf/utils'; -export default function MuiIconButton(props: IconButtonProps) { - const { icon, color, uiSchema, ...otherProps } = props; +// @ts-ignore +import { Add, TrashCan, ArrowUp, ArrowDown } from '@carbon/icons-react'; + +export default function IconButton< + T = any, + S extends StrictRJSFSchema = RJSFSchema, + F extends FormContextType = any +>(props: IconButtonProps) { + const { + iconType = 'default', + icon, + className, + uiSchema, + registry, + ...otherProps + } = props; + // icon string optios: plus, remove, arrow-up, arrow-down + let carbonIcon = ( +

+ Add new +

+ ); + if (icon === 'remove') { + carbonIcon = ; + } + if (icon === 'arrow-up') { + carbonIcon = ; + } + if (icon === 'arrow-down') { + carbonIcon = ; + } + + return ( + + ); +} + +export function MoveDownButton< + T = any, + S extends StrictRJSFSchema = RJSFSchema, + F extends FormContextType = any +>(props: IconButtonProps) { return ( - {icon} - - ); -} - -export function MoveDownButton(props: IconButtonProps) { - return ( - } + icon="arrow-down" /> ); } -export function MoveUpButton(props: IconButtonProps) { +export function MoveUpButton< + T = any, + S extends StrictRJSFSchema = RJSFSchema, + F extends FormContextType = any +>(props: IconButtonProps) { return ( - } + icon="arrow-up" /> ); } -export function RemoveButton(props: IconButtonProps) { - const { iconType, ...otherProps } = props; +export function RemoveButton< + T = any, + S extends StrictRJSFSchema = RJSFSchema, + F extends FormContextType = any +>(props: IconButtonProps) { return ( - - } + className="array-item-remove" + {...props} + iconType="danger" + icon="remove" /> ); } diff --git a/spiffworkflow-frontend/src/themes/carbon/index.css b/spiffworkflow-frontend/src/themes/carbon/index.css index 72cdbb849..b536e7d2d 100644 --- a/spiffworkflow-frontend/src/themes/carbon/index.css +++ b/spiffworkflow-frontend/src/themes/carbon/index.css @@ -17,3 +17,7 @@ .rjsf .rjsf-field .rjsf-field { margin-bottom: 2em; } + +.array-item-toolbox { + margin-left: 2em; +}