Bundles the prior autonomous-session output that was sitting unstaged: - Em-dash sweep across src/ + tests/ (en-dash/em-dash to hyphen, ~2280 instances) - country-flag-icons rollout (CountryFlag component, replaces emoji glyphs that never rendered on Windows; lazy-loads the 3x2 SVG index as a single chunk after the per-subpath dynamic-import approach silently failed in webpack) - Admin IA Phase 1+2: 7-domain regroup, 41 to 38 pages, /admin/berths index, redirects (ocr to ai, reports to dashboard, invitations to users), docs/admin-ia-proposal.md - Per-template email tester (registry + endpoint + UI on Email admin page) - Cancel-document mode picker (delete-from-Documenso vs keep-for-audit) - Dashboard PDF report: 25 widgets, SVG charts, date-range picker, 11 resolvers - Customize-widgets per-region sortables at xl+ (charts/rails/feed); single flat sortable below xl when the layout stacks; per-viewport saved orders - Audit doc updates capturing each shipped item - Lint fixes: react-compiler immutability in DonutChart (reduce instead of let-reassign), set-state-in-effect disables in CountryFlag and UploadForSigning preview-bytes effect, unused 'confirm' destructures in interest contract + reservation tabs, unescaped apostrophe in test-template card copy
162 lines
5.8 KiB
TypeScript
162 lines
5.8 KiB
TypeScript
'use client';
|
|
|
|
import * as React from 'react';
|
|
import { type DialogProps } from '@radix-ui/react-dialog';
|
|
import { Command as CommandPrimitive } from 'cmdk';
|
|
import { Search } from 'lucide-react';
|
|
|
|
import { cn } from '@/lib/utils';
|
|
import { Dialog, DialogContent } from '@/components/ui/dialog';
|
|
|
|
const Command = React.forwardRef<
|
|
React.ElementRef<typeof CommandPrimitive>,
|
|
React.ComponentPropsWithoutRef<typeof CommandPrimitive>
|
|
>(({ className, ...props }, ref) => (
|
|
<CommandPrimitive
|
|
ref={ref}
|
|
className={cn(
|
|
'flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground',
|
|
className,
|
|
)}
|
|
{...props}
|
|
/>
|
|
));
|
|
Command.displayName = CommandPrimitive.displayName;
|
|
|
|
const CommandDialog = ({ children, ...props }: DialogProps) => {
|
|
return (
|
|
<Dialog {...props}>
|
|
<DialogContent className="overflow-hidden p-0">
|
|
<Command className="**:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 **:[[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 **:[[cmdk-input]]:h-12 **:[[cmdk-item]]:px-2 **:[[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
|
|
{children}
|
|
</Command>
|
|
</DialogContent>
|
|
</Dialog>
|
|
);
|
|
};
|
|
|
|
const CommandInput = React.forwardRef<
|
|
React.ElementRef<typeof CommandPrimitive.Input>,
|
|
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>
|
|
>(({ className, ...props }, ref) => (
|
|
<div className="flex items-center border-b px-3" cmdk-input-wrapper="">
|
|
<Search className="mr-2 h-4 w-4 shrink-0 opacity-50" />
|
|
<CommandPrimitive.Input
|
|
ref={ref}
|
|
className={cn(
|
|
'flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50',
|
|
className,
|
|
)}
|
|
{...props}
|
|
/>
|
|
</div>
|
|
));
|
|
|
|
CommandInput.displayName = CommandPrimitive.Input.displayName;
|
|
|
|
const CommandList = React.forwardRef<
|
|
React.ElementRef<typeof CommandPrimitive.List>,
|
|
React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>
|
|
>(({ className, onWheel, ...props }, ref) => (
|
|
// Inside a Radix Popover, native wheel scrolling is intercepted by the
|
|
// focus-scope and never reaches the cmdk list - so trackpad/mousewheel
|
|
// scrolling on the country dropdown silently no-ops. Translate the wheel
|
|
// event ourselves so the list scrolls regardless of focus state.
|
|
<CommandPrimitive.List
|
|
ref={ref}
|
|
// Cap the list at whichever is smaller: the static 300px ceiling or the
|
|
// remaining viewport space the parent Popover has below its trigger.
|
|
// Without the radix-popover variable, long lists in a Popover scrolled
|
|
// past the bottom of the popover content (the visible bottom edge was
|
|
// clipped by the popover's auto-sizing). The variable resolves to
|
|
// `<undefined>` for non-Popover hosts; the static max-h still applies.
|
|
className={cn(
|
|
'max-h-[min(300px,var(--radix-popover-content-available-height,300px))] overflow-y-auto overflow-x-hidden overscroll-contain',
|
|
className,
|
|
)}
|
|
onWheel={(event) => {
|
|
onWheel?.(event);
|
|
if (event.defaultPrevented) return;
|
|
event.currentTarget.scrollTop += event.deltaY;
|
|
}}
|
|
{...props}
|
|
/>
|
|
));
|
|
|
|
CommandList.displayName = CommandPrimitive.List.displayName;
|
|
|
|
const CommandEmpty = React.forwardRef<
|
|
React.ElementRef<typeof CommandPrimitive.Empty>,
|
|
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>
|
|
>((props, ref) => (
|
|
<CommandPrimitive.Empty ref={ref} className="py-6 text-center text-sm" {...props} />
|
|
));
|
|
|
|
CommandEmpty.displayName = CommandPrimitive.Empty.displayName;
|
|
|
|
const CommandGroup = React.forwardRef<
|
|
React.ElementRef<typeof CommandPrimitive.Group>,
|
|
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>
|
|
>(({ className, ...props }, ref) => (
|
|
<CommandPrimitive.Group
|
|
ref={ref}
|
|
className={cn(
|
|
'overflow-hidden p-1 text-foreground **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground',
|
|
className,
|
|
)}
|
|
{...props}
|
|
/>
|
|
));
|
|
|
|
CommandGroup.displayName = CommandPrimitive.Group.displayName;
|
|
|
|
const CommandSeparator = React.forwardRef<
|
|
React.ElementRef<typeof CommandPrimitive.Separator>,
|
|
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>
|
|
>(({ className, ...props }, ref) => (
|
|
<CommandPrimitive.Separator
|
|
ref={ref}
|
|
className={cn('-mx-1 h-px bg-border', className)}
|
|
{...props}
|
|
/>
|
|
));
|
|
CommandSeparator.displayName = CommandPrimitive.Separator.displayName;
|
|
|
|
const CommandItem = React.forwardRef<
|
|
React.ElementRef<typeof CommandPrimitive.Item>,
|
|
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>
|
|
>(({ className, ...props }, ref) => (
|
|
<CommandPrimitive.Item
|
|
ref={ref}
|
|
className={cn(
|
|
'relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-hidden data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0',
|
|
className,
|
|
)}
|
|
{...props}
|
|
/>
|
|
));
|
|
|
|
CommandItem.displayName = CommandPrimitive.Item.displayName;
|
|
|
|
const CommandShortcut = ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) => {
|
|
return (
|
|
<span
|
|
className={cn('ml-auto text-xs tracking-widest text-muted-foreground', className)}
|
|
{...props}
|
|
/>
|
|
);
|
|
};
|
|
CommandShortcut.displayName = 'CommandShortcut';
|
|
|
|
export {
|
|
Command,
|
|
CommandDialog,
|
|
CommandInput,
|
|
CommandList,
|
|
CommandEmpty,
|
|
CommandGroup,
|
|
CommandItem,
|
|
CommandShortcut,
|
|
CommandSeparator,
|
|
};
|