@alea-design/ui 0.0.0-stage → 0.1.1
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 +17 -2
- package/dist/components/accordion/Accordion.d.ts +29 -0
- package/dist/components/ai/AI.d.ts +157 -0
- package/dist/components/app/AppParts.d.ts +105 -0
- package/dist/components/button/Button.d.ts +95 -0
- package/dist/components/button/Groups.d.ts +91 -0
- package/dist/components/card/Card.d.ts +61 -0
- package/dist/components/chat/Chat.d.ts +191 -0
- package/dist/components/choice/Choice.d.ts +87 -0
- package/dist/components/color/Color.d.ts +77 -0
- package/dist/components/combobox/Autocomplete.d.ts +76 -0
- package/dist/components/combobox/ComboBox.d.ts +81 -0
- package/dist/components/combobox/Highlight.d.ts +27 -0
- package/dist/components/command/CommandPalette.d.ts +35 -0
- package/dist/components/content/Content.d.ts +120 -0
- package/dist/components/data/Data.d.ts +85 -0
- package/dist/components/date/Date.d.ts +48 -0
- package/dist/components/display/Display.d.ts +114 -0
- package/dist/components/display/Display2.d.ts +54 -0
- package/dist/components/emoji/EmojiPicker.d.ts +16 -0
- package/dist/components/emoji/emoji-data.d.ts +12 -0
- package/dist/components/extras/CodeSteps.d.ts +24 -0
- package/dist/components/extras/Extras.d.ts +84 -0
- package/dist/components/feedback/Feedback.d.ts +136 -0
- package/dist/components/feedback/Spinner.d.ts +12 -0
- package/dist/components/feedback/Status.d.ts +45 -0
- package/dist/components/field/Field.d.ts +130 -0
- package/dist/components/field/FieldLoading.d.ts +7 -0
- package/dist/components/filter/FilterBar.d.ts +48 -0
- package/dist/components/form/Form.d.ts +32 -0
- package/dist/components/icon/Icon.d.ts +47 -0
- package/dist/components/icon/icon-cells.d.ts +23 -0
- package/dist/components/icon/icon-contexts.d.ts +19 -0
- package/dist/components/icon/icon-names.d.ts +8 -0
- package/dist/components/layout/Bento.d.ts +42 -0
- package/dist/components/layout/Layout.d.ts +76 -0
- package/dist/components/layout/Layout2.d.ts +120 -0
- package/dist/components/layout/Layout3.d.ts +65 -0
- package/dist/components/layout/Responsive.d.ts +21 -0
- package/dist/components/list/List.d.ts +41 -0
- package/dist/components/list/Lists2.d.ts +79 -0
- package/dist/components/media/Media.d.ts +133 -0
- package/dist/components/menu/Menu.d.ts +87 -0
- package/dist/components/more/More.d.ts +176 -0
- package/dist/components/navigation/Navbar.d.ts +23 -0
- package/dist/components/navigation/Navigation.d.ts +88 -0
- package/dist/components/navigation/Navigation2.d.ts +152 -0
- package/dist/components/overlay/Drawer.d.ts +40 -0
- package/dist/components/overlay/Modal.d.ts +41 -0
- package/dist/components/overlay/Overlay.d.ts +95 -0
- package/dist/components/overlay/Sheet.d.ts +55 -0
- package/dist/components/page/Page.d.ts +91 -0
- package/dist/components/page/PageParts.d.ts +94 -0
- package/dist/components/picker/Picker.d.ts +136 -0
- package/dist/components/picker/Wheel.d.ts +63 -0
- package/dist/components/rating/Rating.d.ts +35 -0
- package/dist/components/select/Select.d.ts +116 -0
- package/dist/components/shell/AppShell.d.ts +52 -0
- package/dist/components/shell/AppSidebar.d.ts +55 -0
- package/dist/components/slider/Slider.d.ts +27 -0
- package/dist/components/table/Table.d.ts +45 -0
- package/dist/components/tabs/Tabs.d.ts +59 -0
- package/dist/components/theme/Theme.d.ts +94 -0
- package/dist/components/theme/lens.d.ts +18 -0
- package/dist/components/tree/Tree.d.ts +125 -0
- package/dist/components/typography/Typography.d.ts +59 -0
- package/dist/components/upload/Upload.d.ts +63 -0
- package/dist/components/work/Ops.d.ts +29 -0
- package/dist/components/work/Work.d.ts +216 -0
- package/dist/i18n/strings.d.ts +429 -0
- package/dist/index.d.ts +72 -0
- package/dist/index.js +7439 -0
- package/dist/styles.css +1 -0
- package/dist/utils/Blueprint.d.ts +12 -0
- package/dist/utils/DotField.d.ts +6 -0
- package/dist/utils/attr.d.ts +2 -0
- package/dist/utils/blueprintScene.d.ts +81 -0
- package/dist/utils/controlled.d.ts +2 -0
- package/dist/utils/cx.d.ts +2 -0
- package/dist/utils/inert.d.ts +2 -0
- package/dist/utils/responsive.d.ts +9 -0
- package/dist/utils/scrollEdges.d.ts +9 -0
- package/dist/utils/space.d.ts +2 -0
- package/package.json +68 -4
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
export interface TypingIndicatorProps {
|
|
3
|
+
/** Who is typing. Empty hides it. */
|
|
4
|
+
names: string[];
|
|
5
|
+
/** Extra class names. */
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
/** "Ana is typing" with three bouncing dots. Announced politely once when it appears; the dots are decoration and stop with reduced motion. */
|
|
9
|
+
export declare function TypingIndicator({ names, className }: TypingIndicatorProps): import("react").JSX.Element;
|
|
10
|
+
export interface Reaction {
|
|
11
|
+
emoji: string;
|
|
12
|
+
count: number;
|
|
13
|
+
/** The current person reacted with this one. */
|
|
14
|
+
mine?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface ReactionBarProps {
|
|
17
|
+
/** The reactions so far. */
|
|
18
|
+
reactions: Reaction[];
|
|
19
|
+
/** Called when someone toggles a reaction (an existing one, or a new one from the picker or the quick list). */
|
|
20
|
+
onToggle: (emoji: string) => void;
|
|
21
|
+
/** Shows the add button that opens the emoji picker. Default true. */
|
|
22
|
+
allowAdd?: boolean;
|
|
23
|
+
/** Emoji offered as one-press reactions before the add button, like ['👍', '❤️', '😂']. The ones already used show as reactions instead. */
|
|
24
|
+
quick?: string[];
|
|
25
|
+
/** sm (24 px) or md (28 px, default). */
|
|
26
|
+
size?: 'sm' | 'md';
|
|
27
|
+
/** Extra class names. */
|
|
28
|
+
className?: string;
|
|
29
|
+
}
|
|
30
|
+
/** Emoji reactions under a message or a comment: each is a toggle with its count (it pops when the count changes), quick reactions are one press away, and the add button opens an EmojiPicker. Arrow keys, Home and End move between the buttons. */
|
|
31
|
+
export declare function ReactionBar({ reactions, onToggle, allowAdd, quick, size, className }: ReactionBarProps): import("react").JSX.Element;
|
|
32
|
+
/** What a thread knows about itself, for the link and the preview. */
|
|
33
|
+
export interface ThreadInfo {
|
|
34
|
+
/** Number of replies. */
|
|
35
|
+
replyCount?: number;
|
|
36
|
+
/** The people who replied: their avatars show in the preview. */
|
|
37
|
+
participants?: Array<{
|
|
38
|
+
name: string;
|
|
39
|
+
src?: string;
|
|
40
|
+
}>;
|
|
41
|
+
/** When the last reply came: "Last reply 2 hours ago". */
|
|
42
|
+
lastReplyAt?: Date;
|
|
43
|
+
/** The last reply, as a one line snippet in the collapsed preview. */
|
|
44
|
+
lastReply?: {
|
|
45
|
+
author: string;
|
|
46
|
+
text: string;
|
|
47
|
+
};
|
|
48
|
+
/** Replies you have not read yet: "2 new". */
|
|
49
|
+
unread?: number;
|
|
50
|
+
}
|
|
51
|
+
export interface ThreadPreviewProps extends ThreadInfo {
|
|
52
|
+
/** Opens the thread in its own view. Without replies to expand, the whole preview is this button. */
|
|
53
|
+
onOpen?: () => void;
|
|
54
|
+
/** The replies, shown under the preview when it expands. With them the preview is a disclosure: a button with aria-expanded. */
|
|
55
|
+
children?: ReactNode;
|
|
56
|
+
/** Expanded (controlled). */
|
|
57
|
+
isExpanded?: boolean;
|
|
58
|
+
/** Expanded at first. */
|
|
59
|
+
defaultExpanded?: boolean;
|
|
60
|
+
/** Called when the preview expands or collapses. */
|
|
61
|
+
onExpandedChange?: (isExpanded: boolean) => void;
|
|
62
|
+
/** Extra class names. */
|
|
63
|
+
className?: string;
|
|
64
|
+
}
|
|
65
|
+
/** A collapsed thread under a message: the people who replied, the count, when the last reply came and a one line snippet of it. A button that opens the thread, or, when you pass the replies as children, a disclosure that expands them in place. */
|
|
66
|
+
export declare function ThreadPreview({ replyCount, participants, lastReplyAt, lastReply, unread, onOpen, children, isExpanded, defaultExpanded, onExpandedChange, className }: ThreadPreviewProps): import("react").JSX.Element;
|
|
67
|
+
export type MessageStatus = 'sending' | 'sent' | 'delivered' | 'read' | 'failed';
|
|
68
|
+
export interface ChatMessageProps {
|
|
69
|
+
/** Who wrote it. */
|
|
70
|
+
author: string;
|
|
71
|
+
/** Their photo. */
|
|
72
|
+
avatarSrc?: string;
|
|
73
|
+
/** The message: text, or anything (images, files, cards). */
|
|
74
|
+
children: ReactNode;
|
|
75
|
+
/** When it was sent: shown as a short time, with the full date on hover. */
|
|
76
|
+
time?: Date;
|
|
77
|
+
/** Written by the current person: on the end side, in the accent bubble. */
|
|
78
|
+
isOwn?: boolean;
|
|
79
|
+
/** Part of a run from the same author: hides the avatar and the name. */
|
|
80
|
+
isGrouped?: boolean;
|
|
81
|
+
/** Delivery state for own messages: sending, sent, delivered, read or failed. */
|
|
82
|
+
status?: MessageStatus;
|
|
83
|
+
/** Marks it as edited. */
|
|
84
|
+
isEdited?: boolean;
|
|
85
|
+
/** Reactions under the bubble. */
|
|
86
|
+
reactions?: Reaction[];
|
|
87
|
+
/** Called when a reaction is toggled; with it, the reactions get an add button. */
|
|
88
|
+
onReact?: (emoji: string) => void;
|
|
89
|
+
/** With onReact: emoji offered as one-press reactions in the hover actions, like ['👍', '❤️', '😂']. */
|
|
90
|
+
quickReactions?: string[];
|
|
91
|
+
/** Number of replies in its thread, shown as a link. */
|
|
92
|
+
replyCount?: number;
|
|
93
|
+
/** More about the thread: who replied, when, the last reply. It sets the count too. */
|
|
94
|
+
thread?: ThreadInfo;
|
|
95
|
+
/** link (default): a link with the count; preview: a collapsed thread with avatars, the last reply and a way to expand it. */
|
|
96
|
+
threadVariant?: 'link' | 'preview';
|
|
97
|
+
/** With threadVariant preview: the replies, shown when the preview expands. */
|
|
98
|
+
threadReplies?: ReactNode;
|
|
99
|
+
/** The expanded preview (controlled). */
|
|
100
|
+
isThreadExpanded?: boolean;
|
|
101
|
+
/** Called when the preview expands or collapses. */
|
|
102
|
+
onThreadExpandedChange?: (isExpanded: boolean) => void;
|
|
103
|
+
/** Opens the thread. */
|
|
104
|
+
onOpenThread?: () => void;
|
|
105
|
+
/** Actions that show on hover and focus: reply, react, more (small IconButtons). */
|
|
106
|
+
actions?: ReactNode;
|
|
107
|
+
/** bubble (default) or plain (no bubble, full width, like a channel). */
|
|
108
|
+
variant?: 'bubble' | 'plain';
|
|
109
|
+
/** Extra class names. */
|
|
110
|
+
className?: string;
|
|
111
|
+
}
|
|
112
|
+
/** One message in a conversation: avatar and name (hidden inside a run), a bubble or plain text, time, delivery state, edited, reactions with quick ones, a thread as a link or a collapsed preview, and hover actions. */
|
|
113
|
+
export declare function ChatMessage({ author, avatarSrc, children, time, isOwn, isGrouped, status, isEdited, reactions, onReact, quickReactions, replyCount, thread, threadVariant, threadReplies, isThreadExpanded, onThreadExpandedChange, onOpenThread, actions, variant, className }: ChatMessageProps): import("react").JSX.Element;
|
|
114
|
+
export interface ChatItem {
|
|
115
|
+
id: string;
|
|
116
|
+
author: string;
|
|
117
|
+
avatarSrc?: string;
|
|
118
|
+
time: Date;
|
|
119
|
+
text: ReactNode;
|
|
120
|
+
isOwn?: boolean;
|
|
121
|
+
status?: MessageStatus;
|
|
122
|
+
isEdited?: boolean;
|
|
123
|
+
reactions?: Reaction[];
|
|
124
|
+
replyCount?: number;
|
|
125
|
+
/** More about its thread: who replied, when, the last reply. */
|
|
126
|
+
thread?: ThreadInfo;
|
|
127
|
+
/** Its replies, for the expanding preview (threadVariant="preview") and for ThreadView. */
|
|
128
|
+
replies?: ChatItem[];
|
|
129
|
+
}
|
|
130
|
+
export interface MessageListProps {
|
|
131
|
+
/** The messages, oldest first. */
|
|
132
|
+
messages: ChatItem[];
|
|
133
|
+
/** Messages from the same author within this many minutes form a run (no repeated avatar and name). Default 5. */
|
|
134
|
+
groupMinutes?: number;
|
|
135
|
+
/** Id of the first unread message: a "New messages" line shows above it. */
|
|
136
|
+
firstUnreadId?: string;
|
|
137
|
+
/** Called when a reaction is toggled on a message. */
|
|
138
|
+
onReact?: (messageId: string, emoji: string) => void;
|
|
139
|
+
/** Emoji offered as one-press reactions on hover and focus, with onReact. */
|
|
140
|
+
quickReactions?: string[];
|
|
141
|
+
/** Called when a thread link is pressed, or Open thread in a preview. */
|
|
142
|
+
onOpenThread?: (messageId: string) => void;
|
|
143
|
+
/** How a message's thread shows: link (default) or preview (avatars, the last reply, and its replies expand in place). */
|
|
144
|
+
threadVariant?: 'link' | 'preview';
|
|
145
|
+
/** Extra actions per message, shown on hover and focus. */
|
|
146
|
+
renderActions?: (m: ChatItem) => ReactNode;
|
|
147
|
+
/** Who is typing, shown at the end. */
|
|
148
|
+
typing?: string[];
|
|
149
|
+
/** bubble (default) or plain. */
|
|
150
|
+
variant?: 'bubble' | 'plain';
|
|
151
|
+
/** Content at the top of the scrolling list, before the first message: the parent of a thread. */
|
|
152
|
+
header?: ReactNode;
|
|
153
|
+
/** Height of the scrolling list; it starts at the newest message and follows new ones while you are at the bottom. */
|
|
154
|
+
height?: number | string;
|
|
155
|
+
/** Name for screen readers. Default "Messages". */
|
|
156
|
+
'aria-label'?: string;
|
|
157
|
+
/** Extra class names. */
|
|
158
|
+
className?: string;
|
|
159
|
+
}
|
|
160
|
+
/** A conversation: day separators (Today, Yesterday, a date), runs from the same author, a New messages line, a typing indicator, threads as links or expanding previews, and scrolling that follows new messages. A log region, so screen readers hear new messages as they arrive. */
|
|
161
|
+
export declare function MessageList({ messages, groupMinutes, firstUnreadId, onReact, quickReactions, onOpenThread, threadVariant, renderActions, typing, variant, header, height, className, 'aria-label': label }: MessageListProps): import("react").JSX.Element;
|
|
162
|
+
export interface ThreadViewProps {
|
|
163
|
+
/** The message the thread hangs from. */
|
|
164
|
+
parent: ChatItem;
|
|
165
|
+
/** The replies, oldest first. */
|
|
166
|
+
replies: ChatItem[];
|
|
167
|
+
/** Called when the thread is closed: the close button or Escape. */
|
|
168
|
+
onClose: () => void;
|
|
169
|
+
/** Called when a reaction is toggled on the parent or a reply. */
|
|
170
|
+
onReact?: (messageId: string, emoji: string) => void;
|
|
171
|
+
/** Emoji offered as one-press reactions on hover and focus, with onReact. */
|
|
172
|
+
quickReactions?: string[];
|
|
173
|
+
/** Extra actions per reply, shown on hover and focus. */
|
|
174
|
+
renderActions?: (m: ChatItem) => ReactNode;
|
|
175
|
+
/** Who is typing a reply. */
|
|
176
|
+
typing?: string[];
|
|
177
|
+
/** The reply box under the replies: a PromptInput, a TextArea and a button. */
|
|
178
|
+
children?: ReactNode;
|
|
179
|
+
/** bubble or plain (default): how the messages look. */
|
|
180
|
+
variant?: 'bubble' | 'plain';
|
|
181
|
+
/** Height of the whole view. Default 520. */
|
|
182
|
+
height?: number | string;
|
|
183
|
+
/** Level of the title heading, 2 to 6. Default 2. */
|
|
184
|
+
headingLevel?: 2 | 3 | 4 | 5 | 6;
|
|
185
|
+
/** Moves focus to the thread title when it opens, and back to what opened it when it closes. Default true. */
|
|
186
|
+
autoFocus?: boolean;
|
|
187
|
+
/** Extra class names. */
|
|
188
|
+
className?: string;
|
|
189
|
+
}
|
|
190
|
+
/** A thread on its own: the parent message, the replies in a log, a reply box, and a close button. When it opens focus moves to its title and Escape closes it, returning focus to the message link that opened it. */
|
|
191
|
+
export declare function ThreadView({ parent, replies, onClose, onReact, quickReactions, renderActions, typing, children, variant, height, headingLevel, autoFocus, className }: ThreadViewProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { type CheckboxProps as RACCheckboxProps, type CheckboxGroupProps as RACCheckboxGroupProps, type RadioProps as RACRadioProps, type RadioGroupProps as RACRadioGroupProps, type SwitchProps as RACSwitchProps, type ValidationResult } from 'react-aria-components';
|
|
3
|
+
export type ChoiceSize = 'sm' | 'md' | 'lg';
|
|
4
|
+
export interface CheckboxProps extends Omit<RACCheckboxProps, 'children'> {
|
|
5
|
+
/** The label next to the box. */
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
/** Help text under the label. */
|
|
8
|
+
description?: ReactNode;
|
|
9
|
+
/** sm (16 px box), md (20 px, default) or lg (24 px). In a group, set it on the group. */
|
|
10
|
+
size?: ChoiceSize;
|
|
11
|
+
/** filled (default: an accent box when checked) or outline (an accent border and check). */
|
|
12
|
+
variant?: 'filled' | 'outline';
|
|
13
|
+
/** Label on the right (default) or on the left. */
|
|
14
|
+
labelPosition?: 'start' | 'end';
|
|
15
|
+
}
|
|
16
|
+
/** A checkbox with checked, indeterminate, invalid, read only and disabled states, three sizes and two looks. */
|
|
17
|
+
export declare function Checkbox({ children, description, size, variant, labelPosition, className, ...props }: CheckboxProps): import("react").JSX.Element;
|
|
18
|
+
export interface ChoiceOption {
|
|
19
|
+
value: string;
|
|
20
|
+
label: ReactNode;
|
|
21
|
+
description?: ReactNode;
|
|
22
|
+
isDisabled?: boolean;
|
|
23
|
+
}
|
|
24
|
+
interface GroupBits {
|
|
25
|
+
/** The visible label for the group. */
|
|
26
|
+
label?: ReactNode;
|
|
27
|
+
/** The options as data, instead of Checkbox or Radio children. */
|
|
28
|
+
items?: ChoiceOption[];
|
|
29
|
+
/** sm, md (default) or lg for every option. */
|
|
30
|
+
size?: ChoiceSize;
|
|
31
|
+
/** filled (default) or outline for every option. */
|
|
32
|
+
variant?: 'filled' | 'outline';
|
|
33
|
+
/** Help text under the group. */
|
|
34
|
+
description?: ReactNode;
|
|
35
|
+
/** Error text, shown when the group is invalid. */
|
|
36
|
+
errorMessage?: ReactNode | ((v: ValidationResult) => ReactNode);
|
|
37
|
+
/** vertical (default) or horizontal. */
|
|
38
|
+
orientation?: 'vertical' | 'horizontal';
|
|
39
|
+
children?: ReactNode;
|
|
40
|
+
}
|
|
41
|
+
export interface CheckboxGroupProps extends Omit<RACCheckboxGroupProps, 'children'>, GroupBits {
|
|
42
|
+
/** default (a list) or cards (bordered tiles, for plans or features). */
|
|
43
|
+
appearance?: 'default' | 'cards';
|
|
44
|
+
/** With items: a parent checkbox that checks or clears them all, and shows a dash when only some are checked. */
|
|
45
|
+
selectAllLabel?: ReactNode;
|
|
46
|
+
}
|
|
47
|
+
/** A labeled set of checkboxes; value is the list of checked values. Pass items and selectAllLabel for a "Select all" parent. */
|
|
48
|
+
export declare function CheckboxGroup({ label, description, errorMessage, orientation, appearance, items, size, variant, selectAllLabel, children, className, value, defaultValue, onChange, ...props }: CheckboxGroupProps): import("react").JSX.Element;
|
|
49
|
+
export interface RadioProps extends Omit<RACRadioProps, 'children'> {
|
|
50
|
+
children?: ReactNode;
|
|
51
|
+
/** Help text under the option label. */
|
|
52
|
+
description?: ReactNode;
|
|
53
|
+
/** sm, md (default) or lg. Usually set on the RadioGroup. */
|
|
54
|
+
size?: ChoiceSize;
|
|
55
|
+
/** filled (default) or outline (an accent ring and dot, no fill). */
|
|
56
|
+
variant?: 'filled' | 'outline';
|
|
57
|
+
/** Label on the right (default) or on the left. */
|
|
58
|
+
labelPosition?: 'start' | 'end';
|
|
59
|
+
}
|
|
60
|
+
/** One option of a RadioGroup. */
|
|
61
|
+
export declare function Radio({ children, description, size, variant, labelPosition, className, ...props }: RadioProps): import("react").JSX.Element;
|
|
62
|
+
export interface RadioGroupProps extends Omit<RACRadioGroupProps, 'children' | 'orientation'>, GroupBits {
|
|
63
|
+
/** default (dots), cards (bordered tiles, good for plans or modes) or buttons (a joined row of buttons). */
|
|
64
|
+
appearance?: 'default' | 'cards' | 'buttons';
|
|
65
|
+
}
|
|
66
|
+
/** One choice from a short list; arrow keys move between options. */
|
|
67
|
+
export declare function RadioGroup({ label, description, errorMessage, orientation, appearance, items, size, variant, children, className, ...props }: RadioGroupProps): import("react").JSX.Element;
|
|
68
|
+
export interface SwitchProps extends Omit<RACSwitchProps, 'children'> {
|
|
69
|
+
children?: ReactNode;
|
|
70
|
+
/** Help text under the label. */
|
|
71
|
+
description?: ReactNode;
|
|
72
|
+
/** sm (36 × 20), md (44 × 24, default) or lg (52 × 28). */
|
|
73
|
+
size?: ChoiceSize;
|
|
74
|
+
/** Label on the left (settings rows) or the right (default). */
|
|
75
|
+
labelPosition?: 'start' | 'end';
|
|
76
|
+
/** Short text inside the track when on, like ON or I. The track grows to fit. */
|
|
77
|
+
onLabel?: ReactNode;
|
|
78
|
+
/** Short text inside the track when off. */
|
|
79
|
+
offLabel?: ReactNode;
|
|
80
|
+
/** An icon in the thumb: true for a check and a cross, or your own icon. */
|
|
81
|
+
thumbIcon?: boolean | ReactNode;
|
|
82
|
+
/** Shows a spinner in the thumb while the change is saved; presses are ignored. */
|
|
83
|
+
isLoading?: boolean;
|
|
84
|
+
}
|
|
85
|
+
/** An on/off setting that applies right away: three sizes, labels in the track, icons in the thumb, and a loading state. */
|
|
86
|
+
export declare function Switch({ children, description, size, labelPosition, onLabel, offLabel, thumbIcon, isLoading, className, ...props }: SwitchProps): import("react").JSX.Element;
|
|
87
|
+
export {};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { type ColorPickerProps as RACColorPickerProps, type ColorAreaProps as RACColorAreaProps, type ColorSliderProps as RACColorSliderProps, type ColorWheelProps as RACColorWheelProps, type ColorFieldProps as RACColorFieldProps, type ColorSwatchPickerProps as RACColorSwatchPickerProps, type ValidationResult } from 'react-aria-components';
|
|
3
|
+
export interface ColorPickerProps extends Omit<RACColorPickerProps, 'children'> {
|
|
4
|
+
/** The visible label above the picker. */
|
|
5
|
+
label?: ReactNode;
|
|
6
|
+
/** Preset colors to pick from (hex). */
|
|
7
|
+
swatches?: string[];
|
|
8
|
+
/** Show the hex field. Default true. */
|
|
9
|
+
showField?: boolean;
|
|
10
|
+
/** Check this color against a background and show the WCAG ratio. */
|
|
11
|
+
contrastWith?: string;
|
|
12
|
+
/** Extra class names for the root element. */
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
/** Pick a color by area, hue, hex or presets, with a live contrast check (plus WCAG). */
|
|
16
|
+
export declare function ColorPicker({ label, swatches, showField, contrastWith, className, ...props }: ColorPickerProps): import("react").JSX.Element;
|
|
17
|
+
/** The WCAG 2 contrast ratio between two colors (1 to 21). */
|
|
18
|
+
export declare function contrastRatio(a: string, b: string): number;
|
|
19
|
+
export interface ContrastBadgeProps {
|
|
20
|
+
/** The text color (any CSS color). */
|
|
21
|
+
foreground: string;
|
|
22
|
+
/** The background color (any CSS color). */
|
|
23
|
+
background: string;
|
|
24
|
+
/** Large text (24 px, or 18.66 px bold) needs 3:1 instead of 4.5:1. */
|
|
25
|
+
large?: boolean;
|
|
26
|
+
/** Show the colors as a sample. Default true. */
|
|
27
|
+
showSample?: boolean;
|
|
28
|
+
}
|
|
29
|
+
/** The contrast of a color pair with its WCAG verdict: AAA, AA, AA large or fail. */
|
|
30
|
+
export declare function ContrastBadge({ foreground, background, large, showSample }: ContrastBadgeProps): import("react").JSX.Element;
|
|
31
|
+
export interface ColorAreaProps extends Omit<RACColorAreaProps, 'children'> {
|
|
32
|
+
/** Width and height in px. Default 240 × 180; set the width with style for a fluid area. */
|
|
33
|
+
size?: number;
|
|
34
|
+
}
|
|
35
|
+
/** A two-dimensional color area: saturation and brightness by default, or any two channels. Arrows move the thumb, Shift moves faster. */
|
|
36
|
+
export declare function ColorArea({ size, className, style, colorSpace, xChannel, yChannel, ...props }: ColorAreaProps): import("react").JSX.Element;
|
|
37
|
+
export interface ColorSliderProps extends Omit<RACColorSliderProps, 'children'> {
|
|
38
|
+
/** The visible label; the channel name when left out. */
|
|
39
|
+
label?: ReactNode;
|
|
40
|
+
/** Shows the value next to the label. */
|
|
41
|
+
showValue?: boolean;
|
|
42
|
+
}
|
|
43
|
+
/** A slider for one color channel: hue, saturation, lightness, alpha, red, green or blue. Horizontal or vertical. */
|
|
44
|
+
export declare function ColorSlider({ label, showValue, className, orientation, ...props }: ColorSliderProps): import("react").JSX.Element;
|
|
45
|
+
export interface ColorWheelProps extends Omit<RACColorWheelProps, 'children' | 'outerRadius' | 'innerRadius'> {
|
|
46
|
+
/** Diameter in px. Default 200. */
|
|
47
|
+
size?: number;
|
|
48
|
+
/** Ring thickness in px. Default 24. */
|
|
49
|
+
thickness?: number;
|
|
50
|
+
}
|
|
51
|
+
/** A hue wheel: drag around the ring, or use the arrow keys. */
|
|
52
|
+
export declare function ColorWheel({ size, thickness, className, ...props }: ColorWheelProps): import("react").JSX.Element;
|
|
53
|
+
export interface ColorFieldProps extends Omit<RACColorFieldProps, 'children'> {
|
|
54
|
+
/** The visible label. */
|
|
55
|
+
label?: ReactNode;
|
|
56
|
+
/** Help text under the field. */
|
|
57
|
+
description?: ReactNode;
|
|
58
|
+
/** Error text when the color cannot be read. */
|
|
59
|
+
errorMessage?: ReactNode | ((v: ValidationResult) => ReactNode);
|
|
60
|
+
/** Shows a swatch of the color before the value. Default true. */
|
|
61
|
+
showSwatch?: boolean;
|
|
62
|
+
/** Placeholder, like #C084FC. */
|
|
63
|
+
placeholder?: string;
|
|
64
|
+
}
|
|
65
|
+
/** Type a color: hex by default, or one channel (hue, red, alpha...) as a number. */
|
|
66
|
+
export declare function ColorField({ label, description, errorMessage, showSwatch, placeholder, className, value, defaultValue, onChange, ...props }: ColorFieldProps): import("react").JSX.Element;
|
|
67
|
+
export interface ColorSwatchPickerProps extends Omit<RACColorSwatchPickerProps, 'children'> {
|
|
68
|
+
/** The colors to choose from (any CSS color). */
|
|
69
|
+
colors: string[];
|
|
70
|
+
/** sm 24, md 32 (default), lg 40 px. */
|
|
71
|
+
size?: 'sm' | 'md' | 'lg';
|
|
72
|
+
/** rounded (default), circle or square. */
|
|
73
|
+
shape?: 'rounded' | 'circle' | 'square';
|
|
74
|
+
}
|
|
75
|
+
/** Pick one of a set of colors; arrow keys move between them. */
|
|
76
|
+
export declare function ColorSwatchPicker({ colors, size, shape, className, ...props }: ColorSwatchPickerProps): import("react").JSX.Element;
|
|
77
|
+
export { parseColor } from 'react-aria-components';
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type Key } from 'react-aria-components';
|
|
3
|
+
import type { MotionProp } from '@alea-design/motion';
|
|
4
|
+
import { type MatchStyle } from './Highlight';
|
|
5
|
+
export interface AutocompleteItem {
|
|
6
|
+
id: Key;
|
|
7
|
+
label: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
group?: string;
|
|
10
|
+
icon?: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
export { Highlight, getMatchRanges } from './Highlight';
|
|
13
|
+
export interface AutocompleteProps {
|
|
14
|
+
/** The visible label. */
|
|
15
|
+
label?: ReactNode;
|
|
16
|
+
/** Help text shown under the field. */
|
|
17
|
+
description?: ReactNode;
|
|
18
|
+
/** Shown while there is no value. */
|
|
19
|
+
placeholder?: string;
|
|
20
|
+
/** Static items, filtered as people type. */
|
|
21
|
+
items?: AutocompleteItem[];
|
|
22
|
+
/** Or load matches as people type (debounced); return the items. */
|
|
23
|
+
loadItems?: (query: string, signal: AbortSignal) => Promise<AutocompleteItem[]>;
|
|
24
|
+
/** Wait this long after typing before loading, in ms. Default 250. */
|
|
25
|
+
debounce?: number;
|
|
26
|
+
/** Shown when the field is empty and focused: recent searches or suggestions. */
|
|
27
|
+
recent?: AutocompleteItem[];
|
|
28
|
+
/** Shows the loading spinner while you load the items yourself (with items). It also shows by itself while loadItems runs. */
|
|
29
|
+
isLoading?: boolean;
|
|
30
|
+
/** Marks the part of each suggestion that matches what was typed. Default true. */
|
|
31
|
+
highlightMatch?: boolean;
|
|
32
|
+
/** How the match looks: tint (default), bold or underline. */
|
|
33
|
+
matchStyle?: MatchStyle;
|
|
34
|
+
/** Called with the picked item. */
|
|
35
|
+
onSelect?: (item: AutocompleteItem) => void;
|
|
36
|
+
/** Called on Enter with free text (a search). */
|
|
37
|
+
onSubmit?: (text: string) => void;
|
|
38
|
+
/** Least characters before suggesting. Default 1. */
|
|
39
|
+
minChars?: number;
|
|
40
|
+
/** Extra class names for the root element. */
|
|
41
|
+
className?: string;
|
|
42
|
+
/** How the popup enters and leaves: a preset (fade, scale, pop, slide-down, blur...), false for none, or options. */
|
|
43
|
+
motion?: MotionProp;
|
|
44
|
+
}
|
|
45
|
+
/** Search with suggestions: static or loaded as you type, grouped, matches highlighted, recent searches when empty. */
|
|
46
|
+
export declare function Autocomplete({ motion, label, description, placeholder, items, loadItems, debounce, recent, isLoading, highlightMatch, matchStyle, onSelect, onSubmit, minChars, className }: AutocompleteProps): import("react").JSX.Element;
|
|
47
|
+
export interface MultiSelectProps {
|
|
48
|
+
/** The visible label. */
|
|
49
|
+
label?: ReactNode;
|
|
50
|
+
/** Help text shown under the field. */
|
|
51
|
+
description?: ReactNode;
|
|
52
|
+
/** The options: id, label, optional description. */
|
|
53
|
+
items: Array<{
|
|
54
|
+
id: Key;
|
|
55
|
+
label: string;
|
|
56
|
+
description?: string;
|
|
57
|
+
}>;
|
|
58
|
+
/** The selected ids (controlled). */
|
|
59
|
+
value?: Key[];
|
|
60
|
+
/** The selected ids to start with. */
|
|
61
|
+
defaultValue?: Key[];
|
|
62
|
+
/** Called with the selected ids. */
|
|
63
|
+
onChange?: (keys: Key[]) => void;
|
|
64
|
+
/** Shown while there is no value. */
|
|
65
|
+
placeholder?: string;
|
|
66
|
+
/** Adds a search field to the list. Default true when there are more than 8 items. */
|
|
67
|
+
searchable?: boolean;
|
|
68
|
+
/** Adds "Select all" and "Clear". Default true. */
|
|
69
|
+
showActions?: boolean;
|
|
70
|
+
/** Disables every part of it. */
|
|
71
|
+
isDisabled?: boolean;
|
|
72
|
+
/** How the popup enters and leaves: a preset (fade, scale, pop, slide-down, blur...), false for none, or options. */
|
|
73
|
+
motion?: MotionProp;
|
|
74
|
+
}
|
|
75
|
+
/** Pick several options from a list with checkboxes; the trigger summarizes the picks. */
|
|
76
|
+
export declare function MultiSelect({ motion, label, description, items, value, defaultValue, onChange, placeholder, searchable, showActions, isDisabled }: MultiSelectProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { type CSSProperties, type ReactNode } from 'react';
|
|
2
|
+
import { type ComboBoxProps as RACComboBoxProps, type ValidationResult, type Key } from 'react-aria-components';
|
|
3
|
+
import type { MotionProp } from '@alea-design/motion';
|
|
4
|
+
import { type FieldSize, type FieldVariant } from '../field/Field';
|
|
5
|
+
import type { Responsive } from '../../utils/responsive';
|
|
6
|
+
import { type SelectOption } from '../select/Select';
|
|
7
|
+
import { type MatchStyle } from './Highlight';
|
|
8
|
+
export interface ComboBoxProps<T extends object = SelectOption> extends Omit<RACComboBoxProps<T>, 'children'> {
|
|
9
|
+
/** The visible label. */
|
|
10
|
+
label?: ReactNode;
|
|
11
|
+
/** Help text under the field. */
|
|
12
|
+
description?: ReactNode;
|
|
13
|
+
/** Error text, shown when invalid. */
|
|
14
|
+
errorMessage?: ReactNode | ((v: ValidationResult) => ReactNode);
|
|
15
|
+
/** A warning that does not block, shown under the field in amber. */
|
|
16
|
+
warningMessage?: ReactNode;
|
|
17
|
+
/** Shows "(optional)" after the label. */
|
|
18
|
+
showOptional?: boolean;
|
|
19
|
+
/** Shown while the field is empty. */
|
|
20
|
+
placeholder?: string;
|
|
21
|
+
/** Option rendering for custom items; plain {id, label} items render as options. */
|
|
22
|
+
children?: ReactNode | ((item: T) => ReactNode);
|
|
23
|
+
/** Shown when nothing matches. Default "No matches". */
|
|
24
|
+
emptyText?: ReactNode;
|
|
25
|
+
/** xs 28 px, sm 32 px, md 44 px (default), lg 48 px, xl 56 px. Can change per breakpoint. */
|
|
26
|
+
size?: Responsive<FieldSize>;
|
|
27
|
+
/** outline (default), filled, underline or borderless, like TextField. */
|
|
28
|
+
variant?: FieldVariant;
|
|
29
|
+
/** top (default) or side (from 640 px up). */
|
|
30
|
+
labelPosition?: 'top' | 'side';
|
|
31
|
+
/** An icon or text before the input. */
|
|
32
|
+
prefix?: ReactNode;
|
|
33
|
+
/** Shows a clear button while there is text or a selection. */
|
|
34
|
+
isClearable?: boolean;
|
|
35
|
+
/** Marks the part of each option that matches what was typed, with a mark element (screen readers can say it). */
|
|
36
|
+
highlightMatch?: boolean;
|
|
37
|
+
/** How the match looks: tint (default), bold or underline. */
|
|
38
|
+
matchStyle?: MatchStyle;
|
|
39
|
+
/** Shows a spinner at the end of the text, for results that are loading (async search). It takes no room, you can keep typing, and screen readers hear the field as busy. */
|
|
40
|
+
isLoading?: boolean;
|
|
41
|
+
/** Content under the list inside the popover, like "Create “…”". */
|
|
42
|
+
footer?: ReactNode;
|
|
43
|
+
/** Renders only the visible options: pass the row height (40). */
|
|
44
|
+
virtualized?: number;
|
|
45
|
+
/** How the popup enters and leaves: a preset (fade, scale, pop, slide-down, blur...), false for none, or options. */
|
|
46
|
+
motion?: MotionProp;
|
|
47
|
+
}
|
|
48
|
+
/** Type to filter a list and pick one. Pass defaultItems to filter as people type, or items to filter yourself (async search). allowsCustomValue keeps free text. */
|
|
49
|
+
export declare function ComboBox<T extends object = SelectOption>({ motion, label, description, errorMessage, warningMessage, showOptional, placeholder, children, emptyText, size, variant, labelPosition, prefix, isClearable, highlightMatch, matchStyle, isLoading, footer, virtualized, className, ...props }: ComboBoxProps<T>): import("react").JSX.Element;
|
|
50
|
+
export interface TagFieldProps {
|
|
51
|
+
/** The visible label. */
|
|
52
|
+
label?: ReactNode;
|
|
53
|
+
/** Help text shown under the field. */
|
|
54
|
+
description?: ReactNode;
|
|
55
|
+
/** The options to pick from. */
|
|
56
|
+
items: SelectOption[];
|
|
57
|
+
/** Picked ids (controlled). */
|
|
58
|
+
value?: Key[];
|
|
59
|
+
/** The tags to start with. */
|
|
60
|
+
defaultValue?: Key[];
|
|
61
|
+
/** Called with the tags. */
|
|
62
|
+
onChange?: (value: Key[]) => void;
|
|
63
|
+
/** Shown while there is no value. */
|
|
64
|
+
placeholder?: string;
|
|
65
|
+
/** Lets people add values that are not in the list (Enter). */
|
|
66
|
+
allowsCustomValue?: boolean;
|
|
67
|
+
/** Most picks allowed. */
|
|
68
|
+
max?: number;
|
|
69
|
+
/** Shows a spinner in the field while options load; see ComboBox. */
|
|
70
|
+
isLoading?: boolean;
|
|
71
|
+
/** Marks the part of each option that matches what was typed; see ComboBox. */
|
|
72
|
+
highlightMatch?: boolean;
|
|
73
|
+
/** Disables every part of it. */
|
|
74
|
+
isDisabled?: boolean;
|
|
75
|
+
/** Extra class names for the root element. */
|
|
76
|
+
className?: string;
|
|
77
|
+
/** Inline styles for the root element. */
|
|
78
|
+
style?: CSSProperties;
|
|
79
|
+
}
|
|
80
|
+
/** Pick several options by typing; picks show as removable tags. */
|
|
81
|
+
export declare function TagField({ label, description, items, value, defaultValue, onChange, placeholder, allowsCustomValue, max, isLoading, highlightMatch, isDisabled, className, style }: TagFieldProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export type MatchStyle = 'tint' | 'bold' | 'underline';
|
|
2
|
+
export type MatchMode = 'words' | 'phrase';
|
|
3
|
+
/** Where a query matches a text, as [start, end) ranges in the original text: case and accent insensitive, overlapping matches merged. */
|
|
4
|
+
export declare function getMatchRanges(text: string, query: string, match?: MatchMode): Array<[number, number]>;
|
|
5
|
+
/** Marks the part of a text that matches the query, for search results and suggestions. */
|
|
6
|
+
export interface HighlightProps {
|
|
7
|
+
/** The full text. */
|
|
8
|
+
text: string;
|
|
9
|
+
/** What to look for: case and accent insensitive. */
|
|
10
|
+
query: string;
|
|
11
|
+
/** words (default): each word is marked on its own; phrase: only the whole query. */
|
|
12
|
+
match?: MatchMode;
|
|
13
|
+
/** tint (default), bold or underline. */
|
|
14
|
+
matchStyle?: MatchStyle;
|
|
15
|
+
}
|
|
16
|
+
/** Marks the part of a text that matches the query, for search results and suggestions. Matches are mark elements, so assistive technology can say them; the text itself is unchanged. */
|
|
17
|
+
export declare function Highlight({ text, query, match, matchStyle }: HighlightProps): import("react").JSX.Element;
|
|
18
|
+
export declare function MatchedText({ text }: {
|
|
19
|
+
text: string;
|
|
20
|
+
}): import("react").JSX.Element;
|
|
21
|
+
export interface OptionMatch {
|
|
22
|
+
query: string;
|
|
23
|
+
style: MatchStyle;
|
|
24
|
+
match: MatchMode;
|
|
25
|
+
}
|
|
26
|
+
export declare const OptionMatchContext: import("react").Context<OptionMatch | null>;
|
|
27
|
+
export declare const useOptionMatch: () => OptionMatch | null;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { MotionProp } from '@alea-design/motion';
|
|
3
|
+
import { type Key } from 'react-aria-components';
|
|
4
|
+
export interface Command {
|
|
5
|
+
id: Key;
|
|
6
|
+
label: string;
|
|
7
|
+
/** Group heading, e.g. "Navigation" or "Actions". */
|
|
8
|
+
group?: string;
|
|
9
|
+
/** A second line. */
|
|
10
|
+
description?: string;
|
|
11
|
+
icon?: ReactNode;
|
|
12
|
+
/** Shown on the right, e.g. ⌘D. */
|
|
13
|
+
shortcut?: string;
|
|
14
|
+
/** More words that should find it. */
|
|
15
|
+
keywords?: string[];
|
|
16
|
+
onAction: () => void;
|
|
17
|
+
}
|
|
18
|
+
export interface CommandPaletteProps {
|
|
19
|
+
/** The commands, in groups: id, label, icon, shortcut, keywords and onAction. */
|
|
20
|
+
commands: Command[];
|
|
21
|
+
/** Whether it is open (controlled). Without it, the shortcut toggles it. */
|
|
22
|
+
isOpen?: boolean;
|
|
23
|
+
/** Called when it opens or closes. */
|
|
24
|
+
onOpenChange?: (open: boolean) => void;
|
|
25
|
+
/** Opens with ⌘K / Ctrl+K anywhere. Default true. */
|
|
26
|
+
hotkey?: boolean;
|
|
27
|
+
/** Shown in the search field. Default "Type a command or search…". */
|
|
28
|
+
placeholder?: string;
|
|
29
|
+
/** Shown when nothing matches. */
|
|
30
|
+
emptyText?: ReactNode;
|
|
31
|
+
/** How it enters and leaves (default rise): a preset, false, or options. */
|
|
32
|
+
motion?: MotionProp;
|
|
33
|
+
}
|
|
34
|
+
/** Search every action and page from the keyboard (⌘K). */
|
|
35
|
+
export declare function CommandPalette({ commands, isOpen, onOpenChange, motion, hotkey, placeholder, emptyText }: CommandPaletteProps): import("react").JSX.Element;
|