the-omelet-ui 1.7.5 → 1.7.7
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/entries/sheet.d.ts +172 -0
- package/dist/entries/sheet.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
import { VariantProps } from 'class-variance-authority';
|
|
4
|
+
|
|
5
|
+
declare const sheetContentVariants: (props?: ({
|
|
6
|
+
side?: "bottom" | "top" | "right" | "left" | null | undefined;
|
|
7
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
8
|
+
interface SheetProps {
|
|
9
|
+
/**
|
|
10
|
+
* เปิด/ปิด Sheet
|
|
11
|
+
*/
|
|
12
|
+
open?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Callback เมื่อเปิด/ปิด Sheet
|
|
15
|
+
*/
|
|
16
|
+
onOpenChange?: (open: boolean) => void;
|
|
17
|
+
/**
|
|
18
|
+
* เนื้อหาภายใน Sheet
|
|
19
|
+
*/
|
|
20
|
+
children: React__default.ReactNode;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Sheet Root Component
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* <Sheet open={open} onOpenChange={setOpen}>
|
|
27
|
+
* <SheetContent>
|
|
28
|
+
* <SheetHeader>
|
|
29
|
+
* <SheetTitle>Title</SheetTitle>
|
|
30
|
+
* <SheetDescription>Description</SheetDescription>
|
|
31
|
+
* </SheetHeader>
|
|
32
|
+
* Content here
|
|
33
|
+
* </SheetContent>
|
|
34
|
+
* </Sheet>
|
|
35
|
+
*/
|
|
36
|
+
declare const Sheet: React__default.FC<SheetProps>;
|
|
37
|
+
interface SheetTriggerProps {
|
|
38
|
+
/**
|
|
39
|
+
* Element ที่จะเป็นปุ่มเปิด Sheet
|
|
40
|
+
*/
|
|
41
|
+
children: React__default.ReactNode;
|
|
42
|
+
/**
|
|
43
|
+
* CSS class เพิ่มเติม
|
|
44
|
+
*/
|
|
45
|
+
className?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Disabled trigger
|
|
48
|
+
*/
|
|
49
|
+
disabled?: boolean;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Sheet Trigger - ปุ่มสำหรับเปิด Sheet
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* <SheetTrigger>
|
|
56
|
+
* <button>Open Sheet</button>
|
|
57
|
+
* </SheetTrigger>
|
|
58
|
+
*/
|
|
59
|
+
declare const SheetTrigger: React__default.FC<SheetTriggerProps>;
|
|
60
|
+
interface SheetContentProps extends VariantProps<typeof sheetContentVariants> {
|
|
61
|
+
/**
|
|
62
|
+
* เนื้อหาภายใน Sheet
|
|
63
|
+
*/
|
|
64
|
+
children: React__default.ReactNode;
|
|
65
|
+
/**
|
|
66
|
+
* ทิศทางที่ Sheet จะเลื่อนเข้ามา
|
|
67
|
+
* @default "left"
|
|
68
|
+
*/
|
|
69
|
+
side?: 'top' | 'bottom' | 'left' | 'right';
|
|
70
|
+
/**
|
|
71
|
+
* CSS class เพิ่มเติม
|
|
72
|
+
*/
|
|
73
|
+
className?: string;
|
|
74
|
+
/**
|
|
75
|
+
* แสดงปุ่มปิด (X)
|
|
76
|
+
* @default true
|
|
77
|
+
*/
|
|
78
|
+
showClose?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* ระยะเวลาของ animation (milliseconds)
|
|
81
|
+
* @default 300
|
|
82
|
+
* @example duration={500} // 500ms (0.5 วินาที)
|
|
83
|
+
*/
|
|
84
|
+
duration?: number;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Sheet Content - เนื้อหาของ Sheet
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* <SheetContent side="right" duration={500}>
|
|
91
|
+
* Content here
|
|
92
|
+
* </SheetContent>
|
|
93
|
+
*/
|
|
94
|
+
declare const SheetContent: React__default.FC<SheetContentProps>;
|
|
95
|
+
interface SheetHeaderProps {
|
|
96
|
+
/**
|
|
97
|
+
* เนื้อหาภายใน header
|
|
98
|
+
*/
|
|
99
|
+
children: React__default.ReactNode;
|
|
100
|
+
/**
|
|
101
|
+
* CSS class เพิ่มเติม
|
|
102
|
+
*/
|
|
103
|
+
className?: string;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Sheet Header
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* <SheetHeader>
|
|
110
|
+
* <SheetTitle>Title</SheetTitle>
|
|
111
|
+
* <SheetDescription>Description</SheetDescription>
|
|
112
|
+
* </SheetHeader>
|
|
113
|
+
*/
|
|
114
|
+
declare const SheetHeader: React__default.FC<SheetHeaderProps>;
|
|
115
|
+
interface SheetFooterProps {
|
|
116
|
+
/**
|
|
117
|
+
* เนื้อหาภายใน footer
|
|
118
|
+
*/
|
|
119
|
+
children: React__default.ReactNode;
|
|
120
|
+
/**
|
|
121
|
+
* CSS class เพิ่มเติม
|
|
122
|
+
*/
|
|
123
|
+
className?: string;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Sheet Footer
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* <SheetFooter>
|
|
130
|
+
* <button>Cancel</button>
|
|
131
|
+
* <button>Submit</button>
|
|
132
|
+
* </SheetFooter>
|
|
133
|
+
*/
|
|
134
|
+
declare const SheetFooter: React__default.FC<SheetFooterProps>;
|
|
135
|
+
interface SheetTitleProps {
|
|
136
|
+
/**
|
|
137
|
+
* ข้อความ title
|
|
138
|
+
*/
|
|
139
|
+
children: React__default.ReactNode;
|
|
140
|
+
/**
|
|
141
|
+
* CSS class เพิ่มเติม
|
|
142
|
+
*/
|
|
143
|
+
className?: string;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Sheet Title
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* <SheetTitle>Edit Profile</SheetTitle>
|
|
150
|
+
*/
|
|
151
|
+
declare const SheetTitle: React__default.FC<SheetTitleProps>;
|
|
152
|
+
interface SheetDescriptionProps {
|
|
153
|
+
/**
|
|
154
|
+
* ข้อความ description
|
|
155
|
+
*/
|
|
156
|
+
children: React__default.ReactNode;
|
|
157
|
+
/**
|
|
158
|
+
* CSS class เพิ่มเติม
|
|
159
|
+
*/
|
|
160
|
+
className?: string;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Sheet Description
|
|
164
|
+
*
|
|
165
|
+
* @example
|
|
166
|
+
* <SheetDescription>
|
|
167
|
+
* Make changes to your profile here.
|
|
168
|
+
* </SheetDescription>
|
|
169
|
+
*/
|
|
170
|
+
declare const SheetDescription: React__default.FC<SheetDescriptionProps>;
|
|
171
|
+
|
|
172
|
+
export { Sheet, SheetContent, type SheetContentProps, SheetDescription, type SheetDescriptionProps, SheetFooter, type SheetFooterProps, SheetHeader, type SheetHeaderProps, type SheetProps, SheetTitle, type SheetTitleProps, SheetTrigger, type SheetTriggerProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {a}from'../chunk-6GLPXMGB.js';import {createContext,useState,useEffect,useContext}from'react';import {cva}from'class-variance-authority';import {X}from'lucide-react';import {jsx,jsxs,Fragment}from'react/jsx-runtime';var f=createContext(void 0),u=()=>{let e=useContext(f);if(!e)throw new Error("Sheet components must be used within Sheet");return e},y=cva("fixed z-50 bg-white shadow-lg transition-all duration-300 ease-in-out",{variants:{side:{top:"inset-x-0 top-0 border-b",bottom:"inset-x-0 bottom-0 border-t",left:"inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm"}},defaultVariants:{side:"left"}}),P=({open:e=false,onOpenChange:t,children:o})=>{let[n,i]=useState(e);useEffect(()=>{i(e);},[e]);let s=c=>{i(c),t?.(c);};return useEffect(()=>(n?document.body.style.overflow="hidden":document.body.style.overflow="unset",()=>{document.body.style.overflow="unset";}),[n]),jsx(f.Provider,{value:{open:n,onOpenChange:s},children:o})},v=({children:e,className:t,disabled:o})=>{let{onOpenChange:n}=u();return jsx("div",{onClick:()=>!o&&n(true),className:a(t,o&&"opacity-50 cursor-not-allowed"),children:e})},N=({children:e})=>{let[t,o]=useState(false);return useEffect(()=>(o(true),()=>o(false)),[]),t?jsx(Fragment,{children:e}):null},R=({className:e,duration:t=200})=>{let{open:o,onOpenChange:n}=u(),[i,s]=useState(false);return useEffect(()=>{o?setTimeout(()=>s(true),10):s(false);},[o]),o?jsx("div",{className:a("fixed inset-0 z-40 bg-black/50 backdrop-blur-sm transition-opacity",i?"opacity-100":"opacity-0",e),style:{transitionDuration:`${t}ms`},onClick:()=>n(false)}):null},w=({children:e,side:t="left",className:o,showClose:n=true,duration:i=300})=>{let{open:s,onOpenChange:c}=u(),[m,d]=useState(false);if(useEffect(()=>{s?setTimeout(()=>d(true),10):d(false);},[s]),!s)return null;let S=()=>{if(m)return "translate-x-0 translate-y-0";switch(t){case "left":return "-translate-x-full";case "right":return "translate-x-full";case "top":return "-translate-y-full";case "bottom":return "translate-y-full";default:return ""}};return jsxs(N,{children:[jsx(R,{duration:i}),jsxs("div",{className:a(y({side:t}),"transition-all ease-in-out",S(),o),style:{transitionDuration:`${i}ms`},children:[n&&jsxs("button",{onClick:()=>c(false),className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-white transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-gray-400 focus:ring-offset-2 disabled:pointer-events-none",children:[jsx(X,{className:"h-4 w-4"}),jsx("span",{className:"sr-only",children:"Close"})]}),jsx("div",{className:"h-full overflow-auto",children:e})]})]})},F=({children:e,className:t})=>jsx("div",{className:a("flex flex-col space-y-2 px-6 py-4 border-b",t),children:e}),T=({children:e,className:t})=>jsx("div",{className:a("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2 px-6 py-4 border-t",t),children:e}),V=({children:e,className:t})=>jsx("h2",{className:a("text-lg font-semibold text-gray-900",t),children:e}),O=({children:e,className:t})=>jsx("p",{className:a("text-sm text-gray-500",t),children:e});export{P as Sheet,w as SheetContent,O as SheetDescription,T as SheetFooter,F as SheetHeader,V as SheetTitle,v as SheetTrigger};
|