@schandlergarcia/sf-web-components 1.5.0 → 1.7.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/components/library/heroui/Accordion.d.ts +6 -5
- package/dist/components/library/heroui/Accordion.js +7 -8
- package/dist/components/library/heroui/Accordion.js.map +1 -1
- package/dist/components/library/heroui/Alert.d.ts +6 -5
- package/dist/components/library/heroui/Alert.js +7 -8
- package/dist/components/library/heroui/Alert.js.map +1 -1
- package/dist/components/library/heroui/Badge.d.ts +8 -5
- package/dist/components/library/heroui/Badge.js +2 -3
- package/dist/components/library/heroui/Badge.js.map +1 -1
- package/dist/components/library/heroui/Breadcrumbs.d.ts +5 -2
- package/dist/components/library/heroui/Breadcrumbs.js +4 -5
- package/dist/components/library/heroui/Breadcrumbs.js.map +1 -1
- package/dist/components/library/heroui/Button.d.ts +16 -26
- package/dist/components/library/heroui/Button.js +21 -22
- package/dist/components/library/heroui/Button.js.map +1 -1
- package/dist/components/library/heroui/Card.d.ts +8 -5
- package/dist/components/library/heroui/Card.js +6 -7
- package/dist/components/library/heroui/Card.js.map +1 -1
- package/dist/components/library/heroui/Collapsible.d.ts +19 -30
- package/dist/components/library/heroui/Collapsible.js +13 -13
- package/dist/components/library/heroui/Collapsible.js.map +1 -1
- package/dist/components/library/heroui/DatePicker.d.ts +24 -52
- package/dist/components/library/heroui/DatePicker.js +5 -6
- package/dist/components/library/heroui/DatePicker.js.map +1 -1
- package/dist/components/library/heroui/Dialog.d.ts +18 -32
- package/dist/components/library/heroui/Dialog.js +6 -7
- package/dist/components/library/heroui/Dialog.js.map +1 -1
- package/dist/components/library/heroui/Drawer.d.ts +6 -2
- package/dist/components/library/heroui/Drawer.js +2 -3
- package/dist/components/library/heroui/Drawer.js.map +1 -1
- package/dist/components/library/heroui/Dropdown.d.ts +6 -2
- package/dist/components/library/heroui/Dropdown.js +2 -3
- package/dist/components/library/heroui/Dropdown.js.map +1 -1
- package/dist/components/library/heroui/Field.d.ts +19 -38
- package/dist/components/library/heroui/Field.js +9 -10
- package/dist/components/library/heroui/Field.js.map +1 -1
- package/dist/components/library/heroui/Meter.d.ts +7 -5
- package/dist/components/library/heroui/Meter.js +4 -5
- package/dist/components/library/heroui/Meter.js.map +1 -1
- package/dist/components/library/heroui/Modal.d.ts +6 -2
- package/dist/components/library/heroui/Modal.js +2 -3
- package/dist/components/library/heroui/Modal.js.map +1 -1
- package/dist/components/library/heroui/Pagination.d.ts +6 -2
- package/dist/components/library/heroui/Pagination.js +4 -5
- package/dist/components/library/heroui/Pagination.js.map +1 -1
- package/dist/components/library/heroui/Popover.d.ts +23 -38
- package/dist/components/library/heroui/Popover.js +12 -12
- package/dist/components/library/heroui/Popover.js.map +1 -1
- package/dist/components/library/heroui/ProgressBar.d.ts +8 -5
- package/dist/components/library/heroui/ProgressBar.js +0 -1
- package/dist/components/library/heroui/ProgressBar.js.map +1 -1
- package/dist/components/library/heroui/ProgressCircle.d.ts +8 -5
- package/dist/components/library/heroui/ProgressCircle.js +0 -1
- package/dist/components/library/heroui/ProgressCircle.js.map +1 -1
- package/dist/components/library/heroui/ScrollShadow.d.ts +8 -5
- package/dist/components/library/heroui/ScrollShadow.js +3 -4
- package/dist/components/library/heroui/ScrollShadow.js.map +1 -1
- package/dist/components/library/heroui/Select.d.ts +31 -37
- package/dist/components/library/heroui/Select.js +3 -4
- package/dist/components/library/heroui/Select.js.map +1 -1
- package/dist/components/library/heroui/Separator.d.ts +6 -2
- package/dist/components/library/heroui/Separator.js +4 -5
- package/dist/components/library/heroui/Separator.js.map +1 -1
- package/dist/components/library/heroui/Tabs.d.ts +6 -5
- package/dist/components/library/heroui/Tabs.js +7 -8
- package/dist/components/library/heroui/Tabs.js.map +1 -1
- package/dist/components/library/heroui/Toggle.d.ts +5 -4
- package/dist/components/library/heroui/Toggle.js +5 -6
- package/dist/components/library/heroui/Toggle.js.map +1 -1
- package/dist/components/library/heroui/Tooltip.d.ts +6 -2
- package/dist/components/library/heroui/Tooltip.js +2 -3
- package/dist/components/library/heroui/Tooltip.js.map +1 -1
- package/package.json +1 -1
- package/src/components/library/heroui/{Accordion.jsx → Accordion.tsx} +8 -3
- package/src/components/library/heroui/Alert.tsx +13 -0
- package/src/components/library/heroui/Badge.tsx +14 -0
- package/src/components/library/heroui/{Breadcrumbs.jsx → Breadcrumbs.tsx} +5 -2
- package/src/components/library/heroui/{Button.jsx → Button.tsx} +26 -8
- package/src/components/library/heroui/Card.tsx +14 -0
- package/src/components/library/heroui/Collapsible.tsx +62 -0
- package/src/components/library/heroui/{DatePicker.jsx → DatePicker.tsx} +28 -4
- package/src/components/library/heroui/Dialog.tsx +43 -0
- package/src/components/library/heroui/{Drawer.jsx → Drawer.tsx} +6 -2
- package/src/components/library/heroui/{Dropdown.jsx → Dropdown.tsx} +6 -2
- package/src/components/library/heroui/{Field.jsx → Field.tsx} +23 -6
- package/src/components/library/heroui/Meter.tsx +13 -0
- package/src/components/library/heroui/{Modal.jsx → Modal.tsx} +5 -2
- package/src/components/library/heroui/Pagination.tsx +11 -0
- package/src/components/library/heroui/{Popover.jsx → Popover.tsx} +29 -8
- package/src/components/library/heroui/ProgressBar.tsx +14 -0
- package/src/components/library/heroui/ProgressCircle.tsx +14 -0
- package/src/components/library/heroui/ScrollShadow.tsx +14 -0
- package/src/components/library/heroui/Select.tsx +73 -0
- package/src/components/library/heroui/Separator.tsx +11 -0
- package/src/components/library/heroui/{Tabs.jsx → Tabs.tsx} +8 -3
- package/src/components/library/heroui/{Toggle.jsx → Toggle.tsx} +6 -2
- package/src/components/library/heroui/{Tooltip.jsx → Tooltip.tsx} +5 -2
- package/src/components/library/heroui/Alert.jsx +0 -8
- package/src/components/library/heroui/Badge.jsx +0 -8
- package/src/components/library/heroui/Card.jsx +0 -8
- package/src/components/library/heroui/Collapsible.jsx +0 -42
- package/src/components/library/heroui/Dialog.jsx +0 -37
- package/src/components/library/heroui/Meter.jsx +0 -8
- package/src/components/library/heroui/Pagination.jsx +0 -8
- package/src/components/library/heroui/ProgressBar.jsx +0 -8
- package/src/components/library/heroui/ProgressCircle.jsx +0 -8
- package/src/components/library/heroui/ScrollShadow.jsx +0 -8
- package/src/components/library/heroui/Select.jsx +0 -37
- package/src/components/library/heroui/Separator.jsx +0 -8
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Modal } from "@heroui/react";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* HeroUI v3 Dialog — maps to Modal for shadcn compatibility.
|
|
6
|
+
*
|
|
7
|
+
* Sub-components via dot notation on the named `Modal` export:
|
|
8
|
+
* Modal.Backdrop, Modal.Container, Modal.Dialog,
|
|
9
|
+
* Modal.CloseTrigger, Modal.Header, Modal.Icon,
|
|
10
|
+
* Modal.Heading, Modal.Body, Modal.Footer
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* import { Dialog, DialogTrigger, DialogContent } from "@/components/library";
|
|
14
|
+
* <Dialog>
|
|
15
|
+
* <DialogTrigger>Open</DialogTrigger>
|
|
16
|
+
* <DialogContent>
|
|
17
|
+
* <DialogHeader><DialogTitle>Title</DialogTitle></DialogHeader>
|
|
18
|
+
* <DialogDescription>Content</DialogDescription>
|
|
19
|
+
* <DialogFooter>Actions</DialogFooter>
|
|
20
|
+
* </DialogContent>
|
|
21
|
+
* </Dialog>
|
|
22
|
+
*/
|
|
23
|
+
export interface HeroUIDialogProps {
|
|
24
|
+
children: React.ReactNode;
|
|
25
|
+
[key: string]: any;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default function HeroUIDialog(props: HeroUIDialogProps) {
|
|
29
|
+
return <Modal {...props} />;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Shadcn-compatible exports
|
|
33
|
+
export const Dialog = HeroUIDialog;
|
|
34
|
+
const ModalAny = Modal as any;
|
|
35
|
+
export const DialogTrigger = ModalAny.Trigger || ((props: any) => <button {...props} />);
|
|
36
|
+
export const DialogPortal = ({ children }: { children: React.ReactNode }) => <>{children}</>;
|
|
37
|
+
export const DialogClose = ModalAny.CloseTrigger || ((props: any) => <button {...props} />);
|
|
38
|
+
export const DialogOverlay = ModalAny.Backdrop || ((props: any) => <div {...props} />);
|
|
39
|
+
export const DialogContent = ModalAny.Dialog || ModalAny.Container || ((props: any) => <div {...props} />);
|
|
40
|
+
export const DialogHeader = ModalAny.Header || ((props: any) => <div {...props} />);
|
|
41
|
+
export const DialogFooter = ModalAny.Footer || ((props: any) => <div {...props} />);
|
|
42
|
+
export const DialogTitle = ModalAny.Heading || ((props: any) => <h2 {...props} />);
|
|
43
|
+
export const DialogDescription = (props: any) => <p {...props} />;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import { Drawer } from "@heroui/react";
|
|
3
2
|
|
|
4
3
|
/**
|
|
@@ -25,7 +24,12 @@ import { Drawer } from "@heroui/react";
|
|
|
25
24
|
* </Drawer.Backdrop>
|
|
26
25
|
* </Drawer>
|
|
27
26
|
*/
|
|
28
|
-
export
|
|
27
|
+
export interface HeroUIDrawerProps {
|
|
28
|
+
children: React.ReactNode;
|
|
29
|
+
[key: string]: any;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export default function HeroUIDrawer(props: HeroUIDrawerProps) {
|
|
29
33
|
return <Drawer {...props} />;
|
|
30
34
|
}
|
|
31
35
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import { Dropdown } from "@heroui/react";
|
|
3
2
|
|
|
4
3
|
/**
|
|
@@ -21,7 +20,12 @@ import { Dropdown } from "@heroui/react";
|
|
|
21
20
|
* </Dropdown.Popover>
|
|
22
21
|
* </Dropdown>
|
|
23
22
|
*/
|
|
24
|
-
export
|
|
23
|
+
export interface HeroUIDropdownProps {
|
|
24
|
+
children: React.ReactNode;
|
|
25
|
+
[key: string]: any;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default function HeroUIDropdown(props: HeroUIDropdownProps) {
|
|
25
29
|
return <Dropdown {...props} />;
|
|
26
30
|
}
|
|
27
31
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import * as React from "react";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* HeroUI v3 Field components — simple wrappers for form field layout.
|
|
@@ -11,7 +11,11 @@ import React from "react";
|
|
|
11
11
|
* <FieldError>Required</FieldError>
|
|
12
12
|
* </Field>
|
|
13
13
|
*/
|
|
14
|
-
export
|
|
14
|
+
export interface HeroUIFieldProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
15
|
+
children?: React.ReactNode;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default function HeroUIField({ className = "", children, ...props }: HeroUIFieldProps) {
|
|
15
19
|
return (
|
|
16
20
|
<div className={`flex flex-col gap-1.5 ${className}`} {...props}>
|
|
17
21
|
{children}
|
|
@@ -21,7 +25,11 @@ export default function HeroUIField({ className = "", children, ...props }) {
|
|
|
21
25
|
|
|
22
26
|
export const Field = HeroUIField;
|
|
23
27
|
|
|
24
|
-
export
|
|
28
|
+
export interface FieldLabelProps extends React.LabelHTMLAttributes<HTMLLabelElement> {
|
|
29
|
+
children?: React.ReactNode;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const FieldLabel = ({ className = "", htmlFor, children, ...props }: FieldLabelProps) => (
|
|
25
33
|
<label
|
|
26
34
|
htmlFor={htmlFor}
|
|
27
35
|
className={`text-sm font-medium text-slate-700 dark:text-slate-200 ${className}`}
|
|
@@ -31,15 +39,24 @@ export const FieldLabel = ({ className = "", htmlFor, children, ...props }) => (
|
|
|
31
39
|
</label>
|
|
32
40
|
);
|
|
33
41
|
|
|
34
|
-
export
|
|
42
|
+
export interface FieldDescriptionProps extends React.HTMLAttributes<HTMLParagraphElement> {
|
|
43
|
+
children?: React.ReactNode;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export const FieldDescription = ({ className = "", children, ...props }: FieldDescriptionProps) => (
|
|
35
47
|
<p className={`text-xs text-slate-500 dark:text-slate-400 ${className}`} {...props}>
|
|
36
48
|
{children}
|
|
37
49
|
</p>
|
|
38
50
|
);
|
|
39
51
|
|
|
40
|
-
export
|
|
52
|
+
export interface FieldErrorProps extends React.HTMLAttributes<HTMLParagraphElement> {
|
|
53
|
+
errors?: string[];
|
|
54
|
+
children?: React.ReactNode;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export const FieldError = ({ className = "", errors, children, ...props }: FieldErrorProps) => {
|
|
41
58
|
// Support both children and errors prop
|
|
42
|
-
const errorContent = errors
|
|
59
|
+
const errorContent = errors && errors.length > 0 ? errors.join(", ") : children;
|
|
43
60
|
|
|
44
61
|
if (!errorContent) return null;
|
|
45
62
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Meter } from "@heroui/react";
|
|
3
|
+
|
|
4
|
+
export interface HeroUIMeterProps {
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export default function HeroUIMeter({ children, ...props }: HeroUIMeterProps) {
|
|
10
|
+
return <Meter {...props}>{children}</Meter>;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { Meter };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import { Modal } from "@heroui/react";
|
|
2
|
+
import type { ModalProps } from "@heroui/react";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* HeroUI v3 Modal — compound component.
|
|
@@ -25,8 +25,11 @@ import { Modal } from "@heroui/react";
|
|
|
25
25
|
* </Modal.Backdrop>
|
|
26
26
|
* </Modal>
|
|
27
27
|
*/
|
|
28
|
-
export
|
|
28
|
+
export interface HeroUIModalProps extends ModalProps {}
|
|
29
|
+
|
|
30
|
+
export default function HeroUIModal(props: HeroUIModalProps) {
|
|
29
31
|
return <Modal {...props} />;
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
export { Modal };
|
|
35
|
+
export type { ModalProps };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Pagination } from "@heroui/react";
|
|
2
|
+
import type { PaginationProps } from "@heroui/react";
|
|
3
|
+
|
|
4
|
+
export interface HeroUIPaginationProps extends PaginationProps {}
|
|
5
|
+
|
|
6
|
+
export default function HeroUIPagination(props: HeroUIPaginationProps) {
|
|
7
|
+
return <Pagination {...props} />;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { Pagination };
|
|
11
|
+
export type { PaginationProps };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import * as React from "react";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* HeroUI v3 Popover — simple popover for shadcn compatibility.
|
|
@@ -11,12 +11,18 @@ import React from "react";
|
|
|
11
11
|
* <PopoverContent>Content</PopoverContent>
|
|
12
12
|
* </Popover>
|
|
13
13
|
*/
|
|
14
|
-
export
|
|
14
|
+
export interface HeroUIPopoverProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
15
|
+
children?: React.ReactNode;
|
|
16
|
+
open?: boolean;
|
|
17
|
+
onOpenChange?: (open: boolean) => void;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default function HeroUIPopover({ children, open, onOpenChange, ...props }: HeroUIPopoverProps) {
|
|
15
21
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
16
22
|
const isControlled = open !== undefined;
|
|
17
23
|
const actualOpen = isControlled ? open : isOpen;
|
|
18
24
|
|
|
19
|
-
const handleOpenChange = (newOpen) => {
|
|
25
|
+
const handleOpenChange = (newOpen: boolean) => {
|
|
20
26
|
if (!isControlled) setIsOpen(newOpen);
|
|
21
27
|
onOpenChange?.(newOpen);
|
|
22
28
|
};
|
|
@@ -25,7 +31,7 @@ export default function HeroUIPopover({ children, open, onOpenChange, ...props }
|
|
|
25
31
|
<div className="relative inline-block" {...props}>
|
|
26
32
|
{React.Children.map(children, (child) => {
|
|
27
33
|
if (React.isValidElement(child)) {
|
|
28
|
-
return React.cloneElement(child, { open: actualOpen, onOpenChange: handleOpenChange });
|
|
34
|
+
return React.cloneElement(child, { open: actualOpen, onOpenChange: handleOpenChange } as any);
|
|
29
35
|
}
|
|
30
36
|
return child;
|
|
31
37
|
})}
|
|
@@ -35,7 +41,15 @@ export default function HeroUIPopover({ children, open, onOpenChange, ...props }
|
|
|
35
41
|
|
|
36
42
|
export const Popover = HeroUIPopover;
|
|
37
43
|
|
|
38
|
-
export
|
|
44
|
+
export interface PopoverTriggerProps {
|
|
45
|
+
children?: React.ReactNode;
|
|
46
|
+
open?: boolean;
|
|
47
|
+
onOpenChange?: (open: boolean) => void;
|
|
48
|
+
asChild?: boolean;
|
|
49
|
+
[key: string]: any;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export const PopoverTrigger = ({ children, open, onOpenChange, asChild, ...props }: PopoverTriggerProps) => {
|
|
39
53
|
const handleClick = () => onOpenChange?.(!open);
|
|
40
54
|
|
|
41
55
|
// If asChild is true, clone the child element with the props
|
|
@@ -43,7 +57,7 @@ export const PopoverTrigger = ({ children, open, onOpenChange, asChild, ...props
|
|
|
43
57
|
return React.cloneElement(children, {
|
|
44
58
|
...props,
|
|
45
59
|
onClick: handleClick,
|
|
46
|
-
});
|
|
60
|
+
} as any);
|
|
47
61
|
}
|
|
48
62
|
|
|
49
63
|
// Otherwise, wrap in a button
|
|
@@ -54,10 +68,17 @@ export const PopoverTrigger = ({ children, open, onOpenChange, asChild, ...props
|
|
|
54
68
|
);
|
|
55
69
|
};
|
|
56
70
|
|
|
57
|
-
export
|
|
71
|
+
export interface PopoverContentProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
72
|
+
children?: React.ReactNode;
|
|
73
|
+
open?: boolean;
|
|
74
|
+
align?: "start" | "center" | "end";
|
|
75
|
+
sideOffset?: number;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export const PopoverContent = ({ children, open, className = "", align = "center", sideOffset = 4, ...props }: PopoverContentProps) => {
|
|
58
79
|
if (!open) return null;
|
|
59
80
|
|
|
60
|
-
const alignClasses = {
|
|
81
|
+
const alignClasses: Record<string, string> = {
|
|
61
82
|
start: "left-0",
|
|
62
83
|
center: "left-1/2 -translate-x-1/2",
|
|
63
84
|
end: "right-0"
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { ProgressBar } from "@heroui/react";
|
|
3
|
+
import type { ProgressBarProps } from "@heroui/react";
|
|
4
|
+
|
|
5
|
+
export interface HeroUIProgressBarProps extends ProgressBarProps {
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export default function HeroUIProgressBar({ children, ...props }: HeroUIProgressBarProps) {
|
|
10
|
+
return <ProgressBar {...props}>{children}</ProgressBar>;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { ProgressBar };
|
|
14
|
+
export type { ProgressBarProps };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { ProgressCircle } from "@heroui/react";
|
|
3
|
+
import type { ProgressCircleProps } from "@heroui/react";
|
|
4
|
+
|
|
5
|
+
export interface HeroUIProgressCircleProps extends ProgressCircleProps {
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export default function HeroUIProgressCircle({ children, ...props }: HeroUIProgressCircleProps) {
|
|
10
|
+
return <ProgressCircle {...props}>{children}</ProgressCircle>;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { ProgressCircle };
|
|
14
|
+
export type { ProgressCircleProps };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { ScrollShadow } from "@heroui/react";
|
|
3
|
+
import type { ScrollShadowProps } from "@heroui/react";
|
|
4
|
+
|
|
5
|
+
export interface HeroUIScrollShadowProps extends ScrollShadowProps {
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export default function HeroUIScrollShadow({ children, ...props }: HeroUIScrollShadowProps) {
|
|
10
|
+
return <ScrollShadow {...props}>{children}</ScrollShadow>;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { ScrollShadow };
|
|
14
|
+
export type { ScrollShadowProps };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Select as HeroSelect } from "@heroui/react";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* HeroUI v3 Select wrapper with shadcn compatibility.
|
|
6
|
+
*
|
|
7
|
+
* Translates shadcn API to HeroUI:
|
|
8
|
+
* - onValueChange -> onSelectionChange
|
|
9
|
+
* - value -> selectedKeys
|
|
10
|
+
*/
|
|
11
|
+
export interface HeroUISelectProps {
|
|
12
|
+
value?: string;
|
|
13
|
+
onValueChange?: (value: string) => void;
|
|
14
|
+
children?: React.ReactNode;
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default function HeroUISelect({ value, onValueChange, children, ...props }: HeroUISelectProps) {
|
|
19
|
+
// Translate shadcn API to HeroUI API
|
|
20
|
+
const selectedKeys = value ? [value] : [];
|
|
21
|
+
const handleSelectionChange = (keys: any) => {
|
|
22
|
+
const selected = Array.from(keys)[0] as string;
|
|
23
|
+
onValueChange?.(selected || "");
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const HeroSelectAny = HeroSelect as any;
|
|
27
|
+
return (
|
|
28
|
+
<HeroSelectAny
|
|
29
|
+
selectedKeys={selectedKeys}
|
|
30
|
+
onSelectionChange={handleSelectionChange}
|
|
31
|
+
{...props}
|
|
32
|
+
>
|
|
33
|
+
{children}
|
|
34
|
+
</HeroSelectAny>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// For direct HeroUI usage
|
|
39
|
+
export const Select = HeroUISelect;
|
|
40
|
+
|
|
41
|
+
// Shadcn-compatible subcomponents that just pass through children
|
|
42
|
+
export interface SelectTriggerProps {
|
|
43
|
+
children?: React.ReactNode;
|
|
44
|
+
size?: string;
|
|
45
|
+
[key: string]: any;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export const SelectTrigger = ({ children }: SelectTriggerProps) => <>{children}</>;
|
|
49
|
+
|
|
50
|
+
export interface SelectValueProps {
|
|
51
|
+
placeholder?: string;
|
|
52
|
+
[key: string]: any;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export const SelectValue = ({ placeholder }: SelectValueProps) => <span>{placeholder}</span>;
|
|
56
|
+
|
|
57
|
+
export interface SelectContentProps {
|
|
58
|
+
children?: React.ReactNode;
|
|
59
|
+
[key: string]: any;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export const SelectContent = ({ children }: SelectContentProps) => <>{children}</>;
|
|
63
|
+
|
|
64
|
+
export interface SelectItemProps {
|
|
65
|
+
value: string;
|
|
66
|
+
children?: React.ReactNode;
|
|
67
|
+
[key: string]: any;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export const SelectItem = ({ value, children, ...props }: SelectItemProps) => {
|
|
71
|
+
const HeroSelectAny = HeroSelect as any;
|
|
72
|
+
return <HeroSelectAny.Item key={value} {...props}>{children}</HeroSelectAny.Item>;
|
|
73
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Separator } from "@heroui/react";
|
|
2
|
+
import type { SeparatorProps } from "@heroui/react";
|
|
3
|
+
|
|
4
|
+
export interface HeroUISeparatorProps extends SeparatorProps {}
|
|
5
|
+
|
|
6
|
+
export default function HeroUISeparator(props: HeroUISeparatorProps) {
|
|
7
|
+
return <Separator {...props} />;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { Separator };
|
|
11
|
+
export type { SeparatorProps };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import { Tabs } from "@heroui/react";
|
|
3
2
|
|
|
4
3
|
/**
|
|
@@ -19,8 +18,14 @@ import { Tabs } from "@heroui/react";
|
|
|
19
18
|
* <Tabs.Panel id="analytics">…</Tabs.Panel>
|
|
20
19
|
* </Tabs>
|
|
21
20
|
*/
|
|
22
|
-
export
|
|
23
|
-
|
|
21
|
+
export interface HeroUITabsProps {
|
|
22
|
+
variant?: string;
|
|
23
|
+
[key: string]: any;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export default function HeroUITabs({ variant = "primary", ...props }: HeroUITabsProps) {
|
|
27
|
+
const TabsAny = Tabs as any;
|
|
28
|
+
return <TabsAny variant={variant} {...props} />;
|
|
24
29
|
}
|
|
25
30
|
|
|
26
31
|
export { Tabs };
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import { Switch } from "@heroui/react";
|
|
2
|
+
import type { SwitchProps } from "@heroui/react";
|
|
3
3
|
import { useThemeMode } from "../theme/AppThemeProvider";
|
|
4
4
|
|
|
5
|
-
export
|
|
5
|
+
export interface HeroUIToggleProps extends Omit<SwitchProps, 'isSelected' | 'onChange'> {
|
|
6
|
+
label?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export default function HeroUIToggle({ label = "Dark mode", ...props }: HeroUIToggleProps) {
|
|
6
10
|
const { mode, toggle } = useThemeMode();
|
|
7
11
|
const isSelected = mode === "dark";
|
|
8
12
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import { Tooltip } from "@heroui/react";
|
|
2
|
+
import type { TooltipProps } from "@heroui/react";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* HeroUI v3 Tooltip — compound component.
|
|
@@ -14,8 +14,11 @@ import { Tooltip } from "@heroui/react";
|
|
|
14
14
|
* <Tooltip.Content>Helpful info</Tooltip.Content>
|
|
15
15
|
* </Tooltip>
|
|
16
16
|
*/
|
|
17
|
-
export
|
|
17
|
+
export interface HeroUITooltipProps extends TooltipProps {}
|
|
18
|
+
|
|
19
|
+
export default function HeroUITooltip(props: HeroUITooltipProps) {
|
|
18
20
|
return <Tooltip {...props} />;
|
|
19
21
|
}
|
|
20
22
|
|
|
21
23
|
export { Tooltip };
|
|
24
|
+
export type { TooltipProps };
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Accordion } from "@heroui/react";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* HeroUI v3 Collapsible — maps to Accordion for shadcn compatibility.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* import { Collapsible, CollapsibleTrigger, CollapsibleContent } from "@/components/library";
|
|
9
|
-
* <Collapsible open={isOpen} onOpenChange={setIsOpen}>
|
|
10
|
-
* <CollapsibleTrigger>Toggle</CollapsibleTrigger>
|
|
11
|
-
* <CollapsibleContent>Content</CollapsibleContent>
|
|
12
|
-
* </Collapsible>
|
|
13
|
-
*/
|
|
14
|
-
export default function HeroUICollapsible({ open, onOpenChange, children, ...props }) {
|
|
15
|
-
// Map shadcn props to HeroUI Accordion
|
|
16
|
-
const selectedKeys = open ? ["item"] : [];
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<Accordion
|
|
20
|
-
selectedKeys={selectedKeys}
|
|
21
|
-
onSelectionChange={(keys) => {
|
|
22
|
-
const isOpen = Array.from(keys).includes("item");
|
|
23
|
-
onOpenChange?.(isOpen);
|
|
24
|
-
}}
|
|
25
|
-
{...props}
|
|
26
|
-
>
|
|
27
|
-
<Accordion.Item key="item" aria-label="Collapsible content">
|
|
28
|
-
{children}
|
|
29
|
-
</Accordion.Item>
|
|
30
|
-
</Accordion>
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export const Collapsible = HeroUICollapsible;
|
|
35
|
-
|
|
36
|
-
export const CollapsibleTrigger = ({ children, ...props }) => (
|
|
37
|
-
<Accordion.Trigger {...props}>{children}</Accordion.Trigger>
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
export const CollapsibleContent = ({ children, ...props }) => (
|
|
41
|
-
<Accordion.Panel {...props}>{children}</Accordion.Panel>
|
|
42
|
-
);
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Modal } from "@heroui/react";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* HeroUI v3 Dialog — maps to Modal for shadcn compatibility.
|
|
6
|
-
*
|
|
7
|
-
* Sub-components via dot notation on the named `Modal` export:
|
|
8
|
-
* Modal.Backdrop, Modal.Container, Modal.Dialog,
|
|
9
|
-
* Modal.CloseTrigger, Modal.Header, Modal.Icon,
|
|
10
|
-
* Modal.Heading, Modal.Body, Modal.Footer
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* import { Dialog, DialogTrigger, DialogContent } from "@/components/library";
|
|
14
|
-
* <Dialog>
|
|
15
|
-
* <DialogTrigger>Open</DialogTrigger>
|
|
16
|
-
* <DialogContent>
|
|
17
|
-
* <DialogHeader><DialogTitle>Title</DialogTitle></DialogHeader>
|
|
18
|
-
* <DialogDescription>Content</DialogDescription>
|
|
19
|
-
* <DialogFooter>Actions</DialogFooter>
|
|
20
|
-
* </DialogContent>
|
|
21
|
-
* </Dialog>
|
|
22
|
-
*/
|
|
23
|
-
export default function HeroUIDialog(props) {
|
|
24
|
-
return <Modal {...props} />;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// Shadcn-compatible exports
|
|
28
|
-
export const Dialog = HeroUIDialog;
|
|
29
|
-
export const DialogTrigger = Modal.Trigger || (props => <button {...props} />);
|
|
30
|
-
export const DialogPortal = ({ children }) => <>{children}</>;
|
|
31
|
-
export const DialogClose = Modal.CloseTrigger || (props => <button {...props} />);
|
|
32
|
-
export const DialogOverlay = Modal.Backdrop || (props => <div {...props} />);
|
|
33
|
-
export const DialogContent = Modal.Dialog || Modal.Container || (props => <div {...props} />);
|
|
34
|
-
export const DialogHeader = Modal.Header || (props => <div {...props} />);
|
|
35
|
-
export const DialogFooter = Modal.Footer || (props => <div {...props} />);
|
|
36
|
-
export const DialogTitle = Modal.Heading || (props => <h2 {...props} />);
|
|
37
|
-
export const DialogDescription = (props) => <p {...props} />;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Select as HeroSelect } from "@heroui/react";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* HeroUI v3 Select wrapper with shadcn compatibility.
|
|
6
|
-
*
|
|
7
|
-
* Translates shadcn API to HeroUI:
|
|
8
|
-
* - onValueChange -> onSelectionChange
|
|
9
|
-
* - value -> selectedKeys
|
|
10
|
-
*/
|
|
11
|
-
export default function HeroUISelect({ value, onValueChange, children, ...props }) {
|
|
12
|
-
// Translate shadcn API to HeroUI API
|
|
13
|
-
const selectedKeys = value ? [value] : [];
|
|
14
|
-
const handleSelectionChange = (keys) => {
|
|
15
|
-
const selected = Array.from(keys)[0];
|
|
16
|
-
onValueChange?.(selected || "");
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<HeroSelect
|
|
21
|
-
selectedKeys={selectedKeys}
|
|
22
|
-
onSelectionChange={handleSelectionChange}
|
|
23
|
-
{...props}
|
|
24
|
-
>
|
|
25
|
-
{children}
|
|
26
|
-
</HeroSelect>
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// For direct HeroUI usage
|
|
31
|
-
export const Select = HeroUISelect;
|
|
32
|
-
|
|
33
|
-
// Shadcn-compatible subcomponents that just pass through children
|
|
34
|
-
export const SelectTrigger = ({ children, size, ...props }) => <>{children}</>;
|
|
35
|
-
export const SelectValue = ({ placeholder, ...props }) => <span {...props}>{placeholder}</span>;
|
|
36
|
-
export const SelectContent = ({ children, ...props }) => <>{children}</>;
|
|
37
|
-
export const SelectItem = ({ value, children, ...props }) => <HeroSelect.Item key={value} {...props}>{children}</HeroSelect.Item>;
|