@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,115 @@
|
|
|
1
|
+
import { type LinkNavigateEvent } from "@k2b/ssr/nav";
|
|
2
|
+
import { type DateContext } from "@k2b/stdlib";
|
|
3
|
+
import type { JSX } from "solid-js";
|
|
4
|
+
export type CalendarView = "day" | "week" | "month" | "year" | "mobile-month";
|
|
5
|
+
export type CalendarEventColor = "blue" | "emerald" | "amber" | "red" | "violet" | "cyan" | "zinc";
|
|
6
|
+
export type CalendarEvent = {
|
|
7
|
+
id: string;
|
|
8
|
+
title: string;
|
|
9
|
+
start: Date | string;
|
|
10
|
+
end?: Date | string;
|
|
11
|
+
allDay?: boolean;
|
|
12
|
+
color?: CalendarEventColor;
|
|
13
|
+
colorHex?: string;
|
|
14
|
+
href?: string;
|
|
15
|
+
dataSpaceItemId?: string;
|
|
16
|
+
meta?: string;
|
|
17
|
+
description?: string;
|
|
18
|
+
display?: "event" | "background";
|
|
19
|
+
location?: string;
|
|
20
|
+
calendarName?: string;
|
|
21
|
+
attendees?: CalendarAttendee[];
|
|
22
|
+
resources?: CalendarResource[];
|
|
23
|
+
recurrence?: CalendarRecurrence;
|
|
24
|
+
};
|
|
25
|
+
export type CalendarAttendee = {
|
|
26
|
+
name: string;
|
|
27
|
+
status?: "accepted" | "declined" | "tentative" | "needs-action";
|
|
28
|
+
};
|
|
29
|
+
export type CalendarResource = {
|
|
30
|
+
name: string;
|
|
31
|
+
kind?: "room" | "equipment" | "link" | "other";
|
|
32
|
+
};
|
|
33
|
+
export type CalendarRecurrence = {
|
|
34
|
+
rrule: string;
|
|
35
|
+
exdate?: Array<Date | string>;
|
|
36
|
+
recurrenceId?: Date | string;
|
|
37
|
+
};
|
|
38
|
+
export type CalendarLabels = Partial<{
|
|
39
|
+
today: string;
|
|
40
|
+
day: string;
|
|
41
|
+
week: string;
|
|
42
|
+
month: string;
|
|
43
|
+
year: string;
|
|
44
|
+
allDay: string;
|
|
45
|
+
noEvents: string;
|
|
46
|
+
previous: string;
|
|
47
|
+
next: string;
|
|
48
|
+
}>;
|
|
49
|
+
export type CalendarEventRenderContext = {
|
|
50
|
+
compact: boolean;
|
|
51
|
+
fill: boolean;
|
|
52
|
+
start: Date;
|
|
53
|
+
end: Date;
|
|
54
|
+
allDay: boolean;
|
|
55
|
+
durationHours: number;
|
|
56
|
+
timeLabel: string;
|
|
57
|
+
};
|
|
58
|
+
export type CalendarProps = {
|
|
59
|
+
date: Date | string;
|
|
60
|
+
events: CalendarEvent[];
|
|
61
|
+
view?: CalendarView;
|
|
62
|
+
views?: CalendarView[];
|
|
63
|
+
labels?: CalendarLabels;
|
|
64
|
+
/** stdlib date context used for timezone-aware rendering and calendar math. */
|
|
65
|
+
dateConfig?: DateContext;
|
|
66
|
+
/** Convenience override for dateConfig.timeZone. */
|
|
67
|
+
timeZone?: string;
|
|
68
|
+
firstDayOfWeek?: 0 | 1;
|
|
69
|
+
withWeekNumbers?: boolean;
|
|
70
|
+
startHour?: number;
|
|
71
|
+
endHour?: number;
|
|
72
|
+
visibleStartHour?: number;
|
|
73
|
+
visibleEndHour?: number;
|
|
74
|
+
allDayMaxHeightRem?: number;
|
|
75
|
+
hideAllDay?: boolean;
|
|
76
|
+
selectedDate?: Date | string;
|
|
77
|
+
selectedEventId?: string;
|
|
78
|
+
dayBadges?: Record<string, CalendarDayBadge>;
|
|
79
|
+
getViewHref?: (view: CalendarView) => string;
|
|
80
|
+
getDateHref?: (date: Date, view: CalendarView) => string;
|
|
81
|
+
getEventHref?: (event: CalendarEvent) => string | undefined;
|
|
82
|
+
renderEvent?: (event: CalendarEvent, context: CalendarEventRenderContext) => JSX.Element;
|
|
83
|
+
/** Progressively enhance canonical calendar links after the app has loaded their target state. */
|
|
84
|
+
onNavigate?: (event: LinkNavigateEvent) => void | Promise<void>;
|
|
85
|
+
/** Progressively enhance canonical links without a document view transition. */
|
|
86
|
+
onNavigateHref?: (href: string) => void;
|
|
87
|
+
/** Optionally preload the target behind a canonical calendar link. */
|
|
88
|
+
onPrefetch?: (href: string) => void;
|
|
89
|
+
navigationPending?: boolean;
|
|
90
|
+
onViewChange?: (view: CalendarView) => void;
|
|
91
|
+
onDateChange?: (date: Date, view: CalendarView) => void;
|
|
92
|
+
/** One activation contract for pointer and keyboard input. */
|
|
93
|
+
onEventActivate?: (event: CalendarEvent) => void;
|
|
94
|
+
/** Pointer gesture used for activation. Keyboard activation is always immediate. */
|
|
95
|
+
eventActivation?: "single" | "double";
|
|
96
|
+
onEventDrop?: (event: CalendarEvent, next: CalendarEventTimeChange) => void;
|
|
97
|
+
onEventResize?: (event: CalendarEvent, next: CalendarEventTimeChange) => void;
|
|
98
|
+
onSlotActivate?: (slot: CalendarEventTimeChange) => void;
|
|
99
|
+
/** Pointer gesture used for empty slots. Keyboard activation is always immediate. */
|
|
100
|
+
slotActivation?: "single" | "double";
|
|
101
|
+
toolbarActions?: JSX.Element;
|
|
102
|
+
toolbarContent?: JSX.Element;
|
|
103
|
+
class?: string;
|
|
104
|
+
};
|
|
105
|
+
export type CalendarEventTimeChange = {
|
|
106
|
+
start: Date;
|
|
107
|
+
end: Date;
|
|
108
|
+
allDay?: boolean;
|
|
109
|
+
};
|
|
110
|
+
export type CalendarDayBadge = {
|
|
111
|
+
icon?: string;
|
|
112
|
+
label: string;
|
|
113
|
+
};
|
|
114
|
+
declare const Calendar: (props: CalendarProps) => JSX.Element;
|
|
115
|
+
export default Calendar;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { charts } from "@k2b/stdlib";
|
|
2
|
+
import type { JSX } from "solid-js";
|
|
3
|
+
import { type StateTimelineChartOptions } from "./chart-state-timeline";
|
|
4
|
+
/**
|
|
5
|
+
* Chart — minimal Solid wrapper around `stdlib.charts`.
|
|
6
|
+
*
|
|
7
|
+
* **Live-update story.** `charts.<kind>(opts)` returns an SVG string;
|
|
8
|
+
* Solid's `innerHTML` is reactive, so any time a prop (signal, store
|
|
9
|
+
* slice, derived value) changes, the SVG re-renders. No manual
|
|
10
|
+
* subscription, no imperative DOM patching. Trade-off: every change
|
|
11
|
+
* is a full SVG re-build, not a diff — fine for dashboard cadences
|
|
12
|
+
* (poll, websocket, store updates). Don't use this for 60fps streaming.
|
|
13
|
+
*
|
|
14
|
+
* **Sizing.** stdlib emits `<svg viewBox="0 0 W H">` with no width/
|
|
15
|
+
* height attributes, so the SVG would otherwise fall back to the
|
|
16
|
+
* browser's replaced-element default (300×150) and either overflow
|
|
17
|
+
* or look squished. We measure the wrapping `<div>` with a
|
|
18
|
+
* ResizeObserver and pass the actual pixel dimensions to stdlib —
|
|
19
|
+
* the viewBox matches the container, no aspect distortion, no
|
|
20
|
+
* letterboxing. Sizing the wrapper itself is the caller's job
|
|
21
|
+
* (`style={{ height: "14rem" }}`, an app class, a flex child, …).
|
|
22
|
+
* On SSR (no observer)
|
|
23
|
+
* the chart renders at stdlib's default size; the first client-side
|
|
24
|
+
* frame re-measures and re-renders.
|
|
25
|
+
*
|
|
26
|
+
* One documented exception: `kind: "stateTimeline"` derives its own
|
|
27
|
+
* initial height from the row count and legend via
|
|
28
|
+
* `stateTimelineHeight()`, because a timeline's height is a function of
|
|
29
|
+
* how many rows it has rather than of the layout around it. Every other
|
|
30
|
+
* kind starts at 280px until the observer reports the real box. Layout
|
|
31
|
+
* code that sizes charts uniformly must account for this.
|
|
32
|
+
*
|
|
33
|
+
* **Why so thin.** The props are a discriminated union over each
|
|
34
|
+
* stdlib chart function — `kind: "line"` brings in exactly the params
|
|
35
|
+
* `charts.line` expects, `kind: "bar"` brings in `charts.bar`'s, etc.
|
|
36
|
+
* Options stay aligned with stdlib without renaming. Shared interactive
|
|
37
|
+
* layers add bounded pan / zoom controls to maps and state timelines, plus
|
|
38
|
+
* nearest-point hover and keyboard inspection for line charts.
|
|
39
|
+
* If stdlib gains a new option, it's automatically available at every
|
|
40
|
+
* callsite.
|
|
41
|
+
*
|
|
42
|
+
* **Theming.** stdlib charts use `currentColor` for axes / ticks /
|
|
43
|
+
* tick labels — set the wrapping element's `color` and everything
|
|
44
|
+
* inherits. Series colors come from `--stdlib-chart-c1..c8` CSS
|
|
45
|
+
* custom properties; override on the parent for per-chart palettes.
|
|
46
|
+
*
|
|
47
|
+
* ```tsx
|
|
48
|
+
* <Chart kind="line" style={{ height: "12rem" }}
|
|
49
|
+
* series={[{ data: points() }]}
|
|
50
|
+
* yAxis={{ format: v => `€${v}k` }} />
|
|
51
|
+
*
|
|
52
|
+
* <Chart kind="donut" style={{ height: "12rem" }} data={slices()} />
|
|
53
|
+
*
|
|
54
|
+
* <Chart kind="sparkline" style={{ width: "6rem", height: "1.5rem" }} data={trend()} />
|
|
55
|
+
*
|
|
56
|
+
* <Chart kind="map" style={{ height: "16rem" }} series={locations()} interactive />
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
/** All chart kinds shipped by `stdlib.charts`. */
|
|
60
|
+
export type ChartKind = keyof typeof charts;
|
|
61
|
+
export type ChartLabels = Partial<{
|
|
62
|
+
empty: string;
|
|
63
|
+
series: string;
|
|
64
|
+
interactiveMap: string;
|
|
65
|
+
interactiveTimeline: string;
|
|
66
|
+
interactiveLine: string;
|
|
67
|
+
zoomIn: string;
|
|
68
|
+
zoomOut: string;
|
|
69
|
+
resetMap: string;
|
|
70
|
+
resetTimeline: string;
|
|
71
|
+
}>;
|
|
72
|
+
/**
|
|
73
|
+
* Per-kind props: `kind` discriminator + the exact options that
|
|
74
|
+
* `charts.<kind>` accepts, **minus** `width` / `height` (the wrapper
|
|
75
|
+
* owns those — they're derived from container measurement). Solid's
|
|
76
|
+
* component model handles discriminated unions natively, so callsites
|
|
77
|
+
* get full type safety.
|
|
78
|
+
*/
|
|
79
|
+
export type ChartProps = {
|
|
80
|
+
[K in ChartKind]: {
|
|
81
|
+
kind: K;
|
|
82
|
+
class?: string;
|
|
83
|
+
style?: JSX.CSSProperties | string;
|
|
84
|
+
labels?: ChartLabels;
|
|
85
|
+
} & (K extends "stateTimeline" ? StateTimelineChartOptions : Omit<Parameters<(typeof charts)[K]>[0], "width" | "height"> & (K extends "map" | "line" ? {
|
|
86
|
+
interactive?: boolean;
|
|
87
|
+
} : {}));
|
|
88
|
+
}[ChartKind];
|
|
89
|
+
declare const Chart: (props: ChartProps) => JSX.Element;
|
|
90
|
+
export default Chart;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type CodeDisplayLanguage } from "./code-highlight";
|
|
2
|
+
export type { CodeDisplayLanguage };
|
|
3
|
+
export type CodeDisplayProps = {
|
|
4
|
+
code: string;
|
|
5
|
+
title?: string;
|
|
6
|
+
language?: CodeDisplayLanguage;
|
|
7
|
+
copy?: boolean;
|
|
8
|
+
lineNumbers?: boolean;
|
|
9
|
+
class?: string;
|
|
10
|
+
};
|
|
11
|
+
export default function CodeDisplay(props: CodeDisplayProps): import("solid-js").JSX.Element;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { type JSX } from "solid-js";
|
|
2
|
+
export type DataTableColumn<T> = {
|
|
3
|
+
id: string;
|
|
4
|
+
header: JSX.Element | ((ctx: {
|
|
5
|
+
col: DataTableColumn<T>;
|
|
6
|
+
}) => JSX.Element);
|
|
7
|
+
subtitle?: JSX.Element | ((ctx: {
|
|
8
|
+
col: DataTableColumn<T>;
|
|
9
|
+
}) => JSX.Element);
|
|
10
|
+
value?: keyof T | ((row: T) => unknown);
|
|
11
|
+
class?: string;
|
|
12
|
+
headerClass?: string;
|
|
13
|
+
cellClass?: string;
|
|
14
|
+
/** Defaults to right for numeric values and left for everything else. */
|
|
15
|
+
align?: "left" | "center" | "right";
|
|
16
|
+
/**
|
|
17
|
+
* Marks the column sortable. Pass a string when the server's sort key
|
|
18
|
+
* differs from the column id — they often do, because one column can show a
|
|
19
|
+
* rate while another sorts by the absolute count behind it.
|
|
20
|
+
*/
|
|
21
|
+
sortable?: boolean | string;
|
|
22
|
+
};
|
|
23
|
+
export type DataTableSort = {
|
|
24
|
+
key: string;
|
|
25
|
+
direction: "asc" | "desc";
|
|
26
|
+
};
|
|
27
|
+
export type DataTableRenderCell<T> = (ctx: {
|
|
28
|
+
row: T;
|
|
29
|
+
col: DataTableColumn<T>;
|
|
30
|
+
value: unknown;
|
|
31
|
+
render: (value: unknown) => JSX.Element;
|
|
32
|
+
}) => JSX.Element;
|
|
33
|
+
export type DataTableRenderHeader<T> = (ctx: {
|
|
34
|
+
col: DataTableColumn<T>;
|
|
35
|
+
render: () => JSX.Element;
|
|
36
|
+
}) => JSX.Element;
|
|
37
|
+
export type DataTableFooter<T> = {
|
|
38
|
+
values?: Record<string, unknown>;
|
|
39
|
+
renderCell?: (ctx: {
|
|
40
|
+
col: DataTableColumn<T>;
|
|
41
|
+
value: unknown;
|
|
42
|
+
render: (value: unknown) => JSX.Element;
|
|
43
|
+
}) => JSX.Element;
|
|
44
|
+
};
|
|
45
|
+
export type DataTableProps<T> = {
|
|
46
|
+
rows: readonly T[];
|
|
47
|
+
columns: readonly DataTableColumn<T>[];
|
|
48
|
+
/** Accessible name for a standalone table region. Defaults to "Data table". */
|
|
49
|
+
ariaLabel?: string;
|
|
50
|
+
/** ID of a visible heading that labels the table region. Takes precedence over ariaLabel. */
|
|
51
|
+
ariaLabelledBy?: string;
|
|
52
|
+
getRowId?: (row: T) => string;
|
|
53
|
+
/** Current server-side ordering, or null when the default applies. */
|
|
54
|
+
sort?: DataTableSort | null;
|
|
55
|
+
/**
|
|
56
|
+
* Link target for a sortable header. Link-based because every admin table is
|
|
57
|
+
* server-rendered: sorting is a query change, not client state.
|
|
58
|
+
*/
|
|
59
|
+
sortHref?: (next: DataTableSort) => string;
|
|
60
|
+
selectedRowId?: string | null;
|
|
61
|
+
rowClass?: string | ((row: T) => string | undefined);
|
|
62
|
+
hoverRows?: boolean;
|
|
63
|
+
onRowClick?: (row: T) => void;
|
|
64
|
+
onRowDoubleClick?: (row: T) => void;
|
|
65
|
+
renderCell?: DataTableRenderCell<T>;
|
|
66
|
+
renderHeader?: DataTableRenderHeader<T>;
|
|
67
|
+
footer?: DataTableFooter<T>;
|
|
68
|
+
hasMore?: boolean;
|
|
69
|
+
loadingMore?: boolean;
|
|
70
|
+
onLoadMore?: () => void;
|
|
71
|
+
empty?: JSX.Element;
|
|
72
|
+
density?: "compact" | "normal";
|
|
73
|
+
stickyHeader?: boolean;
|
|
74
|
+
highlightColumns?: boolean;
|
|
75
|
+
verticalAlign?: "top" | "middle" | "bottom";
|
|
76
|
+
cellContentClass?: string;
|
|
77
|
+
fillHeight?: boolean;
|
|
78
|
+
/** Visual frame for a standalone table. Defaults preserve the legacy class-based behavior. */
|
|
79
|
+
surface?: "paper" | "plain";
|
|
80
|
+
class?: string;
|
|
81
|
+
/** Additional classes for the table element. Core table geometry is always retained. */
|
|
82
|
+
tableClass?: string;
|
|
83
|
+
scrollPreserveKey?: string | false;
|
|
84
|
+
};
|
|
85
|
+
export type DataTablePanelProps = {
|
|
86
|
+
children: JSX.Element;
|
|
87
|
+
class?: string;
|
|
88
|
+
};
|
|
89
|
+
export type DataTableHeaderProps = {
|
|
90
|
+
title: string;
|
|
91
|
+
subtitle?: string;
|
|
92
|
+
children?: JSX.Element;
|
|
93
|
+
as?: "h1" | "h2" | "h3";
|
|
94
|
+
size?: "sm" | "md";
|
|
95
|
+
class?: string;
|
|
96
|
+
};
|
|
97
|
+
export type DataTableControlsProps = {
|
|
98
|
+
children: JSX.Element;
|
|
99
|
+
class?: string;
|
|
100
|
+
};
|
|
101
|
+
export type DataTablePanelFooterProps = {
|
|
102
|
+
children: JSX.Element;
|
|
103
|
+
class?: string;
|
|
104
|
+
};
|
|
105
|
+
type DataTableComponent = {
|
|
106
|
+
<T>(props: DataTableProps<T>): JSX.Element;
|
|
107
|
+
Panel: (props: DataTablePanelProps) => JSX.Element;
|
|
108
|
+
Header: (props: DataTableHeaderProps) => JSX.Element;
|
|
109
|
+
Controls: (props: DataTableControlsProps) => JSX.Element;
|
|
110
|
+
Footer: (props: DataTablePanelFooterProps) => JSX.Element;
|
|
111
|
+
};
|
|
112
|
+
declare const DataTable: DataTableComponent;
|
|
113
|
+
export default DataTable;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type JSX } from "solid-js";
|
|
2
|
+
import type { CodeDisplayLanguage } from "./CodeDisplay";
|
|
3
|
+
export type DocCodeHighlighter = (code: string) => string;
|
|
4
|
+
export type DocCodeProps = {
|
|
5
|
+
code: string;
|
|
6
|
+
title?: string;
|
|
7
|
+
language?: CodeDisplayLanguage;
|
|
8
|
+
highlight?: DocCodeHighlighter;
|
|
9
|
+
format?: (code: string) => string;
|
|
10
|
+
copy?: boolean;
|
|
11
|
+
copyText?: string;
|
|
12
|
+
lineNumbers?: boolean;
|
|
13
|
+
class?: string;
|
|
14
|
+
};
|
|
15
|
+
export type DocNoteVariant = "info" | "tip" | "warning";
|
|
16
|
+
export type DocRow = {
|
|
17
|
+
title: string;
|
|
18
|
+
icon?: string;
|
|
19
|
+
text: JSX.Element;
|
|
20
|
+
};
|
|
21
|
+
export type DocConcept = {
|
|
22
|
+
title: string;
|
|
23
|
+
icon: string;
|
|
24
|
+
text: JSX.Element;
|
|
25
|
+
};
|
|
26
|
+
export declare const DocPage: (props: {
|
|
27
|
+
children: JSX.Element;
|
|
28
|
+
class?: string;
|
|
29
|
+
}) => JSX.Element;
|
|
30
|
+
export declare const DocLead: (props: {
|
|
31
|
+
children: JSX.Element;
|
|
32
|
+
}) => JSX.Element;
|
|
33
|
+
export declare const DocSection: (props: {
|
|
34
|
+
title: string;
|
|
35
|
+
eyebrow?: string;
|
|
36
|
+
children: JSX.Element;
|
|
37
|
+
}) => JSX.Element;
|
|
38
|
+
export declare const DocInlineCode: (props: {
|
|
39
|
+
children: JSX.Element;
|
|
40
|
+
}) => JSX.Element;
|
|
41
|
+
export declare const DocCode: (props: DocCodeProps) => JSX.Element;
|
|
42
|
+
export declare const DocConceptGrid: (props: {
|
|
43
|
+
items: DocConcept[];
|
|
44
|
+
}) => JSX.Element;
|
|
45
|
+
export declare const DocRows: (props: {
|
|
46
|
+
items: DocRow[];
|
|
47
|
+
}) => JSX.Element;
|
|
48
|
+
export declare const DocNote: (props: {
|
|
49
|
+
title: string;
|
|
50
|
+
variant?: DocNoteVariant;
|
|
51
|
+
children: JSX.Element;
|
|
52
|
+
}) => JSX.Element;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type FileTreeEntry } from "./FileTree";
|
|
2
|
+
import { type FileViewContent, type FileViewRenderer } from "./FileView";
|
|
3
|
+
export type FileSource = {
|
|
4
|
+
list(): Promise<FileTreeEntry[]>;
|
|
5
|
+
read(path: string): Promise<FileViewContent>;
|
|
6
|
+
write?(path: string, content: string, encoding?: "utf8" | "base64"): Promise<void>;
|
|
7
|
+
remove?(path: string): Promise<void>;
|
|
8
|
+
rename?(from: string, to: string): Promise<void>;
|
|
9
|
+
upload?(dirPath: string, files: File[]): Promise<void>;
|
|
10
|
+
downloadHref?(path: string): string | null;
|
|
11
|
+
/** Paths matching this predicate stay read-only even when the source can write (e.g. /input). */
|
|
12
|
+
isReadOnly?(path: string): boolean;
|
|
13
|
+
};
|
|
14
|
+
export type FileBrowserPanelProps = {
|
|
15
|
+
source: FileSource;
|
|
16
|
+
/** Hide every mutating affordance while retaining file selection and downloads. */
|
|
17
|
+
readOnly?: boolean;
|
|
18
|
+
/** Refetch entries when this host-controlled value changes. */
|
|
19
|
+
refreshKey?: unknown;
|
|
20
|
+
/** Preselect a file once entries are loaded. */
|
|
21
|
+
initialPath?: string;
|
|
22
|
+
/** Mirrors file selection into route state when the host needs durable navigation. */
|
|
23
|
+
onSelectedPathChange?: (path: string | null) => void;
|
|
24
|
+
/** Per-instance preview extensions forwarded to FileView. */
|
|
25
|
+
renderers?: readonly FileViewRenderer[];
|
|
26
|
+
/** Optional host copy/policy for leaving an unsaved file. */
|
|
27
|
+
confirmDiscard?: (path: string, nextPath: string | null) => boolean | Promise<boolean>;
|
|
28
|
+
/** Fixed shell height — the panes scroll inside it. */
|
|
29
|
+
class?: string;
|
|
30
|
+
/** Optional imperative refresh used by realtime owners that must await the visible update. */
|
|
31
|
+
registerRefresh?: (refresh: () => Promise<void>) => void | (() => void);
|
|
32
|
+
};
|
|
33
|
+
export declare function FileBrowserPanel(props: FileBrowserPanelProps): import("solid-js").JSX.Element;
|
|
34
|
+
/** Open the file browser as a dialog. Returns when the dialog closes. */
|
|
35
|
+
export declare const openFileBrowser: (options: {
|
|
36
|
+
source: FileSource;
|
|
37
|
+
title?: string;
|
|
38
|
+
subtitle?: string;
|
|
39
|
+
icon?: string;
|
|
40
|
+
}) => Promise<void>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type DropdownItem } from "../actions/Dropdown";
|
|
2
|
+
import { type FileTreeEntry } from "./file-tree";
|
|
3
|
+
export type { FileTreeEntry } from "./file-tree";
|
|
4
|
+
/** Presence of a callback enables the matching UI affordance. */
|
|
5
|
+
export type FileTreeActions = {
|
|
6
|
+
rename?: (path: string, nextName: string) => void | Promise<void>;
|
|
7
|
+
remove?: (path: string) => void | Promise<void>;
|
|
8
|
+
createFile?: (dirPath: string) => void | Promise<void>;
|
|
9
|
+
createFolder?: (dirPath: string) => void | Promise<void>;
|
|
10
|
+
/** Enables drag & drop of files and folders onto folders (and the tree root). */
|
|
11
|
+
move?: (path: string, targetDir: string) => void | Promise<void>;
|
|
12
|
+
/** Download menu entry — folders arrive as "Download as ZIP". */
|
|
13
|
+
download?: (path: string, isFolder: boolean) => void | Promise<void>;
|
|
14
|
+
};
|
|
15
|
+
export type FileTreeProps = {
|
|
16
|
+
entries: FileTreeEntry[];
|
|
17
|
+
selectedPath?: string | null;
|
|
18
|
+
onSelect?: (entry: FileTreeEntry) => void;
|
|
19
|
+
/** Controlled expansion; omit for internal state (folders start expanded). */
|
|
20
|
+
expandedPaths?: Set<string>;
|
|
21
|
+
onExpandedChange?: (expanded: Set<string>) => void;
|
|
22
|
+
/** Extra context-menu items per entry, merged above the built-in actions. */
|
|
23
|
+
contextMenu?: (entry: FileTreeEntry) => DropdownItem[];
|
|
24
|
+
actions?: FileTreeActions;
|
|
25
|
+
/** Accessible name for the tree. */
|
|
26
|
+
label?: string;
|
|
27
|
+
class?: string;
|
|
28
|
+
};
|
|
29
|
+
export default function FileTree(props: FileTreeProps): import("solid-js").JSX.Element;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FileView — renders one file through a small renderer registry keyed by
|
|
3
|
+
* media type / path. Editing is enabled purely by the presence of `save`;
|
|
4
|
+
* without it every renderer is read-only. IDE-style chrome: editors reuse
|
|
5
|
+
* the markdown editor's surface (toolbar with an in-toolbar save, Ctrl/Cmd+S),
|
|
6
|
+
* previews are quiet paper panels with icon-only actions overlaid top-right.
|
|
7
|
+
* Custom renderers are passed per instance, which keeps SSR requests and
|
|
8
|
+
* independently mounted applications isolated.
|
|
9
|
+
*/
|
|
10
|
+
import { type Component, type JSX } from "solid-js";
|
|
11
|
+
import { type FileViewFile } from "./file-view-preview";
|
|
12
|
+
export type { FileViewFile, FileViewPreviewKind } from "./file-view-preview";
|
|
13
|
+
export { canPreviewFile, getFileViewPreviewKind } from "./file-view-preview";
|
|
14
|
+
export type FileViewContent = {
|
|
15
|
+
encoding: "utf8" | "base64";
|
|
16
|
+
content: string;
|
|
17
|
+
mediaType: string;
|
|
18
|
+
};
|
|
19
|
+
export type FileViewProps = {
|
|
20
|
+
file: FileViewFile;
|
|
21
|
+
load: () => Promise<FileViewContent>;
|
|
22
|
+
/** Refetch the current path when this host-owned revision changes. */
|
|
23
|
+
revision?: unknown;
|
|
24
|
+
/** Register an awaitable refresh for the currently visible preview. */
|
|
25
|
+
registerRefresh?: (refresh: () => Promise<void>) => void | (() => void);
|
|
26
|
+
/** Presence enables editing for text-based renderers. */
|
|
27
|
+
save?: (content: string) => Promise<void>;
|
|
28
|
+
/** Authenticated inline URL used by browser-native image, PDF, audio, and video previews. */
|
|
29
|
+
previewHref?: string | null;
|
|
30
|
+
downloadHref?: string | null;
|
|
31
|
+
/** App-specific renderers matched before the built-ins for this instance. */
|
|
32
|
+
renderers?: readonly FileViewRenderer[];
|
|
33
|
+
/** Reports local edit state so a parent browser can guard navigation. */
|
|
34
|
+
onDirtyChange?: (dirty: boolean) => void;
|
|
35
|
+
class?: string;
|
|
36
|
+
};
|
|
37
|
+
export type FileViewRendererProps = {
|
|
38
|
+
file: FileViewFile;
|
|
39
|
+
content: FileViewContent;
|
|
40
|
+
previewHref: string | null;
|
|
41
|
+
downloadHref: string | null;
|
|
42
|
+
/** Null when the file is read-only. */
|
|
43
|
+
editor: {
|
|
44
|
+
draft: () => string;
|
|
45
|
+
setDraft: (value: string) => void;
|
|
46
|
+
dirty: () => boolean;
|
|
47
|
+
saving: () => boolean;
|
|
48
|
+
save: () => Promise<void>;
|
|
49
|
+
} | null;
|
|
50
|
+
};
|
|
51
|
+
export type FileViewRenderer = {
|
|
52
|
+
id: string;
|
|
53
|
+
match: (file: FileViewFile, content: FileViewContent) => boolean;
|
|
54
|
+
component: Component<FileViewRendererProps>;
|
|
55
|
+
/** Text renderers that support the edit affordance when `save` is present. */
|
|
56
|
+
editable?: boolean;
|
|
57
|
+
};
|
|
58
|
+
export declare const formatFileViewSize: (bytes: number) => string;
|
|
59
|
+
export default function FileView(props: FileViewProps): JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type LightboxImage = {
|
|
2
|
+
src: string;
|
|
3
|
+
alt?: string;
|
|
4
|
+
downloadUrl?: string;
|
|
5
|
+
};
|
|
6
|
+
type LightboxProps = {
|
|
7
|
+
images: LightboxImage[];
|
|
8
|
+
initialIndex?: number;
|
|
9
|
+
onClose: () => void;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Minimal, accessible lightbox using native <dialog>.
|
|
13
|
+
* Supports keyboard navigation, touch swipe gestures, and screen readers.
|
|
14
|
+
*/
|
|
15
|
+
export default function Lightbox(props: LightboxProps): import("solid-js").JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type LogTableEntry = {
|
|
2
|
+
id: number | string;
|
|
3
|
+
level: string;
|
|
4
|
+
source: string;
|
|
5
|
+
message: string;
|
|
6
|
+
metadata: Record<string, unknown> | null;
|
|
7
|
+
createdAt: string;
|
|
8
|
+
};
|
|
9
|
+
type Props = {
|
|
10
|
+
entries: readonly LogTableEntry[];
|
|
11
|
+
emptyMessage?: string;
|
|
12
|
+
};
|
|
13
|
+
export default function LogEntriesTable(props: Props): import("solid-js").JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
type CommonProps = {
|
|
2
|
+
/** Optional additional CSS classes */
|
|
3
|
+
class?: string;
|
|
4
|
+
/**
|
|
5
|
+
* Visual heading scale. Markdown heading levels and document structure stay
|
|
6
|
+
* unchanged.
|
|
7
|
+
*/
|
|
8
|
+
headingScale?: "compact" | "normal" | "large";
|
|
9
|
+
};
|
|
10
|
+
export type MarkdownViewProps = CommonProps & ({
|
|
11
|
+
/** Untrusted Markdown. Raw HTML and unsafe link protocols are escaped. */
|
|
12
|
+
markdown: string;
|
|
13
|
+
/** Exact standalone text tokens to emphasize without changing Markdown parsing or trusted-HTML boundaries. */
|
|
14
|
+
inlineTokens?: readonly string[];
|
|
15
|
+
trustedHtml?: never;
|
|
16
|
+
} | {
|
|
17
|
+
/** Explicitly trusted, already-rendered HTML. The caller owns sanitization. */
|
|
18
|
+
trustedHtml: string;
|
|
19
|
+
markdown?: never;
|
|
20
|
+
inlineTokens?: never;
|
|
21
|
+
});
|
|
22
|
+
export type MarkdownRenderOptions = {
|
|
23
|
+
inlineTokens?: readonly string[];
|
|
24
|
+
};
|
|
25
|
+
export declare const renderSafeMarkdown: (markdown: string, options?: MarkdownRenderOptions) => string;
|
|
26
|
+
/**
|
|
27
|
+
* Markdown View Component (SSR)
|
|
28
|
+
*
|
|
29
|
+
* Renders untrusted Markdown safely by default. Raw HTML and unsafe link
|
|
30
|
+
* protocols are escaped. Already-rendered HTML requires the deliberately named
|
|
31
|
+
* `trustedHtml` boundary; the caller owns sanitization in that mode.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```tsx
|
|
35
|
+
* import { MarkdownView } from "@k2b/ui";
|
|
36
|
+
*
|
|
37
|
+
* <MarkdownView markdown={source} />;
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @example Compact headings, e.g. inside comments or file previews:
|
|
41
|
+
* ```tsx
|
|
42
|
+
* <MarkdownView markdown={source} headingScale="compact" />;
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export default function MarkdownView(props: MarkdownViewProps): import("solid-js").JSX.Element;
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type LinkNavigateEvent } from "@k2b/ssr/nav";
|
|
2
|
+
import { type JSX } from "solid-js";
|
|
3
|
+
export type PaginationProps = {
|
|
4
|
+
currentPage: number;
|
|
5
|
+
totalPages: number;
|
|
6
|
+
baseUrl: string;
|
|
7
|
+
onNavigate?: (event: LinkNavigateEvent) => void | Promise<void>;
|
|
8
|
+
};
|
|
9
|
+
/** Link-based pagination with directional navigation and compact mobile disclosure. */
|
|
10
|
+
export declare const Pagination: (props: PaginationProps) => JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type PdfPreviewRequest = () => Promise<Response | Blob>;
|
|
2
|
+
export type PdfPreviewProps = {
|
|
3
|
+
request: PdfPreviewRequest;
|
|
4
|
+
disabled?: () => boolean;
|
|
5
|
+
title?: string;
|
|
6
|
+
buttonLabel?: string;
|
|
7
|
+
openButtonLabel?: string;
|
|
8
|
+
emptyText?: string;
|
|
9
|
+
class?: string;
|
|
10
|
+
};
|
|
11
|
+
export default function PdfPreview(props: PdfPreviewProps): import("solid-js").JSX.Element;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RangePicker — the time window every observability surface needs.
|
|
3
|
+
*
|
|
4
|
+
* Rendered as links rather than buttons on purpose: window selection is a
|
|
5
|
+
* server concern (the query, not the rendering), so it belongs in the URL and
|
|
6
|
+
* works without hydration. Callers supply the href per option, which is what
|
|
7
|
+
* lets each page keep its own other params intact — the hand-rolled copies
|
|
8
|
+
* differed exactly there, with one silently dropping every unrelated filter.
|
|
9
|
+
*
|
|
10
|
+
* The vocabulary stays with the caller too. Traces think in `10m…30d`, request
|
|
11
|
+
* telemetry in `1h…30d`, audit in days; a single hardcoded list would be wrong
|
|
12
|
+
* for most of them.
|
|
13
|
+
*/
|
|
14
|
+
export type RangeOption<T extends string> = {
|
|
15
|
+
value: T;
|
|
16
|
+
/** Defaults to the value, which is already short by convention (`24h`). */
|
|
17
|
+
label?: string;
|
|
18
|
+
href: string;
|
|
19
|
+
};
|
|
20
|
+
export type RangePickerProps<T extends string> = {
|
|
21
|
+
options: readonly RangeOption<T>[];
|
|
22
|
+
value: T;
|
|
23
|
+
/** Leading caption. Pass `null` to omit it in tight toolbars. */
|
|
24
|
+
label?: string | null;
|
|
25
|
+
/** Names the control for assistive tech; defaults to the visible label. */
|
|
26
|
+
ariaLabel?: string;
|
|
27
|
+
class?: string;
|
|
28
|
+
};
|
|
29
|
+
export default function RangePicker<T extends string>(props: RangePickerProps<T>): import("solid-js").JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type MaybeAccessor } from "../inputs/field-contract";
|
|
2
|
+
export type StructuredDataPreviewMode = "formatted" | "raw";
|
|
3
|
+
export type StructuredDataValue = null | boolean | number | string | readonly StructuredDataValue[] | {
|
|
4
|
+
readonly [key: string]: StructuredDataValue;
|
|
5
|
+
};
|
|
6
|
+
export declare const isStructuredDataValue: (value: unknown, seen?: WeakSet<object>) => value is StructuredDataValue;
|
|
7
|
+
export type StructuredDataPreviewProps = {
|
|
8
|
+
title?: string;
|
|
9
|
+
data: StructuredDataValue;
|
|
10
|
+
/** Controlled display mode. */
|
|
11
|
+
mode?: MaybeAccessor<StructuredDataPreviewMode>;
|
|
12
|
+
onModeChange?: (mode: StructuredDataPreviewMode) => void;
|
|
13
|
+
/** Initial mode for an uncontrolled preview. */
|
|
14
|
+
defaultMode?: StructuredDataPreviewMode;
|
|
15
|
+
copy?: boolean;
|
|
16
|
+
empty?: string;
|
|
17
|
+
maxRows?: number;
|
|
18
|
+
class?: string;
|
|
19
|
+
};
|
|
20
|
+
export default function StructuredDataPreview(props: StructuredDataPreviewProps): import("solid-js").JSX.Element;
|