@hyperpackai/hyperui 0.1.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/LICENSE +21 -0
- package/README.md +82 -0
- package/dist/components/Accordion/index.d.ts +17 -0
- package/dist/components/Accordion/index.d.ts.map +1 -0
- package/dist/components/Accordion/index.js +46 -0
- package/dist/components/Alert/index.d.ts +13 -0
- package/dist/components/Alert/index.d.ts.map +1 -0
- package/dist/components/Alert/index.js +46 -0
- package/dist/components/AppBar/index.d.ts +19 -0
- package/dist/components/AppBar/index.d.ts.map +1 -0
- package/dist/components/AppBar/index.js +48 -0
- package/dist/components/AspectRatio/index.d.ts +8 -0
- package/dist/components/AspectRatio/index.d.ts.map +1 -0
- package/dist/components/AspectRatio/index.js +32 -0
- package/dist/components/Autocomplete/index.d.ts +21 -0
- package/dist/components/Autocomplete/index.d.ts.map +1 -0
- package/dist/components/Autocomplete/index.js +94 -0
- package/dist/components/Avatar/index.d.ts +12 -0
- package/dist/components/Avatar/index.d.ts.map +1 -0
- package/dist/components/Avatar/index.js +32 -0
- package/dist/components/AvatarGroup/index.d.ts +9 -0
- package/dist/components/AvatarGroup/index.d.ts.map +1 -0
- package/dist/components/AvatarGroup/index.js +24 -0
- package/dist/components/Backdrop/index.d.ts +10 -0
- package/dist/components/Backdrop/index.d.ts.map +1 -0
- package/dist/components/Backdrop/index.js +25 -0
- package/dist/components/Badge/index.d.ts +10 -0
- package/dist/components/Badge/index.d.ts.map +1 -0
- package/dist/components/Badge/index.js +30 -0
- package/dist/components/BottomNavigation/index.d.ts +16 -0
- package/dist/components/BottomNavigation/index.d.ts.map +1 -0
- package/dist/components/BottomNavigation/index.js +43 -0
- package/dist/components/Box/index.d.ts +21 -0
- package/dist/components/Box/index.d.ts.map +1 -0
- package/dist/components/Box/index.js +30 -0
- package/dist/components/Breadcrumb/index.d.ts +13 -0
- package/dist/components/Breadcrumb/index.d.ts.map +1 -0
- package/dist/components/Breadcrumb/index.js +19 -0
- package/dist/components/Button/index.d.ts +22 -0
- package/dist/components/Button/index.d.ts.map +1 -0
- package/dist/components/Button/index.js +93 -0
- package/dist/components/ButtonGroup/index.d.ts +9 -0
- package/dist/components/ButtonGroup/index.d.ts.map +1 -0
- package/dist/components/ButtonGroup/index.js +27 -0
- package/dist/components/Card/index.d.ts +14 -0
- package/dist/components/Card/index.d.ts.map +1 -0
- package/dist/components/Card/index.js +33 -0
- package/dist/components/Checkbox/index.d.ts +17 -0
- package/dist/components/Checkbox/index.d.ts.map +1 -0
- package/dist/components/Checkbox/index.js +42 -0
- package/dist/components/Chip/index.d.ts +18 -0
- package/dist/components/Chip/index.d.ts.map +1 -0
- package/dist/components/Chip/index.js +60 -0
- package/dist/components/CircularProgress/index.d.ts +14 -0
- package/dist/components/CircularProgress/index.d.ts.map +1 -0
- package/dist/components/CircularProgress/index.js +58 -0
- package/dist/components/ClickAwayListener/index.d.ts +11 -0
- package/dist/components/ClickAwayListener/index.d.ts.map +1 -0
- package/dist/components/ClickAwayListener/index.js +31 -0
- package/dist/components/Code/index.d.ts +9 -0
- package/dist/components/Code/index.d.ts.map +1 -0
- package/dist/components/Code/index.js +50 -0
- package/dist/components/Collapse/index.d.ts +11 -0
- package/dist/components/Collapse/index.d.ts.map +1 -0
- package/dist/components/Collapse/index.js +30 -0
- package/dist/components/CommandPalette/index.d.ts +26 -0
- package/dist/components/CommandPalette/index.d.ts.map +1 -0
- package/dist/components/CommandPalette/index.js +141 -0
- package/dist/components/Container/index.d.ts +11 -0
- package/dist/components/Container/index.d.ts.map +1 -0
- package/dist/components/Container/index.js +18 -0
- package/dist/components/DashboardLayout/index.d.ts +15 -0
- package/dist/components/DashboardLayout/index.d.ts.map +1 -0
- package/dist/components/DashboardLayout/index.js +67 -0
- package/dist/components/DataTable/index.d.ts +27 -0
- package/dist/components/DataTable/index.d.ts.map +1 -0
- package/dist/components/DataTable/index.js +59 -0
- package/dist/components/Dialog/index.d.ts +19 -0
- package/dist/components/Dialog/index.d.ts.map +1 -0
- package/dist/components/Dialog/index.js +96 -0
- package/dist/components/Divider/index.d.ts +13 -0
- package/dist/components/Divider/index.d.ts.map +1 -0
- package/dist/components/Divider/index.js +40 -0
- package/dist/components/Drawer/index.d.ts +17 -0
- package/dist/components/Drawer/index.d.ts.map +1 -0
- package/dist/components/Drawer/index.js +77 -0
- package/dist/components/DropdownMenu/index.d.ts +25 -0
- package/dist/components/DropdownMenu/index.d.ts.map +1 -0
- package/dist/components/DropdownMenu/index.js +67 -0
- package/dist/components/EmptyState/index.d.ts +11 -0
- package/dist/components/EmptyState/index.d.ts.map +1 -0
- package/dist/components/EmptyState/index.js +53 -0
- package/dist/components/ErrorState/index.d.ts +12 -0
- package/dist/components/ErrorState/index.d.ts.map +1 -0
- package/dist/components/ErrorState/index.js +54 -0
- package/dist/components/Fab/index.d.ts +16 -0
- package/dist/components/Fab/index.d.ts.map +1 -0
- package/dist/components/Fab/index.js +39 -0
- package/dist/components/Fade/index.d.ts +10 -0
- package/dist/components/Fade/index.d.ts.map +1 -0
- package/dist/components/Fade/index.js +13 -0
- package/dist/components/FocusTrap/index.d.ts +11 -0
- package/dist/components/FocusTrap/index.d.ts.map +1 -0
- package/dist/components/FocusTrap/index.js +69 -0
- package/dist/components/FormControl/index.d.ts +34 -0
- package/dist/components/FormControl/index.d.ts.map +1 -0
- package/dist/components/FormControl/index.js +52 -0
- package/dist/components/GlobalSearch/index.d.ts +23 -0
- package/dist/components/GlobalSearch/index.d.ts.map +1 -0
- package/dist/components/GlobalSearch/index.js +91 -0
- package/dist/components/Grid/index.d.ts +19 -0
- package/dist/components/Grid/index.d.ts.map +1 -0
- package/dist/components/Grid/index.js +30 -0
- package/dist/components/Grow/index.d.ts +10 -0
- package/dist/components/Grow/index.d.ts.map +1 -0
- package/dist/components/Grow/index.js +13 -0
- package/dist/components/IconButton/index.d.ts +16 -0
- package/dist/components/IconButton/index.d.ts.map +1 -0
- package/dist/components/IconButton/index.js +43 -0
- package/dist/components/ImageList/index.d.ts +21 -0
- package/dist/components/ImageList/index.d.ts.map +1 -0
- package/dist/components/ImageList/index.js +39 -0
- package/dist/components/Input/index.d.ts +33 -0
- package/dist/components/Input/index.d.ts.map +1 -0
- package/dist/components/Input/index.js +45 -0
- package/dist/components/Kbd/index.d.ts +8 -0
- package/dist/components/Kbd/index.d.ts.map +1 -0
- package/dist/components/Kbd/index.js +41 -0
- package/dist/components/KeyboardShortcut/index.d.ts +20 -0
- package/dist/components/KeyboardShortcut/index.d.ts.map +1 -0
- package/dist/components/KeyboardShortcut/index.js +63 -0
- package/dist/components/Label/index.d.ts +10 -0
- package/dist/components/Label/index.d.ts.map +1 -0
- package/dist/components/Label/index.js +17 -0
- package/dist/components/LinearProgress/index.d.ts +13 -0
- package/dist/components/LinearProgress/index.d.ts.map +1 -0
- package/dist/components/LinearProgress/index.js +69 -0
- package/dist/components/Link/index.d.ts +16 -0
- package/dist/components/Link/index.d.ts.map +1 -0
- package/dist/components/Link/index.js +25 -0
- package/dist/components/List/index.d.ts +40 -0
- package/dist/components/List/index.d.ts.map +1 -0
- package/dist/components/List/index.js +70 -0
- package/dist/components/LoadingState/index.d.ts +11 -0
- package/dist/components/LoadingState/index.d.ts.map +1 -0
- package/dist/components/LoadingState/index.js +66 -0
- package/dist/components/Menu/index.d.ts +40 -0
- package/dist/components/Menu/index.d.ts.map +1 -0
- package/dist/components/Menu/index.js +103 -0
- package/dist/components/MobileStepper/index.d.ts +16 -0
- package/dist/components/MobileStepper/index.d.ts.map +1 -0
- package/dist/components/MobileStepper/index.js +67 -0
- package/dist/components/Modal/index.d.ts +14 -0
- package/dist/components/Modal/index.d.ts.map +1 -0
- package/dist/components/Modal/index.js +51 -0
- package/dist/components/Navbar/index.d.ts +14 -0
- package/dist/components/Navbar/index.d.ts.map +1 -0
- package/dist/components/Navbar/index.js +27 -0
- package/dist/components/NoSSR/index.d.ts +7 -0
- package/dist/components/NoSSR/index.d.ts.map +1 -0
- package/dist/components/NoSSR/index.js +9 -0
- package/dist/components/PageLayout/index.d.ts +13 -0
- package/dist/components/PageLayout/index.d.ts.map +1 -0
- package/dist/components/PageLayout/index.js +41 -0
- package/dist/components/Pagination/index.d.ts +11 -0
- package/dist/components/Pagination/index.d.ts.map +1 -0
- package/dist/components/Pagination/index.js +56 -0
- package/dist/components/Paper/index.d.ts +12 -0
- package/dist/components/Paper/index.d.ts.map +1 -0
- package/dist/components/Paper/index.js +24 -0
- package/dist/components/Popover/index.d.ts +13 -0
- package/dist/components/Popover/index.d.ts.map +1 -0
- package/dist/components/Popover/index.js +34 -0
- package/dist/components/Progress/index.d.ts +13 -0
- package/dist/components/Progress/index.d.ts.map +1 -0
- package/dist/components/Progress/index.js +40 -0
- package/dist/components/Radio/index.d.ts +7 -0
- package/dist/components/Radio/index.d.ts.map +1 -0
- package/dist/components/Radio/index.js +28 -0
- package/dist/components/Rating/index.d.ts +15 -0
- package/dist/components/Rating/index.d.ts.map +1 -0
- package/dist/components/Rating/index.js +41 -0
- package/dist/components/ResizablePanel/index.d.ts +16 -0
- package/dist/components/ResizablePanel/index.d.ts.map +1 -0
- package/dist/components/ResizablePanel/index.js +41 -0
- package/dist/components/ScrollArea/index.d.ts +12 -0
- package/dist/components/ScrollArea/index.d.ts.map +1 -0
- package/dist/components/ScrollArea/index.js +50 -0
- package/dist/components/Select/index.d.ts +23 -0
- package/dist/components/Select/index.d.ts.map +1 -0
- package/dist/components/Select/index.js +52 -0
- package/dist/components/Sheet/index.d.ts +15 -0
- package/dist/components/Sheet/index.d.ts.map +1 -0
- package/dist/components/Sheet/index.js +61 -0
- package/dist/components/Sidebar/index.d.ts +23 -0
- package/dist/components/Sidebar/index.d.ts.map +1 -0
- package/dist/components/Sidebar/index.js +37 -0
- package/dist/components/Skeleton/index.d.ts +9 -0
- package/dist/components/Skeleton/index.d.ts.map +1 -0
- package/dist/components/Skeleton/index.js +22 -0
- package/dist/components/Slide/index.d.ts +12 -0
- package/dist/components/Slide/index.d.ts.map +1 -0
- package/dist/components/Slide/index.js +21 -0
- package/dist/components/Slider/index.d.ts +19 -0
- package/dist/components/Slider/index.d.ts.map +1 -0
- package/dist/components/Slider/index.js +49 -0
- package/dist/components/Snackbar/index.d.ts +28 -0
- package/dist/components/Snackbar/index.d.ts.map +1 -0
- package/dist/components/Snackbar/index.js +71 -0
- package/dist/components/SpeedDial/index.d.ts +18 -0
- package/dist/components/SpeedDial/index.d.ts.map +1 -0
- package/dist/components/SpeedDial/index.js +71 -0
- package/dist/components/Spinner/index.d.ts +10 -0
- package/dist/components/Spinner/index.d.ts.map +1 -0
- package/dist/components/Spinner/index.js +67 -0
- package/dist/components/SplitPane/index.d.ts +11 -0
- package/dist/components/SplitPane/index.d.ts.map +1 -0
- package/dist/components/SplitPane/index.js +46 -0
- package/dist/components/Stack/index.d.ts +17 -0
- package/dist/components/Stack/index.d.ts.map +1 -0
- package/dist/components/Stack/index.js +30 -0
- package/dist/components/Stepper/index.d.ts +20 -0
- package/dist/components/Stepper/index.d.ts.map +1 -0
- package/dist/components/Stepper/index.js +66 -0
- package/dist/components/Switch/index.d.ts +13 -0
- package/dist/components/Switch/index.d.ts.map +1 -0
- package/dist/components/Switch/index.js +38 -0
- package/dist/components/Tabs/index.d.ts +20 -0
- package/dist/components/Tabs/index.d.ts.map +1 -0
- package/dist/components/Tabs/index.js +62 -0
- package/dist/components/TextField/index.d.ts +35 -0
- package/dist/components/TextField/index.d.ts.map +1 -0
- package/dist/components/TextField/index.js +69 -0
- package/dist/components/Textarea/index.d.ts +22 -0
- package/dist/components/Textarea/index.d.ts.map +1 -0
- package/dist/components/Textarea/index.js +27 -0
- package/dist/components/Timeline/index.d.ts +16 -0
- package/dist/components/Timeline/index.d.ts.map +1 -0
- package/dist/components/Timeline/index.js +30 -0
- package/dist/components/Toast/index.d.ts +34 -0
- package/dist/components/Toast/index.d.ts.map +1 -0
- package/dist/components/Toast/index.js +106 -0
- package/dist/components/ToggleButton/index.d.ts +21 -0
- package/dist/components/ToggleButton/index.d.ts.map +1 -0
- package/dist/components/ToggleButton/index.js +81 -0
- package/dist/components/Tooltip/index.d.ts +14 -0
- package/dist/components/Tooltip/index.d.ts.map +1 -0
- package/dist/components/Tooltip/index.js +47 -0
- package/dist/components/TreeView/index.d.ts +19 -0
- package/dist/components/TreeView/index.d.ts.map +1 -0
- package/dist/components/TreeView/index.js +50 -0
- package/dist/components/Typography/index.d.ts +17 -0
- package/dist/components/Typography/index.d.ts.map +1 -0
- package/dist/components/Typography/index.js +44 -0
- package/dist/components/VisuallyHidden/index.d.ts +7 -0
- package/dist/components/VisuallyHidden/index.d.ts.map +1 -0
- package/dist/components/VisuallyHidden/index.js +18 -0
- package/dist/components/Zoom/index.d.ts +10 -0
- package/dist/components/Zoom/index.d.ts.map +1 -0
- package/dist/components/Zoom/index.js +13 -0
- package/dist/components/ai.d.ts +133 -0
- package/dist/components/ai.d.ts.map +1 -0
- package/dist/components/ai.js +184 -0
- package/dist/components/charts.d.ts +143 -0
- package/dist/components/charts.d.ts.map +1 -0
- package/dist/components/charts.js +435 -0
- package/dist/components/data.d.ts +192 -0
- package/dist/components/data.d.ts.map +1 -0
- package/dist/components/data.js +581 -0
- package/dist/components/date.d.ts +73 -0
- package/dist/components/date.d.ts.map +1 -0
- package/dist/components/date.js +199 -0
- package/dist/components/enterprise.d.ts +246 -0
- package/dist/components/enterprise.d.ts.map +1 -0
- package/dist/components/enterprise.js +428 -0
- package/dist/components/form.d.ts +132 -0
- package/dist/components/form.d.ts.map +1 -0
- package/dist/components/form.js +380 -0
- package/dist/components/index.d.ts +173 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +107 -0
- package/dist/components/inputs.d.ts +169 -0
- package/dist/components/inputs.d.ts.map +1 -0
- package/dist/components/inputs.js +437 -0
- package/dist/components/layout.d.ts +224 -0
- package/dist/components/layout.d.ts.map +1 -0
- package/dist/components/layout.js +644 -0
- package/dist/components/overlay.d.ts +102 -0
- package/dist/components/overlay.d.ts.map +1 -0
- package/dist/components/overlay.js +318 -0
- package/dist/components/surfaces.d.ts +180 -0
- package/dist/components/surfaces.d.ts.map +1 -0
- package/dist/components/surfaces.js +423 -0
- package/dist/components/typography.d.ts +69 -0
- package/dist/components/typography.d.ts.map +1 -0
- package/dist/components/typography.js +206 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +29 -0
- package/dist/portal.d.ts +3 -0
- package/dist/portal.d.ts.map +1 -0
- package/dist/portal.js +17 -0
- package/dist/theme/index.d.ts +31 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/theme/index.js +258 -0
- package/dist/tokens/component.d.ts +124 -0
- package/dist/tokens/component.d.ts.map +1 -0
- package/dist/tokens/component.js +113 -0
- package/dist/tokens/index.d.ts +494 -0
- package/dist/tokens/index.d.ts.map +1 -0
- package/dist/tokens/index.js +345 -0
- package/dist/tokens/primitives.d.ts +675 -0
- package/dist/tokens/primitives.d.ts.map +1 -0
- package/dist/tokens/primitives.js +356 -0
- package/dist/tokens/semantic.d.ts +252 -0
- package/dist/tokens/semantic.d.ts.map +1 -0
- package/dist/tokens/semantic.js +242 -0
- package/dist/tokens/themes.d.ts +18 -0
- package/dist/tokens/themes.d.ts.map +1 -0
- package/dist/tokens/themes.js +316 -0
- package/package.json +69 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { injectCSS, cn, h } from "../../theme/index.js";
|
|
2
|
+
const RESIZABLE_PANEL_CSS = `
|
|
3
|
+
.hu-resizable-panel {
|
|
4
|
+
min-width: var(--hu-panel-min-width, 160px); max-width: var(--hu-panel-max-width, none);
|
|
5
|
+
min-height: var(--hu-panel-min-height, 120px); max-height: var(--hu-panel-max-height, none);
|
|
6
|
+
width: var(--hu-panel-width, auto); height: var(--hu-panel-height, auto);
|
|
7
|
+
resize: var(--hu-panel-resize, both); overflow: auto;
|
|
8
|
+
background: var(--hu-bg); border: 1px solid var(--hu-border);
|
|
9
|
+
border-radius: var(--hu-radius-md);
|
|
10
|
+
}
|
|
11
|
+
.hu-resizable-panel__header {
|
|
12
|
+
display: flex; align-items: center; justify-content: space-between; gap: var(--hu-space-3);
|
|
13
|
+
padding: var(--hu-space-3) var(--hu-space-4); border-block-end: 1px solid var(--hu-border);
|
|
14
|
+
font-size: var(--hu-font-size-sm); font-weight: var(--hu-font-weight-semibold);
|
|
15
|
+
}
|
|
16
|
+
.hu-resizable-panel__body { padding: var(--hu-space-4); min-width: 0; }
|
|
17
|
+
`;
|
|
18
|
+
function toCssUnit(value) {
|
|
19
|
+
return typeof value === "number" ? `${value}px` : value;
|
|
20
|
+
}
|
|
21
|
+
export function ResizablePanel(props) {
|
|
22
|
+
injectCSS("hu-resizable-panel", RESIZABLE_PANEL_CSS);
|
|
23
|
+
const styles = [];
|
|
24
|
+
if (props.width !== undefined)
|
|
25
|
+
styles.push(`--hu-panel-width:${toCssUnit(props.width)}`);
|
|
26
|
+
if (props.height !== undefined)
|
|
27
|
+
styles.push(`--hu-panel-height:${toCssUnit(props.height)}`);
|
|
28
|
+
if (props.minWidth !== undefined)
|
|
29
|
+
styles.push(`--hu-panel-min-width:${toCssUnit(props.minWidth)}`);
|
|
30
|
+
if (props.maxWidth !== undefined)
|
|
31
|
+
styles.push(`--hu-panel-max-width:${toCssUnit(props.maxWidth)}`);
|
|
32
|
+
if (props.minHeight !== undefined)
|
|
33
|
+
styles.push(`--hu-panel-min-height:${toCssUnit(props.minHeight)}`);
|
|
34
|
+
if (props.maxHeight !== undefined)
|
|
35
|
+
styles.push(`--hu-panel-max-height:${toCssUnit(props.maxHeight)}`);
|
|
36
|
+
styles.push(`--hu-panel-resize:${props.resize ?? "both"}`);
|
|
37
|
+
return h("section", {
|
|
38
|
+
class: cn("hu-resizable-panel", props.class),
|
|
39
|
+
style: styles.join(";")
|
|
40
|
+
}, (props.title || props.actions) && h("div", { class: "hu-resizable-panel__header" }, h("div", {}, props.title), props.actions && h("div", {}, props.actions)), h("div", { class: "hu-resizable-panel__body" }, props.children));
|
|
41
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type VNode } from "../../theme/index.js";
|
|
2
|
+
export interface ScrollAreaProps {
|
|
3
|
+
orientation?: "vertical" | "horizontal" | "both";
|
|
4
|
+
maxHeight?: string | number;
|
|
5
|
+
maxWidth?: string | number;
|
|
6
|
+
class?: string;
|
|
7
|
+
viewportClass?: string;
|
|
8
|
+
children?: unknown;
|
|
9
|
+
onScroll?: (event: Event) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare function ScrollArea(props?: ScrollAreaProps): VNode;
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ScrollArea/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,KAAK,EAAE,MAAM,sBAAsB,CAAC;AA6BpE,MAAM,WAAW,eAAe;IAC9B,WAAW,CAAC,EAAE,UAAU,GAAG,YAAY,GAAG,MAAM,CAAC;IACjD,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CACnC;AAOD,wBAAgB,UAAU,CAAC,KAAK,GAAE,eAAoB,GAAG,KAAK,CAoB7D"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { injectCSS, cn, h } from "../../theme/index.js";
|
|
2
|
+
const SCROLL_AREA_CSS = `
|
|
3
|
+
.hu-scroll-area {
|
|
4
|
+
position: relative;
|
|
5
|
+
min-width: 0;
|
|
6
|
+
min-height: 0;
|
|
7
|
+
}
|
|
8
|
+
.hu-scroll-area__viewport {
|
|
9
|
+
min-width: 0;
|
|
10
|
+
min-height: 0;
|
|
11
|
+
max-width: var(--hu-scroll-area-max-width, none);
|
|
12
|
+
max-height: var(--hu-scroll-area-max-height, none);
|
|
13
|
+
scrollbar-width: thin;
|
|
14
|
+
scrollbar-color: var(--hu-border-2) transparent;
|
|
15
|
+
}
|
|
16
|
+
.hu-scroll-area__viewport::-webkit-scrollbar { width: 10px; height: 10px; }
|
|
17
|
+
.hu-scroll-area__viewport::-webkit-scrollbar-thumb {
|
|
18
|
+
background: var(--hu-border-2);
|
|
19
|
+
border-radius: var(--hu-radius-full);
|
|
20
|
+
border: 3px solid transparent;
|
|
21
|
+
background-clip: content-box;
|
|
22
|
+
}
|
|
23
|
+
.hu-scroll-area__viewport::-webkit-scrollbar-track { background: transparent; }
|
|
24
|
+
.hu-scroll-area--vertical .hu-scroll-area__viewport { overflow-x: hidden; overflow-y: auto; }
|
|
25
|
+
.hu-scroll-area--horizontal .hu-scroll-area__viewport { overflow-x: auto; overflow-y: hidden; }
|
|
26
|
+
.hu-scroll-area--both .hu-scroll-area__viewport { overflow: auto; }
|
|
27
|
+
`;
|
|
28
|
+
function sizeValue(value) {
|
|
29
|
+
if (value === undefined)
|
|
30
|
+
return undefined;
|
|
31
|
+
return typeof value === "number" ? `${value}px` : value;
|
|
32
|
+
}
|
|
33
|
+
export function ScrollArea(props = {}) {
|
|
34
|
+
injectCSS("hu-scroll-area", SCROLL_AREA_CSS);
|
|
35
|
+
const orientation = props.orientation ?? "vertical";
|
|
36
|
+
const maxHeight = sizeValue(props.maxHeight);
|
|
37
|
+
const maxWidth = sizeValue(props.maxWidth);
|
|
38
|
+
const style = [
|
|
39
|
+
maxHeight && `--hu-scroll-area-max-height:${maxHeight}`,
|
|
40
|
+
maxWidth && `--hu-scroll-area-max-width:${maxWidth}`
|
|
41
|
+
].filter(Boolean).join(";");
|
|
42
|
+
return h("div", {
|
|
43
|
+
class: cn("hu-scroll-area", `hu-scroll-area--${orientation}`, props.class),
|
|
44
|
+
style: style || undefined
|
|
45
|
+
}, h("div", {
|
|
46
|
+
class: cn("hu-scroll-area__viewport", props.viewportClass),
|
|
47
|
+
onScroll: props.onScroll,
|
|
48
|
+
tabindex: "0"
|
|
49
|
+
}, props.children));
|
|
50
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type VNode } from "../../theme/index.js";
|
|
2
|
+
export interface SelectOption {
|
|
3
|
+
value: string;
|
|
4
|
+
label: string;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
group?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface SelectProps {
|
|
9
|
+
value?: string;
|
|
10
|
+
options: SelectOption[];
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
required?: boolean;
|
|
14
|
+
size?: "sm" | "md" | "lg";
|
|
15
|
+
error?: string;
|
|
16
|
+
label?: string;
|
|
17
|
+
id?: string;
|
|
18
|
+
name?: string;
|
|
19
|
+
class?: string;
|
|
20
|
+
onChange?: (e: Event) => void;
|
|
21
|
+
}
|
|
22
|
+
export declare function Select(props: SelectProps): VNode;
|
|
23
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Select/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,KAAK,EAAE,MAAM,sBAAsB,CAAC;AA0BpE,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC;CAC/B;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,KAAK,CAoChD"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { injectCSS, cn, h } from "../../theme/index.js";
|
|
2
|
+
import { Label } from "../Label/index.js";
|
|
3
|
+
const SELECT_CSS = `
|
|
4
|
+
.hu-select-wrap { display: flex; flex-direction: column; gap: 6px; width: 100%; }
|
|
5
|
+
.hu-select-field { position: relative; display: flex; align-items: center; }
|
|
6
|
+
.hu-select {
|
|
7
|
+
width: 100%; min-height: 40px; font-family: var(--hu-font-sans); font-size: var(--hu-font-size-sm);
|
|
8
|
+
color: var(--hu-text); background: linear-gradient(180deg, var(--hu-bg), var(--hu-bg-2));
|
|
9
|
+
border: 1px solid var(--hu-border); border-radius: var(--hu-radius-md);
|
|
10
|
+
padding: 9px 40px 9px 12px; outline: none; appearance: none; cursor: pointer;
|
|
11
|
+
transition: border-color var(--hu-duration) var(--hu-ease), box-shadow var(--hu-duration) var(--hu-ease), background var(--hu-duration) var(--hu-ease);
|
|
12
|
+
box-shadow: var(--hu-shadow-xs);
|
|
13
|
+
}
|
|
14
|
+
.hu-select:hover:not(:disabled) { border-color: color-mix(in srgb, var(--hu-primary) 35%, var(--hu-border-2)); }
|
|
15
|
+
.hu-select:focus { border-color: var(--hu-primary); background: var(--hu-bg); box-shadow: 0 0 0 3px color-mix(in srgb, var(--hu-primary) 18%, transparent), var(--hu-shadow-sm); }
|
|
16
|
+
.hu-select:disabled { opacity: .5; cursor: not-allowed; background: var(--hu-bg-3); }
|
|
17
|
+
.hu-select--error { border-color: var(--hu-error) !important; }
|
|
18
|
+
.hu-select-arrow {
|
|
19
|
+
position: absolute; right: 12px; pointer-events: none; color: var(--hu-text-3);
|
|
20
|
+
width: 18px; height: 18px; display: grid; place-items: center;
|
|
21
|
+
}
|
|
22
|
+
.hu-select--sm { min-height: 34px; padding: 6px 34px 6px 10px; font-size: var(--hu-font-size-xs); border-radius: var(--hu-radius); }
|
|
23
|
+
.hu-select--lg { min-height: 46px; padding: 11px 42px 11px 14px; font-size: var(--hu-font-size-base); }
|
|
24
|
+
`;
|
|
25
|
+
export function Select(props) {
|
|
26
|
+
injectCSS("hu-select", SELECT_CSS);
|
|
27
|
+
const { options, placeholder, error, label, size = "md", id, ...rest } = props;
|
|
28
|
+
const groups = new Map();
|
|
29
|
+
const ungrouped = [];
|
|
30
|
+
for (const opt of options) {
|
|
31
|
+
if (opt.group) {
|
|
32
|
+
if (!groups.has(opt.group))
|
|
33
|
+
groups.set(opt.group, []);
|
|
34
|
+
groups.get(opt.group).push(opt);
|
|
35
|
+
}
|
|
36
|
+
else
|
|
37
|
+
ungrouped.push(opt);
|
|
38
|
+
}
|
|
39
|
+
const renderOptions = (opts) => opts.map((opt) => h("option", { value: opt.value, disabled: opt.disabled }, opt.label));
|
|
40
|
+
const children = [];
|
|
41
|
+
if (placeholder)
|
|
42
|
+
children.push(h("option", { value: "", disabled: true }, placeholder));
|
|
43
|
+
children.push(...renderOptions(ungrouped));
|
|
44
|
+
for (const [groupLabel, groupOpts] of groups) {
|
|
45
|
+
children.push(h("optgroup", { label: groupLabel }, ...renderOptions(groupOpts)));
|
|
46
|
+
}
|
|
47
|
+
const arrowSVG = `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M4 6l4 4 4-4"/></svg>`;
|
|
48
|
+
return h("div", { class: cn("hu-select-wrap", props.class) }, label && Label({ for: id, required: props.required, children: label }), h("div", { class: "hu-select-field" }, h("select", {
|
|
49
|
+
...rest, id,
|
|
50
|
+
class: cn("hu-select", size !== "md" && `hu-select--${size}`, error && "hu-select--error")
|
|
51
|
+
}, ...children), h("span", { class: "hu-select-arrow", innerHTML: arrowSVG, "aria-hidden": "true" })), error && h("span", { class: "hu-input-error-msg", role: "alert" }, error));
|
|
52
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type Signal } from "@hyperpackai/hyperion";
|
|
2
|
+
import { type VNode } from "../../theme/index.js";
|
|
3
|
+
export interface SheetProps {
|
|
4
|
+
open: boolean | Signal<boolean>;
|
|
5
|
+
side?: "right" | "left" | "top" | "bottom";
|
|
6
|
+
title?: string;
|
|
7
|
+
footer?: unknown;
|
|
8
|
+
onClose?: (reason?: "backdrop" | "close-button") => void;
|
|
9
|
+
onOpenChange?: (open: boolean, reason?: "backdrop" | "close-button") => void;
|
|
10
|
+
closeOnBackdrop?: boolean;
|
|
11
|
+
children?: unknown;
|
|
12
|
+
class?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function Sheet(props: SheetProps): VNode;
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Sheet/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAoB,KAAK,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAiCpE,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;IAChC,IAAI,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,CAAC;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,UAAU,GAAG,cAAc,KAAK,IAAI,CAAC;IACzD,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,UAAU,GAAG,cAAc,KAAK,IAAI,CAAC;IAC7E,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,GAAG,KAAK,CA2C9C"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { injectCSS, cn, h } from "../../theme/index.js";
|
|
2
|
+
import { renderInPortal } from "../../portal.js";
|
|
3
|
+
import { FocusTrap } from "../FocusTrap/index.js";
|
|
4
|
+
const SHEET_CSS = `
|
|
5
|
+
.hu-sheet-backdrop {
|
|
6
|
+
position: fixed; inset: 0; background: var(--hu-overlay);
|
|
7
|
+
z-index: var(--hu-z-backdrop);
|
|
8
|
+
animation: hu-fade-in var(--hu-duration-fast) var(--hu-ease);
|
|
9
|
+
}
|
|
10
|
+
.hu-sheet {
|
|
11
|
+
position: fixed; background: var(--hu-bg); box-shadow: var(--hu-shadow-xl);
|
|
12
|
+
z-index: var(--hu-z-modal); overflow: auto; display: flex; flex-direction: column;
|
|
13
|
+
}
|
|
14
|
+
.hu-sheet--right { top: 0; right: 0; bottom: 0; width: 400px; max-width: 90vw; border-radius: var(--hu-radius-lg) 0 0 var(--hu-radius-lg); animation: hu-slide-in-right var(--hu-duration) var(--hu-ease-out); }
|
|
15
|
+
.hu-sheet--left { top: 0; left: 0; bottom: 0; width: 400px; max-width: 90vw; border-radius: 0 var(--hu-radius-lg) var(--hu-radius-lg) 0; animation: hu-slide-in-left var(--hu-duration) var(--hu-ease-out); }
|
|
16
|
+
.hu-sheet--bottom { bottom: 0; left: 0; right: 0; max-height: 90vh; border-radius: var(--hu-radius-lg) var(--hu-radius-lg) 0 0; animation: hu-slide-down var(--hu-duration) var(--hu-ease-out); }
|
|
17
|
+
.hu-sheet--top { top: 0; left: 0; right: 0; max-height: 90vh; border-radius: 0 0 var(--hu-radius-lg) var(--hu-radius-lg); animation: hu-slide-up var(--hu-duration) var(--hu-ease-out); }
|
|
18
|
+
.hu-sheet-header { padding: var(--hu-space-5) var(--hu-space-6); border-bottom: 1px solid var(--hu-border); display: flex; align-items: center; justify-content: space-between; }
|
|
19
|
+
.hu-sheet-title { margin: 0; font-size: var(--hu-font-size-md); font-weight: var(--hu-font-weight-semibold); color: var(--hu-text); }
|
|
20
|
+
.hu-sheet-body { padding: var(--hu-space-6); flex: 1; overflow: auto; }
|
|
21
|
+
.hu-sheet-footer { padding: var(--hu-space-4) var(--hu-space-6); border-top: 1px solid var(--hu-border); }
|
|
22
|
+
.hu-sheet-close {
|
|
23
|
+
display:flex;align-items:center;justify-content:center;width:32px;height:32px;
|
|
24
|
+
border-radius:var(--hu-radius-md);background:linear-gradient(180deg,var(--hu-bg),var(--hu-bg-2));
|
|
25
|
+
border:1px solid var(--hu-border);cursor:pointer;color:var(--hu-text-3);
|
|
26
|
+
transition:background var(--hu-duration) var(--hu-ease),border-color var(--hu-duration) var(--hu-ease),color var(--hu-duration) var(--hu-ease),box-shadow var(--hu-duration) var(--hu-ease),transform var(--hu-duration-fast) var(--hu-ease);
|
|
27
|
+
flex-shrink:0;padding:0;box-shadow:var(--hu-shadow-xs);
|
|
28
|
+
}
|
|
29
|
+
.hu-sheet-close:hover { background:var(--hu-bg-3);color:var(--hu-text);border-color:var(--hu-border-2);box-shadow:var(--hu-shadow-sm);transform:translateY(-1px); }
|
|
30
|
+
.hu-sheet-close:focus-visible { outline:2px solid var(--hu-primary);outline-offset:2px; }
|
|
31
|
+
`;
|
|
32
|
+
export function Sheet(props) {
|
|
33
|
+
injectCSS("hu-sheet", SHEET_CSS);
|
|
34
|
+
const { side = "right", title, footer, onClose, onOpenChange, closeOnBackdrop = true, children } = props;
|
|
35
|
+
const isSignalOpen = typeof props.open === "object" && "peek" in props.open;
|
|
36
|
+
const isOpen = () => isSignalOpen
|
|
37
|
+
? props.open.value
|
|
38
|
+
: props.open;
|
|
39
|
+
if (!isSignalOpen && !isOpen())
|
|
40
|
+
return h("span", { "aria-hidden": "true" });
|
|
41
|
+
const closeSVG = `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2"><path d="M2 2l12 12M14 2L2 14"/></svg>`;
|
|
42
|
+
const renderSheet = () => renderInPortal(h("div", {}, h("div", {
|
|
43
|
+
class: "hu-sheet-backdrop",
|
|
44
|
+
onClick: closeOnBackdrop ? () => {
|
|
45
|
+
onOpenChange?.(false, "backdrop");
|
|
46
|
+
onClose?.("backdrop");
|
|
47
|
+
} : undefined
|
|
48
|
+
}), FocusTrap({ active: true, restoreFocus: true, autoFocus: true, children: h("div", { class: cn("hu-sheet", `hu-sheet--${side}`, props.class), role: "dialog", "aria-modal": "true" }, title && h("div", { class: "hu-sheet-header" }, h("h2", { class: "hu-sheet-title" }, title), h("button", {
|
|
49
|
+
class: "hu-sheet-close",
|
|
50
|
+
onClick: () => {
|
|
51
|
+
onOpenChange?.(false, "close-button");
|
|
52
|
+
onClose?.("close-button");
|
|
53
|
+
},
|
|
54
|
+
"aria-label": "Close",
|
|
55
|
+
innerHTML: closeSVG
|
|
56
|
+
})), h("div", { class: "hu-sheet-body" }, children), footer && h("div", { class: "hu-sheet-footer" }, footer))
|
|
57
|
+
})), "sheet");
|
|
58
|
+
if (!isSignalOpen)
|
|
59
|
+
return renderSheet();
|
|
60
|
+
return (() => isOpen() ? renderSheet() : h("span", { "aria-hidden": "true" }));
|
|
61
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type VNode } from "../../theme/index.js";
|
|
2
|
+
export interface SidebarItem {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
icon?: unknown;
|
|
6
|
+
badge?: unknown;
|
|
7
|
+
href?: string;
|
|
8
|
+
active?: boolean;
|
|
9
|
+
onClick?: () => void;
|
|
10
|
+
}
|
|
11
|
+
export interface SidebarSection {
|
|
12
|
+
label?: string;
|
|
13
|
+
items: SidebarItem[];
|
|
14
|
+
}
|
|
15
|
+
export interface SidebarProps {
|
|
16
|
+
header?: unknown;
|
|
17
|
+
sections: SidebarSection[];
|
|
18
|
+
footer?: unknown;
|
|
19
|
+
width?: "sm" | "md" | "lg";
|
|
20
|
+
class?: string;
|
|
21
|
+
}
|
|
22
|
+
export declare function Sidebar(props: SidebarProps): VNode;
|
|
23
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Sidebar/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,KAAK,EAAE,MAAM,sBAAsB,CAAC;AA+BpE,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,MAAM,WAAW,cAAc;IAAG,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,WAAW,EAAE,CAAC;CAAE;AAEzE,MAAM,WAAW,YAAY;IAC3B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,cAAc,EAAE,CAAC;IAC3B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,GAAG,KAAK,CAyBlD"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { injectCSS, cn, h } from "../../theme/index.js";
|
|
2
|
+
const SIDEBAR_CSS = `
|
|
3
|
+
.hu-sidebar {
|
|
4
|
+
display: flex; flex-direction: column; height: 100vh; overflow: hidden;
|
|
5
|
+
background: linear-gradient(180deg, var(--hu-bg), color-mix(in srgb, var(--hu-bg-2) 64%, var(--hu-bg)));
|
|
6
|
+
border-right: 1px solid color-mix(in srgb, var(--hu-border) 82%, transparent);
|
|
7
|
+
position: sticky; top: 0;
|
|
8
|
+
}
|
|
9
|
+
.hu-sidebar--sm { width: 220px; min-width: 220px; }
|
|
10
|
+
.hu-sidebar--md { width: 260px; min-width: 260px; }
|
|
11
|
+
.hu-sidebar--lg { width: 300px; min-width: 300px; }
|
|
12
|
+
.hu-sidebar-header { padding: var(--hu-space-4) var(--hu-space-4) var(--hu-space-3); border-bottom: 1px solid var(--hu-border); }
|
|
13
|
+
.hu-sidebar-nav { flex: 1; overflow-y: auto; padding: var(--hu-space-2); scrollbar-width: thin; }
|
|
14
|
+
.hu-sidebar-section { margin-bottom: var(--hu-space-4); }
|
|
15
|
+
.hu-sidebar-section-label { padding: var(--hu-space-2) var(--hu-space-3); font-size: 11px; font-weight: var(--hu-font-weight-semibold); color: var(--hu-text-3); text-transform: uppercase; letter-spacing: .06em; }
|
|
16
|
+
.hu-sidebar-item {
|
|
17
|
+
display: flex; align-items: center; gap: var(--hu-space-3); width: 100%;
|
|
18
|
+
min-height: 38px; padding: 8px var(--hu-space-3); border-radius: var(--hu-radius-md); font-size: var(--hu-font-size-sm);
|
|
19
|
+
color: var(--hu-text-2); text-decoration: none; border: none; background: transparent;
|
|
20
|
+
cursor: pointer; font-weight: var(--hu-font-weight-medium);
|
|
21
|
+
transition: background var(--hu-duration) var(--hu-ease), color var(--hu-duration) var(--hu-ease), box-shadow var(--hu-duration) var(--hu-ease), transform var(--hu-duration-fast) var(--hu-ease);
|
|
22
|
+
}
|
|
23
|
+
.hu-sidebar-item:hover { background: var(--hu-bg-3); color: var(--hu-text); transform: translateX(1px); }
|
|
24
|
+
.hu-sidebar-item:focus-visible { outline: 2px solid var(--hu-primary); outline-offset: 2px; }
|
|
25
|
+
.hu-sidebar-item--active { background: var(--hu-primary-bg); color: var(--hu-primary); box-shadow: inset 3px 0 0 var(--hu-primary); }
|
|
26
|
+
.hu-sidebar-item-icon { width: 18px; height: 18px; flex-shrink: 0; }
|
|
27
|
+
.hu-sidebar-item-badge { margin-left: auto; }
|
|
28
|
+
.hu-sidebar-footer { padding: var(--hu-space-3) var(--hu-space-4); border-top: 1px solid var(--hu-border); background: color-mix(in srgb, var(--hu-bg-2) 62%, transparent); }
|
|
29
|
+
`;
|
|
30
|
+
export function Sidebar(props) {
|
|
31
|
+
injectCSS("hu-sidebar", SIDEBAR_CSS);
|
|
32
|
+
const { header, sections, footer, width = "md" } = props;
|
|
33
|
+
return h("aside", { class: cn("hu-sidebar", `hu-sidebar--${width}`, props.class) }, header && h("div", { class: "hu-sidebar-header" }, header), h("nav", { class: "hu-sidebar-nav", "aria-label": "Sidebar navigation" }, ...sections.map((section, si) => h("div", { key: si, class: "hu-sidebar-section" }, section.label && h("div", { class: "hu-sidebar-section-label" }, section.label), ...section.items.map((item) => h(item.href ? "a" : "button", {
|
|
34
|
+
key: item.id, class: cn("hu-sidebar-item", item.active && "hu-sidebar-item--active"),
|
|
35
|
+
href: item.href, onClick: item.onClick, "aria-current": item.active ? "page" : undefined
|
|
36
|
+
}, item.icon && h("span", { class: "hu-sidebar-item-icon", "aria-hidden": "true" }, item.icon), item.label, item.badge && h("span", { class: "hu-sidebar-item-badge" }, item.badge)))))), footer && h("div", { class: "hu-sidebar-footer" }, footer));
|
|
37
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type VNode } from "../../theme/index.js";
|
|
2
|
+
export interface SkeletonProps {
|
|
3
|
+
width?: string | number;
|
|
4
|
+
height?: string | number;
|
|
5
|
+
variant?: "rect" | "text" | "circle" | "title";
|
|
6
|
+
class?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function Skeleton(props: SkeletonProps): VNode;
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Skeleton/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAapE,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,KAAK,CAWpD"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { injectCSS, cn, h } from "../../theme/index.js";
|
|
2
|
+
const SKELETON_CSS = `
|
|
3
|
+
.hu-skeleton {
|
|
4
|
+
display: block; border-radius: var(--hu-radius);
|
|
5
|
+
background: linear-gradient(90deg, var(--hu-bg-3) 25%, var(--hu-bg-4) 50%, var(--hu-bg-3) 75%);
|
|
6
|
+
background-size: 200% 100%; animation: hu-shimmer 1.5s infinite;
|
|
7
|
+
}
|
|
8
|
+
.hu-skeleton--text { height: 14px; border-radius: var(--hu-radius-sm); }
|
|
9
|
+
.hu-skeleton--circle { border-radius: var(--hu-radius-full); }
|
|
10
|
+
.hu-skeleton--title { height: 24px; border-radius: var(--hu-radius-sm); }
|
|
11
|
+
`;
|
|
12
|
+
export function Skeleton(props) {
|
|
13
|
+
injectCSS("hu-skeleton", SKELETON_CSS);
|
|
14
|
+
const { width, height, variant = "rect" } = props;
|
|
15
|
+
const w = typeof width === "number" ? `${width}px` : width;
|
|
16
|
+
const h_ = typeof height === "number" ? `${height}px` : height;
|
|
17
|
+
return h("span", {
|
|
18
|
+
class: cn("hu-skeleton", variant !== "rect" && `hu-skeleton--${variant}`, props.class),
|
|
19
|
+
style: [w && `width:${w}`, h_ && `height:${h_}`].filter(Boolean).join(";"),
|
|
20
|
+
"aria-hidden": "true"
|
|
21
|
+
});
|
|
22
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type VNode } from "../../theme/index.js";
|
|
2
|
+
export type SlideDirection = "left" | "right" | "up" | "down";
|
|
3
|
+
export interface SlideProps {
|
|
4
|
+
in: boolean;
|
|
5
|
+
direction?: SlideDirection;
|
|
6
|
+
timeout?: number;
|
|
7
|
+
unmountOnExit?: boolean;
|
|
8
|
+
class?: string;
|
|
9
|
+
children?: unknown;
|
|
10
|
+
}
|
|
11
|
+
export declare function Slide(props: SlideProps): VNode | null;
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Slide/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAYpE,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,MAAM,CAAC;AAE9D,MAAM,WAAW,UAAU;IAAG,EAAE,EAAE,OAAO,CAAC;IAAC,SAAS,CAAC,EAAE,cAAc,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE;AAEtJ,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,GAAG,KAAK,GAAG,IAAI,CASrD"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { injectCSS, cn, h } from "../../theme/index.js";
|
|
2
|
+
const CSS = `
|
|
3
|
+
.hu-slide { transition: transform var(--hu-duration) cubic-bezier(.4,0,.2,1), opacity var(--hu-duration) var(--hu-ease); }
|
|
4
|
+
.hu-slide--in { transform: translate(0,0); opacity: 1; }
|
|
5
|
+
.hu-slide--out { opacity: 0; pointer-events: none; }
|
|
6
|
+
.hu-slide--out-left { transform: translateX(-100%); }
|
|
7
|
+
.hu-slide--out-right { transform: translateX(100%); }
|
|
8
|
+
.hu-slide--out-up { transform: translateY(-100%); }
|
|
9
|
+
.hu-slide--out-down { transform: translateY(100%); }
|
|
10
|
+
`;
|
|
11
|
+
export function Slide(props) {
|
|
12
|
+
injectCSS("hu-slide", CSS);
|
|
13
|
+
const { in: isIn, direction = "down", unmountOnExit } = props;
|
|
14
|
+
if (!isIn && unmountOnExit)
|
|
15
|
+
return null;
|
|
16
|
+
const style = props.timeout ? `transition-duration:${props.timeout}ms` : undefined;
|
|
17
|
+
return h("div", {
|
|
18
|
+
class: cn("hu-slide", isIn ? "hu-slide--in" : `hu-slide--out hu-slide--out-${direction}`, props.class),
|
|
19
|
+
style
|
|
20
|
+
}, props.children);
|
|
21
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type VNode } from "../../theme/index.js";
|
|
2
|
+
export interface SliderProps {
|
|
3
|
+
value?: number;
|
|
4
|
+
defaultValue?: number;
|
|
5
|
+
min?: number;
|
|
6
|
+
max?: number;
|
|
7
|
+
step?: number;
|
|
8
|
+
size?: "sm" | "md" | "lg";
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
marks?: boolean | Array<{
|
|
11
|
+
value: number;
|
|
12
|
+
label?: string;
|
|
13
|
+
}>;
|
|
14
|
+
showValueLabel?: boolean;
|
|
15
|
+
onChange?: (value: number) => void;
|
|
16
|
+
class?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare function Slider(props: SliderProps): VNode;
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Slider/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,KAAK,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAiCpE,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC3D,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,KAAK,CAyBhD"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { signal } from "@hyperpackai/hyperion";
|
|
2
|
+
import { injectCSS, cn, h } from "../../theme/index.js";
|
|
3
|
+
const SLIDER_CSS = `
|
|
4
|
+
.hu-slider { display: flex; align-items: center; width: 100%; position: relative; padding: 12px 0; cursor: pointer; user-select: none; }
|
|
5
|
+
.hu-slider__track-bg {
|
|
6
|
+
width: 100%; height: 4px; border-radius: 2px;
|
|
7
|
+
background: var(--hu-border-2); position: relative;
|
|
8
|
+
}
|
|
9
|
+
.hu-slider__track-fill {
|
|
10
|
+
position: absolute; left: 0; top: 0; height: 100%; border-radius: 2px;
|
|
11
|
+
background: var(--hu-primary); transition: width 0ms;
|
|
12
|
+
}
|
|
13
|
+
.hu-slider__thumb {
|
|
14
|
+
position: absolute; top: 50%; transform: translate(-50%, -50%);
|
|
15
|
+
width: 18px; height: 18px; border-radius: 50%; background: var(--hu-primary);
|
|
16
|
+
box-shadow: 0 1px 4px rgba(0,0,0,.25); transition: box-shadow var(--hu-duration);
|
|
17
|
+
}
|
|
18
|
+
.hu-slider__thumb:hover { box-shadow: 0 0 0 8px var(--hu-primary-bg); }
|
|
19
|
+
.hu-slider:focus-within .hu-slider__thumb { box-shadow: 0 0 0 10px var(--hu-primary-bg); }
|
|
20
|
+
.hu-slider__input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; margin: 0; }
|
|
21
|
+
.hu-slider--disabled { opacity: .5; pointer-events: none; }
|
|
22
|
+
.hu-slider--sm .hu-slider__track-bg { height: 2px; }
|
|
23
|
+
.hu-slider--sm .hu-slider__thumb { width: 14px; height: 14px; }
|
|
24
|
+
.hu-slider--lg .hu-slider__track-bg { height: 6px; }
|
|
25
|
+
.hu-slider--lg .hu-slider__thumb { width: 22px; height: 22px; }
|
|
26
|
+
.hu-slider__mark { position: absolute; top: 50%; transform: translate(-50%, -50%); width: 6px; height: 6px; border-radius: 50%; background: var(--hu-primary-bg); border: 2px solid var(--hu-primary); }
|
|
27
|
+
.hu-slider__value-label {
|
|
28
|
+
position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%);
|
|
29
|
+
background: var(--hu-text); color: var(--hu-bg); font-size: 11px; padding: 2px 6px;
|
|
30
|
+
border-radius: var(--hu-radius-sm); white-space: nowrap; pointer-events: none;
|
|
31
|
+
}
|
|
32
|
+
`;
|
|
33
|
+
export function Slider(props) {
|
|
34
|
+
injectCSS("hu-slider", SLIDER_CSS);
|
|
35
|
+
const { min = 0, max = 100, step = 1, size = "md", disabled, onChange } = props;
|
|
36
|
+
const val = signal(props.value ?? props.defaultValue ?? 0);
|
|
37
|
+
const pct = () => ((val.value - min) / (max - min)) * 100;
|
|
38
|
+
return h("div", {
|
|
39
|
+
class: cn("hu-slider", `hu-slider--${size}`, disabled && "hu-slider--disabled", props.class)
|
|
40
|
+
}, h("div", { class: "hu-slider__track-bg" }, h("div", { class: "hu-slider__track-fill", style: `width:${pct()}%` }), h("div", { class: "hu-slider__thumb", style: `left:${pct()}%` }, props.showValueLabel && h("div", { class: "hu-slider__value-label" }, String(val.value)))), h("input", {
|
|
41
|
+
class: "hu-slider__input",
|
|
42
|
+
type: "range", min, max, step,
|
|
43
|
+
value: val.value, disabled,
|
|
44
|
+
onInput: (e) => {
|
|
45
|
+
val.value = Number(e.target.value);
|
|
46
|
+
onChange?.(val.value);
|
|
47
|
+
}
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type VNode } from "../../theme/index.js";
|
|
2
|
+
export type SnackbarSeverity = "default" | "success" | "error" | "warning" | "info";
|
|
3
|
+
export type SnackbarPosition = "bottom-left" | "bottom-center" | "bottom-right" | "top-left" | "top-center" | "top-right";
|
|
4
|
+
export interface SnackbarItem {
|
|
5
|
+
id: string;
|
|
6
|
+
message: string;
|
|
7
|
+
severity?: SnackbarSeverity;
|
|
8
|
+
action?: {
|
|
9
|
+
label: string;
|
|
10
|
+
onClick: () => void;
|
|
11
|
+
};
|
|
12
|
+
duration?: number;
|
|
13
|
+
}
|
|
14
|
+
export declare function useSnackbar(): {
|
|
15
|
+
show: (message: string, options?: Partial<Omit<SnackbarItem, "id" | "message">>) => string;
|
|
16
|
+
dismiss: (id: string) => void;
|
|
17
|
+
clear: () => void;
|
|
18
|
+
success: (msg: string, opts?: Partial<SnackbarItem>) => string;
|
|
19
|
+
error: (msg: string, opts?: Partial<SnackbarItem>) => string;
|
|
20
|
+
warning: (msg: string, opts?: Partial<SnackbarItem>) => string;
|
|
21
|
+
info: (msg: string, opts?: Partial<SnackbarItem>) => string;
|
|
22
|
+
};
|
|
23
|
+
export interface SnackbarRegionProps {
|
|
24
|
+
position?: SnackbarPosition;
|
|
25
|
+
maxItems?: number;
|
|
26
|
+
}
|
|
27
|
+
export declare function SnackbarRegion(props: SnackbarRegionProps): VNode;
|
|
28
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Snackbar/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,KAAK,KAAK,EAAE,MAAM,sBAAsB,CAAC;AA0CpE,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;AACpF,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG,eAAe,GAAG,cAAc,GAAG,UAAU,GAAG,YAAY,GAAG,WAAW,CAAC;AAE1H,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,MAAM,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,IAAI,CAAA;KAAE,CAAC;IAChD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAKD,wBAAgB,WAAW;oBACF,MAAM,YAAW,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,GAAG,SAAS,CAAC,CAAC;kBAShE,MAAM;;mBAGV,MAAM,SAAS,OAAO,CAAC,YAAY,CAAC;iBACpC,MAAM,SAAS,OAAO,CAAC,YAAY,CAAC;mBACpC,MAAM,SAAS,OAAO,CAAC,YAAY,CAAC;gBACpC,MAAM,SAAS,OAAO,CAAC,YAAY,CAAC;EAEtD;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,KAAK,CAiBhE"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { signal } from "@hyperpackai/hyperion";
|
|
2
|
+
import { injectCSS, cn, h } from "../../theme/index.js";
|
|
3
|
+
import { renderInPortal } from "../../portal.js";
|
|
4
|
+
const CSS = `
|
|
5
|
+
.hu-snackbar {
|
|
6
|
+
position: fixed; z-index: var(--hu-z-toast); pointer-events: none;
|
|
7
|
+
display: flex; flex-direction: column; gap: var(--hu-space-2);
|
|
8
|
+
max-width: min(480px, calc(100vw - 32px));
|
|
9
|
+
}
|
|
10
|
+
.hu-snackbar--bottom-left { bottom: var(--hu-space-4); left: var(--hu-space-4); }
|
|
11
|
+
.hu-snackbar--bottom-center { bottom: var(--hu-space-4); left: 50%; transform: translateX(-50%); }
|
|
12
|
+
.hu-snackbar--bottom-right { bottom: var(--hu-space-4); right: var(--hu-space-4); }
|
|
13
|
+
.hu-snackbar--top-left { top: var(--hu-space-4); left: var(--hu-space-4); }
|
|
14
|
+
.hu-snackbar--top-center { top: var(--hu-space-4); left: 50%; transform: translateX(-50%); }
|
|
15
|
+
.hu-snackbar--top-right { top: var(--hu-space-4); right: var(--hu-space-4); }
|
|
16
|
+
|
|
17
|
+
.hu-snackbar__item {
|
|
18
|
+
display: flex; align-items: center; gap: var(--hu-space-3);
|
|
19
|
+
min-width: min(280px, calc(100vw - 32px)); max-width: 480px;
|
|
20
|
+
padding: var(--hu-space-3) var(--hu-space-4); border-radius: var(--hu-radius-lg);
|
|
21
|
+
background: #1e293b; color: #f1f5f9; font-size: var(--hu-font-size-sm);
|
|
22
|
+
box-shadow: var(--hu-shadow-lg); pointer-events: all;
|
|
23
|
+
animation: hu-snack-in 200ms cubic-bezier(.34,1.56,.64,1) forwards;
|
|
24
|
+
}
|
|
25
|
+
.hu-snackbar__item--success { background: var(--hu-success); color: #fff; }
|
|
26
|
+
.hu-snackbar__item--error { background: var(--hu-error); color: #fff; }
|
|
27
|
+
.hu-snackbar__item--warning { background: var(--hu-warning); color: #fff; }
|
|
28
|
+
.hu-snackbar__item--info { background: var(--hu-info); color: #fff; }
|
|
29
|
+
.hu-snackbar__message { flex: 1; min-width: 0; line-height: var(--hu-line-height-normal); }
|
|
30
|
+
.hu-snackbar__action { background: none; border: none; color: inherit; cursor: pointer; font-weight: var(--hu-font-weight-semibold); font-size: var(--hu-font-size-sm); padding: 4px 8px; border-radius: var(--hu-radius-sm); opacity: .85; font-family: var(--hu-font-sans); }
|
|
31
|
+
.hu-snackbar__action:hover { opacity: 1; background: rgba(255,255,255,.1); }
|
|
32
|
+
.hu-snackbar__action:focus-visible,
|
|
33
|
+
.hu-snackbar__close:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
|
|
34
|
+
.hu-snackbar__close {
|
|
35
|
+
display: inline-flex; align-items: center; justify-content: center;
|
|
36
|
+
width: 26px; height: 26px; background: none; border: 1px solid transparent; border-radius: var(--hu-radius);
|
|
37
|
+
color: inherit; cursor: pointer; padding: 0; font-size: 18px; line-height: 1; opacity: .76;
|
|
38
|
+
}
|
|
39
|
+
.hu-snackbar__close:hover { opacity: 1; background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.18); }
|
|
40
|
+
@keyframes hu-snack-in { from { opacity: 0; transform: translateY(8px) scale(.96); } to { opacity: 1; transform: none; } }
|
|
41
|
+
`;
|
|
42
|
+
// Global snackbar queue
|
|
43
|
+
const _items = signal([]);
|
|
44
|
+
export function useSnackbar() {
|
|
45
|
+
const show = (message, options = {}) => {
|
|
46
|
+
const id = Math.random().toString(36).slice(2);
|
|
47
|
+
const item = { id, message, severity: "default", duration: 4000, ...options };
|
|
48
|
+
_items.value = [..._items.value, item];
|
|
49
|
+
if (item.duration && item.duration > 0) {
|
|
50
|
+
setTimeout(() => dismiss(id), item.duration);
|
|
51
|
+
}
|
|
52
|
+
return id;
|
|
53
|
+
};
|
|
54
|
+
const dismiss = (id) => { _items.value = _items.value.filter(i => i.id !== id); };
|
|
55
|
+
const clear = () => { _items.value = []; };
|
|
56
|
+
return { show, dismiss, clear,
|
|
57
|
+
success: (msg, opts) => show(msg, { severity: "success", ...opts }),
|
|
58
|
+
error: (msg, opts) => show(msg, { severity: "error", ...opts }),
|
|
59
|
+
warning: (msg, opts) => show(msg, { severity: "warning", ...opts }),
|
|
60
|
+
info: (msg, opts) => show(msg, { severity: "info", ...opts }),
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
export function SnackbarRegion(props) {
|
|
64
|
+
injectCSS("hu-snackbar", CSS);
|
|
65
|
+
const { position = "bottom-left", maxItems = 5 } = props;
|
|
66
|
+
const snackbar = useSnackbar();
|
|
67
|
+
return (() => {
|
|
68
|
+
const items = _items.value.slice(-maxItems);
|
|
69
|
+
return renderInPortal(h("div", { class: cn("hu-snackbar", `hu-snackbar--${position}`), "aria-live": "polite" }, ...items.map(item => h("div", { class: cn("hu-snackbar__item", item.severity !== "default" && `hu-snackbar__item--${item.severity}`), role: "alert" }, h("span", { class: "hu-snackbar__message" }, item.message), item.action && h("button", { class: "hu-snackbar__action", onClick: item.action.onClick }, item.action.label), h("button", { class: "hu-snackbar__close", onClick: () => snackbar.dismiss(item.id), "aria-label": "close" }, "×")))), "snackbar");
|
|
70
|
+
});
|
|
71
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type VNode } from "../../theme/index.js";
|
|
2
|
+
export interface SpeedDialAction {
|
|
3
|
+
icon: unknown;
|
|
4
|
+
label: string;
|
|
5
|
+
onClick: () => void;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export type SpeedDialDirection = "bottom-right" | "bottom-left" | "top-right" | "top-left";
|
|
9
|
+
export interface SpeedDialProps {
|
|
10
|
+
icon?: unknown;
|
|
11
|
+
openIcon?: unknown;
|
|
12
|
+
actions: SpeedDialAction[];
|
|
13
|
+
direction?: SpeedDialDirection;
|
|
14
|
+
backdrop?: boolean;
|
|
15
|
+
ariaLabel: string;
|
|
16
|
+
}
|
|
17
|
+
export declare function SpeedDial(props: SpeedDialProps): VNode;
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/SpeedDial/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,KAAK,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAmDpE,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,MAAM,kBAAkB,GAAG,cAAc,GAAG,aAAa,GAAG,WAAW,GAAG,UAAU,CAAC;AAE3F,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,SAAS,CAAC,EAAE,kBAAkB,CAAC;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,GAAG,KAAK,CAiCtD"}
|