@a4ui/core 0.4.3 → 0.6.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/README.md +1 -1
- package/dist/index.d.ts +38 -2
- package/dist/index.js +3262 -1130
- package/dist/layout/ChristmasBackground.d.ts +8 -0
- package/dist/layout/SnowScenery.d.ts +7 -0
- package/dist/styles.css +99 -0
- package/dist/themes/index.d.ts +1 -1
- package/dist/themes/palettes.d.ts +2 -0
- package/dist/ui/Affix.d.ts +21 -0
- package/dist/ui/Anchor.d.ts +28 -0
- package/dist/ui/AvatarGroup.d.ts +29 -0
- package/dist/ui/BackToTop.d.ts +17 -0
- package/dist/ui/BottomNavigation.d.ts +33 -0
- package/dist/ui/Calendar.d.ts +21 -0
- package/dist/ui/Carousel.d.ts +23 -0
- package/dist/ui/Cascader.d.ts +38 -0
- package/dist/ui/Collapse.d.ts +24 -0
- package/dist/ui/Command.d.ts +40 -0
- package/dist/ui/Countdown.d.ts +19 -0
- package/dist/ui/DataGrid.d.ts +40 -0
- package/dist/ui/Descriptions.d.ts +28 -0
- package/dist/ui/Empty.d.ts +27 -0
- package/dist/ui/FloatingActionButton.d.ts +22 -0
- package/dist/ui/Highlight.d.ts +18 -0
- package/dist/ui/Image.d.ts +20 -0
- package/dist/ui/Kbd.d.ts +14 -0
- package/dist/ui/List.d.ts +36 -0
- package/dist/ui/Marquee.d.ts +26 -0
- package/dist/ui/Mentions.d.ts +37 -0
- package/dist/ui/NotificationCenter.d.ts +32 -0
- package/dist/ui/Rating.d.ts +23 -0
- package/dist/ui/Result.d.ts +31 -0
- package/dist/ui/RingProgress.d.ts +23 -0
- package/dist/ui/SpeedDial.d.ts +29 -0
- package/dist/ui/Splitter.d.ts +32 -0
- package/dist/ui/Stepper.d.ts +38 -0
- package/dist/ui/TagInput.d.ts +22 -0
- package/dist/ui/Timeline.d.ts +36 -0
- package/dist/ui/Tour.d.ts +35 -0
- package/dist/ui/Transfer.d.ts +35 -0
- package/dist/ui/Tree.d.ts +41 -0
- package/dist/ui/TreeSelect.d.ts +40 -0
- package/package.json +14 -2
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { JSX, ParentProps } from 'solid-js';
|
|
2
|
+
interface MarqueeProps extends ParentProps {
|
|
3
|
+
/** Seconds for one full loop of the track. Lower is faster. Defaults to `20`. */
|
|
4
|
+
speed?: number;
|
|
5
|
+
/** Pause the scroll while the pointer hovers the strip. Defaults to `true`. */
|
|
6
|
+
pauseOnHover?: boolean;
|
|
7
|
+
class?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A horizontally scrolling strip that loops its children seamlessly. The
|
|
11
|
+
* children are rendered twice inside a flex track; when the first copy has
|
|
12
|
+
* scrolled fully out of view the second copy sits exactly where the first
|
|
13
|
+
* began, so the animation restarts with no visible seam. Honors reduced
|
|
14
|
+
* motion (the track sits still) and, by default, pauses on hover.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* <Marquee speed={30}>
|
|
19
|
+
* <span class="mx-4">A4ui</span>
|
|
20
|
+
* <span class="mx-4">SolidJS</span>
|
|
21
|
+
* <span class="mx-4">Tailwind</span>
|
|
22
|
+
* </Marquee>
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare function Marquee(props: MarqueeProps): JSX.Element;
|
|
26
|
+
export {};
|
|
@@ -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,23 @@
|
|
|
1
|
+
import { JSX } from 'solid-js';
|
|
2
|
+
export interface RatingProps {
|
|
3
|
+
/** Currently selected rating, from 0 to `max`. */
|
|
4
|
+
value: number;
|
|
5
|
+
/** Called with the new rating when a star is clicked or set via keyboard. */
|
|
6
|
+
onChange?: (value: number) => void;
|
|
7
|
+
/** Number of stars to render. Default: 5. */
|
|
8
|
+
max?: number;
|
|
9
|
+
/** Render a non-interactive, display-only rating. Default: false. */
|
|
10
|
+
readonly?: boolean;
|
|
11
|
+
class?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Star rating control. In interactive mode each star is a button: click or use
|
|
15
|
+
* the Left/Right arrow keys to set the rating, and hovering previews it. In
|
|
16
|
+
* `readonly` mode it renders as a static, labelled row of stars.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* <Rating value={rating()} onChange={setRating} max={5} />
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare function Rating(props: RatingProps): JSX.Element;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { JSX } from 'solid-js';
|
|
2
|
+
/** Semantic status of a {@link Result}; drives the icon, tint, and optional HTTP number. */
|
|
3
|
+
export type ResultStatus = 'success' | 'error' | 'info' | 'warning' | '404' | '500';
|
|
4
|
+
export interface ResultProps {
|
|
5
|
+
/** Result status; drives the icon and color. Defaults to `'info'`. */
|
|
6
|
+
status?: ResultStatus;
|
|
7
|
+
/** Bold headline describing the outcome. */
|
|
8
|
+
title: string;
|
|
9
|
+
/** Optional supporting line under the title. */
|
|
10
|
+
description?: string;
|
|
11
|
+
/** Optional action slot (e.g. Buttons) rendered below the text. */
|
|
12
|
+
actions?: JSX.Element;
|
|
13
|
+
class?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Full-status result screen — a large status icon in a tinted circle, a title,
|
|
17
|
+
* optional description, and an optional actions slot — for terminal states such
|
|
18
|
+
* as success/error confirmations or HTTP 404/500 pages. For `'404'`/`'500'` the
|
|
19
|
+
* big HTTP number is shown above the icon.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* <Result
|
|
24
|
+
* status="success"
|
|
25
|
+
* title="Payment complete"
|
|
26
|
+
* description="A receipt has been sent to your email."
|
|
27
|
+
* actions={<Button>Back to dashboard</Button>}
|
|
28
|
+
* />
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare function Result(props: ResultProps): JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { JSX } from 'solid-js';
|
|
2
|
+
export interface RingProgressProps {
|
|
3
|
+
value: number;
|
|
4
|
+
/** Outer diameter of the ring in px. @default 96 */
|
|
5
|
+
size?: number;
|
|
6
|
+
/** Stroke width of the track and arc in px. @default 8 */
|
|
7
|
+
thickness?: number;
|
|
8
|
+
/** Content centered over the ring. Defaults to the rounded percent. */
|
|
9
|
+
label?: JSX.Element;
|
|
10
|
+
class?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Circular progress indicator drawn with two concentric SVG circles: a muted
|
|
14
|
+
* track and a primary arc whose length is derived from `value` (0–100). Use for
|
|
15
|
+
* compact, radial completion feedback where a linear bar would be too wide.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* <RingProgress value={72} />
|
|
20
|
+
* <RingProgress value={40} size={128} thickness={12} label={<span>4/10</span>} />
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare function RingProgress(props: RingProgressProps): JSX.Element;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { JSX } from 'solid-js';
|
|
2
|
+
/** A single action in a {@link SpeedDial} — an icon button with an accessible label. */
|
|
3
|
+
export interface SpeedDialAction {
|
|
4
|
+
icon: JSX.Element;
|
|
5
|
+
label: string;
|
|
6
|
+
onClick: () => void;
|
|
7
|
+
}
|
|
8
|
+
export interface SpeedDialProps {
|
|
9
|
+
actions: SpeedDialAction[];
|
|
10
|
+
/** Icon for the main FAB. Defaults to a `Plus` that rotates to an ✕ when open. */
|
|
11
|
+
icon?: JSX.Element;
|
|
12
|
+
class?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* A fixed floating action button (FAB) pinned to the bottom-right. Clicking the
|
|
16
|
+
* main circular button toggles an open state; while open, `actions` fan out
|
|
17
|
+
* upward as a vertical stack of smaller circular buttons. Selecting an action
|
|
18
|
+
* runs its `onClick` and closes the dial. Theme-agnostic — colors come from
|
|
19
|
+
* semantic tokens only.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* <SpeedDial actions={[
|
|
24
|
+
* { icon: <Share class="h-5 w-5" />, label: 'Share', onClick: () => share() },
|
|
25
|
+
* { icon: <Copy class="h-5 w-5" />, label: 'Copy', onClick: () => copy() },
|
|
26
|
+
* ]} />
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare function SpeedDial(props: SpeedDialProps): JSX.Element;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { JSX } from 'solid-js';
|
|
2
|
+
export interface SplitterProps {
|
|
3
|
+
/** Content of the first pane (left when horizontal, top when vertical). */
|
|
4
|
+
start: JSX.Element;
|
|
5
|
+
/** Content of the second pane (right when horizontal, bottom when vertical). */
|
|
6
|
+
end: JSX.Element;
|
|
7
|
+
/** Layout axis. `'horizontal'` (default) splits side-by-side with a vertical divider; `'vertical'` stacks the panes with a horizontal divider. */
|
|
8
|
+
orientation?: 'horizontal' | 'vertical';
|
|
9
|
+
/** Initial size of the first pane, as a percentage of the container. Defaults to `50`. */
|
|
10
|
+
initial?: number;
|
|
11
|
+
/** Minimum size of the first pane, as a percentage. Defaults to `15`. */
|
|
12
|
+
min?: number;
|
|
13
|
+
/** Maximum size of the first pane, as a percentage. Defaults to `85`. */
|
|
14
|
+
max?: number;
|
|
15
|
+
class?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Two panes separated by a draggable divider that resizes them. Drag the
|
|
19
|
+
* divider with a pointer or focus it and use the Arrow keys to nudge the split.
|
|
20
|
+
* The first pane's size is tracked as a percentage and clamped to `[min, max]`.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```tsx
|
|
24
|
+
* <Splitter
|
|
25
|
+
* orientation="horizontal"
|
|
26
|
+
* initial={40}
|
|
27
|
+
* start={<div class="p-4">Sidebar</div>}
|
|
28
|
+
* end={<div class="p-4">Main content</div>}
|
|
29
|
+
* />
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare function Splitter(props: SplitterProps): JSX.Element;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { JSX } from 'solid-js';
|
|
2
|
+
/** A single step rendered by {@link Stepper}. */
|
|
3
|
+
export interface StepItem {
|
|
4
|
+
/** Text shown beside the step indicator. */
|
|
5
|
+
label: string;
|
|
6
|
+
/** Optional secondary line shown under the label. */
|
|
7
|
+
description?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface StepperProps {
|
|
10
|
+
/** Ordered list of steps to display. */
|
|
11
|
+
steps: StepItem[];
|
|
12
|
+
/** Index of the currently active step; steps before it are completed. */
|
|
13
|
+
active: number;
|
|
14
|
+
/** When provided, indicators become clickable buttons reporting their index. */
|
|
15
|
+
onStepClick?: (index: number) => void;
|
|
16
|
+
/** Layout direction. Defaults to `'horizontal'`. */
|
|
17
|
+
orientation?: 'horizontal' | 'vertical';
|
|
18
|
+
class?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Multi-step progress indicator. Steps before `active` render as completed
|
|
22
|
+
* (with a check), the `active` step is highlighted with a ring, and later
|
|
23
|
+
* steps are dimmed. Pass `onStepClick` to let users jump between steps.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```tsx
|
|
27
|
+
* <Stepper
|
|
28
|
+
* active={1}
|
|
29
|
+
* steps={[
|
|
30
|
+
* { label: 'Account', description: 'Your details' },
|
|
31
|
+
* { label: 'Shipping' },
|
|
32
|
+
* { label: 'Payment' },
|
|
33
|
+
* ]}
|
|
34
|
+
* onStepClick={setActive}
|
|
35
|
+
* />
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export declare function Stepper(props: StepperProps): JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { JSX } from 'solid-js';
|
|
2
|
+
export interface TagInputProps {
|
|
3
|
+
/** Current tags (controlled). */
|
|
4
|
+
value: string[];
|
|
5
|
+
/** Called with the next tag array whenever tags are added or removed. */
|
|
6
|
+
onChange: (tags: string[]) => void;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
class?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Bordered field that turns free text into removable chips. Press Enter or comma
|
|
12
|
+
* to add the trimmed input as a tag (empty and duplicate values are ignored),
|
|
13
|
+
* click a chip's `×` to remove it, or press Backspace on an empty input to drop
|
|
14
|
+
* the last tag. Theme-agnostic — colors come from semantic tokens.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* const [tags, setTags] = createSignal<string[]>(['solid', 'ui'])
|
|
19
|
+
* <TagInput value={tags()} onChange={setTags} placeholder="Add tag…" />
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare function TagInput(props: TagInputProps): JSX.Element;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { JSX } from 'solid-js';
|
|
2
|
+
/** Accent applied to a {@link TimelineItem}'s dot on the line. */
|
|
3
|
+
export type TimelineTone = 'default' | 'primary' | 'success' | 'danger';
|
|
4
|
+
/** A single event rendered by {@link Timeline}. */
|
|
5
|
+
export interface TimelineItem {
|
|
6
|
+
/** Headline for the event (rendered emphasized). */
|
|
7
|
+
title: string;
|
|
8
|
+
/** Optional supporting copy shown under the title. */
|
|
9
|
+
description?: string;
|
|
10
|
+
/** Optional timestamp / relative time label. */
|
|
11
|
+
time?: string;
|
|
12
|
+
/** Accent for the dot on the line. Defaults to `'default'`. */
|
|
13
|
+
tone?: TimelineTone;
|
|
14
|
+
}
|
|
15
|
+
export interface TimelineProps {
|
|
16
|
+
items: TimelineItem[];
|
|
17
|
+
class?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Vertical timeline of events. A continuous line runs down the left with a
|
|
21
|
+
* tone-colored dot marking each entry; to the right sit the title, an optional
|
|
22
|
+
* right-aligned time, and an optional description. The line segment stops at the
|
|
23
|
+
* last item's dot. Renders as a semantic `<ol>`/`<li>` list.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```tsx
|
|
27
|
+
* <Timeline
|
|
28
|
+
* items={[
|
|
29
|
+
* { title: 'Order placed', time: '09:24', tone: 'primary' },
|
|
30
|
+
* { title: 'Shipped', description: 'Left the warehouse.', time: '11:02', tone: 'success' },
|
|
31
|
+
* { title: 'Delayed', description: 'Weather hold.', time: '14:30', tone: 'danger' },
|
|
32
|
+
* ]}
|
|
33
|
+
* />
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare function Timeline(props: TimelineProps): 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,35 @@
|
|
|
1
|
+
import { JSX } from 'solid-js';
|
|
2
|
+
/** A single option shown in either pane of a {@link Transfer}. */
|
|
3
|
+
export interface TransferItem {
|
|
4
|
+
value: string;
|
|
5
|
+
label: string;
|
|
6
|
+
}
|
|
7
|
+
export interface TransferProps {
|
|
8
|
+
/** Full pool of options; membership in `selected` decides which pane each lands in. */
|
|
9
|
+
items: TransferItem[];
|
|
10
|
+
/** Values currently in the right ("selected") pane. */
|
|
11
|
+
selected: string[];
|
|
12
|
+
/** Called with the next selected-value array whenever items are moved across. */
|
|
13
|
+
onChange: (selected: string[]) => void;
|
|
14
|
+
/** Pane headers, `[availableTitle, selectedTitle]`. Defaults to `['Available', 'Selected']`. */
|
|
15
|
+
titles?: [string, string];
|
|
16
|
+
class?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Dual-list picker: two side-by-side panes let the user shuttle items between
|
|
20
|
+
* an "available" pool and a "selected" set. Tick rows in either pane, then use
|
|
21
|
+
* the middle chevrons to move the ticked items across; `onChange` receives the
|
|
22
|
+
* updated array of selected values.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```tsx
|
|
26
|
+
* const [picked, setPicked] = createSignal<string[]>(['a'])
|
|
27
|
+
* <Transfer
|
|
28
|
+
* items={[{ value: 'a', label: 'Apple' }, { value: 'b', label: 'Banana' }]}
|
|
29
|
+
* selected={picked()}
|
|
30
|
+
* onChange={setPicked}
|
|
31
|
+
* titles={['Fruits', 'Basket']}
|
|
32
|
+
* />
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare function Transfer(props: TransferProps): JSX.Element;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { JSX } from 'solid-js';
|
|
2
|
+
/** A single node in a {@link Tree}; nodes may nest via `children`. */
|
|
3
|
+
export interface TreeNode {
|
|
4
|
+
/** Unique identifier; used to track expanded state. */
|
|
5
|
+
id: string;
|
|
6
|
+
/** Text shown in the node's row. */
|
|
7
|
+
label: string;
|
|
8
|
+
/** Optional icon rendered before the label. */
|
|
9
|
+
icon?: JSX.Element;
|
|
10
|
+
/** Child nodes revealed when this node is expanded. */
|
|
11
|
+
children?: TreeNode[];
|
|
12
|
+
}
|
|
13
|
+
export interface TreeProps {
|
|
14
|
+
nodes: TreeNode[];
|
|
15
|
+
/** Ids of nodes expanded on first render. */
|
|
16
|
+
defaultExpanded?: string[];
|
|
17
|
+
class?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Accessible, indented tree view. Nodes with children render a chevron that
|
|
21
|
+
* rotates when expanded; clicking a row toggles its subtree. Expanded state is
|
|
22
|
+
* tracked internally, seeded from `defaultExpanded`.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```tsx
|
|
26
|
+
* <Tree
|
|
27
|
+
* defaultExpanded={['src']}
|
|
28
|
+
* nodes={[
|
|
29
|
+
* {
|
|
30
|
+
* id: 'src',
|
|
31
|
+
* label: 'src',
|
|
32
|
+
* children: [
|
|
33
|
+
* { id: 'index', label: 'index.ts' },
|
|
34
|
+
* { id: 'ui', label: 'ui', children: [{ id: 'tree', label: 'Tree.tsx' }] },
|
|
35
|
+
* ],
|
|
36
|
+
* },
|
|
37
|
+
* ]}
|
|
38
|
+
* />
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare function Tree(props: TreeProps): 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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@a4ui/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "A4ui — Spatial Glass design system & component library for SolidJS (Kobalte behavior + Tailwind glass tokens + motion).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -60,7 +60,17 @@
|
|
|
60
60
|
"test:ui": "playwright test --ui",
|
|
61
61
|
"test:a11y": "playwright test a11y --project=desktop",
|
|
62
62
|
"test:report": "playwright show-report",
|
|
63
|
-
"prepublishOnly": "npm run build"
|
|
63
|
+
"prepublishOnly": "npm run build",
|
|
64
|
+
"prepare": "husky"
|
|
65
|
+
},
|
|
66
|
+
"lint-staged": {
|
|
67
|
+
"*.{ts,tsx}": [
|
|
68
|
+
"eslint --fix",
|
|
69
|
+
"prettier --write"
|
|
70
|
+
],
|
|
71
|
+
"*.{js,mjs,cjs,json,css,md,yml,html}": [
|
|
72
|
+
"prettier --write"
|
|
73
|
+
]
|
|
64
74
|
},
|
|
65
75
|
"peerDependencies": {
|
|
66
76
|
"solid-js": "^1.9.13"
|
|
@@ -84,7 +94,9 @@
|
|
|
84
94
|
"eslint": "^9.39.5",
|
|
85
95
|
"eslint-config-prettier": "^10.1.8",
|
|
86
96
|
"eslint-plugin-solid": "^0.14.5",
|
|
97
|
+
"husky": "^9.1.7",
|
|
87
98
|
"jsdom": "^29.1.1",
|
|
99
|
+
"lint-staged": "^16.4.0",
|
|
88
100
|
"playwright-core": "^1.61.1",
|
|
89
101
|
"prettier": "^3.9.5",
|
|
90
102
|
"tailwindcss": "^3.4.19",
|