File tree Expand file tree Collapse file tree 5 files changed +64
-11
lines changed Expand file tree Collapse file tree 5 files changed +64
-11
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " @kleros/ui-components-library" ,
3- "version" : " 3.0.1 " ,
3+ "version" : " 3.1.2 " ,
44 "description" : " UI components library which implements the Kleros design system." ,
55 "source" : " ./src/lib/index.ts" ,
66 "main" : " ./dist/esm/ui-components-library.js" ,
Original file line number Diff line number Diff line change @@ -2,23 +2,50 @@ import React from "react";
22import { cn } from "../../utils" ;
33import {
44 Modal as AriaModal ,
5+ Dialog ,
6+ ModalOverlay ,
7+ type DialogProps ,
58 type ModalOverlayProps ,
69} from "react-aria-components" ;
710
11+ interface ModalProps
12+ extends Omit < ModalOverlayProps , "children" > ,
13+ React . RefAttributes < HTMLDivElement > {
14+ /** classname that applies to the modal overlay. */
15+ modalOverlayClassname ?: ModalOverlayProps [ "className" ] ;
16+ children ?: DialogProps [ "children" ] ;
17+ }
18+
19+ /** A modal is an overlay element which blocks interaction with elements outside it. */
820function Modal ( {
921 className,
22+ modalOverlayClassname,
23+ children,
1024 ...props
11- } : ModalOverlayProps & React . RefAttributes < HTMLDivElement > ) {
25+ } : Readonly < ModalProps > ) {
1226 return (
13- < AriaModal
27+ < ModalOverlay
1428 className = { cn (
15- "bg-klerosUIComponentsWhiteBackground h-[200px] w-[328px]" ,
16- "rounded-base box-border" ,
17- className ,
29+ "fixed top-0 left-0 isolate" ,
30+ "z-20 h-(--visual-viewport-height) w-full bg-black/[50%] backdrop-blur-md" ,
31+ "flex items-center justify-center" ,
32+ "entering:animate-[fadeIn_100ms_ease-out] exiting:animate-[fadeOut_100ms_ease-in]" ,
33+ modalOverlayClassname ,
1834 ) }
35+ { ...props }
1936 >
20- { props . children }
21- </ AriaModal >
37+ < AriaModal { ...props } >
38+ < Dialog
39+ className = { cn (
40+ "bg-klerosUIComponentsWhiteBackground h-[200px] w-[328px] outline-none" ,
41+ "rounded-base box-border" ,
42+ className ,
43+ ) }
44+ >
45+ { children }
46+ </ Dialog >
47+ </ AriaModal >
48+ </ ModalOverlay >
2249 ) ;
2350}
2451export default Modal ;
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ export { default as Button } from "./button";
66
77export { default as Card } from "./container/card" ;
88export { default as Box } from "./container/box" ;
9+ export { default as Modal } from "./container/modal" ;
910
1011export { default as DisplayLarge } from "./display/large" ;
1112export { default as DisplayIcon } from "./display/icon" ;
Original file line number Diff line number Diff line change 11import type { Meta , StoryObj } from "@storybook/react" ;
2-
2+ import React , { useState } from "react" ;
33import { IPreviewArgs } from "./utils" ;
44
5- import ModalComponent from "../lib/container/box" ;
5+ import ModalComponent from "../lib/container/modal" ;
6+ import { Button } from "../lib" ;
67
78const meta = {
89 component : ModalComponent ,
910 title : "Containers/Modal" ,
1011 tags : [ "autodocs" ] ,
12+ argTypes : {
13+ isOpen : {
14+ control : "boolean" ,
15+ } ,
16+ isDismissable : {
17+ control : "boolean" ,
18+ } ,
19+ } ,
1120} satisfies Meta < typeof ModalComponent > ;
1221
1322export default meta ;
@@ -19,5 +28,21 @@ export const Modal: Story = {
1928 themeUI : "dark" ,
2029 backgroundUI : "light" ,
2130 className : "w-[500px]" ,
31+ isDismissable : true ,
32+ } ,
33+ render : function Render ( args ) {
34+ const [ isOpen , setOpen ] = useState ( false ) ;
35+ return (
36+ < div >
37+ < Button text = "Press me!" onPress = { ( ) => setOpen ( true ) } />
38+ < ModalComponent { ...args } isOpen = { isOpen } onOpenChange = { setOpen } >
39+ < div className = "flex size-full items-center justify-center" >
40+ < p className = "text-klerosUIComponentsPrimaryText font-semibold" >
41+ I am a Modal.
42+ </ p >
43+ </ div >
44+ </ ModalComponent >
45+ </ div >
46+ ) ;
2247 } ,
2348} ;
Original file line number Diff line number Diff line change 3434 --klerosUIComponentsBaseRadius : 3px ;
3535 }
3636
37- : root [ class = " dark" ] {
37+ : root . dark {
3838 --klerosUIComponentsName : dark;
3939 --klerosUIComponentsPrimaryPurple : # 7e1bd4 ;
4040 --klerosUIComponentsSecondaryPurple : # b45fff ;
You can’t perform that action at this time.
0 commit comments