@hydrateless/react 0.5.0 → 0.6.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 +28 -22
- package/dist/index.d.ts +125 -52
- package/dist/index.js +239 -186
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -19,62 +19,68 @@ import 'hydrateless/hydrateless.css';
|
|
|
19
19
|
## Components
|
|
20
20
|
|
|
21
21
|
```tsx
|
|
22
|
-
import { Tabs,
|
|
22
|
+
import { Tabs, TabList, Tab, TabPanel } from '@hydrateless/react';
|
|
23
23
|
|
|
24
24
|
function Example() {
|
|
25
25
|
return (
|
|
26
|
-
<Tabs
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
<Tabs defaultValue="overview">
|
|
27
|
+
<TabList>
|
|
28
|
+
<Tab value="overview">Overview</Tab>
|
|
29
|
+
<Tab value="install">Install</Tab>
|
|
30
|
+
</TabList>
|
|
31
|
+
<TabPanel>Zero runtime by default.</TabPanel>
|
|
32
|
+
<TabPanel>
|
|
33
|
+
<code>npm i hydrateless</code>
|
|
34
|
+
</TabPanel>
|
|
35
|
+
</Tabs>
|
|
32
36
|
);
|
|
33
37
|
}
|
|
34
38
|
```
|
|
35
39
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
`Toc`, and `ToastProvider` + `useToast`.
|
|
40
|
+
Interactive components work uncontrolled (`defaultValue` / `defaultOpen`) or
|
|
41
|
+
fully controlled (`value` + `onValueChange`, `open` + `onOpenChange`).
|
|
39
42
|
|
|
40
43
|
### Controlled dialogs
|
|
41
44
|
|
|
42
45
|
`Modal` and `Drawer` are controlled via the `open` prop and built on the native
|
|
43
|
-
`<dialog>` element
|
|
46
|
+
`<dialog>` element plus the modal enhancer (focus trap, scroll-lock, background
|
|
47
|
+
`inert`). Escape and backdrop clicks report back through `onOpenChange`:
|
|
44
48
|
|
|
45
49
|
```tsx
|
|
46
50
|
const [open, setOpen] = useState(false);
|
|
47
51
|
|
|
48
52
|
<button onClick={() => setOpen(true)}>Open</button>
|
|
49
|
-
<Modal open={open}
|
|
50
|
-
|
|
53
|
+
<Modal open={open} onOpenChange={setOpen}>
|
|
54
|
+
<ModalHeader>Title</ModalHeader>
|
|
55
|
+
<ModalBody>Body content.</ModalBody>
|
|
56
|
+
<ModalFooter><button onClick={() => setOpen(false)}>Close</button></ModalFooter>
|
|
51
57
|
</Modal>;
|
|
52
58
|
```
|
|
53
59
|
|
|
54
60
|
### Toasts
|
|
55
61
|
|
|
62
|
+
`useToast()` works anywhere — no provider required. Render `<ToastRegion />`
|
|
63
|
+
once if you want to control where toasts appear:
|
|
64
|
+
|
|
56
65
|
```tsx
|
|
57
66
|
function Save() {
|
|
58
67
|
const toast = useToast();
|
|
59
|
-
return <button onClick={() => toast.show('Saved')}>Save</button>;
|
|
68
|
+
return <button onClick={() => toast.show('Saved', { variant: 'success' })}>Save</button>;
|
|
60
69
|
}
|
|
61
|
-
|
|
62
|
-
<ToastProvider>
|
|
63
|
-
<Save />
|
|
64
|
-
</ToastProvider>;
|
|
65
70
|
```
|
|
66
71
|
|
|
67
72
|
## Hooks
|
|
68
73
|
|
|
69
|
-
For your own markup, attach any enhancer with a ref.
|
|
70
|
-
|
|
74
|
+
For your own markup, attach any enhancer with a ref. You get the enhancer's
|
|
75
|
+
imperative API back, and the instance is destroyed automatically on unmount:
|
|
71
76
|
|
|
72
77
|
```tsx
|
|
73
78
|
import { useEnhancer } from '@hydrateless/react';
|
|
74
|
-
import { enhanceTabs } from '@hydrateless/enhancers';
|
|
79
|
+
import { enhanceTabs, type TabsApi } from '@hydrateless/enhancers';
|
|
75
80
|
|
|
76
81
|
function CustomTabs() {
|
|
77
|
-
const ref = useEnhancer<HTMLDivElement>(enhanceTabs);
|
|
82
|
+
const { ref, api } = useEnhancer<HTMLDivElement, TabsApi>((el) => enhanceTabs(el));
|
|
83
|
+
// api.current?.setValue('install')
|
|
78
84
|
return (
|
|
79
85
|
<div data-hl-tabs ref={ref}>
|
|
80
86
|
{/* tablist + tabpanels */}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,46 +1,87 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { DependencyList, RefObject, HTMLAttributes, ReactNode, ButtonHTMLAttributes, LiHTMLAttributes, AnchorHTMLAttributes, ReactElement, InputHTMLAttributes, TextareaHTMLAttributes, SelectHTMLAttributes, LabelHTMLAttributes, ProgressHTMLAttributes } from 'react';
|
|
3
|
-
import
|
|
4
|
-
|
|
3
|
+
import * as _hydrateless_enhancers from '@hydrateless/enhancers';
|
|
4
|
+
import { EnhancerHandle, AccordionApi, DropdownApi, TabsApi, EnhanceTocOptions, TooltipApi, EnhanceTabsOptions, EnhanceDropdownOptions, EnhanceMenuOptions, ToastApi, EnhanceComboboxOptions } from '@hydrateless/enhancers';
|
|
5
|
+
export { AccordionApi, ComboboxApi, Disposer, DrawerApi, DropdownApi, EnhancerHandle, ModalApi, PopoverApi, TabsApi, ToastApi, TooltipApi } from '@hydrateless/enhancers';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Attach any Hydrateless enhancer to a DOM node for the lifetime of a
|
|
8
|
-
* component. Returns a ref to spread onto the element you want enhanced
|
|
9
|
-
*
|
|
10
|
-
*
|
|
9
|
+
* component. Returns a ref to spread onto the element you want enhanced plus
|
|
10
|
+
* a ref to the enhancer's imperative API (e.g. `setValue`/`setOpen`). The
|
|
11
|
+
* instance is destroyed automatically on unmount (and before re-running when
|
|
12
|
+
* `deps` change), so there are no leaked listeners across renders.
|
|
11
13
|
*
|
|
12
14
|
* ```tsx
|
|
13
|
-
* const ref = useEnhancer<HTMLDivElement>(enhanceTabs);
|
|
15
|
+
* const { ref, api } = useEnhancer<HTMLDivElement, TabsApi>((el) => enhanceTabs(el));
|
|
16
|
+
* // api.current?.setValue('two');
|
|
14
17
|
* return <div data-hl-tabs ref={ref}>…</div>;
|
|
15
18
|
* ```
|
|
16
19
|
*/
|
|
17
|
-
declare function useEnhancer<T extends HTMLElement = HTMLElement>(enhance: (container: HTMLElement) =>
|
|
20
|
+
declare function useEnhancer<T extends HTMLElement = HTMLElement, Api = null>(enhance: (container: HTMLElement) => EnhancerHandle<Api>, deps?: DependencyList): {
|
|
21
|
+
ref: RefObject<T | null>;
|
|
22
|
+
api: RefObject<Api | null>;
|
|
23
|
+
};
|
|
18
24
|
|
|
19
25
|
/** Ref hook that wires tabs ARIA + keyboard navigation onto a container. */
|
|
20
|
-
declare const useTabs: <T extends HTMLElement = HTMLDivElement>() =>
|
|
26
|
+
declare const useTabs: <T extends HTMLElement = HTMLDivElement>() => {
|
|
27
|
+
ref: react.RefObject<T | null>;
|
|
28
|
+
api: react.RefObject<TabsApi | null>;
|
|
29
|
+
};
|
|
21
30
|
/** Ref hook that wires a dropdown menu onto a container. */
|
|
22
|
-
declare const useDropdown: <T extends HTMLElement = HTMLDivElement>() =>
|
|
31
|
+
declare const useDropdown: <T extends HTMLElement = HTMLDivElement>() => {
|
|
32
|
+
ref: react.RefObject<T | null>;
|
|
33
|
+
api: react.RefObject<DropdownApi | null>;
|
|
34
|
+
};
|
|
23
35
|
/** Ref hook that wires tooltips onto all `[data-hl-tooltip]` triggers inside. */
|
|
24
|
-
declare const useTooltip: <T extends HTMLElement = HTMLElement>() =>
|
|
36
|
+
declare const useTooltip: <T extends HTMLElement = HTMLElement>() => {
|
|
37
|
+
ref: react.RefObject<T | null>;
|
|
38
|
+
api: react.RefObject<TooltipApi | null>;
|
|
39
|
+
};
|
|
25
40
|
/** Ref hook that enforces single-open accordion behavior on a container. */
|
|
26
|
-
declare const useAccordion: <T extends HTMLElement = HTMLDivElement>(allowMultiple?: boolean) =>
|
|
41
|
+
declare const useAccordion: <T extends HTMLElement = HTMLDivElement>(allowMultiple?: boolean) => {
|
|
42
|
+
ref: react.RefObject<T | null>;
|
|
43
|
+
api: react.RefObject<AccordionApi | null>;
|
|
44
|
+
};
|
|
27
45
|
/** Ref hook that groups `[data-hl-disclosure]` elements for mutual exclusivity. */
|
|
28
|
-
declare const useDisclosureGroup: <T extends HTMLElement = HTMLElement>(allowMultiple?: boolean) =>
|
|
46
|
+
declare const useDisclosureGroup: <T extends HTMLElement = HTMLElement>(allowMultiple?: boolean) => {
|
|
47
|
+
ref: react.RefObject<T | null>;
|
|
48
|
+
api: react.RefObject<null>;
|
|
49
|
+
};
|
|
29
50
|
/** Ref hook that wires modal openers/closers + focus trap within a container. */
|
|
30
|
-
declare const useModalGroup: <T extends HTMLElement = HTMLElement>(closeOnBackdrop?: boolean) =>
|
|
51
|
+
declare const useModalGroup: <T extends HTMLElement = HTMLElement>(closeOnBackdrop?: boolean) => {
|
|
52
|
+
ref: react.RefObject<T | null>;
|
|
53
|
+
api: react.RefObject<_hydrateless_enhancers.DialogApi | null>;
|
|
54
|
+
};
|
|
31
55
|
/** Ref hook that builds a table of contents from the surrounding document. */
|
|
32
|
-
declare const useTocEnhancer: <T extends HTMLElement = HTMLElement>(options?: EnhanceTocOptions) =>
|
|
56
|
+
declare const useTocEnhancer: <T extends HTMLElement = HTMLElement>(options?: EnhanceTocOptions) => {
|
|
57
|
+
ref: react.RefObject<T | null>;
|
|
58
|
+
api: react.RefObject<null>;
|
|
59
|
+
};
|
|
33
60
|
|
|
34
61
|
interface AccordionProps extends HTMLAttributes<HTMLDivElement> {
|
|
35
62
|
/** Allow more than one panel to stay open at a time. */
|
|
36
63
|
allowMultiple?: boolean;
|
|
64
|
+
/** Controlled list of open item values (pair with `onValueChange`). */
|
|
65
|
+
value?: string[];
|
|
66
|
+
/** Initially open item values for uncontrolled usage. */
|
|
67
|
+
defaultValue?: string[];
|
|
68
|
+
/** Called with the open item values after every change. */
|
|
69
|
+
onValueChange?: (value: string[]) => void;
|
|
37
70
|
}
|
|
38
|
-
|
|
71
|
+
/**
|
|
72
|
+
* Accordion of native `<details>` items. Item values come from each
|
|
73
|
+
* `<AccordionItem value>`, defaulting to the index. Open state works
|
|
74
|
+
* uncontrolled (`defaultValue`, or `defaultOpen` on items) or controlled
|
|
75
|
+
* (`value` + `onValueChange`).
|
|
76
|
+
*/
|
|
77
|
+
declare function Accordion({ allowMultiple, value, defaultValue, onValueChange, children, ...rest }: AccordionProps): react.JSX.Element;
|
|
39
78
|
interface AccordionItemProps extends Omit<HTMLAttributes<HTMLDetailsElement>, 'title'> {
|
|
40
79
|
summary: ReactNode;
|
|
80
|
+
/** Stable value identifying this item; defaults to its index. */
|
|
81
|
+
value?: string;
|
|
41
82
|
defaultOpen?: boolean;
|
|
42
83
|
}
|
|
43
|
-
declare function AccordionItem({ summary, defaultOpen, children, ...rest }: AccordionItemProps): react.JSX.Element;
|
|
84
|
+
declare function AccordionItem({ summary, value, defaultOpen, children, ...rest }: AccordionItemProps): react.JSX.Element;
|
|
44
85
|
|
|
45
86
|
interface DisclosureProps extends Omit<HTMLAttributes<HTMLDetailsElement>, 'title'> {
|
|
46
87
|
summary: ReactNode;
|
|
@@ -52,48 +93,65 @@ interface DisclosureProps extends Omit<HTMLAttributes<HTMLDetailsElement>, 'titl
|
|
|
52
93
|
* `useEnhancer(enhanceDisclosure)` on a wrapper if you need a mutually
|
|
53
94
|
* exclusive group.
|
|
54
95
|
*/
|
|
55
|
-
declare function Disclosure({ summary, defaultOpen, children, ...rest }: DisclosureProps): react.JSX.Element;
|
|
96
|
+
declare function Disclosure({ summary, defaultOpen, className, children, ...rest }: DisclosureProps): react.JSX.Element;
|
|
56
97
|
|
|
57
98
|
interface TabsProps extends HTMLAttributes<HTMLDivElement> {
|
|
58
99
|
/** `manual` (default): arrows move focus, Enter/Space activates. `automatic`: arrows activate immediately. */
|
|
59
100
|
activation?: EnhanceTabsOptions['activation'];
|
|
60
101
|
orientation?: EnhanceTabsOptions['orientation'];
|
|
102
|
+
/** Controlled value of the selected tab (pair with `onValueChange`). */
|
|
103
|
+
value?: string;
|
|
104
|
+
/** Initial value for uncontrolled usage. */
|
|
105
|
+
defaultValue?: string;
|
|
106
|
+
/** Called with the new tab value after every selection change. */
|
|
107
|
+
onValueChange?: (value: string) => void;
|
|
61
108
|
}
|
|
62
109
|
/**
|
|
63
110
|
* Tabbed interface root. Compose with `<TabList>`, `<Tab>`, and `<TabPanel>`.
|
|
64
111
|
* The enhancer wires ARIA roles, roving tabindex, and arrow-key navigation
|
|
65
|
-
* once the markup is mounted.
|
|
112
|
+
* once the markup is mounted. Tab values come from each `<Tab value>`,
|
|
113
|
+
* defaulting to the index; selection works uncontrolled (`defaultValue`) or
|
|
114
|
+
* controlled (`value` + `onValueChange`).
|
|
66
115
|
*
|
|
67
116
|
* ```tsx
|
|
68
|
-
* <Tabs>
|
|
117
|
+
* <Tabs value={tab} onValueChange={setTab}>
|
|
69
118
|
* <TabList>
|
|
70
|
-
* <Tab>Overview</Tab>
|
|
71
|
-
* <Tab>Install</Tab>
|
|
119
|
+
* <Tab value="overview">Overview</Tab>
|
|
120
|
+
* <Tab value="install">Install</Tab>
|
|
72
121
|
* </TabList>
|
|
73
122
|
* <TabPanel>Zero runtime by default.</TabPanel>
|
|
74
123
|
* <TabPanel>npm install hydrateless</TabPanel>
|
|
75
124
|
* </Tabs>
|
|
76
125
|
* ```
|
|
77
126
|
*/
|
|
78
|
-
declare function Tabs({ activation, orientation, children, ...rest }: TabsProps): react.JSX.Element;
|
|
127
|
+
declare function Tabs({ activation, orientation, value, defaultValue, onValueChange, children, ...rest }: TabsProps): react.JSX.Element;
|
|
79
128
|
type TabListProps = HTMLAttributes<HTMLDivElement>;
|
|
80
129
|
/** The row of tab triggers. Renders `role="tablist"`. */
|
|
81
130
|
declare function TabList({ children, ...rest }: TabListProps): react.JSX.Element;
|
|
82
|
-
|
|
131
|
+
interface TabProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
132
|
+
/** Stable value identifying this tab; defaults to its index. */
|
|
133
|
+
value?: string;
|
|
134
|
+
}
|
|
83
135
|
/** A single tab trigger. Renders `role="tab"`. */
|
|
84
|
-
declare function Tab({ children, type, ...rest }: TabProps): react.JSX.Element;
|
|
136
|
+
declare function Tab({ children, type, value, ...rest }: TabProps): react.JSX.Element;
|
|
85
137
|
type TabPanelProps = HTMLAttributes<HTMLDivElement>;
|
|
86
138
|
/** Content for the matching tab. Renders `role="tabpanel"`. */
|
|
87
139
|
declare function TabPanel({ children, ...rest }: TabPanelProps): react.JSX.Element;
|
|
88
140
|
|
|
89
141
|
interface DropdownProps extends HTMLAttributes<HTMLDivElement> {
|
|
90
142
|
placement?: EnhanceDropdownOptions['placement'];
|
|
143
|
+
/** Controlled open state (pair with `onOpenChange`). */
|
|
144
|
+
open?: boolean;
|
|
145
|
+
/** Open the menu initially for uncontrolled usage. */
|
|
146
|
+
defaultOpen?: boolean;
|
|
147
|
+
/** Called after the menu opens or closes. */
|
|
148
|
+
onOpenChange?: (open: boolean) => void;
|
|
91
149
|
}
|
|
92
150
|
/**
|
|
93
151
|
* Button-triggered menu following the WAI-ARIA menu-button pattern. Compose with
|
|
94
152
|
* `<DropdownTrigger>`, `<DropdownMenu>`, `<DropdownItem>`, and
|
|
95
153
|
* `<DropdownSeparator>`. The enhancer adds keyboard navigation, typeahead, and
|
|
96
|
-
* `aria-expanded`/`role` wiring.
|
|
154
|
+
* `aria-expanded`/`role` wiring; open state works uncontrolled or controlled.
|
|
97
155
|
*
|
|
98
156
|
* ```tsx
|
|
99
157
|
* <Dropdown>
|
|
@@ -106,7 +164,7 @@ interface DropdownProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
106
164
|
* </Dropdown>
|
|
107
165
|
* ```
|
|
108
166
|
*/
|
|
109
|
-
declare function Dropdown({ placement, children, ...rest }: DropdownProps): react.JSX.Element;
|
|
167
|
+
declare function Dropdown({ placement, open, defaultOpen, onOpenChange, children, ...rest }: DropdownProps): react.JSX.Element;
|
|
110
168
|
type DropdownTriggerProps = ButtonHTMLAttributes<HTMLButtonElement>;
|
|
111
169
|
/** The button that opens the menu. */
|
|
112
170
|
declare function DropdownTrigger({ children, type, ...rest }: DropdownTriggerProps): react.JSX.Element;
|
|
@@ -155,26 +213,28 @@ interface MenuItemProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'h
|
|
|
155
213
|
*/
|
|
156
214
|
declare function MenuItem({ href, onSelect, onClick, submenu, anchorProps, children, ...rest }: MenuItemProps): react.JSX.Element;
|
|
157
215
|
|
|
158
|
-
interface ModalProps extends Omit<HTMLAttributes<HTMLDialogElement>, 'title'
|
|
216
|
+
interface ModalProps extends Omit<HTMLAttributes<HTMLDialogElement>, 'title'> {
|
|
159
217
|
open: boolean;
|
|
160
|
-
|
|
218
|
+
/** Called after the dialog opens or closes (Escape, backdrop, close buttons). */
|
|
219
|
+
onOpenChange?: (open: boolean) => void;
|
|
161
220
|
closeOnBackdrop?: boolean;
|
|
162
221
|
}
|
|
163
222
|
/**
|
|
164
223
|
* Controlled dialog overlay. Driven by the `open` prop via the native
|
|
165
|
-
* `<dialog>` element
|
|
166
|
-
*
|
|
167
|
-
*
|
|
224
|
+
* `<dialog>` element and the modal enhancer, which adds a focus trap, body
|
|
225
|
+
* scroll-lock, and a background `inert` barrier. Compose with `<ModalHeader>`,
|
|
226
|
+
* `<ModalBody>`, and `<ModalFooter>`. Wire `onOpenChange` so Escape and
|
|
227
|
+
* backdrop clicks can update your state.
|
|
168
228
|
*
|
|
169
229
|
* ```tsx
|
|
170
|
-
* <Modal open={open}
|
|
230
|
+
* <Modal open={open} onOpenChange={setOpen}>
|
|
171
231
|
* <ModalHeader>Confirm</ModalHeader>
|
|
172
232
|
* <ModalBody>Are you sure?</ModalBody>
|
|
173
|
-
* <ModalFooter><Button onClick={
|
|
233
|
+
* <ModalFooter><Button onClick={() => setOpen(false)}>Close</Button></ModalFooter>
|
|
174
234
|
* </Modal>
|
|
175
235
|
* ```
|
|
176
236
|
*/
|
|
177
|
-
declare function Modal({ open,
|
|
237
|
+
declare function Modal({ open, onOpenChange, closeOnBackdrop, className, children, ...rest }: ModalProps): react.JSX.Element;
|
|
178
238
|
type ModalSectionProps = HTMLAttributes<HTMLDivElement>;
|
|
179
239
|
/** Modal heading region; its content labels the dialog for assistive tech. */
|
|
180
240
|
declare function ModalHeader({ className, ...rest }: ModalSectionProps): react.JSX.Element;
|
|
@@ -183,18 +243,20 @@ declare function ModalBody({ className, ...rest }: ModalSectionProps): react.JSX
|
|
|
183
243
|
/** Modal actions region. */
|
|
184
244
|
declare function ModalFooter({ className, ...rest }: ModalSectionProps): react.JSX.Element;
|
|
185
245
|
|
|
186
|
-
interface DrawerProps extends Omit<HTMLAttributes<HTMLDialogElement>, 'title'
|
|
246
|
+
interface DrawerProps extends Omit<HTMLAttributes<HTMLDialogElement>, 'title'> {
|
|
187
247
|
open: boolean;
|
|
188
|
-
|
|
248
|
+
/** Called after the drawer opens or closes (Escape, backdrop, close buttons). */
|
|
249
|
+
onOpenChange?: (open: boolean) => void;
|
|
189
250
|
side?: 'left' | 'right';
|
|
190
251
|
closeOnBackdrop?: boolean;
|
|
191
252
|
}
|
|
192
253
|
/**
|
|
193
|
-
* Controlled off-canvas panel built on the native `<dialog>` element
|
|
254
|
+
* Controlled off-canvas panel built on the native `<dialog>` element and the
|
|
255
|
+
* drawer enhancer (focus trap, scroll-lock, background `inert`). Mirrors
|
|
194
256
|
* {@link Modal} but slides in from the chosen `side`. Compose with
|
|
195
257
|
* `<DrawerHeader>`, `<DrawerBody>`, and `<DrawerFooter>`.
|
|
196
258
|
*/
|
|
197
|
-
declare function Drawer({ open,
|
|
259
|
+
declare function Drawer({ open, onOpenChange, side, closeOnBackdrop, className, children, ...rest }: DrawerProps): react.JSX.Element;
|
|
198
260
|
type DrawerSectionProps = HTMLAttributes<HTMLDivElement>;
|
|
199
261
|
/** Drawer heading region. */
|
|
200
262
|
declare function DrawerHeader({ className, ...rest }: DrawerSectionProps): react.JSX.Element;
|
|
@@ -205,14 +267,17 @@ declare function DrawerFooter({ className, ...rest }: DrawerSectionProps): react
|
|
|
205
267
|
|
|
206
268
|
interface PopoverProps extends HTMLAttributes<HTMLDivElement> {
|
|
207
269
|
open: boolean;
|
|
270
|
+
/** Called when Escape or an outside click requests dismissal. */
|
|
271
|
+
onOpenChange?: (open: boolean) => void;
|
|
208
272
|
children?: ReactNode;
|
|
209
273
|
}
|
|
210
274
|
/**
|
|
211
|
-
* Controlled floating content. Visibility follows the `open` prop
|
|
212
|
-
*
|
|
275
|
+
* Controlled floating content. Visibility follows the `open` prop; wire
|
|
276
|
+
* `onOpenChange` to let Escape and outside clicks request dismissal. Pair it
|
|
277
|
+
* with your own trigger button (toggling `open`) and position it with the
|
|
213
278
|
* `hydrateless/popover.css` styles.
|
|
214
279
|
*/
|
|
215
|
-
declare function Popover({ open, children, ...rest }: PopoverProps): react.JSX.Element;
|
|
280
|
+
declare function Popover({ open, onOpenChange, children, ...rest }: PopoverProps): react.JSX.Element;
|
|
216
281
|
|
|
217
282
|
interface TooltipProps {
|
|
218
283
|
/** The hint text shown on hover/focus. */
|
|
@@ -273,30 +338,38 @@ interface TocProps extends HTMLAttributes<HTMLElement> {
|
|
|
273
338
|
/** Auto-generated table of contents with optional scroll-spy. */
|
|
274
339
|
declare function Toc({ contentSelector, headings, scrollSpy, ...rest }: TocProps): react.JSX.Element;
|
|
275
340
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
341
|
+
type ToastRegionProps = HTMLAttributes<HTMLDivElement>;
|
|
342
|
+
/**
|
|
343
|
+
* The polite live region toasts render into. Render once near the root of
|
|
344
|
+
* your app to control where toasts appear; if omitted, the first `show()`
|
|
345
|
+
* call creates a region at the end of `<body>`.
|
|
346
|
+
*/
|
|
347
|
+
declare function ToastRegion(props: ToastRegionProps): react.JSX.Element;
|
|
279
348
|
/**
|
|
280
|
-
*
|
|
281
|
-
* {@link
|
|
349
|
+
* Access the imperative toast API (`show`/`dismiss`). Works with or without a
|
|
350
|
+
* mounted {@link ToastRegion}.
|
|
282
351
|
*/
|
|
283
|
-
declare function ToastProvider({ children }: ToastProviderProps): react.JSX.Element;
|
|
284
|
-
/** Access the toast API. Must be called within a {@link ToastProvider}. */
|
|
285
352
|
declare function useToast(): ToastApi;
|
|
286
353
|
|
|
287
354
|
interface ComboboxProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
|
288
355
|
filter?: EnhanceComboboxOptions['filter'];
|
|
289
356
|
autoHighlight?: EnhanceComboboxOptions['autoHighlight'];
|
|
357
|
+
/** Controlled committed value (pair with `onValueChange`). */
|
|
358
|
+
value?: string;
|
|
359
|
+
/** Initial committed value for uncontrolled usage. */
|
|
360
|
+
defaultValue?: string;
|
|
290
361
|
/** Fires with the committed value when an option is selected. */
|
|
291
362
|
onValueChange?: (value: string) => void;
|
|
292
363
|
}
|
|
293
364
|
/**
|
|
294
365
|
* Editable combobox (input + listbox) implementing the APG pattern. Compose with
|
|
295
366
|
* `<ComboboxInput>`, `<ComboboxList>`, and `<ComboboxOption>`. The enhancer adds
|
|
296
|
-
* filtering, `aria-activedescendant` navigation, and selection
|
|
367
|
+
* filtering, `aria-activedescendant` navigation, and selection; the committed
|
|
368
|
+
* value works uncontrolled (`defaultValue`) or controlled (`value` +
|
|
369
|
+
* `onValueChange`).
|
|
297
370
|
*
|
|
298
371
|
* ```tsx
|
|
299
|
-
* <Combobox onValueChange={
|
|
372
|
+
* <Combobox value={fruit} onValueChange={setFruit}>
|
|
300
373
|
* <ComboboxInput placeholder="Search…" />
|
|
301
374
|
* <ComboboxList>
|
|
302
375
|
* <ComboboxOption value="apple">Apple</ComboboxOption>
|
|
@@ -305,7 +378,7 @@ interface ComboboxProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'>
|
|
|
305
378
|
* </Combobox>
|
|
306
379
|
* ```
|
|
307
380
|
*/
|
|
308
|
-
declare function Combobox({ filter, autoHighlight, onValueChange, children, ...rest }: ComboboxProps): react.JSX.Element;
|
|
381
|
+
declare function Combobox({ filter, autoHighlight, value, defaultValue, onValueChange, children, ...rest }: ComboboxProps): react.JSX.Element;
|
|
309
382
|
interface ComboboxInputProps extends InputHTMLAttributes<HTMLInputElement> {
|
|
310
383
|
/** Apply the `hl-input` style. Defaults to `true`. */
|
|
311
384
|
styled?: boolean;
|
|
@@ -586,4 +659,4 @@ declare const Separator: react.ForwardRefExoticComponent<SeparatorProps & react.
|
|
|
586
659
|
/** Join truthy class names into a single string. */
|
|
587
660
|
declare function cx(...classes: Array<string | false | null | undefined>): string;
|
|
588
661
|
|
|
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,
|
|
662
|
+
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, ToastRegion, type ToastRegionProps, Toc, type TocProps, Tooltip, type TooltipProps, cx, useAccordion, useDisclosureGroup, useDropdown, useEnhancer, useField, useModalGroup, useTabs, useToast, useTocEnhancer, useTooltip };
|
package/dist/index.js
CHANGED
|
@@ -2,12 +2,18 @@
|
|
|
2
2
|
import { useEffect, useRef } from "react";
|
|
3
3
|
function useEnhancer(enhance, deps = []) {
|
|
4
4
|
const ref = useRef(null);
|
|
5
|
+
const api = useRef(null);
|
|
5
6
|
useEffect(() => {
|
|
6
7
|
const el = ref.current;
|
|
7
8
|
if (!el) return;
|
|
8
|
-
|
|
9
|
+
const handle = enhance(el);
|
|
10
|
+
api.current = handle.api;
|
|
11
|
+
return () => {
|
|
12
|
+
api.current = null;
|
|
13
|
+
handle.destroy();
|
|
14
|
+
};
|
|
9
15
|
}, deps);
|
|
10
|
-
return ref;
|
|
16
|
+
return { ref, api };
|
|
11
17
|
}
|
|
12
18
|
|
|
13
19
|
// src/hooks.ts
|
|
@@ -32,64 +38,116 @@ var useTocEnhancer = (options) => useEnhancer(
|
|
|
32
38
|
);
|
|
33
39
|
|
|
34
40
|
// src/Accordion.tsx
|
|
35
|
-
import { useEffect as useEffect2, useRef as
|
|
41
|
+
import { useEffect as useEffect2, useRef as useRef3 } from "react";
|
|
36
42
|
import { enhanceAccordion as enhanceAccordion2 } from "@hydrateless/enhancers";
|
|
43
|
+
|
|
44
|
+
// src/util.ts
|
|
45
|
+
import { useRef as useRef2 } from "react";
|
|
46
|
+
function cx(...classes) {
|
|
47
|
+
return classes.filter(Boolean).join(" ");
|
|
48
|
+
}
|
|
49
|
+
function useLatest(value) {
|
|
50
|
+
const ref = useRef2(value);
|
|
51
|
+
ref.current = value;
|
|
52
|
+
return ref;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// src/Accordion.tsx
|
|
37
56
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
38
|
-
function Accordion({
|
|
39
|
-
|
|
57
|
+
function Accordion({
|
|
58
|
+
allowMultiple = false,
|
|
59
|
+
value,
|
|
60
|
+
defaultValue,
|
|
61
|
+
onValueChange,
|
|
62
|
+
children,
|
|
63
|
+
...rest
|
|
64
|
+
}) {
|
|
65
|
+
const onValueChangeRef = useLatest(onValueChange);
|
|
66
|
+
const initialValueRef = useLatest(value ?? defaultValue);
|
|
67
|
+
const { ref, api } = useEnhancer(
|
|
68
|
+
(el) => enhanceAccordion2(el, {
|
|
69
|
+
allowMultiple,
|
|
70
|
+
defaultValue: initialValueRef.current,
|
|
71
|
+
onValueChange: (next) => onValueChangeRef.current?.(next)
|
|
72
|
+
}),
|
|
73
|
+
[allowMultiple]
|
|
74
|
+
);
|
|
40
75
|
useEffect2(() => {
|
|
41
|
-
if (
|
|
42
|
-
|
|
43
|
-
}, [allowMultiple]);
|
|
76
|
+
if (value != null) api.current?.setValue(value);
|
|
77
|
+
}, [value, api]);
|
|
44
78
|
return /* @__PURE__ */ jsx("div", { ...rest, "data-hl-accordion": true, ref, children });
|
|
45
79
|
}
|
|
46
80
|
function AccordionItem({
|
|
47
81
|
summary,
|
|
82
|
+
value,
|
|
48
83
|
defaultOpen = false,
|
|
49
84
|
children,
|
|
50
85
|
...rest
|
|
51
86
|
}) {
|
|
52
|
-
const ref =
|
|
87
|
+
const ref = useRef3(null);
|
|
53
88
|
useEffect2(() => {
|
|
54
89
|
if (ref.current && defaultOpen) ref.current.open = true;
|
|
55
90
|
}, [defaultOpen]);
|
|
56
|
-
return /* @__PURE__ */ jsxs("details", { ...rest, ref, children: [
|
|
91
|
+
return /* @__PURE__ */ jsxs("details", { ...rest, "data-hl-value": value, ref, children: [
|
|
57
92
|
/* @__PURE__ */ jsx("summary", { children: summary }),
|
|
58
|
-
/* @__PURE__ */ jsx("div", { className: "accordion-panel", children })
|
|
93
|
+
/* @__PURE__ */ jsx("div", { className: "hl-accordion-panel", children })
|
|
59
94
|
] });
|
|
60
95
|
}
|
|
61
96
|
|
|
62
97
|
// src/Disclosure.tsx
|
|
63
|
-
import { useEffect as useEffect3, useRef as
|
|
98
|
+
import { useEffect as useEffect3, useRef as useRef4 } from "react";
|
|
64
99
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
65
|
-
function Disclosure({
|
|
66
|
-
|
|
100
|
+
function Disclosure({
|
|
101
|
+
summary,
|
|
102
|
+
defaultOpen = false,
|
|
103
|
+
className,
|
|
104
|
+
children,
|
|
105
|
+
...rest
|
|
106
|
+
}) {
|
|
107
|
+
const ref = useRef4(null);
|
|
67
108
|
useEffect3(() => {
|
|
68
109
|
if (ref.current && defaultOpen) ref.current.open = true;
|
|
69
110
|
}, [defaultOpen]);
|
|
70
|
-
return /* @__PURE__ */ jsxs2("details", { ...rest, className: "
|
|
111
|
+
return /* @__PURE__ */ jsxs2("details", { ...rest, className: cx("hl-disclosure", className), "data-hl-disclosure": true, ref, children: [
|
|
71
112
|
/* @__PURE__ */ jsx2("summary", { children: summary }),
|
|
72
|
-
/* @__PURE__ */ jsx2("div", { className: "disclosure-panel", children })
|
|
113
|
+
/* @__PURE__ */ jsx2("div", { className: "hl-disclosure-panel", children })
|
|
73
114
|
] });
|
|
74
115
|
}
|
|
75
116
|
|
|
76
117
|
// src/Tabs.tsx
|
|
77
|
-
import { useEffect as useEffect4
|
|
118
|
+
import { useEffect as useEffect4 } from "react";
|
|
78
119
|
import { enhanceTabs as enhanceTabs2 } from "@hydrateless/enhancers";
|
|
79
120
|
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
80
|
-
function Tabs({
|
|
81
|
-
|
|
121
|
+
function Tabs({
|
|
122
|
+
activation,
|
|
123
|
+
orientation,
|
|
124
|
+
value,
|
|
125
|
+
defaultValue,
|
|
126
|
+
onValueChange,
|
|
127
|
+
children,
|
|
128
|
+
...rest
|
|
129
|
+
}) {
|
|
130
|
+
const onValueChangeRef = useLatest(onValueChange);
|
|
131
|
+
const initialValueRef = useLatest(value ?? defaultValue);
|
|
132
|
+
const { ref, api } = useEnhancer(
|
|
133
|
+
(el) => enhanceTabs2(el, {
|
|
134
|
+
activation,
|
|
135
|
+
orientation,
|
|
136
|
+
defaultValue: initialValueRef.current,
|
|
137
|
+
onValueChange: (next) => onValueChangeRef.current?.(next)
|
|
138
|
+
}),
|
|
139
|
+
[activation, orientation]
|
|
140
|
+
);
|
|
82
141
|
useEffect4(() => {
|
|
83
|
-
if (
|
|
84
|
-
|
|
85
|
-
}, [activation, orientation]);
|
|
142
|
+
if (value != null) api.current?.setValue(value);
|
|
143
|
+
}, [value, api]);
|
|
86
144
|
return /* @__PURE__ */ jsx3("div", { ...rest, "data-hl-tabs": true, ref, children });
|
|
87
145
|
}
|
|
88
146
|
function TabList({ children, ...rest }) {
|
|
89
147
|
return /* @__PURE__ */ jsx3("div", { ...rest, role: "tablist", children });
|
|
90
148
|
}
|
|
91
|
-
function Tab({ children, type, ...rest }) {
|
|
92
|
-
return /* @__PURE__ */ jsx3("button", { ...rest, type: type ?? "button", role: "tab", children });
|
|
149
|
+
function Tab({ children, type, value, ...rest }) {
|
|
150
|
+
return /* @__PURE__ */ jsx3("button", { ...rest, type: type ?? "button", role: "tab", "data-hl-value": value, children });
|
|
93
151
|
}
|
|
94
152
|
function TabPanel({ children, ...rest }) {
|
|
95
153
|
return /* @__PURE__ */ jsx3("div", { ...rest, role: "tabpanel", children });
|
|
@@ -97,17 +155,33 @@ function TabPanel({ children, ...rest }) {
|
|
|
97
155
|
|
|
98
156
|
// src/Dropdown.tsx
|
|
99
157
|
import {
|
|
100
|
-
useEffect as useEffect5
|
|
101
|
-
useRef as useRef5
|
|
158
|
+
useEffect as useEffect5
|
|
102
159
|
} from "react";
|
|
103
|
-
import {
|
|
160
|
+
import {
|
|
161
|
+
enhanceDropdown as enhanceDropdown2
|
|
162
|
+
} from "@hydrateless/enhancers";
|
|
104
163
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
105
|
-
function Dropdown({
|
|
106
|
-
|
|
164
|
+
function Dropdown({
|
|
165
|
+
placement,
|
|
166
|
+
open,
|
|
167
|
+
defaultOpen,
|
|
168
|
+
onOpenChange,
|
|
169
|
+
children,
|
|
170
|
+
...rest
|
|
171
|
+
}) {
|
|
172
|
+
const onOpenChangeRef = useLatest(onOpenChange);
|
|
173
|
+
const initialOpenRef = useLatest(open ?? defaultOpen);
|
|
174
|
+
const { ref, api } = useEnhancer(
|
|
175
|
+
(el) => enhanceDropdown2(el, {
|
|
176
|
+
placement,
|
|
177
|
+
defaultOpen: initialOpenRef.current,
|
|
178
|
+
onOpenChange: (next) => onOpenChangeRef.current?.(next)
|
|
179
|
+
}),
|
|
180
|
+
[placement]
|
|
181
|
+
);
|
|
107
182
|
useEffect5(() => {
|
|
108
|
-
if (
|
|
109
|
-
|
|
110
|
-
}, [placement]);
|
|
183
|
+
if (open != null) api.current?.setOpen(open);
|
|
184
|
+
}, [open, api]);
|
|
111
185
|
return /* @__PURE__ */ jsx4("div", { ...rest, "data-hl-dropdown": true, ref, children });
|
|
112
186
|
}
|
|
113
187
|
function DropdownTrigger({ children, type, ...rest }) {
|
|
@@ -138,15 +212,15 @@ function DropdownSeparator(props) {
|
|
|
138
212
|
// src/Menu.tsx
|
|
139
213
|
import {
|
|
140
214
|
useEffect as useEffect6,
|
|
141
|
-
useRef as
|
|
215
|
+
useRef as useRef5
|
|
142
216
|
} from "react";
|
|
143
217
|
import { enhanceMenu } from "@hydrateless/enhancers";
|
|
144
218
|
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
145
219
|
function Menu({ orientation = "horizontal", children, ...rest }) {
|
|
146
|
-
const ref =
|
|
220
|
+
const ref = useRef5(null);
|
|
147
221
|
useEffect6(() => {
|
|
148
222
|
if (!ref.current) return;
|
|
149
|
-
return enhanceMenu(ref.current, { orientation });
|
|
223
|
+
return enhanceMenu(ref.current, { orientation }).destroy;
|
|
150
224
|
}, [orientation]);
|
|
151
225
|
return /* @__PURE__ */ jsx5(
|
|
152
226
|
"ul",
|
|
@@ -189,50 +263,29 @@ function MenuItem({
|
|
|
189
263
|
}
|
|
190
264
|
|
|
191
265
|
// src/Modal.tsx
|
|
192
|
-
import { useEffect as useEffect7
|
|
193
|
-
|
|
194
|
-
// src/util.ts
|
|
195
|
-
function cx(...classes) {
|
|
196
|
-
return classes.filter(Boolean).join(" ");
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
// src/Modal.tsx
|
|
266
|
+
import { useEffect as useEffect7 } from "react";
|
|
267
|
+
import { enhanceModal as enhanceModal2 } from "@hydrateless/enhancers";
|
|
200
268
|
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
201
269
|
function Modal({
|
|
202
270
|
open,
|
|
203
|
-
|
|
271
|
+
onOpenChange,
|
|
204
272
|
closeOnBackdrop = true,
|
|
205
273
|
className,
|
|
206
274
|
children,
|
|
207
275
|
...rest
|
|
208
276
|
}) {
|
|
209
|
-
const
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
useEffect7(() => {
|
|
217
|
-
const dialog = ref.current;
|
|
218
|
-
if (!dialog) return;
|
|
219
|
-
const handleClose = () => onClose?.();
|
|
220
|
-
dialog.addEventListener("close", handleClose);
|
|
221
|
-
return () => dialog.removeEventListener("close", handleClose);
|
|
222
|
-
}, [onClose]);
|
|
223
|
-
const handleClick = (e) => {
|
|
224
|
-
if (closeOnBackdrop && e.target === ref.current) onClose?.();
|
|
225
|
-
};
|
|
226
|
-
return /* @__PURE__ */ jsx6(
|
|
227
|
-
"dialog",
|
|
228
|
-
{
|
|
229
|
-
...rest,
|
|
230
|
-
ref,
|
|
231
|
-
className: cx("hydrateless-modal", className),
|
|
232
|
-
onClick: handleClick,
|
|
233
|
-
children
|
|
234
|
-
}
|
|
277
|
+
const onOpenChangeRef = useLatest(onOpenChange);
|
|
278
|
+
const { ref, api } = useEnhancer(
|
|
279
|
+
(el) => enhanceModal2(el, {
|
|
280
|
+
closeOnBackdrop,
|
|
281
|
+
onOpenChange: (next) => onOpenChangeRef.current?.(next)
|
|
282
|
+
}),
|
|
283
|
+
[closeOnBackdrop]
|
|
235
284
|
);
|
|
285
|
+
useEffect7(() => {
|
|
286
|
+
api.current?.setOpen(open);
|
|
287
|
+
}, [open, api]);
|
|
288
|
+
return /* @__PURE__ */ jsx6("dialog", { ...rest, ref, "data-hl-modal": true, className: cx("hl-modal", className), children });
|
|
236
289
|
}
|
|
237
290
|
function ModalHeader({ className, ...rest }) {
|
|
238
291
|
return /* @__PURE__ */ jsx6("div", { ...rest, className: cx("hl-modal-header", className) });
|
|
@@ -245,42 +298,37 @@ function ModalFooter({ className, ...rest }) {
|
|
|
245
298
|
}
|
|
246
299
|
|
|
247
300
|
// src/Drawer.tsx
|
|
248
|
-
import { useEffect as useEffect8
|
|
301
|
+
import { useEffect as useEffect8 } from "react";
|
|
302
|
+
import { enhanceDrawer } from "@hydrateless/enhancers";
|
|
249
303
|
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
250
304
|
function Drawer({
|
|
251
305
|
open,
|
|
252
|
-
|
|
306
|
+
onOpenChange,
|
|
253
307
|
side = "right",
|
|
254
308
|
closeOnBackdrop = true,
|
|
255
309
|
className,
|
|
256
310
|
children,
|
|
257
311
|
...rest
|
|
258
312
|
}) {
|
|
259
|
-
const
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
313
|
+
const onOpenChangeRef = useLatest(onOpenChange);
|
|
314
|
+
const { ref, api } = useEnhancer(
|
|
315
|
+
(el) => enhanceDrawer(el, {
|
|
316
|
+
closeOnBackdrop,
|
|
317
|
+
onOpenChange: (next) => onOpenChangeRef.current?.(next)
|
|
318
|
+
}),
|
|
319
|
+
[closeOnBackdrop]
|
|
320
|
+
);
|
|
266
321
|
useEffect8(() => {
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
const handleClose = () => onClose?.();
|
|
270
|
-
dialog.addEventListener("close", handleClose);
|
|
271
|
-
return () => dialog.removeEventListener("close", handleClose);
|
|
272
|
-
}, [onClose]);
|
|
273
|
-
const handleClick = (e) => {
|
|
274
|
-
if (closeOnBackdrop && e.target === ref.current) onClose?.();
|
|
275
|
-
};
|
|
322
|
+
api.current?.setOpen(open);
|
|
323
|
+
}, [open, api]);
|
|
276
324
|
return /* @__PURE__ */ jsx7(
|
|
277
325
|
"dialog",
|
|
278
326
|
{
|
|
279
327
|
...rest,
|
|
280
328
|
ref,
|
|
329
|
+
"data-hl-drawer": true,
|
|
281
330
|
"data-side": side,
|
|
282
|
-
className: cx("
|
|
283
|
-
onClick: handleClick,
|
|
331
|
+
className: cx("hl-drawer", className),
|
|
284
332
|
children
|
|
285
333
|
}
|
|
286
334
|
);
|
|
@@ -296,28 +344,38 @@ function DrawerFooter({ className, ...rest }) {
|
|
|
296
344
|
}
|
|
297
345
|
|
|
298
346
|
// src/Popover.tsx
|
|
347
|
+
import { useEffect as useEffect9, useRef as useRef6 } from "react";
|
|
348
|
+
import { onClickOutside, onEscape, combine } from "@hydrateless/enhancers";
|
|
299
349
|
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
300
|
-
function Popover({ open, children, ...rest }) {
|
|
301
|
-
|
|
350
|
+
function Popover({ open, onOpenChange, children, ...rest }) {
|
|
351
|
+
const ref = useRef6(null);
|
|
352
|
+
const onOpenChangeRef = useLatest(onOpenChange);
|
|
353
|
+
useEffect9(() => {
|
|
354
|
+
const el = ref.current;
|
|
355
|
+
if (!el || !open) return;
|
|
356
|
+
const dismiss = () => onOpenChangeRef.current?.(false);
|
|
357
|
+
return combine([onClickOutside(el, dismiss), onEscape(dismiss, el.ownerDocument)]);
|
|
358
|
+
}, [open, onOpenChangeRef]);
|
|
359
|
+
return /* @__PURE__ */ jsx8("div", { ...rest, ref, "data-hl-popover": true, role: "dialog", hidden: !open, children });
|
|
302
360
|
}
|
|
303
361
|
|
|
304
362
|
// src/Tooltip.tsx
|
|
305
363
|
import {
|
|
306
364
|
cloneElement,
|
|
307
365
|
isValidElement,
|
|
308
|
-
useEffect as
|
|
366
|
+
useEffect as useEffect10,
|
|
309
367
|
useId,
|
|
310
|
-
useRef as
|
|
368
|
+
useRef as useRef7
|
|
311
369
|
} from "react";
|
|
312
370
|
import { enhanceTooltip as enhanceTooltip2 } from "@hydrateless/enhancers";
|
|
313
371
|
import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
314
372
|
function Tooltip({ label, children, id }) {
|
|
315
373
|
const generatedId = useId().replace(/:/g, "");
|
|
316
374
|
const tipId = id ?? `hl-tip-${generatedId}`;
|
|
317
|
-
const ref =
|
|
318
|
-
|
|
375
|
+
const ref = useRef7(null);
|
|
376
|
+
useEffect10(() => {
|
|
319
377
|
if (!ref.current) return;
|
|
320
|
-
return enhanceTooltip2(ref.current);
|
|
378
|
+
return enhanceTooltip2(ref.current).destroy;
|
|
321
379
|
}, [tipId]);
|
|
322
380
|
const trigger = isValidElement(children) ? cloneElement(children, {
|
|
323
381
|
"data-hl-tooltip": tipId,
|
|
@@ -356,86 +414,86 @@ function Switch({ children, className, ...rest }) {
|
|
|
356
414
|
// src/SkipLink.tsx
|
|
357
415
|
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
358
416
|
function SkipLink({ children = "Skip to content", className, ...rest }) {
|
|
359
|
-
return /* @__PURE__ */ jsx12("a", { ...rest, className:
|
|
417
|
+
return /* @__PURE__ */ jsx12("a", { ...rest, className: cx("hl-skip-link", className), children });
|
|
360
418
|
}
|
|
361
419
|
|
|
362
420
|
// src/Toc.tsx
|
|
363
|
-
import { useEffect as
|
|
421
|
+
import { useEffect as useEffect11, useRef as useRef8 } from "react";
|
|
364
422
|
import { enhanceToc as enhanceToc2 } from "@hydrateless/enhancers";
|
|
365
423
|
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
366
424
|
function Toc({ contentSelector, headings, scrollSpy, ...rest }) {
|
|
367
|
-
const ref =
|
|
368
|
-
|
|
425
|
+
const ref = useRef8(null);
|
|
426
|
+
useEffect11(() => {
|
|
369
427
|
if (!ref.current) return;
|
|
370
|
-
return enhanceToc2(ref.current.ownerDocument, { contentSelector, headings, scrollSpy });
|
|
428
|
+
return enhanceToc2(ref.current.ownerDocument, { contentSelector, headings, scrollSpy }).destroy;
|
|
371
429
|
}, [contentSelector, headings, scrollSpy]);
|
|
372
430
|
return /* @__PURE__ */ jsx13("nav", { ...rest, "data-hl-toc": true, ref });
|
|
373
431
|
}
|
|
374
432
|
|
|
375
433
|
// src/Toast.tsx
|
|
376
|
-
import {
|
|
434
|
+
import { useEffect as useEffect12, useRef as useRef9 } from "react";
|
|
377
435
|
import { enhanceToast } from "@hydrateless/enhancers";
|
|
378
|
-
import { jsx as jsx14
|
|
379
|
-
var
|
|
380
|
-
function
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
436
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
437
|
+
var sharedApi = null;
|
|
438
|
+
function ensureApi() {
|
|
439
|
+
if (!sharedApi) {
|
|
440
|
+
const handle = enhanceToast(document);
|
|
441
|
+
sharedApi = handle.api;
|
|
442
|
+
}
|
|
443
|
+
return sharedApi;
|
|
444
|
+
}
|
|
445
|
+
var facade = {
|
|
446
|
+
show: (message, options) => ensureApi().show(message, options),
|
|
447
|
+
dismiss: (toast) => ensureApi().dismiss(toast)
|
|
448
|
+
};
|
|
449
|
+
function ToastRegion(props) {
|
|
450
|
+
const ref = useRef9(null);
|
|
451
|
+
useEffect12(() => {
|
|
452
|
+
if (!ref.current) return;
|
|
453
|
+
const handle = enhanceToast(ref.current.ownerDocument);
|
|
454
|
+
sharedApi = handle.api;
|
|
393
455
|
return () => {
|
|
394
|
-
|
|
395
|
-
|
|
456
|
+
handle.destroy();
|
|
457
|
+
sharedApi = null;
|
|
396
458
|
};
|
|
397
459
|
}, []);
|
|
398
|
-
return /* @__PURE__ */
|
|
399
|
-
children,
|
|
400
|
-
/* @__PURE__ */ jsx14("div", { "data-hl-toast-region": true, ref: regionRef })
|
|
401
|
-
] });
|
|
460
|
+
return /* @__PURE__ */ jsx14("div", { ...props, "data-hl-toast-region": true, ref });
|
|
402
461
|
}
|
|
403
462
|
function useToast() {
|
|
404
|
-
|
|
405
|
-
if (!ctx) {
|
|
406
|
-
throw new Error("useToast must be used within a <ToastProvider>");
|
|
407
|
-
}
|
|
408
|
-
return ctx;
|
|
463
|
+
return facade;
|
|
409
464
|
}
|
|
410
465
|
|
|
411
466
|
// src/Combobox.tsx
|
|
412
467
|
import {
|
|
413
|
-
useEffect as
|
|
414
|
-
useRef as useRef12
|
|
468
|
+
useEffect as useEffect13
|
|
415
469
|
} from "react";
|
|
416
|
-
import {
|
|
470
|
+
import {
|
|
471
|
+
enhanceCombobox
|
|
472
|
+
} from "@hydrateless/enhancers";
|
|
417
473
|
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
418
474
|
function Combobox({
|
|
419
475
|
filter,
|
|
420
476
|
autoHighlight,
|
|
477
|
+
value,
|
|
478
|
+
defaultValue,
|
|
421
479
|
onValueChange,
|
|
422
480
|
children,
|
|
423
481
|
...rest
|
|
424
482
|
}) {
|
|
425
|
-
const
|
|
426
|
-
const
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
}, [
|
|
483
|
+
const onValueChangeRef = useLatest(onValueChange);
|
|
484
|
+
const initialValueRef = useLatest(value ?? defaultValue);
|
|
485
|
+
const { ref, api } = useEnhancer(
|
|
486
|
+
(el) => enhanceCombobox(el, {
|
|
487
|
+
filter,
|
|
488
|
+
autoHighlight,
|
|
489
|
+
defaultValue: initialValueRef.current,
|
|
490
|
+
onValueChange: (next) => onValueChangeRef.current?.(next)
|
|
491
|
+
}),
|
|
492
|
+
[filter, autoHighlight]
|
|
493
|
+
);
|
|
494
|
+
useEffect13(() => {
|
|
495
|
+
if (value != null) api.current?.setValue(value);
|
|
496
|
+
}, [value, api]);
|
|
439
497
|
return /* @__PURE__ */ jsx15("div", { ...rest, ref, "data-hl-combobox": true, children });
|
|
440
498
|
}
|
|
441
499
|
function ComboboxInput({ styled = true, className, ...rest }) {
|
|
@@ -450,28 +508,23 @@ function ComboboxOption({ value, children, ...rest }) {
|
|
|
450
508
|
|
|
451
509
|
// src/Command.tsx
|
|
452
510
|
import {
|
|
453
|
-
useEffect as
|
|
454
|
-
useRef as
|
|
511
|
+
useEffect as useEffect14,
|
|
512
|
+
useRef as useRef10
|
|
455
513
|
} from "react";
|
|
456
514
|
import { enhanceCommand } from "@hydrateless/enhancers";
|
|
457
|
-
import { jsx as jsx16, jsxs as
|
|
515
|
+
import { jsx as jsx16, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
458
516
|
function Command({ hotkey, onSelect, children, ...rest }) {
|
|
459
|
-
const ref =
|
|
460
|
-
const onSelectRef =
|
|
517
|
+
const ref = useRef10(null);
|
|
518
|
+
const onSelectRef = useRef10(onSelect);
|
|
461
519
|
onSelectRef.current = onSelect;
|
|
462
|
-
|
|
520
|
+
useEffect14(() => {
|
|
463
521
|
const el = ref.current;
|
|
464
522
|
if (!el) return;
|
|
465
|
-
const
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
el.addEventListener("hl:command", handler);
|
|
471
|
-
return () => {
|
|
472
|
-
el.removeEventListener("hl:command", handler);
|
|
473
|
-
dispose();
|
|
474
|
-
};
|
|
523
|
+
const handle = enhanceCommand(el, {
|
|
524
|
+
hotkey,
|
|
525
|
+
onCommand: (value) => onSelectRef.current?.(value)
|
|
526
|
+
});
|
|
527
|
+
return handle.destroy;
|
|
475
528
|
}, [hotkey]);
|
|
476
529
|
return /* @__PURE__ */ jsx16("div", { ...rest, ref, "data-hl-command": true, "data-hl-command-hotkey": hotkey, children });
|
|
477
530
|
}
|
|
@@ -482,13 +535,13 @@ function CommandList({ children, ...rest }) {
|
|
|
482
535
|
return /* @__PURE__ */ jsx16("div", { ...rest, "data-hl-command-list": true, role: "listbox", children });
|
|
483
536
|
}
|
|
484
537
|
function CommandGroup({ label, children, ...rest }) {
|
|
485
|
-
return /* @__PURE__ */
|
|
538
|
+
return /* @__PURE__ */ jsxs6("div", { ...rest, "data-hl-command-group": true, children: [
|
|
486
539
|
label != null && /* @__PURE__ */ jsx16("div", { className: "hl-command-group-label", role: "presentation", children: label }),
|
|
487
540
|
children
|
|
488
541
|
] });
|
|
489
542
|
}
|
|
490
543
|
function CommandItem({ value, keywords, icon, children, ...rest }) {
|
|
491
|
-
return /* @__PURE__ */
|
|
544
|
+
return /* @__PURE__ */ jsxs6("div", { ...rest, role: "option", "data-hl-value": value, "data-hl-keywords": keywords, children: [
|
|
492
545
|
icon,
|
|
493
546
|
/* @__PURE__ */ jsx16("span", { children })
|
|
494
547
|
] });
|
|
@@ -550,9 +603,9 @@ var Select = forwardRef3(function Select2({ size, invalid, options, className, c
|
|
|
550
603
|
|
|
551
604
|
// src/Checkbox.tsx
|
|
552
605
|
import { forwardRef as forwardRef4 } from "react";
|
|
553
|
-
import { jsx as jsx20, jsxs as
|
|
606
|
+
import { jsx as jsx20, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
554
607
|
var Checkbox = forwardRef4(function Checkbox2({ children, className, ...rest }, ref) {
|
|
555
|
-
return /* @__PURE__ */
|
|
608
|
+
return /* @__PURE__ */ jsxs7("label", { className: ["hl-checkbox", className].filter(Boolean).join(" "), children: [
|
|
556
609
|
/* @__PURE__ */ jsx20("input", { ...rest, ref, type: "checkbox" }),
|
|
557
610
|
children != null && /* @__PURE__ */ jsx20("span", { children })
|
|
558
611
|
] });
|
|
@@ -560,16 +613,16 @@ var Checkbox = forwardRef4(function Checkbox2({ children, className, ...rest },
|
|
|
560
613
|
|
|
561
614
|
// src/Radio.tsx
|
|
562
615
|
import {
|
|
563
|
-
createContext
|
|
616
|
+
createContext,
|
|
564
617
|
forwardRef as forwardRef5,
|
|
565
|
-
useContext
|
|
618
|
+
useContext
|
|
566
619
|
} from "react";
|
|
567
|
-
import { jsx as jsx21, jsxs as
|
|
568
|
-
var RadioGroupContext =
|
|
620
|
+
import { jsx as jsx21, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
621
|
+
var RadioGroupContext = createContext(null);
|
|
569
622
|
var Radio = forwardRef5(function Radio2({ children, className, value, ...rest }, ref) {
|
|
570
|
-
const group =
|
|
623
|
+
const group = useContext(RadioGroupContext);
|
|
571
624
|
const checked = group ? group.value === value : rest.checked;
|
|
572
|
-
return /* @__PURE__ */
|
|
625
|
+
return /* @__PURE__ */ jsxs8("label", { className: ["hl-radio", className].filter(Boolean).join(" "), children: [
|
|
573
626
|
/* @__PURE__ */ jsx21(
|
|
574
627
|
"input",
|
|
575
628
|
{
|
|
@@ -609,12 +662,12 @@ function RadioGroup({
|
|
|
609
662
|
|
|
610
663
|
// src/Field.tsx
|
|
611
664
|
import {
|
|
612
|
-
createContext as
|
|
613
|
-
useContext as
|
|
665
|
+
createContext as createContext2,
|
|
666
|
+
useContext as useContext2,
|
|
614
667
|
useId as useId2
|
|
615
668
|
} from "react";
|
|
616
|
-
import { jsx as jsx22, jsxs as
|
|
617
|
-
var FieldContext =
|
|
669
|
+
import { jsx as jsx22, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
670
|
+
var FieldContext = createContext2(null);
|
|
618
671
|
function Field({
|
|
619
672
|
id,
|
|
620
673
|
invalid = false,
|
|
@@ -645,7 +698,7 @@ function Field({
|
|
|
645
698
|
) });
|
|
646
699
|
}
|
|
647
700
|
function useFieldContext(component) {
|
|
648
|
-
const ctx =
|
|
701
|
+
const ctx = useContext2(FieldContext);
|
|
649
702
|
if (!ctx) throw new Error(`<${component}> must be used within a <Field>`);
|
|
650
703
|
return ctx;
|
|
651
704
|
}
|
|
@@ -690,7 +743,7 @@ function FieldError({ className, children, ...rest }) {
|
|
|
690
743
|
);
|
|
691
744
|
}
|
|
692
745
|
function Fieldset({ legend, className, children, ...rest }) {
|
|
693
|
-
return /* @__PURE__ */
|
|
746
|
+
return /* @__PURE__ */ jsxs9("fieldset", { ...rest, className: ["hl-fieldset", className].filter(Boolean).join(" "), children: [
|
|
694
747
|
legend != null && /* @__PURE__ */ jsx22("legend", { className: "hl-legend", children: legend }),
|
|
695
748
|
children
|
|
696
749
|
] });
|
|
@@ -698,7 +751,7 @@ function Fieldset({ legend, className, children, ...rest }) {
|
|
|
698
751
|
|
|
699
752
|
// src/SegmentedControl.tsx
|
|
700
753
|
import { useId as useId3, useState } from "react";
|
|
701
|
-
import { jsx as jsx23, jsxs as
|
|
754
|
+
import { jsx as jsx23, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
702
755
|
function SegmentedControl({
|
|
703
756
|
options,
|
|
704
757
|
value,
|
|
@@ -724,7 +777,7 @@ function SegmentedControl({
|
|
|
724
777
|
role: "radiogroup",
|
|
725
778
|
className: ["hl-segmented", className].filter(Boolean).join(" "),
|
|
726
779
|
"data-hl-size": size,
|
|
727
|
-
children: options.map((option) => /* @__PURE__ */
|
|
780
|
+
children: options.map((option) => /* @__PURE__ */ jsxs10("label", { className: "hl-segmented-item", children: [
|
|
728
781
|
/* @__PURE__ */ jsx23(
|
|
729
782
|
"input",
|
|
730
783
|
{
|
|
@@ -783,9 +836,9 @@ var Button = forwardRef7(function Button2({ variant, intent, size, block, icon,
|
|
|
783
836
|
|
|
784
837
|
// src/Alert.tsx
|
|
785
838
|
import { forwardRef as forwardRef8 } from "react";
|
|
786
|
-
import { jsx as jsx26, jsxs as
|
|
839
|
+
import { jsx as jsx26, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
787
840
|
var Alert = forwardRef8(function Alert2({ intent, title, icon, className, children, ...rest }, ref) {
|
|
788
|
-
return /* @__PURE__ */
|
|
841
|
+
return /* @__PURE__ */ jsxs11(
|
|
789
842
|
"div",
|
|
790
843
|
{
|
|
791
844
|
...rest,
|
|
@@ -795,7 +848,7 @@ var Alert = forwardRef8(function Alert2({ intent, title, icon, className, childr
|
|
|
795
848
|
"data-hl-intent": intent,
|
|
796
849
|
children: [
|
|
797
850
|
icon,
|
|
798
|
-
/* @__PURE__ */
|
|
851
|
+
/* @__PURE__ */ jsxs11("div", { className: "hl-alert-body", children: [
|
|
799
852
|
title != null && /* @__PURE__ */ jsx26("p", { className: "hl-alert-title", children: title }),
|
|
800
853
|
children
|
|
801
854
|
] })
|
|
@@ -942,7 +995,7 @@ var Skeleton = forwardRef14(function Skeleton2({ variant, width, height, classNa
|
|
|
942
995
|
});
|
|
943
996
|
|
|
944
997
|
// src/Pagination.tsx
|
|
945
|
-
import { jsx as jsx33, jsxs as
|
|
998
|
+
import { jsx as jsx33, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
946
999
|
var ELLIPSIS = "ellipsis";
|
|
947
1000
|
function range(start, end) {
|
|
948
1001
|
return Array.from({ length: end - start + 1 }, (_, i) => start + i);
|
|
@@ -983,7 +1036,7 @@ function Pagination({
|
|
|
983
1036
|
...rest,
|
|
984
1037
|
className: ["hl-pagination", className].filter(Boolean).join(" "),
|
|
985
1038
|
"aria-label": rest["aria-label"] ?? "Pagination",
|
|
986
|
-
children: /* @__PURE__ */
|
|
1039
|
+
children: /* @__PURE__ */ jsxs12("ul", { children: [
|
|
987
1040
|
showControls && /* @__PURE__ */ jsx33("li", { children: /* @__PURE__ */ jsx33(
|
|
988
1041
|
"button",
|
|
989
1042
|
{
|
|
@@ -1115,7 +1168,7 @@ export {
|
|
|
1115
1168
|
TabPanel,
|
|
1116
1169
|
Tabs,
|
|
1117
1170
|
Textarea,
|
|
1118
|
-
|
|
1171
|
+
ToastRegion,
|
|
1119
1172
|
Toc,
|
|
1120
1173
|
Tooltip,
|
|
1121
1174
|
cx,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hydrateless/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "React bindings for Hydrateless — hooks and components that wire the framework-agnostic enhancers.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"test": "vitest run"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@hydrateless/enhancers": "^0.
|
|
31
|
+
"@hydrateless/enhancers": "^0.6.0"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"react": ">=18"
|