import { default as React } from 'react'; import { FeatureFlags, FieldDescriptor, FieldOption, FormDefinition, NestedData, Registry, WorkflowDefinition } from './core/index.js'; import { AccordionItem, AvatarSize, BadgeTone, ButtonSize, ButtonVariant, MenuItem, PopoverPlacement, TabItem, CellRenderer, ColumnMap, ChartDatePoint, ChartFormat, ChartGroup, ChartMarker, ChartSeries, CodeVariant, Crumb, FilterVariant, ListItem, MeterThresholds, ModalPlacement, ProgressRingTone, FieldReferenceLookup, ReferenceOption, SwipeAction, TimelineItem, CommentEntry, EditColumn, EditRow, NotificationItem } from './components/primitives/index.js'; import { BahtFormOptions } from './components/baht-form.js'; /** * Base attributes shared by every custom element (style, event handlers, …). * `class` is included alongside React's `className` — web-component users often * reach for the plain HTML attribute, and both work on custom elements. */ type WC = React.DetailedHTMLProps & { class?: string; } & Props, HTMLElement>; /** `empty-message`: what an element shows with nothing to list. */ type EmptyMessage = Pick; /** Shared props of every chart element (all extend BahtChartBase). */ interface ChartCommon { 'empty-message'?: string; loading?: boolean; 'show-table'?: boolean; format?: ChartFormat; currency?: string; } /** Shared props of the form-field primitives (all extend BahtFieldBase). */ interface FieldProps { field?: FieldDescriptor; value?: unknown; disabled?: boolean; readonly?: boolean; required?: boolean; error?: string | null; } declare module 'react' { namespace JSX { interface IntrinsicElements { 'baht-form': WC<{ form?: FormDefinition; value?: Record; registry?: Registry; options?: BahtFormOptions; view?: string; flags?: FeatureFlags; }>; 'baht-workflow': WC<{ workflow?: WorkflowDefinition; value?: NestedData; registry?: Registry; flags?: FeatureFlags; 'validate-gate'?: boolean; 'show-steps'?: boolean; 'next-label'?: string; 'submit-label'?: string; 'back-label'?: string; 'show-back'?: boolean; }>; 'baht-input': WC; 'baht-textarea': WC; 'baht-number': WC; 'baht-currency': WC; 'baht-select': WC; 'baht-multiselect': WC; 'baht-tags': WC; 'baht-checkbox': WC; 'baht-radio': WC; 'baht-toggle': WC; 'baht-datepicker': WC; 'baht-file': WC; 'baht-repeater': WC; 'baht-text': WC<{ field?: FieldDescriptor; }>; 'baht-button': WC<{ variant?: ButtonVariant; size?: ButtonSize; disabled?: boolean; type?: 'button' | 'submit'; label?: string; icon?: string; 'icon-only'?: boolean; shortcut?: string; 'tooltip-position'?: 'top' | 'bottom'; }>; 'baht-menu': WC<{ items?: MenuItem[]; 'trigger-label'?: string; icon?: string; label?: string; variant?: 'ghost' | 'secondary'; size?: 'sm' | 'md'; align?: 'start' | 'end'; disabled?: boolean; heading?: string; }>; 'baht-tabs': WC<{ tabs?: TabItem[]; value?: string; label?: string; variant?: 'line' | 'pill'; activation?: 'automatic' | 'manual'; }>; 'baht-popover': WC<{ open?: boolean; label?: string; placement?: PopoverPlacement; }>; 'baht-theme-toggle': WC<{ theme?: 'light' | 'dark'; default?: 'light' | 'dark' | 'system'; target?: string; 'storage-key'?: string; }>; 'baht-split-button': WC<{ label?: string; variant?: ButtonVariant; size?: ButtonSize; disabled?: boolean; shortcut?: string; items?: MenuItem[]; align?: 'start' | 'end'; 'menu-label'?: string; }>; 'baht-badge': WC<{ tone?: BadgeTone; label?: string; dot?: boolean; }>; 'baht-avatar': WC<{ label?: string; initials?: string; size?: AvatarSize; }>; 'baht-card': WC<{ heading?: string; subtitle?: string; hero?: boolean; }>; 'baht-alert': WC<{ tone?: 'info' | 'success' | 'warning' | 'danger'; heading?: string; message?: string; dismissible?: boolean; }>; 'baht-code': WC<{ variant?: CodeVariant; code?: string; }>; 'baht-link': WC<{ href?: string; label?: string; external?: boolean; }>; 'baht-spinner': WC<{ size?: 'sm' | 'md' | 'lg'; label?: string; }>; 'baht-skeleton': WC<{ variant?: 'rect' | 'text' | 'circle'; width?: string; height?: string; }>; 'baht-tooltip': WC<{ text?: string; position?: 'top' | 'bottom' | 'left' | 'right'; }>; 'baht-fieldset': WC<{ legend?: string; disabled?: boolean; }>; 'baht-table': WC<{ items?: Record[]; columns?: ColumnMap; renderers?: Record; visibleColumns?: string[]; 'column-picker'?: boolean; loading?: boolean; error?: boolean; 'error-message'?: string; 'empty-message'?: string; 'show-index'?: boolean; 'index-offset'?: number; 'skeleton-rows'?: number; 'row-key'?: string; clickable?: boolean; page?: number; 'total-pages'?: number; 'cursor-mode'?: boolean; 'has-next'?: boolean; 'has-prev'?: boolean; }>; 'baht-list': WC<{ items?: ListItem[]; loading?: boolean; error?: boolean; 'error-message'?: string; 'empty-message'?: string; 'skeleton-rows'?: number; clickable?: boolean; }>; 'baht-accordion': WC<{ items?: AccordionItem[]; multiple?: boolean; }>; 'baht-timeline': WC<{ items?: TimelineItem[]; }>; 'baht-comments': WC; 'baht-notification-bell': WC; 'baht-edit-table': WC<{ columns?: EditColumn[]; rows?: EditRow[]; 'row-key'?: string; addable?: boolean; removable?: boolean; label?: string; }>; 'baht-rule-builder': WC<{ workflow?: WorkflowDefinition | null; }>; 'baht-breadcrumbs': WC<{ items?: Crumb[]; separator?: string; }>; 'baht-steps': WC<{ steps?: string[]; current?: number; variant?: 'default' | 'sidebar'; }>; 'baht-filter': WC<{ options?: FieldOption[]; selected?: string[]; multiple?: boolean; disabled?: boolean; variant?: FilterVariant; label?: string; }>; 'baht-swipe-row': WC<{ actions?: SwipeAction[]; open?: boolean; label?: string; }>; 'baht-pagination': WC<{ page?: number; 'total-pages'?: number; variant?: 'numbered' | 'compact' | 'cursor'; siblings?: number; 'has-next'?: boolean; 'has-prev'?: boolean; }>; 'baht-progress': WC<{ value?: number | null; tone?: 'primary' | 'success' | 'warning' | 'danger'; 'show-label'?: boolean; label?: string; }>; 'baht-progress-ring': WC<{ value?: number; tone?: ProgressRingTone; label?: string; size?: number; }>; /** standalone props, or FieldProps when used as a `type: 'range'` field */ 'baht-range': WC; /** standalone props, or FieldProps when used as a `type: 'rating'` field */ 'baht-rating': WC; 'baht-otp': WC<{ length?: number; value?: string; disabled?: boolean; mode?: 'numeric' | 'text'; }>; 'baht-stat-chart': WC<{ total?: number; label?: string; color?: string; }>; 'baht-stat': WC<{ label?: string; value?: number; format?: ChartFormat; currency?: string; delta?: number | null; 'delta-kind'?: 'abs' | 'pct'; 'delta-label'?: string; 'up-is-good'?: boolean; trend?: number[]; size?: 'md' | 'hero'; icon?: string; }>; 'baht-sparkline': WC<{ values?: number[]; width?: number; height?: number; 'accent-last'?: boolean; color?: string; label?: string; }>; 'baht-donut-chart': WC; 'baht-bar-chart': WC; 'baht-line-chart': WC; 'baht-heatmap': WC; 'baht-meter': WC<{ value?: number; max?: number; label?: string; format?: ChartFormat; currency?: string; thresholds?: MeterThresholds; expected?: number | null; 'over-label'?: string; 'near-label'?: string; 'at-label'?: string; }>; 'baht-empty-state': WC<{ icon?: string; message?: string; hint?: string; }>; 'baht-error-state': WC<{ icon?: string; heading?: string; message?: string; 'retry-label'?: string; }>; 'baht-keyvalue-editor': WC<{ value?: Record; 'key-placeholder'?: string; 'value-placeholder'?: string; 'add-label'?: string; disabled?: boolean; }>; /** standalone props, or FieldProps + `lookup` when used as a `type: 'reference'` field */ 'baht-reference-picker': WC Promise; }>; 'baht-modal': WC<{ open?: boolean; heading?: string; description?: string; placement?: ModalPlacement; 'show-close'?: boolean; 'close-on-scrim'?: boolean; }>; 'baht-toast': WC<{ duration?: number; }>; } } } export {};