the-omelet-ui 1.7.4 → 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/loadingSpinner.d.ts +1 -1
- package/dist/entries/sheet.d.ts +172 -0
- package/dist/entries/sheet.js +1 -0
- package/dist/entries/tag.d.ts +99 -0
- package/dist/entries/tag.js +2 -0
- package/package.json +1 -1
|
@@ -7,7 +7,7 @@ declare const spinnerVariants: (props?: ({
|
|
|
7
7
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
8
8
|
interface LoadingSpinnerProps extends VariantProps<typeof spinnerVariants> {
|
|
9
9
|
className?: string;
|
|
10
|
-
/** Custom color for the spinner (eg. text-red-500) */
|
|
10
|
+
/** Custom color for the spinner (eg. text-red-500 for Loading Spinner , bg-red-500 for Bars Spinner) */
|
|
11
11
|
colorClassName?: string;
|
|
12
12
|
}
|
|
13
13
|
declare const LoadingSpinner: React__default.FC<LoadingSpinnerProps>;
|
|
@@ -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};
|
|
@@ -0,0 +1,99 @@
|
|
|
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
|
+
/**
|
|
6
|
+
* Tag Component Variants using CVA
|
|
7
|
+
*
|
|
8
|
+
* Types (Colors):
|
|
9
|
+
* - blue: สีน้ำเงิน - ใช้สำหรับข้อมูลทั่วไป, status ปกติ
|
|
10
|
+
* - gray: สีเทา - ใช้สำหรับข้อมูลรอง, disabled, neutral
|
|
11
|
+
* - green: สีเขียว - ใช้สำหรับ success, active, approved
|
|
12
|
+
* - yellow: สีเหลือง - ใช้สำหรับ warning, pending
|
|
13
|
+
* - red: สีแดง - ใช้สำหรับ error, danger, rejected
|
|
14
|
+
*
|
|
15
|
+
* Variants:
|
|
16
|
+
* - filled: พื้นหลังเต็มสี (default)
|
|
17
|
+
* - outlined: มีแค่ border และข้อความสี
|
|
18
|
+
*/
|
|
19
|
+
declare const tagVariants: (props?: ({
|
|
20
|
+
type?: "red" | "green" | "blue" | "yellow" | "gray" | null | undefined;
|
|
21
|
+
variant?: "filled" | "outlined" | null | undefined;
|
|
22
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
23
|
+
interface TagProps extends VariantProps<typeof tagVariants> {
|
|
24
|
+
/**
|
|
25
|
+
* ข้อความที่แสดงใน tag
|
|
26
|
+
* @example "Label"
|
|
27
|
+
*/
|
|
28
|
+
children: React__default.ReactNode;
|
|
29
|
+
/**
|
|
30
|
+
* สีของ tag
|
|
31
|
+
* @default "blue"
|
|
32
|
+
*
|
|
33
|
+
* - blue: สีน้ำเงิน - ใช้สำหรับข้อมูลทั่วไป
|
|
34
|
+
* - gray: สีเทา - ใช้สำหรับข้อมูลรอง
|
|
35
|
+
* - green: สีเขียว - ใช้สำหรับ success
|
|
36
|
+
* - yellow: สีเหลือง - ใช้สำหรับ warning
|
|
37
|
+
* - red: สีแดง - ใช้สำหรับ error
|
|
38
|
+
*/
|
|
39
|
+
type?: 'blue' | 'gray' | 'green' | 'yellow' | 'red';
|
|
40
|
+
/**
|
|
41
|
+
* รูปแบบของ tag
|
|
42
|
+
* @default "filled"
|
|
43
|
+
*
|
|
44
|
+
* - filled: พื้นหลังเต็มสี
|
|
45
|
+
* - outlined: มีแค่ border และข้อความสี
|
|
46
|
+
*/
|
|
47
|
+
variant?: 'filled' | 'outlined';
|
|
48
|
+
/**
|
|
49
|
+
* แสดงปุ่มปิด (X)
|
|
50
|
+
* @default false
|
|
51
|
+
*/
|
|
52
|
+
closable?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Callback เมื่อกดปุ่มปิด
|
|
55
|
+
*/
|
|
56
|
+
onClose?: () => void;
|
|
57
|
+
/**
|
|
58
|
+
* CSS class เพิ่มเติม
|
|
59
|
+
*/
|
|
60
|
+
className?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Icon ที่แสดงด้านหน้า label
|
|
63
|
+
* @example <IconCheck className="w-4 h-4" />
|
|
64
|
+
*/
|
|
65
|
+
icon?: React__default.ReactNode;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Tag Component
|
|
69
|
+
*
|
|
70
|
+
* Component สำหรับแสดง label, category, status, หรือ badge
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* // Basic usage
|
|
74
|
+
* <Tag>Label</Tag>
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* // With different colors
|
|
78
|
+
* <Tag type="blue">Info</Tag>
|
|
79
|
+
* <Tag type="green">Success</Tag>
|
|
80
|
+
* <Tag type="yellow">Warning</Tag>
|
|
81
|
+
* <Tag type="red">Error</Tag>
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* // Outlined variant
|
|
85
|
+
* <Tag variant="outlined">Outlined</Tag>
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* // With close button
|
|
89
|
+
* <Tag closable onClose={() => console.log('closed')}>
|
|
90
|
+
* Closable Tag
|
|
91
|
+
* </Tag>
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* // With icon
|
|
95
|
+
* <Tag icon={<CheckIcon />}>With Icon</Tag>
|
|
96
|
+
*/
|
|
97
|
+
declare const Tag: React__default.FC<TagProps>;
|
|
98
|
+
|
|
99
|
+
export { Tag, type TagProps, Tag as default };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {a}from'../chunk-6GLPXMGB.js';import {cva}from'class-variance-authority';import {forwardRef,memo}from'react';import {jsxs,jsx}from'react/jsx-runtime';var m=({title:t,titleId:e,...a},l)=>jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em",ref:l,"aria-labelledby":e,...a,children:[t?jsx("title",{id:e,children:t}):null,jsx("path",{fill:"currentColor",fillRule:"evenodd",d:"M.26.26a.89.89 0 0 1 1.257 0L8 6.743 14.483.26a.889.889 0 0 1 1.257 1.257L9.257 8l6.483 6.483a.889.889 0 1 1-1.257 1.257L8 9.257 1.517 15.74A.889.889 0 0 1 .26 14.483L6.743 8 .26 1.517A.89.89 0 0 1 .26.26",clipRule:"evenodd"})]}),v=forwardRef(m),c=memo(v),s=c;var f=cva("inline-flex items-center gap-1.5 px-3 py-1.5 rounded-md text-sm font-medium transition-colors",{variants:{type:{blue:"",gray:"",green:"",yellow:"",red:""},variant:{filled:"",outlined:"bg-white border"}},compoundVariants:[{type:"blue",variant:"filled",className:"bg-blue-500 text-white hover:bg-blue-600"},{type:"blue",variant:"outlined",className:"border-blue-500 text-blue-600 hover:bg-blue-50"},{type:"gray",variant:"filled",className:"bg-gray-500 text-white hover:bg-gray-600"},{type:"gray",variant:"outlined",className:"border-gray-400 text-gray-600 hover:bg-gray-50"},{type:"green",variant:"filled",className:"bg-green-500 text-white hover:bg-green-600"},{type:"green",variant:"outlined",className:"border-green-500 text-green-600 hover:bg-green-50"},{type:"yellow",variant:"filled",className:"bg-yellow-500 text-white hover:bg-yellow-600"},{type:"yellow",variant:"outlined",className:"border-yellow-500 text-yellow-600 hover:bg-yellow-50"},{type:"red",variant:"filled",className:"bg-red-500 text-white hover:bg-red-600"},{type:"red",variant:"outlined",className:"border-red-500 text-red-600 hover:bg-red-50"}],defaultVariants:{type:"blue",variant:"filled"}}),x=cva("inline-flex items-center justify-center rounded hover:bg-black/10 transition-colors",{variants:{type:{blue:"",gray:"",green:"",yellow:"",red:""},variant:{filled:"text-white/80 hover:text-white",outlined:""}},compoundVariants:[{type:"blue",variant:"outlined",className:"text-blue-500 hover:text-blue-700"},{type:"gray",variant:"outlined",className:"text-gray-500 hover:text-gray-700"},{type:"green",variant:"outlined",className:"text-green-500 hover:text-green-700"},{type:"yellow",variant:"outlined",className:"text-yellow-500 hover:text-yellow-700"},{type:"red",variant:"outlined",className:"text-red-500 hover:text-red-700"}],defaultVariants:{type:"blue",variant:"filled"}}),h=({children:t,type:e="blue",variant:a$1="filled",closable:l=false,onClose:g,className:p,icon:n})=>jsxs("span",{className:a(f({type:e,variant:a$1}),p),children:[n&&jsx("span",{className:"inline-flex",children:n}),jsx("span",{children:t}),l&&jsx("button",{type:"button",onClick:g,className:a(x({type:e,variant:a$1}),"p-0.5"),"aria-label":"Remove",children:jsx(s,{fontSize:10})})]}),w=h;
|
|
2
|
+
export{h as Tag,w as default};
|