@nucleux/sheet 0.4.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.tsx"],"names":["React","jsx","jsxs","cn","X"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,IAAM,YAAA,GAAqBA,+BAAwC,IAAI,CAAA;AAIvE,IAAM,WAAA,GAAyC;AAAA,EAC7C,KAAA,EAAO,mDAAA;AAAA,EACP,IAAA,EAAM,kDAAA;AAAA,EACN,GAAA,EAAK,iCAAA;AAAA,EACL,MAAA,EAAQ;AACV,CAAA;AAqBO,SAAS,KAAA,CAAM;AAAA,EACpB,IAAA;AAAA,EACA,YAAA;AAAA,EACA,IAAA,GAAO,OAAA;AAAA,EACP,QAAA;AAAA,EACA,SAAA;AAAA,EACA,WAAA,GAAc;AAChB,CAAA,EAAe;AACb,EAAA,MAAM,SAAeA,gBAAA,CAAA,KAAA,EAAM;AAC3B,EAAA,MAAM,QAAA,GAAiBA,wBAAuB,IAAI,CAAA;AAClD,EAAA,MAAM,KAAA,GAAcA,6BAAY,MAAM,YAAA,CAAa,KAAK,CAAA,EAAG,CAAC,YAAY,CAAC,CAAA;AAEzE,EAAMA,2BAAU,MAAM;AACpB,IAAA,IAAI,CAAC,IAAA,IAAQ,CAAC,WAAA,EAAa;AAC3B,IAAA,MAAM,KAAA,GAAQ,CAAC,CAAA,KAAqB;AAClC,MAAA,IAAI,CAAA,CAAE,GAAA,KAAQ,QAAA,EAAU,KAAA,EAAM;AAAA,IAChC,CAAA;AACA,IAAA,QAAA,CAAS,gBAAA,CAAiB,WAAW,KAAK,CAAA;AAC1C,IAAA,OAAO,MAAM,QAAA,CAAS,mBAAA,CAAoB,SAAA,EAAW,KAAK,CAAA;AAAA,EAC5D,CAAA,EAAG,CAAC,IAAA,EAAM,WAAA,EAAa,KAAK,CAAC,CAAA;AAE7B,EAAMA,2BAAU,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EJ;AACF;AACA,UAAA,CAAW,WAAA,GAAc,YAAA","file":"index.cjs","sourcesContent":["import * as React from \"react\";\nimport { X } from \"lucide-react\";\nimport { cn } from \"@nucleux/utils\";\n\ninterface SheetContextValue {\n titleId: string;\n descriptionId: string;\n onClose: () => void;\n}\nconst SheetContext = React.createContext<SheetContextValue | null>(null);\n\nexport type SheetSide = \"right\" | \"left\" | \"top\" | \"bottom\";\n\nconst sideClasses: Record<SheetSide, string> = {\n right: \"inset-y-0 right-0 h-full w-full max-w-sm border-l\",\n left: \"inset-y-0 left-0 h-full w-full max-w-sm border-r\",\n top: \"inset-x-0 top-0 w-full border-b\",\n bottom: \"inset-x-0 bottom-0 w-full border-t\",\n};\n\nexport interface SheetProps {\n /** Whether the sheet is open. */\n open: boolean;\n /** Called when the sheet requests to close (overlay click / Escape / close button). */\n onOpenChange: (open: boolean) => void;\n /** Which edge the sheet slides in from. */\n side?: SheetSide;\n /** Panel content — compose SheetHeader/Title/Description/Body/Footer. */\n children: React.ReactNode;\n /** Class overrides for the panel. */\n className?: string;\n /** Disable closing on overlay click / Escape. */\n dismissible?: boolean;\n}\n\n/**\n * A slide-over drawer anchored to a screen edge. Controlled via `open` /\n * `onOpenChange`; closes on overlay click, Escape, or {@link SheetClose}.\n */\nexport function Sheet({\n open,\n onOpenChange,\n side = \"right\",\n children,\n className,\n dismissible = true,\n}: SheetProps) {\n const baseId = React.useId();\n const panelRef = React.useRef<HTMLDivElement>(null);\n const close = React.useCallback(() => onOpenChange(false), [onOpenChange]);\n\n React.useEffect(() => {\n if (!open || !dismissible) return;\n const onKey = (e: KeyboardEvent) => {\n if (e.key === \"Escape\") close();\n };\n document.addEventListener(\"keydown\", onKey);\n return () => document.removeEventListener(\"keydown\", onKey);\n }, [open, dismissible, close]);\n\n React.useEffect(() => {\n if (open) panelRef.current?.focus();\n }, [open]);\n\n if (!open) return null;\n\n return (\n <SheetContext.Provider\n value={{ titleId: `${baseId}-title`, descriptionId: `${baseId}-desc`, onClose: close }}\n >\n <div className=\"fixed inset-0 z-50\">\n <div\n aria-hidden\n className=\"absolute inset-0 bg-foreground/50 animate-nx-fade-in\"\n onClick={dismissible ? close : undefined}\n />\n <div\n ref={panelRef}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={`${baseId}-title`}\n aria-describedby={`${baseId}-desc`}\n tabIndex={-1}\n className={cn(\n \"absolute flex flex-col border-border bg-background shadow-lg outline-none animate-nx-fade-in\",\n sideClasses[side],\n className,\n )}\n >\n {children}\n </div>\n </div>\n </SheetContext.Provider>\n );\n}\n\nexport const SheetHeader = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, children, ...props }, ref) => {\n const ctx = React.useContext(SheetContext);\n return (\n <div\n ref={ref}\n className={cn(\"flex items-center justify-between gap-4 border-b border-border p-4\", className)}\n {...props}\n >\n <div className=\"min-w-0 flex-1\">{children}</div>\n <button\n type=\"button\"\n aria-label=\"Close\"\n onClick={ctx?.onClose}\n className=\"shrink-0 rounded p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n <X className=\"size-4\" />\n </button>\n </div>\n );\n },\n);\nSheetHeader.displayName = \"SheetHeader\";\n\nexport const SheetTitle = React.forwardRef<HTMLHeadingElement, React.HTMLAttributes<HTMLHeadingElement>>(\n ({ className, ...props }, ref) => {\n const ctx = React.useContext(SheetContext);\n return (\n <h2\n ref={ref}\n id={ctx?.titleId}\n className={cn(\"text-sm font-semibold text-foreground\", className)}\n {...props}\n />\n );\n },\n);\nSheetTitle.displayName = \"SheetTitle\";\n\nexport const SheetDescription = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, ...props }, ref) => {\n const ctx = React.useContext(SheetContext);\n return (\n <p ref={ref} id={ctx?.descriptionId} className={cn(\"text-sm text-muted-foreground\", className)} {...props} />\n );\n});\nSheetDescription.displayName = \"SheetDescription\";\n\nexport const SheetBody = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => (\n <div ref={ref} className={cn(\"min-h-0 flex-1 overflow-y-auto p-4\", className)} {...props} />\n ),\n);\nSheetBody.displayName = \"SheetBody\";\n\nexport const SheetFooter = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\"flex items-center justify-end gap-2 border-t border-border p-4\", className)}\n {...props}\n />\n ),\n);\nSheetFooter.displayName = \"SheetFooter\";\n\n/** A button that closes the enclosing Sheet. */\nexport const SheetClose = React.forwardRef<HTMLButtonElement, React.ButtonHTMLAttributes<HTMLButtonElement>>(\n ({ onClick, type = \"button\", ...props }, ref) => {\n const ctx = React.useContext(SheetContext);\n return (\n <button\n ref={ref}\n type={type}\n onClick={(e) => {\n onClick?.(e);\n ctx?.onClose();\n }}\n {...props}\n />\n );\n },\n);\nSheetClose.displayName = \"SheetClose\";\n"]}
1
+ {"version":3,"sources":["../src/index.tsx"],"names":["React","jsx","jsxs","cn","X"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,IAAM,YAAA,GAAqBA,+BAAwC,IAAI,CAAA;AAIvE,IAAM,WAAA,GAAyC;AAAA,EAC7C,KAAA,EAAO,mDAAA;AAAA,EACP,IAAA,EAAM,kDAAA;AAAA,EACN,GAAA,EAAK,iCAAA;AAAA,EACL,MAAA,EAAQ;AACV,CAAA;AAqBO,SAAS,KAAA,CAAM;AAAA,EACpB,IAAA;AAAA,EACA,YAAA;AAAA,EACA,IAAA,GAAO,OAAA;AAAA,EACP,QAAA;AAAA,EACA,SAAA;AAAA,EACA,WAAA,GAAc;AAChB,CAAA,EAAe;AACb,EAAA,MAAM,SAAeA,gBAAA,CAAA,KAAA,EAAM;AAC3B,EAAA,MAAM,QAAA,GAAiBA,wBAAuB,IAAI,CAAA;AAClD,EAAA,MAAM,KAAA,GAAcA,6B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AAA,MACxF,GAAG;AAAA;AAAA;AAGV;AACA,WAAA,CAAY,WAAA,GAAc,aAAA;AAWnB,IAAM,UAAA,GAAmBH,gBAAA,CAAA,UAAA;AAAA,EAC9B,CAAC,EAAE,OAAA,EAAS,IAAA,GAAO,UAAU,GAAG,KAAA,IAAS,GAAA,KAAQ;AAC/C,IAAA,MAAM,GAAA,GAAYA,4BAAW,YAAY,CAAA;AACzC,IAAA,uBACEC,cAAA;AAAA,MAAC,QAAA;AAAA,MAAA;AAAA,QACC,GAAA;AAAA,QACA,IAAA;AAAA,QACA,OAAA,EAAS,CAAC,CAAA,KAAM;AACd,UAAA,OAAA,GAAU,CAAC,CAAA;AACX,UAAA,GAAA,EAAK,OAAA,EAAQ;AAAA,QACf,CAAA;AAAA,QACC,GAAG;AAAA;AAAA,KACN;AAAA,EAEJ;AACF;AACA,UAAA,CAAW,WAAA,GAAc,YAAA","file":"index.cjs","sourcesContent":["import * as React from \"react\";\nimport { X } from \"lucide-react\";\nimport { cn } from \"@nucleux/utils\";\n\ninterface SheetContextValue {\n titleId: string;\n descriptionId: string;\n onClose: () => void;\n}\nconst SheetContext = React.createContext<SheetContextValue | null>(null);\n\nexport type SheetSide = \"right\" | \"left\" | \"top\" | \"bottom\";\n\nconst sideClasses: Record<SheetSide, string> = {\n right: \"inset-y-0 right-0 h-full w-full max-w-sm border-l\",\n left: \"inset-y-0 left-0 h-full w-full max-w-sm border-r\",\n top: \"inset-x-0 top-0 w-full border-b\",\n bottom: \"inset-x-0 bottom-0 w-full border-t\",\n};\n\nexport interface SheetProps {\n /** Whether the sheet is open. */\n open: boolean;\n /** Called when the sheet requests to close (overlay click / Escape / close button). */\n onOpenChange: (open: boolean) => void;\n /** Which edge the sheet slides in from. */\n side?: SheetSide;\n /** Panel content — compose SheetHeader/Title/Description/Body/Footer. */\n children: React.ReactNode;\n /** Class overrides for the panel. */\n className?: string;\n /** Disable closing on overlay click / Escape. */\n dismissible?: boolean;\n}\n\n/**\n * A slide-over drawer anchored to a screen edge. Controlled via `open` /\n * `onOpenChange`; closes on overlay click, Escape, or {@link SheetClose}.\n */\nexport function Sheet({\n open,\n onOpenChange,\n side = \"right\",\n children,\n className,\n dismissible = true,\n}: SheetProps) {\n const baseId = React.useId();\n const panelRef = React.useRef<HTMLDivElement>(null);\n const close = React.useCallback(() => onOpenChange(false), [onOpenChange]);\n\n React.useEffect(() => {\n if (!open || !dismissible) return;\n const onKey = (e: KeyboardEvent) => {\n if (e.key === \"Escape\") close();\n };\n document.addEventListener(\"keydown\", onKey);\n return () => document.removeEventListener(\"keydown\", onKey);\n }, [open, dismissible, close]);\n\n React.useEffect(() => {\n if (open) panelRef.current?.focus();\n }, [open]);\n\n if (!open) return null;\n\n return (\n <SheetContext.Provider\n value={{ titleId: `${baseId}-title`, descriptionId: `${baseId}-desc`, onClose: close }}\n >\n <div className=\"fixed inset-0 z-50\">\n <div\n aria-hidden\n className=\"absolute inset-0 bg-foreground/50 animate-nx-fade-in\"\n onClick={dismissible ? close : undefined}\n />\n <div\n ref={panelRef}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={`${baseId}-title`}\n aria-describedby={`${baseId}-desc`}\n tabIndex={-1}\n className={cn(\n \"absolute flex flex-col border-border bg-background shadow-lg outline-none animate-nx-fade-in\",\n sideClasses[side],\n className,\n )}\n >\n {children}\n </div>\n </div>\n </SheetContext.Provider>\n );\n}\n\nexport interface SheetHeaderProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Additional classes merged onto the sheet header. */\n className?: string;\n}\n\n/** Sheet header slot: SheetTitle + SheetDescription, with a close button. */\nexport const SheetHeader = React.forwardRef<HTMLDivElement, SheetHeaderProps>(\n ({ className, children, ...props }, ref) => {\n const ctx = React.useContext(SheetContext);\n return (\n <div\n ref={ref}\n className={cn(\"flex items-center justify-between gap-4 border-b border-border p-4\", className)}\n {...props}\n >\n <div className=\"min-w-0 flex-1\">{children}</div>\n <button\n type=\"button\"\n aria-label=\"Close\"\n onClick={ctx?.onClose}\n className=\"shrink-0 rounded p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n <X className=\"size-4\" />\n </button>\n </div>\n );\n },\n);\nSheetHeader.displayName = \"SheetHeader\";\n\nexport interface SheetTitleProps extends React.HTMLAttributes<HTMLHeadingElement> {\n /** Additional classes merged onto the title. */\n className?: string;\n}\n\n/** Sheet heading; auto-wired to aria-labelledby. */\nexport const SheetTitle = React.forwardRef<HTMLHeadingElement, SheetTitleProps>(\n ({ className, ...props }, ref) => {\n const ctx = React.useContext(SheetContext);\n return (\n <h2\n ref={ref}\n id={ctx?.titleId}\n className={cn(\"text-sm font-semibold text-foreground\", className)}\n {...props}\n />\n );\n },\n);\nSheetTitle.displayName = \"SheetTitle\";\n\nexport interface SheetDescriptionProps extends React.HTMLAttributes<HTMLParagraphElement> {\n /** Additional classes merged onto the description. */\n className?: string;\n}\n\n/** Muted supporting copy under the sheet title. */\nexport const SheetDescription = React.forwardRef<HTMLParagraphElement, SheetDescriptionProps>(({ className, ...props }, ref) => {\n const ctx = React.useContext(SheetContext);\n return (\n <p ref={ref} id={ctx?.descriptionId} className={cn(\"text-sm text-muted-foreground\", className)} {...props} />\n );\n});\nSheetDescription.displayName = \"SheetDescription\";\n\nexport interface SheetBodyProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Additional classes merged onto the sheet body. */\n className?: string;\n}\n\n/** Scrollable sheet body region. */\nexport const SheetBody = React.forwardRef<HTMLDivElement, SheetBodyProps>(\n ({ className, ...props }, ref) => (\n <div ref={ref} className={cn(\"min-h-0 flex-1 overflow-y-auto p-4\", className)} {...props} />\n ),\n);\nSheetBody.displayName = \"SheetBody\";\n\nexport interface SheetFooterProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Additional classes merged onto the sheet footer. */\n className?: string;\n}\n\n/** Sheet footer slot, right-aligned (actions). */\nexport const SheetFooter = React.forwardRef<HTMLDivElement, SheetFooterProps>(\n ({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\"flex items-center justify-end gap-2 border-t border-border p-4\", className)}\n {...props}\n />\n ),\n);\nSheetFooter.displayName = \"SheetFooter\";\n\n/** A button that closes the enclosing Sheet. */\nexport interface SheetCloseProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /** Additional classes merged onto the close button. */\n className?: string;\n /** Button type. Defaults to \"button\". */\n type?: \"button\" | \"submit\" | \"reset\";\n}\n\n/** Button that closes the sheet from inside it. */\nexport const SheetClose = React.forwardRef<HTMLButtonElement, SheetCloseProps>(\n ({ onClick, type = \"button\", ...props }, ref) => {\n const ctx = React.useContext(SheetContext);\n return (\n <button\n ref={ref}\n type={type}\n onClick={(e) => {\n onClick?.(e);\n ctx?.onClose();\n }}\n {...props}\n />\n );\n },\n);\nSheetClose.displayName = \"SheetClose\";\n"]}
package/dist/index.d.cts CHANGED
@@ -20,12 +20,44 @@ interface SheetProps {
20
20
  * `onOpenChange`; closes on overlay click, Escape, or {@link SheetClose}.
21
21
  */
22
22
  declare function Sheet({ open, onOpenChange, side, children, className, dismissible, }: SheetProps): React.JSX.Element | null;
23
- declare const SheetHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
24
- declare const SheetTitle: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLHeadingElement> & React.RefAttributes<HTMLHeadingElement>>;
25
- declare const SheetDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
26
- declare const SheetBody: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
27
- declare const SheetFooter: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
23
+ interface SheetHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
24
+ /** Additional classes merged onto the sheet header. */
25
+ className?: string;
26
+ }
27
+ /** Sheet header slot: SheetTitle + SheetDescription, with a close button. */
28
+ declare const SheetHeader: React.ForwardRefExoticComponent<SheetHeaderProps & React.RefAttributes<HTMLDivElement>>;
29
+ interface SheetTitleProps extends React.HTMLAttributes<HTMLHeadingElement> {
30
+ /** Additional classes merged onto the title. */
31
+ className?: string;
32
+ }
33
+ /** Sheet heading; auto-wired to aria-labelledby. */
34
+ declare const SheetTitle: React.ForwardRefExoticComponent<SheetTitleProps & React.RefAttributes<HTMLHeadingElement>>;
35
+ interface SheetDescriptionProps extends React.HTMLAttributes<HTMLParagraphElement> {
36
+ /** Additional classes merged onto the description. */
37
+ className?: string;
38
+ }
39
+ /** Muted supporting copy under the sheet title. */
40
+ declare const SheetDescription: React.ForwardRefExoticComponent<SheetDescriptionProps & React.RefAttributes<HTMLParagraphElement>>;
41
+ interface SheetBodyProps extends React.HTMLAttributes<HTMLDivElement> {
42
+ /** Additional classes merged onto the sheet body. */
43
+ className?: string;
44
+ }
45
+ /** Scrollable sheet body region. */
46
+ declare const SheetBody: React.ForwardRefExoticComponent<SheetBodyProps & React.RefAttributes<HTMLDivElement>>;
47
+ interface SheetFooterProps extends React.HTMLAttributes<HTMLDivElement> {
48
+ /** Additional classes merged onto the sheet footer. */
49
+ className?: string;
50
+ }
51
+ /** Sheet footer slot, right-aligned (actions). */
52
+ declare const SheetFooter: React.ForwardRefExoticComponent<SheetFooterProps & React.RefAttributes<HTMLDivElement>>;
28
53
  /** A button that closes the enclosing Sheet. */
29
- declare const SheetClose: React.ForwardRefExoticComponent<React.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>;
54
+ interface SheetCloseProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
55
+ /** Additional classes merged onto the close button. */
56
+ className?: string;
57
+ /** Button type. Defaults to "button". */
58
+ type?: "button" | "submit" | "reset";
59
+ }
60
+ /** Button that closes the sheet from inside it. */
61
+ declare const SheetClose: React.ForwardRefExoticComponent<SheetCloseProps & React.RefAttributes<HTMLButtonElement>>;
30
62
 
31
- export { Sheet, SheetBody, SheetClose, SheetDescription, SheetFooter, SheetHeader, type SheetProps, type SheetSide, SheetTitle };
63
+ export { Sheet, SheetBody, type SheetBodyProps, SheetClose, type SheetCloseProps, SheetDescription, type SheetDescriptionProps, SheetFooter, type SheetFooterProps, SheetHeader, type SheetHeaderProps, type SheetProps, type SheetSide, SheetTitle, type SheetTitleProps };
package/dist/index.d.ts CHANGED
@@ -20,12 +20,44 @@ interface SheetProps {
20
20
  * `onOpenChange`; closes on overlay click, Escape, or {@link SheetClose}.
21
21
  */
22
22
  declare function Sheet({ open, onOpenChange, side, children, className, dismissible, }: SheetProps): React.JSX.Element | null;
23
- declare const SheetHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
24
- declare const SheetTitle: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLHeadingElement> & React.RefAttributes<HTMLHeadingElement>>;
25
- declare const SheetDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
26
- declare const SheetBody: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
27
- declare const SheetFooter: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
23
+ interface SheetHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
24
+ /** Additional classes merged onto the sheet header. */
25
+ className?: string;
26
+ }
27
+ /** Sheet header slot: SheetTitle + SheetDescription, with a close button. */
28
+ declare const SheetHeader: React.ForwardRefExoticComponent<SheetHeaderProps & React.RefAttributes<HTMLDivElement>>;
29
+ interface SheetTitleProps extends React.HTMLAttributes<HTMLHeadingElement> {
30
+ /** Additional classes merged onto the title. */
31
+ className?: string;
32
+ }
33
+ /** Sheet heading; auto-wired to aria-labelledby. */
34
+ declare const SheetTitle: React.ForwardRefExoticComponent<SheetTitleProps & React.RefAttributes<HTMLHeadingElement>>;
35
+ interface SheetDescriptionProps extends React.HTMLAttributes<HTMLParagraphElement> {
36
+ /** Additional classes merged onto the description. */
37
+ className?: string;
38
+ }
39
+ /** Muted supporting copy under the sheet title. */
40
+ declare const SheetDescription: React.ForwardRefExoticComponent<SheetDescriptionProps & React.RefAttributes<HTMLParagraphElement>>;
41
+ interface SheetBodyProps extends React.HTMLAttributes<HTMLDivElement> {
42
+ /** Additional classes merged onto the sheet body. */
43
+ className?: string;
44
+ }
45
+ /** Scrollable sheet body region. */
46
+ declare const SheetBody: React.ForwardRefExoticComponent<SheetBodyProps & React.RefAttributes<HTMLDivElement>>;
47
+ interface SheetFooterProps extends React.HTMLAttributes<HTMLDivElement> {
48
+ /** Additional classes merged onto the sheet footer. */
49
+ className?: string;
50
+ }
51
+ /** Sheet footer slot, right-aligned (actions). */
52
+ declare const SheetFooter: React.ForwardRefExoticComponent<SheetFooterProps & React.RefAttributes<HTMLDivElement>>;
28
53
  /** A button that closes the enclosing Sheet. */
29
- declare const SheetClose: React.ForwardRefExoticComponent<React.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>;
54
+ interface SheetCloseProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
55
+ /** Additional classes merged onto the close button. */
56
+ className?: string;
57
+ /** Button type. Defaults to "button". */
58
+ type?: "button" | "submit" | "reset";
59
+ }
60
+ /** Button that closes the sheet from inside it. */
61
+ declare const SheetClose: React.ForwardRefExoticComponent<SheetCloseProps & React.RefAttributes<HTMLButtonElement>>;
30
62
 
31
- export { Sheet, SheetBody, SheetClose, SheetDescription, SheetFooter, SheetHeader, type SheetProps, type SheetSide, SheetTitle };
63
+ export { Sheet, SheetBody, type SheetBodyProps, SheetClose, type SheetCloseProps, SheetDescription, type SheetDescriptionProps, SheetFooter, type SheetFooterProps, SheetHeader, type SheetHeaderProps, type SheetProps, type SheetSide, SheetTitle, type SheetTitleProps };
package/dist/index.js.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,CAAiB,WAAA,GAAc,kBAAA;AAExB,IAAM,SAAA,GAAkB,KAAA,CAAA,UAAA;AAAA,EAC7B,CAAC,EAAE,SAAA,EAAW,GAAG,KAAA,IAAS,GAAA,qBACxB,GAAA,CAAC,KAAA,EAAA,EAAI,GAAA,EAAU,WAAW,EAAA,CAAG,oCAAA,EAAsC,SAAS,CAAA,EAAI,GAAG,KAAA,EAAO;AAE9F;AACA,SAAA,CAAU,WAAA,GAAc,WAAA;AAEjB,IAAM,WAAA,GAAoB,KAAA,CAAA,UAAA;AAAA,EAC/B,CAAC,EAAE,SAAA,EAAW,GAAG,KAAA,IAAS,GAAA,qBACxB,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,SAAA,EAAW,EAAA,CAAG,gEAAA,EAAkE,SAAS,CAAA;AAAA,MACxF,GAAG;AAAA;AAAA;AAGV;AACA,WAAA,CAAY,WAAA,GAAc,aAAA;AAGnB,IAAM,UAAA,GAAmB,KAAA,CAAA,UAAA;AAAA,EAC9B,CAAC,EAAE,OAAA,EAAS,IAAA,GAAO,UAAU,GAAG,KAAA,IAAS,GAAA,KAAQ;AAC/C,IAAA,MAAM,GAAA,GAAY,iBAAW,YAAY,CAAA;AACzC,IAAA,uBACE,GAAA;AAAA,MAAC,QAAA;AAAA,MAAA;AAAA,QACC,GAAA;AAAA,QACA,IAAA;AAAA,QACA,OAAA,EAAS,CAAC,CAAA,KAAM;AACd,UAAA,OAAA,GAAU,CAAC,CAAA;AACX,UAAA,GAAA,EAAK,OAAA,EAAQ;AAAA,QACf,CAAA;AAAA,QACC,GAAG;AAAA;AAAA,KACN;AAAA,EAEJ;AACF;AACA,UAAA,CAAW,WAAA,GAAc,YAAA","file":"index.js","sourcesContent":["import * as React from \"react\";\nimport { X } from \"lucide-react\";\nimport { cn } from \"@nucleux/utils\";\n\ninterface SheetContextValue {\n titleId: string;\n descriptionId: string;\n onClose: () => void;\n}\nconst SheetContext = React.createContext<SheetContextValue | null>(null);\n\nexport type SheetSide = \"right\" | \"left\" | \"top\" | \"bottom\";\n\nconst sideClasses: Record<SheetSide, string> = {\n right: \"inset-y-0 right-0 h-full w-full max-w-sm border-l\",\n left: \"inset-y-0 left-0 h-full w-full max-w-sm border-r\",\n top: \"inset-x-0 top-0 w-full border-b\",\n bottom: \"inset-x-0 bottom-0 w-full border-t\",\n};\n\nexport interface SheetProps {\n /** Whether the sheet is open. */\n open: boolean;\n /** Called when the sheet requests to close (overlay click / Escape / close button). */\n onOpenChange: (open: boolean) => void;\n /** Which edge the sheet slides in from. */\n side?: SheetSide;\n /** Panel content — compose SheetHeader/Title/Description/Body/Footer. */\n children: React.ReactNode;\n /** Class overrides for the panel. */\n className?: string;\n /** Disable closing on overlay click / Escape. */\n dismissible?: boolean;\n}\n\n/**\n * A slide-over drawer anchored to a screen edge. Controlled via `open` /\n * `onOpenChange`; closes on overlay click, Escape, or {@link SheetClose}.\n */\nexport function Sheet({\n open,\n onOpenChange,\n side = \"right\",\n children,\n className,\n dismissible = true,\n}: SheetProps) {\n const baseId = React.useId();\n const panelRef = React.useRef<HTMLDivElement>(null);\n const close = React.useCallback(() => onOpenChange(false), [onOpenChange]);\n\n React.useEffect(() => {\n if (!open || !dismissible) return;\n const onKey = (e: KeyboardEvent) => {\n if (e.key === \"Escape\") close();\n };\n document.addEventListener(\"keydown\", onKey);\n return () => document.removeEventListener(\"keydown\", onKey);\n }, [open, dismissible, close]);\n\n React.useEffect(() => {\n if (open) panelRef.current?.focus();\n }, [open]);\n\n if (!open) return null;\n\n return (\n <SheetContext.Provider\n value={{ titleId: `${baseId}-title`, descriptionId: `${baseId}-desc`, onClose: close }}\n >\n <div className=\"fixed inset-0 z-50\">\n <div\n aria-hidden\n className=\"absolute inset-0 bg-foreground/50 animate-nx-fade-in\"\n onClick={dismissible ? close : undefined}\n />\n <div\n ref={panelRef}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={`${baseId}-title`}\n aria-describedby={`${baseId}-desc`}\n tabIndex={-1}\n className={cn(\n \"absolute flex flex-col border-border bg-background shadow-lg outline-none animate-nx-fade-in\",\n sideClasses[side],\n className,\n )}\n >\n {children}\n </div>\n </div>\n </SheetContext.Provider>\n );\n}\n\nexport const SheetHeader = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, children, ...props }, ref) => {\n const ctx = React.useContext(SheetContext);\n return (\n <div\n ref={ref}\n className={cn(\"flex items-center justify-between gap-4 border-b border-border p-4\", className)}\n {...props}\n >\n <div className=\"min-w-0 flex-1\">{children}</div>\n <button\n type=\"button\"\n aria-label=\"Close\"\n onClick={ctx?.onClose}\n className=\"shrink-0 rounded p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n <X className=\"size-4\" />\n </button>\n </div>\n );\n },\n);\nSheetHeader.displayName = \"SheetHeader\";\n\nexport const SheetTitle = React.forwardRef<HTMLHeadingElement, React.HTMLAttributes<HTMLHeadingElement>>(\n ({ className, ...props }, ref) => {\n const ctx = React.useContext(SheetContext);\n return (\n <h2\n ref={ref}\n id={ctx?.titleId}\n className={cn(\"text-sm font-semibold text-foreground\", className)}\n {...props}\n />\n );\n },\n);\nSheetTitle.displayName = \"SheetTitle\";\n\nexport const SheetDescription = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, ...props }, ref) => {\n const ctx = React.useContext(SheetContext);\n return (\n <p ref={ref} id={ctx?.descriptionId} className={cn(\"text-sm text-muted-foreground\", className)} {...props} />\n );\n});\nSheetDescription.displayName = \"SheetDescription\";\n\nexport const SheetBody = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => (\n <div ref={ref} className={cn(\"min-h-0 flex-1 overflow-y-auto p-4\", className)} {...props} />\n ),\n);\nSheetBody.displayName = \"SheetBody\";\n\nexport const SheetFooter = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\"flex items-center justify-end gap-2 border-t border-border p-4\", className)}\n {...props}\n />\n ),\n);\nSheetFooter.displayName = \"SheetFooter\";\n\n/** A button that closes the enclosing Sheet. */\nexport const SheetClose = React.forwardRef<HTMLButtonElement, React.ButtonHTMLAttributes<HTMLButtonElement>>(\n ({ onClick, type = \"button\", ...props }, ref) => {\n const ctx = React.useContext(SheetContext);\n return (\n <button\n ref={ref}\n type={type}\n onClick={(e) => {\n onClick?.(e);\n ctx?.onClose();\n }}\n {...props}\n />\n );\n },\n);\nSheetClose.displayName = \"SheetClose\";\n"]}
1
+ {"version":3,"sources":["../src/index.tsx"],"names":[],"mappings":";;;;;;AASA,IAAM,YAAA,GAAqB,oBAAwC,IAAI,CAAA;AAIvE,IAAM,WAAA,GAAyC;AAAA,EAC7C,KAAA,EAAO,mDAAA;AAAA,EACP,IAAA,EAAM,kDAAA;AAAA,EACN,GAAA,EAAK,iCAAA;AAAA,EACL,MAAA,EAAQ;AACV,CAAA;AAqBO,SAAS,KAAA,CAAM;AAAA,EACpB,IAAA;AAAA,EACA,YAAA;AAAA,EACA,IAAA,GAAO,OAAA;AAAA,EACP,QAAA;AAAA,EACA,SAAA;AAAA,EACA,WAAA,GAAc;AAChB,CAAA,EAAe;AACb,EAAA,MAAM,SAAe,KAAA,CAAA,KAAA,EAAM;AAC3B,EAAA,MAAM,QAAA,GAAiB,aAAuB,IAAI,CAAA;AAClD,EAAA,MAAM,KAAA,GAAc,kBAAY,MAAM,YAAA,CAAa,KAAK,CAAA,EAAG,CAAC,YAAY,CAAC,CAAA;AAEzE,EAAM,gBAAU,MAAM;AACpB,IAAA,IAAI,CAAC,IAAA,IAAQ,CAAC,WAAA,EAAa;AAC3B,IAAA,MAAM,KAAA,GAAQ,CAAC,CAAA,KAAqB;AAClC,MAAA,IAAI,CAAA,CAAE,GAAA,KAAQ,QAAA,EAAU,KA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AA,MAAA;AAAA,QACC,GAAA;AAAA,QACA,IAAA;AAAA,QACA,OAAA,EAAS,CAAC,CAAA,KAAM;AACd,UAAA,OAAA,GAAU,CAAC,CAAA;AACX,UAAA,GAAA,EAAK,OAAA,EAAQ;AAAA,QACf,CAAA;AAAA,QACC,GAAG;AAAA;AAAA,KACN;AAAA,EAEJ;AACF;AACA,UAAA,CAAW,WAAA,GAAc,YAAA","file":"index.js","sourcesContent":["import * as React from \"react\";\nimport { X } from \"lucide-react\";\nimport { cn } from \"@nucleux/utils\";\n\ninterface SheetContextValue {\n titleId: string;\n descriptionId: string;\n onClose: () => void;\n}\nconst SheetContext = React.createContext<SheetContextValue | null>(null);\n\nexport type SheetSide = \"right\" | \"left\" | \"top\" | \"bottom\";\n\nconst sideClasses: Record<SheetSide, string> = {\n right: \"inset-y-0 right-0 h-full w-full max-w-sm border-l\",\n left: \"inset-y-0 left-0 h-full w-full max-w-sm border-r\",\n top: \"inset-x-0 top-0 w-full border-b\",\n bottom: \"inset-x-0 bottom-0 w-full border-t\",\n};\n\nexport interface SheetProps {\n /** Whether the sheet is open. */\n open: boolean;\n /** Called when the sheet requests to close (overlay click / Escape / close button). */\n onOpenChange: (open: boolean) => void;\n /** Which edge the sheet slides in from. */\n side?: SheetSide;\n /** Panel content — compose SheetHeader/Title/Description/Body/Footer. */\n children: React.ReactNode;\n /** Class overrides for the panel. */\n className?: string;\n /** Disable closing on overlay click / Escape. */\n dismissible?: boolean;\n}\n\n/**\n * A slide-over drawer anchored to a screen edge. Controlled via `open` /\n * `onOpenChange`; closes on overlay click, Escape, or {@link SheetClose}.\n */\nexport function Sheet({\n open,\n onOpenChange,\n side = \"right\",\n children,\n className,\n dismissible = true,\n}: SheetProps) {\n const baseId = React.useId();\n const panelRef = React.useRef<HTMLDivElement>(null);\n const close = React.useCallback(() => onOpenChange(false), [onOpenChange]);\n\n React.useEffect(() => {\n if (!open || !dismissible) return;\n const onKey = (e: KeyboardEvent) => {\n if (e.key === \"Escape\") close();\n };\n document.addEventListener(\"keydown\", onKey);\n return () => document.removeEventListener(\"keydown\", onKey);\n }, [open, dismissible, close]);\n\n React.useEffect(() => {\n if (open) panelRef.current?.focus();\n }, [open]);\n\n if (!open) return null;\n\n return (\n <SheetContext.Provider\n value={{ titleId: `${baseId}-title`, descriptionId: `${baseId}-desc`, onClose: close }}\n >\n <div className=\"fixed inset-0 z-50\">\n <div\n aria-hidden\n className=\"absolute inset-0 bg-foreground/50 animate-nx-fade-in\"\n onClick={dismissible ? close : undefined}\n />\n <div\n ref={panelRef}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={`${baseId}-title`}\n aria-describedby={`${baseId}-desc`}\n tabIndex={-1}\n className={cn(\n \"absolute flex flex-col border-border bg-background shadow-lg outline-none animate-nx-fade-in\",\n sideClasses[side],\n className,\n )}\n >\n {children}\n </div>\n </div>\n </SheetContext.Provider>\n );\n}\n\nexport interface SheetHeaderProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Additional classes merged onto the sheet header. */\n className?: string;\n}\n\n/** Sheet header slot: SheetTitle + SheetDescription, with a close button. */\nexport const SheetHeader = React.forwardRef<HTMLDivElement, SheetHeaderProps>(\n ({ className, children, ...props }, ref) => {\n const ctx = React.useContext(SheetContext);\n return (\n <div\n ref={ref}\n className={cn(\"flex items-center justify-between gap-4 border-b border-border p-4\", className)}\n {...props}\n >\n <div className=\"min-w-0 flex-1\">{children}</div>\n <button\n type=\"button\"\n aria-label=\"Close\"\n onClick={ctx?.onClose}\n className=\"shrink-0 rounded p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n <X className=\"size-4\" />\n </button>\n </div>\n );\n },\n);\nSheetHeader.displayName = \"SheetHeader\";\n\nexport interface SheetTitleProps extends React.HTMLAttributes<HTMLHeadingElement> {\n /** Additional classes merged onto the title. */\n className?: string;\n}\n\n/** Sheet heading; auto-wired to aria-labelledby. */\nexport const SheetTitle = React.forwardRef<HTMLHeadingElement, SheetTitleProps>(\n ({ className, ...props }, ref) => {\n const ctx = React.useContext(SheetContext);\n return (\n <h2\n ref={ref}\n id={ctx?.titleId}\n className={cn(\"text-sm font-semibold text-foreground\", className)}\n {...props}\n />\n );\n },\n);\nSheetTitle.displayName = \"SheetTitle\";\n\nexport interface SheetDescriptionProps extends React.HTMLAttributes<HTMLParagraphElement> {\n /** Additional classes merged onto the description. */\n className?: string;\n}\n\n/** Muted supporting copy under the sheet title. */\nexport const SheetDescription = React.forwardRef<HTMLParagraphElement, SheetDescriptionProps>(({ className, ...props }, ref) => {\n const ctx = React.useContext(SheetContext);\n return (\n <p ref={ref} id={ctx?.descriptionId} className={cn(\"text-sm text-muted-foreground\", className)} {...props} />\n );\n});\nSheetDescription.displayName = \"SheetDescription\";\n\nexport interface SheetBodyProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Additional classes merged onto the sheet body. */\n className?: string;\n}\n\n/** Scrollable sheet body region. */\nexport const SheetBody = React.forwardRef<HTMLDivElement, SheetBodyProps>(\n ({ className, ...props }, ref) => (\n <div ref={ref} className={cn(\"min-h-0 flex-1 overflow-y-auto p-4\", className)} {...props} />\n ),\n);\nSheetBody.displayName = \"SheetBody\";\n\nexport interface SheetFooterProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Additional classes merged onto the sheet footer. */\n className?: string;\n}\n\n/** Sheet footer slot, right-aligned (actions). */\nexport const SheetFooter = React.forwardRef<HTMLDivElement, SheetFooterProps>(\n ({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\"flex items-center justify-end gap-2 border-t border-border p-4\", className)}\n {...props}\n />\n ),\n);\nSheetFooter.displayName = \"SheetFooter\";\n\n/** A button that closes the enclosing Sheet. */\nexport interface SheetCloseProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /** Additional classes merged onto the close button. */\n className?: string;\n /** Button type. Defaults to \"button\". */\n type?: \"button\" | \"submit\" | \"reset\";\n}\n\n/** Button that closes the sheet from inside it. */\nexport const SheetClose = React.forwardRef<HTMLButtonElement, SheetCloseProps>(\n ({ onClick, type = \"button\", ...props }, ref) => {\n const ctx = React.useContext(SheetContext);\n return (\n <button\n ref={ref}\n type={type}\n onClick={(e) => {\n onClick?.(e);\n ctx?.onClose();\n }}\n {...props}\n />\n );\n },\n);\nSheetClose.displayName = \"SheetClose\";\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nucleux/sheet",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "description": "Sheet — a slide-over drawer panel — Nucleux agentic UI for React.",
@@ -34,8 +34,8 @@
34
34
  "react-dom": ">=18"
35
35
  },
36
36
  "dependencies": {
37
- "lucide-react": "^0.469.0",
38
- "@nucleux/utils": "0.4.0"
37
+ "@nucleux/utils": "0.6.0",
38
+ "lucide-react": "^0.469.0"
39
39
  },
40
40
  "devDependencies": {
41
41
  "tsup": "^8.3.5",