Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions apps/mapgen-studio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,25 @@
"@civ7/plugin-mods": "workspace:*",
"@civ7/studio-server": "workspace:*",
"@deck.gl/core": "^9.0.43",
"@fontsource/inter": "^5.1.1",
"@fontsource/jetbrains-mono": "^5.1.1",
"@deck.gl/layers": "^9.0.43",
"@deck.gl/react": "^9.0.43",
"@fontsource/inter": "^5.1.1",
"@fontsource/jetbrains-mono": "^5.1.1",
"@orpc/client": "^1.14.4",
"@orpc/contract": "^1.14.4",
"@orpc/server": "^1.14.4",
"@radix-ui/react-checkbox": "1.3.4",
"@radix-ui/react-dialog": "1.1.16",
"@radix-ui/react-dropdown-menu": "2.1.17",
"@radix-ui/react-label": "2.1.9",
"@radix-ui/react-popover": "1.1.16",
"@radix-ui/react-scroll-area": "1.2.11",
"@radix-ui/react-select": "2.3.0",
"@radix-ui/react-separator": "1.1.9",
"@radix-ui/react-slot": "1.2.5",
"@radix-ui/react-switch": "1.3.0",
"@radix-ui/react-tabs": "1.1.14",
"@radix-ui/react-tooltip": "1.2.9",
"@standard-schema/spec": "^1.1.0",
"@rjsf/core": "^6.2.5",
"@rjsf/utils": "^6.2.5",
Expand All @@ -42,6 +54,7 @@
"mod-swooper-maps": "workspace:*",
"react": "^19.2.4",
"react-dom": "^19.2.4",
"sonner": "2.0.7",
"tailwind-merge": "latest",
"typebox": "^1.0.80"
},
Expand Down
65 changes: 65 additions & 0 deletions apps/mapgen-studio/src/components/ui/button.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import * as React from "react";
import { Slot } from "@radix-ui/react-slot";
import { cva, type VariantProps } from "class-variance-authority";

import { cn } from "@/lib/utils";

/**
* Button — the one filled action in a borders-only instrument.
*
* `default` is the single restrained primary slate; everything else is a
* contour (outline / ghost / link). Dense as-built dimensions are preserved:
* h-8 default, h-7 sm, 4px radius. Focus is the luminance contour ring.
*/
const buttonVariants = cva(
"inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-sm text-data font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-3.5 [&_svg]:shrink-0",
{
variants: {
variant: {
default:
"bg-primary text-primary-foreground border border-primary hover:bg-primary/90 active:bg-primary/80",
destructive:
"bg-destructive text-destructive-foreground border border-destructive hover:bg-destructive/90",
outline:
"border border-input bg-transparent text-foreground hover:bg-accent hover:text-accent-foreground active:bg-muted",
secondary:
"bg-secondary text-secondary-foreground border border-border hover:bg-muted",
ghost: "text-foreground hover:bg-accent hover:text-accent-foreground",
link: "text-foreground underline-offset-4 hover:underline",
},
size: {
default: "h-8 px-3",
sm: "h-7 px-2.5",
lg: "h-9 px-4",
icon: "h-7 w-7",
},
},
defaultVariants: {
variant: "default",
size: "default",
},
},
);

export interface ButtonProps
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
VariantProps<typeof buttonVariants> {
/** Render as the child element (Radix `asChild` slot pattern). */
asChild?: boolean;
}

const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
({ className, variant, size, asChild = false, ...props }, ref) => {
const Comp = asChild ? Slot : "button";
return (
<Comp
className={cn(buttonVariants({ variant, size, className }))}
ref={ref}
{...props}
/>
);
},
);
Button.displayName = "Button";

export { Button, buttonVariants };
35 changes: 35 additions & 0 deletions apps/mapgen-studio/src/components/ui/checkbox.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import * as React from "react";
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
import { Check } from "lucide-react";

import { cn } from "@/lib/utils";

/**
* Checkbox — dense 14px box, 4px radius. Checked fills with the one primary
* slate; focus is the luminance contour ring.
*/
const Checkbox = React.forwardRef<
React.ComponentRef<typeof CheckboxPrimitive.Root>,
React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>
>(({ className, ...props }, ref) => (
<CheckboxPrimitive.Root
ref={ref}
className={cn(
"peer size-3.5 shrink-0 rounded-sm border border-input bg-input-background transition-colors",
"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background",
"disabled:cursor-not-allowed disabled:opacity-50",
"data-[state=checked]:bg-primary data-[state=checked]:border-primary data-[state=checked]:text-primary-foreground",
className,
)}
{...props}
>
<CheckboxPrimitive.Indicator
className={cn("flex items-center justify-center text-current")}
>
<Check className="size-3" strokeWidth={3} />
</CheckboxPrimitive.Indicator>
</CheckboxPrimitive.Root>
));
Checkbox.displayName = CheckboxPrimitive.Root.displayName;

export { Checkbox };
121 changes: 121 additions & 0 deletions apps/mapgen-studio/src/components/ui/dialog.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
import * as React from "react";
import * as DialogPrimitive from "@radix-ui/react-dialog";
import { X } from "lucide-react";

import { cn } from "@/lib/utils";

/**
* Dialog — modal on the floating tier. The overlay is a dimmed scrim with a
* quiet backdrop blur; the panel rests on `popover` with an 8px radius and a
* shadow (floating depth). Titles use 14px (`text-sm`).
*/
const Dialog = DialogPrimitive.Root;
const DialogTrigger = DialogPrimitive.Trigger;
const DialogPortal = DialogPrimitive.Portal;
const DialogClose = DialogPrimitive.Close;

const DialogOverlay = React.forwardRef<
React.ComponentRef<typeof DialogPrimitive.Overlay>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
>(({ className, ...props }, ref) => (
<DialogPrimitive.Overlay
ref={ref}
className={cn(
"fixed inset-0 z-50 bg-background/70 backdrop-blur-sm",
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
className,
)}
{...props}
/>
));
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;

const DialogContent = React.forwardRef<
React.ComponentRef<typeof DialogPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
>(({ className, children, ...props }, ref) => (
<DialogPortal>
<DialogOverlay />
<DialogPrimitive.Content
ref={ref}
className={cn(
"fixed left-1/2 top-1/2 z-50 grid w-full max-w-lg -translate-x-1/2 -translate-y-1/2 gap-3 rounded-lg border border-border bg-popover p-4 text-popover-foreground shadow-lg",
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",
className,
)}
{...props}
>
{children}
<DialogPrimitive.Close className="absolute right-3 top-3 rounded-sm text-muted-foreground opacity-70 transition-opacity hover:opacity-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none">
<X className="size-3.5" />
<span className="sr-only">Close</span>
</DialogPrimitive.Close>
</DialogPrimitive.Content>
</DialogPortal>
));
DialogContent.displayName = DialogPrimitive.Content.displayName;

const DialogHeader = ({
className,
...props
}: React.HTMLAttributes<HTMLDivElement>) => (
<div
className={cn("flex flex-col gap-1 text-left", className)}
{...props}
/>
);
DialogHeader.displayName = "DialogHeader";

const DialogFooter = ({
className,
...props
}: React.HTMLAttributes<HTMLDivElement>) => (
<div
className={cn(
"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
className,
)}
{...props}
/>
);
DialogFooter.displayName = "DialogFooter";

const DialogTitle = React.forwardRef<
React.ComponentRef<typeof DialogPrimitive.Title>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
>(({ className, ...props }, ref) => (
<DialogPrimitive.Title
ref={ref}
className={cn(
"text-sm font-semibold leading-none text-foreground",
className,
)}
{...props}
/>
));
DialogTitle.displayName = DialogPrimitive.Title.displayName;

const DialogDescription = React.forwardRef<
React.ComponentRef<typeof DialogPrimitive.Description>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
>(({ className, ...props }, ref) => (
<DialogPrimitive.Description
ref={ref}
className={cn("text-data text-muted-foreground", className)}
{...props}
/>
));
DialogDescription.displayName = DialogPrimitive.Description.displayName;

export {
Dialog,
DialogPortal,
DialogOverlay,
DialogTrigger,
DialogClose,
DialogContent,
DialogHeader,
DialogFooter,
DialogTitle,
DialogDescription,
};
Loading
Loading