// Minimal local primitives used by the dialogs copied into runtime-react. // These are intentionally dependency-free shims — hosts that want richer // visuals (date picker calendar, radix progress, radix radio-group) should // override by wrapping these components. The UI package does not currently // export these three primitives so we keep them inside the runtime. import * as React from 'react' // ── Progress ──────────────────────────────────────────────────────────────── export interface ProgressProps extends React.HTMLAttributes { value?: number } export function Progress({ value = 0, className = '', ...props }: ProgressProps) { const pct = Math.max(0, Math.min(100, value)) return (
) } // ── RadioGroup ────────────────────────────────────────────────────────────── interface RadioGroupContextValue { value: string onChange: (value: string) => void name: string } const RadioGroupContext = React.createContext(null) export interface RadioGroupProps { value: string onValueChange: (value: string) => void className?: string children: React.ReactNode name?: string } export function RadioGroup({ value, onValueChange, className = '', children, name = 'radio-group' }: RadioGroupProps) { return (
{children}
) } export interface RadioGroupItemProps { value: string id?: string className?: string disabled?: boolean } export function RadioGroupItem({ value, id, className = '', disabled }: RadioGroupItemProps) { const ctx = React.useContext(RadioGroupContext) if (!ctx) throw new Error('RadioGroupItem must be used inside ') const checked = ctx.value === value return ( ctx.onChange(value)} className={`h-4 w-4 border-primary text-primary ${className}`} /> ) } // ── Calendar (minimal) ────────────────────────────────────────────────────── // We expose a tiny date-input based Calendar so the record-dialog still // renders when no host-provided calendar is available. Hosts wanting a full // calendar grid can pass their own via the `calendar` prop on DynamicTable // (not wired here) or wrap the dialog. For the build to succeed, this shim // is sufficient. export interface CalendarProps { mode?: 'single' selected?: Date onSelect?: (date: Date | undefined) => void locale?: any className?: string } export function Calendar({ selected, onSelect, className = '' }: CalendarProps) { const value = selected && !isNaN(selected.getTime()) ? selected.toISOString().slice(0, 10) : '' return (
{ const v = e.target.value if (!v) { onSelect?.(undefined); return } onSelect?.(new Date(v + 'T00:00:00')) }} className="w-full rounded-md border px-3 py-2 text-sm" />
) }