@hydrateless/react 0.10.1 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -15
- package/dist/client.d.ts +760 -0
- package/dist/client.js +1121 -0
- package/dist/index.d.ts +2 -939
- package/dist/index.js +2 -1422
- package/dist/server.d.ts +216 -0
- package/dist/server.js +244 -0
- package/package.json +10 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,939 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { EnhancerHandle, EnhanceTabsOptions, EnhanceDropdownOptions, EnhanceMenuOptions, EnhancePopoverOptions, EnhanceTooltipOptions, ToastApi, EnhanceComboboxOptions } from '@hydrateless/enhancers';
|
|
4
|
-
export { AccordionApi, ComboboxApi, CommandApi, DisclosureApi, Disposer, DrawerApi, DropdownApi, EnhancerHandle, MenuApi, ModalApi, PopoverApi, TabsApi, ToastApi, ToastIntent, ToastOptions, TocApi, TooltipApi } from '@hydrateless/enhancers';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Attach any Hydrateless enhancer to the element in `ref` for the lifetime of a
|
|
8
|
-
* component. Returns a ref holding the enhancer's imperative API (for example
|
|
9
|
-
* `setValue`/`setOpen`), or `null` while nothing is enhanced. The instance is
|
|
10
|
-
* destroyed on unmount, and destroyed and re-created when `deps` change, so no
|
|
11
|
-
* listeners leak across renders.
|
|
12
|
-
*
|
|
13
|
-
* Function-valued options (`onValueChange`, `onOpenChange`, ...) always call
|
|
14
|
-
* the handler from the latest render, so they never need to appear in `deps`.
|
|
15
|
-
* Other options are read when the enhancer is created; list the ones that
|
|
16
|
-
* should trigger re-enhancement in `deps`.
|
|
17
|
-
*
|
|
18
|
-
* ```tsx
|
|
19
|
-
* const ref = useRef<HTMLDivElement>(null);
|
|
20
|
-
* const api = useEnhancer(ref, enhanceTabs, { onValueChange: setTab });
|
|
21
|
-
* // api.current?.setValue('install');
|
|
22
|
-
* return <div data-hl-tabs ref={ref}>...</div>;
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
declare function useEnhancer<Options extends object, Api>(ref: RefObject<HTMLElement | null>, enhancer: (container: HTMLElement, options?: Partial<Options>) => EnhancerHandle<Api>, options?: Partial<Options>, deps?: DependencyList): RefObject<Api | null>;
|
|
26
|
-
|
|
27
|
-
/** Props for {@link Accordion}. */
|
|
28
|
-
interface AccordionProps extends HTMLAttributes<HTMLDivElement> {
|
|
29
|
-
/** Allow more than one panel to stay open at a time. */
|
|
30
|
-
allowMultiple?: boolean;
|
|
31
|
-
/** Controlled list of open item values (pair with `onValueChange`). */
|
|
32
|
-
value?: string[];
|
|
33
|
-
/** Initially open item values for uncontrolled usage. */
|
|
34
|
-
defaultValue?: string[];
|
|
35
|
-
/** Called with the open item values after every change. */
|
|
36
|
-
onValueChange?: (value: string[]) => void;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Accordion of native `<details>` items. Item values come from each
|
|
40
|
-
* `<AccordionItem value>`, defaulting to the index, and each item's `open`
|
|
41
|
-
* attribute is rendered from the value so server output already shows the
|
|
42
|
-
* right panels. Open state works uncontrolled (`defaultValue`) or controlled
|
|
43
|
-
* (`value` + `onValueChange`).
|
|
44
|
-
*/
|
|
45
|
-
declare const Accordion: react.ForwardRefExoticComponent<AccordionProps & react.RefAttributes<HTMLDivElement>>;
|
|
46
|
-
/** Props for {@link AccordionItem}. */
|
|
47
|
-
interface AccordionItemProps extends Omit<HTMLAttributes<HTMLDetailsElement>, 'title'> {
|
|
48
|
-
/** The always-visible header content. */
|
|
49
|
-
summary: ReactNode;
|
|
50
|
-
/** Stable value identifying this item; defaults to its index. */
|
|
51
|
-
value?: string;
|
|
52
|
-
}
|
|
53
|
-
/** A single collapsible item within an {@link Accordion}, rendered as a native `<details>`. */
|
|
54
|
-
declare const AccordionItem: react.ForwardRefExoticComponent<AccordionItemProps & react.RefAttributes<HTMLDetailsElement>>;
|
|
55
|
-
|
|
56
|
-
/** Props for {@link Disclosure}. */
|
|
57
|
-
interface DisclosureProps extends Omit<HTMLAttributes<HTMLDetailsElement>, 'title'> {
|
|
58
|
-
/** The always-visible header content. */
|
|
59
|
-
summary: ReactNode;
|
|
60
|
-
/** Controlled open state (pair with `onOpenChange`). */
|
|
61
|
-
open?: boolean;
|
|
62
|
-
/** Open the disclosure initially for uncontrolled usage. */
|
|
63
|
-
defaultOpen?: boolean;
|
|
64
|
-
/** Called after the disclosure opens or closes. */
|
|
65
|
-
onOpenChange?: (open: boolean) => void;
|
|
66
|
-
/**
|
|
67
|
-
* Group name. Disclosures sharing a `name` are exclusive: the browser closes
|
|
68
|
-
* the others when one opens, with no JavaScript.
|
|
69
|
-
*/
|
|
70
|
-
name?: string;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* A single expandable section built on native `<details>`, which handles
|
|
74
|
-
* open/close (and exclusive groups, via the `name` attribute) on its own.
|
|
75
|
-
* Open state works uncontrolled (`defaultOpen`) or controlled (`open` +
|
|
76
|
-
* `onOpenChange`).
|
|
77
|
-
*/
|
|
78
|
-
declare const Disclosure: react.ForwardRefExoticComponent<DisclosureProps & react.RefAttributes<HTMLDetailsElement>>;
|
|
79
|
-
|
|
80
|
-
/** Props for {@link Tabs}. */
|
|
81
|
-
interface TabsProps extends HTMLAttributes<HTMLDivElement> {
|
|
82
|
-
/** `manual` (default): arrows move focus, Enter/Space activates. `automatic`: arrows activate immediately. */
|
|
83
|
-
activation?: EnhanceTabsOptions['activation'];
|
|
84
|
-
orientation?: EnhanceTabsOptions['orientation'];
|
|
85
|
-
/** Controlled value of the selected tab (pair with `onValueChange`). */
|
|
86
|
-
value?: string;
|
|
87
|
-
/** Initial value for uncontrolled usage. */
|
|
88
|
-
defaultValue?: string;
|
|
89
|
-
/** Called with the new tab value after every selection change. */
|
|
90
|
-
onValueChange?: (value: string) => void;
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Tabbed interface root. Compose with `<TabList>`, `<Tab>`, and `<TabPanel>`.
|
|
94
|
-
* The role-based markup, `aria-selected`, `hidden`, and roving `tabindex` are
|
|
95
|
-
* all rendered from the value, so server output is correct before the
|
|
96
|
-
* enhancer adds keyboard navigation. Tab values come from each `<Tab value>`,
|
|
97
|
-
* defaulting to the index; panels match tabs by position. Selection works
|
|
98
|
-
* uncontrolled (`defaultValue`) or controlled (`value` + `onValueChange`).
|
|
99
|
-
*
|
|
100
|
-
* ```tsx
|
|
101
|
-
* <Tabs value={tab} onValueChange={setTab}>
|
|
102
|
-
* <TabList>
|
|
103
|
-
* <Tab value="overview">Overview</Tab>
|
|
104
|
-
* <Tab value="install">Install</Tab>
|
|
105
|
-
* </TabList>
|
|
106
|
-
* <TabPanel>Zero runtime by default.</TabPanel>
|
|
107
|
-
* <TabPanel>npm install hydrateless</TabPanel>
|
|
108
|
-
* </Tabs>
|
|
109
|
-
* ```
|
|
110
|
-
*/
|
|
111
|
-
declare const Tabs: react.ForwardRefExoticComponent<TabsProps & react.RefAttributes<HTMLDivElement>>;
|
|
112
|
-
/** Props for {@link TabList}. */
|
|
113
|
-
type TabListProps = HTMLAttributes<HTMLDivElement>;
|
|
114
|
-
/** The row of tab triggers. Renders `role="tablist"`. */
|
|
115
|
-
declare const TabList: react.ForwardRefExoticComponent<TabListProps & react.RefAttributes<HTMLDivElement>>;
|
|
116
|
-
/** Props for {@link Tab}. */
|
|
117
|
-
interface TabProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
118
|
-
/** Stable value identifying this tab; defaults to its index. */
|
|
119
|
-
value?: string;
|
|
120
|
-
}
|
|
121
|
-
/** A single tab trigger. Renders `role="tab"` with `aria-selected` from the Tabs value. */
|
|
122
|
-
declare const Tab: react.ForwardRefExoticComponent<TabProps & react.RefAttributes<HTMLButtonElement>>;
|
|
123
|
-
/** Props for {@link TabPanel}. */
|
|
124
|
-
type TabPanelProps = HTMLAttributes<HTMLDivElement>;
|
|
125
|
-
/** Content for the tab at the same position. Renders `role="tabpanel"`, hidden unless selected. */
|
|
126
|
-
declare const TabPanel: react.ForwardRefExoticComponent<TabPanelProps & react.RefAttributes<HTMLDivElement>>;
|
|
127
|
-
|
|
128
|
-
/** Props for {@link Dropdown}. */
|
|
129
|
-
interface DropdownProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onSelect'> {
|
|
130
|
-
/** Placement used by the JS positioning fallback. Defaults to `bottom-start`. */
|
|
131
|
-
placement?: EnhanceDropdownOptions['placement'];
|
|
132
|
-
/** Close the menu after an item is activated. Defaults to `true`. */
|
|
133
|
-
closeOnSelect?: boolean;
|
|
134
|
-
/** Controlled open state (pair with `onOpenChange`). */
|
|
135
|
-
open?: boolean;
|
|
136
|
-
/** Open the menu initially for uncontrolled usage. */
|
|
137
|
-
defaultOpen?: boolean;
|
|
138
|
-
/** Called after the menu opens or closes. */
|
|
139
|
-
onOpenChange?: (open: boolean) => void;
|
|
140
|
-
/**
|
|
141
|
-
* Called with the item's value when a menu item is activated. For
|
|
142
|
-
* `menuitemcheckbox`/`menuitemradio` items, `checked` is the new state.
|
|
143
|
-
*/
|
|
144
|
-
onSelect?: (value: string, item: HTMLElement, checked?: boolean) => void;
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* Button-triggered menu following the WAI-ARIA menu-button pattern. Compose with
|
|
148
|
-
* `<DropdownTrigger>`, `<DropdownMenu>`, `<DropdownItem>`, `<DropdownGroup>`,
|
|
149
|
-
* and `<DropdownSeparator>`. The menu renders as a native `popover` the
|
|
150
|
-
* trigger opens through `popovertarget`, so it works before hydration; the
|
|
151
|
-
* enhancer adds keyboard navigation, typeahead, checkable items, and focus
|
|
152
|
-
* return. Open state works uncontrolled or controlled.
|
|
153
|
-
*
|
|
154
|
-
* ```tsx
|
|
155
|
-
* <Dropdown onSelect={(value) => run(value)}>
|
|
156
|
-
* <DropdownTrigger>Actions</DropdownTrigger>
|
|
157
|
-
* <DropdownMenu>
|
|
158
|
-
* <DropdownItem value="edit">Edit</DropdownItem>
|
|
159
|
-
* <DropdownSeparator />
|
|
160
|
-
* <DropdownItem value="delete">Delete</DropdownItem>
|
|
161
|
-
* </DropdownMenu>
|
|
162
|
-
* </Dropdown>
|
|
163
|
-
* ```
|
|
164
|
-
*/
|
|
165
|
-
declare const Dropdown: react.ForwardRefExoticComponent<DropdownProps & react.RefAttributes<HTMLDivElement>>;
|
|
166
|
-
/** Props for {@link DropdownTrigger}. */
|
|
167
|
-
type DropdownTriggerProps = ButtonHTMLAttributes<HTMLButtonElement>;
|
|
168
|
-
/** The button that opens the menu; carries `popovertarget` so it works pre-hydration. */
|
|
169
|
-
declare const DropdownTrigger: react.ForwardRefExoticComponent<DropdownTriggerProps & react.RefAttributes<HTMLButtonElement>>;
|
|
170
|
-
/** Props for {@link DropdownMenu}. */
|
|
171
|
-
type DropdownMenuProps = HTMLAttributes<HTMLUListElement>;
|
|
172
|
-
/** The menu surface (a native `popover`); holds items, groups, and separators. */
|
|
173
|
-
declare const DropdownMenu: react.ForwardRefExoticComponent<DropdownMenuProps & react.RefAttributes<HTMLUListElement>>;
|
|
174
|
-
/** Props for {@link DropdownItem}. */
|
|
175
|
-
interface DropdownItemProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'value'> {
|
|
176
|
-
/** Value reported to `onSelect`; defaults to the item's text. */
|
|
177
|
-
value?: string;
|
|
178
|
-
/** `menuitemcheckbox` toggles; `menuitemradio` is exclusive within its group. Defaults to `menuitem`. */
|
|
179
|
-
role?: 'menuitem' | 'menuitemcheckbox' | 'menuitemradio';
|
|
180
|
-
/** Checked state for checkable roles (rendered as `aria-checked`). */
|
|
181
|
-
checked?: boolean;
|
|
182
|
-
/** Skip the item in keyboard navigation and ignore activation. */
|
|
183
|
-
disabled?: boolean;
|
|
184
|
-
}
|
|
185
|
-
/** A menu item. Renders `<li><button role="menuitem">`. */
|
|
186
|
-
declare const DropdownItem: react.ForwardRefExoticComponent<DropdownItemProps & react.RefAttributes<HTMLButtonElement>>;
|
|
187
|
-
/** Props for {@link DropdownGroup}. */
|
|
188
|
-
interface DropdownGroupProps extends HTMLAttributes<HTMLUListElement> {
|
|
189
|
-
/** Accessible name of the group. */
|
|
190
|
-
label?: string;
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* A labelled `role="group"` of items; `menuitemradio` items inside it are
|
|
194
|
-
* exclusive with each other.
|
|
195
|
-
*/
|
|
196
|
-
declare const DropdownGroup: react.ForwardRefExoticComponent<DropdownGroupProps & react.RefAttributes<HTMLUListElement>>;
|
|
197
|
-
/** Props for {@link DropdownSeparator}. */
|
|
198
|
-
type DropdownSeparatorProps = Omit<LiHTMLAttributes<HTMLLIElement>, 'role'>;
|
|
199
|
-
/** A visual divider between groups of items. */
|
|
200
|
-
declare const DropdownSeparator: react.ForwardRefExoticComponent<DropdownSeparatorProps & react.RefAttributes<HTMLLIElement>>;
|
|
201
|
-
|
|
202
|
-
/** Props for {@link Menu}. */
|
|
203
|
-
interface MenuProps extends Omit<HTMLAttributes<HTMLUListElement>, 'onSelect' | 'defaultValue'> {
|
|
204
|
-
/** Layout of the top-level items. Defaults to `horizontal` (a menubar). */
|
|
205
|
-
orientation?: EnhanceMenuOptions['orientation'];
|
|
206
|
-
/** Controlled value of the open submenu, or `null` when all are closed (pair with `onValueChange`). */
|
|
207
|
-
value?: string | null;
|
|
208
|
-
/** Submenu to open initially for uncontrolled usage. */
|
|
209
|
-
defaultValue?: string | null;
|
|
210
|
-
/** Called with the open submenu's value (or `null`) after every change. */
|
|
211
|
-
onValueChange?: (value: string | null) => void;
|
|
212
|
-
/**
|
|
213
|
-
* Called with the item's value when a leaf item is activated. For
|
|
214
|
-
* `menuitemcheckbox`/`menuitemradio` items, `checked` is the new state.
|
|
215
|
-
*/
|
|
216
|
-
onSelect?: (value: string, item: HTMLElement, checked?: boolean) => void;
|
|
217
|
-
}
|
|
218
|
-
/**
|
|
219
|
-
* Menubar / navigation menu with single-level submenus rendered in the top
|
|
220
|
-
* layer. Compose with `<MenuItem>` for leaf items and `<MenuSubmenu>` for
|
|
221
|
-
* items that open a flyout. The enhancer wires roving tabindex,
|
|
222
|
-
* orientation-aware arrow navigation, typeahead, and submenu toggling; the
|
|
223
|
-
* open submenu is the component's value (from `<MenuSubmenu value>`,
|
|
224
|
-
* defaulting to the index).
|
|
225
|
-
*
|
|
226
|
-
* ```tsx
|
|
227
|
-
* <Menu orientation="horizontal">
|
|
228
|
-
* <MenuItem href="/">Home</MenuItem>
|
|
229
|
-
* <MenuSubmenu label="Resources" value="resources">
|
|
230
|
-
* <MenuItem href="/docs">Docs</MenuItem>
|
|
231
|
-
* </MenuSubmenu>
|
|
232
|
-
* </Menu>
|
|
233
|
-
* ```
|
|
234
|
-
*/
|
|
235
|
-
declare const Menu: react.ForwardRefExoticComponent<MenuProps & react.RefAttributes<HTMLUListElement>>;
|
|
236
|
-
/** Props for {@link MenuItem}. */
|
|
237
|
-
interface MenuItemProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'href' | 'type' | 'value'> {
|
|
238
|
-
/** Render as a link instead of a button. */
|
|
239
|
-
href?: string;
|
|
240
|
-
/** Value reported to `onSelect`; defaults to the item's text. */
|
|
241
|
-
value?: string;
|
|
242
|
-
/** `menuitemcheckbox` toggles; `menuitemradio` is exclusive within its menu. Defaults to `menuitem`. */
|
|
243
|
-
role?: 'menuitem' | 'menuitemcheckbox' | 'menuitemradio';
|
|
244
|
-
/** Checked state for checkable roles (rendered as `aria-checked`). */
|
|
245
|
-
checked?: boolean;
|
|
246
|
-
/** Skip the item in keyboard navigation and ignore activation. */
|
|
247
|
-
disabled?: boolean;
|
|
248
|
-
/** Extra attributes for the `<a>` when `href` is set. */
|
|
249
|
-
anchorProps?: AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
250
|
-
}
|
|
251
|
-
/** A leaf menu entry. With `href` it renders an anchor, otherwise a button. */
|
|
252
|
-
declare const MenuItem: react.ForwardRefExoticComponent<MenuItemProps & react.RefAttributes<HTMLElement>>;
|
|
253
|
-
/** Props for {@link MenuSubmenu}. */
|
|
254
|
-
interface MenuSubmenuProps extends Omit<HTMLAttributes<HTMLUListElement>, 'value'> {
|
|
255
|
-
/** Content of the top-level trigger. */
|
|
256
|
-
label: ReactNode;
|
|
257
|
-
/** Stable value identifying this submenu; defaults to its index among top-level items. */
|
|
258
|
-
value?: string;
|
|
259
|
-
/** Skip the trigger in keyboard navigation and keep the submenu closed. */
|
|
260
|
-
disabled?: boolean;
|
|
261
|
-
/** Extra attributes for the trigger button. */
|
|
262
|
-
triggerProps?: ButtonHTMLAttributes<HTMLButtonElement>;
|
|
263
|
-
}
|
|
264
|
-
/**
|
|
265
|
-
* A top-level menu entry that opens a flyout of `<MenuItem>`s. Rest props go
|
|
266
|
-
* to the submenu list (`role="menu"`); use `triggerProps` for the button.
|
|
267
|
-
*/
|
|
268
|
-
declare const MenuSubmenu: react.ForwardRefExoticComponent<MenuSubmenuProps & react.RefAttributes<HTMLUListElement>>;
|
|
269
|
-
|
|
270
|
-
/** Props for {@link Modal}. */
|
|
271
|
-
interface ModalProps extends Omit<HTMLAttributes<HTMLDialogElement>, 'title'> {
|
|
272
|
-
/** Controlled open state (pair with `onOpenChange`). */
|
|
273
|
-
open?: boolean;
|
|
274
|
-
/** Open the dialog initially for uncontrolled usage. */
|
|
275
|
-
defaultOpen?: boolean;
|
|
276
|
-
/** Called after the dialog opens or closes (Escape, backdrop, close buttons). */
|
|
277
|
-
onOpenChange?: (open: boolean) => void;
|
|
278
|
-
/** Let Escape and backdrop clicks close the dialog. Defaults to `true`. */
|
|
279
|
-
closeOnBackdrop?: boolean;
|
|
280
|
-
}
|
|
281
|
-
/**
|
|
282
|
-
* Dialog overlay built on the native `<dialog>` element and the modal
|
|
283
|
-
* enhancer, which adds a focus trap, body scroll-lock, and a background
|
|
284
|
-
* `inert` barrier. Compose with `<ModalHeader>`, `<ModalBody>`, and
|
|
285
|
-
* `<ModalFooter>`. Open state works uncontrolled (`defaultOpen`, or a
|
|
286
|
-
* `command="show-modal"` invoker button) or controlled (`open` +
|
|
287
|
-
* `onOpenChange`).
|
|
288
|
-
*
|
|
289
|
-
* ```tsx
|
|
290
|
-
* <Modal open={open} onOpenChange={setOpen}>
|
|
291
|
-
* <ModalHeader>Confirm</ModalHeader>
|
|
292
|
-
* <ModalBody>Are you sure?</ModalBody>
|
|
293
|
-
* <ModalFooter><Button onClick={() => setOpen(false)}>Close</Button></ModalFooter>
|
|
294
|
-
* </Modal>
|
|
295
|
-
* ```
|
|
296
|
-
*/
|
|
297
|
-
declare const Modal: react.ForwardRefExoticComponent<ModalProps & react.RefAttributes<HTMLDialogElement>>;
|
|
298
|
-
/** Props shared by the {@link Modal} section components. */
|
|
299
|
-
type ModalSectionProps = HTMLAttributes<HTMLDivElement>;
|
|
300
|
-
/** Modal heading region; its content labels the dialog for assistive tech. */
|
|
301
|
-
declare const ModalHeader: react.ForwardRefExoticComponent<ModalSectionProps & react.RefAttributes<HTMLDivElement>>;
|
|
302
|
-
/** Modal main content region. */
|
|
303
|
-
declare const ModalBody: react.ForwardRefExoticComponent<ModalSectionProps & react.RefAttributes<HTMLDivElement>>;
|
|
304
|
-
/** Modal actions region. */
|
|
305
|
-
declare const ModalFooter: react.ForwardRefExoticComponent<ModalSectionProps & react.RefAttributes<HTMLDivElement>>;
|
|
306
|
-
|
|
307
|
-
/** Props for {@link Drawer}. */
|
|
308
|
-
interface DrawerProps extends Omit<HTMLAttributes<HTMLDialogElement>, 'title'> {
|
|
309
|
-
/** Controlled open state (pair with `onOpenChange`). */
|
|
310
|
-
open?: boolean;
|
|
311
|
-
/** Open the drawer initially for uncontrolled usage. */
|
|
312
|
-
defaultOpen?: boolean;
|
|
313
|
-
/** Called after the drawer opens or closes (Escape, backdrop, close buttons). */
|
|
314
|
-
onOpenChange?: (open: boolean) => void;
|
|
315
|
-
/** Logical edge the panel slides in from (`end` follows the writing direction). Defaults to `end`. */
|
|
316
|
-
side?: 'start' | 'end';
|
|
317
|
-
/** Let Escape and backdrop clicks close the drawer. Defaults to `true`. */
|
|
318
|
-
closeOnBackdrop?: boolean;
|
|
319
|
-
}
|
|
320
|
-
/**
|
|
321
|
-
* Off-canvas panel built on the native `<dialog>` element and the drawer
|
|
322
|
-
* enhancer (focus trap, scroll-lock, background `inert`). Mirrors
|
|
323
|
-
* {@link Modal} but slides in from the chosen `side`. Compose with
|
|
324
|
-
* `<DrawerHeader>`, `<DrawerBody>`, and `<DrawerFooter>`. Open state works
|
|
325
|
-
* uncontrolled (`defaultOpen`, or an invoker button) or controlled (`open` +
|
|
326
|
-
* `onOpenChange`).
|
|
327
|
-
*/
|
|
328
|
-
declare const Drawer: react.ForwardRefExoticComponent<DrawerProps & react.RefAttributes<HTMLDialogElement>>;
|
|
329
|
-
/** Props shared by the {@link Drawer} section components. */
|
|
330
|
-
type DrawerSectionProps = HTMLAttributes<HTMLDivElement>;
|
|
331
|
-
/** Drawer heading region. */
|
|
332
|
-
declare const DrawerHeader: react.ForwardRefExoticComponent<DrawerSectionProps & react.RefAttributes<HTMLDivElement>>;
|
|
333
|
-
/** Drawer main content region. */
|
|
334
|
-
declare const DrawerBody: react.ForwardRefExoticComponent<DrawerSectionProps & react.RefAttributes<HTMLDivElement>>;
|
|
335
|
-
/** Drawer actions region. */
|
|
336
|
-
declare const DrawerFooter: react.ForwardRefExoticComponent<DrawerSectionProps & react.RefAttributes<HTMLDivElement>>;
|
|
337
|
-
|
|
338
|
-
/** Props for {@link Popover}. */
|
|
339
|
-
interface PopoverProps extends HTMLAttributes<HTMLDivElement> {
|
|
340
|
-
/** Controlled open state (pair with `onOpenChange`). */
|
|
341
|
-
open?: boolean;
|
|
342
|
-
/** Show the popover initially for uncontrolled usage. */
|
|
343
|
-
defaultOpen?: boolean;
|
|
344
|
-
/** Called after the popover shows or hides (including the browser's light-dismiss). */
|
|
345
|
-
onOpenChange?: (open: boolean) => void;
|
|
346
|
-
/** Placement used by the JS positioning fallback. Defaults to `bottom`. */
|
|
347
|
-
placement?: EnhancePopoverOptions['placement'];
|
|
348
|
-
/** Open on pointer hover and focus instead of click. */
|
|
349
|
-
hover?: boolean;
|
|
350
|
-
}
|
|
351
|
-
/**
|
|
352
|
-
* Floating content built on the native Popover API. The surface lives in the
|
|
353
|
-
* top layer with light-dismiss and Escape handled by the browser; visibility
|
|
354
|
-
* works uncontrolled (`defaultOpen`, or a `popovertarget` trigger button) or
|
|
355
|
-
* controlled (`open` + `onOpenChange`). Position it with the
|
|
356
|
-
* `hydrateless/popover.css` styles.
|
|
357
|
-
*/
|
|
358
|
-
declare const Popover: react.ForwardRefExoticComponent<PopoverProps & react.RefAttributes<HTMLDivElement>>;
|
|
359
|
-
|
|
360
|
-
/** Props for {@link Tooltip}. */
|
|
361
|
-
interface TooltipProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'content'> {
|
|
362
|
-
/** The hint shown on hover/focus. */
|
|
363
|
-
content: ReactNode;
|
|
364
|
-
/** A single focusable element that triggers the tooltip. */
|
|
365
|
-
children: ReactElement;
|
|
366
|
-
/** Preferred placement relative to the trigger. Defaults to `top`. */
|
|
367
|
-
placement?: EnhanceTooltipOptions['placement'];
|
|
368
|
-
/** Delay in ms before showing on hover. */
|
|
369
|
-
showDelay?: number;
|
|
370
|
-
/** Grace period in ms before hiding. */
|
|
371
|
-
hideDelay?: number;
|
|
372
|
-
/** Controlled visibility (pair with `onOpenChange`). */
|
|
373
|
-
open?: boolean;
|
|
374
|
-
/** Called after the tooltip shows or hides. */
|
|
375
|
-
onOpenChange?: (open: boolean) => void;
|
|
376
|
-
}
|
|
377
|
-
/**
|
|
378
|
-
* Adds an accessible tooltip to a focusable trigger. The trigger is linked to
|
|
379
|
-
* the tip with `aria-describedby`; the enhancer shows it on hover/focus with
|
|
380
|
-
* delays, promotes it to the top layer, and dismisses it on Escape.
|
|
381
|
-
*
|
|
382
|
-
* ```tsx
|
|
383
|
-
* <Tooltip content="Save (Cmd+S)">
|
|
384
|
-
* <Button icon aria-label="Save">...</Button>
|
|
385
|
-
* </Tooltip>
|
|
386
|
-
* ```
|
|
387
|
-
*/
|
|
388
|
-
declare const Tooltip: react.ForwardRefExoticComponent<TooltipProps & react.RefAttributes<HTMLSpanElement>>;
|
|
389
|
-
|
|
390
|
-
/** Props for {@link Breadcrumb}. */
|
|
391
|
-
type BreadcrumbProps = HTMLAttributes<HTMLElement>;
|
|
392
|
-
/**
|
|
393
|
-
* Semantic breadcrumb navigation (`<nav> > <ol>`). CSS-only, no enhancer.
|
|
394
|
-
* Compose with `<BreadcrumbItem>`.
|
|
395
|
-
*
|
|
396
|
-
* ```tsx
|
|
397
|
-
* <Breadcrumb>
|
|
398
|
-
* <BreadcrumbItem href="/">Home</BreadcrumbItem>
|
|
399
|
-
* <BreadcrumbItem current>Components</BreadcrumbItem>
|
|
400
|
-
* </Breadcrumb>
|
|
401
|
-
* ```
|
|
402
|
-
*/
|
|
403
|
-
declare const Breadcrumb: react.ForwardRefExoticComponent<BreadcrumbProps & react.RefAttributes<HTMLElement>>;
|
|
404
|
-
/** Props for {@link BreadcrumbItem}. */
|
|
405
|
-
interface BreadcrumbItemProps extends Omit<LiHTMLAttributes<HTMLLIElement>, 'children'> {
|
|
406
|
-
href?: string;
|
|
407
|
-
/** Marks the current page; renders a non-link with `aria-current="page"`. */
|
|
408
|
-
current?: boolean;
|
|
409
|
-
children?: ReactNode;
|
|
410
|
-
/** Extra attributes for the `<a>` when `href` is set. */
|
|
411
|
-
anchorProps?: AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
412
|
-
}
|
|
413
|
-
/** A single crumb. Renders a link unless `current` (or no `href`) is set. */
|
|
414
|
-
declare const BreadcrumbItem: react.ForwardRefExoticComponent<BreadcrumbItemProps & react.RefAttributes<HTMLLIElement>>;
|
|
415
|
-
|
|
416
|
-
/** Props for {@link Switch}. */
|
|
417
|
-
interface SwitchProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type'> {
|
|
418
|
-
children?: ReactNode;
|
|
419
|
-
}
|
|
420
|
-
/**
|
|
421
|
-
* Toggle switch built on a native checkbox with `role="switch"`. CSS-only.
|
|
422
|
-
* Inside a {@link Field} it picks up `id`, `aria-describedby`, `aria-invalid`,
|
|
423
|
-
* and `required`.
|
|
424
|
-
*/
|
|
425
|
-
declare const Switch: react.ForwardRefExoticComponent<SwitchProps & react.RefAttributes<HTMLInputElement>>;
|
|
426
|
-
|
|
427
|
-
/** Props for {@link SkipLink}. */
|
|
428
|
-
type SkipLinkProps = AnchorHTMLAttributes<HTMLAnchorElement> & {
|
|
429
|
-
children?: ReactNode;
|
|
430
|
-
};
|
|
431
|
-
/** Accessibility skip-navigation link, visually hidden until focused. */
|
|
432
|
-
declare const SkipLink: react.ForwardRefExoticComponent<AnchorHTMLAttributes<HTMLAnchorElement> & {
|
|
433
|
-
children?: ReactNode;
|
|
434
|
-
} & react.RefAttributes<HTMLAnchorElement>>;
|
|
435
|
-
|
|
436
|
-
/** Props for {@link Toc}. */
|
|
437
|
-
interface TocProps extends HTMLAttributes<HTMLElement> {
|
|
438
|
-
/** CSS selector for the content root to scan for headings. */
|
|
439
|
-
contentSelector?: string;
|
|
440
|
-
/** Comma-separated heading selector, e.g. `"h2,h3"`. */
|
|
441
|
-
headings?: string;
|
|
442
|
-
/** Highlight the current section while scrolling. */
|
|
443
|
-
scrollSpy?: boolean;
|
|
444
|
-
}
|
|
445
|
-
/** Auto-generated table of contents with optional scroll-spy. */
|
|
446
|
-
declare const Toc: react.ForwardRefExoticComponent<TocProps & react.RefAttributes<HTMLElement>>;
|
|
447
|
-
|
|
448
|
-
/** Props for {@link ToastRegion}. */
|
|
449
|
-
interface ToastRegionProps extends HTMLAttributes<HTMLDivElement> {
|
|
450
|
-
/** Default auto-dismiss duration in ms for toasts shown without one. */
|
|
451
|
-
duration?: number;
|
|
452
|
-
/** Called after a toast appears (`open: true`) or is dismissed (`open: false`). */
|
|
453
|
-
onOpenChange?: (open: boolean, toast: HTMLElement) => void;
|
|
454
|
-
}
|
|
455
|
-
/**
|
|
456
|
-
* The polite live region toasts render into. Render once near the root of
|
|
457
|
-
* your app to control where toasts appear; it enhances on mount and adopts
|
|
458
|
-
* declarative `data-hl-toast-trigger` buttons anywhere in the document. If
|
|
459
|
-
* omitted, the first `show()` call creates a region at the end of `<body>`.
|
|
460
|
-
*/
|
|
461
|
-
declare const ToastRegion: react.ForwardRefExoticComponent<ToastRegionProps & react.RefAttributes<HTMLDivElement>>;
|
|
462
|
-
/**
|
|
463
|
-
* Access the imperative toast API: `show(message, { duration, intent })`
|
|
464
|
-
* returns the toast element, `dismiss(toast)` removes it. Works with or
|
|
465
|
-
* without a mounted {@link ToastRegion}.
|
|
466
|
-
*
|
|
467
|
-
* ```tsx
|
|
468
|
-
* const toast = useToast();
|
|
469
|
-
* toast.show('Saved', { intent: 'success' });
|
|
470
|
-
* ```
|
|
471
|
-
*/
|
|
472
|
-
declare function useToast(): ToastApi;
|
|
473
|
-
|
|
474
|
-
/** Props for {@link Combobox}. */
|
|
475
|
-
interface ComboboxProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
|
476
|
-
/** Hide options that don't match the typed query. Defaults to `true`. */
|
|
477
|
-
filter?: EnhanceComboboxOptions['filter'];
|
|
478
|
-
/** Highlight the first match while typing. Defaults to `true`. */
|
|
479
|
-
autoHighlight?: EnhanceComboboxOptions['autoHighlight'];
|
|
480
|
-
/** Controlled committed value (pair with `onValueChange`). */
|
|
481
|
-
value?: string;
|
|
482
|
-
/** Initial committed value for uncontrolled usage. */
|
|
483
|
-
defaultValue?: string;
|
|
484
|
-
/** Fires with the committed value when an option is selected. */
|
|
485
|
-
onValueChange?: (value: string) => void;
|
|
486
|
-
/** Controlled listbox visibility (pair with `onOpenChange`). */
|
|
487
|
-
open?: boolean;
|
|
488
|
-
/** Show the listbox initially for uncontrolled usage. */
|
|
489
|
-
defaultOpen?: boolean;
|
|
490
|
-
/** Called when the listbox expands or collapses. */
|
|
491
|
-
onOpenChange?: (open: boolean) => void;
|
|
492
|
-
}
|
|
493
|
-
/**
|
|
494
|
-
* Editable combobox (input + listbox) implementing the APG pattern. Compose with
|
|
495
|
-
* `<ComboboxInput>`, `<ComboboxList>`, and `<ComboboxOption>`. The enhancer adds
|
|
496
|
-
* filtering, `aria-activedescendant` navigation, and selection; both the
|
|
497
|
-
* committed value and the open state work uncontrolled or controlled.
|
|
498
|
-
*
|
|
499
|
-
* ```tsx
|
|
500
|
-
* <Combobox value={fruit} onValueChange={setFruit}>
|
|
501
|
-
* <ComboboxInput placeholder="Search..." />
|
|
502
|
-
* <ComboboxList>
|
|
503
|
-
* <ComboboxOption value="apple">Apple</ComboboxOption>
|
|
504
|
-
* <ComboboxOption value="banana">Banana</ComboboxOption>
|
|
505
|
-
* </ComboboxList>
|
|
506
|
-
* </Combobox>
|
|
507
|
-
* ```
|
|
508
|
-
*/
|
|
509
|
-
declare const Combobox: react.ForwardRefExoticComponent<ComboboxProps & react.RefAttributes<HTMLDivElement>>;
|
|
510
|
-
/** Props for {@link ComboboxInput}. */
|
|
511
|
-
interface ComboboxInputProps extends InputHTMLAttributes<HTMLInputElement> {
|
|
512
|
-
/** Apply the `hl-input` style. Defaults to `true`. */
|
|
513
|
-
styled?: boolean;
|
|
514
|
-
}
|
|
515
|
-
/**
|
|
516
|
-
* The combobox text field. Inside a {@link Field} it picks up `id`,
|
|
517
|
-
* `aria-describedby`, `aria-invalid`, and `required`.
|
|
518
|
-
*/
|
|
519
|
-
declare const ComboboxInput: react.ForwardRefExoticComponent<ComboboxInputProps & react.RefAttributes<HTMLInputElement>>;
|
|
520
|
-
/** Props for {@link ComboboxList}. */
|
|
521
|
-
type ComboboxListProps = HTMLAttributes<HTMLUListElement>;
|
|
522
|
-
/** The option popup (`role="listbox"`). */
|
|
523
|
-
declare const ComboboxList: react.ForwardRefExoticComponent<ComboboxListProps & react.RefAttributes<HTMLUListElement>>;
|
|
524
|
-
/** Props for {@link ComboboxOption}. */
|
|
525
|
-
interface ComboboxOptionProps extends Omit<LiHTMLAttributes<HTMLLIElement>, 'value'> {
|
|
526
|
-
/** The value committed when this option is selected. */
|
|
527
|
-
value: string;
|
|
528
|
-
/** Skip the option in keyboard navigation and refuse selection. */
|
|
529
|
-
disabled?: boolean;
|
|
530
|
-
}
|
|
531
|
-
/** A selectable option. The `value` is committed on selection. */
|
|
532
|
-
declare const ComboboxOption: react.ForwardRefExoticComponent<ComboboxOptionProps & react.RefAttributes<HTMLLIElement>>;
|
|
533
|
-
|
|
534
|
-
/** Props for {@link Command}. */
|
|
535
|
-
interface CommandProps extends HTMLAttributes<HTMLDivElement> {
|
|
536
|
-
/** Lowercased key that opens the palette's hosting `<dialog>` with Cmd/Ctrl. */
|
|
537
|
-
hotkey?: string;
|
|
538
|
-
/** Controlled filter query (pair with `onQueryChange`). */
|
|
539
|
-
query?: string;
|
|
540
|
-
/** Initial filter query for uncontrolled usage. */
|
|
541
|
-
defaultQuery?: string;
|
|
542
|
-
/** Called with the filter query after every change. */
|
|
543
|
-
onQueryChange?: (query: string) => void;
|
|
544
|
-
/** Fires with the chosen item's value and element when a command runs. */
|
|
545
|
-
onCommand?: (value: string, item: HTMLElement) => void;
|
|
546
|
-
}
|
|
547
|
-
/**
|
|
548
|
-
* Command palette. Compose with `<CommandInput>`, `<CommandList>`,
|
|
549
|
-
* `<CommandGroup>`, `<CommandItem>`, and `<CommandEmpty>`. The enhancer filters
|
|
550
|
-
* items (text + keywords), provides arrow navigation and an empty state, and
|
|
551
|
-
* runs the active item on Enter. The query works uncontrolled (`defaultQuery`)
|
|
552
|
-
* or controlled (`query` + `onQueryChange`). Place inside a `<dialog>` to use
|
|
553
|
-
* `hotkey`.
|
|
554
|
-
*/
|
|
555
|
-
declare const Command: react.ForwardRefExoticComponent<CommandProps & react.RefAttributes<HTMLDivElement>>;
|
|
556
|
-
/** Props for {@link CommandInput}. */
|
|
557
|
-
interface CommandInputProps extends InputHTMLAttributes<HTMLInputElement> {
|
|
558
|
-
/** Apply the `hl-input` style. Defaults to `true`. */
|
|
559
|
-
styled?: boolean;
|
|
560
|
-
}
|
|
561
|
-
/** The palette search field. */
|
|
562
|
-
declare const CommandInput: react.ForwardRefExoticComponent<CommandInputProps & react.RefAttributes<HTMLInputElement>>;
|
|
563
|
-
/** Props for {@link CommandList}. */
|
|
564
|
-
type CommandListProps = HTMLAttributes<HTMLDivElement>;
|
|
565
|
-
/** The scrollable list of commands (`role="listbox"`). */
|
|
566
|
-
declare const CommandList: react.ForwardRefExoticComponent<CommandListProps & react.RefAttributes<HTMLDivElement>>;
|
|
567
|
-
/** Props for {@link CommandGroup}. */
|
|
568
|
-
interface CommandGroupProps extends HTMLAttributes<HTMLDivElement> {
|
|
569
|
-
/** Optional heading shown above the grouped items. */
|
|
570
|
-
label?: ReactNode;
|
|
571
|
-
}
|
|
572
|
-
/** A labelled group of commands. */
|
|
573
|
-
declare const CommandGroup: react.ForwardRefExoticComponent<CommandGroupProps & react.RefAttributes<HTMLDivElement>>;
|
|
574
|
-
/** Props for {@link CommandItem}. */
|
|
575
|
-
interface CommandItemProps extends HTMLAttributes<HTMLDivElement> {
|
|
576
|
-
/** Value reported to `onCommand`. */
|
|
577
|
-
value: string;
|
|
578
|
-
/** Extra search terms for filtering. */
|
|
579
|
-
keywords?: string;
|
|
580
|
-
/** Leading icon node. */
|
|
581
|
-
icon?: ReactNode;
|
|
582
|
-
}
|
|
583
|
-
/** A runnable command (`role="option"`). */
|
|
584
|
-
declare const CommandItem: react.ForwardRefExoticComponent<CommandItemProps & react.RefAttributes<HTMLDivElement>>;
|
|
585
|
-
/** Props for {@link CommandEmpty}. */
|
|
586
|
-
type CommandEmptyProps = HTMLAttributes<HTMLDivElement>;
|
|
587
|
-
/** Shown when no commands match the query. */
|
|
588
|
-
declare const CommandEmpty: react.ForwardRefExoticComponent<CommandEmptyProps & react.RefAttributes<HTMLDivElement>>;
|
|
589
|
-
|
|
590
|
-
/** Props for {@link Input}. */
|
|
591
|
-
interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> {
|
|
592
|
-
size?: 'sm' | 'md' | 'lg';
|
|
593
|
-
/** Error state; also inherited from an enclosing {@link Field}. */
|
|
594
|
-
invalid?: boolean;
|
|
595
|
-
}
|
|
596
|
-
/**
|
|
597
|
-
* Text input styled with the `hl-input` primitive. Inside a {@link Field} it
|
|
598
|
-
* picks up `id`, `aria-describedby`, `aria-invalid`, and `required`.
|
|
599
|
-
*/
|
|
600
|
-
declare const Input: react.ForwardRefExoticComponent<InputProps & react.RefAttributes<HTMLInputElement>>;
|
|
601
|
-
|
|
602
|
-
/** Props for {@link Textarea}. */
|
|
603
|
-
interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
604
|
-
/** Error state; also inherited from an enclosing {@link Field}. */
|
|
605
|
-
invalid?: boolean;
|
|
606
|
-
/** Grow with the content (`field-sizing: content` where supported). */
|
|
607
|
-
autosize?: boolean;
|
|
608
|
-
}
|
|
609
|
-
/**
|
|
610
|
-
* Multi-line text input styled with the `hl-textarea` primitive. Inside a
|
|
611
|
-
* {@link Field} it picks up `id`, `aria-describedby`, `aria-invalid`, and
|
|
612
|
-
* `required`.
|
|
613
|
-
*/
|
|
614
|
-
declare const Textarea: react.ForwardRefExoticComponent<TextareaProps & react.RefAttributes<HTMLTextAreaElement>>;
|
|
615
|
-
|
|
616
|
-
/** A single option in a {@link Select}. */
|
|
617
|
-
interface SelectOption {
|
|
618
|
-
label: ReactNode;
|
|
619
|
-
value: string;
|
|
620
|
-
disabled?: boolean;
|
|
621
|
-
}
|
|
622
|
-
/** Props for {@link Select}. */
|
|
623
|
-
interface SelectProps extends Omit<SelectHTMLAttributes<HTMLSelectElement>, 'size'> {
|
|
624
|
-
size?: 'sm' | 'md' | 'lg';
|
|
625
|
-
/** Error state; also inherited from an enclosing {@link Field}. */
|
|
626
|
-
invalid?: boolean;
|
|
627
|
-
/** Convenience for simple option lists; or pass `children` directly. */
|
|
628
|
-
options?: SelectOption[];
|
|
629
|
-
}
|
|
630
|
-
/**
|
|
631
|
-
* Native `<select>` styled with the `hl-select` primitive, wrapped so a custom
|
|
632
|
-
* caret can be drawn purely in CSS. Native selects keep full mobile/keyboard
|
|
633
|
-
* behavior for free. Inside a {@link Field} it picks up `id`,
|
|
634
|
-
* `aria-describedby`, `aria-invalid`, and `required`.
|
|
635
|
-
*/
|
|
636
|
-
declare const Select: react.ForwardRefExoticComponent<SelectProps & react.RefAttributes<HTMLSelectElement>>;
|
|
637
|
-
|
|
638
|
-
/** Props for {@link Checkbox}. */
|
|
639
|
-
interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type'> {
|
|
640
|
-
children?: ReactNode;
|
|
641
|
-
}
|
|
642
|
-
/**
|
|
643
|
-
* Checkbox built on a native `<input type="checkbox">`, label-wrapped. Inside
|
|
644
|
-
* a {@link Field} it picks up `id`, `aria-describedby`, `aria-invalid`, and
|
|
645
|
-
* `required`.
|
|
646
|
-
*/
|
|
647
|
-
declare const Checkbox: react.ForwardRefExoticComponent<CheckboxProps & react.RefAttributes<HTMLInputElement>>;
|
|
648
|
-
|
|
649
|
-
/** Props for {@link Radio}. */
|
|
650
|
-
interface RadioProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'value'> {
|
|
651
|
-
children?: ReactNode;
|
|
652
|
-
value: string;
|
|
653
|
-
}
|
|
654
|
-
/** A single radio built on a native `<input type="radio">`, label-wrapped. */
|
|
655
|
-
declare const Radio: react.ForwardRefExoticComponent<RadioProps & react.RefAttributes<HTMLInputElement>>;
|
|
656
|
-
/** Props for {@link RadioGroup}. */
|
|
657
|
-
interface RadioGroupProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
|
658
|
-
/** Shared `name` for the radios; generated when omitted. */
|
|
659
|
-
name?: string;
|
|
660
|
-
/** Controlled selected value (pair with `onValueChange`). */
|
|
661
|
-
value?: string;
|
|
662
|
-
/** Initially selected value for uncontrolled usage. */
|
|
663
|
-
defaultValue?: string;
|
|
664
|
-
/** Called with the newly selected value. */
|
|
665
|
-
onValueChange?: (value: string) => void;
|
|
666
|
-
/** Layout direction; sets `data-hl-orientation` and `aria-orientation`. */
|
|
667
|
-
orientation?: 'horizontal' | 'vertical';
|
|
668
|
-
}
|
|
669
|
-
/**
|
|
670
|
-
* Groups radios under a `role="radiogroup"`, sharing a name and managing the
|
|
671
|
-
* selected value (uncontrolled via `defaultValue` or controlled via `value`).
|
|
672
|
-
* Pass `<Radio value="...">` children.
|
|
673
|
-
*/
|
|
674
|
-
declare const RadioGroup: react.ForwardRefExoticComponent<RadioGroupProps & react.RefAttributes<HTMLDivElement>>;
|
|
675
|
-
|
|
676
|
-
/** What {@link useField} hands to a custom control inside a {@link Field}. */
|
|
677
|
-
interface FieldControl {
|
|
678
|
-
/** The id the field's label points at; put it on the control. */
|
|
679
|
-
id: string;
|
|
680
|
-
/** Space-separated ids for `aria-describedby`, or `undefined` when there's nothing to reference. */
|
|
681
|
-
describedBy: string | undefined;
|
|
682
|
-
/** Whether the field is currently in an error state. */
|
|
683
|
-
invalid: boolean;
|
|
684
|
-
/** Whether the field is required. */
|
|
685
|
-
required: boolean;
|
|
686
|
-
}
|
|
687
|
-
/**
|
|
688
|
-
* Read the enclosing {@link Field}'s wiring for a custom control, or `null`
|
|
689
|
-
* outside a Field. The built-in controls (Input, Textarea, Select, Checkbox,
|
|
690
|
-
* Switch, Slider, ComboboxInput) call this themselves.
|
|
691
|
-
*
|
|
692
|
-
* ```tsx
|
|
693
|
-
* const field = useField();
|
|
694
|
-
* <input id={field?.id} aria-describedby={field?.describedBy} aria-invalid={field?.invalid || undefined} />
|
|
695
|
-
* ```
|
|
696
|
-
*/
|
|
697
|
-
declare function useField(): FieldControl | null;
|
|
698
|
-
/** Props for {@link Field}. */
|
|
699
|
-
interface FieldProps extends HTMLAttributes<HTMLDivElement> {
|
|
700
|
-
/**
|
|
701
|
-
* Id given to the control inside the Field (the label's `htmlFor` target).
|
|
702
|
-
* Generated when omitted. Help and error text derive their ids from it.
|
|
703
|
-
*/
|
|
704
|
-
id?: string;
|
|
705
|
-
/** Label text; renders a {@link FieldLabel} before the control. */
|
|
706
|
-
label?: ReactNode;
|
|
707
|
-
/** Help text; renders a {@link FieldHelp} after the control. */
|
|
708
|
-
description?: ReactNode;
|
|
709
|
-
/** Validation message; renders a {@link FieldError} and marks the field invalid. */
|
|
710
|
-
error?: ReactNode;
|
|
711
|
-
/** Force the error state without a message. */
|
|
712
|
-
invalid?: boolean;
|
|
713
|
-
required?: boolean;
|
|
714
|
-
}
|
|
715
|
-
/**
|
|
716
|
-
* Layout + accessibility wrapper for a form control. Provides a shared id so
|
|
717
|
-
* the label, help text, and error message wire up `htmlFor` and
|
|
718
|
-
* `aria-describedby` automatically, and the built-in controls pick up `id`,
|
|
719
|
-
* `aria-describedby`, `aria-invalid`, and `required` from it with no extra
|
|
720
|
-
* props. Pass `label`/`description`/`error` for the common layout, or compose
|
|
721
|
-
* `<FieldLabel>`, `<FieldHelp>`, and `<FieldError>` yourself.
|
|
722
|
-
*
|
|
723
|
-
* ```tsx
|
|
724
|
-
* <Field label="Email" description="We never share it." error={errors.email}>
|
|
725
|
-
* <Input type="email" />
|
|
726
|
-
* </Field>
|
|
727
|
-
* ```
|
|
728
|
-
*/
|
|
729
|
-
declare const Field: react.ForwardRefExoticComponent<FieldProps & react.RefAttributes<HTMLDivElement>>;
|
|
730
|
-
/** Props for {@link FieldLabel}. */
|
|
731
|
-
type FieldLabelProps = LabelHTMLAttributes<HTMLLabelElement>;
|
|
732
|
-
/** Label bound to the enclosing field's control via `htmlFor`. */
|
|
733
|
-
declare const FieldLabel: react.ForwardRefExoticComponent<FieldLabelProps & react.RefAttributes<HTMLLabelElement>>;
|
|
734
|
-
/** Props for {@link FieldHelp}. */
|
|
735
|
-
type FieldHelpProps = HTMLAttributes<HTMLParagraphElement>;
|
|
736
|
-
/** Supplementary help text, referenced by the control's `aria-describedby`. */
|
|
737
|
-
declare const FieldHelp: react.ForwardRefExoticComponent<FieldHelpProps & react.RefAttributes<HTMLParagraphElement>>;
|
|
738
|
-
/** Props for {@link FieldError}. */
|
|
739
|
-
type FieldErrorProps = HTMLAttributes<HTMLParagraphElement>;
|
|
740
|
-
/** Validation message; renders nothing unless given content. */
|
|
741
|
-
declare const FieldError: react.ForwardRefExoticComponent<FieldErrorProps & react.RefAttributes<HTMLParagraphElement>>;
|
|
742
|
-
/** Props for {@link Fieldset}. */
|
|
743
|
-
interface FieldsetProps extends HTMLAttributes<HTMLFieldSetElement> {
|
|
744
|
-
legend?: ReactNode;
|
|
745
|
-
}
|
|
746
|
-
/** Grouped fields with an optional legend. */
|
|
747
|
-
declare const Fieldset: react.ForwardRefExoticComponent<FieldsetProps & react.RefAttributes<HTMLFieldSetElement>>;
|
|
748
|
-
|
|
749
|
-
/** A single option in a {@link SegmentedControl}. */
|
|
750
|
-
interface SegmentedOption {
|
|
751
|
-
label: ReactNode;
|
|
752
|
-
value: string;
|
|
753
|
-
disabled?: boolean;
|
|
754
|
-
}
|
|
755
|
-
/** Props for {@link SegmentedControl}. */
|
|
756
|
-
interface SegmentedControlProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
|
757
|
-
options: SegmentedOption[];
|
|
758
|
-
/** Controlled selected value (pair with `onValueChange`). */
|
|
759
|
-
value?: string;
|
|
760
|
-
/** Initially selected value for uncontrolled usage; defaults to the first option. */
|
|
761
|
-
defaultValue?: string;
|
|
762
|
-
/** Called with the newly selected value. */
|
|
763
|
-
onValueChange?: (value: string) => void;
|
|
764
|
-
/** Shared `name` for the underlying radios; generated when omitted. */
|
|
765
|
-
name?: string;
|
|
766
|
-
size?: 'sm' | 'md' | 'lg';
|
|
767
|
-
}
|
|
768
|
-
/**
|
|
769
|
-
* Segmented control: an `hl-segmented` radiogroup built on native radios, so
|
|
770
|
-
* keyboard navigation comes for free. Uncontrolled (`defaultValue`, falling
|
|
771
|
-
* back to the first option) or controlled (`value` + `onValueChange`).
|
|
772
|
-
*/
|
|
773
|
-
declare const SegmentedControl: react.ForwardRefExoticComponent<SegmentedControlProps & react.RefAttributes<HTMLDivElement>>;
|
|
774
|
-
|
|
775
|
-
/** Props for {@link Slider}. */
|
|
776
|
-
type SliderProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type'>;
|
|
777
|
-
/**
|
|
778
|
-
* Range slider primitive: `<input type="range" class="hl-slider">`. Inside a
|
|
779
|
-
* {@link Field} it picks up `id`, `aria-describedby`, `aria-invalid`, and
|
|
780
|
-
* `required`.
|
|
781
|
-
*/
|
|
782
|
-
declare const Slider: react.ForwardRefExoticComponent<SliderProps & react.RefAttributes<HTMLInputElement>>;
|
|
783
|
-
|
|
784
|
-
/** Props for {@link Button}. */
|
|
785
|
-
interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
786
|
-
variant?: 'solid' | 'soft' | 'outline' | 'ghost' | 'link';
|
|
787
|
-
intent?: 'neutral' | 'primary' | 'danger' | 'success' | 'warning' | 'info';
|
|
788
|
-
size?: 'sm' | 'md' | 'lg';
|
|
789
|
-
/** Stretch to the container width. */
|
|
790
|
-
block?: boolean;
|
|
791
|
-
/** Square, icon-only button. */
|
|
792
|
-
icon?: boolean;
|
|
793
|
-
/** Show a spinner and disable interaction. */
|
|
794
|
-
loading?: boolean;
|
|
795
|
-
}
|
|
796
|
-
/** Button primitive: `hl-button` with intent/variant/size modifiers. */
|
|
797
|
-
declare const Button: react.ForwardRefExoticComponent<ButtonProps & react.RefAttributes<HTMLButtonElement>>;
|
|
798
|
-
|
|
799
|
-
/** Props for {@link Alert}. */
|
|
800
|
-
interface AlertProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
801
|
-
intent?: 'info' | 'success' | 'warning' | 'danger' | 'neutral';
|
|
802
|
-
title?: ReactNode;
|
|
803
|
-
/** Leading icon, rendered before the body. */
|
|
804
|
-
icon?: ReactNode;
|
|
805
|
-
}
|
|
806
|
-
/** Alert primitive: `hl-alert` with intent, optional icon + title. */
|
|
807
|
-
declare const Alert: react.ForwardRefExoticComponent<AlertProps & react.RefAttributes<HTMLDivElement>>;
|
|
808
|
-
|
|
809
|
-
/** Props for {@link Badge}. */
|
|
810
|
-
interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {
|
|
811
|
-
intent?: 'neutral' | 'primary' | 'danger' | 'success' | 'warning' | 'info';
|
|
812
|
-
variant?: 'soft' | 'solid' | 'outline';
|
|
813
|
-
size?: 'sm' | 'md';
|
|
814
|
-
}
|
|
815
|
-
/** Badge primitive: `hl-badge` with intent/variant/size modifiers. */
|
|
816
|
-
declare const Badge: react.ForwardRefExoticComponent<BadgeProps & react.RefAttributes<HTMLSpanElement>>;
|
|
817
|
-
|
|
818
|
-
/** Props for {@link Card}. */
|
|
819
|
-
interface CardProps extends HTMLAttributes<HTMLDivElement> {
|
|
820
|
-
/** Hover/active elevation for clickable cards. */
|
|
821
|
-
interactive?: boolean;
|
|
822
|
-
}
|
|
823
|
-
/** Card container: `hl-card`. Compose with the Card.* parts. */
|
|
824
|
-
declare const Card: react.ForwardRefExoticComponent<CardProps & react.RefAttributes<HTMLDivElement>>;
|
|
825
|
-
/** Props shared by the {@link Card} section components. */
|
|
826
|
-
type CardSectionProps = HTMLAttributes<HTMLDivElement>;
|
|
827
|
-
/** Header region of a {@link Card}. */
|
|
828
|
-
declare const CardHeader: react.ForwardRefExoticComponent<CardSectionProps & react.RefAttributes<HTMLDivElement>>;
|
|
829
|
-
/** Body region of a {@link Card}. */
|
|
830
|
-
declare const CardBody: react.ForwardRefExoticComponent<CardSectionProps & react.RefAttributes<HTMLDivElement>>;
|
|
831
|
-
/** Footer region of a {@link Card}. */
|
|
832
|
-
declare const CardFooter: react.ForwardRefExoticComponent<CardSectionProps & react.RefAttributes<HTMLDivElement>>;
|
|
833
|
-
/** Title heading of a {@link Card}. */
|
|
834
|
-
declare const CardTitle: react.ForwardRefExoticComponent<HTMLAttributes<HTMLHeadingElement> & react.RefAttributes<HTMLHeadingElement>>;
|
|
835
|
-
/** Description text of a {@link Card}. */
|
|
836
|
-
declare const CardDescription: react.ForwardRefExoticComponent<HTMLAttributes<HTMLParagraphElement> & react.RefAttributes<HTMLParagraphElement>>;
|
|
837
|
-
|
|
838
|
-
/** Props for {@link Avatar}. */
|
|
839
|
-
interface AvatarProps extends HTMLAttributes<HTMLSpanElement> {
|
|
840
|
-
src?: string;
|
|
841
|
-
alt?: string;
|
|
842
|
-
/** Shown when there is no `src` or the image fails to load. */
|
|
843
|
-
fallback?: ReactNode;
|
|
844
|
-
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
845
|
-
shape?: 'circle' | 'square';
|
|
846
|
-
}
|
|
847
|
-
/** Avatar primitive: `hl-avatar` with image + graceful fallback. */
|
|
848
|
-
declare const Avatar: react.ForwardRefExoticComponent<AvatarProps & react.RefAttributes<HTMLSpanElement>>;
|
|
849
|
-
/** Props for {@link AvatarGroup}. */
|
|
850
|
-
type AvatarGroupProps = HTMLAttributes<HTMLDivElement>;
|
|
851
|
-
/** Overlapping stack of avatars. */
|
|
852
|
-
declare const AvatarGroup: react.ForwardRefExoticComponent<AvatarGroupProps & react.RefAttributes<HTMLDivElement>>;
|
|
853
|
-
|
|
854
|
-
/** Props for {@link Progress}. */
|
|
855
|
-
interface ProgressProps extends Omit<ProgressHTMLAttributes<HTMLProgressElement>, 'value'> {
|
|
856
|
-
/** Omit for an indeterminate bar. */
|
|
857
|
-
value?: number;
|
|
858
|
-
max?: number;
|
|
859
|
-
intent?: 'primary' | 'success' | 'warning' | 'danger' | 'info';
|
|
860
|
-
size?: 'sm' | 'md' | 'lg';
|
|
861
|
-
}
|
|
862
|
-
/** Progress primitive: native `<progress class="hl-progress">`. */
|
|
863
|
-
declare const Progress: react.ForwardRefExoticComponent<ProgressProps & react.RefAttributes<HTMLProgressElement>>;
|
|
864
|
-
|
|
865
|
-
/** Props for {@link Spinner}. */
|
|
866
|
-
interface SpinnerProps extends HTMLAttributes<HTMLSpanElement> {
|
|
867
|
-
size?: 'sm' | 'md' | 'lg' | 'xl';
|
|
868
|
-
/** Accessible label; announced via `role="status"`. */
|
|
869
|
-
label?: string;
|
|
870
|
-
}
|
|
871
|
-
/** Spinner primitive: `hl-spinner`. Inherits `currentColor`. */
|
|
872
|
-
declare const Spinner: react.ForwardRefExoticComponent<SpinnerProps & react.RefAttributes<HTMLSpanElement>>;
|
|
873
|
-
|
|
874
|
-
/** Props for {@link Skeleton}. */
|
|
875
|
-
interface SkeletonProps extends HTMLAttributes<HTMLSpanElement> {
|
|
876
|
-
/** Placeholder silhouette. Defaults to a rectangle. */
|
|
877
|
-
shape?: 'rect' | 'text' | 'circle';
|
|
878
|
-
/** Inline size (maps to the logical `inline-size`). */
|
|
879
|
-
width?: string | number;
|
|
880
|
-
/** Block size (maps to the logical `block-size`). */
|
|
881
|
-
height?: string | number;
|
|
882
|
-
}
|
|
883
|
-
/** Skeleton placeholder primitive: `hl-skeleton`. Hidden from assistive tech. */
|
|
884
|
-
declare const Skeleton: react.ForwardRefExoticComponent<SkeletonProps & react.RefAttributes<HTMLSpanElement>>;
|
|
885
|
-
|
|
886
|
-
/** Props for {@link Pagination}. */
|
|
887
|
-
interface PaginationProps extends Omit<HTMLAttributes<HTMLElement>, 'onChange'> {
|
|
888
|
-
/** The current 1-based page. */
|
|
889
|
-
page: number;
|
|
890
|
-
/** Total number of pages. */
|
|
891
|
-
count: number;
|
|
892
|
-
/** Called with the requested page. */
|
|
893
|
-
onPageChange?: (page: number) => void;
|
|
894
|
-
/** Pages to show on each side of the current page. Defaults to 1. */
|
|
895
|
-
siblingCount?: number;
|
|
896
|
-
/** Render Previous/Next controls. Defaults to true. */
|
|
897
|
-
showControls?: boolean;
|
|
898
|
-
prevLabel?: ReactNode;
|
|
899
|
-
nextLabel?: ReactNode;
|
|
900
|
-
}
|
|
901
|
-
/** Pagination primitive: `hl-pagination` with smart ellipsis truncation. */
|
|
902
|
-
declare const Pagination: react.ForwardRefExoticComponent<PaginationProps & react.RefAttributes<HTMLElement>>;
|
|
903
|
-
|
|
904
|
-
/** Props for {@link Kbd}. */
|
|
905
|
-
type KbdProps = HTMLAttributes<HTMLElement>;
|
|
906
|
-
/** Keyboard key primitive: `<kbd class="hl-kbd">`. */
|
|
907
|
-
declare const Kbd: react.ForwardRefExoticComponent<KbdProps & react.RefAttributes<HTMLElement>>;
|
|
908
|
-
|
|
909
|
-
/** Props for {@link Separator}. */
|
|
910
|
-
interface SeparatorProps extends HTMLAttributes<HTMLHRElement> {
|
|
911
|
-
orientation?: 'horizontal' | 'vertical';
|
|
912
|
-
/** Purely decorative: removes it from the accessibility tree. */
|
|
913
|
-
decorative?: boolean;
|
|
914
|
-
}
|
|
915
|
-
/** Separator primitive: `<hr class="hl-separator">`. */
|
|
916
|
-
declare const Separator: react.ForwardRefExoticComponent<SeparatorProps & react.RefAttributes<HTMLHRElement>>;
|
|
917
|
-
|
|
918
|
-
/** Props for {@link Table}. */
|
|
919
|
-
interface TableProps extends Omit<TableHTMLAttributes<HTMLTableElement>, 'align'> {
|
|
920
|
-
/** Zebra-stripe the body rows. */
|
|
921
|
-
striped?: boolean;
|
|
922
|
-
/** Highlight body rows on hover. */
|
|
923
|
-
hover?: boolean;
|
|
924
|
-
/** Default cell alignment. */
|
|
925
|
-
align?: 'start' | 'center' | 'end';
|
|
926
|
-
/** Cell density. */
|
|
927
|
-
size?: 'sm' | 'md' | 'lg';
|
|
928
|
-
}
|
|
929
|
-
/**
|
|
930
|
-
* Semantic table styled with the `hl-table` primitive. Pass `<thead>`,
|
|
931
|
-
* `<tbody>`, and friends as children; wrap it in an element with
|
|
932
|
-
* `overflow-x: auto` (the `hl-table-wrapper` class) when rows may overflow.
|
|
933
|
-
*/
|
|
934
|
-
declare const Table: react.ForwardRefExoticComponent<TableProps & react.RefAttributes<HTMLTableElement>>;
|
|
935
|
-
|
|
936
|
-
/** Join truthy class names into a single string. */
|
|
937
|
-
declare function cx(...classes: Array<string | false | null | undefined>): string;
|
|
938
|
-
|
|
939
|
-
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, DropdownGroup, type DropdownGroupProps, DropdownItem, type DropdownItemProps, DropdownMenu, type DropdownMenuProps, type DropdownProps, DropdownSeparator, type DropdownSeparatorProps, DropdownTrigger, type DropdownTriggerProps, Field, type FieldControl, FieldError, type FieldErrorProps, FieldHelp, type FieldHelpProps, FieldLabel, type FieldLabelProps, type FieldProps, Fieldset, type FieldsetProps, Input, type InputProps, Kbd, type KbdProps, Menu, MenuItem, type MenuItemProps, type MenuProps, MenuSubmenu, type MenuSubmenuProps, 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, Table, type TableProps, Tabs, type TabsProps, Textarea, type TextareaProps, ToastRegion, type ToastRegionProps, Toc, type TocProps, Tooltip, type TooltipProps, cx, useEnhancer, useField, useToast };
|
|
1
|
+
export * from './server.js';
|
|
2
|
+
export * from './client.js';
|