atlas-react-kit 0.12.0 → 1.0.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/COMPONENTS.md +201 -100
- package/DESIGN_RULES.md +44 -1
- package/README.md +10 -9
- package/dist/accordion.d.ts +1 -0
- package/dist/alert.d.ts +1 -1
- package/dist/avatar.d.ts +1 -0
- package/dist/badge.d.ts +4 -5
- package/dist/breadcrumb.d.ts +2 -3
- package/dist/button.d.ts +4 -5
- package/dist/calendar.d.ts +2 -0
- package/dist/card.d.ts +3 -0
- package/dist/chart.d.ts +152 -0
- package/dist/chart.js +177 -0
- package/dist/color-legend.d.ts +8 -0
- package/dist/combobox.d.ts +13 -4
- package/dist/combobox.js +1 -8
- package/dist/date-picker.d.ts +16 -6
- package/dist/date-picker.js +13 -20
- package/dist/date-time-picker.d.ts +5 -2
- package/dist/date-time-picker.js +6 -5
- package/dist/dialog.d.ts +1 -0
- package/dist/dialog.js +4 -2
- package/dist/dropdown-menu.d.ts +9 -8
- package/dist/empty-panel.d.ts +8 -2
- package/dist/empty-panel.js +2 -2
- package/dist/error-boundary.d.ts +7 -2
- package/dist/field.d.ts +4 -1
- package/dist/field.js +1 -1
- package/dist/form/checkbox-field.d.ts +45 -0
- package/dist/form/checkbox-field.js +39 -0
- package/dist/form/combobox-field.d.ts +13 -0
- package/dist/form/combobox-field.js +14 -0
- package/dist/form/control-field.d.ts +30 -0
- package/dist/form/control-field.js +22 -0
- package/dist/form/date-picker-field.d.ts +7 -21
- package/dist/form/date-picker-field.js +4 -4
- package/dist/form/date-time-picker-field.d.ts +7 -22
- package/dist/form/date-time-picker-field.js +3 -3
- package/dist/form/feedback-field.d.ts +2 -0
- package/dist/form/field-error.d.ts +49 -0
- package/dist/form/field-shell.d.ts +47 -8
- package/dist/form/field-shell.js +24 -7
- package/dist/form/markdown-field.d.ts +4 -16
- package/dist/form/markdown-field.js +2 -2
- package/dist/form/select-field.d.ts +7 -7
- package/dist/form/select-field.js +2 -2
- package/dist/form/text-field.d.ts +29 -12
- package/dist/form/text-field.js +10 -6
- package/dist/form/toggle-group-field.d.ts +30 -0
- package/dist/form/toggle-group-field.js +19 -0
- package/dist/info-tip.d.ts +10 -1
- package/dist/internal/as-child.d.ts +8 -0
- package/dist/internal/as-child.js +1 -0
- package/dist/internal/date-like.d.ts +23 -0
- package/dist/internal/form-control.d.ts +3 -2
- package/dist/internal/form-control.js +3 -2
- package/dist/internal/kanban-layout.d.ts +55 -0
- package/dist/internal/kanban-layout.js +80 -0
- package/dist/internal/kanban-plugins.d.ts +17 -0
- package/dist/internal/kanban-plugins.js +17 -0
- package/dist/internal/use-media-query.d.ts +4 -2
- package/dist/internal/use-media-query.js +11 -15
- package/dist/kanban.d.ts +84 -0
- package/dist/kanban.js +197 -0
- package/dist/markdown.d.ts +2 -0
- package/dist/meter.d.ts +7 -0
- package/dist/nav-link.d.ts +23 -0
- package/dist/nav-link.js +31 -0
- package/dist/next/nav-link.d.ts +11 -0
- package/dist/next/nav-link.js +14 -0
- package/dist/next/period-stepper.d.ts +11 -0
- package/dist/next/period-stepper.js +16 -0
- package/dist/page-header.d.ts +19 -0
- package/dist/page-header.js +11 -0
- package/dist/pagination.d.ts +2 -0
- package/dist/period-stepper.d.ts +32 -0
- package/dist/period-stepper.js +27 -0
- package/dist/picker-shell.d.ts +43 -6
- package/dist/picker-shell.js +2 -2
- package/dist/progress.d.ts +1 -0
- package/dist/search-picker.d.ts +12 -0
- package/dist/select.d.ts +1 -0
- package/dist/skip-link.d.ts +7 -0
- package/dist/skip-link.js +10 -0
- package/dist/slider.d.ts +11 -0
- package/dist/sortable-table-head.d.ts +2 -0
- package/dist/stat-tile.d.ts +5 -0
- package/dist/table-body-skeleton.d.ts +2 -0
- package/dist/table.d.ts +1 -0
- package/dist/tabs.d.ts +9 -5
- package/dist/tabs.js +1 -1
- package/dist/toast.d.ts +7 -1
- package/dist/toggle-group.d.ts +9 -2
- package/dist/toggle-group.js +2 -1
- package/dist/toggle.d.ts +1 -1
- package/package.json +85 -11
- package/skills/atlas-react-kit/SKILL.md +2 -0
- package/theme.css +11 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import Link from "next/link.js";
|
|
4
|
+
import { PeriodStepperFrame, } from "../period-stepper.js";
|
|
5
|
+
/**
|
|
6
|
+
* Next.js `PeriodStepper`: each step is a prefetched link, so the period
|
|
7
|
+
* lives in the URL. Leave out `todayHref` to drop the Today link.
|
|
8
|
+
*/
|
|
9
|
+
function PeriodStepper({ previousHref, todayHref, nextHref, ...props }) {
|
|
10
|
+
const hrefs = { previous: previousHref, today: todayHref, next: nextHref };
|
|
11
|
+
return (_jsx(PeriodStepperFrame, { ...props, control: (step, content) => {
|
|
12
|
+
const href = hrefs[step];
|
|
13
|
+
return href ? (_jsx(Link, { href: href, prefetch: true, children: content })) : null;
|
|
14
|
+
} }));
|
|
15
|
+
}
|
|
16
|
+
export { PeriodStepper };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* A page's title row: the heading, an optional hint, anything else that
|
|
4
|
+
* belongs under them (badges, meta), and actions on the right. Stacks on
|
|
5
|
+
* small screens.
|
|
6
|
+
*/
|
|
7
|
+
declare function PageHeader({ title, description, actions, titleAs: Title, titleClassName, className, children, ...props }: {
|
|
8
|
+
/** The page heading. */
|
|
9
|
+
title: React.ReactNode;
|
|
10
|
+
/** Muted hint under the title. */
|
|
11
|
+
description?: React.ReactNode;
|
|
12
|
+
/** Buttons or links on the right (stacked below on small screens). */
|
|
13
|
+
actions?: React.ReactNode;
|
|
14
|
+
/** Heading level. Default `h1`. */
|
|
15
|
+
titleAs?: "h1" | "h2" | "h3";
|
|
16
|
+
/** Classes for the heading. */
|
|
17
|
+
titleClassName?: string;
|
|
18
|
+
} & Omit<React.ComponentProps<"header">, "title">): React.JSX.Element;
|
|
19
|
+
export { PageHeader };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "./utils.js";
|
|
3
|
+
/**
|
|
4
|
+
* A page's title row: the heading, an optional hint, anything else that
|
|
5
|
+
* belongs under them (badges, meta), and actions on the right. Stacks on
|
|
6
|
+
* small screens.
|
|
7
|
+
*/
|
|
8
|
+
function PageHeader({ title, description, actions, titleAs: Title = "h1", titleClassName, className, children, ...props }) {
|
|
9
|
+
return (_jsxs("header", { "data-slot": "page-header", className: cn("flex flex-col gap-3 sm:flex-row sm:flex-wrap sm:items-start sm:justify-between", className), ...props, children: [_jsxs("div", { "data-slot": "page-header-heading", className: "flex min-w-0 flex-col gap-1", children: [_jsx(Title, { "data-slot": "page-header-title", className: cn("text-2xl font-semibold tracking-tight", titleClassName), children: title }), description ? (_jsx("p", { "data-slot": "page-header-description", className: "text-sm text-muted-foreground", children: description })) : null, children] }), actions ? (_jsx("div", { "data-slot": "page-header-actions", className: "flex flex-wrap items-center gap-2", children: actions })) : null] }));
|
|
10
|
+
}
|
|
11
|
+
export { PageHeader };
|
package/dist/pagination.d.ts
CHANGED
|
@@ -9,7 +9,9 @@ declare function Pagination({ className, ...props }: React.ComponentProps<"nav">
|
|
|
9
9
|
declare function PaginationContent({ className, ...props }: React.ComponentProps<"ul">): React.JSX.Element;
|
|
10
10
|
declare function PaginationItem({ ...props }: React.ComponentProps<"li">): React.JSX.Element;
|
|
11
11
|
type PaginationLinkProps = {
|
|
12
|
+
/** This link is the current page: `aria-current="page"` and the selected wash. */
|
|
12
13
|
isActive?: boolean;
|
|
14
|
+
/** `icon` (default) is a square page number; `default` fits text such as Previous. */
|
|
13
15
|
size?: "default" | "icon";
|
|
14
16
|
/**
|
|
15
17
|
* No page to go to, such as Previous on the first page. Renders without
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
type PeriodStepperFrameProps = {
|
|
3
|
+
/** The range shown, announced when it changes. */
|
|
4
|
+
label: React.ReactNode;
|
|
5
|
+
/** What one step moves ("month", "week"), for the button names. */
|
|
6
|
+
stepLabel: string;
|
|
7
|
+
/** Classes for the range heading. */
|
|
8
|
+
labelClassName?: string;
|
|
9
|
+
} & Omit<React.ComponentProps<"div">, "children">;
|
|
10
|
+
/**
|
|
11
|
+
* Layout under both steppers. `control` renders each step as the element a
|
|
12
|
+
* `Button` wraps (`asChild`), such as another router's link; returning
|
|
13
|
+
* `null` for "today" drops that button.
|
|
14
|
+
*/
|
|
15
|
+
declare function PeriodStepperFrame({ label, stepLabel, labelClassName, className, control, ...props }: PeriodStepperFrameProps & {
|
|
16
|
+
/** Renders the element for each step; return `null` for "today" to drop it. */
|
|
17
|
+
control: (step: "previous" | "today" | "next", content: React.ReactNode) => React.ReactElement | null;
|
|
18
|
+
}): React.JSX.Element;
|
|
19
|
+
/**
|
|
20
|
+
* Previous / Today / Next buttons and the range they show (a month, a
|
|
21
|
+
* week). The app owns the period; for URL-driven periods in Next use
|
|
22
|
+
* `next/period-stepper`. Leave out `onToday` to drop the Today button.
|
|
23
|
+
*/
|
|
24
|
+
declare function PeriodStepper({ onPrevious, onToday, onNext, ...props }: PeriodStepperFrameProps & {
|
|
25
|
+
/** Called when Previous is pressed. */
|
|
26
|
+
onPrevious: () => void;
|
|
27
|
+
/** Called when Today is pressed. Leave out to drop the Today button. */
|
|
28
|
+
onToday?: () => void;
|
|
29
|
+
/** Called when Next is pressed. */
|
|
30
|
+
onNext: () => void;
|
|
31
|
+
}): React.JSX.Element;
|
|
32
|
+
export { PeriodStepper, PeriodStepperFrame, type PeriodStepperFrameProps };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { ChevronLeft, ChevronRight } from "lucide-react";
|
|
4
|
+
import { Button } from "./button.js";
|
|
5
|
+
import { cn } from "./utils.js";
|
|
6
|
+
/**
|
|
7
|
+
* Layout under both steppers. `control` renders each step as the element a
|
|
8
|
+
* `Button` wraps (`asChild`), such as another router's link; returning
|
|
9
|
+
* `null` for "today" drops that button.
|
|
10
|
+
*/
|
|
11
|
+
function PeriodStepperFrame({ label, stepLabel, labelClassName, className, control, ...props }) {
|
|
12
|
+
const today = control("today", "Today");
|
|
13
|
+
return (_jsxs("div", { "data-slot": "period-stepper", className: cn("flex flex-wrap items-center gap-2", className), ...props, children: [_jsx(Button, { variant: "outline", size: "icon-sm", "aria-label": `Previous ${stepLabel}`, asChild: true, children: control("previous", _jsx(ChevronLeft, {})) }), today ? (_jsx(Button, { variant: "outline", size: "sm", asChild: true, children: today })) : null, _jsx(Button, { variant: "outline", size: "icon-sm", "aria-label": `Next ${stepLabel}`, asChild: true, children: control("next", _jsx(ChevronRight, {})) }), _jsx("h2", { "aria-live": "polite", "data-slot": "period-stepper-label", className: cn("text-base font-semibold tabular-nums", labelClassName), children: label })] }));
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Previous / Today / Next buttons and the range they show (a month, a
|
|
17
|
+
* week). The app owns the period; for URL-driven periods in Next use
|
|
18
|
+
* `next/period-stepper`. Leave out `onToday` to drop the Today button.
|
|
19
|
+
*/
|
|
20
|
+
function PeriodStepper({ onPrevious, onToday, onNext, ...props }) {
|
|
21
|
+
const handlers = { previous: onPrevious, today: onToday, next: onNext };
|
|
22
|
+
return (_jsx(PeriodStepperFrame, { ...props, control: (step, content) => {
|
|
23
|
+
const onClick = handlers[step];
|
|
24
|
+
return onClick ? (_jsx("button", { type: "button", onClick: onClick, children: content })) : null;
|
|
25
|
+
} }));
|
|
26
|
+
}
|
|
27
|
+
export { PeriodStepper, PeriodStepperFrame };
|
package/dist/picker-shell.d.ts
CHANGED
|
@@ -1,26 +1,58 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import type {
|
|
3
|
-
import { type DateLike } from "./internal/date-like.js";
|
|
2
|
+
import type { Locale } from "date-fns";
|
|
3
|
+
import { type DateLike, type DateMatcher } from "./internal/date-like.js";
|
|
4
4
|
import { PopoverContent } from "./popover.js";
|
|
5
5
|
/**
|
|
6
6
|
* Not a public entry. The trigger, popover, and Clear footer that
|
|
7
7
|
* `DatePickerButton` and `DateTimePickerButton` share.
|
|
8
8
|
*/
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* Options for the picker's calendar. The picker owns the selection, focus,
|
|
11
|
+
* and month props; these are the kit's own types, so a Day Picker upgrade
|
|
12
|
+
* does not change them.
|
|
13
13
|
*/
|
|
14
|
-
export type PickerCalendarProps =
|
|
14
|
+
export type PickerCalendarProps = {
|
|
15
|
+
/** Days that cannot be picked. */
|
|
16
|
+
disabled?: DateMatcher | DateMatcher[];
|
|
17
|
+
/** Days left out of the grid. */
|
|
18
|
+
hidden?: DateMatcher | DateMatcher[];
|
|
19
|
+
/** Earliest month the calendar pages to. */
|
|
20
|
+
startMonth?: Date;
|
|
21
|
+
/** Latest month the calendar pages to. */
|
|
22
|
+
endMonth?: Date;
|
|
23
|
+
/** First day of the week, `0` (Sunday) to `6`. Defaults to the locale's. */
|
|
24
|
+
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
25
|
+
/** A date-fns locale for month and weekday names. */
|
|
26
|
+
locale?: Locale;
|
|
27
|
+
/** Show the leading and trailing days of the neighbouring months. Default `true`. */
|
|
28
|
+
showOutsideDays?: boolean;
|
|
29
|
+
/** Always show six weeks, so the popover height does not change. */
|
|
30
|
+
fixedWeeks?: boolean;
|
|
31
|
+
/** Show ISO or locale week numbers in a first column. */
|
|
32
|
+
showWeekNumber?: boolean;
|
|
33
|
+
/** Month and year as text (`label`, default) or as dropdowns. */
|
|
34
|
+
captionLayout?: "label" | "dropdown" | "dropdown-months" | "dropdown-years";
|
|
35
|
+
/** The day marked as today. Defaults to the current date. */
|
|
36
|
+
today?: Date;
|
|
37
|
+
/** Classes for the calendar root. */
|
|
38
|
+
className?: string;
|
|
39
|
+
};
|
|
15
40
|
/** Props both pickers take for their trigger and popover. */
|
|
16
41
|
export type PickerTriggerProps = {
|
|
42
|
+
/** Id of the trigger button; the trigger text gets `${id}-value`. */
|
|
17
43
|
id?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Trigger text while nothing is picked. Defaults to "Pick a date", "Pick a
|
|
46
|
+
* date range", or "Pick a date and time" depending on the picker.
|
|
47
|
+
*/
|
|
18
48
|
placeholder?: string;
|
|
49
|
+
/** Disable the trigger so the popover cannot open. */
|
|
19
50
|
disabled?: boolean;
|
|
20
51
|
/** Classes for the trigger button. */
|
|
21
52
|
className?: string;
|
|
22
53
|
/** Classes for the popover content, e.g. a width such as `w-80`. */
|
|
23
54
|
contentClassName?: string;
|
|
55
|
+
/** Mark the trigger invalid, e.g. when its field has an error. */
|
|
24
56
|
"aria-invalid"?: boolean;
|
|
25
57
|
/**
|
|
26
58
|
* Forwarded to the trigger. To name it from a visible label while still
|
|
@@ -61,8 +93,11 @@ type PickerShellProps = Omit<PickerTriggerProps, "placeholder" | "defaultMonth"
|
|
|
61
93
|
label: string;
|
|
62
94
|
/** Accessible name of the popover dialog. */
|
|
63
95
|
dialogLabel: string;
|
|
96
|
+
/** Whether the popover is open. */
|
|
64
97
|
open: boolean;
|
|
98
|
+
/** Called when the popover opens or closes. */
|
|
65
99
|
onOpenChange: (open: boolean) => void;
|
|
100
|
+
/** Called on a pointer down or focus outside the popover; can prevent the dismiss. */
|
|
66
101
|
onInteractOutside?: React.ComponentProps<typeof PopoverContent>["onInteractOutside"];
|
|
67
102
|
children: React.ReactNode;
|
|
68
103
|
};
|
|
@@ -70,7 +105,9 @@ type PickerShellProps = Omit<PickerTriggerProps, "placeholder" | "defaultMonth"
|
|
|
70
105
|
export declare function PickerShell({ id, disabled, className, contentClassName, "aria-invalid": ariaInvalid, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, side, empty, label, dialogLabel, open, onOpenChange, onInteractOutside, children, }: PickerShellProps): React.JSX.Element;
|
|
71
106
|
/** Clear button row under the calendar. */
|
|
72
107
|
export declare function PickerClearFooter({ disabled, onClear, }: {
|
|
108
|
+
/** Disable the Clear button, e.g. while nothing is picked. */
|
|
73
109
|
disabled: boolean;
|
|
110
|
+
/** Called when Clear is pressed. */
|
|
74
111
|
onClear: () => void;
|
|
75
112
|
}): React.JSX.Element;
|
|
76
113
|
export {};
|
package/dist/picker-shell.js
CHANGED
|
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { CalendarIcon } from "lucide-react";
|
|
5
5
|
import { Button } from "./button.js";
|
|
6
|
-
import { toDate } from "./internal/date-like.js";
|
|
6
|
+
import { toDate, } from "./internal/date-like.js";
|
|
7
7
|
import { PICKER_COLLISION_PADDING, pickerContentClassName, pickerTriggerClassName, pickerValueId, } from "./internal/form-control.js";
|
|
8
8
|
import { preloadCalendar } from "./lazy-calendar.js";
|
|
9
9
|
import { Popover, PopoverContent, PopoverTrigger } from "./popover.js";
|
|
@@ -37,7 +37,7 @@ export function limitCalendarProps(calendarProps, minDate, maxDate) {
|
|
|
37
37
|
}
|
|
38
38
|
/** Form-control trigger plus the viewport-clamped calendar popover. */
|
|
39
39
|
export function PickerShell({ id, disabled, className, contentClassName, "aria-invalid": ariaInvalid, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, side, empty, label, dialogLabel, open, onOpenChange, onInteractOutside, children, }) {
|
|
40
|
-
return (_jsxs(Popover, { open: open, onOpenChange: onOpenChange, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs(Button, { id: id, type: "button", variant: "outline", disabled: disabled, "aria-invalid": ariaInvalid, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, "data-empty": empty, className: cn(pickerTriggerClassName, className), onPointerEnter: preloadCalendar, onFocus: preloadCalendar, children: [_jsx(CalendarIcon, { "data-icon": "inline-start" }), _jsx("span", { "data-slot": "date-picker-value", id: id ? pickerValueId(id) : undefined, children: label })] }) }), _jsx(PopoverContent, { align: "start", side: side, collisionPadding: PICKER_COLLISION_PADDING, "aria-label": dialogLabel,
|
|
40
|
+
return (_jsxs(Popover, { open: open, onOpenChange: onOpenChange, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs(Button, { id: id, type: "button", variant: "outline", disabled: disabled, "aria-invalid": ariaInvalid, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, "data-empty": empty, className: cn(pickerTriggerClassName, className), onPointerEnter: preloadCalendar, onFocus: preloadCalendar, children: [_jsx(CalendarIcon, { "data-icon": "inline-start" }), _jsx("span", { "data-slot": "date-picker-value", className: "min-w-0 text-left whitespace-normal", id: id ? pickerValueId(id) : undefined, children: label })] }) }), _jsx(PopoverContent, { align: "start", side: side, collisionPadding: PICKER_COLLISION_PADDING, "aria-label": dialogLabel,
|
|
41
41
|
// The calendar's `autoFocus` puts focus on the selected day (or
|
|
42
42
|
// today) once it loads, as the APG date picker dialog does; Radix
|
|
43
43
|
// focusing the popover first would leave it on the container.
|
package/dist/progress.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { Progress as ProgressPrimitive } from "radix-ui";
|
|
|
7
7
|
* label. `indicatorClassName` styles the fill (default `bg-primary`).
|
|
8
8
|
*/
|
|
9
9
|
declare function Progress({ className, indicatorClassName, value, max, ...props }: React.ComponentProps<typeof ProgressPrimitive.Root> & {
|
|
10
|
+
/** Classes for the fill, e.g. a status color. Defaults to `bg-primary`. */
|
|
10
11
|
indicatorClassName?: string;
|
|
11
12
|
}): React.JSX.Element;
|
|
12
13
|
export { Progress };
|
package/dist/search-picker.d.ts
CHANGED
|
@@ -6,17 +6,29 @@ export { foldSearchText };
|
|
|
6
6
|
*/
|
|
7
7
|
export declare function defaultSearchFilter<T>(item: T, query: string, getLabel: (item: T) => string): boolean;
|
|
8
8
|
export type SearchPickerProps<T> = {
|
|
9
|
+
/** Every choice, in display order. */
|
|
9
10
|
items: T[];
|
|
11
|
+
/** A unique, stable value for an item; matched against `value`. */
|
|
10
12
|
getValue: (item: T) => string;
|
|
13
|
+
/** The item's visible text, also what the default filter searches. */
|
|
11
14
|
getLabel: (item: T) => string;
|
|
15
|
+
/** Whether an item matches the query. Default `defaultSearchFilter` (label contains query, ignoring case and accents). */
|
|
12
16
|
filter?: (item: T, query: string, getLabel: (item: T) => string) => boolean;
|
|
17
|
+
/** The selected item's value, marked in the list. */
|
|
13
18
|
value?: string;
|
|
19
|
+
/** Called with the item picked by click or Enter; the query then clears. */
|
|
14
20
|
onSelect: (item: T) => void;
|
|
21
|
+
/** Visible label for the search input. */
|
|
15
22
|
label: string;
|
|
23
|
+
/** Placeholder for the search input. Default `"Search"`. */
|
|
16
24
|
placeholder?: string;
|
|
25
|
+
/** Text shown when nothing matches the query. Default `"No results"`. */
|
|
17
26
|
emptyText?: string;
|
|
27
|
+
/** Accessible name for the listbox. Defaults to `label`. */
|
|
18
28
|
listLabel?: string;
|
|
29
|
+
/** Disables the input and every option. */
|
|
19
30
|
disabled?: boolean;
|
|
31
|
+
/** Classes for the wrapper, e.g. its width. */
|
|
20
32
|
className?: string;
|
|
21
33
|
/** Classes for the listbox, e.g. its height. Defaults to `max-h-60`. */
|
|
22
34
|
listClassName?: string;
|
package/dist/select.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ declare function Select({ ...props }: React.ComponentProps<typeof SelectPrimitiv
|
|
|
4
4
|
declare function SelectGroup({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Group>): React.JSX.Element;
|
|
5
5
|
declare function SelectValue({ ...props }: React.ComponentProps<typeof SelectPrimitive.Value>): React.JSX.Element;
|
|
6
6
|
declare function SelectTrigger({ className, size, children, ...props }: React.ComponentProps<typeof SelectPrimitive.Trigger> & {
|
|
7
|
+
/** Trigger height: `default` (`h-10`) or `sm` (`h-9`). Default `default`. */
|
|
7
8
|
size?: "sm" | "default";
|
|
8
9
|
}): React.JSX.Element;
|
|
9
10
|
declare function SelectContent({ className, children, position, align, sideOffset, collisionPadding, ...props }: React.ComponentProps<typeof SelectPrimitive.Content>): React.JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* First focusable link on the page: hidden until a keyboard user tabs to
|
|
4
|
+
* it, then it jumps past the navigation to `href` (the main landmark's id).
|
|
5
|
+
*/
|
|
6
|
+
declare function SkipLink({ href, className, children, ...props }: React.ComponentProps<"a">): React.JSX.Element;
|
|
7
|
+
export { SkipLink };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "./utils.js";
|
|
3
|
+
/**
|
|
4
|
+
* First focusable link on the page: hidden until a keyboard user tabs to
|
|
5
|
+
* it, then it jumps past the navigation to `href` (the main landmark's id).
|
|
6
|
+
*/
|
|
7
|
+
function SkipLink({ href = "#main-content", className, children = "Skip to content", ...props }) {
|
|
8
|
+
return (_jsx("a", { "data-slot": "skip-link", href: href, className: cn("sr-only focus:not-sr-only focus:absolute focus:top-4 focus:left-4 focus:z-50 focus:bg-background focus:px-3 focus:py-2 focus:text-sm focus:ring-2 focus:ring-ring", className), ...props, children: children }));
|
|
9
|
+
}
|
|
10
|
+
export { SkipLink };
|
package/dist/slider.d.ts
CHANGED
|
@@ -1,18 +1,29 @@
|
|
|
1
1
|
import type * as React from "react";
|
|
2
2
|
import { Slider as SliderPrimitive } from "radix-ui";
|
|
3
3
|
export type SliderProps = Omit<React.ComponentProps<typeof SliderPrimitive.Root>, "value" | "defaultValue" | "onValueChange" | "onValueCommit" | "children"> & {
|
|
4
|
+
/** The current value; the slider is always controlled. */
|
|
4
5
|
value: number;
|
|
6
|
+
/** Called with the new value on every move while dragging or on a key press. */
|
|
5
7
|
onValueChange: (value: number) => void;
|
|
8
|
+
/** Called with the final value when a drag ends or a key press settles. */
|
|
6
9
|
onValueCommit?: (value: number) => void;
|
|
10
|
+
/** The lowest value. Default 0. */
|
|
7
11
|
min?: number;
|
|
12
|
+
/** The highest value. Default 100. */
|
|
8
13
|
max?: number;
|
|
14
|
+
/** The amount each move snaps to. Default 1. */
|
|
9
15
|
step?: number;
|
|
16
|
+
/** Dims the slider and ignores pointer and keyboard input. */
|
|
10
17
|
disabled?: boolean;
|
|
11
18
|
/** Goes on the thumb, so a `<Label htmlFor>` names the slider. */
|
|
12
19
|
id?: string;
|
|
20
|
+
/** Form field name, so the value submits with a surrounding `<form>`. */
|
|
13
21
|
name?: string;
|
|
22
|
+
/** Classes for the root, e.g. its width. */
|
|
14
23
|
className?: string;
|
|
24
|
+
/** Names the slider when there is no `<Label htmlFor={id}>`. Goes on the thumb. */
|
|
15
25
|
"aria-label"?: string;
|
|
26
|
+
/** Id of the element that names the slider. Goes on the thumb. */
|
|
16
27
|
"aria-labelledby"?: string;
|
|
17
28
|
};
|
|
18
29
|
/**
|
|
@@ -4,7 +4,9 @@ export type SortDirection = "asc" | "desc";
|
|
|
4
4
|
type SortableTableHeadProps = ComponentProps<typeof TableHead> & {
|
|
5
5
|
/** Whether this column is the active sort key. */
|
|
6
6
|
sorted?: boolean;
|
|
7
|
+
/** Sort order shown while `sorted`. Default `asc`. */
|
|
7
8
|
direction?: SortDirection;
|
|
9
|
+
/** Called when the header button is pressed, e.g. to toggle the sort. */
|
|
8
10
|
onClick?: () => void;
|
|
9
11
|
/** Classes for the inner sort button (`data-slot="sortable-table-head-button"`). */
|
|
10
12
|
buttonClassName?: string;
|
package/dist/stat-tile.d.ts
CHANGED
|
@@ -8,10 +8,15 @@ export { sectionLabel };
|
|
|
8
8
|
/** Row of tiles: stacked on phones, divided columns from `sm`. */
|
|
9
9
|
export declare const statTileGrid = "grid ring-1 ring-foreground/5 sm:divide-x";
|
|
10
10
|
export type StatTileProps = Omit<React.ComponentProps<"div">, "children" | "title"> & {
|
|
11
|
+
/** Small uppercase label above the figure. */
|
|
11
12
|
label: string;
|
|
13
|
+
/** The big figure, already formatted. */
|
|
12
14
|
value: string;
|
|
15
|
+
/** Muted line under the figure; hidden when empty. */
|
|
13
16
|
sub?: React.ReactNode;
|
|
17
|
+
/** Extra content between the figure and `sub`, e.g. a `Meter`. */
|
|
14
18
|
children?: React.ReactNode;
|
|
19
|
+
/** Classes for the root `div`. */
|
|
15
20
|
className?: string;
|
|
16
21
|
};
|
|
17
22
|
/**
|
package/dist/table.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ import * as React from "react";
|
|
|
11
11
|
* cap (`max-h-96 overflow-y-auto`) or a border.
|
|
12
12
|
*/
|
|
13
13
|
declare function Table({ className, containerClassName, ...props }: React.ComponentProps<"table"> & {
|
|
14
|
+
/** Classes for the scroller around the table, e.g. a height cap or border. */
|
|
14
15
|
containerClassName?: string;
|
|
15
16
|
}): React.JSX.Element;
|
|
16
17
|
declare function TableHeader({ className, ...props }: React.ComponentProps<"thead">): React.JSX.Element;
|
package/dist/tabs.d.ts
CHANGED
|
@@ -2,15 +2,18 @@ import * as React from "react";
|
|
|
2
2
|
import { type VariantProps } from "class-variance-authority";
|
|
3
3
|
import { Tabs as TabsPrimitive } from "radix-ui";
|
|
4
4
|
import { tabsListVariants, tabsTriggerVariants } from "./internal/tabs-styles.js";
|
|
5
|
+
/** Props `TabsList` and `TabsNav` share for the scroller around their row. */
|
|
6
|
+
type TabsScrollerClassNameProps = {
|
|
7
|
+
/** Classes for the scroller around the tab row (`h-13` with `p-1` by default). */
|
|
8
|
+
scrollerClassName?: string;
|
|
9
|
+
};
|
|
5
10
|
declare function Tabs({ className, orientation, ...props }: React.ComponentProps<typeof TabsPrimitive.Root>): React.JSX.Element;
|
|
6
11
|
/**
|
|
7
12
|
* The tab row inside its scroller. `className` styles the list (its `h-11`
|
|
8
13
|
* height, fill, gap); `scrollerClassName` styles the scroller around it
|
|
9
14
|
* (`h-13` with `p-1` for the active border and focus ring).
|
|
10
15
|
*/
|
|
11
|
-
declare function TabsList({ className, scrollerClassName, variant, ...props }: React.ComponentProps<typeof TabsPrimitive.List> & Omit<VariantProps<typeof tabsListVariants>, "orientation"> &
|
|
12
|
-
scrollerClassName?: string;
|
|
13
|
-
}): React.JSX.Element;
|
|
16
|
+
declare function TabsList({ className, scrollerClassName, variant, ...props }: React.ComponentProps<typeof TabsPrimitive.List> & Omit<VariantProps<typeof tabsListVariants>, "orientation"> & TabsScrollerClassNameProps): React.JSX.Element;
|
|
14
17
|
declare function TabsTrigger({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Trigger>): React.JSX.Element;
|
|
15
18
|
declare function TabsContent({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Content>): React.JSX.Element;
|
|
16
19
|
/**
|
|
@@ -28,9 +31,10 @@ declare function TabsContent({ className, ...props }: React.ComponentProps<typeo
|
|
|
28
31
|
* `overflow-x-auto`. `scrollerClassName` styles that scroller and
|
|
29
32
|
* `listClassName` the row of links inside it.
|
|
30
33
|
*/
|
|
31
|
-
declare function TabsNav({ className, scrollerClassName, listClassName, children, ...props }: React.ComponentProps<"nav"> & {
|
|
34
|
+
declare function TabsNav({ className, scrollerClassName, listClassName, children, ...props }: React.ComponentProps<"nav"> & TabsScrollerClassNameProps & {
|
|
35
|
+
/** Required accessible name for the nav landmark. */
|
|
32
36
|
"aria-label": string;
|
|
33
|
-
|
|
37
|
+
/** Classes for the row of links inside the scroller. */
|
|
34
38
|
listClassName?: string;
|
|
35
39
|
}): React.JSX.Element;
|
|
36
40
|
export { Tabs, TabsList, TabsTrigger, TabsContent, TabsNav, tabsListVariants, tabsTriggerVariants, };
|
package/dist/tabs.js
CHANGED
|
@@ -61,7 +61,7 @@ function TabsTrigger({ className, ...props }) {
|
|
|
61
61
|
return (_jsx(TabsPrimitive.Trigger, { "data-slot": "tabs-trigger", className: cn(tabsTriggerVariants(), className), ...props }));
|
|
62
62
|
}
|
|
63
63
|
function TabsContent({ className, ...props }) {
|
|
64
|
-
return (_jsx(TabsPrimitive.Content, { "data-slot": "tabs-content", className: cn("flex-1 text-sm
|
|
64
|
+
return (_jsx(TabsPrimitive.Content, { "data-slot": "tabs-content", className: cn("flex-1 text-sm", focusRing, className), ...props }));
|
|
65
65
|
}
|
|
66
66
|
/**
|
|
67
67
|
* Tab-styled links for a view switcher that changes the URL. Use this, not
|
package/dist/toast.d.ts
CHANGED
|
@@ -3,7 +3,9 @@ import { type ReactNode } from "react";
|
|
|
3
3
|
type ToastId = string | number;
|
|
4
4
|
/** A button in a toast. Clicking it runs `onClick`, then closes the toast. */
|
|
5
5
|
interface ToastAction {
|
|
6
|
+
/** The button's text. */
|
|
6
7
|
label: string;
|
|
8
|
+
/** Runs when the button is clicked, before the toast closes. */
|
|
7
9
|
onClick: () => void;
|
|
8
10
|
}
|
|
9
11
|
interface ToastOptions {
|
|
@@ -21,9 +23,13 @@ interface ToastOptions {
|
|
|
21
23
|
/** Shows a toast and returns its id. */
|
|
22
24
|
type ShowToast = (message: ReactNode, options?: ToastOptions) => ToastId;
|
|
23
25
|
type Toast = ShowToast & {
|
|
26
|
+
/** A toast with a check icon and a success-toned title and border. */
|
|
24
27
|
success: ShowToast;
|
|
28
|
+
/** A toast with an info icon. */
|
|
25
29
|
info: ShowToast;
|
|
30
|
+
/** A toast with an alert icon and a warning-toned title and border. */
|
|
26
31
|
warning: ShowToast;
|
|
32
|
+
/** A toast with an alert icon and a destructive-toned title and border. */
|
|
27
33
|
error: ShowToast;
|
|
28
34
|
/** A spinner toast that stays until it is replaced (same `id`) or dismissed. */
|
|
29
35
|
loading: ShowToast;
|
|
@@ -36,7 +42,7 @@ interface ToasterProps {
|
|
|
36
42
|
position?: ToastPosition;
|
|
37
43
|
/** A labelled close button on every toast. Default `true`. */
|
|
38
44
|
closeButton?: boolean;
|
|
39
|
-
/** Keep the stack expanded instead of collapsed behind the newest toast. */
|
|
45
|
+
/** Keep the stack expanded instead of collapsed behind the newest toast. Default `false`. */
|
|
40
46
|
expand?: boolean;
|
|
41
47
|
/** How many toasts show at once. Default 3. */
|
|
42
48
|
visibleToasts?: number;
|
package/dist/toggle-group.d.ts
CHANGED
|
@@ -2,9 +2,16 @@ import * as React from "react";
|
|
|
2
2
|
import { type VariantProps } from "class-variance-authority";
|
|
3
3
|
import { ToggleGroup as ToggleGroupPrimitive } from "radix-ui";
|
|
4
4
|
import { toggleVariants } from "./toggle.js";
|
|
5
|
-
|
|
5
|
+
/** Layout props a `ToggleGroup` shares with its items. */
|
|
6
|
+
type ToggleGroupLayoutProps = {
|
|
7
|
+
/**
|
|
8
|
+
* Gap between items, in spacing units. `0` joins them into one segmented
|
|
9
|
+
* control. Default `2`.
|
|
10
|
+
*/
|
|
6
11
|
spacing?: number;
|
|
12
|
+
/** Lay items out in a row or a column. Default `horizontal`. */
|
|
7
13
|
orientation?: "horizontal" | "vertical";
|
|
8
|
-
}
|
|
14
|
+
};
|
|
15
|
+
declare function ToggleGroup({ className, variant, size, spacing, orientation, children, ...props }: React.ComponentProps<typeof ToggleGroupPrimitive.Root> & VariantProps<typeof toggleVariants> & ToggleGroupLayoutProps): React.JSX.Element;
|
|
9
16
|
declare function ToggleGroupItem({ className, children, variant, size, ...props }: React.ComponentProps<typeof ToggleGroupPrimitive.Item> & VariantProps<typeof toggleVariants>): React.JSX.Element;
|
|
10
17
|
export { ToggleGroup, ToggleGroupItem };
|
package/dist/toggle-group.js
CHANGED
|
@@ -12,7 +12,8 @@ const ToggleGroupContext = React.createContext({
|
|
|
12
12
|
orientation: "horizontal",
|
|
13
13
|
});
|
|
14
14
|
function ToggleGroup({ className, variant, size, spacing = 2, orientation = "horizontal", children, ...props }) {
|
|
15
|
-
|
|
15
|
+
const context = React.useMemo(() => ({ variant, size, spacing, orientation }), [variant, size, spacing, orientation]);
|
|
16
|
+
return (_jsx(ToggleGroupPrimitive.Root, { "data-slot": "toggle-group", "data-variant": variant, "data-size": size, "data-spacing": spacing, "data-orientation": orientation, style: { "--gap": spacing }, className: cn("group/toggle-group flex w-fit max-w-full flex-row flex-wrap items-center gap-[--spacing(var(--gap))] data-[spacing=0]:data-[variant=outline]:rounded-none data-vertical:flex-col data-vertical:flex-nowrap data-vertical:items-stretch", className), ...props, children: _jsx(ToggleGroupContext.Provider, { value: context, children: children }) }));
|
|
16
17
|
}
|
|
17
18
|
function ToggleGroupItem({ className, children, variant = "default", size = "default", ...props }) {
|
|
18
19
|
const context = React.useContext(ToggleGroupContext);
|
package/dist/toggle.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { Toggle as TogglePrimitive } from "radix-ui";
|
|
|
9
9
|
declare const selectedToggleChrome: string;
|
|
10
10
|
declare const toggleVariants: (props?: ({
|
|
11
11
|
variant?: "default" | "outline" | null | undefined;
|
|
12
|
-
size?: "default" | "
|
|
12
|
+
size?: "default" | "lg" | "sm" | null | undefined;
|
|
13
13
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
14
14
|
declare function Toggle({ className, variant, size, ...props }: React.ComponentProps<typeof TogglePrimitive.Root> & VariantProps<typeof toggleVariants>): React.JSX.Element;
|
|
15
15
|
export { Toggle, toggleVariants, selectedToggleChrome };
|