feat: Add shadcn components for editing fields - #304
Conversation
Signed-off-by: kumaradityaraj <sedulous.0007@gmail.com>
✅ Deploy Preview for openworkflow-editor ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Signed-off-by: kumaradityaraj <sedulous.0007@gmail.com>
There was a problem hiding this comment.
Pull request overview
This PR adds additional shadcn-style UI building blocks (Textarea, Switch, and a Base UI–powered Combobox) to open-workflow-diagram-editor, along with dependency updates needed to support them and ensure styling aligns with the editor’s dec:-prefixed utility classes.
Changes:
- Added new UI components:
Textarea,Switch,Combobox, and a sharedInputGroupwrapper. - Introduced
@base-ui/reactdependency (catalog + package dependency) to support the Combobox implementation. - Updated lockfile to reflect new dependency graph (including Base UI and related transitive deps).
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-workspace.yaml | Adds @base-ui/react to the workspace catalog for consistent dependency management. |
| pnpm-lock.yaml | Locks @base-ui/react and its resolved dependency snapshot changes. |
| packages/open-workflow-diagram-editor/package.json | Adds @base-ui/react as a dependency for the diagram editor package. |
| packages/open-workflow-diagram-editor/src/components/ui/textarea.tsx | Introduces a styled Textarea component using dec: utility classes. |
| packages/open-workflow-diagram-editor/src/components/ui/switch.tsx | Introduces a styled Switch component using Radix primitives and dec: utility classes. |
| packages/open-workflow-diagram-editor/src/components/ui/input-group.tsx | Adds an InputGroup composition helper used by inputs/textarea/combobox UI. |
| packages/open-workflow-diagram-editor/src/components/ui/combobox.tsx | Adds a styled Combobox built on @base-ui/react, using InputGroup and editor styling conventions. |
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
Suppressed comments (2)
packages/open-workflow-diagram-editor/src/components/ui/input-group.tsx:73
- InputGroupAddon’s click-to-focus logic only searches for an , so it won’t focus a textarea control (InputGroupTextarea uses the same data-slot). Use the shared data-slot selector so addons work for both inputs and textareas.
packages/open-workflow-diagram-editor/src/components/ui/combobox.tsx:64 disabledis destructured from ComboboxInput props, but it isn’t forwarded to <ComboboxPrimitive.Input> or reflected on the surrounding InputGroup. This can leave the primitive’s disabled/ARIA state (and InputGroup’sgroup-data-[disabled=true]styles) out of sync with the rendered input/buttons.
</ComboboxPrimitive.Clear>
);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 7 changed files in this pull request and generated no new comments.
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
Suppressed comments (2)
packages/open-workflow-diagram-editor/src/components/ui/input-group.tsx:90
- Clicking an InputGroup addon currently always focuses the first , so InputGroupTextarea won’t receive focus when the addon is clicked (and any future non-input control would also be skipped). Since you’re already standardizing on
data-slot="input-group-control", focus that element instead.
onClick={(e) => {
if ((e.target as HTMLElement).closest("button")) {
return;
}
e.currentTarget.parentElement?.querySelector("input")?.focus();
}}
packages/open-workflow-diagram-editor/src/components/ui/combobox.tsx:33
- New UI primitives were added (Combobox + related subcomponents), but there are no corresponding unit tests. This package already has component-level UI tests (e.g.
tests/components/ui/sidebar.test.tsx), so adding a basiccombobox.test.tsxwould help catch regressions (open/close, selection, disabled state, clear button, and chip mode if supported).
import * as React from "react";
import { Combobox as ComboboxPrimitive } from "@base-ui/react";
import { CheckIcon, ChevronDownIcon, XIcon } from "lucide-react";
import { cn } from "@/lib/utils";
import { Button } from "@/components/ui/button";
import {
InputGroup,
InputGroupAddon,
InputGroupButton,
InputGroupInput,
} from "@/components/ui/input-group";
const Combobox = ComboboxPrimitive.Root;
Signed-off-by: kumaradityaraj <sedulous.0007@gmail.com>
Signed-off-by: kumaradityaraj <sedulous.0007@gmail.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 7 changed files in this pull request and generated no new comments.
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
Suppressed comments (3)
packages/open-workflow-diagram-editor/src/components/ui/input-group.tsx:90
- Clicking an addon currently focuses only an , so the addon won’t focus a textarea-based InputGroup (or any other control). Since this PR adds InputGroupTextarea, the focus target should be the shared control slot instead of hard-coding "input".
onClick={(e) => {
if ((e.target as HTMLElement).closest("button")) {
return;
}
e.currentTarget.parentElement?.querySelector("input")?.focus();
packages/open-workflow-diagram-editor/src/components/ui/combobox.tsx:270
childrenis destructured inComboboxChipsInputbut never used, which triggers the repo’stypescript/no-unused-varslint rule and adds noise to lint output.
function ComboboxChipsInput({ className, children, ...props }: ComboboxPrimitive.Input.Props) {
packages/open-workflow-diagram-editor/src/components/ui/combobox.tsx:80
disabledis destructured but not forwarded toComboboxPrimitive.Input, so the underlying combobox input may remain enabled (keyboard interaction, aria state, etc.) even though the rendered<input>and buttons are disabled.
<ComboboxPrimitive.Input render={<InputGroupInput disabled={disabled} />} {...props} />
Signed-off-by: kumaradityaraj <sedulous.0007@gmail.com>
Signed-off-by: kumaradityaraj <sedulous.0007@gmail.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 8 changed files in this pull request and generated no new comments.
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
Suppressed comments (5)
packages/open-workflow-diagram-editor/src/components/ui/input-group.tsx:90
InputGroupAddon’s click handler always focuses aninput, so add-ons won’t focus a textarea-based control (e.g.,InputGroupTextarea). Since both controls setdata-slot="input-group-control", focus that instead.
onClick={(e) => {
if ((e.target as HTMLElement).closest("button")) {
return;
}
e.currentTarget.parentElement?.querySelector("input")?.focus();
}}
packages/open-workflow-diagram-editor/src/components/ui/switch.tsx:43
Switchthumb translation is hard-coded totranslate-x-4for the checked state, which will overshoot for thesmsize (root width 7 / thumb width 3). The translate distance should vary bydata-size.
className={cn(
"dec:pointer-events-none dec:block dec:rounded-full dec:bg-white dec:shadow-sm dec:ring-0 dec:transition-transform dec:group-data-[size=default]/switch:h-4 dec:group-data-[size=default]/switch:w-4 dec:group-data-[size=sm]/switch:h-3 dec:group-data-[size=sm]/switch:w-3 dec:data-[state=checked]:translate-x-4 dec:data-[state=unchecked]:translate-x-0 dec:dark:bg-white",
)}
packages/open-workflow-diagram-editor/src/components/ui/combobox.tsx:81
ComboboxInputaccepts adisabledprop, but the surroundingInputGroupnever receives it. This means styles that depend ongroup-data-[disabled=true]/input-groupwon’t activate for disabled comboboxes.
<InputGroup className={cn("dec:w-auto", className)}>
<ComboboxPrimitive.Input render={<InputGroupInput disabled={disabled} />} {...props} />
<InputGroupAddon align="inline-end">
packages/open-workflow-diagram-editor/README.md:160
- README now states shadcn/ui is used for “radix based UI primitives”, but this PR introduces a shadcn component built on
@base-ui/react(Combobox). This sentence should mention Base UI as well (or avoid claiming Radix-only).
This package uses [shadcn/ui](https://ui.shadcn.com/) for radix based UI primitives. Configuration: [`components.json`](components.json)
packages/open-workflow-diagram-editor/src/components/ui/combobox.tsx:270
ComboboxChipsInputdestructureschildrenbut never uses it. WithnoUnusedParameters/ lint rules enabled, this can fail typecheck/lint; also, input components don’t accept children anyway.
function ComboboxChipsInput({ className, children, ...props }: ComboboxPrimitive.Input.Props) {
Signed-off-by: kumaradityaraj <sedulous.0007@gmail.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 8 changed files in this pull request and generated no new comments.
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
Suppressed comments (5)
packages/open-workflow-diagram-editor/src/components/ui/input-group.tsx:90
- InputGroupAddon’s click handler always focuses the first in the group. When the group is used with InputGroupTextarea (or any non-input control), clicking the addon won’t focus the actual control.
onClick={(e) => {
if ((e.target as HTMLElement).closest("button")) {
return;
}
e.currentTarget.parentElement?.querySelector("input")?.focus();
packages/open-workflow-diagram-editor/README.md:160
- The README now claims shadcn/ui is used for “radix based UI primitives”, but this PR introduces a Combobox built on @base-ui/react. This sentence should be broadened so it stays accurate for both Radix and Base UI-backed shadcn components.
This package uses [shadcn/ui](https://ui.shadcn.com/) for radix based UI primitives. Configuration: [`components.json`](components.json)
packages/open-workflow-diagram-editor/src/components/ui/combobox.tsx:233
- This class list includes a duplicate
dec:focus-within:ring-[3px], which is redundant and makes the styling harder to maintain.
className={cn(
"dec:flex dec:min-h-9 dec:flex-wrap dec:items-center dec:gap-1.5 dec:rounded-md dec:border dec:bg-clip-padding dec:px-2.5 dec:py-1.5 dec:text-sm dec:shadow-xs dec:transition-[color,box-shadow] dec:focus-within:ring-[3px] dec:has-aria-invalid:ring-[3px] dec:has-data-[slot=combobox-chip]:px-1.5 dec:border-slate-300 dec:bg-white dec:text-slate-900 dec:hover:border-slate-400 dec:focus-within:border-blue-500 dec:focus-within:ring-[3px] dec:focus-within:ring-blue-500/20 dec:has-aria-invalid:border-red-500 dec:has-aria-invalid:ring-red-500/20 dec:dark:border-slate-600 dec:dark:bg-[#1f2937] dec:dark:text-slate-100 dec:dark:hover:border-slate-500 dec:dark:focus-within:border-blue-400 dec:dark:focus-within:ring-blue-400/20",
className,
packages/open-workflow-diagram-editor/src/components/ui/combobox.tsx:288
- New UI primitives (Textarea/Switch/Combobox/InputGroup) are added without any accompanying unit tests. There is already a UI component testing setup in this package (e.g., sidebar.test.tsx), so adding at least a basic render/smoke test would help catch regressions (e.g., required data-slot attributes and
dec:-prefixed class application).
export {
Combobox,
ComboboxInput,
ComboboxContent,
ComboboxList,
packages/open-workflow-diagram-editor/src/components/ui/input-group.tsx:38
- InputGroup’s alignment variants only adjust padding on direct child elements. Since this component also supports <Textarea> via InputGroupTextarea, addons can overlap the textarea content because the padding rules won’t apply.
"dec:has-[>[data-align=inline-start]]:[&>input]:pl-2",
"dec:has-[>[data-align=inline-end]]:[&>input]:pr-2",
"dec:has-[>[data-align=block-start]]:h-auto dec:has-[>[data-align=block-start]]:flex-col dec:has-[>[data-align=block-start]]:[&>input]:pb-3",
"dec:has-[>[data-align=block-end]]:h-auto dec:has-[>[data-align=block-end]]:flex-col dec:has-[>[data-align=block-end]]:[&>input]:pt-3",
Signed-off-by: kumaradityaraj <sedulous.0007@gmail.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 13 changed files in this pull request and generated no new comments.
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
Suppressed comments (4)
packages/open-workflow-diagram-editor/src/components/ui/input-group.tsx:89
InputGroupAddonfocuses only the first<input>in the group; when the group contains a<textarea>(viaInputGroupTextarea), clicking the addon won’t focus the control.
e.currentTarget.parentElement?.querySelector("input")?.focus();
packages/open-workflow-diagram-editor/src/components/ui/combobox.tsx:259
ComboboxPrimitive.ChipRemoverenders aButtonwithout an explicittype, which defaults tosubmitinside forms and can trigger unintended form submissions.
render={<Button variant="ghost" size="icon-xs" />}
packages/open-workflow-diagram-editor/src/components/ui/combobox.tsx:115
ComboboxContentuses a portal without scoping it to.dec-root. The editor’s Tailwind dark variant is scoped to.dec-root.dark(src/styles.css:28), so portalled content outside.dec-rootwon’t receivedec:dark:*styles (contrast withTooltipContent, which portals into.dec-root).
<ComboboxPrimitive.Portal>
packages/open-workflow-diagram-editor/README.md:160
- The README now states shadcn/ui is used for “radix based UI primitives”, but this PR introduces a shadcn component (
Combobox) built on@base-ui/react. This sentence should be updated to reflect both libraries (or avoid calling it Radix-only).
This package uses [shadcn/ui](https://ui.shadcn.com/) for radix based UI primitives. Configuration: [`components.json`](components.json)
Signed-off-by: kumaradityaraj <sedulous.0007@gmail.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 14 changed files in this pull request and generated no new comments.
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
Suppressed comments (8)
packages/open-workflow-diagram-editor/src/components/ui/switch.tsx:42
- The thumb translate distance doesn’t vary by
size. Withsize="sm"(w-7, thumb w-3),translate-x-4moves the thumb the full track width difference and can visually collide with/overflow the right border. Consider using a smaller translate for the sm variant.
"dec:pointer-events-none dec:block dec:rounded-full dec:bg-white dec:shadow-sm dec:ring-0 dec:transition-transform dec:group-data-[size=default]/switch:h-4 dec:group-data-[size=default]/switch:w-4 dec:group-data-[size=sm]/switch:h-3 dec:group-data-[size=sm]/switch:w-3 dec:data-[state=checked]:translate-x-4 dec:data-[state=unchecked]:translate-x-0 dec:dark:bg-white",
packages/open-workflow-diagram-editor/src/components/ui/input-group.tsx:90
- Clicking the addon currently only focuses an , so the addon won’t focus other supported controls (e.g., the InputGroupTextarea’s <textarea>), which breaks expected interaction for textarea-based groups.
onClick={(e) => {
if ((e.target as HTMLElement).closest("button")) {
return;
}
e.currentTarget.parentElement?.querySelector("input")?.focus();
packages/open-workflow-diagram-editor/README.md:160
- The README now states shadcn components are “radix based”, but this PR introduces a Combobox built on
@base-ui/react. Updating this sentence will keep the docs accurate for consumers and future contributors.
This package uses [shadcn/ui](https://ui.shadcn.com/) for radix based UI primitives. Configuration: [`components.json`](components.json)
.changeset/validate-color-mode-input.md:5
- This changeset appears unrelated to the shadcn component work described in the PR, and its text matches an entry already present in
packages/open-workflow-diagram-editor/CHANGELOG.md(v1.1.0). Keeping it will likely cause a duplicate release note/version bump on the next changeset publish run.
---
"@openworkflowspec/diagram-editor": patch
---
Validate colorMode input in useResolvedColorMode, falling back to "system" for unknown values.
.changeset/temporary-validation-workaround.md:5
- This changeset appears unrelated to the shadcn component work described in the PR, and its text matches an entry already present in
packages/open-workflow-diagram-editor/CHANGELOG.md(v1.1.0). Keeping it will likely cause a duplicate release note/version bump on the next changeset publish run.
---
"@openworkflowspec/diagram-editor": minor
---
Temporary validation workaround before updated specification is published
.changeset/task-reference-validation.md:5
- This changeset appears unrelated to the shadcn component work described in the PR, and its text matches an entry already present in
packages/open-workflow-diagram-editor/CHANGELOG.md(v1.1.0). Keeping it will likely cause a duplicate release note/version bump on the next changeset publish run.
---
"@openworkflowspec/diagram-editor": minor
---
Use new sdk task reference for validation errors
.changeset/fix-feedback-edges-routing.md:5
- This changeset appears unrelated to the shadcn component work described in the PR, and its text matches an entry already present in
packages/open-workflow-diagram-editor/CHANGELOG.md(v1.1.0). Keeping it will likely cause a duplicate release note/version bump on the next changeset publish run.
---
"@openworkflowspec/diagram-editor": minor
---
Fix bad routing / overlaps for feedback edges.
.changeset/add-vanilla-web-component-example.md:5
- This changeset appears unrelated to the shadcn component work described in the PR. The described change (“Add a non-React host example…”) matches an entry already present in
examples/vanilla-web-component/CHANGELOG.md(v1.1.0), so keeping this changeset will likely create a duplicate release note/version bump.
---
"@openworkflowspec/vanilla-web-component-example": minor
---
Add a non-React host example for the Diagram Editor
Signed-off-by: kumaradityaraj <sedulous.0007@gmail.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 9 changed files in this pull request and generated no new comments.
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
Suppressed comments (2)
packages/open-workflow-diagram-editor/src/components/ui/input-group.tsx:89
- InputGroupAddon’s click handler only focuses an , so add-ons won’t focus a textarea control (InputGroupTextarea) or any other control using data-slot="input-group-control". This makes the click-to-focus behavior inconsistent across supported controls.
if ((e.target as HTMLElement).closest("button")) {
return;
}
e.currentTarget.parentElement?.querySelector("input")?.focus();
}}
packages/open-workflow-diagram-editor/README.md:160
- The README now states shadcn/ui is used for “radix based UI primitives”, but this PR introduces a Combobox built on
@base-ui/react(not Radix). This wording is misleading for future contributors.
This package uses [shadcn/ui](https://ui.shadcn.com/) for radix based UI primitives. Configuration: [`components.json`](components.json)
Signed-off-by: kumaradityaraj <sedulous.0007@gmail.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 9 changed files in this pull request and generated no new comments.
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
Suppressed comments (6)
packages/open-workflow-diagram-editor/src/components/ui/combobox.tsx:128
- Combobox popup classes include both shadow-md and shadow-lg; the earlier class is overridden and adds noise. Removing the redundant shadow class makes the styling easier to reason about.
"dec:group/combobox-content dec:relative dec:max-h-96 dec:w-(--anchor-width) dec:max-w-(--available-width) dec:min-w-[calc(var(--anchor-width)+--spacing(7))] dec:origin-(--transform-origin) dec:overflow-hidden dec:rounded-md dec:shadow-md dec:ring-1 dec:bg-white dec:text-slate-900 dec:border dec:border-slate-200 dec:shadow-lg dec:dark:bg-[#1f2937] dec:dark:text-slate-100 dec:dark:border-slate-700 dec:duration-100 dec:data-[chips=true]:min-w-(--anchor-width) dec:data-[side=bottom]:slide-in-from-top-2 dec:data-[side=left]:slide-in-from-right-2 dec:data-[side=right]:slide-in-from-left-2 dec:data-[side=top]:slide-in-from-bottom-2 dec:*:data-[slot=input-group]:m-1 dec:*:data-[slot=input-group]:mb-0 dec:*:data-[slot=input-group]:h-8 dec:*:data-[slot=input-group]:border-input/30 dec:*:data-[slot=input-group]:bg-input/30 dec:*:data-[slot=input-group]:shadow-none dec:data-open:animate-in dec:data-open:fade-in-0 dec:data-open:zoom-in-95 dec:data-closed:animate-out dec:data-closed:fade-out-0 dec:data-closed:zoom-out-95",
packages/open-workflow-diagram-editor/src/components/ui/combobox.tsx:231
- ComboboxChips class list repeats focus-within:ring-[3px] and has extra whitespace, which makes the final style harder to audit and maintain. Keep a single ring width declaration and remove the redundant token.
"dec:flex dec:min-h-9 dec:flex-wrap dec:items-center dec:gap-1.5 dec:rounded-md dec:border dec:bg-clip-padding dec:px-2.5 dec:py-1.5 dec:text-sm dec:shadow-xs dec:transition-[color,box-shadow] dec:focus-within:ring-[3px] dec:has-aria-invalid:ring-[3px] dec:has-data-[slot=combobox-chip]:px-1.5 dec:border-slate-300 dec:bg-white dec:text-slate-900 dec:hover:border-slate-400 dec:focus-within:border-blue-500 dec:focus-within:ring-[3px] dec:focus-within:ring-blue-500/20 dec:has-aria-invalid:border-red-500 dec:has-aria-invalid:ring-red-500/20 dec:dark:border-slate-600 dec:dark:bg-[#1f2937] dec:dark:text-slate-100 dec:dark:hover:border-slate-500 dec:dark:focus-within:border-blue-400 dec:dark:focus-within:ring-blue-400/20",
packages/open-workflow-diagram-editor/src/components/ui/combobox.tsx:270
- ComboboxChipsInput destructures
childrenbut never uses it, which creates an unnecessary unused variable and makes the component signature misleading.
function ComboboxChipsInput({ className, children, ...props }: ComboboxPrimitive.Input.Props) {
packages/open-workflow-diagram-editor/src/components/ui/combobox.tsx:117
- Combobox uses a Portal without an explicit container, while other overlay components (e.g., TooltipContent) explicitly portal into the
.dec-rootcontainer to support Shadow DOM / style scoping. Consider aligning Combobox’s portal/container strategy to avoid the popup rendering outside the editor root (and potentially outside the scoped styles).
<ComboboxPrimitive.Portal>
<ComboboxPrimitive.Positioner
side={side}
packages/open-workflow-diagram-editor/src/components/ui/combobox.tsx:73
- New UI primitives (Combobox/Switch/Textarea/InputGroup) add interactive behavior but there are no corresponding UI component tests (tests/components/ui currently only covers Sidebar). Adding at least basic render + interaction tests (open/close, clear, disabled state, keyboard navigation) would help prevent regressions as editing features are built on top.
function ComboboxInput({
className,
children,
disabled = false,
showTrigger = true,
showClear = false,
...props
packages/open-workflow-diagram-editor/src/components/ui/input-group.tsx:90
- InputGroupAddon click-to-focus currently only targets a descendant , so clicking an addon won’t focus an InputGroupTextarea (or any other control using data-slot="input-group-control" that isn’t an input). This breaks the expected behavior for textarea-based groups.
if ((e.target as HTMLElement).closest("button")) {
return;
}
e.currentTarget.parentElement?.querySelector("input")?.focus();
}}
Closes #293
Summary
Adds the remaining shadcn components required for the upcoming editing work and verifies they integrate correctly with the diagram editor styling.
Changes
Textareacomponent.Switchcomponent.Comboboxcomponent.dec:prefix.Screenshots
| Light Mode | Dark Mode |