@k2b/ui 0.1.0-rc.0 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/dist/types/actions/Button.d.ts +38 -0
  2. package/dist/types/actions/ContextMenu.d.ts +17 -0
  3. package/dist/types/actions/CopyButton.d.ts +20 -0
  4. package/dist/types/actions/Disclosure.d.ts +15 -0
  5. package/dist/types/actions/Dropdown.d.ts +100 -0
  6. package/dist/types/actions/FilterChip.d.ts +27 -0
  7. package/dist/types/actions/RemoveButton.d.ts +7 -0
  8. package/dist/types/actions/SegmentedControl.d.ts +20 -0
  9. package/dist/types/actions/SplitButton.d.ts +13 -0
  10. package/dist/types/actions/SpotlightSearch.d.ts +25 -0
  11. package/dist/types/actions/Tabs.d.ts +27 -0
  12. package/dist/types/actions/Toolbar.d.ts +23 -0
  13. package/dist/types/actions/index.d.ts +24 -0
  14. package/dist/types/chat/ChatComposer.d.ts +57 -0
  15. package/dist/types/chat/ChatPrimitives.d.ts +48 -0
  16. package/dist/types/chat/ChatRoot.d.ts +7 -0
  17. package/dist/types/chat/ChatTimeline.d.ts +52 -0
  18. package/dist/types/chat/chat-behavior.d.ts +29 -0
  19. package/dist/types/chat/index.d.ts +21 -0
  20. package/dist/types/chat/types.d.ts +62 -0
  21. package/dist/types/content/Calendar.d.ts +115 -0
  22. package/dist/types/content/Chart.d.ts +90 -0
  23. package/dist/types/content/CodeDisplay.d.ts +11 -0
  24. package/dist/types/content/DataTable.d.ts +113 -0
  25. package/dist/types/content/Docs.d.ts +52 -0
  26. package/dist/types/content/FileBrowser.d.ts +40 -0
  27. package/dist/types/content/FileTree.d.ts +29 -0
  28. package/dist/types/content/FileView.d.ts +59 -0
  29. package/dist/types/content/Lightbox.d.ts +16 -0
  30. package/dist/types/content/LogEntriesTable.d.ts +14 -0
  31. package/dist/types/content/MarkdownView.d.ts +46 -0
  32. package/dist/types/content/Pagination.d.ts +10 -0
  33. package/dist/types/content/PdfPreview.d.ts +11 -0
  34. package/dist/types/content/RangePicker.d.ts +29 -0
  35. package/dist/types/content/StructuredDataPreview.d.ts +20 -0
  36. package/dist/types/content/calendar-event-layout.d.ts +16 -0
  37. package/dist/types/content/calendar-pointer.d.ts +22 -0
  38. package/dist/types/content/chart-map-viewport.d.ts +5 -0
  39. package/dist/types/content/chart-state-timeline.d.ts +42 -0
  40. package/dist/types/content/code-highlight.d.ts +14 -0
  41. package/dist/types/content/file-tree.d.ts +41 -0
  42. package/dist/types/content/file-view-preview.d.ts +22 -0
  43. package/dist/types/content/index.d.ts +26 -0
  44. package/dist/types/feedback/InlineGuidance.d.ts +10 -0
  45. package/dist/types/feedback/Tooltip.d.ts +18 -0
  46. package/dist/types/feedback/dialog-core.d.ts +19 -0
  47. package/dist/types/feedback/index.d.ts +10 -0
  48. package/dist/types/feedback/prompts.d.ts +164 -0
  49. package/dist/types/feedback/toast.d.ts +25 -0
  50. package/dist/types/feedback/tooltip-position.d.ts +2 -0
  51. package/dist/types/index.d.ts +10 -0
  52. package/dist/types/inputs/AutocompleteEditor.d.ts +21 -0
  53. package/dist/types/inputs/AutocompleteSelect.d.ts +30 -0
  54. package/dist/types/inputs/Checkbox.d.ts +9 -0
  55. package/dist/types/inputs/CheckboxCard.d.ts +9 -0
  56. package/dist/types/inputs/ChoiceGroups.d.ts +13 -0
  57. package/dist/types/inputs/ChoiceInputs.d.ts +24 -0
  58. package/dist/types/inputs/Combobox.d.ts +18 -0
  59. package/dist/types/inputs/DatePicker.d.ts +31 -0
  60. package/dist/types/inputs/FileInputs.d.ts +31 -0
  61. package/dist/types/inputs/MultiSelectInput.d.ts +41 -0
  62. package/dist/types/inputs/NumberInput.d.ts +24 -0
  63. package/dist/types/inputs/Select.d.ts +50 -0
  64. package/dist/types/inputs/SelectChip.d.ts +25 -0
  65. package/dist/types/inputs/SpecialInputs.d.ts +21 -0
  66. package/dist/types/inputs/Switch.d.ts +7 -0
  67. package/dist/types/inputs/TagEditor.d.ts +35 -0
  68. package/dist/types/inputs/TagsInput.d.ts +11 -0
  69. package/dist/types/inputs/TemplateEditor.d.ts +28 -0
  70. package/dist/types/inputs/TextInput.d.ts +26 -0
  71. package/dist/types/inputs/choice.d.ts +32 -0
  72. package/dist/types/inputs/completion/behaviors.d.ts +13 -0
  73. package/dist/types/inputs/completion/engine.d.ts +54 -0
  74. package/dist/types/inputs/completion/index.d.ts +3 -0
  75. package/dist/types/inputs/completion/overlay.d.ts +11 -0
  76. package/dist/types/inputs/date-picker.d.ts +42 -0
  77. package/dist/types/inputs/editor-dom.d.ts +6 -0
  78. package/dist/types/inputs/field-contract.d.ts +24 -0
  79. package/dist/types/inputs/icon-options.d.ts +37 -0
  80. package/dist/types/inputs/image-crop.d.ts +44 -0
  81. package/dist/types/inputs/index.d.ts +45 -0
  82. package/dist/types/inputs/markdown/MarkdownEditor.d.ts +25 -0
  83. package/dist/types/inputs/markdown/Toolbar.d.ts +9 -0
  84. package/dist/types/inputs/markdown/actions.d.ts +8 -0
  85. package/dist/types/inputs/markdown/active-formats.d.ts +1 -0
  86. package/dist/types/inputs/markdown/behaviors.d.ts +3 -0
  87. package/dist/types/inputs/markdown/code-zone.d.ts +1 -0
  88. package/dist/types/internal/color.d.ts +4 -0
  89. package/dist/types/internal/field.d.ts +27 -0
  90. package/dist/types/internal/portal.d.ts +1 -0
  91. package/dist/types/intl/Format.d.ts +84 -0
  92. package/dist/types/intl/index.d.ts +4 -0
  93. package/dist/types/intl/locale.d.ts +42 -0
  94. package/dist/types/intl/messages.d.ts +375 -0
  95. package/dist/types/layout/AppOverview.d.ts +29 -0
  96. package/dist/types/layout/AppWorkspace.d.ts +254 -0
  97. package/dist/types/layout/DataPanel.d.ts +16 -0
  98. package/dist/types/layout/DetailPanel.d.ts +89 -0
  99. package/dist/types/layout/Discussion.d.ts +52 -0
  100. package/dist/types/layout/FloatingWindow.d.ts +19 -0
  101. package/dist/types/layout/PanelDialog.d.ts +72 -0
  102. package/dist/types/layout/PanelHeader.d.ts +10 -0
  103. package/dist/types/layout/Panes.d.ts +48 -0
  104. package/dist/types/layout/ScrollArea.d.ts +8 -0
  105. package/dist/types/layout/Settings.d.ts +72 -0
  106. package/dist/types/layout/SettingsCollection.d.ts +41 -0
  107. package/dist/types/layout/SettingsModal.d.ts +39 -0
  108. package/dist/types/layout/app-workspace-controller.d.ts +7 -0
  109. package/dist/types/layout/app-workspace-state.d.ts +57 -0
  110. package/dist/types/layout/floating-window-geometry.d.ts +11 -0
  111. package/dist/types/layout/index.d.ts +32 -0
  112. package/dist/types/layout/panes-layout.d.ts +63 -0
  113. package/dist/types/layout/stable-id.d.ts +3 -0
  114. package/dist/types/semantics.d.ts +4 -0
  115. package/dist/types/surfaces/Avatar.d.ts +14 -0
  116. package/dist/types/surfaces/DescriptionList.d.ts +17 -0
  117. package/dist/types/surfaces/LinkCard.d.ts +11 -0
  118. package/dist/types/surfaces/NotFoundState.d.ts +15 -0
  119. package/dist/types/surfaces/NoticeCard.d.ts +39 -0
  120. package/dist/types/surfaces/Paper.d.ts +13 -0
  121. package/dist/types/surfaces/Placeholder.d.ts +17 -0
  122. package/dist/types/surfaces/ProgressBar.d.ts +13 -0
  123. package/dist/types/surfaces/StatCell.d.ts +22 -0
  124. package/dist/types/surfaces/StatGrid.d.ts +21 -0
  125. package/dist/types/surfaces/StatusBadge.d.ts +12 -0
  126. package/dist/types/surfaces/Tag.d.ts +16 -0
  127. package/dist/types/surfaces/index.d.ts +24 -0
  128. package/dist/types/widgets/Widget.d.ts +12 -0
  129. package/dist/types/widgets/WidgetHero.d.ts +11 -0
  130. package/dist/types/widgets/WidgetList.d.ts +17 -0
  131. package/dist/types/widgets/WidgetPills.d.ts +14 -0
  132. package/dist/types/widgets/WidgetStat.d.ts +17 -0
  133. package/dist/types/widgets/WidgetStatus.d.ts +12 -0
  134. package/dist/types/widgets/index.d.ts +6 -0
  135. package/package.json +1 -1
@@ -0,0 +1,16 @@
1
+ export type CalendarIntervalLayout<T> = {
2
+ item: T;
3
+ lane: number;
4
+ lanes: number;
5
+ groupId: number;
6
+ groupStart: number;
7
+ groupEnd: number;
8
+ };
9
+ /**
10
+ * Assigns the lowest available visual lane to overlapping intervals.
11
+ * Sorting plus two binary heaps keeps large overlap groups at O(n log n).
12
+ */
13
+ export declare const layoutCalendarIntervals: <T>(items: readonly T[], bounds: (item: T) => {
14
+ start: number;
15
+ end: number;
16
+ }) => CalendarIntervalLayout<T>[];
@@ -0,0 +1,22 @@
1
+ export declare const CALENDAR_SNAP_MINUTES = 15;
2
+ export declare const snapCalendarMinutes: (minutes: number, step?: number) => number;
3
+ export declare const calendarDayIndexAtPoint: (clientX: number, startX: number, width: number, days: number) => number | null;
4
+ export declare const calendarMinuteAtPoint: (clientY: number, top: number, height: number, startHour: number, endHour: number) => number;
5
+ export declare const calendarAutoScrollSpeed: (clientY: number, top: number, bottom: number, edge?: number, maximum?: number) => number;
6
+ type CalendarPointerSessionOptions<T> = {
7
+ event: PointerEvent;
8
+ resolve: (clientX: number, clientY: number) => T | null;
9
+ onActivate?: () => void;
10
+ onPreview: (value: T) => void;
11
+ onCommit: (value: T) => void;
12
+ onCancel?: () => void;
13
+ scrollContainer?: HTMLElement;
14
+ threshold?: number;
15
+ };
16
+ /**
17
+ * Owns one pointer gesture from threshold crossing through commit or cancel.
18
+ * Views provide geometry through `resolve`; this helper owns global cleanup,
19
+ * pointer cancellation, Escape handling, and edge auto-scroll.
20
+ */
21
+ export declare const startCalendarPointerSession: <T>(options: CalendarPointerSessionOptions<T>) => (() => void);
22
+ export {};
@@ -0,0 +1,5 @@
1
+ import type { MapViewport } from "@k2b/stdlib";
2
+ export declare const DEFAULT_MAP_VIEWPORT: MapViewport;
3
+ export declare const normalizeMapViewport: (viewport: MapViewport | undefined) => MapViewport;
4
+ export declare const zoomMapViewport: (viewport: MapViewport, delta: number) => MapViewport;
5
+ export declare const panMapViewport: (viewport: MapViewport, deltaX: number, deltaY: number, width: number, height: number) => MapViewport;
@@ -0,0 +1,42 @@
1
+ export type StateTimelineDomain = readonly [number, number];
2
+ export type StateTimelineInterval = {
3
+ from: number;
4
+ to: number;
5
+ state: string;
6
+ label?: string;
7
+ href?: string;
8
+ tooltip?: string;
9
+ };
10
+ export type StateTimelineRow = {
11
+ label: string;
12
+ href?: string;
13
+ tooltip?: string;
14
+ intervals: StateTimelineInterval[];
15
+ };
16
+ export type StateTimelineState = {
17
+ state: string;
18
+ label?: string;
19
+ color?: string;
20
+ };
21
+ export type StateTimelineChartOptions = {
22
+ rows: StateTimelineRow[];
23
+ states?: StateTimelineState[];
24
+ domain?: StateTimelineDomain;
25
+ xAxis?: {
26
+ format?: (value: number) => string;
27
+ label?: string;
28
+ };
29
+ legend?: boolean;
30
+ interactive?: boolean;
31
+ };
32
+ export declare const stateTimelineDomain: (rows: readonly StateTimelineRow[], domain?: StateTimelineDomain) => StateTimelineDomain;
33
+ export declare const normalizeStateTimelineViewport: (viewport: StateTimelineDomain | undefined, fullDomain: StateTimelineDomain) => StateTimelineDomain;
34
+ export declare const zoomStateTimelineViewport: (viewport: StateTimelineDomain, fullDomain: StateTimelineDomain, delta: number, anchor?: number) => StateTimelineDomain;
35
+ export declare const panStateTimelineViewport: (viewport: StateTimelineDomain, fullDomain: StateTimelineDomain, pixelDelta: number, plotWidth: number) => StateTimelineDomain;
36
+ export declare const stateTimelineHeight: (rows: number, legend?: boolean) => number;
37
+ export declare const renderStateTimelineSvg: (opts: StateTimelineChartOptions & {
38
+ width: number;
39
+ height: number;
40
+ viewport?: StateTimelineDomain;
41
+ className?: string;
42
+ }) => string;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Small safe highlighters for CodeDisplay.
3
+ *
4
+ * These are display-only highlighters: no AST, no runtime parser, no
5
+ * dependency. Every input character is HTML-escaped before being wrapped
6
+ * in token spans, so the returned strings are safe to inject with
7
+ * `innerHTML`.
8
+ */
9
+ export type CodeDisplayLanguage = "ts" | "tsx" | "js" | "jsx" | "script" | "markdown" | "md" | "text";
10
+ export declare const escapeCodeHtml: (s: string) => string;
11
+ export declare const highlightCode: (code: string) => string;
12
+ export declare const highlightMarkdownDisplay: (code: string) => string;
13
+ export declare const highlightCodeDisplayLines: (code: string, language?: CodeDisplayLanguage) => string[];
14
+ export declare const highlightCodeDisplay: (code: string, language?: CodeDisplayLanguage) => string;
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Tree shaping for FileTree — flat paths in, sorted nodes out.
3
+ *
4
+ * Kept beside the component rather than inside it because it is pure: no JSX,
5
+ * no reactivity, nothing that needs a DOM. That is also what makes it testable
6
+ * — a test importing the .tsx pulls the whole component through Bun's JSX
7
+ * transform, which resolves against the root tsconfig and lands on the React
8
+ * runtime. Same reason `file-view-preview.ts` sits next to FileView.
9
+ */
10
+ export type FileTreeEntry = {
11
+ /** Canonical identity, e.g. "/input/report.csv". */
12
+ path: string;
13
+ /** Folders are usually implicit from paths — explicit entries model empty dirs. */
14
+ kind?: "file" | "folder";
15
+ size?: number;
16
+ mediaType?: string;
17
+ updatedAt?: string;
18
+ /** Icon override (tabler class without "ti " prefix); default derives from the name. */
19
+ icon?: string;
20
+ /** Small trailing badge, e.g. "ro" on read-only mounts. */
21
+ badge?: string;
22
+ };
23
+ export type TreeNode = {
24
+ entry: FileTreeEntry;
25
+ name: string;
26
+ depth: number;
27
+ isFolder: boolean;
28
+ children: TreeNode[];
29
+ };
30
+ /** Containing directory of a path; "/" for top-level entries. */
31
+ export declare const parentOf: (path: string) => string;
32
+ /**
33
+ * Flat paths → sorted tree (folders first, then files, both alphabetical).
34
+ *
35
+ * Passing the previous tree preserves object identity by path while updating
36
+ * the cached node in place. Solid's keyed `<For>` can then keep rows, rename
37
+ * inputs, and focus alive even when a refetch changes metadata.
38
+ */
39
+ export declare const buildTree: (entries: FileTreeEntry[], previous?: TreeNode[]) => TreeNode[];
40
+ export declare const flattenVisible: (nodes: TreeNode[], expanded: Set<string>) => TreeNode[];
41
+ export declare const allFolderPaths: (nodes: TreeNode[]) => string[];
@@ -0,0 +1,22 @@
1
+ export type FileViewFile = {
2
+ path: string;
3
+ mediaType?: string;
4
+ size?: number;
5
+ };
6
+ export type FileViewPreviewKind = "markdown" | "image" | "pdf" | "json" | "delimited-text" | "audio" | "video" | "text";
7
+ export declare const fileViewExtension: (path: string) => string;
8
+ /**
9
+ * Returns the built-in preview kind when FileView can render the file within
10
+ * its bounded client-side limits. Custom renderers remain registry-driven.
11
+ */
12
+ export declare const getFileViewPreviewKind: (file: FileViewFile) => FileViewPreviewKind | null;
13
+ /** Use this to expose preview actions only for files FileView can render. */
14
+ export declare const canPreviewFile: (file: FileViewFile) => boolean;
15
+ export type DelimitedTextPreview = {
16
+ rows: string[][];
17
+ truncated: boolean;
18
+ };
19
+ export declare const parseDelimitedText: (input: string, delimiter: "," | "\t", limits?: {
20
+ rows?: number;
21
+ columns?: number;
22
+ }) => DelimitedTextPreview;
@@ -0,0 +1,26 @@
1
+ export type { CalendarAttendee, CalendarDayBadge, CalendarEvent, CalendarEventColor, CalendarEventRenderContext, CalendarEventTimeChange, CalendarLabels, CalendarProps, CalendarRecurrence, CalendarResource, CalendarView, } from "./Calendar";
2
+ export { default as Calendar } from "./Calendar";
3
+ export type { ChartKind, ChartLabels, ChartProps } from "./Chart";
4
+ export { default as Chart } from "./Chart";
5
+ export type { CodeDisplayLanguage, CodeDisplayProps } from "./CodeDisplay";
6
+ export { default as CodeDisplay } from "./CodeDisplay";
7
+ export type { StateTimelineChartOptions, StateTimelineDomain, StateTimelineInterval, StateTimelineRow, StateTimelineState, } from "./chart-state-timeline";
8
+ export type { DataTableColumn, DataTableControlsProps, DataTableFooter, DataTableHeaderProps, DataTablePanelFooterProps, DataTablePanelProps, DataTableProps, DataTableRenderCell, DataTableRenderHeader, DataTableSort, } from "./DataTable";
9
+ export { default as DataTable } from "./DataTable";
10
+ export type { DocCodeHighlighter, DocCodeProps, DocConcept, DocNoteVariant, DocRow } from "./Docs";
11
+ export { DocCode, DocConceptGrid, DocInlineCode, DocLead, DocNote, DocPage, DocRows, DocSection } from "./Docs";
12
+ export { FileBrowserPanel, type FileBrowserPanelProps, type FileSource, openFileBrowser } from "./FileBrowser";
13
+ export { default as FileTree, type FileTreeActions, type FileTreeEntry, type FileTreeProps } from "./FileTree";
14
+ export { canPreviewFile, default as FileView, type FileViewContent, type FileViewFile, type FileViewPreviewKind, type FileViewProps, type FileViewRenderer, type FileViewRendererProps, formatFileViewSize, getFileViewPreviewKind, } from "./FileView";
15
+ export type { LightboxImage } from "./Lightbox";
16
+ export { default as Lightbox } from "./Lightbox";
17
+ export type { LogTableEntry } from "./LogEntriesTable";
18
+ export { default as LogEntriesTable } from "./LogEntriesTable";
19
+ export { default as MarkdownView, renderSafeMarkdown, type MarkdownRenderOptions, type MarkdownViewProps } from "./MarkdownView";
20
+ export { Pagination, type PaginationProps } from "./Pagination";
21
+ export type { PdfPreviewProps, PdfPreviewRequest } from "./PdfPreview";
22
+ export { default as PdfPreview } from "./PdfPreview";
23
+ export type { RangeOption, RangePickerProps } from "./RangePicker";
24
+ export { default as RangePicker } from "./RangePicker";
25
+ export type { StructuredDataPreviewMode, StructuredDataPreviewProps, StructuredDataValue } from "./StructuredDataPreview";
26
+ export { default as StructuredDataPreview, isStructuredDataValue } from "./StructuredDataPreview";
@@ -0,0 +1,10 @@
1
+ import { type JSX } from "solid-js";
2
+ import type { IntentTone } from "../semantics";
3
+ export type InlineGuidanceProps = Omit<JSX.HTMLAttributes<HTMLDivElement>, "children" | "class"> & {
4
+ children: JSX.Element;
5
+ tone?: IntentTone;
6
+ icon?: string | false;
7
+ class?: string;
8
+ };
9
+ export declare function InlineGuidance(props: InlineGuidanceProps): JSX.Element;
10
+ export default InlineGuidance;
@@ -0,0 +1,18 @@
1
+ import { type JSX } from "solid-js";
2
+ import { type TooltipPlacement } from "./tooltip-position";
3
+ export type TooltipProps = {
4
+ content: JSX.Element;
5
+ target: () => HTMLElement | undefined;
6
+ placement?: TooltipPlacement;
7
+ delay?: number;
8
+ disabled?: boolean;
9
+ };
10
+ export type TooltipAnchorProps = Omit<JSX.HTMLAttributes<HTMLSpanElement>, "content"> & Omit<TooltipProps, "target">;
11
+ export type TooltipTriggerProps = Omit<JSX.ButtonHTMLAttributes<HTMLButtonElement>, "content"> & Omit<TooltipProps, "target">;
12
+ type TooltipComponent = ((props: TooltipProps) => JSX.Element) & {
13
+ Anchor: (props: TooltipAnchorProps) => JSX.Element;
14
+ Trigger: (props: TooltipTriggerProps) => JSX.Element;
15
+ };
16
+ export declare const Tooltip: TooltipComponent;
17
+ export type { TooltipPlacement } from "./tooltip-position";
18
+ export default Tooltip;
@@ -0,0 +1,19 @@
1
+ import type { JSX } from "solid-js";
2
+ export type DialogClose<T> = (result?: T) => void;
3
+ export type OpenDialogOptions = {
4
+ panelClassName?: string;
5
+ contentClassName?: string;
6
+ initialFocus?: "first-input" | "none" | ((dialog: HTMLDialogElement) => HTMLElement | null);
7
+ cancelBehavior?: "resolve-undefined" | "ignore";
8
+ ariaLabel?: string;
9
+ };
10
+ export type DialogRender<T> = (close: DialogClose<T>, context: {
11
+ dialog: HTMLDialogElement;
12
+ }) => JSX.Element;
13
+ export type DialogCore = {
14
+ open: <T>(view: DialogRender<T>, options?: OpenDialogOptions) => Promise<T | undefined>;
15
+ close: (result?: unknown) => void;
16
+ isOpen: () => boolean;
17
+ };
18
+ export declare const createDialogCore: () => DialogCore;
19
+ export declare const dialogCore: DialogCore;
@@ -0,0 +1,10 @@
1
+ export type { DialogClose, DialogCore, DialogRender, OpenDialogOptions } from "./dialog-core";
2
+ export { dialogCore } from "./dialog-core";
3
+ export type { InlineGuidanceProps } from "./InlineGuidance";
4
+ export { default as InlineGuidance } from "./InlineGuidance";
5
+ export type { ConfirmOptions, DialogOptions, FieldSchema, PromptFieldBase, PromptSearchInput, PromptSearchItem, PromptSearchOptions, } from "./prompts";
6
+ export { createFormState, DialogHeader, prompts } from "./prompts";
7
+ export type { TooltipAnchorProps, TooltipPlacement, TooltipProps, TooltipTriggerProps } from "./Tooltip";
8
+ export { Tooltip } from "./Tooltip";
9
+ export type { ToastAction, ToastFn, ToastHandle, ToastOptions, ToastVariant } from "./toast";
10
+ export { isPointInsideToast, toast } from "./toast";
@@ -0,0 +1,164 @@
1
+ import { type JSX } from "solid-js";
2
+ import { type OpenDialogOptions } from "./dialog-core";
3
+ export interface DialogOptions {
4
+ title?: string;
5
+ ariaLabel?: string;
6
+ icon?: string;
7
+ confirmText?: string;
8
+ cancelText?: string | false;
9
+ variant?: "danger" | "primary" | "success";
10
+ size?: "small" | "medium" | "large" | "wide";
11
+ surface?: "default" | "bare";
12
+ header?: false;
13
+ cancelBehavior?: OpenDialogOptions["cancelBehavior"];
14
+ }
15
+ export interface ConfirmOptions extends DialogOptions {
16
+ confirmationPhrase?: string;
17
+ }
18
+ type PromptContent = string | HTMLElement | JSX.Element;
19
+ export type PromptSearchItem<T = unknown> = {
20
+ label: string;
21
+ desc?: string;
22
+ icon?: string;
23
+ previewUrl?: string;
24
+ value?: T;
25
+ };
26
+ export type PromptSearchInput = {
27
+ query: string;
28
+ abortSignal: AbortSignal;
29
+ };
30
+ export type PromptSearchOptions = DialogOptions & {
31
+ placeholder?: string;
32
+ icon?: string;
33
+ initialQuery?: string;
34
+ minQueryLength?: number;
35
+ debounceMs?: number;
36
+ emptyText?: string;
37
+ noResultsText?: string;
38
+ };
39
+ export type PromptFieldBase<T = any> = {
40
+ label?: string | false;
41
+ description?: string;
42
+ placeholder?: string;
43
+ required?: boolean;
44
+ default?: T;
45
+ validate?: (value: T | undefined) => string | null;
46
+ };
47
+ export type FieldSchema = (PromptFieldBase<string> & {
48
+ type: "text";
49
+ multiline?: boolean;
50
+ lines?: number;
51
+ maxLength?: number;
52
+ minLength?: number;
53
+ icon?: string;
54
+ activeIcon?: string;
55
+ password?: boolean;
56
+ markdown?: boolean;
57
+ }) | (PromptFieldBase<number> & {
58
+ type: "number";
59
+ min?: number;
60
+ max?: number;
61
+ step?: number;
62
+ }) | (PromptFieldBase<string> & {
63
+ type: "image";
64
+ round?: boolean;
65
+ ariaLabel?: string;
66
+ accept?: string;
67
+ }) | (PromptFieldBase<string> & {
68
+ type: "pin";
69
+ length?: number;
70
+ stretch?: boolean;
71
+ }) | (PromptFieldBase<string> & {
72
+ type: "select";
73
+ options: string[] | {
74
+ id: string;
75
+ label?: string;
76
+ description?: string;
77
+ icon?: string;
78
+ }[];
79
+ icon?: string;
80
+ activeIcon?: string;
81
+ clearable?: boolean;
82
+ }) | (PromptFieldBase<string[]> & {
83
+ type: "tags";
84
+ maxTags?: number;
85
+ minTags?: number;
86
+ icon?: string;
87
+ activeIcon?: string;
88
+ }) | (PromptFieldBase<boolean> & {
89
+ type: "boolean";
90
+ }) | (PromptFieldBase<string> & {
91
+ type: "datetime";
92
+ dateOnly?: boolean;
93
+ }) | {
94
+ type: "info";
95
+ content: string | JSX.Element | (() => JSX.Element);
96
+ };
97
+ type InferFieldType<T extends FieldSchema> = T extends {
98
+ type: "text";
99
+ } ? string : T extends {
100
+ type: "number";
101
+ } ? number : T extends {
102
+ type: "image";
103
+ } ? string : T extends {
104
+ type: "pin";
105
+ } ? string : T extends {
106
+ type: "select";
107
+ } ? string : T extends {
108
+ type: "tags";
109
+ } ? string[] : T extends {
110
+ type: "boolean";
111
+ } ? boolean : T extends {
112
+ type: "datetime";
113
+ } ? string : T extends {
114
+ type: "currency";
115
+ } ? number : T extends {
116
+ type: "info";
117
+ } ? never : never;
118
+ type InferFormValues<T extends Record<string, FieldSchema>> = {
119
+ [K in keyof T as T[K] extends {
120
+ type: "info";
121
+ } ? never : K]: T[K] extends {
122
+ required: true;
123
+ } ? InferFieldType<T[K]> : InferFieldType<T[K]> | undefined;
124
+ };
125
+ type PromptFormValue = string | number | boolean | string[] | undefined;
126
+ type PromptFormOptions<T extends Record<string, FieldSchema>> = {
127
+ title?: string;
128
+ ariaLabel?: string;
129
+ icon?: string;
130
+ fields: T;
131
+ confirmText?: string;
132
+ cancelText?: string | false;
133
+ variant?: "danger" | "primary" | "success";
134
+ size?: DialogOptions["size"];
135
+ cancelBehavior?: DialogOptions["cancelBehavior"];
136
+ };
137
+ export declare const createFormState: <T extends Record<string, FieldSchema>>(schema: T) => {
138
+ values: Record<string, PromptFormValue>;
139
+ errors: Record<string, string | undefined>;
140
+ updateField: (key: string, value: PromptFormValue) => void;
141
+ validateAll: () => boolean;
142
+ reset: () => void;
143
+ };
144
+ export declare const DialogHeader: (props: {
145
+ close: () => void;
146
+ title?: string;
147
+ icon?: string;
148
+ }) => JSX.Element;
149
+ type CloudSearchResolver<T> = (input: PromptSearchInput) => Promise<PromptSearchItem<T>[]> | PromptSearchItem<T>[];
150
+ export declare const prompts: {
151
+ alert: (content: PromptContent, options?: DialogOptions) => Promise<void | undefined>;
152
+ success: (content: PromptContent, options?: Omit<DialogOptions, "variant">) => Promise<void | undefined>;
153
+ confirm: (content: PromptContent, options?: ConfirmOptions) => Promise<boolean | undefined>;
154
+ prompt: (content: string, defaultValue?: string, options?: DialogOptions) => Promise<string | null>;
155
+ promptNumber: (content: string, defaultValue?: number, options?: DialogOptions & {
156
+ min?: number;
157
+ max?: number;
158
+ }) => Promise<number | null>;
159
+ form: <T extends Record<string, FieldSchema>>(config: PromptFormOptions<T>) => Promise<InferFormValues<T> | null>;
160
+ dialog: <T = unknown>(component: (close: (result?: T) => void) => JSX.Element, options?: DialogOptions) => Promise<T | undefined>;
161
+ search: <T = unknown>(resolver: CloudSearchResolver<T>, options?: PromptSearchOptions) => Promise<PromptSearchItem<T> | undefined>;
162
+ error: (content: string | HTMLElement, options?: DialogOptions) => Promise<unknown>;
163
+ };
164
+ export {};
@@ -0,0 +1,25 @@
1
+ export type ToastVariant = "default" | "success" | "error";
2
+ export type ToastAction = {
3
+ label: string;
4
+ href: string;
5
+ };
6
+ export type ToastOptions = {
7
+ variant?: ToastVariant;
8
+ duration?: number;
9
+ iconClass?: string;
10
+ title?: string;
11
+ action?: ToastAction | null;
12
+ };
13
+ export type ToastHandle = {
14
+ dismiss: () => void;
15
+ update: (description: string, options?: ToastOptions) => void;
16
+ };
17
+ export interface ToastFn {
18
+ (description: string, options?: ToastOptions): ToastHandle;
19
+ success: (description: string, options?: Omit<ToastOptions, "variant">) => ToastHandle;
20
+ error: (description: string, options?: Omit<ToastOptions, "variant">) => ToastHandle;
21
+ dismissAll: () => void;
22
+ }
23
+ export declare const K2B_TOAST_CONTAINER_ID = "k2b-ui-toast-container";
24
+ export declare const isPointInsideToast: (x: number, y: number) => boolean;
25
+ export declare const toast: ToastFn;
@@ -0,0 +1,2 @@
1
+ export type TooltipPlacement = "top" | "bottom";
2
+ export declare const positionTooltipSurface: (tooltip: HTMLElement, target: HTMLElement, placement?: TooltipPlacement) => void;
@@ -0,0 +1,10 @@
1
+ export * from "./actions";
2
+ export * from "./chat";
3
+ export * from "./content";
4
+ export * from "./feedback";
5
+ export * from "./inputs";
6
+ export * from "./intl";
7
+ export * from "./layout";
8
+ export type { AccentColor, IntentTone } from "./semantics";
9
+ export * from "./surfaces";
10
+ export * from "./widgets";
@@ -0,0 +1,21 @@
1
+ import { type JSX } from "solid-js";
2
+ import { type Completion } from "./completion";
3
+ import type { ValueFieldProps } from "./field-contract";
4
+ export type AutocompleteEditorProps = ValueFieldProps<string> & {
5
+ onSubmit?: () => void;
6
+ completions?: readonly Completion[];
7
+ restoreExpansionOnBackspace?: boolean;
8
+ highlight?: (text: string) => string;
9
+ singleLine?: boolean;
10
+ lines?: number;
11
+ fill?: boolean;
12
+ placeholder?: string;
13
+ spellcheck?: boolean;
14
+ name?: string;
15
+ maxLength?: number;
16
+ textareaRef?: (element: HTMLTextAreaElement) => void;
17
+ variant?: "default" | "paper";
18
+ };
19
+ export declare function AutocompleteEditor(props: AutocompleteEditorProps): JSX.Element;
20
+ export type { Completion, SuggestContext, Suggestion } from "./completion";
21
+ export { abbreviations } from "./completion";
@@ -0,0 +1,30 @@
1
+ import { type JSX } from "solid-js";
2
+ import { type ChoiceOption } from "./choice";
3
+ import type { ValueFieldProps } from "./field-contract";
4
+ import type { SelectGroup } from "./Select";
5
+ export type AutocompleteSelectOption = ChoiceOption<string>;
6
+ export type AutocompleteSelectSearchResult = {
7
+ /** Ranked suggestions shown in the popup. */
8
+ options: readonly AutocompleteSelectOption[];
9
+ /** The authoritative option that Tab or blur may accept automatically. */
10
+ match?: AutocompleteSelectOption;
11
+ };
12
+ export type AutocompleteSelectProps = ValueFieldProps<string | null> & {
13
+ search: (query: string, signal: AbortSignal, group: string | null) => Promise<AutocompleteSelectSearchResult>;
14
+ selectedOption?: AutocompleteSelectOption;
15
+ formatValue?: (option: AutocompleteSelectOption) => string;
16
+ groups?: readonly SelectGroup[];
17
+ defaultGroup?: string;
18
+ groupsAriaLabel?: string;
19
+ allGroupLabel?: string;
20
+ placeholder?: string;
21
+ debounceMs?: number;
22
+ clearable?: boolean;
23
+ name?: string;
24
+ autofocus?: boolean;
25
+ noMatchText?: string;
26
+ checkingText?: string;
27
+ noOptionsText?: string;
28
+ };
29
+ export declare function AutocompleteSelect(props: AutocompleteSelectProps): JSX.Element;
30
+ export default AutocompleteSelect;
@@ -0,0 +1,9 @@
1
+ import { type JSX } from "solid-js";
2
+ import type { ValueFieldProps } from "./field-contract";
3
+ export type CheckboxProps = ValueFieldProps<boolean> & {
4
+ /** Visual and accessible mixed state for partial bulk selections. */
5
+ indeterminate?: boolean;
6
+ name?: string;
7
+ };
8
+ export declare function Checkbox(props: CheckboxProps): JSX.Element;
9
+ export default Checkbox;
@@ -0,0 +1,9 @@
1
+ import { type JSX } from "solid-js";
2
+ import type { ValueFieldProps } from "./field-contract";
3
+ export type CheckboxCardProps = Omit<JSX.InputHTMLAttributes<HTMLInputElement>, "checked" | "onChange" | "type" | "value" | keyof ValueFieldProps<boolean>> & ValueFieldProps<boolean> & {
4
+ icon?: string;
5
+ color?: string;
6
+ variant?: "card" | "input";
7
+ };
8
+ export declare function CheckboxCard(props: CheckboxCardProps): JSX.Element;
9
+ export default CheckboxCard;
@@ -0,0 +1,13 @@
1
+ import { type JSX } from "solid-js";
2
+ type ChoiceGroup = {
3
+ value: string | null;
4
+ label: string;
5
+ };
6
+ export declare function ChoiceGroups(props: {
7
+ choices: readonly ChoiceGroup[];
8
+ value: string | null;
9
+ onValueChange: (value: string | null) => void;
10
+ ariaLabel: string;
11
+ controls: string;
12
+ }): JSX.Element;
13
+ export {};
@@ -0,0 +1,24 @@
1
+ import { type JSX } from "solid-js";
2
+ import type { FieldProps, MaybeAccessor, ValueFieldProps } from "./field-contract";
3
+ export type PinInputProps = ValueFieldProps<string> & {
4
+ length?: number;
5
+ name?: string;
6
+ stretch?: boolean;
7
+ };
8
+ export declare function PinInput(props: PinInputProps): JSX.Element;
9
+ export type SliderProps = FieldProps & Omit<JSX.InputHTMLAttributes<HTMLInputElement>, "type" | "value" | "onInput" | "onChange" | keyof FieldProps> & ValueFieldProps<number> & {
10
+ value: MaybeAccessor<number>;
11
+ formatValue?: (value: number) => string;
12
+ showValue?: boolean;
13
+ center?: boolean;
14
+ defaultValue?: number;
15
+ };
16
+ export declare function Slider(props: SliderProps): JSX.Element;
17
+ export type ColorInputProps = ValueFieldProps<string> & {
18
+ name?: string;
19
+ compact?: boolean;
20
+ transparent?: boolean;
21
+ transparentValue?: MaybeAccessor<boolean>;
22
+ onTransparentValueChange?: (value: boolean) => void;
23
+ };
24
+ export declare function ColorInput(props: ColorInputProps): JSX.Element;
@@ -0,0 +1,18 @@
1
+ import { type JSX } from "solid-js";
2
+ import type { FieldProps, MaybeAccessor } from "./field-contract";
3
+ export type ComboboxOption = {
4
+ id: string;
5
+ label: string;
6
+ description?: string;
7
+ icon?: string;
8
+ };
9
+ export type ComboboxProps = FieldProps & {
10
+ query?: MaybeAccessor<string>;
11
+ onQueryChange?: (query: string) => void;
12
+ placeholder?: string;
13
+ fetchData: (query: string, signal: AbortSignal) => Promise<ComboboxOption[]>;
14
+ onSelect: (option: ComboboxOption) => void;
15
+ debounceMs?: number;
16
+ };
17
+ export declare function Combobox(props: ComboboxProps): JSX.Element;
18
+ export default Combobox;
@@ -0,0 +1,31 @@
1
+ import { type DateContext } from "@k2b/stdlib";
2
+ import { type JSX } from "solid-js";
3
+ import { type DateRangeValue } from "./date-picker";
4
+ import type { MaybeAccessor, ValueFieldProps } from "./field-contract";
5
+ export type { DateRangeValue } from "./date-picker";
6
+ export type DatePreset<T> = {
7
+ label: string;
8
+ value: T;
9
+ };
10
+ export type DurationPreset = {
11
+ label: string;
12
+ minutes: number;
13
+ };
14
+ export type DatePickerBaseProps<T> = Omit<ValueFieldProps<T>, "value"> & {
15
+ placeholder?: string;
16
+ value: MaybeAccessor<T>;
17
+ presets?: readonly DatePreset<T>[];
18
+ dateConfig?: DateContext;
19
+ clearable?: boolean;
20
+ };
21
+ export type DatePickerProps = DatePickerBaseProps<string | null>;
22
+ export type DateTimePickerProps = DatePickerBaseProps<string | null>;
23
+ export type DateRangePickerProps = DatePickerBaseProps<DateRangeValue> & {
24
+ withTime?: boolean;
25
+ datePresets?: readonly DatePreset<string | null>[];
26
+ durationPresets?: readonly DurationPreset[];
27
+ };
28
+ export declare const placeDatePopover: (trigger: HTMLElement, popover: HTMLElement, wide: boolean) => void;
29
+ export declare function DatePicker(props: DatePickerProps): JSX.Element;
30
+ export declare function DateTimePicker(props: DateTimePickerProps): JSX.Element;
31
+ export declare function DateRangePicker(props: DateRangePickerProps): JSX.Element;