@hydrateless/react 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +443 -37
- package/dist/index.js +877 -85
- package/package.json +5 -3
package/dist/index.js
CHANGED
|
@@ -76,67 +76,144 @@ function Disclosure({ summary, defaultOpen = false, children, ...rest }) {
|
|
|
76
76
|
// src/Tabs.tsx
|
|
77
77
|
import { useEffect as useEffect4, useRef as useRef4 } from "react";
|
|
78
78
|
import { enhanceTabs as enhanceTabs2 } from "@hydrateless/enhancers";
|
|
79
|
-
import { jsx as jsx3
|
|
80
|
-
function Tabs({
|
|
79
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
80
|
+
function Tabs({ activation, orientation, children, ...rest }) {
|
|
81
81
|
const ref = useRef4(null);
|
|
82
82
|
useEffect4(() => {
|
|
83
83
|
if (!ref.current) return;
|
|
84
|
-
return enhanceTabs2(ref.current);
|
|
85
|
-
}, [
|
|
86
|
-
return /* @__PURE__ */
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
84
|
+
return enhanceTabs2(ref.current, { activation, orientation });
|
|
85
|
+
}, [activation, orientation]);
|
|
86
|
+
return /* @__PURE__ */ jsx3("div", { ...rest, "data-hl-tabs": true, ref, children });
|
|
87
|
+
}
|
|
88
|
+
function TabList({ children, ...rest }) {
|
|
89
|
+
return /* @__PURE__ */ jsx3("div", { ...rest, role: "tablist", children });
|
|
90
|
+
}
|
|
91
|
+
function Tab({ children, type, ...rest }) {
|
|
92
|
+
return /* @__PURE__ */ jsx3("button", { ...rest, type: type ?? "button", role: "tab", children });
|
|
93
|
+
}
|
|
94
|
+
function TabPanel({ children, ...rest }) {
|
|
95
|
+
return /* @__PURE__ */ jsx3("div", { ...rest, role: "tabpanel", children });
|
|
90
96
|
}
|
|
91
97
|
|
|
92
98
|
// src/Dropdown.tsx
|
|
93
|
-
import {
|
|
99
|
+
import {
|
|
100
|
+
useEffect as useEffect5,
|
|
101
|
+
useRef as useRef5
|
|
102
|
+
} from "react";
|
|
94
103
|
import { enhanceDropdown as enhanceDropdown2 } from "@hydrateless/enhancers";
|
|
95
|
-
import { jsx as jsx4
|
|
96
|
-
function Dropdown({
|
|
104
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
105
|
+
function Dropdown({ placement, children, ...rest }) {
|
|
97
106
|
const ref = useRef5(null);
|
|
98
107
|
useEffect5(() => {
|
|
99
108
|
if (!ref.current) return;
|
|
100
|
-
return enhanceDropdown2(ref.current);
|
|
101
|
-
}, [
|
|
102
|
-
return /* @__PURE__ */
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
109
|
+
return enhanceDropdown2(ref.current, { placement });
|
|
110
|
+
}, [placement]);
|
|
111
|
+
return /* @__PURE__ */ jsx4("div", { ...rest, "data-hl-dropdown": true, ref, children });
|
|
112
|
+
}
|
|
113
|
+
function DropdownTrigger({ children, type, ...rest }) {
|
|
114
|
+
return /* @__PURE__ */ jsx4("button", { ...rest, type: type ?? "button", "data-hl-dropdown-trigger": true, children });
|
|
115
|
+
}
|
|
116
|
+
function DropdownMenu({ children, ...rest }) {
|
|
117
|
+
return /* @__PURE__ */ jsx4("ul", { ...rest, "data-hl-dropdown-menu": true, children });
|
|
118
|
+
}
|
|
119
|
+
function DropdownItem({ children, onSelect, onClick, type, ...rest }) {
|
|
120
|
+
return /* @__PURE__ */ jsx4("li", { children: /* @__PURE__ */ jsx4(
|
|
121
|
+
"button",
|
|
122
|
+
{
|
|
123
|
+
...rest,
|
|
124
|
+
type: type ?? "button",
|
|
125
|
+
role: "menuitem",
|
|
126
|
+
onClick: (e) => {
|
|
127
|
+
onSelect?.();
|
|
128
|
+
onClick?.(e);
|
|
129
|
+
},
|
|
130
|
+
children
|
|
131
|
+
}
|
|
132
|
+
) });
|
|
133
|
+
}
|
|
134
|
+
function DropdownSeparator(props) {
|
|
135
|
+
return /* @__PURE__ */ jsx4("li", { ...props, role: "separator" });
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// src/Menu.tsx
|
|
139
|
+
import {
|
|
140
|
+
useEffect as useEffect6,
|
|
141
|
+
useRef as useRef6
|
|
142
|
+
} from "react";
|
|
143
|
+
import { enhanceMenu } from "@hydrateless/enhancers";
|
|
144
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
145
|
+
function Menu({ orientation = "horizontal", children, ...rest }) {
|
|
146
|
+
const ref = useRef6(null);
|
|
147
|
+
useEffect6(() => {
|
|
148
|
+
if (!ref.current) return;
|
|
149
|
+
return enhanceMenu(ref.current, { orientation });
|
|
150
|
+
}, [orientation]);
|
|
151
|
+
return /* @__PURE__ */ jsx5(
|
|
152
|
+
"ul",
|
|
153
|
+
{
|
|
154
|
+
...rest,
|
|
155
|
+
ref,
|
|
156
|
+
"data-hl-menu": true,
|
|
157
|
+
role: orientation === "vertical" ? "menu" : "menubar",
|
|
158
|
+
"aria-orientation": orientation,
|
|
159
|
+
children
|
|
160
|
+
}
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
function MenuItem({
|
|
164
|
+
href,
|
|
165
|
+
onSelect,
|
|
166
|
+
onClick,
|
|
167
|
+
submenu,
|
|
168
|
+
anchorProps,
|
|
169
|
+
children,
|
|
170
|
+
...rest
|
|
171
|
+
}) {
|
|
172
|
+
const hasSubmenu = submenu != null;
|
|
173
|
+
return /* @__PURE__ */ jsxs3("li", { role: "none", children: [
|
|
174
|
+
href && !hasSubmenu ? /* @__PURE__ */ jsx5("a", { ...anchorProps, role: "menuitem", href, children }) : /* @__PURE__ */ jsx5(
|
|
175
|
+
"button",
|
|
176
|
+
{
|
|
177
|
+
...rest,
|
|
178
|
+
type: "button",
|
|
179
|
+
role: "menuitem",
|
|
180
|
+
onClick: (e) => {
|
|
181
|
+
onSelect?.();
|
|
182
|
+
onClick?.(e);
|
|
183
|
+
},
|
|
184
|
+
children
|
|
185
|
+
}
|
|
186
|
+
),
|
|
187
|
+
hasSubmenu && /* @__PURE__ */ jsx5("ul", { role: "menu", "data-hl-menu-submenu": true, hidden: true, children: submenu })
|
|
116
188
|
] });
|
|
117
189
|
}
|
|
118
190
|
|
|
119
191
|
// src/Modal.tsx
|
|
120
|
-
import { useEffect as
|
|
121
|
-
|
|
192
|
+
import { useEffect as useEffect7, useRef as useRef7 } from "react";
|
|
193
|
+
|
|
194
|
+
// src/util.ts
|
|
195
|
+
function cx(...classes) {
|
|
196
|
+
return classes.filter(Boolean).join(" ");
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// src/Modal.tsx
|
|
200
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
122
201
|
function Modal({
|
|
123
202
|
open,
|
|
124
203
|
onClose,
|
|
125
|
-
title,
|
|
126
|
-
footer,
|
|
127
204
|
closeOnBackdrop = true,
|
|
128
205
|
className,
|
|
129
206
|
children,
|
|
130
207
|
...rest
|
|
131
208
|
}) {
|
|
132
|
-
const ref =
|
|
133
|
-
|
|
209
|
+
const ref = useRef7(null);
|
|
210
|
+
useEffect7(() => {
|
|
134
211
|
const dialog = ref.current;
|
|
135
212
|
if (!dialog) return;
|
|
136
213
|
if (open && !dialog.open) dialog.showModal();
|
|
137
214
|
else if (!open && dialog.open) dialog.close();
|
|
138
215
|
}, [open]);
|
|
139
|
-
|
|
216
|
+
useEffect7(() => {
|
|
140
217
|
const dialog = ref.current;
|
|
141
218
|
if (!dialog) return;
|
|
142
219
|
const handleClose = () => onClose?.();
|
|
@@ -146,44 +223,47 @@ function Modal({
|
|
|
146
223
|
const handleClick = (e) => {
|
|
147
224
|
if (closeOnBackdrop && e.target === ref.current) onClose?.();
|
|
148
225
|
};
|
|
149
|
-
return /* @__PURE__ */
|
|
226
|
+
return /* @__PURE__ */ jsx6(
|
|
150
227
|
"dialog",
|
|
151
228
|
{
|
|
152
229
|
...rest,
|
|
153
230
|
ref,
|
|
154
|
-
className:
|
|
231
|
+
className: cx("hydrateless-modal", className),
|
|
155
232
|
onClick: handleClick,
|
|
156
|
-
children
|
|
157
|
-
title != null && /* @__PURE__ */ jsx5("div", { className: "hl-modal-header", children: title }),
|
|
158
|
-
/* @__PURE__ */ jsx5("div", { className: "hl-modal-body", children }),
|
|
159
|
-
footer != null && /* @__PURE__ */ jsx5("div", { className: "hl-modal-footer", children: footer })
|
|
160
|
-
]
|
|
233
|
+
children
|
|
161
234
|
}
|
|
162
235
|
);
|
|
163
236
|
}
|
|
237
|
+
function ModalHeader({ className, ...rest }) {
|
|
238
|
+
return /* @__PURE__ */ jsx6("div", { ...rest, className: cx("hl-modal-header", className) });
|
|
239
|
+
}
|
|
240
|
+
function ModalBody({ className, ...rest }) {
|
|
241
|
+
return /* @__PURE__ */ jsx6("div", { ...rest, className: cx("hl-modal-body", className) });
|
|
242
|
+
}
|
|
243
|
+
function ModalFooter({ className, ...rest }) {
|
|
244
|
+
return /* @__PURE__ */ jsx6("div", { ...rest, className: cx("hl-modal-footer", className) });
|
|
245
|
+
}
|
|
164
246
|
|
|
165
247
|
// src/Drawer.tsx
|
|
166
|
-
import { useEffect as
|
|
167
|
-
import { jsx as
|
|
248
|
+
import { useEffect as useEffect8, useRef as useRef8 } from "react";
|
|
249
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
168
250
|
function Drawer({
|
|
169
251
|
open,
|
|
170
252
|
onClose,
|
|
171
253
|
side = "right",
|
|
172
|
-
title,
|
|
173
|
-
footer,
|
|
174
254
|
closeOnBackdrop = true,
|
|
175
255
|
className,
|
|
176
256
|
children,
|
|
177
257
|
...rest
|
|
178
258
|
}) {
|
|
179
|
-
const ref =
|
|
180
|
-
|
|
259
|
+
const ref = useRef8(null);
|
|
260
|
+
useEffect8(() => {
|
|
181
261
|
const dialog = ref.current;
|
|
182
262
|
if (!dialog) return;
|
|
183
263
|
if (open && !dialog.open) dialog.showModal();
|
|
184
264
|
else if (!open && dialog.open) dialog.close();
|
|
185
265
|
}, [open]);
|
|
186
|
-
|
|
266
|
+
useEffect8(() => {
|
|
187
267
|
const dialog = ref.current;
|
|
188
268
|
if (!dialog) return;
|
|
189
269
|
const handleClose = () => onClose?.();
|
|
@@ -193,44 +273,49 @@ function Drawer({
|
|
|
193
273
|
const handleClick = (e) => {
|
|
194
274
|
if (closeOnBackdrop && e.target === ref.current) onClose?.();
|
|
195
275
|
};
|
|
196
|
-
return /* @__PURE__ */
|
|
276
|
+
return /* @__PURE__ */ jsx7(
|
|
197
277
|
"dialog",
|
|
198
278
|
{
|
|
199
279
|
...rest,
|
|
200
280
|
ref,
|
|
201
281
|
"data-side": side,
|
|
202
|
-
className:
|
|
282
|
+
className: cx("hydrateless-drawer", className),
|
|
203
283
|
onClick: handleClick,
|
|
204
|
-
children
|
|
205
|
-
title != null && /* @__PURE__ */ jsx6("div", { className: "hl-drawer-header", children: title }),
|
|
206
|
-
/* @__PURE__ */ jsx6("div", { className: "hl-drawer-body", children }),
|
|
207
|
-
footer != null && /* @__PURE__ */ jsx6("div", { className: "hl-drawer-footer", children: footer })
|
|
208
|
-
]
|
|
284
|
+
children
|
|
209
285
|
}
|
|
210
286
|
);
|
|
211
287
|
}
|
|
288
|
+
function DrawerHeader({ className, ...rest }) {
|
|
289
|
+
return /* @__PURE__ */ jsx7("div", { ...rest, className: cx("hl-drawer-header", className) });
|
|
290
|
+
}
|
|
291
|
+
function DrawerBody({ className, ...rest }) {
|
|
292
|
+
return /* @__PURE__ */ jsx7("div", { ...rest, className: cx("hl-drawer-body", className) });
|
|
293
|
+
}
|
|
294
|
+
function DrawerFooter({ className, ...rest }) {
|
|
295
|
+
return /* @__PURE__ */ jsx7("div", { ...rest, className: cx("hl-drawer-footer", className) });
|
|
296
|
+
}
|
|
212
297
|
|
|
213
298
|
// src/Popover.tsx
|
|
214
|
-
import { jsx as
|
|
299
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
215
300
|
function Popover({ open, children, ...rest }) {
|
|
216
|
-
return /* @__PURE__ */
|
|
301
|
+
return /* @__PURE__ */ jsx8("div", { ...rest, "data-hl-popover": true, role: "dialog", hidden: !open, children });
|
|
217
302
|
}
|
|
218
303
|
|
|
219
304
|
// src/Tooltip.tsx
|
|
220
305
|
import {
|
|
221
306
|
cloneElement,
|
|
222
307
|
isValidElement,
|
|
223
|
-
useEffect as
|
|
308
|
+
useEffect as useEffect9,
|
|
224
309
|
useId,
|
|
225
|
-
useRef as
|
|
310
|
+
useRef as useRef9
|
|
226
311
|
} from "react";
|
|
227
312
|
import { enhanceTooltip as enhanceTooltip2 } from "@hydrateless/enhancers";
|
|
228
|
-
import { jsx as
|
|
313
|
+
import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
229
314
|
function Tooltip({ label, children, id }) {
|
|
230
315
|
const generatedId = useId().replace(/:/g, "");
|
|
231
316
|
const tipId = id ?? `hl-tip-${generatedId}`;
|
|
232
|
-
const ref =
|
|
233
|
-
|
|
317
|
+
const ref = useRef9(null);
|
|
318
|
+
useEffect9(() => {
|
|
234
319
|
if (!ref.current) return;
|
|
235
320
|
return enhanceTooltip2(ref.current);
|
|
236
321
|
}, [tipId]);
|
|
@@ -238,60 +323,69 @@ function Tooltip({ label, children, id }) {
|
|
|
238
323
|
"data-hl-tooltip": tipId,
|
|
239
324
|
"aria-describedby": tipId
|
|
240
325
|
}) : children;
|
|
241
|
-
return /* @__PURE__ */
|
|
326
|
+
return /* @__PURE__ */ jsxs4("span", { ref, style: { position: "relative", display: "inline-block" }, children: [
|
|
242
327
|
trigger,
|
|
243
|
-
/* @__PURE__ */
|
|
328
|
+
/* @__PURE__ */ jsx9("span", { id: tipId, role: "tooltip", hidden: true, children: label })
|
|
244
329
|
] });
|
|
245
330
|
}
|
|
246
331
|
|
|
247
332
|
// src/Breadcrumb.tsx
|
|
248
|
-
import { jsx as
|
|
249
|
-
function Breadcrumb({
|
|
250
|
-
return /* @__PURE__ */
|
|
333
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
334
|
+
function Breadcrumb({ children, ...rest }) {
|
|
335
|
+
return /* @__PURE__ */ jsx10("nav", { ...rest, "data-hl-breadcrumb": true, "aria-label": rest["aria-label"] ?? "Breadcrumb", children: /* @__PURE__ */ jsx10("ol", { children }) });
|
|
336
|
+
}
|
|
337
|
+
function BreadcrumbItem({
|
|
338
|
+
href,
|
|
339
|
+
current,
|
|
340
|
+
anchorProps,
|
|
341
|
+
children,
|
|
342
|
+
...rest
|
|
343
|
+
}) {
|
|
344
|
+
return /* @__PURE__ */ jsx10("li", { ...rest, children: current || !href ? /* @__PURE__ */ jsx10("span", { "aria-current": current ? "page" : void 0, children }) : /* @__PURE__ */ jsx10("a", { ...anchorProps, href, children }) });
|
|
251
345
|
}
|
|
252
346
|
|
|
253
347
|
// src/Switch.tsx
|
|
254
|
-
import { jsx as
|
|
348
|
+
import { jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
255
349
|
function Switch({ children, className, ...rest }) {
|
|
256
|
-
return /* @__PURE__ */
|
|
257
|
-
/* @__PURE__ */
|
|
350
|
+
return /* @__PURE__ */ jsxs5("label", { "data-hl-switch": true, className, children: [
|
|
351
|
+
/* @__PURE__ */ jsx11("input", { type: "checkbox", role: "switch", ...rest }),
|
|
258
352
|
children
|
|
259
353
|
] });
|
|
260
354
|
}
|
|
261
355
|
|
|
262
356
|
// src/SkipLink.tsx
|
|
263
|
-
import { jsx as
|
|
357
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
264
358
|
function SkipLink({ children = "Skip to content", className, ...rest }) {
|
|
265
|
-
return /* @__PURE__ */
|
|
359
|
+
return /* @__PURE__ */ jsx12("a", { ...rest, className: ["a11y-skip-link", className].filter(Boolean).join(" "), children });
|
|
266
360
|
}
|
|
267
361
|
|
|
268
362
|
// src/Toc.tsx
|
|
269
|
-
import { useEffect as
|
|
363
|
+
import { useEffect as useEffect10, useRef as useRef10 } from "react";
|
|
270
364
|
import { enhanceToc as enhanceToc2 } from "@hydrateless/enhancers";
|
|
271
|
-
import { jsx as
|
|
365
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
272
366
|
function Toc({ contentSelector, headings, scrollSpy, ...rest }) {
|
|
273
|
-
const ref =
|
|
274
|
-
|
|
367
|
+
const ref = useRef10(null);
|
|
368
|
+
useEffect10(() => {
|
|
275
369
|
if (!ref.current) return;
|
|
276
370
|
return enhanceToc2(ref.current.ownerDocument, { contentSelector, headings, scrollSpy });
|
|
277
371
|
}, [contentSelector, headings, scrollSpy]);
|
|
278
|
-
return /* @__PURE__ */
|
|
372
|
+
return /* @__PURE__ */ jsx13("nav", { ...rest, "data-hl-toc": true, ref });
|
|
279
373
|
}
|
|
280
374
|
|
|
281
375
|
// src/Toast.tsx
|
|
282
|
-
import { createContext, useContext, useEffect as
|
|
376
|
+
import { createContext, useContext, useEffect as useEffect11, useRef as useRef11 } from "react";
|
|
283
377
|
import { enhanceToast } from "@hydrateless/enhancers";
|
|
284
|
-
import { jsx as
|
|
378
|
+
import { jsx as jsx14, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
285
379
|
var ToastContext = createContext(null);
|
|
286
380
|
function ToastProvider({ children }) {
|
|
287
|
-
const apiRef =
|
|
288
|
-
const facade =
|
|
381
|
+
const apiRef = useRef11(null);
|
|
382
|
+
const facade = useRef11({
|
|
289
383
|
show: (message, options) => apiRef.current ? apiRef.current.show(message, options) : document.createElement("div"),
|
|
290
384
|
dismiss: (toast) => apiRef.current?.dismiss(toast),
|
|
291
385
|
destroy: () => apiRef.current?.destroy()
|
|
292
386
|
});
|
|
293
|
-
const regionRef =
|
|
294
|
-
|
|
387
|
+
const regionRef = useRef11(null);
|
|
388
|
+
useEffect11(() => {
|
|
295
389
|
const region = regionRef.current;
|
|
296
390
|
if (!region) return;
|
|
297
391
|
const api = enhanceToast(region.ownerDocument);
|
|
@@ -301,9 +395,9 @@ function ToastProvider({ children }) {
|
|
|
301
395
|
apiRef.current = null;
|
|
302
396
|
};
|
|
303
397
|
}, []);
|
|
304
|
-
return /* @__PURE__ */
|
|
398
|
+
return /* @__PURE__ */ jsxs6(ToastContext.Provider, { value: facade.current, children: [
|
|
305
399
|
children,
|
|
306
|
-
/* @__PURE__ */
|
|
400
|
+
/* @__PURE__ */ jsx14("div", { "data-hl-toast-region": true, ref: regionRef })
|
|
307
401
|
] });
|
|
308
402
|
}
|
|
309
403
|
function useToast() {
|
|
@@ -313,25 +407,723 @@ function useToast() {
|
|
|
313
407
|
}
|
|
314
408
|
return ctx;
|
|
315
409
|
}
|
|
410
|
+
|
|
411
|
+
// src/Combobox.tsx
|
|
412
|
+
import {
|
|
413
|
+
useEffect as useEffect12,
|
|
414
|
+
useRef as useRef12
|
|
415
|
+
} from "react";
|
|
416
|
+
import { enhanceCombobox } from "@hydrateless/enhancers";
|
|
417
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
418
|
+
function Combobox({
|
|
419
|
+
filter,
|
|
420
|
+
autoHighlight,
|
|
421
|
+
onValueChange,
|
|
422
|
+
children,
|
|
423
|
+
...rest
|
|
424
|
+
}) {
|
|
425
|
+
const ref = useRef12(null);
|
|
426
|
+
const onChangeRef = useRef12(onValueChange);
|
|
427
|
+
onChangeRef.current = onValueChange;
|
|
428
|
+
useEffect12(() => {
|
|
429
|
+
const el = ref.current;
|
|
430
|
+
if (!el) return;
|
|
431
|
+
const dispose = enhanceCombobox(el, { filter, autoHighlight });
|
|
432
|
+
const handler = (e) => onChangeRef.current?.(e.detail.value);
|
|
433
|
+
el.addEventListener("hl:select", handler);
|
|
434
|
+
return () => {
|
|
435
|
+
el.removeEventListener("hl:select", handler);
|
|
436
|
+
dispose();
|
|
437
|
+
};
|
|
438
|
+
}, [filter, autoHighlight]);
|
|
439
|
+
return /* @__PURE__ */ jsx15("div", { ...rest, ref, "data-hl-combobox": true, children });
|
|
440
|
+
}
|
|
441
|
+
function ComboboxInput({ styled = true, className, ...rest }) {
|
|
442
|
+
return /* @__PURE__ */ jsx15("input", { ...rest, className: cx(styled && "hl-input", className) });
|
|
443
|
+
}
|
|
444
|
+
function ComboboxList({ children, ...rest }) {
|
|
445
|
+
return /* @__PURE__ */ jsx15("ul", { ...rest, role: "listbox", hidden: true, children });
|
|
446
|
+
}
|
|
447
|
+
function ComboboxOption({ value, children, ...rest }) {
|
|
448
|
+
return /* @__PURE__ */ jsx15("li", { ...rest, role: "option", "data-hl-value": value, children: children ?? value });
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
// src/Command.tsx
|
|
452
|
+
import {
|
|
453
|
+
useEffect as useEffect13,
|
|
454
|
+
useRef as useRef13
|
|
455
|
+
} from "react";
|
|
456
|
+
import { enhanceCommand } from "@hydrateless/enhancers";
|
|
457
|
+
import { jsx as jsx16, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
458
|
+
function Command({ hotkey, onSelect, children, ...rest }) {
|
|
459
|
+
const ref = useRef13(null);
|
|
460
|
+
const onSelectRef = useRef13(onSelect);
|
|
461
|
+
onSelectRef.current = onSelect;
|
|
462
|
+
useEffect13(() => {
|
|
463
|
+
const el = ref.current;
|
|
464
|
+
if (!el) return;
|
|
465
|
+
const dispose = enhanceCommand(el, { hotkey });
|
|
466
|
+
const handler = (e) => {
|
|
467
|
+
const { value } = e.detail;
|
|
468
|
+
onSelectRef.current?.(value);
|
|
469
|
+
};
|
|
470
|
+
el.addEventListener("hl:command", handler);
|
|
471
|
+
return () => {
|
|
472
|
+
el.removeEventListener("hl:command", handler);
|
|
473
|
+
dispose();
|
|
474
|
+
};
|
|
475
|
+
}, [hotkey]);
|
|
476
|
+
return /* @__PURE__ */ jsx16("div", { ...rest, ref, "data-hl-command": true, "data-hl-command-hotkey": hotkey, children });
|
|
477
|
+
}
|
|
478
|
+
function CommandInput({ styled = true, className, ...rest }) {
|
|
479
|
+
return /* @__PURE__ */ jsx16("input", { ...rest, className: cx(styled && "hl-input", className), "data-hl-command-input": true });
|
|
480
|
+
}
|
|
481
|
+
function CommandList({ children, ...rest }) {
|
|
482
|
+
return /* @__PURE__ */ jsx16("div", { ...rest, "data-hl-command-list": true, role: "listbox", children });
|
|
483
|
+
}
|
|
484
|
+
function CommandGroup({ label, children, ...rest }) {
|
|
485
|
+
return /* @__PURE__ */ jsxs7("div", { ...rest, "data-hl-command-group": true, children: [
|
|
486
|
+
label != null && /* @__PURE__ */ jsx16("div", { className: "hl-command-group-label", role: "presentation", children: label }),
|
|
487
|
+
children
|
|
488
|
+
] });
|
|
489
|
+
}
|
|
490
|
+
function CommandItem({ value, keywords, icon, children, ...rest }) {
|
|
491
|
+
return /* @__PURE__ */ jsxs7("div", { ...rest, role: "option", "data-hl-value": value, "data-hl-keywords": keywords, children: [
|
|
492
|
+
icon,
|
|
493
|
+
/* @__PURE__ */ jsx16("span", { children })
|
|
494
|
+
] });
|
|
495
|
+
}
|
|
496
|
+
function CommandEmpty({ children = "No results found.", ...rest }) {
|
|
497
|
+
return /* @__PURE__ */ jsx16("div", { ...rest, "data-hl-command-empty": true, hidden: true, children });
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
// src/Input.tsx
|
|
501
|
+
import { forwardRef } from "react";
|
|
502
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
503
|
+
var Input = forwardRef(function Input2({ size, invalid, className, ...rest }, ref) {
|
|
504
|
+
return /* @__PURE__ */ jsx17(
|
|
505
|
+
"input",
|
|
506
|
+
{
|
|
507
|
+
...rest,
|
|
508
|
+
ref,
|
|
509
|
+
className: ["hl-input", className].filter(Boolean).join(" "),
|
|
510
|
+
"data-hl-size": size,
|
|
511
|
+
"data-hl-invalid": invalid || void 0,
|
|
512
|
+
"aria-invalid": invalid || rest["aria-invalid"]
|
|
513
|
+
}
|
|
514
|
+
);
|
|
515
|
+
});
|
|
516
|
+
|
|
517
|
+
// src/Textarea.tsx
|
|
518
|
+
import { forwardRef as forwardRef2 } from "react";
|
|
519
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
520
|
+
var Textarea = forwardRef2(function Textarea2({ invalid, className, ...rest }, ref) {
|
|
521
|
+
return /* @__PURE__ */ jsx18(
|
|
522
|
+
"textarea",
|
|
523
|
+
{
|
|
524
|
+
...rest,
|
|
525
|
+
ref,
|
|
526
|
+
className: ["hl-textarea", className].filter(Boolean).join(" "),
|
|
527
|
+
"data-hl-invalid": invalid || void 0,
|
|
528
|
+
"aria-invalid": invalid || rest["aria-invalid"]
|
|
529
|
+
}
|
|
530
|
+
);
|
|
531
|
+
});
|
|
532
|
+
|
|
533
|
+
// src/Select.tsx
|
|
534
|
+
import { forwardRef as forwardRef3 } from "react";
|
|
535
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
536
|
+
var Select = forwardRef3(function Select2({ size, invalid, options, className, children, ...rest }, ref) {
|
|
537
|
+
return /* @__PURE__ */ jsx19("span", { className: "hl-select-wrapper", children: /* @__PURE__ */ jsx19(
|
|
538
|
+
"select",
|
|
539
|
+
{
|
|
540
|
+
...rest,
|
|
541
|
+
ref,
|
|
542
|
+
className: ["hl-select", className].filter(Boolean).join(" "),
|
|
543
|
+
"data-hl-size": size,
|
|
544
|
+
"data-hl-invalid": invalid || void 0,
|
|
545
|
+
"aria-invalid": invalid || rest["aria-invalid"],
|
|
546
|
+
children: options ? options.map((option) => /* @__PURE__ */ jsx19("option", { value: option.value, disabled: option.disabled, children: option.label }, option.value)) : children
|
|
547
|
+
}
|
|
548
|
+
) });
|
|
549
|
+
});
|
|
550
|
+
|
|
551
|
+
// src/Checkbox.tsx
|
|
552
|
+
import { forwardRef as forwardRef4 } from "react";
|
|
553
|
+
import { jsx as jsx20, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
554
|
+
var Checkbox = forwardRef4(function Checkbox2({ children, className, ...rest }, ref) {
|
|
555
|
+
return /* @__PURE__ */ jsxs8("label", { className: ["hl-checkbox", className].filter(Boolean).join(" "), children: [
|
|
556
|
+
/* @__PURE__ */ jsx20("input", { ...rest, ref, type: "checkbox" }),
|
|
557
|
+
children != null && /* @__PURE__ */ jsx20("span", { children })
|
|
558
|
+
] });
|
|
559
|
+
});
|
|
560
|
+
|
|
561
|
+
// src/Radio.tsx
|
|
562
|
+
import {
|
|
563
|
+
createContext as createContext2,
|
|
564
|
+
forwardRef as forwardRef5,
|
|
565
|
+
useContext as useContext2
|
|
566
|
+
} from "react";
|
|
567
|
+
import { jsx as jsx21, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
568
|
+
var RadioGroupContext = createContext2(null);
|
|
569
|
+
var Radio = forwardRef5(function Radio2({ children, className, value, ...rest }, ref) {
|
|
570
|
+
const group = useContext2(RadioGroupContext);
|
|
571
|
+
const checked = group ? group.value === value : rest.checked;
|
|
572
|
+
return /* @__PURE__ */ jsxs9("label", { className: ["hl-radio", className].filter(Boolean).join(" "), children: [
|
|
573
|
+
/* @__PURE__ */ jsx21(
|
|
574
|
+
"input",
|
|
575
|
+
{
|
|
576
|
+
...rest,
|
|
577
|
+
ref,
|
|
578
|
+
type: "radio",
|
|
579
|
+
name: rest.name ?? group?.name,
|
|
580
|
+
value,
|
|
581
|
+
checked,
|
|
582
|
+
onChange: (e) => {
|
|
583
|
+
group?.onValueChange?.(value);
|
|
584
|
+
rest.onChange?.(e);
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
),
|
|
588
|
+
children != null && /* @__PURE__ */ jsx21("span", { children })
|
|
589
|
+
] });
|
|
590
|
+
});
|
|
591
|
+
function RadioGroup({
|
|
592
|
+
name,
|
|
593
|
+
value,
|
|
594
|
+
onValueChange,
|
|
595
|
+
className,
|
|
596
|
+
children,
|
|
597
|
+
...rest
|
|
598
|
+
}) {
|
|
599
|
+
return /* @__PURE__ */ jsx21(RadioGroupContext.Provider, { value: { name, value, onValueChange }, children: /* @__PURE__ */ jsx21(
|
|
600
|
+
"div",
|
|
601
|
+
{
|
|
602
|
+
...rest,
|
|
603
|
+
role: "radiogroup",
|
|
604
|
+
className: ["hl-radio-group", className].filter(Boolean).join(" "),
|
|
605
|
+
children
|
|
606
|
+
}
|
|
607
|
+
) });
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
// src/Field.tsx
|
|
611
|
+
import {
|
|
612
|
+
createContext as createContext3,
|
|
613
|
+
useContext as useContext3,
|
|
614
|
+
useId as useId2
|
|
615
|
+
} from "react";
|
|
616
|
+
import { jsx as jsx22, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
617
|
+
var FieldContext = createContext3(null);
|
|
618
|
+
function Field({
|
|
619
|
+
id,
|
|
620
|
+
invalid = false,
|
|
621
|
+
required = false,
|
|
622
|
+
className,
|
|
623
|
+
children,
|
|
624
|
+
...rest
|
|
625
|
+
}) {
|
|
626
|
+
const generated = useId2().replace(/:/g, "");
|
|
627
|
+
const baseId = id ?? `hl-field-${generated}`;
|
|
628
|
+
const value = {
|
|
629
|
+
id: baseId,
|
|
630
|
+
helpId: `${baseId}-help`,
|
|
631
|
+
errorId: `${baseId}-error`,
|
|
632
|
+
invalid,
|
|
633
|
+
required,
|
|
634
|
+
hasHelp: true,
|
|
635
|
+
hasError: invalid
|
|
636
|
+
};
|
|
637
|
+
return /* @__PURE__ */ jsx22(FieldContext.Provider, { value, children: /* @__PURE__ */ jsx22(
|
|
638
|
+
"div",
|
|
639
|
+
{
|
|
640
|
+
...rest,
|
|
641
|
+
className: ["hl-field", className].filter(Boolean).join(" "),
|
|
642
|
+
"data-hl-invalid": invalid || void 0,
|
|
643
|
+
children
|
|
644
|
+
}
|
|
645
|
+
) });
|
|
646
|
+
}
|
|
647
|
+
function useFieldContext(component) {
|
|
648
|
+
const ctx = useContext3(FieldContext);
|
|
649
|
+
if (!ctx) throw new Error(`<${component}> must be used within a <Field>`);
|
|
650
|
+
return ctx;
|
|
651
|
+
}
|
|
652
|
+
function useField() {
|
|
653
|
+
const ctx = useFieldContext("useField");
|
|
654
|
+
const describedBy = [ctx.hasHelp ? ctx.helpId : null, ctx.invalid ? ctx.errorId : null].filter(Boolean).join(" ");
|
|
655
|
+
return {
|
|
656
|
+
id: ctx.id,
|
|
657
|
+
"aria-describedby": describedBy || void 0,
|
|
658
|
+
"aria-invalid": ctx.invalid || void 0
|
|
659
|
+
};
|
|
660
|
+
}
|
|
661
|
+
function FieldLabel({ className, children, ...rest }) {
|
|
662
|
+
const ctx = useFieldContext("FieldLabel");
|
|
663
|
+
return /* @__PURE__ */ jsx22(
|
|
664
|
+
"label",
|
|
665
|
+
{
|
|
666
|
+
...rest,
|
|
667
|
+
htmlFor: rest.htmlFor ?? ctx.id,
|
|
668
|
+
className: ["hl-label", className].filter(Boolean).join(" "),
|
|
669
|
+
"data-hl-required": ctx.required || void 0,
|
|
670
|
+
children
|
|
671
|
+
}
|
|
672
|
+
);
|
|
673
|
+
}
|
|
674
|
+
function FieldHelp({ className, children, ...rest }) {
|
|
675
|
+
const ctx = useFieldContext("FieldHelp");
|
|
676
|
+
return /* @__PURE__ */ jsx22("p", { ...rest, id: ctx.helpId, className: ["hl-help", className].filter(Boolean).join(" "), children });
|
|
677
|
+
}
|
|
678
|
+
function FieldError({ className, children, ...rest }) {
|
|
679
|
+
const ctx = useFieldContext("FieldError");
|
|
680
|
+
if (children == null || children === false) return null;
|
|
681
|
+
return /* @__PURE__ */ jsx22(
|
|
682
|
+
"p",
|
|
683
|
+
{
|
|
684
|
+
...rest,
|
|
685
|
+
id: ctx.errorId,
|
|
686
|
+
role: "alert",
|
|
687
|
+
className: ["hl-error", className].filter(Boolean).join(" "),
|
|
688
|
+
children
|
|
689
|
+
}
|
|
690
|
+
);
|
|
691
|
+
}
|
|
692
|
+
function Fieldset({ legend, className, children, ...rest }) {
|
|
693
|
+
return /* @__PURE__ */ jsxs10("fieldset", { ...rest, className: ["hl-fieldset", className].filter(Boolean).join(" "), children: [
|
|
694
|
+
legend != null && /* @__PURE__ */ jsx22("legend", { className: "hl-legend", children: legend }),
|
|
695
|
+
children
|
|
696
|
+
] });
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
// src/SegmentedControl.tsx
|
|
700
|
+
import { useId as useId3, useState } from "react";
|
|
701
|
+
import { jsx as jsx23, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
702
|
+
function SegmentedControl({
|
|
703
|
+
options,
|
|
704
|
+
value,
|
|
705
|
+
defaultValue,
|
|
706
|
+
onValueChange,
|
|
707
|
+
name,
|
|
708
|
+
size,
|
|
709
|
+
className,
|
|
710
|
+
...rest
|
|
711
|
+
}) {
|
|
712
|
+
const generatedName = useId3();
|
|
713
|
+
const groupName = name ?? generatedName;
|
|
714
|
+
const [internal, setInternal] = useState(defaultValue ?? options[0]?.value);
|
|
715
|
+
const current = value ?? internal;
|
|
716
|
+
const select = (next) => {
|
|
717
|
+
if (value === void 0) setInternal(next);
|
|
718
|
+
onValueChange?.(next);
|
|
719
|
+
};
|
|
720
|
+
return /* @__PURE__ */ jsx23(
|
|
721
|
+
"div",
|
|
722
|
+
{
|
|
723
|
+
...rest,
|
|
724
|
+
role: "radiogroup",
|
|
725
|
+
className: ["hl-segmented", className].filter(Boolean).join(" "),
|
|
726
|
+
"data-hl-size": size,
|
|
727
|
+
children: options.map((option) => /* @__PURE__ */ jsxs11("label", { className: "hl-segmented-item", children: [
|
|
728
|
+
/* @__PURE__ */ jsx23(
|
|
729
|
+
"input",
|
|
730
|
+
{
|
|
731
|
+
type: "radio",
|
|
732
|
+
name: groupName,
|
|
733
|
+
value: option.value,
|
|
734
|
+
checked: current === option.value,
|
|
735
|
+
disabled: option.disabled,
|
|
736
|
+
onChange: () => select(option.value)
|
|
737
|
+
}
|
|
738
|
+
),
|
|
739
|
+
/* @__PURE__ */ jsx23("span", { children: option.label })
|
|
740
|
+
] }, option.value))
|
|
741
|
+
}
|
|
742
|
+
);
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
// src/Slider.tsx
|
|
746
|
+
import { forwardRef as forwardRef6 } from "react";
|
|
747
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
748
|
+
var Slider = forwardRef6(function Slider2({ className, ...rest }, ref) {
|
|
749
|
+
return /* @__PURE__ */ jsx24(
|
|
750
|
+
"input",
|
|
751
|
+
{
|
|
752
|
+
...rest,
|
|
753
|
+
ref,
|
|
754
|
+
type: "range",
|
|
755
|
+
className: ["hl-slider", className].filter(Boolean).join(" ")
|
|
756
|
+
}
|
|
757
|
+
);
|
|
758
|
+
});
|
|
759
|
+
|
|
760
|
+
// src/Button.tsx
|
|
761
|
+
import { forwardRef as forwardRef7 } from "react";
|
|
762
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
763
|
+
var Button = forwardRef7(function Button2({ variant, intent, size, block, icon, loading, className, children, disabled, type, ...rest }, ref) {
|
|
764
|
+
return /* @__PURE__ */ jsx25(
|
|
765
|
+
"button",
|
|
766
|
+
{
|
|
767
|
+
...rest,
|
|
768
|
+
ref,
|
|
769
|
+
type: type ?? "button",
|
|
770
|
+
className: ["hl-button", className].filter(Boolean).join(" "),
|
|
771
|
+
"data-hl-variant": variant,
|
|
772
|
+
"data-hl-intent": intent,
|
|
773
|
+
"data-hl-size": size,
|
|
774
|
+
"data-hl-block": block || void 0,
|
|
775
|
+
"data-hl-icon": icon || void 0,
|
|
776
|
+
"data-hl-loading": loading || void 0,
|
|
777
|
+
"aria-busy": loading || void 0,
|
|
778
|
+
disabled: disabled || loading,
|
|
779
|
+
children
|
|
780
|
+
}
|
|
781
|
+
);
|
|
782
|
+
});
|
|
783
|
+
|
|
784
|
+
// src/Alert.tsx
|
|
785
|
+
import { forwardRef as forwardRef8 } from "react";
|
|
786
|
+
import { jsx as jsx26, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
787
|
+
var Alert = forwardRef8(function Alert2({ intent, title, icon, className, children, ...rest }, ref) {
|
|
788
|
+
return /* @__PURE__ */ jsxs12(
|
|
789
|
+
"div",
|
|
790
|
+
{
|
|
791
|
+
...rest,
|
|
792
|
+
ref,
|
|
793
|
+
role: rest.role ?? "alert",
|
|
794
|
+
className: ["hl-alert", className].filter(Boolean).join(" "),
|
|
795
|
+
"data-hl-intent": intent,
|
|
796
|
+
children: [
|
|
797
|
+
icon,
|
|
798
|
+
/* @__PURE__ */ jsxs12("div", { className: "hl-alert-body", children: [
|
|
799
|
+
title != null && /* @__PURE__ */ jsx26("p", { className: "hl-alert-title", children: title }),
|
|
800
|
+
children
|
|
801
|
+
] })
|
|
802
|
+
]
|
|
803
|
+
}
|
|
804
|
+
);
|
|
805
|
+
});
|
|
806
|
+
|
|
807
|
+
// src/Badge.tsx
|
|
808
|
+
import { forwardRef as forwardRef9 } from "react";
|
|
809
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
810
|
+
var Badge = forwardRef9(function Badge2({ intent, variant, size, className, children, ...rest }, ref) {
|
|
811
|
+
return /* @__PURE__ */ jsx27(
|
|
812
|
+
"span",
|
|
813
|
+
{
|
|
814
|
+
...rest,
|
|
815
|
+
ref,
|
|
816
|
+
className: ["hl-badge", className].filter(Boolean).join(" "),
|
|
817
|
+
"data-hl-intent": intent,
|
|
818
|
+
"data-hl-variant": variant,
|
|
819
|
+
"data-hl-size": size,
|
|
820
|
+
children
|
|
821
|
+
}
|
|
822
|
+
);
|
|
823
|
+
});
|
|
824
|
+
|
|
825
|
+
// src/Card.tsx
|
|
826
|
+
import { forwardRef as forwardRef10 } from "react";
|
|
827
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
828
|
+
var Card = forwardRef10(function Card2({ interactive, className, children, ...rest }, ref) {
|
|
829
|
+
return /* @__PURE__ */ jsx28(
|
|
830
|
+
"div",
|
|
831
|
+
{
|
|
832
|
+
...rest,
|
|
833
|
+
ref,
|
|
834
|
+
className: ["hl-card", className].filter(Boolean).join(" "),
|
|
835
|
+
"data-hl-interactive": interactive || void 0,
|
|
836
|
+
children
|
|
837
|
+
}
|
|
838
|
+
);
|
|
839
|
+
});
|
|
840
|
+
var CardHeader = forwardRef10(function CardHeader2({ className, ...rest }, ref) {
|
|
841
|
+
return /* @__PURE__ */ jsx28("div", { ...rest, ref, className: ["hl-card-header", className].filter(Boolean).join(" ") });
|
|
842
|
+
});
|
|
843
|
+
var CardBody = forwardRef10(function CardBody2({ className, ...rest }, ref) {
|
|
844
|
+
return /* @__PURE__ */ jsx28("div", { ...rest, ref, className: ["hl-card-body", className].filter(Boolean).join(" ") });
|
|
845
|
+
});
|
|
846
|
+
var CardFooter = forwardRef10(function CardFooter2({ className, ...rest }, ref) {
|
|
847
|
+
return /* @__PURE__ */ jsx28("div", { ...rest, ref, className: ["hl-card-footer", className].filter(Boolean).join(" ") });
|
|
848
|
+
});
|
|
849
|
+
var CardTitle = forwardRef10(
|
|
850
|
+
function CardTitle2({ className, ...rest }, ref) {
|
|
851
|
+
return /* @__PURE__ */ jsx28("h3", { ...rest, ref, className: ["hl-card-title", className].filter(Boolean).join(" ") });
|
|
852
|
+
}
|
|
853
|
+
);
|
|
854
|
+
var CardDescription = forwardRef10(function CardDescription2({ className, ...rest }, ref) {
|
|
855
|
+
return /* @__PURE__ */ jsx28(
|
|
856
|
+
"p",
|
|
857
|
+
{
|
|
858
|
+
...rest,
|
|
859
|
+
ref,
|
|
860
|
+
className: ["hl-card-description", className].filter(Boolean).join(" ")
|
|
861
|
+
}
|
|
862
|
+
);
|
|
863
|
+
});
|
|
864
|
+
|
|
865
|
+
// src/Avatar.tsx
|
|
866
|
+
import { forwardRef as forwardRef11, useState as useState2 } from "react";
|
|
867
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
868
|
+
var Avatar = forwardRef11(function Avatar2({ src, alt = "", fallback, size, shape, className, children, ...rest }, ref) {
|
|
869
|
+
const [failed, setFailed] = useState2(false);
|
|
870
|
+
const showImage = src && !failed;
|
|
871
|
+
return /* @__PURE__ */ jsx29(
|
|
872
|
+
"span",
|
|
873
|
+
{
|
|
874
|
+
...rest,
|
|
875
|
+
ref,
|
|
876
|
+
className: ["hl-avatar", className].filter(Boolean).join(" "),
|
|
877
|
+
"data-hl-size": size,
|
|
878
|
+
"data-hl-shape": shape === "square" ? "square" : void 0,
|
|
879
|
+
children: showImage ? /* @__PURE__ */ jsx29("img", { src, alt, onError: () => setFailed(true) }) : fallback ?? children
|
|
880
|
+
}
|
|
881
|
+
);
|
|
882
|
+
});
|
|
883
|
+
var AvatarGroup = forwardRef11(function AvatarGroup2({ className, children, ...rest }, ref) {
|
|
884
|
+
return /* @__PURE__ */ jsx29("div", { ...rest, ref, className: ["hl-avatar-group", className].filter(Boolean).join(" "), children });
|
|
885
|
+
});
|
|
886
|
+
|
|
887
|
+
// src/Progress.tsx
|
|
888
|
+
import { forwardRef as forwardRef12 } from "react";
|
|
889
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
890
|
+
var Progress = forwardRef12(function Progress2({ value, max = 100, intent, size, className, ...rest }, ref) {
|
|
891
|
+
return /* @__PURE__ */ jsx30(
|
|
892
|
+
"progress",
|
|
893
|
+
{
|
|
894
|
+
...rest,
|
|
895
|
+
ref,
|
|
896
|
+
className: ["hl-progress", className].filter(Boolean).join(" "),
|
|
897
|
+
"data-hl-intent": intent,
|
|
898
|
+
"data-hl-size": size,
|
|
899
|
+
value,
|
|
900
|
+
max
|
|
901
|
+
}
|
|
902
|
+
);
|
|
903
|
+
});
|
|
904
|
+
|
|
905
|
+
// src/Spinner.tsx
|
|
906
|
+
import { forwardRef as forwardRef13 } from "react";
|
|
907
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
908
|
+
var Spinner = forwardRef13(function Spinner2({ size, label = "Loading", className, ...rest }, ref) {
|
|
909
|
+
return /* @__PURE__ */ jsx31(
|
|
910
|
+
"span",
|
|
911
|
+
{
|
|
912
|
+
...rest,
|
|
913
|
+
ref,
|
|
914
|
+
className: ["hl-spinner", className].filter(Boolean).join(" "),
|
|
915
|
+
"data-hl-size": size,
|
|
916
|
+
role: "status",
|
|
917
|
+
"aria-label": label
|
|
918
|
+
}
|
|
919
|
+
);
|
|
920
|
+
});
|
|
921
|
+
|
|
922
|
+
// src/Skeleton.tsx
|
|
923
|
+
import { forwardRef as forwardRef14 } from "react";
|
|
924
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
925
|
+
var Skeleton = forwardRef14(function Skeleton2({ variant, width, height, className, style, ...rest }, ref) {
|
|
926
|
+
const sizeStyle = {
|
|
927
|
+
...width != null && { inlineSize: width },
|
|
928
|
+
...height != null && { blockSize: height },
|
|
929
|
+
...style
|
|
930
|
+
};
|
|
931
|
+
return /* @__PURE__ */ jsx32(
|
|
932
|
+
"span",
|
|
933
|
+
{
|
|
934
|
+
...rest,
|
|
935
|
+
ref,
|
|
936
|
+
className: ["hl-skeleton", className].filter(Boolean).join(" "),
|
|
937
|
+
"data-hl-variant": variant,
|
|
938
|
+
style: sizeStyle,
|
|
939
|
+
"aria-hidden": "true"
|
|
940
|
+
}
|
|
941
|
+
);
|
|
942
|
+
});
|
|
943
|
+
|
|
944
|
+
// src/Pagination.tsx
|
|
945
|
+
import { jsx as jsx33, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
946
|
+
var ELLIPSIS = "ellipsis";
|
|
947
|
+
function range(start, end) {
|
|
948
|
+
return Array.from({ length: end - start + 1 }, (_, i) => start + i);
|
|
949
|
+
}
|
|
950
|
+
function paginationRange(page, count, siblingCount) {
|
|
951
|
+
const totalNumbers = siblingCount * 2 + 5;
|
|
952
|
+
if (totalNumbers >= count) return range(1, count);
|
|
953
|
+
const leftSibling = Math.max(page - siblingCount, 1);
|
|
954
|
+
const rightSibling = Math.min(page + siblingCount, count);
|
|
955
|
+
const showLeftDots = leftSibling > 2;
|
|
956
|
+
const showRightDots = rightSibling < count - 1;
|
|
957
|
+
if (!showLeftDots && showRightDots) {
|
|
958
|
+
return [...range(1, siblingCount * 2 + 3), ELLIPSIS, count];
|
|
959
|
+
}
|
|
960
|
+
if (showLeftDots && !showRightDots) {
|
|
961
|
+
return [1, ELLIPSIS, ...range(count - (siblingCount * 2 + 2), count)];
|
|
962
|
+
}
|
|
963
|
+
return [1, ELLIPSIS, ...range(leftSibling, rightSibling), ELLIPSIS, count];
|
|
964
|
+
}
|
|
965
|
+
function Pagination({
|
|
966
|
+
page,
|
|
967
|
+
count,
|
|
968
|
+
onPageChange,
|
|
969
|
+
siblingCount = 1,
|
|
970
|
+
showControls = true,
|
|
971
|
+
prevLabel = "\u2039",
|
|
972
|
+
nextLabel = "\u203A",
|
|
973
|
+
className,
|
|
974
|
+
...rest
|
|
975
|
+
}) {
|
|
976
|
+
const items = paginationRange(page, count, siblingCount);
|
|
977
|
+
const go = (target) => {
|
|
978
|
+
if (target >= 1 && target <= count && target !== page) onPageChange?.(target);
|
|
979
|
+
};
|
|
980
|
+
return /* @__PURE__ */ jsx33(
|
|
981
|
+
"nav",
|
|
982
|
+
{
|
|
983
|
+
...rest,
|
|
984
|
+
className: ["hl-pagination", className].filter(Boolean).join(" "),
|
|
985
|
+
"aria-label": rest["aria-label"] ?? "Pagination",
|
|
986
|
+
children: /* @__PURE__ */ jsxs13("ul", { children: [
|
|
987
|
+
showControls && /* @__PURE__ */ jsx33("li", { children: /* @__PURE__ */ jsx33(
|
|
988
|
+
"button",
|
|
989
|
+
{
|
|
990
|
+
type: "button",
|
|
991
|
+
className: "hl-pagination-item",
|
|
992
|
+
"aria-label": "Previous page",
|
|
993
|
+
disabled: page <= 1,
|
|
994
|
+
onClick: () => go(page - 1),
|
|
995
|
+
children: prevLabel
|
|
996
|
+
}
|
|
997
|
+
) }),
|
|
998
|
+
items.map(
|
|
999
|
+
(item, i) => item === ELLIPSIS ? /* @__PURE__ */ jsx33("li", { "aria-hidden": "true", children: /* @__PURE__ */ jsx33("span", { className: "hl-pagination-ellipsis", children: "\u2026" }) }, `e${i}`) : /* @__PURE__ */ jsx33("li", { children: /* @__PURE__ */ jsx33(
|
|
1000
|
+
"button",
|
|
1001
|
+
{
|
|
1002
|
+
type: "button",
|
|
1003
|
+
className: "hl-pagination-item",
|
|
1004
|
+
"aria-current": item === page ? "page" : void 0,
|
|
1005
|
+
"aria-label": `Page ${item}`,
|
|
1006
|
+
onClick: () => go(item),
|
|
1007
|
+
children: item
|
|
1008
|
+
}
|
|
1009
|
+
) }, item)
|
|
1010
|
+
),
|
|
1011
|
+
showControls && /* @__PURE__ */ jsx33("li", { children: /* @__PURE__ */ jsx33(
|
|
1012
|
+
"button",
|
|
1013
|
+
{
|
|
1014
|
+
type: "button",
|
|
1015
|
+
className: "hl-pagination-item",
|
|
1016
|
+
"aria-label": "Next page",
|
|
1017
|
+
disabled: page >= count,
|
|
1018
|
+
onClick: () => go(page + 1),
|
|
1019
|
+
children: nextLabel
|
|
1020
|
+
}
|
|
1021
|
+
) })
|
|
1022
|
+
] })
|
|
1023
|
+
}
|
|
1024
|
+
);
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
// src/Kbd.tsx
|
|
1028
|
+
import { forwardRef as forwardRef15 } from "react";
|
|
1029
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
1030
|
+
var Kbd = forwardRef15(function Kbd2({ className, children, ...rest }, ref) {
|
|
1031
|
+
return /* @__PURE__ */ jsx34("kbd", { ...rest, ref, className: ["hl-kbd", className].filter(Boolean).join(" "), children });
|
|
1032
|
+
});
|
|
1033
|
+
|
|
1034
|
+
// src/Separator.tsx
|
|
1035
|
+
import { forwardRef as forwardRef16 } from "react";
|
|
1036
|
+
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
1037
|
+
var Separator = forwardRef16(function Separator2({ orientation = "horizontal", decorative, className, ...rest }, ref) {
|
|
1038
|
+
return /* @__PURE__ */ jsx35(
|
|
1039
|
+
"hr",
|
|
1040
|
+
{
|
|
1041
|
+
...rest,
|
|
1042
|
+
ref,
|
|
1043
|
+
className: ["hl-separator", className].filter(Boolean).join(" "),
|
|
1044
|
+
"data-hl-orientation": orientation === "vertical" ? "vertical" : void 0,
|
|
1045
|
+
"aria-orientation": orientation,
|
|
1046
|
+
role: decorative ? "presentation" : "separator"
|
|
1047
|
+
}
|
|
1048
|
+
);
|
|
1049
|
+
});
|
|
316
1050
|
export {
|
|
317
1051
|
Accordion,
|
|
318
1052
|
AccordionItem,
|
|
1053
|
+
Alert,
|
|
1054
|
+
Avatar,
|
|
1055
|
+
AvatarGroup,
|
|
1056
|
+
Badge,
|
|
319
1057
|
Breadcrumb,
|
|
1058
|
+
BreadcrumbItem,
|
|
1059
|
+
Button,
|
|
1060
|
+
Card,
|
|
1061
|
+
CardBody,
|
|
1062
|
+
CardDescription,
|
|
1063
|
+
CardFooter,
|
|
1064
|
+
CardHeader,
|
|
1065
|
+
CardTitle,
|
|
1066
|
+
Checkbox,
|
|
1067
|
+
Combobox,
|
|
1068
|
+
ComboboxInput,
|
|
1069
|
+
ComboboxList,
|
|
1070
|
+
ComboboxOption,
|
|
1071
|
+
Command,
|
|
1072
|
+
CommandEmpty,
|
|
1073
|
+
CommandGroup,
|
|
1074
|
+
CommandInput,
|
|
1075
|
+
CommandItem,
|
|
1076
|
+
CommandList,
|
|
320
1077
|
Disclosure,
|
|
321
1078
|
Drawer,
|
|
1079
|
+
DrawerBody,
|
|
1080
|
+
DrawerFooter,
|
|
1081
|
+
DrawerHeader,
|
|
322
1082
|
Dropdown,
|
|
1083
|
+
DropdownItem,
|
|
1084
|
+
DropdownMenu,
|
|
1085
|
+
DropdownSeparator,
|
|
1086
|
+
DropdownTrigger,
|
|
1087
|
+
Field,
|
|
1088
|
+
FieldError,
|
|
1089
|
+
FieldHelp,
|
|
1090
|
+
FieldLabel,
|
|
1091
|
+
Fieldset,
|
|
1092
|
+
Input,
|
|
1093
|
+
Kbd,
|
|
1094
|
+
Menu,
|
|
1095
|
+
MenuItem,
|
|
323
1096
|
Modal,
|
|
1097
|
+
ModalBody,
|
|
1098
|
+
ModalFooter,
|
|
1099
|
+
ModalHeader,
|
|
1100
|
+
Pagination,
|
|
324
1101
|
Popover,
|
|
1102
|
+
Progress,
|
|
1103
|
+
Radio,
|
|
1104
|
+
RadioGroup,
|
|
1105
|
+
SegmentedControl,
|
|
1106
|
+
Select,
|
|
1107
|
+
Separator,
|
|
1108
|
+
Skeleton,
|
|
325
1109
|
SkipLink,
|
|
1110
|
+
Slider,
|
|
1111
|
+
Spinner,
|
|
326
1112
|
Switch,
|
|
1113
|
+
Tab,
|
|
1114
|
+
TabList,
|
|
1115
|
+
TabPanel,
|
|
327
1116
|
Tabs,
|
|
1117
|
+
Textarea,
|
|
328
1118
|
ToastProvider,
|
|
329
1119
|
Toc,
|
|
330
1120
|
Tooltip,
|
|
1121
|
+
cx,
|
|
331
1122
|
useAccordion,
|
|
332
1123
|
useDisclosureGroup,
|
|
333
1124
|
useDropdown,
|
|
334
1125
|
useEnhancer,
|
|
1126
|
+
useField,
|
|
335
1127
|
useModalGroup,
|
|
336
1128
|
useTabs,
|
|
337
1129
|
useToast,
|