@openwarelabs/ui 0.0.0-stage → 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/LICENSE +21 -0
- package/README.md +100 -2
- package/dist/components/Accordion/Accordion.d.cts +54 -0
- package/dist/components/Accordion/Accordion.d.ts +54 -0
- package/dist/components/Alert/Alert.d.cts +18 -0
- package/dist/components/Alert/Alert.d.ts +18 -0
- package/dist/components/Avatar/Avatar.d.cts +14 -0
- package/dist/components/Avatar/Avatar.d.ts +14 -0
- package/dist/components/Avatar/AvatarGroup.d.cts +28 -0
- package/dist/components/Avatar/AvatarGroup.d.ts +28 -0
- package/dist/components/Badge/Badge.d.cts +13 -0
- package/dist/components/Badge/Badge.d.ts +13 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.d.cts +33 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +33 -0
- package/dist/components/Button/Button.d.cts +42 -0
- package/dist/components/Button/Button.d.ts +42 -0
- package/dist/components/Button/ButtonGroup.d.cts +33 -0
- package/dist/components/Button/ButtonGroup.d.ts +33 -0
- package/dist/components/Calendar/Calendar.d.cts +31 -0
- package/dist/components/Calendar/Calendar.d.ts +31 -0
- package/dist/components/Calendar/DatePicker.d.cts +21 -0
- package/dist/components/Calendar/DatePicker.d.ts +21 -0
- package/dist/components/Calendar/dates.d.cts +15 -0
- package/dist/components/Calendar/dates.d.ts +15 -0
- package/dist/components/Card/Card.d.cts +18 -0
- package/dist/components/Card/Card.d.ts +18 -0
- package/dist/components/Checkbox/Checkbox.d.cts +59 -0
- package/dist/components/Checkbox/Checkbox.d.ts +59 -0
- package/dist/components/ChoiceCard/ChoiceCard.d.cts +14 -0
- package/dist/components/ChoiceCard/ChoiceCard.d.ts +14 -0
- package/dist/components/CodeBlock/CodeBlock.d.cts +50 -0
- package/dist/components/CodeBlock/CodeBlock.d.ts +50 -0
- package/dist/components/ColorPicker/ColorPicker.d.cts +62 -0
- package/dist/components/ColorPicker/ColorPicker.d.ts +62 -0
- package/dist/components/Combobox/Combobox.d.cts +42 -0
- package/dist/components/Combobox/Combobox.d.ts +42 -0
- package/dist/components/CommandPalette/CommandPalette.d.cts +27 -0
- package/dist/components/CommandPalette/CommandPalette.d.ts +27 -0
- package/dist/components/CommandPalette/filterCommands.d.cts +3 -0
- package/dist/components/CommandPalette/filterCommands.d.ts +3 -0
- package/dist/components/Dialog/Dialog.d.cts +42 -0
- package/dist/components/Dialog/Dialog.d.ts +42 -0
- package/dist/components/Drawer/Drawer.d.cts +23 -0
- package/dist/components/Drawer/Drawer.d.ts +23 -0
- package/dist/components/EmptyState/EmptyState.d.cts +18 -0
- package/dist/components/EmptyState/EmptyState.d.ts +18 -0
- package/dist/components/Field/Field.d.cts +18 -0
- package/dist/components/Field/Field.d.ts +18 -0
- package/dist/components/FileDropZone/FileDropZone.d.cts +29 -0
- package/dist/components/FileDropZone/FileDropZone.d.ts +29 -0
- package/dist/components/FileTree/FileTree.d.cts +29 -0
- package/dist/components/FileTree/FileTree.d.ts +29 -0
- package/dist/components/Input/Input.d.cts +18 -0
- package/dist/components/Input/Input.d.ts +18 -0
- package/dist/components/InputOTP/InputOTP.d.cts +31 -0
- package/dist/components/InputOTP/InputOTP.d.ts +31 -0
- package/dist/components/Kbd/Kbd.d.cts +5 -0
- package/dist/components/Kbd/Kbd.d.ts +5 -0
- package/dist/components/Layout/Layout.d.cts +50 -0
- package/dist/components/Layout/Layout.d.ts +50 -0
- package/dist/components/Marketing/Marketing.d.cts +39 -0
- package/dist/components/Marketing/Marketing.d.ts +39 -0
- package/dist/components/Menu/Menu.d.cts +43 -0
- package/dist/components/Menu/Menu.d.ts +43 -0
- package/dist/components/NavList/NavList.d.cts +27 -0
- package/dist/components/NavList/NavList.d.ts +27 -0
- package/dist/components/NumberField/NumberField.d.cts +23 -0
- package/dist/components/NumberField/NumberField.d.ts +23 -0
- package/dist/components/Pagination/Pagination.d.cts +24 -0
- package/dist/components/Pagination/Pagination.d.ts +24 -0
- package/dist/components/Popover/Popover.d.cts +30 -0
- package/dist/components/Popover/Popover.d.ts +30 -0
- package/dist/components/Progress/Progress.d.cts +41 -0
- package/dist/components/Progress/Progress.d.ts +41 -0
- package/dist/components/RadioGroup/RadioGroup.d.cts +36 -0
- package/dist/components/RadioGroup/RadioGroup.d.ts +36 -0
- package/dist/components/SearchField/SearchField.d.cts +17 -0
- package/dist/components/SearchField/SearchField.d.ts +17 -0
- package/dist/components/SegmentedControl/SegmentedControl.d.cts +32 -0
- package/dist/components/SegmentedControl/SegmentedControl.d.ts +32 -0
- package/dist/components/Select/Select.d.cts +40 -0
- package/dist/components/Select/Select.d.ts +40 -0
- package/dist/components/Skeleton/Skeleton.d.cts +26 -0
- package/dist/components/Skeleton/Skeleton.d.ts +26 -0
- package/dist/components/Slider/Slider.d.cts +33 -0
- package/dist/components/Slider/Slider.d.ts +33 -0
- package/dist/components/Spinner/Spinner.d.cts +14 -0
- package/dist/components/Spinner/Spinner.d.ts +14 -0
- package/dist/components/Stat/Stat.d.cts +20 -0
- package/dist/components/Stat/Stat.d.ts +20 -0
- package/dist/components/Steps/Steps.d.cts +27 -0
- package/dist/components/Steps/Steps.d.ts +27 -0
- package/dist/components/Switch/Switch.d.cts +9 -0
- package/dist/components/Switch/Switch.d.ts +9 -0
- package/dist/components/Table/Table.d.cts +55 -0
- package/dist/components/Table/Table.d.ts +55 -0
- package/dist/components/Tabs/Tabs.d.cts +35 -0
- package/dist/components/Tabs/Tabs.d.ts +35 -0
- package/dist/components/Tag/Tag.d.cts +40 -0
- package/dist/components/Tag/Tag.d.ts +40 -0
- package/dist/components/Textarea/Textarea.d.cts +12 -0
- package/dist/components/Textarea/Textarea.d.ts +12 -0
- package/dist/components/Toast/Toast.d.cts +41 -0
- package/dist/components/Toast/Toast.d.ts +41 -0
- package/dist/components/Tooltip/Tooltip.d.cts +19 -0
- package/dist/components/Tooltip/Tooltip.d.ts +19 -0
- package/dist/components.css +5236 -0
- package/dist/fonts.css +3 -0
- package/dist/hooks/useControllableState.d.cts +5 -0
- package/dist/hooks/useControllableState.d.ts +5 -0
- package/dist/hooks/useFloating.d.cts +26 -0
- package/dist/hooks/useFloating.d.ts +26 -0
- package/dist/hooks/useIndicator.d.cts +8 -0
- package/dist/hooks/useIndicator.d.ts +8 -0
- package/dist/hooks/useMenuKeyboard.d.cts +12 -0
- package/dist/hooks/useMenuKeyboard.d.ts +12 -0
- package/dist/hooks/useModalDialog.d.cts +9 -0
- package/dist/hooks/useModalDialog.d.ts +9 -0
- package/dist/hooks/usePresence.d.cts +13 -0
- package/dist/hooks/usePresence.d.ts +13 -0
- package/dist/icons.d.cts +33 -0
- package/dist/icons.d.ts +33 -0
- package/dist/index.cjs +4622 -0
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.cts +114 -0
- package/dist/index.d.ts +114 -0
- package/dist/index.js +4650 -0
- package/dist/index.js.map +7 -0
- package/dist/openware-ui.iife.js +8 -0
- package/dist/styles.css +5664 -0
- package/dist/tailwind.css +145 -0
- package/dist/tokens.css +427 -0
- package/dist/tokens.json +252 -0
- package/dist/utils/brand.d.cts +30 -0
- package/dist/utils/brand.d.ts +30 -0
- package/dist/utils/copyText.d.cts +2 -0
- package/dist/utils/copyText.d.ts +2 -0
- package/dist/utils/cx.d.cts +4 -0
- package/dist/utils/cx.d.ts +4 -0
- package/dist/utils/resizeTextArea.d.cts +2 -0
- package/dist/utils/resizeTextArea.d.ts +2 -0
- package/dist/utils/text.d.cts +4 -0
- package/dist/utils/text.d.ts +4 -0
- package/package.json +83 -4
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export interface Command {
|
|
3
|
+
/** Unique in the list, e.g. "project.new". */
|
|
4
|
+
id: string;
|
|
5
|
+
title: string;
|
|
6
|
+
/** Commands with the same group are listed together under its name (when nothing is typed). */
|
|
7
|
+
group?: string;
|
|
8
|
+
icon?: ReactNode;
|
|
9
|
+
/** Extra words that should find this command, e.g. "start go" for Run. */
|
|
10
|
+
keywords?: string;
|
|
11
|
+
/** Shown on the right, e.g. a folder or "Running". */
|
|
12
|
+
hint?: string;
|
|
13
|
+
/** Shortcut shown on the right, e.g. "⌘,". */
|
|
14
|
+
shortcut?: string;
|
|
15
|
+
/** Why it can't run right now; the command still shows, greyed out, with this as its hint. */
|
|
16
|
+
disabled?: string;
|
|
17
|
+
run(): void;
|
|
18
|
+
}
|
|
19
|
+
export interface CommandPaletteProps {
|
|
20
|
+
open: boolean;
|
|
21
|
+
onClose(): void;
|
|
22
|
+
commands: Command[];
|
|
23
|
+
/** Default "Search commands…". */
|
|
24
|
+
placeholder?: string;
|
|
25
|
+
}
|
|
26
|
+
/** ⌘K: search every action and run it from the keyboard. Arrow keys (or Ctrl+N and Ctrl+P) move, Enter runs. */
|
|
27
|
+
export declare function CommandPalette({ open, onClose, commands, placeholder }: CommandPaletteProps): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export interface Command {
|
|
3
|
+
/** Unique in the list, e.g. "project.new". */
|
|
4
|
+
id: string;
|
|
5
|
+
title: string;
|
|
6
|
+
/** Commands with the same group are listed together under its name (when nothing is typed). */
|
|
7
|
+
group?: string;
|
|
8
|
+
icon?: ReactNode;
|
|
9
|
+
/** Extra words that should find this command, e.g. "start go" for Run. */
|
|
10
|
+
keywords?: string;
|
|
11
|
+
/** Shown on the right, e.g. a folder or "Running". */
|
|
12
|
+
hint?: string;
|
|
13
|
+
/** Shortcut shown on the right, e.g. "⌘,". */
|
|
14
|
+
shortcut?: string;
|
|
15
|
+
/** Why it can't run right now; the command still shows, greyed out, with this as its hint. */
|
|
16
|
+
disabled?: string;
|
|
17
|
+
run(): void;
|
|
18
|
+
}
|
|
19
|
+
export interface CommandPaletteProps {
|
|
20
|
+
open: boolean;
|
|
21
|
+
onClose(): void;
|
|
22
|
+
commands: Command[];
|
|
23
|
+
/** Default "Search commands…". */
|
|
24
|
+
placeholder?: string;
|
|
25
|
+
}
|
|
26
|
+
/** ⌘K: search every action and run it from the keyboard. Arrow keys (or Ctrl+N and Ctrl+P) move, Enter runs. */
|
|
27
|
+
export declare function CommandPalette({ open, onClose, commands, placeholder }: CommandPaletteProps): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type FormEvent, type ReactNode } from "react";
|
|
2
|
+
export interface DialogProps {
|
|
3
|
+
open: boolean;
|
|
4
|
+
/** Called when the person dismisses it (Escape, the backdrop) unless `dismissible` is false. Set `open` to false here. */
|
|
5
|
+
onClose(): void;
|
|
6
|
+
title: ReactNode;
|
|
7
|
+
/** A muted line or two under the title. */
|
|
8
|
+
description?: ReactNode;
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
/** Buttons at the bottom right, cancel first, the main action last. */
|
|
11
|
+
actions?: ReactNode;
|
|
12
|
+
/** Pixels. Default 420. */
|
|
13
|
+
width?: number;
|
|
14
|
+
/** False while saving, so Escape and the backdrop can't close it mid-way. Default true. */
|
|
15
|
+
dismissible?: boolean;
|
|
16
|
+
/** Makes the dialog a form; its submit button submits it. */
|
|
17
|
+
onSubmit?(event: FormEvent<HTMLFormElement>): void;
|
|
18
|
+
className?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A modal dialog on the native <dialog> element: it traps focus, sits above everything, closes with Escape
|
|
22
|
+
* or a click on the backdrop, and fades and rises in.
|
|
23
|
+
*/
|
|
24
|
+
export declare function Dialog({ open, onClose, title, description, children, actions, width, dismissible, onSubmit, className, }: DialogProps): import("react").JSX.Element | null;
|
|
25
|
+
export interface ConfirmDialogProps {
|
|
26
|
+
open: boolean;
|
|
27
|
+
onClose(): void;
|
|
28
|
+
title: ReactNode;
|
|
29
|
+
description: ReactNode;
|
|
30
|
+
/** The verb on the confirm button: "Delete project", not "OK". */
|
|
31
|
+
confirmLabel: string;
|
|
32
|
+
/** Styles the confirm button and icon as a destructive action. */
|
|
33
|
+
destructive?: boolean;
|
|
34
|
+
/** Keeps the confirm button disabled, e.g. until a typed confirmation matches. */
|
|
35
|
+
confirmDisabled?: boolean;
|
|
36
|
+
/** Runs the action. The dialog closes when it resolves and shows the error's message when it throws. */
|
|
37
|
+
onConfirm(): Promise<void> | void;
|
|
38
|
+
/** Extra content between the description and the buttons, such as an option checkbox. */
|
|
39
|
+
children?: ReactNode;
|
|
40
|
+
}
|
|
41
|
+
/** Asks before an action: a title, what will happen, Cancel and the action. Cancel has focus first. */
|
|
42
|
+
export declare function ConfirmDialog({ open, onClose, title, description, confirmLabel, destructive, confirmDisabled, onConfirm, children, }: ConfirmDialogProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type FormEvent, type ReactNode } from "react";
|
|
2
|
+
export interface DialogProps {
|
|
3
|
+
open: boolean;
|
|
4
|
+
/** Called when the person dismisses it (Escape, the backdrop) unless `dismissible` is false. Set `open` to false here. */
|
|
5
|
+
onClose(): void;
|
|
6
|
+
title: ReactNode;
|
|
7
|
+
/** A muted line or two under the title. */
|
|
8
|
+
description?: ReactNode;
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
/** Buttons at the bottom right, cancel first, the main action last. */
|
|
11
|
+
actions?: ReactNode;
|
|
12
|
+
/** Pixels. Default 420. */
|
|
13
|
+
width?: number;
|
|
14
|
+
/** False while saving, so Escape and the backdrop can't close it mid-way. Default true. */
|
|
15
|
+
dismissible?: boolean;
|
|
16
|
+
/** Makes the dialog a form; its submit button submits it. */
|
|
17
|
+
onSubmit?(event: FormEvent<HTMLFormElement>): void;
|
|
18
|
+
className?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A modal dialog on the native <dialog> element: it traps focus, sits above everything, closes with Escape
|
|
22
|
+
* or a click on the backdrop, and fades and rises in.
|
|
23
|
+
*/
|
|
24
|
+
export declare function Dialog({ open, onClose, title, description, children, actions, width, dismissible, onSubmit, className, }: DialogProps): import("react").JSX.Element | null;
|
|
25
|
+
export interface ConfirmDialogProps {
|
|
26
|
+
open: boolean;
|
|
27
|
+
onClose(): void;
|
|
28
|
+
title: ReactNode;
|
|
29
|
+
description: ReactNode;
|
|
30
|
+
/** The verb on the confirm button: "Delete project", not "OK". */
|
|
31
|
+
confirmLabel: string;
|
|
32
|
+
/** Styles the confirm button and icon as a destructive action. */
|
|
33
|
+
destructive?: boolean;
|
|
34
|
+
/** Keeps the confirm button disabled, e.g. until a typed confirmation matches. */
|
|
35
|
+
confirmDisabled?: boolean;
|
|
36
|
+
/** Runs the action. The dialog closes when it resolves and shows the error's message when it throws. */
|
|
37
|
+
onConfirm(): Promise<void> | void;
|
|
38
|
+
/** Extra content between the description and the buttons, such as an option checkbox. */
|
|
39
|
+
children?: ReactNode;
|
|
40
|
+
}
|
|
41
|
+
/** Asks before an action: a title, what will happen, Cancel and the action. Cancel has focus first. */
|
|
42
|
+
export declare function ConfirmDialog({ open, onClose, title, description, confirmLabel, destructive, confirmDisabled, onConfirm, children, }: ConfirmDialogProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export interface DrawerProps {
|
|
3
|
+
open: boolean;
|
|
4
|
+
/** Called on Escape, the backdrop or the ✕, unless `dismissible` is false. Set `open` to false here. */
|
|
5
|
+
onClose(): void;
|
|
6
|
+
title: ReactNode;
|
|
7
|
+
/** A muted line under the title. */
|
|
8
|
+
description?: ReactNode;
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
/** Buttons pinned to the bottom: Cancel first, the main action last. */
|
|
11
|
+
footer?: ReactNode;
|
|
12
|
+
/** Which edge it slides in from.
|
|
13
|
+
* @default "right" */
|
|
14
|
+
side?: "right" | "left" | "bottom";
|
|
15
|
+
/** Width (or height, from the bottom) in pixels.
|
|
16
|
+
* @default 420 */
|
|
17
|
+
size?: number;
|
|
18
|
+
/** @default true */
|
|
19
|
+
dismissible?: boolean;
|
|
20
|
+
className?: string;
|
|
21
|
+
}
|
|
22
|
+
/** A panel that slides in from an edge over the page, for details or a form beside what the person was doing. */
|
|
23
|
+
export declare function Drawer({ open, onClose, title, description, children, footer, side, size, dismissible, className, }: DrawerProps): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export interface DrawerProps {
|
|
3
|
+
open: boolean;
|
|
4
|
+
/** Called on Escape, the backdrop or the ✕, unless `dismissible` is false. Set `open` to false here. */
|
|
5
|
+
onClose(): void;
|
|
6
|
+
title: ReactNode;
|
|
7
|
+
/** A muted line under the title. */
|
|
8
|
+
description?: ReactNode;
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
/** Buttons pinned to the bottom: Cancel first, the main action last. */
|
|
11
|
+
footer?: ReactNode;
|
|
12
|
+
/** Which edge it slides in from.
|
|
13
|
+
* @default "right" */
|
|
14
|
+
side?: "right" | "left" | "bottom";
|
|
15
|
+
/** Width (or height, from the bottom) in pixels.
|
|
16
|
+
* @default 420 */
|
|
17
|
+
size?: number;
|
|
18
|
+
/** @default true */
|
|
19
|
+
dismissible?: boolean;
|
|
20
|
+
className?: string;
|
|
21
|
+
}
|
|
22
|
+
/** A panel that slides in from an edge over the page, for details or a form beside what the person was doing. */
|
|
23
|
+
export declare function Drawer({ open, onClose, title, description, children, footer, side, size, dismissible, className, }: DrawerProps): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
export interface EmptyStateProps {
|
|
3
|
+
/** What's missing, as a plain statement: "No projects yet". */
|
|
4
|
+
title: ReactNode;
|
|
5
|
+
/** What to do about it, in a sentence. */
|
|
6
|
+
description?: ReactNode;
|
|
7
|
+
/** A 20px icon on a tile.
|
|
8
|
+
* @default <InboxIcon /> */
|
|
9
|
+
icon?: ReactNode;
|
|
10
|
+
/** One primary Button, and maybe a secondary one. */
|
|
11
|
+
actions?: ReactNode;
|
|
12
|
+
/** Draws a dashed outline around it, for an empty area inside a page.
|
|
13
|
+
* @default false */
|
|
14
|
+
bordered?: boolean;
|
|
15
|
+
className?: string;
|
|
16
|
+
}
|
|
17
|
+
/** What a list, table or panel shows when there's nothing in it yet, and the way to add the first thing. */
|
|
18
|
+
export declare function EmptyState({ title, description, icon, actions, bordered, className }: EmptyStateProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
export interface EmptyStateProps {
|
|
3
|
+
/** What's missing, as a plain statement: "No projects yet". */
|
|
4
|
+
title: ReactNode;
|
|
5
|
+
/** What to do about it, in a sentence. */
|
|
6
|
+
description?: ReactNode;
|
|
7
|
+
/** A 20px icon on a tile.
|
|
8
|
+
* @default <InboxIcon /> */
|
|
9
|
+
icon?: ReactNode;
|
|
10
|
+
/** One primary Button, and maybe a secondary one. */
|
|
11
|
+
actions?: ReactNode;
|
|
12
|
+
/** Draws a dashed outline around it, for an empty area inside a page.
|
|
13
|
+
* @default false */
|
|
14
|
+
bordered?: boolean;
|
|
15
|
+
className?: string;
|
|
16
|
+
}
|
|
17
|
+
/** What a list, table or panel shows when there's nothing in it yet, and the way to add the first thing. */
|
|
18
|
+
export declare function EmptyState({ title, description, icon, actions, bordered, className }: EmptyStateProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type ReactElement, type ReactNode } from "react";
|
|
2
|
+
export interface FieldProps {
|
|
3
|
+
/** The label, set above the control. */
|
|
4
|
+
label: ReactNode;
|
|
5
|
+
/** One control: an Input, Textarea, Select, or any element that takes an id. */
|
|
6
|
+
children: ReactElement;
|
|
7
|
+
/** A muted line under the control. */
|
|
8
|
+
hint?: ReactNode;
|
|
9
|
+
/** An error under the control; it also marks the control invalid. */
|
|
10
|
+
error?: ReactNode;
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* A label above a control, with an optional hint and error below. Field wires them together:
|
|
15
|
+
* it gives the control an id (unless it has one), points aria-describedby at the hint and error,
|
|
16
|
+
* and marks it invalid when there is an error.
|
|
17
|
+
*/
|
|
18
|
+
export declare function Field({ label, children, hint, error, className }: FieldProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type ReactElement, type ReactNode } from "react";
|
|
2
|
+
export interface FieldProps {
|
|
3
|
+
/** The label, set above the control. */
|
|
4
|
+
label: ReactNode;
|
|
5
|
+
/** One control: an Input, Textarea, Select, or any element that takes an id. */
|
|
6
|
+
children: ReactElement;
|
|
7
|
+
/** A muted line under the control. */
|
|
8
|
+
hint?: ReactNode;
|
|
9
|
+
/** An error under the control; it also marks the control invalid. */
|
|
10
|
+
error?: ReactNode;
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* A label above a control, with an optional hint and error below. Field wires them together:
|
|
15
|
+
* it gives the control an id (unless it has one), points aria-describedby at the hint and error,
|
|
16
|
+
* and marks it invalid when there is an error.
|
|
17
|
+
*/
|
|
18
|
+
export declare function Field({ label, children, hint, error, className }: FieldProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export interface FileDropZoneProps {
|
|
3
|
+
/** Called with the accepted files, whether dropped or picked. */
|
|
4
|
+
onFiles(files: File[]): void;
|
|
5
|
+
/** File types to accept, as for <input accept>: ".png,.jpg", "image/*". */
|
|
6
|
+
accept?: string;
|
|
7
|
+
/** @default false */
|
|
8
|
+
multiple?: boolean;
|
|
9
|
+
/** The largest file accepted, in bytes. */
|
|
10
|
+
maxSize?: number;
|
|
11
|
+
/** @default "Drop files here, or browse" */
|
|
12
|
+
label?: ReactNode;
|
|
13
|
+
/** A muted line under the label: what's accepted, how big. */
|
|
14
|
+
hint?: ReactNode;
|
|
15
|
+
/** An error to show in place of the hint, such as a failed upload. */
|
|
16
|
+
error?: ReactNode;
|
|
17
|
+
/** A 20px icon on the tile.
|
|
18
|
+
* @default <UploadIcon /> */
|
|
19
|
+
icon?: ReactNode;
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
/** The form field name for the file input. */
|
|
22
|
+
name?: string;
|
|
23
|
+
className?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Commandr's folder drop zone, for files: drop them on it, or press it to pick them.
|
|
27
|
+
* It checks the type and size and says what was wrong.
|
|
28
|
+
*/
|
|
29
|
+
export declare function FileDropZone({ onFiles, accept, multiple, maxSize, label, hint, error, icon, disabled, name, className, }: FileDropZoneProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export interface FileDropZoneProps {
|
|
3
|
+
/** Called with the accepted files, whether dropped or picked. */
|
|
4
|
+
onFiles(files: File[]): void;
|
|
5
|
+
/** File types to accept, as for <input accept>: ".png,.jpg", "image/*". */
|
|
6
|
+
accept?: string;
|
|
7
|
+
/** @default false */
|
|
8
|
+
multiple?: boolean;
|
|
9
|
+
/** The largest file accepted, in bytes. */
|
|
10
|
+
maxSize?: number;
|
|
11
|
+
/** @default "Drop files here, or browse" */
|
|
12
|
+
label?: ReactNode;
|
|
13
|
+
/** A muted line under the label: what's accepted, how big. */
|
|
14
|
+
hint?: ReactNode;
|
|
15
|
+
/** An error to show in place of the hint, such as a failed upload. */
|
|
16
|
+
error?: ReactNode;
|
|
17
|
+
/** A 20px icon on the tile.
|
|
18
|
+
* @default <UploadIcon /> */
|
|
19
|
+
icon?: ReactNode;
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
/** The form field name for the file input. */
|
|
22
|
+
name?: string;
|
|
23
|
+
className?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Commandr's folder drop zone, for files: drop them on it, or press it to pick them.
|
|
27
|
+
* It checks the type and size and says what was wrong.
|
|
28
|
+
*/
|
|
29
|
+
export declare function FileDropZone({ onFiles, accept, multiple, maxSize, label, hint, error, icon, disabled, name, className, }: FileDropZoneProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export interface FileTreeNode {
|
|
3
|
+
name: string;
|
|
4
|
+
/** A folder's contents. Give folders an empty array if they're empty. */
|
|
5
|
+
children?: FileTreeNode[];
|
|
6
|
+
/** Replaces the file or folder icon. */
|
|
7
|
+
icon?: ReactNode;
|
|
8
|
+
/** Muted text at the right of the row, such as "+12 −3" or a size. */
|
|
9
|
+
meta?: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export interface FileTreeProps {
|
|
12
|
+
items: FileTreeNode[];
|
|
13
|
+
/** The selected file's path, "src/app.tsx". */
|
|
14
|
+
selected?: string;
|
|
15
|
+
defaultSelected?: string;
|
|
16
|
+
onSelect?(path: string): void;
|
|
17
|
+
/** Folder paths open at first, or "all".
|
|
18
|
+
* @default "all" */
|
|
19
|
+
defaultExpanded?: string[] | "all";
|
|
20
|
+
/** Names the tree for screen readers.
|
|
21
|
+
* @default "Files" */
|
|
22
|
+
label?: string;
|
|
23
|
+
className?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Commandr's project structure explorer: folders open and close, files can be selected.
|
|
27
|
+
* Up and Down move, Right opens a folder or goes into it, Left closes it or goes to its parent.
|
|
28
|
+
*/
|
|
29
|
+
export declare function FileTree({ items, selected, defaultSelected, onSelect, defaultExpanded, label, className, }: FileTreeProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export interface FileTreeNode {
|
|
3
|
+
name: string;
|
|
4
|
+
/** A folder's contents. Give folders an empty array if they're empty. */
|
|
5
|
+
children?: FileTreeNode[];
|
|
6
|
+
/** Replaces the file or folder icon. */
|
|
7
|
+
icon?: ReactNode;
|
|
8
|
+
/** Muted text at the right of the row, such as "+12 −3" or a size. */
|
|
9
|
+
meta?: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export interface FileTreeProps {
|
|
12
|
+
items: FileTreeNode[];
|
|
13
|
+
/** The selected file's path, "src/app.tsx". */
|
|
14
|
+
selected?: string;
|
|
15
|
+
defaultSelected?: string;
|
|
16
|
+
onSelect?(path: string): void;
|
|
17
|
+
/** Folder paths open at first, or "all".
|
|
18
|
+
* @default "all" */
|
|
19
|
+
defaultExpanded?: string[] | "all";
|
|
20
|
+
/** Names the tree for screen readers.
|
|
21
|
+
* @default "Files" */
|
|
22
|
+
label?: string;
|
|
23
|
+
className?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Commandr's project structure explorer: folders open and close, files can be selected.
|
|
27
|
+
* Up and Down move, Right opens a folder or goes into it, Left closes it or goes to its parent.
|
|
28
|
+
*/
|
|
29
|
+
export declare function FileTree({ items, selected, defaultSelected, onSelect, defaultExpanded, label, className, }: FileTreeProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type InputHTMLAttributes, type ReactNode } from "react";
|
|
2
|
+
export interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size"> {
|
|
3
|
+
/** Shows the field as wrong: a red border, and a red halo when focused. Also sets aria-invalid.
|
|
4
|
+
* @default false */
|
|
5
|
+
isInvalid?: boolean;
|
|
6
|
+
/** sm 32px for toolbars and settings rows, md 40px in forms.
|
|
7
|
+
* @default "md" */
|
|
8
|
+
size?: "sm" | "md";
|
|
9
|
+
/** Inside the field, before the text: a 16px icon, a unit, a prefix like "https://". */
|
|
10
|
+
startContent?: ReactNode;
|
|
11
|
+
/** Inside the field, after the text: a unit, a small ghost Button, a Spinner. */
|
|
12
|
+
endContent?: ReactNode;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* A single-line text field. With startContent or endContent, the field becomes a group and `className`
|
|
16
|
+
* goes on the group, so width and margins apply to the whole field.
|
|
17
|
+
*/
|
|
18
|
+
export declare const Input: import("react").ForwardRefExoticComponent<InputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type InputHTMLAttributes, type ReactNode } from "react";
|
|
2
|
+
export interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size"> {
|
|
3
|
+
/** Shows the field as wrong: a red border, and a red halo when focused. Also sets aria-invalid.
|
|
4
|
+
* @default false */
|
|
5
|
+
isInvalid?: boolean;
|
|
6
|
+
/** sm 32px for toolbars and settings rows, md 40px in forms.
|
|
7
|
+
* @default "md" */
|
|
8
|
+
size?: "sm" | "md";
|
|
9
|
+
/** Inside the field, before the text: a 16px icon, a unit, a prefix like "https://". */
|
|
10
|
+
startContent?: ReactNode;
|
|
11
|
+
/** Inside the field, after the text: a unit, a small ghost Button, a Spinner. */
|
|
12
|
+
endContent?: ReactNode;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* A single-line text field. With startContent or endContent, the field becomes a group and `className`
|
|
16
|
+
* goes on the group, so width and margins apply to the whole field.
|
|
17
|
+
*/
|
|
18
|
+
export declare const Input: import("react").ForwardRefExoticComponent<InputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export interface InputOTPProps {
|
|
2
|
+
/** How many characters the code has.
|
|
3
|
+
* @default 6 */
|
|
4
|
+
length?: number;
|
|
5
|
+
value?: string;
|
|
6
|
+
/** @default "" */
|
|
7
|
+
defaultValue?: string;
|
|
8
|
+
onChange?(value: string): void;
|
|
9
|
+
/** Called once every box is filled. */
|
|
10
|
+
onComplete?(value: string): void;
|
|
11
|
+
/** `numeric` accepts digits only; `alphanumeric` letters and digits (shown upper case).
|
|
12
|
+
* @default "numeric" */
|
|
13
|
+
type?: "numeric" | "alphanumeric";
|
|
14
|
+
/** Splits the boxes into groups with a dash between, e.g. 3 for "123–456". */
|
|
15
|
+
groupSize?: number;
|
|
16
|
+
/** @default false */
|
|
17
|
+
isInvalid?: boolean;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
autoFocus?: boolean;
|
|
20
|
+
/** Names the code for screen readers.
|
|
21
|
+
* @default "Verification code" */
|
|
22
|
+
"aria-label"?: string;
|
|
23
|
+
/** The form field name; a hidden input carries the whole code. */
|
|
24
|
+
name?: string;
|
|
25
|
+
className?: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* A one-time code in separate boxes. Typing moves forward, Backspace moves back,
|
|
29
|
+
* and pasting a code fills every box. The browser can fill it from a text message.
|
|
30
|
+
*/
|
|
31
|
+
export declare function InputOTP({ length, value, defaultValue, onChange, onComplete, type, groupSize, isInvalid, disabled, autoFocus, "aria-label": ariaLabel, name, className, }: InputOTPProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export interface InputOTPProps {
|
|
2
|
+
/** How many characters the code has.
|
|
3
|
+
* @default 6 */
|
|
4
|
+
length?: number;
|
|
5
|
+
value?: string;
|
|
6
|
+
/** @default "" */
|
|
7
|
+
defaultValue?: string;
|
|
8
|
+
onChange?(value: string): void;
|
|
9
|
+
/** Called once every box is filled. */
|
|
10
|
+
onComplete?(value: string): void;
|
|
11
|
+
/** `numeric` accepts digits only; `alphanumeric` letters and digits (shown upper case).
|
|
12
|
+
* @default "numeric" */
|
|
13
|
+
type?: "numeric" | "alphanumeric";
|
|
14
|
+
/** Splits the boxes into groups with a dash between, e.g. 3 for "123–456". */
|
|
15
|
+
groupSize?: number;
|
|
16
|
+
/** @default false */
|
|
17
|
+
isInvalid?: boolean;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
autoFocus?: boolean;
|
|
20
|
+
/** Names the code for screen readers.
|
|
21
|
+
* @default "Verification code" */
|
|
22
|
+
"aria-label"?: string;
|
|
23
|
+
/** The form field name; a hidden input carries the whole code. */
|
|
24
|
+
name?: string;
|
|
25
|
+
className?: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* A one-time code in separate boxes. Typing moves forward, Backspace moves back,
|
|
29
|
+
* and pasting a code fills every box. The browser can fill it from a text message.
|
|
30
|
+
*/
|
|
31
|
+
export declare function InputOTP({ length, value, defaultValue, onChange, onComplete, type, groupSize, isInvalid, disabled, autoFocus, "aria-label": ariaLabel, name, className, }: InputOTPProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "react";
|
|
2
|
+
/** One keyboard key in running text, with a heavier bottom edge like a real key: <Kbd>⌘</Kbd> <Kbd>K</Kbd>. */
|
|
3
|
+
export declare function Kbd({ className, ...props }: HTMLAttributes<HTMLElement>): import("react").JSX.Element;
|
|
4
|
+
/** Code, a path or a command inside a sentence. */
|
|
5
|
+
export declare function Code({ className, ...props }: HTMLAttributes<HTMLElement>): import("react").JSX.Element;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "react";
|
|
2
|
+
/** One keyboard key in running text, with a heavier bottom edge like a real key: <Kbd>⌘</Kbd> <Kbd>K</Kbd>. */
|
|
3
|
+
export declare function Kbd({ className, ...props }: HTMLAttributes<HTMLElement>): import("react").JSX.Element;
|
|
4
|
+
/** Code, a path or a command inside a sentence. */
|
|
5
|
+
export declare function Code({ className, ...props }: HTMLAttributes<HTMLElement>): import("react").JSX.Element;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type HTMLAttributes, type JSX, type ReactNode } from "react";
|
|
2
|
+
export type SpaceToken = "none" | "3xs" | "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "5xl" | "6xl" | "7xl";
|
|
3
|
+
export interface StackProps extends HTMLAttributes<HTMLElement> {
|
|
4
|
+
/** @default "column" */
|
|
5
|
+
direction?: "row" | "column";
|
|
6
|
+
/** The space between children, from the spacing scale.
|
|
7
|
+
* @default "md" */
|
|
8
|
+
gap?: SpaceToken;
|
|
9
|
+
/** Cross-axis alignment. */
|
|
10
|
+
align?: "start" | "center" | "end" | "stretch" | "baseline";
|
|
11
|
+
/** Main-axis alignment. */
|
|
12
|
+
justify?: "start" | "center" | "end" | "between";
|
|
13
|
+
/** Lets a row wrap onto more lines.
|
|
14
|
+
* @default false */
|
|
15
|
+
wrap?: boolean;
|
|
16
|
+
/** The element to render.
|
|
17
|
+
* @default "div" */
|
|
18
|
+
as?: keyof JSX.IntrinsicElements;
|
|
19
|
+
children?: ReactNode;
|
|
20
|
+
}
|
|
21
|
+
/** Lays children out in a row or a column with a gap from the spacing scale. */
|
|
22
|
+
export declare function Stack({ direction, gap, align, justify, wrap, as, className, style, children, ...props }: StackProps): JSX.Element;
|
|
23
|
+
export interface SeparatorProps {
|
|
24
|
+
/** @default "horizontal" */
|
|
25
|
+
orientation?: "horizontal" | "vertical";
|
|
26
|
+
/** Text in the middle of a horizontal line, such as "or". */
|
|
27
|
+
label?: ReactNode;
|
|
28
|
+
/** Space before and after, from the spacing scale.
|
|
29
|
+
* @default "none" */
|
|
30
|
+
spacing?: SpaceToken;
|
|
31
|
+
className?: string;
|
|
32
|
+
}
|
|
33
|
+
/** A hairline between groups of content. Prefer space; use a line when space alone doesn't separate. */
|
|
34
|
+
export declare function Separator({ orientation, label, spacing, className }: SeparatorProps): JSX.Element;
|
|
35
|
+
export interface ScrollShadowProps extends HTMLAttributes<HTMLDivElement> {
|
|
36
|
+
/** @default "vertical" */
|
|
37
|
+
orientation?: "vertical" | "horizontal";
|
|
38
|
+
/** How far the fade reaches, in pixels.
|
|
39
|
+
* @default 32 */
|
|
40
|
+
size?: number;
|
|
41
|
+
/** Its height (vertical) or width; it scrolls past this. */
|
|
42
|
+
maxSize?: number | string;
|
|
43
|
+
/** Names the area; with it, the area becomes a focusable region so keyboards can scroll it. */
|
|
44
|
+
"aria-label"?: string;
|
|
45
|
+
children: ReactNode;
|
|
46
|
+
}
|
|
47
|
+
/** A scrolling area whose edges fade out where there's more to scroll, so nothing looks cut off. */
|
|
48
|
+
export declare function ScrollShadow({ orientation, size, maxSize, className, style, children, "aria-label": ariaLabel, ...props }: ScrollShadowProps): JSX.Element;
|
|
49
|
+
/** Hides content visually but keeps it for screen readers: extra context for an icon, a table caption. */
|
|
50
|
+
export declare function VisuallyHidden({ className, ...props }: HTMLAttributes<HTMLSpanElement>): JSX.Element;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type HTMLAttributes, type JSX, type ReactNode } from "react";
|
|
2
|
+
export type SpaceToken = "none" | "3xs" | "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "5xl" | "6xl" | "7xl";
|
|
3
|
+
export interface StackProps extends HTMLAttributes<HTMLElement> {
|
|
4
|
+
/** @default "column" */
|
|
5
|
+
direction?: "row" | "column";
|
|
6
|
+
/** The space between children, from the spacing scale.
|
|
7
|
+
* @default "md" */
|
|
8
|
+
gap?: SpaceToken;
|
|
9
|
+
/** Cross-axis alignment. */
|
|
10
|
+
align?: "start" | "center" | "end" | "stretch" | "baseline";
|
|
11
|
+
/** Main-axis alignment. */
|
|
12
|
+
justify?: "start" | "center" | "end" | "between";
|
|
13
|
+
/** Lets a row wrap onto more lines.
|
|
14
|
+
* @default false */
|
|
15
|
+
wrap?: boolean;
|
|
16
|
+
/** The element to render.
|
|
17
|
+
* @default "div" */
|
|
18
|
+
as?: keyof JSX.IntrinsicElements;
|
|
19
|
+
children?: ReactNode;
|
|
20
|
+
}
|
|
21
|
+
/** Lays children out in a row or a column with a gap from the spacing scale. */
|
|
22
|
+
export declare function Stack({ direction, gap, align, justify, wrap, as, className, style, children, ...props }: StackProps): JSX.Element;
|
|
23
|
+
export interface SeparatorProps {
|
|
24
|
+
/** @default "horizontal" */
|
|
25
|
+
orientation?: "horizontal" | "vertical";
|
|
26
|
+
/** Text in the middle of a horizontal line, such as "or". */
|
|
27
|
+
label?: ReactNode;
|
|
28
|
+
/** Space before and after, from the spacing scale.
|
|
29
|
+
* @default "none" */
|
|
30
|
+
spacing?: SpaceToken;
|
|
31
|
+
className?: string;
|
|
32
|
+
}
|
|
33
|
+
/** A hairline between groups of content. Prefer space; use a line when space alone doesn't separate. */
|
|
34
|
+
export declare function Separator({ orientation, label, spacing, className }: SeparatorProps): JSX.Element;
|
|
35
|
+
export interface ScrollShadowProps extends HTMLAttributes<HTMLDivElement> {
|
|
36
|
+
/** @default "vertical" */
|
|
37
|
+
orientation?: "vertical" | "horizontal";
|
|
38
|
+
/** How far the fade reaches, in pixels.
|
|
39
|
+
* @default 32 */
|
|
40
|
+
size?: number;
|
|
41
|
+
/** Its height (vertical) or width; it scrolls past this. */
|
|
42
|
+
maxSize?: number | string;
|
|
43
|
+
/** Names the area; with it, the area becomes a focusable region so keyboards can scroll it. */
|
|
44
|
+
"aria-label"?: string;
|
|
45
|
+
children: ReactNode;
|
|
46
|
+
}
|
|
47
|
+
/** A scrolling area whose edges fade out where there's more to scroll, so nothing looks cut off. */
|
|
48
|
+
export declare function ScrollShadow({ orientation, size, maxSize, className, style, children, "aria-label": ariaLabel, ...props }: ScrollShadowProps): JSX.Element;
|
|
49
|
+
/** Hides content visually but keeps it for screen readers: extra context for an icon, a table caption. */
|
|
50
|
+
export declare function VisuallyHidden({ className, ...props }: HTMLAttributes<HTMLSpanElement>): JSX.Element;
|