@hydrateless/react 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +443 -37
- package/dist/index.js +877 -85
- package/package.json +5 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { DependencyList, RefObject, HTMLAttributes, ReactNode, ReactElement, InputHTMLAttributes,
|
|
3
|
-
import { Disposer, EnhanceTocOptions, ToastApi } from '@hydrateless/enhancers';
|
|
2
|
+
import { DependencyList, RefObject, HTMLAttributes, ReactNode, ButtonHTMLAttributes, LiHTMLAttributes, AnchorHTMLAttributes, ReactElement, InputHTMLAttributes, TextareaHTMLAttributes, SelectHTMLAttributes, LabelHTMLAttributes, ProgressHTMLAttributes } from 'react';
|
|
3
|
+
import { Disposer, EnhanceTocOptions, EnhanceTabsOptions, EnhanceDropdownOptions, EnhanceMenuOptions, ToastApi, EnhanceComboboxOptions } from '@hydrateless/enhancers';
|
|
4
4
|
export { Disposer } from '@hydrateless/enhancers';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -54,62 +54,154 @@ interface DisclosureProps extends Omit<HTMLAttributes<HTMLDetailsElement>, 'titl
|
|
|
54
54
|
*/
|
|
55
55
|
declare function Disclosure({ summary, defaultOpen, children, ...rest }: DisclosureProps): react.JSX.Element;
|
|
56
56
|
|
|
57
|
-
interface TabItem {
|
|
58
|
-
label: ReactNode;
|
|
59
|
-
content: ReactNode;
|
|
60
|
-
}
|
|
61
57
|
interface TabsProps extends HTMLAttributes<HTMLDivElement> {
|
|
62
|
-
|
|
58
|
+
/** `manual` (default): arrows move focus, Enter/Space activates. `automatic`: arrows activate immediately. */
|
|
59
|
+
activation?: EnhanceTabsOptions['activation'];
|
|
60
|
+
orientation?: EnhanceTabsOptions['orientation'];
|
|
63
61
|
}
|
|
64
62
|
/**
|
|
65
|
-
* Tabbed interface.
|
|
66
|
-
*
|
|
63
|
+
* Tabbed interface root. Compose with `<TabList>`, `<Tab>`, and `<TabPanel>`.
|
|
64
|
+
* The enhancer wires ARIA roles, roving tabindex, and arrow-key navigation
|
|
65
|
+
* once the markup is mounted.
|
|
66
|
+
*
|
|
67
|
+
* ```tsx
|
|
68
|
+
* <Tabs>
|
|
69
|
+
* <TabList>
|
|
70
|
+
* <Tab>Overview</Tab>
|
|
71
|
+
* <Tab>Install</Tab>
|
|
72
|
+
* </TabList>
|
|
73
|
+
* <TabPanel>Zero runtime by default.</TabPanel>
|
|
74
|
+
* <TabPanel>npm install hydrateless</TabPanel>
|
|
75
|
+
* </Tabs>
|
|
76
|
+
* ```
|
|
67
77
|
*/
|
|
68
|
-
declare function Tabs({
|
|
78
|
+
declare function Tabs({ activation, orientation, children, ...rest }: TabsProps): react.JSX.Element;
|
|
79
|
+
type TabListProps = HTMLAttributes<HTMLDivElement>;
|
|
80
|
+
/** The row of tab triggers. Renders `role="tablist"`. */
|
|
81
|
+
declare function TabList({ children, ...rest }: TabListProps): react.JSX.Element;
|
|
82
|
+
type TabProps = ButtonHTMLAttributes<HTMLButtonElement>;
|
|
83
|
+
/** A single tab trigger. Renders `role="tab"`. */
|
|
84
|
+
declare function Tab({ children, type, ...rest }: TabProps): react.JSX.Element;
|
|
85
|
+
type TabPanelProps = HTMLAttributes<HTMLDivElement>;
|
|
86
|
+
/** Content for the matching tab. Renders `role="tabpanel"`. */
|
|
87
|
+
declare function TabPanel({ children, ...rest }: TabPanelProps): react.JSX.Element;
|
|
69
88
|
|
|
70
|
-
interface
|
|
71
|
-
|
|
89
|
+
interface DropdownProps extends HTMLAttributes<HTMLDivElement> {
|
|
90
|
+
placement?: EnhanceDropdownOptions['placement'];
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Button-triggered menu following the WAI-ARIA menu-button pattern. Compose with
|
|
94
|
+
* `<DropdownTrigger>`, `<DropdownMenu>`, `<DropdownItem>`, and
|
|
95
|
+
* `<DropdownSeparator>`. The enhancer adds keyboard navigation, typeahead, and
|
|
96
|
+
* `aria-expanded`/`role` wiring.
|
|
97
|
+
*
|
|
98
|
+
* ```tsx
|
|
99
|
+
* <Dropdown>
|
|
100
|
+
* <DropdownTrigger>Actions</DropdownTrigger>
|
|
101
|
+
* <DropdownMenu>
|
|
102
|
+
* <DropdownItem onSelect={edit}>Edit</DropdownItem>
|
|
103
|
+
* <DropdownSeparator />
|
|
104
|
+
* <DropdownItem onSelect={remove}>Delete</DropdownItem>
|
|
105
|
+
* </DropdownMenu>
|
|
106
|
+
* </Dropdown>
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
109
|
+
declare function Dropdown({ placement, children, ...rest }: DropdownProps): react.JSX.Element;
|
|
110
|
+
type DropdownTriggerProps = ButtonHTMLAttributes<HTMLButtonElement>;
|
|
111
|
+
/** The button that opens the menu. */
|
|
112
|
+
declare function DropdownTrigger({ children, type, ...rest }: DropdownTriggerProps): react.JSX.Element;
|
|
113
|
+
type DropdownMenuProps = HTMLAttributes<HTMLUListElement>;
|
|
114
|
+
/** The menu surface; holds `<DropdownItem>` and `<DropdownSeparator>`. */
|
|
115
|
+
declare function DropdownMenu({ children, ...rest }: DropdownMenuProps): react.JSX.Element;
|
|
116
|
+
interface DropdownItemProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
117
|
+
/** Convenience handler fired on click; you can also pass `onClick`. */
|
|
72
118
|
onSelect?: () => void;
|
|
73
|
-
separator?: boolean;
|
|
74
|
-
disabled?: boolean;
|
|
75
119
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
120
|
+
/** A selectable menu item (`role="menuitem"`). */
|
|
121
|
+
declare function DropdownItem({ children, onSelect, onClick, type, ...rest }: DropdownItemProps): react.JSX.Element;
|
|
122
|
+
type DropdownSeparatorProps = Omit<LiHTMLAttributes<HTMLLIElement>, 'role'>;
|
|
123
|
+
/** A visual divider between groups of items. */
|
|
124
|
+
declare function DropdownSeparator(props: DropdownSeparatorProps): react.JSX.Element;
|
|
125
|
+
|
|
126
|
+
interface MenuProps extends HTMLAttributes<HTMLUListElement> {
|
|
127
|
+
orientation?: EnhanceMenuOptions['orientation'];
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Menubar / navigation menu with single-level submenus. Compose with
|
|
131
|
+
* `<MenuItem>`; nest items by passing a `submenu`. The enhancer wires roving
|
|
132
|
+
* tabindex, orientation-aware arrow navigation, and submenu toggling.
|
|
133
|
+
*
|
|
134
|
+
* ```tsx
|
|
135
|
+
* <Menu orientation="horizontal">
|
|
136
|
+
* <MenuItem href="/">Home</MenuItem>
|
|
137
|
+
* <MenuItem submenu={<><MenuItem href="/docs">Docs</MenuItem></>}>Resources</MenuItem>
|
|
138
|
+
* </Menu>
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
141
|
+
declare function Menu({ orientation, children, ...rest }: MenuProps): react.JSX.Element;
|
|
142
|
+
interface MenuItemProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'href' | 'type'> {
|
|
143
|
+
/** Render as a link instead of a button. */
|
|
144
|
+
href?: string;
|
|
145
|
+
/** Convenience handler fired on activation. */
|
|
146
|
+
onSelect?: () => void;
|
|
147
|
+
/** Nested `<MenuItem>`s; renders a single-level submenu. */
|
|
148
|
+
submenu?: ReactNode;
|
|
149
|
+
/** Extra attributes for the `<a>` when `href` is set. */
|
|
150
|
+
anchorProps?: AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
79
151
|
}
|
|
80
152
|
/**
|
|
81
|
-
*
|
|
82
|
-
*
|
|
153
|
+
* A menu entry. Children are the label; pass `submenu` to nest a flyout. With
|
|
154
|
+
* `href` it renders an anchor, otherwise a button.
|
|
83
155
|
*/
|
|
84
|
-
declare function
|
|
156
|
+
declare function MenuItem({ href, onSelect, onClick, submenu, anchorProps, children, ...rest }: MenuItemProps): react.JSX.Element;
|
|
85
157
|
|
|
86
158
|
interface ModalProps extends Omit<HTMLAttributes<HTMLDialogElement>, 'title' | 'onClick'> {
|
|
87
159
|
open: boolean;
|
|
88
160
|
onClose?: () => void;
|
|
89
|
-
title?: ReactNode;
|
|
90
|
-
footer?: ReactNode;
|
|
91
161
|
closeOnBackdrop?: boolean;
|
|
92
162
|
}
|
|
93
163
|
/**
|
|
94
164
|
* Controlled dialog overlay. Driven by the `open` prop via the native
|
|
95
|
-
* `<dialog>` element, which provides focus containment in the top layer.
|
|
96
|
-
*
|
|
165
|
+
* `<dialog>` element, which provides focus containment in the top layer. Compose
|
|
166
|
+
* with `<ModalHeader>`, `<ModalBody>`, and `<ModalFooter>`. Wire `onClose` so
|
|
167
|
+
* Escape and backdrop clicks can update your state.
|
|
168
|
+
*
|
|
169
|
+
* ```tsx
|
|
170
|
+
* <Modal open={open} onClose={close}>
|
|
171
|
+
* <ModalHeader>Confirm</ModalHeader>
|
|
172
|
+
* <ModalBody>Are you sure?</ModalBody>
|
|
173
|
+
* <ModalFooter><Button onClick={close}>Close</Button></ModalFooter>
|
|
174
|
+
* </Modal>
|
|
175
|
+
* ```
|
|
97
176
|
*/
|
|
98
|
-
declare function Modal({ open, onClose,
|
|
177
|
+
declare function Modal({ open, onClose, closeOnBackdrop, className, children, ...rest }: ModalProps): react.JSX.Element;
|
|
178
|
+
type ModalSectionProps = HTMLAttributes<HTMLDivElement>;
|
|
179
|
+
/** Modal heading region; its content labels the dialog for assistive tech. */
|
|
180
|
+
declare function ModalHeader({ className, ...rest }: ModalSectionProps): react.JSX.Element;
|
|
181
|
+
/** Modal main content region. */
|
|
182
|
+
declare function ModalBody({ className, ...rest }: ModalSectionProps): react.JSX.Element;
|
|
183
|
+
/** Modal actions region. */
|
|
184
|
+
declare function ModalFooter({ className, ...rest }: ModalSectionProps): react.JSX.Element;
|
|
99
185
|
|
|
100
186
|
interface DrawerProps extends Omit<HTMLAttributes<HTMLDialogElement>, 'title' | 'onClick'> {
|
|
101
187
|
open: boolean;
|
|
102
188
|
onClose?: () => void;
|
|
103
189
|
side?: 'left' | 'right';
|
|
104
|
-
title?: ReactNode;
|
|
105
|
-
footer?: ReactNode;
|
|
106
190
|
closeOnBackdrop?: boolean;
|
|
107
191
|
}
|
|
108
192
|
/**
|
|
109
193
|
* Controlled off-canvas panel built on the native `<dialog>` element. Mirrors
|
|
110
|
-
* {@link Modal} but slides in from the chosen `side`.
|
|
194
|
+
* {@link Modal} but slides in from the chosen `side`. Compose with
|
|
195
|
+
* `<DrawerHeader>`, `<DrawerBody>`, and `<DrawerFooter>`.
|
|
111
196
|
*/
|
|
112
|
-
declare function Drawer({ open, onClose, side,
|
|
197
|
+
declare function Drawer({ open, onClose, side, closeOnBackdrop, className, children, ...rest }: DrawerProps): react.JSX.Element;
|
|
198
|
+
type DrawerSectionProps = HTMLAttributes<HTMLDivElement>;
|
|
199
|
+
/** Drawer heading region. */
|
|
200
|
+
declare function DrawerHeader({ className, ...rest }: DrawerSectionProps): react.JSX.Element;
|
|
201
|
+
/** Drawer main content region. */
|
|
202
|
+
declare function DrawerBody({ className, ...rest }: DrawerSectionProps): react.JSX.Element;
|
|
203
|
+
/** Drawer actions region. */
|
|
204
|
+
declare function DrawerFooter({ className, ...rest }: DrawerSectionProps): react.JSX.Element;
|
|
113
205
|
|
|
114
206
|
interface PopoverProps extends HTMLAttributes<HTMLDivElement> {
|
|
115
207
|
open: boolean;
|
|
@@ -135,16 +227,28 @@ interface TooltipProps {
|
|
|
135
227
|
*/
|
|
136
228
|
declare function Tooltip({ label, children, id }: TooltipProps): react.JSX.Element;
|
|
137
229
|
|
|
138
|
-
|
|
139
|
-
|
|
230
|
+
type BreadcrumbProps = HTMLAttributes<HTMLElement>;
|
|
231
|
+
/**
|
|
232
|
+
* Semantic breadcrumb navigation (`<nav> > <ol>`). CSS-only, no enhancer.
|
|
233
|
+
* Compose with `<BreadcrumbItem>`.
|
|
234
|
+
*
|
|
235
|
+
* ```tsx
|
|
236
|
+
* <Breadcrumb>
|
|
237
|
+
* <BreadcrumbItem href="/">Home</BreadcrumbItem>
|
|
238
|
+
* <BreadcrumbItem current>Components</BreadcrumbItem>
|
|
239
|
+
* </Breadcrumb>
|
|
240
|
+
* ```
|
|
241
|
+
*/
|
|
242
|
+
declare function Breadcrumb({ children, ...rest }: BreadcrumbProps): react.JSX.Element;
|
|
243
|
+
interface BreadcrumbItemProps extends Omit<LiHTMLAttributes<HTMLLIElement>, 'children'> {
|
|
140
244
|
href?: string;
|
|
245
|
+
/** Marks the current page; renders a non-link with `aria-current="page"`. */
|
|
141
246
|
current?: boolean;
|
|
247
|
+
children?: ReactNode;
|
|
248
|
+
anchorProps?: AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
142
249
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
}
|
|
146
|
-
/** Semantic breadcrumb navigation (`<nav> > <ol>`). CSS-only, no enhancer. */
|
|
147
|
-
declare function Breadcrumb({ items, ...rest }: BreadcrumbProps): react.JSX.Element;
|
|
250
|
+
/** A single crumb. Renders a link unless `current` (or no `href`) is set. */
|
|
251
|
+
declare function BreadcrumbItem({ href, current, anchorProps, children, ...rest }: BreadcrumbItemProps): react.JSX.Element;
|
|
148
252
|
|
|
149
253
|
interface SwitchProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type'> {
|
|
150
254
|
children?: ReactNode;
|
|
@@ -180,4 +284,306 @@ declare function ToastProvider({ children }: ToastProviderProps): react.JSX.Elem
|
|
|
180
284
|
/** Access the toast API. Must be called within a {@link ToastProvider}. */
|
|
181
285
|
declare function useToast(): ToastApi;
|
|
182
286
|
|
|
183
|
-
|
|
287
|
+
interface ComboboxProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
|
288
|
+
filter?: EnhanceComboboxOptions['filter'];
|
|
289
|
+
autoHighlight?: EnhanceComboboxOptions['autoHighlight'];
|
|
290
|
+
/** Fires with the committed value when an option is selected. */
|
|
291
|
+
onValueChange?: (value: string) => void;
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Editable combobox (input + listbox) implementing the APG pattern. Compose with
|
|
295
|
+
* `<ComboboxInput>`, `<ComboboxList>`, and `<ComboboxOption>`. The enhancer adds
|
|
296
|
+
* filtering, `aria-activedescendant` navigation, and selection.
|
|
297
|
+
*
|
|
298
|
+
* ```tsx
|
|
299
|
+
* <Combobox onValueChange={setValue}>
|
|
300
|
+
* <ComboboxInput placeholder="Search…" />
|
|
301
|
+
* <ComboboxList>
|
|
302
|
+
* <ComboboxOption value="apple">Apple</ComboboxOption>
|
|
303
|
+
* <ComboboxOption value="banana">Banana</ComboboxOption>
|
|
304
|
+
* </ComboboxList>
|
|
305
|
+
* </Combobox>
|
|
306
|
+
* ```
|
|
307
|
+
*/
|
|
308
|
+
declare function Combobox({ filter, autoHighlight, onValueChange, children, ...rest }: ComboboxProps): react.JSX.Element;
|
|
309
|
+
interface ComboboxInputProps extends InputHTMLAttributes<HTMLInputElement> {
|
|
310
|
+
/** Apply the `hl-input` style. Defaults to `true`. */
|
|
311
|
+
styled?: boolean;
|
|
312
|
+
}
|
|
313
|
+
/** The combobox text field. */
|
|
314
|
+
declare function ComboboxInput({ styled, className, ...rest }: ComboboxInputProps): react.JSX.Element;
|
|
315
|
+
type ComboboxListProps = HTMLAttributes<HTMLUListElement>;
|
|
316
|
+
/** The option popup (`role="listbox"`). */
|
|
317
|
+
declare function ComboboxList({ children, ...rest }: ComboboxListProps): react.JSX.Element;
|
|
318
|
+
interface ComboboxOptionProps extends Omit<LiHTMLAttributes<HTMLLIElement>, 'value'> {
|
|
319
|
+
value: string;
|
|
320
|
+
}
|
|
321
|
+
/** A selectable option. The `value` is committed on selection. */
|
|
322
|
+
declare function ComboboxOption({ value, children, ...rest }: ComboboxOptionProps): react.JSX.Element;
|
|
323
|
+
|
|
324
|
+
interface CommandProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onSelect'> {
|
|
325
|
+
/** Lowercased key that opens the palette's dialog with Cmd/Ctrl. */
|
|
326
|
+
hotkey?: string;
|
|
327
|
+
/** Fires with the chosen item's value when a command runs. */
|
|
328
|
+
onSelect?: (value: string) => void;
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Command palette. Compose with `<CommandInput>`, `<CommandList>`,
|
|
332
|
+
* `<CommandGroup>`, `<CommandItem>`, and `<CommandEmpty>`. The enhancer filters
|
|
333
|
+
* items (text + keywords), provides arrow navigation and an empty state, and
|
|
334
|
+
* runs the active item on Enter. Place inside a `<dialog>` to use `hotkey`.
|
|
335
|
+
*/
|
|
336
|
+
declare function Command({ hotkey, onSelect, children, ...rest }: CommandProps): react.JSX.Element;
|
|
337
|
+
interface CommandInputProps extends InputHTMLAttributes<HTMLInputElement> {
|
|
338
|
+
styled?: boolean;
|
|
339
|
+
}
|
|
340
|
+
/** The palette search field. */
|
|
341
|
+
declare function CommandInput({ styled, className, ...rest }: CommandInputProps): react.JSX.Element;
|
|
342
|
+
type CommandListProps = HTMLAttributes<HTMLDivElement>;
|
|
343
|
+
/** The scrollable list of commands (`role="listbox"`). */
|
|
344
|
+
declare function CommandList({ children, ...rest }: CommandListProps): react.JSX.Element;
|
|
345
|
+
interface CommandGroupProps extends HTMLAttributes<HTMLDivElement> {
|
|
346
|
+
/** Optional heading shown above the grouped items. */
|
|
347
|
+
label?: ReactNode;
|
|
348
|
+
}
|
|
349
|
+
/** A labelled group of commands. */
|
|
350
|
+
declare function CommandGroup({ label, children, ...rest }: CommandGroupProps): react.JSX.Element;
|
|
351
|
+
interface CommandItemProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onSelect'> {
|
|
352
|
+
value: string;
|
|
353
|
+
/** Extra search terms for filtering. */
|
|
354
|
+
keywords?: string;
|
|
355
|
+
/** Leading icon node. */
|
|
356
|
+
icon?: ReactNode;
|
|
357
|
+
}
|
|
358
|
+
/** A runnable command (`role="option"`). */
|
|
359
|
+
declare function CommandItem({ value, keywords, icon, children, ...rest }: CommandItemProps): react.JSX.Element;
|
|
360
|
+
type CommandEmptyProps = HTMLAttributes<HTMLDivElement>;
|
|
361
|
+
/** Shown when no commands match the query. */
|
|
362
|
+
declare function CommandEmpty({ children, ...rest }: CommandEmptyProps): react.JSX.Element;
|
|
363
|
+
|
|
364
|
+
interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> {
|
|
365
|
+
size?: 'sm' | 'md' | 'lg';
|
|
366
|
+
invalid?: boolean;
|
|
367
|
+
}
|
|
368
|
+
/** Text input styled with the `hl-input` primitive. */
|
|
369
|
+
declare const Input: react.ForwardRefExoticComponent<InputProps & react.RefAttributes<HTMLInputElement>>;
|
|
370
|
+
|
|
371
|
+
interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
372
|
+
invalid?: boolean;
|
|
373
|
+
}
|
|
374
|
+
/** Multi-line text input styled with the `hl-textarea` primitive. */
|
|
375
|
+
declare const Textarea: react.ForwardRefExoticComponent<TextareaProps & react.RefAttributes<HTMLTextAreaElement>>;
|
|
376
|
+
|
|
377
|
+
interface SelectOption {
|
|
378
|
+
label: ReactNode;
|
|
379
|
+
value: string;
|
|
380
|
+
disabled?: boolean;
|
|
381
|
+
}
|
|
382
|
+
interface SelectProps extends Omit<SelectHTMLAttributes<HTMLSelectElement>, 'size'> {
|
|
383
|
+
size?: 'sm' | 'md' | 'lg';
|
|
384
|
+
invalid?: boolean;
|
|
385
|
+
/** Convenience for simple option lists; or pass `children` directly. */
|
|
386
|
+
options?: SelectOption[];
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Native `<select>` styled with the `hl-select` primitive, wrapped so a custom
|
|
390
|
+
* caret can be drawn purely in CSS. Native selects keep full mobile/keyboard
|
|
391
|
+
* behavior for free.
|
|
392
|
+
*/
|
|
393
|
+
declare const Select: react.ForwardRefExoticComponent<SelectProps & react.RefAttributes<HTMLSelectElement>>;
|
|
394
|
+
|
|
395
|
+
interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type'> {
|
|
396
|
+
children?: ReactNode;
|
|
397
|
+
}
|
|
398
|
+
/** Checkbox built on a native `<input type="checkbox">`, label-wrapped. */
|
|
399
|
+
declare const Checkbox: react.ForwardRefExoticComponent<CheckboxProps & react.RefAttributes<HTMLInputElement>>;
|
|
400
|
+
|
|
401
|
+
interface RadioProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type'> {
|
|
402
|
+
children?: ReactNode;
|
|
403
|
+
value: string;
|
|
404
|
+
}
|
|
405
|
+
/** A single radio built on a native `<input type="radio">`, label-wrapped. */
|
|
406
|
+
declare const Radio: react.ForwardRefExoticComponent<RadioProps & react.RefAttributes<HTMLInputElement>>;
|
|
407
|
+
interface RadioGroupProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
|
408
|
+
name?: string;
|
|
409
|
+
value?: string;
|
|
410
|
+
onValueChange?: (value: string) => void;
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Groups radios under a `role="radiogroup"`, sharing a name and managing the
|
|
414
|
+
* selected value. Pass `<Radio value="…">` children.
|
|
415
|
+
*/
|
|
416
|
+
declare function RadioGroup({ name, value, onValueChange, className, children, ...rest }: RadioGroupProps): react.JSX.Element;
|
|
417
|
+
|
|
418
|
+
interface FieldProps extends HTMLAttributes<HTMLDivElement> {
|
|
419
|
+
id?: string;
|
|
420
|
+
invalid?: boolean;
|
|
421
|
+
required?: boolean;
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* Layout + accessibility wrapper for a form control. Provides a shared id so
|
|
425
|
+
* `<FieldLabel>`, `<FieldHelp>`, and `<FieldError>` wire up
|
|
426
|
+
* `htmlFor`/`aria-describedby` automatically; spread {@link useField}'s result
|
|
427
|
+
* onto your control.
|
|
428
|
+
*/
|
|
429
|
+
declare function Field({ id, invalid, required, className, children, ...rest }: FieldProps): react.JSX.Element;
|
|
430
|
+
/**
|
|
431
|
+
* Props to spread onto the field's control (`id`, `aria-describedby`,
|
|
432
|
+
* `aria-invalid`). Must be called within a {@link Field}.
|
|
433
|
+
*/
|
|
434
|
+
declare function useField(): {
|
|
435
|
+
id: string;
|
|
436
|
+
'aria-describedby': string | undefined;
|
|
437
|
+
'aria-invalid': true | undefined;
|
|
438
|
+
};
|
|
439
|
+
type FieldLabelProps = LabelHTMLAttributes<HTMLLabelElement>;
|
|
440
|
+
/** Label bound to the enclosing field's control via `htmlFor`. */
|
|
441
|
+
declare function FieldLabel({ className, children, ...rest }: FieldLabelProps): react.JSX.Element;
|
|
442
|
+
/** Supplementary help text, referenced by the control's `aria-describedby`. */
|
|
443
|
+
declare function FieldHelp({ className, children, ...rest }: HTMLAttributes<HTMLParagraphElement>): react.JSX.Element;
|
|
444
|
+
/** Validation message; renders nothing unless given content. */
|
|
445
|
+
declare function FieldError({ className, children, ...rest }: HTMLAttributes<HTMLParagraphElement>): react.JSX.Element | null;
|
|
446
|
+
interface FieldsetProps extends HTMLAttributes<HTMLFieldSetElement> {
|
|
447
|
+
legend?: ReactNode;
|
|
448
|
+
}
|
|
449
|
+
/** Grouped fields with an optional legend. */
|
|
450
|
+
declare function Fieldset({ legend, className, children, ...rest }: FieldsetProps): react.JSX.Element;
|
|
451
|
+
|
|
452
|
+
interface SegmentedOption {
|
|
453
|
+
label: ReactNode;
|
|
454
|
+
value: string;
|
|
455
|
+
disabled?: boolean;
|
|
456
|
+
}
|
|
457
|
+
interface SegmentedControlProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
|
458
|
+
options: SegmentedOption[];
|
|
459
|
+
value?: string;
|
|
460
|
+
defaultValue?: string;
|
|
461
|
+
onValueChange?: (value: string) => void;
|
|
462
|
+
name?: string;
|
|
463
|
+
size?: 'sm' | 'md' | 'lg';
|
|
464
|
+
}
|
|
465
|
+
/**
|
|
466
|
+
* Segmented control — `hl-segmented` radiogroup. Controlled via `value` or
|
|
467
|
+
* uncontrolled via `defaultValue`. Built on native radios for free keyboard
|
|
468
|
+
* navigation.
|
|
469
|
+
*/
|
|
470
|
+
declare function SegmentedControl({ options, value, defaultValue, onValueChange, name, size, className, ...rest }: SegmentedControlProps): react.JSX.Element;
|
|
471
|
+
|
|
472
|
+
type SliderProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type'>;
|
|
473
|
+
/** Range slider primitive — `<input type="range" class="hl-slider">`. */
|
|
474
|
+
declare const Slider: react.ForwardRefExoticComponent<SliderProps & react.RefAttributes<HTMLInputElement>>;
|
|
475
|
+
|
|
476
|
+
interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
477
|
+
variant?: 'solid' | 'soft' | 'outline' | 'ghost' | 'link';
|
|
478
|
+
intent?: 'neutral' | 'primary' | 'danger' | 'success' | 'warning' | 'info';
|
|
479
|
+
size?: 'sm' | 'md' | 'lg';
|
|
480
|
+
/** Stretch to the container width. */
|
|
481
|
+
block?: boolean;
|
|
482
|
+
/** Square, icon-only button. */
|
|
483
|
+
icon?: boolean;
|
|
484
|
+
/** Show a spinner and disable interaction. */
|
|
485
|
+
loading?: boolean;
|
|
486
|
+
}
|
|
487
|
+
/** Button primitive — `hl-button` with intent/variant/size modifiers. */
|
|
488
|
+
declare const Button: react.ForwardRefExoticComponent<ButtonProps & react.RefAttributes<HTMLButtonElement>>;
|
|
489
|
+
|
|
490
|
+
interface AlertProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
491
|
+
intent?: 'info' | 'success' | 'warning' | 'danger' | 'neutral';
|
|
492
|
+
title?: ReactNode;
|
|
493
|
+
/** Leading icon, rendered before the body. */
|
|
494
|
+
icon?: ReactNode;
|
|
495
|
+
}
|
|
496
|
+
/** Alert primitive — `hl-alert` with intent, optional icon + title. */
|
|
497
|
+
declare const Alert: react.ForwardRefExoticComponent<AlertProps & react.RefAttributes<HTMLDivElement>>;
|
|
498
|
+
|
|
499
|
+
interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {
|
|
500
|
+
intent?: 'neutral' | 'primary' | 'danger' | 'success' | 'warning' | 'info';
|
|
501
|
+
variant?: 'soft' | 'solid' | 'outline';
|
|
502
|
+
size?: 'sm' | 'md';
|
|
503
|
+
}
|
|
504
|
+
/** Badge primitive — `hl-badge` with intent/variant/size modifiers. */
|
|
505
|
+
declare const Badge: react.ForwardRefExoticComponent<BadgeProps & react.RefAttributes<HTMLSpanElement>>;
|
|
506
|
+
|
|
507
|
+
interface CardProps extends HTMLAttributes<HTMLDivElement> {
|
|
508
|
+
/** Hover/active elevation for clickable cards. */
|
|
509
|
+
interactive?: boolean;
|
|
510
|
+
}
|
|
511
|
+
/** Card container — `hl-card`. Compose with the Card.* parts. */
|
|
512
|
+
declare const Card: react.ForwardRefExoticComponent<CardProps & react.RefAttributes<HTMLDivElement>>;
|
|
513
|
+
type CardSectionProps = HTMLAttributes<HTMLDivElement>;
|
|
514
|
+
declare const CardHeader: react.ForwardRefExoticComponent<CardSectionProps & react.RefAttributes<HTMLDivElement>>;
|
|
515
|
+
declare const CardBody: react.ForwardRefExoticComponent<CardSectionProps & react.RefAttributes<HTMLDivElement>>;
|
|
516
|
+
declare const CardFooter: react.ForwardRefExoticComponent<CardSectionProps & react.RefAttributes<HTMLDivElement>>;
|
|
517
|
+
declare const CardTitle: react.ForwardRefExoticComponent<HTMLAttributes<HTMLHeadingElement> & react.RefAttributes<HTMLHeadingElement>>;
|
|
518
|
+
declare const CardDescription: react.ForwardRefExoticComponent<HTMLAttributes<HTMLParagraphElement> & react.RefAttributes<HTMLParagraphElement>>;
|
|
519
|
+
|
|
520
|
+
interface AvatarProps extends HTMLAttributes<HTMLSpanElement> {
|
|
521
|
+
src?: string;
|
|
522
|
+
alt?: string;
|
|
523
|
+
/** Shown when there is no `src` or the image fails to load. */
|
|
524
|
+
fallback?: ReactNode;
|
|
525
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
526
|
+
shape?: 'circle' | 'square';
|
|
527
|
+
}
|
|
528
|
+
/** Avatar primitive — `hl-avatar` with image + graceful fallback. */
|
|
529
|
+
declare const Avatar: react.ForwardRefExoticComponent<AvatarProps & react.RefAttributes<HTMLSpanElement>>;
|
|
530
|
+
type AvatarGroupProps = HTMLAttributes<HTMLDivElement>;
|
|
531
|
+
/** Overlapping stack of avatars. */
|
|
532
|
+
declare const AvatarGroup: react.ForwardRefExoticComponent<AvatarGroupProps & react.RefAttributes<HTMLDivElement>>;
|
|
533
|
+
|
|
534
|
+
interface ProgressProps extends Omit<ProgressHTMLAttributes<HTMLProgressElement>, 'value'> {
|
|
535
|
+
/** Omit for an indeterminate bar. */
|
|
536
|
+
value?: number;
|
|
537
|
+
max?: number;
|
|
538
|
+
intent?: 'primary' | 'success' | 'warning' | 'danger' | 'info';
|
|
539
|
+
size?: 'sm' | 'md' | 'lg';
|
|
540
|
+
}
|
|
541
|
+
/** Progress primitive — native `<progress class="hl-progress">`. */
|
|
542
|
+
declare const Progress: react.ForwardRefExoticComponent<ProgressProps & react.RefAttributes<HTMLProgressElement>>;
|
|
543
|
+
|
|
544
|
+
interface SpinnerProps extends HTMLAttributes<HTMLSpanElement> {
|
|
545
|
+
size?: 'sm' | 'md' | 'lg' | 'xl';
|
|
546
|
+
/** Accessible label; announced via `role="status"`. */
|
|
547
|
+
label?: string;
|
|
548
|
+
}
|
|
549
|
+
/** Spinner primitive — `hl-spinner`. Inherits `currentColor`. */
|
|
550
|
+
declare const Spinner: react.ForwardRefExoticComponent<SpinnerProps & react.RefAttributes<HTMLSpanElement>>;
|
|
551
|
+
|
|
552
|
+
interface SkeletonProps extends HTMLAttributes<HTMLSpanElement> {
|
|
553
|
+
variant?: 'rect' | 'text' | 'circle';
|
|
554
|
+
width?: string | number;
|
|
555
|
+
height?: string | number;
|
|
556
|
+
}
|
|
557
|
+
/** Skeleton placeholder primitive — `hl-skeleton`. */
|
|
558
|
+
declare const Skeleton: react.ForwardRefExoticComponent<SkeletonProps & react.RefAttributes<HTMLSpanElement>>;
|
|
559
|
+
|
|
560
|
+
interface PaginationProps extends Omit<HTMLAttributes<HTMLElement>, 'onChange'> {
|
|
561
|
+
page: number;
|
|
562
|
+
count: number;
|
|
563
|
+
onPageChange?: (page: number) => void;
|
|
564
|
+
/** Pages to show on each side of the current page. Defaults to 1. */
|
|
565
|
+
siblingCount?: number;
|
|
566
|
+
/** Render Previous/Next controls. Defaults to true. */
|
|
567
|
+
showControls?: boolean;
|
|
568
|
+
prevLabel?: ReactNode;
|
|
569
|
+
nextLabel?: ReactNode;
|
|
570
|
+
}
|
|
571
|
+
/** Pagination primitive — `hl-pagination` with smart ellipsis truncation. */
|
|
572
|
+
declare function Pagination({ page, count, onPageChange, siblingCount, showControls, prevLabel, nextLabel, className, ...rest }: PaginationProps): react.JSX.Element;
|
|
573
|
+
|
|
574
|
+
type KbdProps = HTMLAttributes<HTMLElement>;
|
|
575
|
+
/** Keyboard key primitive — `<kbd class="hl-kbd">`. */
|
|
576
|
+
declare const Kbd: react.ForwardRefExoticComponent<KbdProps & react.RefAttributes<HTMLElement>>;
|
|
577
|
+
|
|
578
|
+
interface SeparatorProps extends HTMLAttributes<HTMLHRElement> {
|
|
579
|
+
orientation?: 'horizontal' | 'vertical';
|
|
580
|
+
/** Purely decorative — removes it from the accessibility tree. */
|
|
581
|
+
decorative?: boolean;
|
|
582
|
+
}
|
|
583
|
+
/** Separator primitive — `<hr class="hl-separator">`. */
|
|
584
|
+
declare const Separator: react.ForwardRefExoticComponent<SeparatorProps & react.RefAttributes<HTMLHRElement>>;
|
|
585
|
+
|
|
586
|
+
/** Join truthy class names into a single string. */
|
|
587
|
+
declare function cx(...classes: Array<string | false | null | undefined>): string;
|
|
588
|
+
|
|
589
|
+
export { Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, Alert, type AlertProps, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, Badge, type BadgeProps, Breadcrumb, BreadcrumbItem, type BreadcrumbItemProps, type BreadcrumbProps, Button, type ButtonProps, Card, CardBody, CardDescription, CardFooter, CardHeader, type CardProps, type CardSectionProps, CardTitle, Checkbox, type CheckboxProps, Combobox, ComboboxInput, type ComboboxInputProps, ComboboxList, type ComboboxListProps, ComboboxOption, type ComboboxOptionProps, type ComboboxProps, Command, CommandEmpty, type CommandEmptyProps, CommandGroup, type CommandGroupProps, CommandInput, type CommandInputProps, CommandItem, type CommandItemProps, CommandList, type CommandListProps, type CommandProps, Disclosure, type DisclosureProps, Drawer, DrawerBody, DrawerFooter, DrawerHeader, type DrawerProps, type DrawerSectionProps, Dropdown, DropdownItem, type DropdownItemProps, DropdownMenu, type DropdownMenuProps, type DropdownProps, DropdownSeparator, type DropdownSeparatorProps, DropdownTrigger, type DropdownTriggerProps, Field, FieldError, FieldHelp, FieldLabel, type FieldLabelProps, type FieldProps, Fieldset, type FieldsetProps, Input, type InputProps, Kbd, type KbdProps, Menu, MenuItem, type MenuItemProps, type MenuProps, Modal, ModalBody, ModalFooter, ModalHeader, type ModalProps, type ModalSectionProps, Pagination, type PaginationProps, Popover, type PopoverProps, Progress, type ProgressProps, Radio, RadioGroup, type RadioGroupProps, type RadioProps, SegmentedControl, type SegmentedControlProps, type SegmentedOption, Select, type SelectOption, type SelectProps, Separator, type SeparatorProps, Skeleton, type SkeletonProps, SkipLink, type SkipLinkProps, Slider, type SliderProps, Spinner, type SpinnerProps, Switch, type SwitchProps, Tab, TabList, type TabListProps, TabPanel, type TabPanelProps, type TabProps, Tabs, type TabsProps, Textarea, type TextareaProps, ToastProvider, type ToastProviderProps, Toc, type TocProps, Tooltip, type TooltipProps, cx, useAccordion, useDisclosureGroup, useDropdown, useEnhancer, useField, useModalGroup, useTabs, useToast, useTocEnhancer, useTooltip };
|