@a4ui/core 0.5.0 → 0.7.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/index.d.ts +11 -1
- package/dist/index.js +2466 -1662
- package/dist/ui/CalendarHeatmap.d.ts +26 -0
- package/dist/ui/Cascader.d.ts +38 -0
- package/dist/ui/ColorPicker.d.ts +22 -0
- package/dist/ui/Comment.d.ts +42 -0
- package/dist/ui/DataGrid.d.ts +40 -0
- package/dist/ui/Mentions.d.ts +37 -0
- package/dist/ui/NotificationCenter.d.ts +32 -0
- package/dist/ui/Portal.d.ts +22 -0
- package/dist/ui/Tour.d.ts +35 -0
- package/dist/ui/TreeSelect.d.ts +40 -0
- package/package.json +1 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { JSX } from 'solid-js';
|
|
2
|
+
/** A single day's activity count, keyed by an ISO `YYYY-MM-DD` date. */
|
|
3
|
+
export interface HeatmapValue {
|
|
4
|
+
date: string;
|
|
5
|
+
count: number;
|
|
6
|
+
}
|
|
7
|
+
export interface CalendarHeatmapProps {
|
|
8
|
+
/** Activity counts to plot; dates outside the visible range are ignored. */
|
|
9
|
+
values: HeatmapValue[];
|
|
10
|
+
/** Number of week-columns to show, ending on today. Default 26. */
|
|
11
|
+
weeks?: number;
|
|
12
|
+
class?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* GitHub-contributions-style heatmap: a grid of the last `weeks` weeks ending
|
|
16
|
+
* today, laid out as columns (one per week) of 7 vertically-stacked day-cells
|
|
17
|
+
* (Sun→Sat). Each cell is shaded by its count into 5 intensity levels and shows
|
|
18
|
+
* a native tooltip like "3 on 2026-07-10". A "Less … More" legend sits below.
|
|
19
|
+
* Theme-agnostic (semantic tokens only).
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* <CalendarHeatmap values={[{ date: '2026-07-10', count: 3 }]} weeks={26} />
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare function CalendarHeatmap(props: CalendarHeatmapProps): JSX.Element;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { JSX } from 'solid-js';
|
|
2
|
+
/** A node in a {@link Cascader} tree. `children` makes it a branch column. */
|
|
3
|
+
export interface CascaderOption {
|
|
4
|
+
value: string;
|
|
5
|
+
label: string;
|
|
6
|
+
children?: CascaderOption[];
|
|
7
|
+
}
|
|
8
|
+
export interface CascaderProps {
|
|
9
|
+
options: CascaderOption[];
|
|
10
|
+
/** The currently selected value-path (root → leaf). */
|
|
11
|
+
value?: string[];
|
|
12
|
+
/** Fired when a leaf is chosen, with the full value-path and label-path. */
|
|
13
|
+
onChange: (path: string[], labels: string[]) => void;
|
|
14
|
+
placeholder?: string;
|
|
15
|
+
class?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Cascading multi-level select. Renders a Select-styled trigger showing the
|
|
19
|
+
* selected path (labels joined with " / "); clicking opens a floating panel of
|
|
20
|
+
* side-by-side columns. Hovering an option with children reveals the next
|
|
21
|
+
* column; clicking a leaf commits the selection and closes the panel.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```tsx
|
|
25
|
+
* <Cascader
|
|
26
|
+
* options={[
|
|
27
|
+
* { value: 'mx', label: 'Mexico', children: [
|
|
28
|
+
* { value: 'son', label: 'Sonora' },
|
|
29
|
+
* { value: 'jal', label: 'Jalisco' },
|
|
30
|
+
* ] },
|
|
31
|
+
* ]}
|
|
32
|
+
* value={path()}
|
|
33
|
+
* onChange={(p, labels) => { setPath(p); console.log(labels.join(' / ')) }}
|
|
34
|
+
* placeholder="Select a region"
|
|
35
|
+
* />
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export declare function Cascader(props: CascaderProps): JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { JSX } from 'solid-js';
|
|
2
|
+
export interface ColorPickerProps {
|
|
3
|
+
/** Current color as a `#rrggbb` hex string. */
|
|
4
|
+
value: string;
|
|
5
|
+
/** Called with a valid `#rrggbb` hex whenever the user picks a new color. */
|
|
6
|
+
onChange: (hex: string) => void;
|
|
7
|
+
/** Preset colors shown as clickable swatches. Defaults to a small palette. */
|
|
8
|
+
swatches?: string[];
|
|
9
|
+
class?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Controlled color picker: a native color well, a hex text field, and a row of
|
|
13
|
+
* preset swatches. The text field validates against `#rrggbb` and only reports
|
|
14
|
+
* complete, valid hex values while letting you type freely in between.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* const [color, setColor] = createSignal('#3b82f6')
|
|
19
|
+
* <ColorPicker value={color()} onChange={setColor} />
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare function ColorPicker(props: ColorPickerProps): JSX.Element;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { JSX } from 'solid-js';
|
|
2
|
+
/** A single comment node, optionally carrying its own nested `replies`. */
|
|
3
|
+
export interface CommentData {
|
|
4
|
+
/** Unique identifier for the comment. */
|
|
5
|
+
id: string;
|
|
6
|
+
/** Display name of the comment's author. */
|
|
7
|
+
author: string;
|
|
8
|
+
/** Author avatar image URL; falls back to the author's initials. */
|
|
9
|
+
avatar?: string;
|
|
10
|
+
/** Human-readable timestamp shown next to the author. */
|
|
11
|
+
time?: string;
|
|
12
|
+
/** The comment body. */
|
|
13
|
+
content: JSX.Element;
|
|
14
|
+
/** Nested replies, rendered recursively below the comment. */
|
|
15
|
+
replies?: CommentData[];
|
|
16
|
+
}
|
|
17
|
+
export interface CommentProps {
|
|
18
|
+
comment: CommentData;
|
|
19
|
+
/** Renders an actions row (e.g. reply/like) for a given comment. */
|
|
20
|
+
actions?: (comment: CommentData) => JSX.Element;
|
|
21
|
+
class?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Threaded comment layout: a left-aligned {@link Avatar} beside the author,
|
|
25
|
+
* timestamp, content, and an optional actions row. Any `replies` are rendered
|
|
26
|
+
* recursively in a left-indented, bordered thread, inheriting the same `actions`.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```tsx
|
|
30
|
+
* <Comment
|
|
31
|
+
* comment={{
|
|
32
|
+
* id: '1',
|
|
33
|
+
* author: 'Jane Doe',
|
|
34
|
+
* time: '2h ago',
|
|
35
|
+
* content: <p>Great work on this!</p>,
|
|
36
|
+
* replies: [{ id: '2', author: 'John Smith', content: <p>Agreed.</p> }],
|
|
37
|
+
* }}
|
|
38
|
+
* actions={(c) => <button>Reply to {c.author}</button>}
|
|
39
|
+
* />
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export declare function Comment(props: CommentProps): JSX.Element;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { JSX } from 'solid-js';
|
|
2
|
+
/** A single column definition for {@link DataGrid}. */
|
|
3
|
+
export interface DataGridColumn {
|
|
4
|
+
/** Row property this column reads (also used as the sort key). */
|
|
5
|
+
key: string;
|
|
6
|
+
/** Column heading text. */
|
|
7
|
+
header: string;
|
|
8
|
+
/** When true, the header becomes a button that cycles asc → desc → none. */
|
|
9
|
+
sortable?: boolean;
|
|
10
|
+
/** Custom cell renderer; falls back to `String(row[key])` when omitted. */
|
|
11
|
+
render?: (row: Record<string, unknown>) => JSX.Element;
|
|
12
|
+
}
|
|
13
|
+
/** Props for {@link DataGrid}. */
|
|
14
|
+
export interface DataGridProps {
|
|
15
|
+
columns: DataGridColumn[];
|
|
16
|
+
rows: Record<string, unknown>[];
|
|
17
|
+
/** Rows per page. Defaults to 10. */
|
|
18
|
+
pageSize?: number;
|
|
19
|
+
/** Show the global text filter above the table. Defaults to true. */
|
|
20
|
+
filterable?: boolean;
|
|
21
|
+
class?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Sortable + filterable table. Provide `columns` and `rows`; the grid handles
|
|
25
|
+
* global text filtering, per-column sorting (click a sortable header to cycle
|
|
26
|
+
* ascending → descending → unsorted), and pagination on its own.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```tsx
|
|
30
|
+
* <DataGrid
|
|
31
|
+
* columns={[
|
|
32
|
+
* { key: 'name', header: 'Name', sortable: true },
|
|
33
|
+
* { key: 'age', header: 'Age', sortable: true },
|
|
34
|
+
* ]}
|
|
35
|
+
* rows={[{ name: 'Alfredo', age: 30 }, { name: 'Sonora', age: 12 }]}
|
|
36
|
+
* pageSize={25}
|
|
37
|
+
* />
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare function DataGrid(props: DataGridProps): JSX.Element;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { JSX } from 'solid-js';
|
|
2
|
+
export interface MentionOption {
|
|
3
|
+
value: string;
|
|
4
|
+
label: string;
|
|
5
|
+
}
|
|
6
|
+
export interface MentionsProps {
|
|
7
|
+
value: string;
|
|
8
|
+
/** Called with the new string value on every input (not the raw DOM event). */
|
|
9
|
+
onChange: (value: string) => void;
|
|
10
|
+
/** Options offered while typing an `@mention`. */
|
|
11
|
+
options: MentionOption[];
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
class?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Controlled multi-line text field that shows an autocomplete dropdown while
|
|
17
|
+
* the user types an `@mention`. On each input, the text before the caret is
|
|
18
|
+
* checked for a trailing `@query`; matching {@link MentionOption}s (by `label`
|
|
19
|
+
* or `value`, case-insensitive) are offered in a panel. Selecting one replaces
|
|
20
|
+
* the `@query` with `@{label} `. Arrow keys move the highlight, Enter accepts,
|
|
21
|
+
* Escape dismisses.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```tsx
|
|
25
|
+
* const [body, setBody] = createSignal('')
|
|
26
|
+
* <Mentions
|
|
27
|
+
* value={body()}
|
|
28
|
+
* onChange={setBody}
|
|
29
|
+
* options={[
|
|
30
|
+
* { value: 'ada', label: 'Ada Lovelace' },
|
|
31
|
+
* { value: 'alan', label: 'Alan Turing' },
|
|
32
|
+
* ]}
|
|
33
|
+
* placeholder="Write a note, use @ to mention someone"
|
|
34
|
+
* />
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare function Mentions(props: MentionsProps): JSX.Element;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { JSX } from 'solid-js';
|
|
2
|
+
/** A single entry rendered by {@link NotificationCenter}. */
|
|
3
|
+
export interface NotificationItem {
|
|
4
|
+
id: string;
|
|
5
|
+
title: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
time?: string;
|
|
8
|
+
read?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface NotificationCenterProps {
|
|
11
|
+
/** Notifications to display, newest first. */
|
|
12
|
+
items: NotificationItem[];
|
|
13
|
+
/** Called with an item's id when its dismiss button is clicked. */
|
|
14
|
+
onDismiss?: (id: string) => void;
|
|
15
|
+
/** Called when the "Mark all read" action is clicked. */
|
|
16
|
+
onMarkAllRead?: () => void;
|
|
17
|
+
class?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Bell button that opens a popover listing notifications, with an unread count
|
|
21
|
+
* badge, per-item dismiss, and a "mark all read" action. Built on {@link Popover}.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```tsx
|
|
25
|
+
* <NotificationCenter
|
|
26
|
+
* items={items}
|
|
27
|
+
* onDismiss={(id) => remove(id)}
|
|
28
|
+
* onMarkAllRead={() => markAll()}
|
|
29
|
+
* />
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare function NotificationCenter(props: NotificationCenterProps): JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { JSX } from 'solid-js';
|
|
2
|
+
/** Props for {@link Portal}. */
|
|
3
|
+
export interface PortalProps {
|
|
4
|
+
/** Where to mount. Defaults to `document.body`. */
|
|
5
|
+
mount?: Node;
|
|
6
|
+
/** Use a Shadow DOM root for the portal container. */
|
|
7
|
+
useShadow?: boolean;
|
|
8
|
+
children: JSX.Element;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Renders its children into a different place in the DOM (by default
|
|
12
|
+
* `document.body`), so overlays aren't clipped by an ancestor's `overflow` or
|
|
13
|
+
* transformed stacking context. Built on Solid's `Portal`.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* <Portal>
|
|
18
|
+
* <div class="fixed inset-0 grid place-items-center">Floating layer</div>
|
|
19
|
+
* </Portal>
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare function Portal(props: PortalProps): JSX.Element;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { JSX } from 'solid-js';
|
|
2
|
+
/** A single stop in a {@link Tour}. */
|
|
3
|
+
export interface TourStep {
|
|
4
|
+
/** CSS selector for the element to highlight. */
|
|
5
|
+
target: string;
|
|
6
|
+
title: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface TourProps {
|
|
10
|
+
steps: TourStep[];
|
|
11
|
+
open: boolean;
|
|
12
|
+
onOpenChange: (open: boolean) => void;
|
|
13
|
+
/** Called after the last step's "Done" (in addition to `onOpenChange(false)`). */
|
|
14
|
+
onFinish?: () => void;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Guided coachmark tour: walks the user through a sequence of on-page targets,
|
|
18
|
+
* spotlighting each one and explaining it in a floating tooltip. Theme-agnostic —
|
|
19
|
+
* the dimmer uses `--background` so it adapts to light/dark automatically.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* const [open, setOpen] = createSignal(false)
|
|
24
|
+
* <Tour
|
|
25
|
+
* open={open()}
|
|
26
|
+
* onOpenChange={setOpen}
|
|
27
|
+
* onFinish={() => markTourSeen()}
|
|
28
|
+
* steps={[
|
|
29
|
+
* { target: '#new-btn', title: 'Create', description: 'Start a new record here.' },
|
|
30
|
+
* { target: '#search', title: 'Search', description: 'Find anything fast.' },
|
|
31
|
+
* ]}
|
|
32
|
+
* />
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare function Tour(props: TourProps): JSX.Element;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { JSX } from 'solid-js';
|
|
2
|
+
import { TreeNode } from './Tree';
|
|
3
|
+
export interface TreeSelectProps {
|
|
4
|
+
/** Hierarchical options; the same shape consumed by {@link Tree}. */
|
|
5
|
+
nodes: TreeNode[];
|
|
6
|
+
/** Id of the currently selected leaf node. */
|
|
7
|
+
value?: string;
|
|
8
|
+
/** Fired when a leaf is picked, with its id and the node itself. */
|
|
9
|
+
onChange: (value: string, node: TreeNode) => void;
|
|
10
|
+
/** Text shown when no value is selected. */
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
class?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* A dropdown that pairs a {@link Select}-styled trigger with a {@link Tree} in a
|
|
16
|
+
* popover panel. Clicking a branch toggles its subtree; clicking a leaf calls
|
|
17
|
+
* `onChange` and closes the panel. The trigger shows the selected leaf's label
|
|
18
|
+
* (found by walking `nodes`) or a muted `placeholder`. Closes on outside click.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* const [dept, setDept] = createSignal<string>()
|
|
23
|
+
* <TreeSelect
|
|
24
|
+
* placeholder="Pick a team"
|
|
25
|
+
* value={dept()}
|
|
26
|
+
* onChange={(id) => setDept(id)}
|
|
27
|
+
* nodes={[
|
|
28
|
+
* {
|
|
29
|
+
* id: 'eng',
|
|
30
|
+
* label: 'Engineering',
|
|
31
|
+
* children: [
|
|
32
|
+
* { id: 'fe', label: 'Frontend' },
|
|
33
|
+
* { id: 'be', label: 'Backend' },
|
|
34
|
+
* ],
|
|
35
|
+
* },
|
|
36
|
+
* ]}
|
|
37
|
+
* />
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare function TreeSelect(props: TreeSelectProps): JSX.Element;
|
package/package.json
CHANGED