@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.
- package/dist/types/actions/Button.d.ts +38 -0
- package/dist/types/actions/ContextMenu.d.ts +17 -0
- package/dist/types/actions/CopyButton.d.ts +20 -0
- package/dist/types/actions/Disclosure.d.ts +15 -0
- package/dist/types/actions/Dropdown.d.ts +100 -0
- package/dist/types/actions/FilterChip.d.ts +27 -0
- package/dist/types/actions/RemoveButton.d.ts +7 -0
- package/dist/types/actions/SegmentedControl.d.ts +20 -0
- package/dist/types/actions/SplitButton.d.ts +13 -0
- package/dist/types/actions/SpotlightSearch.d.ts +25 -0
- package/dist/types/actions/Tabs.d.ts +27 -0
- package/dist/types/actions/Toolbar.d.ts +23 -0
- package/dist/types/actions/index.d.ts +24 -0
- package/dist/types/chat/ChatComposer.d.ts +57 -0
- package/dist/types/chat/ChatPrimitives.d.ts +48 -0
- package/dist/types/chat/ChatRoot.d.ts +7 -0
- package/dist/types/chat/ChatTimeline.d.ts +52 -0
- package/dist/types/chat/chat-behavior.d.ts +29 -0
- package/dist/types/chat/index.d.ts +21 -0
- package/dist/types/chat/types.d.ts +62 -0
- package/dist/types/content/Calendar.d.ts +115 -0
- package/dist/types/content/Chart.d.ts +90 -0
- package/dist/types/content/CodeDisplay.d.ts +11 -0
- package/dist/types/content/DataTable.d.ts +113 -0
- package/dist/types/content/Docs.d.ts +52 -0
- package/dist/types/content/FileBrowser.d.ts +40 -0
- package/dist/types/content/FileTree.d.ts +29 -0
- package/dist/types/content/FileView.d.ts +59 -0
- package/dist/types/content/Lightbox.d.ts +16 -0
- package/dist/types/content/LogEntriesTable.d.ts +14 -0
- package/dist/types/content/MarkdownView.d.ts +46 -0
- package/dist/types/content/Pagination.d.ts +10 -0
- package/dist/types/content/PdfPreview.d.ts +11 -0
- package/dist/types/content/RangePicker.d.ts +29 -0
- package/dist/types/content/StructuredDataPreview.d.ts +20 -0
- package/dist/types/content/calendar-event-layout.d.ts +16 -0
- package/dist/types/content/calendar-pointer.d.ts +22 -0
- package/dist/types/content/chart-map-viewport.d.ts +5 -0
- package/dist/types/content/chart-state-timeline.d.ts +42 -0
- package/dist/types/content/code-highlight.d.ts +14 -0
- package/dist/types/content/file-tree.d.ts +41 -0
- package/dist/types/content/file-view-preview.d.ts +22 -0
- package/dist/types/content/index.d.ts +26 -0
- package/dist/types/feedback/InlineGuidance.d.ts +10 -0
- package/dist/types/feedback/Tooltip.d.ts +18 -0
- package/dist/types/feedback/dialog-core.d.ts +19 -0
- package/dist/types/feedback/index.d.ts +10 -0
- package/dist/types/feedback/prompts.d.ts +164 -0
- package/dist/types/feedback/toast.d.ts +25 -0
- package/dist/types/feedback/tooltip-position.d.ts +2 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/inputs/AutocompleteEditor.d.ts +21 -0
- package/dist/types/inputs/AutocompleteSelect.d.ts +30 -0
- package/dist/types/inputs/Checkbox.d.ts +9 -0
- package/dist/types/inputs/CheckboxCard.d.ts +9 -0
- package/dist/types/inputs/ChoiceGroups.d.ts +13 -0
- package/dist/types/inputs/ChoiceInputs.d.ts +24 -0
- package/dist/types/inputs/Combobox.d.ts +18 -0
- package/dist/types/inputs/DatePicker.d.ts +31 -0
- package/dist/types/inputs/FileInputs.d.ts +31 -0
- package/dist/types/inputs/MultiSelectInput.d.ts +41 -0
- package/dist/types/inputs/NumberInput.d.ts +24 -0
- package/dist/types/inputs/Select.d.ts +50 -0
- package/dist/types/inputs/SelectChip.d.ts +25 -0
- package/dist/types/inputs/SpecialInputs.d.ts +21 -0
- package/dist/types/inputs/Switch.d.ts +7 -0
- package/dist/types/inputs/TagEditor.d.ts +35 -0
- package/dist/types/inputs/TagsInput.d.ts +11 -0
- package/dist/types/inputs/TemplateEditor.d.ts +28 -0
- package/dist/types/inputs/TextInput.d.ts +26 -0
- package/dist/types/inputs/choice.d.ts +32 -0
- package/dist/types/inputs/completion/behaviors.d.ts +13 -0
- package/dist/types/inputs/completion/engine.d.ts +54 -0
- package/dist/types/inputs/completion/index.d.ts +3 -0
- package/dist/types/inputs/completion/overlay.d.ts +11 -0
- package/dist/types/inputs/date-picker.d.ts +42 -0
- package/dist/types/inputs/editor-dom.d.ts +6 -0
- package/dist/types/inputs/field-contract.d.ts +24 -0
- package/dist/types/inputs/icon-options.d.ts +37 -0
- package/dist/types/inputs/image-crop.d.ts +44 -0
- package/dist/types/inputs/index.d.ts +45 -0
- package/dist/types/inputs/markdown/MarkdownEditor.d.ts +25 -0
- package/dist/types/inputs/markdown/Toolbar.d.ts +9 -0
- package/dist/types/inputs/markdown/actions.d.ts +8 -0
- package/dist/types/inputs/markdown/active-formats.d.ts +1 -0
- package/dist/types/inputs/markdown/behaviors.d.ts +3 -0
- package/dist/types/inputs/markdown/code-zone.d.ts +1 -0
- package/dist/types/internal/color.d.ts +4 -0
- package/dist/types/internal/field.d.ts +27 -0
- package/dist/types/internal/portal.d.ts +1 -0
- package/dist/types/intl/Format.d.ts +84 -0
- package/dist/types/intl/index.d.ts +4 -0
- package/dist/types/intl/locale.d.ts +42 -0
- package/dist/types/intl/messages.d.ts +375 -0
- package/dist/types/layout/AppOverview.d.ts +29 -0
- package/dist/types/layout/AppWorkspace.d.ts +254 -0
- package/dist/types/layout/DataPanel.d.ts +16 -0
- package/dist/types/layout/DetailPanel.d.ts +89 -0
- package/dist/types/layout/Discussion.d.ts +52 -0
- package/dist/types/layout/FloatingWindow.d.ts +19 -0
- package/dist/types/layout/PanelDialog.d.ts +72 -0
- package/dist/types/layout/PanelHeader.d.ts +10 -0
- package/dist/types/layout/Panes.d.ts +48 -0
- package/dist/types/layout/ScrollArea.d.ts +8 -0
- package/dist/types/layout/Settings.d.ts +72 -0
- package/dist/types/layout/SettingsCollection.d.ts +41 -0
- package/dist/types/layout/SettingsModal.d.ts +39 -0
- package/dist/types/layout/app-workspace-controller.d.ts +7 -0
- package/dist/types/layout/app-workspace-state.d.ts +57 -0
- package/dist/types/layout/floating-window-geometry.d.ts +11 -0
- package/dist/types/layout/index.d.ts +32 -0
- package/dist/types/layout/panes-layout.d.ts +63 -0
- package/dist/types/layout/stable-id.d.ts +3 -0
- package/dist/types/semantics.d.ts +4 -0
- package/dist/types/surfaces/Avatar.d.ts +14 -0
- package/dist/types/surfaces/DescriptionList.d.ts +17 -0
- package/dist/types/surfaces/LinkCard.d.ts +11 -0
- package/dist/types/surfaces/NotFoundState.d.ts +15 -0
- package/dist/types/surfaces/NoticeCard.d.ts +39 -0
- package/dist/types/surfaces/Paper.d.ts +13 -0
- package/dist/types/surfaces/Placeholder.d.ts +17 -0
- package/dist/types/surfaces/ProgressBar.d.ts +13 -0
- package/dist/types/surfaces/StatCell.d.ts +22 -0
- package/dist/types/surfaces/StatGrid.d.ts +21 -0
- package/dist/types/surfaces/StatusBadge.d.ts +12 -0
- package/dist/types/surfaces/Tag.d.ts +16 -0
- package/dist/types/surfaces/index.d.ts +24 -0
- package/dist/types/widgets/Widget.d.ts +12 -0
- package/dist/types/widgets/WidgetHero.d.ts +11 -0
- package/dist/types/widgets/WidgetList.d.ts +17 -0
- package/dist/types/widgets/WidgetPills.d.ts +14 -0
- package/dist/types/widgets/WidgetStat.d.ts +17 -0
- package/dist/types/widgets/WidgetStatus.d.ts +12 -0
- package/dist/types/widgets/index.d.ts +6 -0
- package/package.json +1 -1
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type LinkNavigateEvent, type NavigationScrollMode } from "@k2b/ssr/nav";
|
|
2
|
+
import { type JSX } from "solid-js";
|
|
3
|
+
import { type TooltipPlacement } from "../feedback/Tooltip";
|
|
4
|
+
export type ButtonVariant = "primary" | "secondary" | "ghost" | "text" | "subtle" | "input" | "warning" | "danger" | "success" | "ai";
|
|
5
|
+
export type ButtonSize = "xs" | "sm" | "md" | "lg";
|
|
6
|
+
export type ButtonProps = JSX.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
7
|
+
loading?: boolean;
|
|
8
|
+
loadingLabel?: string;
|
|
9
|
+
size?: ButtonSize;
|
|
10
|
+
variant?: ButtonVariant;
|
|
11
|
+
tooltip?: JSX.Element | false;
|
|
12
|
+
tooltipDelay?: number;
|
|
13
|
+
tooltipPlacement?: TooltipPlacement;
|
|
14
|
+
};
|
|
15
|
+
export type ButtonLinkProps = Omit<JSX.AnchorHTMLAttributes<HTMLAnchorElement>, "onClick"> & {
|
|
16
|
+
navigation?: "document" | "enhanced";
|
|
17
|
+
onClick?: JSX.EventHandlerUnion<HTMLAnchorElement, MouseEvent>;
|
|
18
|
+
onNavigate?: (event: LinkNavigateEvent) => void | Promise<void>;
|
|
19
|
+
replace?: boolean;
|
|
20
|
+
scroll?: NavigationScrollMode;
|
|
21
|
+
size?: ButtonSize;
|
|
22
|
+
variant?: ButtonVariant;
|
|
23
|
+
tooltip?: JSX.Element | false;
|
|
24
|
+
tooltipDelay?: number;
|
|
25
|
+
tooltipPlacement?: TooltipPlacement;
|
|
26
|
+
};
|
|
27
|
+
export declare function Button(props: ButtonProps): JSX.Element;
|
|
28
|
+
export declare function ButtonLink(props: ButtonLinkProps): JSX.Element;
|
|
29
|
+
export type IconButtonProps = Omit<ButtonProps, "children"> & {
|
|
30
|
+
children: JSX.Element;
|
|
31
|
+
label: string;
|
|
32
|
+
};
|
|
33
|
+
export type IconButtonLinkProps = Omit<ButtonLinkProps, "children"> & {
|
|
34
|
+
children: JSX.Element;
|
|
35
|
+
label: string;
|
|
36
|
+
};
|
|
37
|
+
export declare function IconButton(props: IconButtonProps): JSX.Element;
|
|
38
|
+
export declare function IconButtonLink(props: IconButtonLinkProps): JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type JSX } from "solid-js";
|
|
2
|
+
import { type DropdownItem } from "./Dropdown";
|
|
3
|
+
export type ContextMenuProps = {
|
|
4
|
+
items: readonly DropdownItem[];
|
|
5
|
+
children: JSX.Element;
|
|
6
|
+
class?: string | ((isOpen: boolean) => string);
|
|
7
|
+
/** Tab order of the context-menu host. Descendant-focused composite widgets use -1. */
|
|
8
|
+
tabIndex?: number;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
onClose?: () => void;
|
|
11
|
+
onOpen?: () => void;
|
|
12
|
+
id?: string;
|
|
13
|
+
label?: string;
|
|
14
|
+
};
|
|
15
|
+
/** Right-click menu with keyboard invocation, one-open-at-a-time behavior, and viewport clamping. */
|
|
16
|
+
export declare function ContextMenu(props: ContextMenuProps): JSX.Element;
|
|
17
|
+
export default ContextMenu;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type JSX } from "solid-js";
|
|
2
|
+
import { type ButtonProps } from "./Button";
|
|
3
|
+
export type CopyButtonValue = {
|
|
4
|
+
text: string;
|
|
5
|
+
value?: string;
|
|
6
|
+
} | {
|
|
7
|
+
text?: string;
|
|
8
|
+
value: string;
|
|
9
|
+
};
|
|
10
|
+
export type CopyButtonProps = CopyButtonValue & Omit<ButtonProps, "children" | "onClick"> & {
|
|
11
|
+
label?: string;
|
|
12
|
+
copiedLabel?: string;
|
|
13
|
+
iconOnly?: boolean;
|
|
14
|
+
onCopied?: () => void;
|
|
15
|
+
onCopyError?: (error: unknown) => void;
|
|
16
|
+
resetAfter?: number;
|
|
17
|
+
};
|
|
18
|
+
export declare function copyText(text: string, onCopyError?: (error: unknown) => void, copy?: (text: string) => Promise<void>): Promise<void>;
|
|
19
|
+
export declare function CopyButton(props: CopyButtonProps): JSX.Element;
|
|
20
|
+
export default CopyButton;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type JSX } from "solid-js";
|
|
2
|
+
import type { MaybeAccessor } from "../inputs/field-contract";
|
|
3
|
+
export type DisclosureProps = {
|
|
4
|
+
summary: JSX.Element;
|
|
5
|
+
children: JSX.Element;
|
|
6
|
+
value?: MaybeAccessor<boolean>;
|
|
7
|
+
defaultValue?: boolean;
|
|
8
|
+
onValueChange?: (value: boolean) => void;
|
|
9
|
+
icon?: string;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
class?: string;
|
|
12
|
+
};
|
|
13
|
+
/** Native disclosure with the same value/onValueChange vocabulary as other controls. */
|
|
14
|
+
export declare function Disclosure(props: DisclosureProps): JSX.Element;
|
|
15
|
+
export default Disclosure;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { type JSX } from "solid-js";
|
|
2
|
+
import { type TooltipPlacement } from "../feedback/Tooltip";
|
|
3
|
+
import { type ButtonProps, type ButtonSize, type ButtonVariant } from "./Button";
|
|
4
|
+
export type DropdownPosition = "bottom-right" | "bottom-left" | "top-right" | "top-left" | "right-start";
|
|
5
|
+
export type DropdownActionBase = {
|
|
6
|
+
class?: string;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
icon?: string;
|
|
9
|
+
image?: string;
|
|
10
|
+
label: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
variant?: "danger";
|
|
13
|
+
};
|
|
14
|
+
export type DropdownAction = (DropdownActionBase & {
|
|
15
|
+
action: () => void;
|
|
16
|
+
href?: never;
|
|
17
|
+
external?: never;
|
|
18
|
+
}) | (DropdownActionBase & {
|
|
19
|
+
href: string;
|
|
20
|
+
external?: boolean;
|
|
21
|
+
action?: never;
|
|
22
|
+
}) | (DropdownActionBase & {
|
|
23
|
+
disabled: true;
|
|
24
|
+
action?: never;
|
|
25
|
+
href?: never;
|
|
26
|
+
external?: never;
|
|
27
|
+
});
|
|
28
|
+
/** Declarative radio or checkbox row for compact action menus. */
|
|
29
|
+
export type DropdownChoice = DropdownActionBase & {
|
|
30
|
+
action: () => void;
|
|
31
|
+
checked: boolean | (() => boolean);
|
|
32
|
+
choice: "checkbox" | "radio";
|
|
33
|
+
closeOnSelect?: boolean;
|
|
34
|
+
color?: string;
|
|
35
|
+
};
|
|
36
|
+
export type DropdownSection = {
|
|
37
|
+
sectionLabel?: string;
|
|
38
|
+
items: readonly (DropdownAction | DropdownChoice)[];
|
|
39
|
+
};
|
|
40
|
+
export type DropdownItem = DropdownAction | DropdownChoice | DropdownSection;
|
|
41
|
+
export type DropdownProps = {
|
|
42
|
+
items: readonly DropdownItem[];
|
|
43
|
+
children: JSX.Element;
|
|
44
|
+
position?: DropdownPosition | (() => DropdownPosition);
|
|
45
|
+
/** Menu width as a CSS length. Defaults to `12rem`. */
|
|
46
|
+
width?: string;
|
|
47
|
+
class?: string;
|
|
48
|
+
menuClass?: string;
|
|
49
|
+
onClose?: () => void;
|
|
50
|
+
open?: boolean;
|
|
51
|
+
onOpenChange?: (open: boolean) => void;
|
|
52
|
+
disabled?: boolean;
|
|
53
|
+
label?: string;
|
|
54
|
+
align?: "start" | "end";
|
|
55
|
+
};
|
|
56
|
+
export type DropdownTriggerProps = Omit<ButtonProps, "aria-controls" | "aria-expanded" | "aria-haspopup" | "children" | "disabled" | "onClick" | "onKeyDown"> & {
|
|
57
|
+
children: JSX.Element;
|
|
58
|
+
/** Use `plain` when a specialized component class owns the complete visual treatment. */
|
|
59
|
+
appearance?: "button" | "plain";
|
|
60
|
+
disabled?: boolean;
|
|
61
|
+
iconOnly?: boolean;
|
|
62
|
+
label?: string;
|
|
63
|
+
size?: ButtonSize;
|
|
64
|
+
tooltip?: JSX.Element | false;
|
|
65
|
+
tooltipDelay?: number;
|
|
66
|
+
tooltipPlacement?: TooltipPlacement;
|
|
67
|
+
variant?: ButtonVariant;
|
|
68
|
+
};
|
|
69
|
+
export type DropdownItemProps = {
|
|
70
|
+
children: JSX.Element;
|
|
71
|
+
icon?: string;
|
|
72
|
+
image?: string;
|
|
73
|
+
description?: string;
|
|
74
|
+
disabled?: boolean;
|
|
75
|
+
danger?: boolean;
|
|
76
|
+
variant?: "danger";
|
|
77
|
+
href?: string;
|
|
78
|
+
external?: boolean;
|
|
79
|
+
onSelect?: () => void;
|
|
80
|
+
class?: string;
|
|
81
|
+
};
|
|
82
|
+
export declare const dropdownPosition: (trigger: DOMRect, menu: Pick<DOMRect, "width" | "height">, position: DropdownPosition, viewport: {
|
|
83
|
+
width: number;
|
|
84
|
+
height: number;
|
|
85
|
+
}, gap?: number) => {
|
|
86
|
+
left: number;
|
|
87
|
+
top: number;
|
|
88
|
+
};
|
|
89
|
+
export declare function DropdownItem(props: DropdownItemProps): JSX.Element;
|
|
90
|
+
export declare function DropdownItems(props: {
|
|
91
|
+
items: readonly DropdownItem[];
|
|
92
|
+
close: (restoreFocus?: boolean) => void;
|
|
93
|
+
}): JSX.Element;
|
|
94
|
+
type DropdownComponent = ((props: DropdownProps) => JSX.Element) & {
|
|
95
|
+
Root: (props: DropdownProps) => JSX.Element;
|
|
96
|
+
Trigger: (props: DropdownTriggerProps) => JSX.Element;
|
|
97
|
+
Item: (props: DropdownItemProps) => JSX.Element;
|
|
98
|
+
};
|
|
99
|
+
export declare const Dropdown: DropdownComponent;
|
|
100
|
+
export default Dropdown;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type JSX } from "solid-js";
|
|
2
|
+
export type FilterChipOption = {
|
|
3
|
+
value: string;
|
|
4
|
+
label: string;
|
|
5
|
+
icon?: string;
|
|
6
|
+
color?: string;
|
|
7
|
+
};
|
|
8
|
+
export type FilterChipSection = {
|
|
9
|
+
label?: string;
|
|
10
|
+
options: readonly FilterChipOption[];
|
|
11
|
+
multiple?: boolean;
|
|
12
|
+
};
|
|
13
|
+
export type FilterChipProps = {
|
|
14
|
+
label: string;
|
|
15
|
+
icon: string;
|
|
16
|
+
options: readonly FilterChipSection[];
|
|
17
|
+
value: readonly string[];
|
|
18
|
+
onValueChange: (value: string[]) => void;
|
|
19
|
+
isActive?: boolean;
|
|
20
|
+
position?: "bottom-left" | "bottom-right";
|
|
21
|
+
defaultValue?: readonly string[];
|
|
22
|
+
iconOnly?: boolean;
|
|
23
|
+
class?: string;
|
|
24
|
+
};
|
|
25
|
+
/** Section-aware controlled filter with immediate single- and multi-select commits. */
|
|
26
|
+
export declare function FilterChip(props: FilterChipProps): JSX.Element;
|
|
27
|
+
export default FilterChip;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type JSX } from "solid-js";
|
|
2
|
+
export type RemoveButtonProps = Omit<JSX.ButtonHTMLAttributes<HTMLButtonElement>, "aria-label" | "children"> & {
|
|
3
|
+
ariaLabel: string;
|
|
4
|
+
loading?: boolean;
|
|
5
|
+
};
|
|
6
|
+
export declare function RemoveButton(props: RemoveButtonProps): JSX.Element;
|
|
7
|
+
export default RemoveButton;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type JSX } from "solid-js";
|
|
2
|
+
export type SegmentOption<T extends string = string> = {
|
|
3
|
+
value: T;
|
|
4
|
+
label: JSX.Element;
|
|
5
|
+
icon?: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export type SegmentedControlProps<T extends string = string> = {
|
|
9
|
+
options: readonly SegmentOption<T>[];
|
|
10
|
+
value: T | (() => T);
|
|
11
|
+
onValueChange: (value: T) => void;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
ariaLabel?: string;
|
|
14
|
+
label?: string;
|
|
15
|
+
size?: "sm" | "md";
|
|
16
|
+
class?: string;
|
|
17
|
+
};
|
|
18
|
+
/** Controlled radio group with automatic selection during arrow-key navigation. */
|
|
19
|
+
export declare function SegmentedControl<T extends string = string>(props: SegmentedControlProps<T>): JSX.Element;
|
|
20
|
+
export default SegmentedControl;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type JSX } from "solid-js";
|
|
2
|
+
import { type ButtonProps } from "./Button";
|
|
3
|
+
import { type DropdownItem, type DropdownPosition } from "./Dropdown";
|
|
4
|
+
export type SplitButtonProps = ButtonProps & {
|
|
5
|
+
/** Actions shown from the secondary menu trigger. */
|
|
6
|
+
items: readonly DropdownItem[];
|
|
7
|
+
/** Accessible name and title for the icon-only menu trigger. */
|
|
8
|
+
menuLabel: string;
|
|
9
|
+
menuPosition?: DropdownPosition | (() => DropdownPosition);
|
|
10
|
+
menuWidth?: string;
|
|
11
|
+
};
|
|
12
|
+
/** One primary button action with a separate menu of related alternatives. */
|
|
13
|
+
export declare function SplitButton(props: SplitButtonProps): JSX.Element;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { JSX } from "solid-js";
|
|
2
|
+
import type { PromptSearchInput, PromptSearchItem, PromptSearchOptions } from "../feedback/prompts";
|
|
3
|
+
export declare const SPOTLIGHT_SHORTCUT = "mod+shift+k";
|
|
4
|
+
export declare const SPOTLIGHT_SHORTCUT_LABEL = "\u21E7\u2318K";
|
|
5
|
+
export declare const SPOTLIGHT_SHORTCUT_TITLE = "Mod+Shift+K";
|
|
6
|
+
export type SpotlightSearchResolver<T = unknown> = (input: PromptSearchInput) => Promise<PromptSearchItem<T>[]> | PromptSearchItem<T>[];
|
|
7
|
+
export type SpotlightSearchOptions<T = unknown> = PromptSearchOptions & {
|
|
8
|
+
resolve: SpotlightSearchResolver<T>;
|
|
9
|
+
};
|
|
10
|
+
export type SpotlightButtonVariant = "default" | "compact" | "chip" | "sidebar" | "sidebar-mobile" | "icon";
|
|
11
|
+
export type SpotlightButtonProps = {
|
|
12
|
+
variant?: SpotlightButtonVariant;
|
|
13
|
+
label?: string;
|
|
14
|
+
title?: string;
|
|
15
|
+
icon?: string;
|
|
16
|
+
shortcutLabel?: string | false;
|
|
17
|
+
ariaLabel?: string;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
class?: string;
|
|
20
|
+
onClick: () => void | Promise<void>;
|
|
21
|
+
};
|
|
22
|
+
export declare const isSpotlightShortcut: (event: KeyboardEvent) => boolean;
|
|
23
|
+
export declare const openSpotlightSearch: <T = unknown>(options: SpotlightSearchOptions<T>) => Promise<PromptSearchItem<T> | undefined>;
|
|
24
|
+
export declare function SpotlightButton(props: SpotlightButtonProps): JSX.Element;
|
|
25
|
+
export default SpotlightButton;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type JSX } from "solid-js";
|
|
2
|
+
import type { MaybeAccessor } from "../inputs/field-contract";
|
|
3
|
+
export type TabOption<T extends string = string> = {
|
|
4
|
+
value: T;
|
|
5
|
+
label: JSX.Element;
|
|
6
|
+
icon?: string;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
panel?: JSX.Element;
|
|
9
|
+
};
|
|
10
|
+
export type TabsItemProps<T extends string = string> = Omit<TabOption<T>, "panel"> & {
|
|
11
|
+
children?: JSX.Element;
|
|
12
|
+
};
|
|
13
|
+
export type TabsProps<T extends string = string> = {
|
|
14
|
+
value: MaybeAccessor<T>;
|
|
15
|
+
onValueChange: (value: T) => void;
|
|
16
|
+
ariaLabel: string;
|
|
17
|
+
orientation?: "horizontal" | "vertical";
|
|
18
|
+
class?: string;
|
|
19
|
+
/** Data-driven alternative to colocated `Tabs.Item` children. */
|
|
20
|
+
options?: readonly TabOption<T>[];
|
|
21
|
+
children?: JSX.Element;
|
|
22
|
+
};
|
|
23
|
+
type TabsComponent = (<T extends string = string>(props: TabsProps<T>) => JSX.Element) & {
|
|
24
|
+
Item: <T extends string = string>(props: TabsItemProps<T>) => JSX.Element;
|
|
25
|
+
};
|
|
26
|
+
export declare const Tabs: TabsComponent;
|
|
27
|
+
export default Tabs;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type JSX } from "solid-js";
|
|
2
|
+
export type ToolbarProps = {
|
|
3
|
+
children: JSX.Element;
|
|
4
|
+
label: string;
|
|
5
|
+
orientation?: "horizontal" | "vertical";
|
|
6
|
+
wrap?: boolean;
|
|
7
|
+
class?: string;
|
|
8
|
+
};
|
|
9
|
+
export type ToolbarGroupProps = {
|
|
10
|
+
children: JSX.Element;
|
|
11
|
+
label?: string;
|
|
12
|
+
class?: string;
|
|
13
|
+
};
|
|
14
|
+
export type ToolbarSeparatorProps = {
|
|
15
|
+
class?: string;
|
|
16
|
+
};
|
|
17
|
+
type ToolbarComponent = ((props: ToolbarProps) => JSX.Element) & {
|
|
18
|
+
Group: (props: ToolbarGroupProps) => JSX.Element;
|
|
19
|
+
Separator: (props: ToolbarSeparatorProps) => JSX.Element;
|
|
20
|
+
Spacer: () => JSX.Element;
|
|
21
|
+
};
|
|
22
|
+
export declare const Toolbar: ToolbarComponent;
|
|
23
|
+
export default Toolbar;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type { ButtonLinkProps, ButtonProps, ButtonSize, ButtonVariant, IconButtonLinkProps, IconButtonProps } from "./Button";
|
|
2
|
+
export { Button, ButtonLink, IconButton, IconButtonLink } from "./Button";
|
|
3
|
+
export type { CopyButtonProps, CopyButtonValue } from "./CopyButton";
|
|
4
|
+
export { CopyButton } from "./CopyButton";
|
|
5
|
+
export type { DisclosureProps } from "./Disclosure";
|
|
6
|
+
export { Disclosure } from "./Disclosure";
|
|
7
|
+
export type { DropdownAction, DropdownActionBase, DropdownChoice, DropdownItemProps, DropdownPosition, DropdownProps, DropdownSection, DropdownTriggerProps, } from "./Dropdown";
|
|
8
|
+
export { Dropdown, DropdownItem, dropdownPosition } from "./Dropdown";
|
|
9
|
+
export type { FilterChipOption, FilterChipProps, FilterChipSection } from "./FilterChip";
|
|
10
|
+
export { FilterChip } from "./FilterChip";
|
|
11
|
+
export type { ContextMenuProps } from "./ContextMenu";
|
|
12
|
+
export { ContextMenu } from "./ContextMenu";
|
|
13
|
+
export type { RemoveButtonProps } from "./RemoveButton";
|
|
14
|
+
export { RemoveButton } from "./RemoveButton";
|
|
15
|
+
export type { SpotlightButtonProps, SpotlightButtonVariant, SpotlightSearchOptions, SpotlightSearchResolver, } from "./SpotlightSearch";
|
|
16
|
+
export { isSpotlightShortcut, openSpotlightSearch, SPOTLIGHT_SHORTCUT, SPOTLIGHT_SHORTCUT_LABEL, SPOTLIGHT_SHORTCUT_TITLE, SpotlightButton, } from "./SpotlightSearch";
|
|
17
|
+
export type { SegmentedControlProps, SegmentOption } from "./SegmentedControl";
|
|
18
|
+
export { SegmentedControl } from "./SegmentedControl";
|
|
19
|
+
export type { SplitButtonProps } from "./SplitButton";
|
|
20
|
+
export { SplitButton } from "./SplitButton";
|
|
21
|
+
export type { TabOption, TabsItemProps, TabsProps } from "./Tabs";
|
|
22
|
+
export { Tabs } from "./Tabs";
|
|
23
|
+
export type { ToolbarGroupProps, ToolbarProps, ToolbarSeparatorProps } from "./Toolbar";
|
|
24
|
+
export { Toolbar } from "./Toolbar";
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { type JSX } from "solid-js";
|
|
2
|
+
import type { ChatAction, ChatAttachment, ChatComposerState, ChatContextUsageData, ChatModelOption, ChatSubmitInput } from "./types";
|
|
3
|
+
export type ChatCommandContext = {
|
|
4
|
+
setValue: (value: string) => void;
|
|
5
|
+
submit: () => void;
|
|
6
|
+
focus: () => void;
|
|
7
|
+
};
|
|
8
|
+
export type ChatCommand = {
|
|
9
|
+
name: string;
|
|
10
|
+
description: string;
|
|
11
|
+
icon?: string;
|
|
12
|
+
action: (context: ChatCommandContext) => void | Promise<void>;
|
|
13
|
+
};
|
|
14
|
+
export type ChatFileSelection = {
|
|
15
|
+
onSelect: (files: readonly File[]) => void | Promise<void>;
|
|
16
|
+
onError?: (error: unknown) => void;
|
|
17
|
+
accept?: string;
|
|
18
|
+
multiple?: boolean;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
label?: string;
|
|
21
|
+
};
|
|
22
|
+
export type ChatPasteHandler = (event: ClipboardEvent & {
|
|
23
|
+
currentTarget: HTMLTextAreaElement;
|
|
24
|
+
target: Element;
|
|
25
|
+
}) => void;
|
|
26
|
+
export type ChatComposerProps = {
|
|
27
|
+
value: string;
|
|
28
|
+
onValueChange: (value: string) => void;
|
|
29
|
+
onSubmit: (input: ChatSubmitInput) => boolean | void | Promise<boolean | void>;
|
|
30
|
+
/** Submit intent used for drafts entered while a response is running. Defaults to `steer`. */
|
|
31
|
+
runningSubmitIntent?: "steer" | "queue";
|
|
32
|
+
onStop?: () => void | Promise<void>;
|
|
33
|
+
onError?: (error: unknown) => void;
|
|
34
|
+
state?: ChatComposerState;
|
|
35
|
+
attachments?: readonly ChatAttachment[];
|
|
36
|
+
onAttachmentsChange?: (attachments: readonly ChatAttachment[]) => void;
|
|
37
|
+
fileSelection?: ChatFileSelection;
|
|
38
|
+
/** Handle non-file clipboard content. Pasted files already use `fileSelection`. */
|
|
39
|
+
onPaste?: ChatPasteHandler;
|
|
40
|
+
menuActions?: readonly ChatAction[];
|
|
41
|
+
models?: readonly ChatModelOption[];
|
|
42
|
+
selectedModelId?: string | null;
|
|
43
|
+
onModelChange?: (modelId: string) => void;
|
|
44
|
+
commands?: readonly ChatCommand[];
|
|
45
|
+
contextUsage?: ChatContextUsageData;
|
|
46
|
+
contextActions?: readonly ChatAction[];
|
|
47
|
+
/** Additional compact controls rendered with the add/model controls. */
|
|
48
|
+
footerTools?: JSX.Element;
|
|
49
|
+
placeholder?: string;
|
|
50
|
+
label?: string;
|
|
51
|
+
inputLabel?: string;
|
|
52
|
+
disabled?: boolean;
|
|
53
|
+
error?: string;
|
|
54
|
+
focusToken?: unknown;
|
|
55
|
+
class?: string;
|
|
56
|
+
};
|
|
57
|
+
export declare function ChatComposer(props: ChatComposerProps): JSX.Element;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type JSX } from "solid-js";
|
|
2
|
+
import type { ChatAction, ChatActivityTone, ChatAttachment, ChatContextUsageData, ChatMessageStatus, ChatRole } from "./types";
|
|
3
|
+
export type ChatMessageProps = {
|
|
4
|
+
role: ChatRole;
|
|
5
|
+
children?: JSX.Element;
|
|
6
|
+
label?: string;
|
|
7
|
+
createdAt?: string | Date;
|
|
8
|
+
timeLabel?: string;
|
|
9
|
+
status?: ChatMessageStatus;
|
|
10
|
+
attachments?: readonly ChatAttachment[];
|
|
11
|
+
actions?: readonly ChatAction[];
|
|
12
|
+
actionDisplay?: "auto" | "inline" | "menu";
|
|
13
|
+
anchorId?: string | number;
|
|
14
|
+
onActionError?: (error: unknown) => void;
|
|
15
|
+
class?: string;
|
|
16
|
+
};
|
|
17
|
+
export type ChatActivityProps = {
|
|
18
|
+
label: string;
|
|
19
|
+
description?: string;
|
|
20
|
+
icon?: string;
|
|
21
|
+
/** Optional host-owned leading visual rendered instead of the icon. */
|
|
22
|
+
leading?: JSX.Element;
|
|
23
|
+
/** Optional identity accent for the leading visual. Semantic tones still take precedence. */
|
|
24
|
+
accent?: string;
|
|
25
|
+
tone?: ChatActivityTone;
|
|
26
|
+
/** Marks the activity as running with the shared accent sweep. */
|
|
27
|
+
busy?: boolean;
|
|
28
|
+
trailing?: JSX.Element;
|
|
29
|
+
/** Controlled disclosure state. Omit to keep native details behavior. */
|
|
30
|
+
open?: boolean;
|
|
31
|
+
/** Reports disclosure changes when `open` is controlled by the host. */
|
|
32
|
+
onOpenChange?: (open: boolean) => void;
|
|
33
|
+
defaultOpen?: boolean;
|
|
34
|
+
/** Set to false when the body is a peer list that should align with the activity row. */
|
|
35
|
+
bodyInset?: boolean;
|
|
36
|
+
anchorId?: string | number;
|
|
37
|
+
children?: JSX.Element;
|
|
38
|
+
class?: string;
|
|
39
|
+
};
|
|
40
|
+
export type ChatContextUsageProps = ChatContextUsageData & {
|
|
41
|
+
/** Host-owned number formatting. The default is locale-independent and SSR-stable. */
|
|
42
|
+
formatNumber?: (value: number) => string;
|
|
43
|
+
class?: string;
|
|
44
|
+
};
|
|
45
|
+
export declare const formatChatTokens: (tokens: number) => string;
|
|
46
|
+
export declare function ChatMessage(props: ChatMessageProps): JSX.Element;
|
|
47
|
+
export declare function ChatActivity(props: ChatActivityProps): JSX.Element;
|
|
48
|
+
export declare function ChatContextUsage(props: ChatContextUsageProps): JSX.Element;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type JSX } from "solid-js";
|
|
2
|
+
import type { ChatAction, ChatActivityTone, ChatAttachment, ChatMessageStatus, ChatRole } from "./types";
|
|
3
|
+
export type ChatMessageItem = {
|
|
4
|
+
kind: "message";
|
|
5
|
+
id: string;
|
|
6
|
+
role: ChatRole;
|
|
7
|
+
content?: JSX.Element;
|
|
8
|
+
label?: string;
|
|
9
|
+
createdAt?: string | Date;
|
|
10
|
+
timeLabel?: string;
|
|
11
|
+
status?: ChatMessageStatus;
|
|
12
|
+
attachments?: readonly ChatAttachment[];
|
|
13
|
+
actions?: readonly ChatAction[];
|
|
14
|
+
actionDisplay?: "auto" | "inline" | "menu";
|
|
15
|
+
anchorId?: string | number;
|
|
16
|
+
class?: string;
|
|
17
|
+
};
|
|
18
|
+
export type ChatActivityItem = {
|
|
19
|
+
kind: "activity";
|
|
20
|
+
id: string;
|
|
21
|
+
label: string;
|
|
22
|
+
description?: string;
|
|
23
|
+
icon?: string;
|
|
24
|
+
leading?: JSX.Element;
|
|
25
|
+
accent?: string;
|
|
26
|
+
tone?: ChatActivityTone;
|
|
27
|
+
busy?: boolean;
|
|
28
|
+
trailing?: JSX.Element;
|
|
29
|
+
defaultOpen?: boolean;
|
|
30
|
+
anchorId?: string | number;
|
|
31
|
+
content?: JSX.Element;
|
|
32
|
+
class?: string;
|
|
33
|
+
};
|
|
34
|
+
export type ChatTimelineItem = ChatMessageItem | ChatActivityItem;
|
|
35
|
+
export type ChatTimelineProps = {
|
|
36
|
+
items: readonly ChatTimelineItem[];
|
|
37
|
+
conversationKey?: string | null;
|
|
38
|
+
loading?: boolean;
|
|
39
|
+
hasMore?: boolean;
|
|
40
|
+
loadingOlder?: boolean;
|
|
41
|
+
onLoadOlder?: () => boolean | void | Promise<boolean | void>;
|
|
42
|
+
emptyTitle?: string;
|
|
43
|
+
emptyDescription?: string;
|
|
44
|
+
navigation?: JSX.Element;
|
|
45
|
+
onActionError?: (error: unknown) => void;
|
|
46
|
+
viewportRef?: (element: HTMLDivElement) => void;
|
|
47
|
+
contentRef?: (element: HTMLDivElement) => void;
|
|
48
|
+
label?: string;
|
|
49
|
+
followThreshold?: number;
|
|
50
|
+
class?: string;
|
|
51
|
+
};
|
|
52
|
+
export declare function ChatTimeline(props: ChatTimelineProps): JSX.Element;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ChatAction } from "./types";
|
|
2
|
+
export declare const filterChatCommands: <T extends {
|
|
3
|
+
name: string;
|
|
4
|
+
}>(value: string, commands: readonly T[]) => T[];
|
|
5
|
+
export declare const nextChatCommandIndex: (index: number, length: number, direction: 1 | -1) => number;
|
|
6
|
+
export declare const isChatNearBottom: (scrollHeight: number, scrollTop: number, clientHeight: number, threshold?: number) => boolean;
|
|
7
|
+
export declare const restoredChatScrollTop: (previousScrollTop: number, previousScrollHeight: number, nextScrollHeight: number) => number;
|
|
8
|
+
export type ChatSubmissionRun = {
|
|
9
|
+
/** Clears the controlled draft (and attachments) before the handler runs. */
|
|
10
|
+
clear: () => void;
|
|
11
|
+
/**
|
|
12
|
+
* The application handler. A synchronous throw, a rejected promise, and a
|
|
13
|
+
* `false` result all count as a rejected submission.
|
|
14
|
+
*/
|
|
15
|
+
perform: () => boolean | void | Promise<boolean | void>;
|
|
16
|
+
/** Restores the cleared draft (and attachments) after a rejected submission. */
|
|
17
|
+
restore: () => void;
|
|
18
|
+
onError?: (error: unknown) => void;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Runs one composer submission with optimistic clearing. Resolves to `true`
|
|
22
|
+
* when the handler accepted the submission. A synchronous throw is handled
|
|
23
|
+
* exactly like a rejected promise so a controlled draft is never lost.
|
|
24
|
+
*/
|
|
25
|
+
export declare const runChatSubmission: (run: ChatSubmissionRun) => Promise<boolean>;
|
|
26
|
+
/** Reports a handler failure without letting a synchronous throw escape. */
|
|
27
|
+
export declare const reportChatFailure: (perform: () => unknown, onError?: (error: unknown) => void) => void;
|
|
28
|
+
/** Executes the one behavior guaranteed by the ChatAction contract. */
|
|
29
|
+
export declare const executeChatAction: (action: ChatAction) => Promise<void>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ChatComposer } from "./ChatComposer";
|
|
2
|
+
import { ChatActivity, ChatContextUsage, ChatMessage } from "./ChatPrimitives";
|
|
3
|
+
import { ChatRoot } from "./ChatRoot";
|
|
4
|
+
import { ChatTimeline } from "./ChatTimeline";
|
|
5
|
+
export type { ChatCommand, ChatCommandContext, ChatComposerProps, ChatFileSelection, ChatPasteHandler } from "./ChatComposer";
|
|
6
|
+
export type { ChatActivityProps, ChatContextUsageProps, ChatMessageProps } from "./ChatPrimitives";
|
|
7
|
+
export { formatChatTokens } from "./ChatPrimitives";
|
|
8
|
+
export type { ChatRootProps } from "./ChatRoot";
|
|
9
|
+
export type { ChatActivityItem, ChatMessageItem, ChatTimelineItem, ChatTimelineProps } from "./ChatTimeline";
|
|
10
|
+
export type { ChatAction, ChatActivityTone, ChatAttachment, ChatComposerState, ChatContextUsageData, ChatMessageStatus, ChatModelOption, ChatRole, ChatSubmitInput, ChatSubmitIntent, ChatUsage, } from "./types";
|
|
11
|
+
/**
|
|
12
|
+
* Portable, controlled chat surface. Applications own storage, streaming,
|
|
13
|
+
* authorization, rich message rendering, and domain actions.
|
|
14
|
+
*/
|
|
15
|
+
export declare const Chat: typeof ChatRoot & {
|
|
16
|
+
Timeline: typeof ChatTimeline;
|
|
17
|
+
Message: typeof ChatMessage;
|
|
18
|
+
Activity: typeof ChatActivity;
|
|
19
|
+
Composer: typeof ChatComposer;
|
|
20
|
+
ContextUsage: typeof ChatContextUsage;
|
|
21
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export type ChatRole = "user" | "assistant" | "system" | "tool";
|
|
2
|
+
export type ChatMessageStatus = "pending" | "streaming" | "complete" | "error";
|
|
3
|
+
export type ChatActivityTone = "neutral" | "ai" | "success" | "danger";
|
|
4
|
+
type ChatActionBase = {
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
icon?: string;
|
|
8
|
+
variant?: "danger";
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
/** Toggle state for persistent message actions such as feedback. */
|
|
11
|
+
pressed?: boolean;
|
|
12
|
+
};
|
|
13
|
+
/** Exactly one executable behavior for every chat action. */
|
|
14
|
+
export type ChatAction = ChatActionBase & ({
|
|
15
|
+
onSelect: () => void | Promise<void>;
|
|
16
|
+
copyText?: never;
|
|
17
|
+
} | {
|
|
18
|
+
copyText: string;
|
|
19
|
+
onSelect?: never;
|
|
20
|
+
});
|
|
21
|
+
export type ChatAttachment = {
|
|
22
|
+
id: string;
|
|
23
|
+
name: string;
|
|
24
|
+
size?: number;
|
|
25
|
+
kind?: "file" | "image" | "resource";
|
|
26
|
+
icon?: string;
|
|
27
|
+
previewUrl?: string;
|
|
28
|
+
alt?: string;
|
|
29
|
+
/** Optional destination represented by this attachment. */
|
|
30
|
+
href?: string;
|
|
31
|
+
/** Opaque application-owned payload returned unchanged with ChatSubmitInput. */
|
|
32
|
+
data?: unknown;
|
|
33
|
+
/** Optional application-owned action presented below the attachment label. */
|
|
34
|
+
action?: ChatAction;
|
|
35
|
+
};
|
|
36
|
+
export type ChatUsage = {
|
|
37
|
+
input?: number;
|
|
38
|
+
output?: number;
|
|
39
|
+
total?: number;
|
|
40
|
+
};
|
|
41
|
+
export type ChatContextUsageData = {
|
|
42
|
+
usage?: ChatUsage | null;
|
|
43
|
+
loopUsage?: ChatUsage | null;
|
|
44
|
+
contextWindow?: number;
|
|
45
|
+
modelLabel?: string;
|
|
46
|
+
};
|
|
47
|
+
export type ChatModelOption = {
|
|
48
|
+
id: string;
|
|
49
|
+
label: string;
|
|
50
|
+
description?: string;
|
|
51
|
+
image?: string;
|
|
52
|
+
icon?: string;
|
|
53
|
+
capabilities?: readonly string[];
|
|
54
|
+
};
|
|
55
|
+
export type ChatComposerState = "idle" | "submitting" | "running" | "stopping";
|
|
56
|
+
export type ChatSubmitIntent = "send" | "steer" | "queue";
|
|
57
|
+
export type ChatSubmitInput = {
|
|
58
|
+
intent: ChatSubmitIntent;
|
|
59
|
+
text: string;
|
|
60
|
+
attachments: readonly ChatAttachment[];
|
|
61
|
+
};
|
|
62
|
+
export {};
|