alope-ui 1.2.66 → 1.2.67
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/Tooltip/Tooltip.d.ts +15 -2
- package/dist/main.cjs +31 -29
- package/dist/main.js +52 -30
- package/package.json +1 -1
|
@@ -1,10 +1,22 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
declare const TooltipColors: {
|
|
3
|
+
readonly neutral: "bg-gray-900 text-white border-gray-900 dark:bg-neutral-800 dark:text-neutral-100 dark:border-neutral-700";
|
|
4
|
+
readonly primary: "bg-primary text-white border-primary dark:bg-primary-dark dark:border-primary-dark";
|
|
5
|
+
readonly secondary: "bg-secondary text-white border-secondary dark:bg-secondary-dark dark:border-secondary-dark";
|
|
6
|
+
readonly success: "bg-success text-white border-success dark:bg-success-dark dark:border-success-dark";
|
|
7
|
+
readonly warning: "bg-warning text-white border-warning dark:bg-warning-dark dark:border-warning-dark";
|
|
8
|
+
readonly error: "bg-error text-white border-error dark:bg-error-dark dark:border-error-dark";
|
|
9
|
+
readonly info: "bg-info text-white border-info dark:bg-info-dark dark:border-info-dark";
|
|
10
|
+
};
|
|
11
|
+
export type TooltipColor = keyof typeof TooltipColors;
|
|
12
|
+
export type TooltipPlacement = "top" | "bottom" | "left" | "right";
|
|
1
13
|
export type TooltipProps = {
|
|
2
14
|
children: React.ReactNode;
|
|
3
15
|
text: string;
|
|
4
16
|
showArrow?: boolean;
|
|
5
|
-
placement?:
|
|
17
|
+
placement?: TooltipPlacement;
|
|
6
18
|
offset?: number;
|
|
7
|
-
|
|
19
|
+
color?: TooltipColor;
|
|
8
20
|
isOpen?: boolean;
|
|
9
21
|
onOpenChange?: (open: boolean) => void;
|
|
10
22
|
disabled?: boolean;
|
|
@@ -12,3 +24,4 @@ export type TooltipProps = {
|
|
|
12
24
|
delay?: number;
|
|
13
25
|
};
|
|
14
26
|
export declare const Tooltip: React.FC<TooltipProps>;
|
|
27
|
+
export {};
|
package/dist/main.cjs
CHANGED
|
@@ -9,29 +9,31 @@ return e.jsxs("div",{className:"relative inline-flex shrink-0",children:[j?e.jsx
|
|
|
9
9
|
return e.jsxs("button",{onClick:()=>o?.(n),className:t.cn("inline-flex flex-1 flex-col items-center justify-center p-5 group",i?"bg-secondary-30-50 dark:bg-secondary/10":"hover:bg-secondary-30 dark:hover:bg-secondary/30",d),children:[a,e.jsx("span",{className:t.cn("text-sm",i?"text-primary":"text-secondary-dark-700 dark:text-secondary-dark group-hover:text-secondary-700 dark:group-hover:text-white",l),children:r})]})},f={primary:"text-primary dark:text-primary-dark-30",secondary:"text-secondary-foreground dark:text-secondary-foreground-dark",success:"text-success-dark dark:text-success-dark-30",info:"text-info-dark dark:text-info-dark-30",warning:"text-warning-dark dark:text-warning-dark-30",error:"text-error-dark dark:text-error-dark-30"},y={sm:"px-3 py-2 text-sm font-medium",md:"px-4 py-2 text-base font-semibold tracking-[.2px]",lg:"px-6 py-3 text-lg font-semibold"},w={regular:"rounded-md",pill:"rounded-full"},v={primary:{solid:"bg-primary text-white hover:bg-primary-dark dark:bg-primary-dark dark:hover:bg-primary-dark/70",outline:"border border-primary text-primary hover:bg-primary-30 dark:bg-primary-dark/30 dark:border-primary-dark dark:hover:bg-primary-dark/70",ghost:"text-primary hover:bg-primary-30 dark:text-primary-dark dark:hover:bg-primary-dark/70 dark:hover:text-white",plain:"text-primary dark:text-primary-dark"},secondary:{solid:"bg-secondary text-black hover:bg-secondary-dark/80 dark:bg-secondary-dark dark:text-white dark:hover:bg-secondary-dark/70",outline:"border border-secondary text-black hover:bg-secondary-30 dark:bg-secondary-dark/30 dark:border-secondary-dark dark:text-white dark:hover:bg-secondary-dark/70",ghost:"text-black hover:bg-secondary-30 dark:text-white dark:hover:bg-secondary-dark/70",plain:"text-black dark:text-white"},success:{solid:"bg-success text-white hover:bg-success-dark dark:bg-success-dark dark:hover:bg-success-dark/70",outline:"border border-success text-success hover:bg-success-30 dark:bg-success-dark/30 dark:border-success-dark dark:text-white dark:hover:bg-success-dark/70",ghost:"text-success hover:bg-success-30 dark:text-success-dark dark:hover:bg-success-dark/70 dark:hover:text-white",plain:"text-success dark:text-success-dark"},warning:{solid:"bg-warning text-white hover:bg-warning-dark dark:bg-warning-dark dark:hover:bg-warning-dark/70",outline:"border border-warning text-warning hover:bg-warning-30 dark:bg-warning-dark/30 dark:border-warning-dark dark:text-white dark:hover:bg-warning-dark/70",ghost:"text-warning hover:bg-warning-30 dark:text-warning-dark dark:hover:bg-warning-dark/70 dark:hover:text-white",plain:"text-warning dark:text-warning-dark"},error:{solid:"bg-error text-white hover:bg-error-dark dark:bg-error-dark dark:hover:bg-error-dark/70",outline:"border border-error text-error hover:bg-error-30 dark:bg-error-dark/30 dark:border-error-dark dark:text-white dark:hover:bg-error-dark/70",ghost:"text-error hover:bg-error-30 dark:text-error-dark dark:hover:bg-error-dark/70 dark:hover:text-white",plain:"text-error dark:text-error-dark"},info:{solid:"bg-info text-white hover:bg-info-dark dark:bg-info-dark dark:hover:bg-info-dark/70",outline:"border border-info text-info hover:bg-info-30 dark:bg-info-dark/30 dark:border-info-dark dark:text-white dark:hover:bg-info-dark/70",ghost:"text-info hover:bg-info-30 dark:text-info-dark dark:hover:bg-info-dark/70 dark:hover:text-white",plain:"text-info dark:text-info-dark"}},j=(e,r)=>v[r][e]||"",N={sm:"max-w-xs",md:"max-w-sm",lg:"max-w-md",xl:"max-w-xl",full:"w-full"},C={primary:"bg-primary dark:bg-primary-dark text-white",error:"bg-error dark:bg-error-dark text-white",warning:"bg-warning dark:bg-warning-dark text-white",success:"bg-success dark:bg-success-dark text-white",info:"bg-info dark:bg-info-dark text-white",secondary:"bg-secondary dark:bg-secondary-dark text-secondary-foreground dark:text-neutral-900"},z=r.forwardRef(({label:a,description:n,indeterminate:s=!1,disabled:o,readOnly:l,children:d,checked:i,defaultChecked:c,onChange:m,...u},x)=>{const g=r.useRef(null)
|
|
10
10
|
r.useImperativeHandle(x,()=>g.current)
|
|
11
11
|
const[b,p]=r.useState(c??!1),h=void 0!==i,k=h?i:b
|
|
12
|
-
return r.useEffect(()=>{g.current&&(g.current.indeterminate=s)},[s]),e.jsxs("label",{className:t.cn("inline-flex items-center gap-3 cursor-pointer select-none",o&&"opacity-50 cursor-not-allowed"),children:[e.jsxs("span",{className:"relative inline-flex items-center justify-center w-5 h-5",children:[e.jsx("input",{...u,ref:g,type:"checkbox",readOnly:l,disabled:o,onChange:e=>{h||p(e.target.checked),m?.(e)},checked:k,"aria-checked":s?"mixed":k?"true":"false",className:"absolute w-full h-full opacity-0 cursor-pointer peer"}),e.jsx("span",{className:t.cn("w-5 h-5 rounded border border-gray-300 dark:border-gray-600 flex items-center justify-center transition-colors duration-200",{"bg-primary border-primary dark:bg-primary-dark dark:border-primary-dark":k||s}),children:s?e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-3 h-3 text-white",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{d:"M6 10a1 1 0 011-1h6a1 1 0 110 2H7a1 1 0 01-1-1z"})}):k?e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-3 h-3 text-white fill-white",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-7.778 7.778a1 1 0 01-1.414 0L3.293 10.05a1 1 0 111.414-1.414l3.536 3.535 7.071-7.071a1 1 0 011.414 0z",clipRule:"evenodd"})}):null})]}),e.jsxs("div",{className:"flex flex-col gap-1",children:[d,a&&e.jsx("span",{className:"font-medium text-sm dark:text-white",children:a}),n&&e.jsx("span",{className:"text-secondary-700 text-sm dark:text-secondary-dark",children:n})]})]})}),L={sm:{container:"text-sm",checkbox:"w-4 h-4",label:"pl-2"},md:{container:"text-base",checkbox:"w-5 h-5",label:"pl-2"},lg:{container:"text-lg",checkbox:"w-6 h-6",label:"pl-3"}},M={solid:{label:"border-transparent bg-transparent hover:bg-gray-100 dark:text-white dark:hover:bg-gray-800",checked:"bg-primary/30 text-primary-700 hover:bg-primary/30 dark:bg-primary/30 dark:text-white dark:hover:bg-primary/30",checkbox:"border-gray-300 dark:border-gray-600",checkedCheckbox:"border-primary bg-primary dark:border-primary dark:bg-primary"},subtle:{label:"border-transparent bg-transparent hover:bg-gray-100 dark:text-white dark:hover:bg-gray-800",checked:"bg-primary/30 text-primary-700 hover:bg-primary/30 dark:bg-primary/30 dark:text-white dark:hover:bg-primary/30",checkbox:"border-gray-300 dark:border-gray-600",checkedCheckbox:"border-primary-700 bg-primary-700 dark:border-primary dark:bg-primary"},outline:{label:"border-secondary-700 bg-transparent hover:bg-gray-100 dark:text-white dark:border-secondary-dark dark:hover:bg-gray-800",checked:"border-primary bg-primary/30 text-primary-700 hover:bg-primary/30 dark:border-primary-700 dark:bg-primary/30 dark:text-white dark:hover:bg-primary/30",checkbox:"border-gray-300 dark:border-secondary-dark",checkedCheckbox:"border-primary bg-primary-700 dark:border-primary dark:bg-primary"}},E={sm:"w-10 h-10 text-sm",md:"w-12 h-12 text-base",lg:"w-14 h-14 text-lg",xl:"w-16 h-16 text-xl"}
|
|
12
|
+
return r.useEffect(()=>{g.current&&(g.current.indeterminate=s)},[s]),e.jsxs("label",{className:t.cn("inline-flex items-center gap-3 cursor-pointer select-none",o&&"opacity-50 cursor-not-allowed"),children:[e.jsxs("span",{className:"relative inline-flex items-center justify-center w-5 h-5",children:[e.jsx("input",{...u,ref:g,type:"checkbox",readOnly:l,disabled:o,onChange:e=>{h||p(e.target.checked),m?.(e)},checked:k,"aria-checked":s?"mixed":k?"true":"false",className:"absolute w-full h-full opacity-0 cursor-pointer peer"}),e.jsx("span",{className:t.cn("w-5 h-5 rounded border border-gray-300 dark:border-gray-600 flex items-center justify-center transition-colors duration-200",{"bg-primary border-primary dark:bg-primary-dark dark:border-primary-dark":k||s}),children:s?e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-3 h-3 text-white",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{d:"M6 10a1 1 0 011-1h6a1 1 0 110 2H7a1 1 0 01-1-1z"})}):k?e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-3 h-3 text-white fill-white",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-7.778 7.778a1 1 0 01-1.414 0L3.293 10.05a1 1 0 111.414-1.414l3.536 3.535 7.071-7.071a1 1 0 011.414 0z",clipRule:"evenodd"})}):null})]}),e.jsxs("div",{className:"flex flex-col gap-1",children:[d,a&&e.jsx("span",{className:"font-medium text-sm dark:text-white",children:a}),n&&e.jsx("span",{className:"text-secondary-700 text-sm dark:text-secondary-dark",children:n})]})]})}),L={sm:{container:"text-sm",checkbox:"w-4 h-4",label:"pl-2"},md:{container:"text-base",checkbox:"w-5 h-5",label:"pl-2"},lg:{container:"text-lg",checkbox:"w-6 h-6",label:"pl-3"}},M={solid:{label:"border-transparent bg-transparent hover:bg-gray-100 dark:text-white dark:hover:bg-gray-800",checked:"bg-primary/30 text-primary-700 hover:bg-primary/30 dark:bg-primary/30 dark:text-white dark:hover:bg-primary/30",checkbox:"border-gray-300 dark:border-gray-600",checkedCheckbox:"border-primary bg-primary dark:border-primary dark:bg-primary"},subtle:{label:"border-transparent bg-transparent hover:bg-gray-100 dark:text-white dark:hover:bg-gray-800",checked:"bg-primary/30 text-primary-700 hover:bg-primary/30 dark:bg-primary/30 dark:text-white dark:hover:bg-primary/30",checkbox:"border-gray-300 dark:border-gray-600",checkedCheckbox:"border-primary-700 bg-primary-700 dark:border-primary dark:bg-primary"},outline:{label:"border-secondary-700 bg-transparent hover:bg-gray-100 dark:text-white dark:border-secondary-dark dark:hover:bg-gray-800",checked:"border-primary bg-primary/30 text-primary-700 hover:bg-primary/30 dark:border-primary-700 dark:bg-primary/30 dark:text-white dark:hover:bg-primary/30",checkbox:"border-gray-300 dark:border-secondary-dark",checkedCheckbox:"border-primary bg-primary-700 dark:border-primary dark:bg-primary"}},E={sm:"w-10 h-10 text-sm",md:"w-12 h-12 text-base",lg:"w-14 h-14 text-lg",xl:"w-16 h-16 text-xl"},S={sm:"w-11 h-11 font-medium rounded-sm rounded rounded-full",md:"w-14 h-14 font-semibold tracking-[.2px] rounded-md rounded rounded-full",lg:"w-19 h-19 text-lg font-semibold rounded-lg rounded rounded-full"},T={base:{1:"grid-cols-1",2:"grid-cols-2",3:"grid-cols-3",4:"grid-cols-4",5:"grid-cols-5",6:"grid-cols-6",7:"grid-cols-7",8:"grid-cols-8",9:"grid-cols-9",10:"grid-cols-10",11:"grid-cols-11",12:"grid-cols-12"},sm:{1:"sm:grid-cols-1",2:"sm:grid-cols-2",3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6",7:"sm:grid-cols-7",8:"sm:grid-cols-8",9:"sm:grid-cols-9",10:"sm:grid-cols-10",11:"sm:grid-cols-11",12:"sm:grid-cols-12"},md:{1:"md:grid-cols-1",2:"md:grid-cols-2",3:"md:grid-cols-3",4:"md:grid-cols-4",5:"md:grid-cols-5",6:"md:grid-cols-6",7:"md:grid-cols-7",8:"md:grid-cols-8",9:"md:grid-cols-9",10:"md:grid-cols-10",11:"md:grid-cols-11",12:"md:grid-cols-12"},lg:{1:"lg:grid-cols-1",2:"lg:grid-cols-2",3:"lg:grid-cols-3",4:"lg:grid-cols-4",5:"lg:grid-cols-5",6:"lg:grid-cols-6",7:"lg:grid-cols-7",8:"lg:grid-cols-8",9:"lg:grid-cols-9",10:"lg:grid-cols-10",11:"lg:grid-cols-11",12:"lg:grid-cols-12"},xl:{1:"xl:grid-cols-1",2:"xl:grid-cols-2",3:"xl:grid-cols-3",4:"xl:grid-cols-4",5:"xl:grid-cols-5",6:"xl:grid-cols-6",7:"xl:grid-cols-7",8:"xl:grid-cols-8",9:"xl:grid-cols-9",10:"xl:grid-cols-10",11:"xl:grid-cols-11",12:"xl:grid-cols-12"},"2xl":{1:"2xl:grid-cols-1",2:"2xl:grid-cols-2",3:"2xl:grid-cols-3",4:"2xl:grid-cols-4",5:"2xl:grid-cols-5",6:"2xl:grid-cols-6",7:"2xl:grid-cols-7",8:"2xl:grid-cols-8",9:"2xl:grid-cols-9",10:"2xl:grid-cols-10",11:"2xl:grid-cols-11",12:"2xl:grid-cols-12"}},$={base:{1:"gap-1",2:"gap-2",3:"gap-3",4:"gap-4",5:"gap-5",6:"gap-6"},sm:{1:"sm:gap-1",2:"sm:gap-2",3:"sm:gap-3",4:"sm:gap-4",5:"sm:gap-5",6:"sm:gap-6"},md:{1:"md:gap-1",2:"md:gap-2",3:"md:gap-3",4:"md:gap-4",5:"md:gap-5",6:"md:gap-6"},lg:{1:"lg:gap-1",2:"lg:gap-2",3:"lg:gap-3",4:"lg:gap-4",5:"lg:gap-5",6:"lg:gap-6"},xl:{1:"xl:gap-1",2:"xl:gap-2",3:"xl:gap-3",4:"xl:gap-4",5:"xl:gap-5",6:"xl:gap-6"},"2xl":{1:"2xl:gap-1",2:"2xl:gap-2",3:"2xl:gap-3",4:"2xl:gap-4",5:"2xl:gap-5",6:"2xl:gap-6"}}
|
|
13
13
|
function I(e){return"number"==typeof e?{base:e}:e}const D={base:{1:"col-span-1",2:"col-span-2",3:"col-span-3",4:"col-span-4",5:"col-span-5",6:"col-span-6",7:"col-span-7",8:"col-span-8",9:"col-span-9",10:"col-span-10",11:"col-span-11",12:"col-span-12",full:"col-span-full"},sm:{1:"sm:col-span-1",2:"sm:col-span-2",3:"sm:col-span-3",4:"sm:col-span-4",5:"sm:col-span-5",6:"sm:col-span-6",7:"sm:col-span-7",8:"sm:col-span-8",9:"sm:col-span-9",10:"sm:col-span-10",11:"sm:col-span-11",12:"sm:col-span-12",full:"sm:col-span-full"},md:{1:"md:col-span-1",2:"md:col-span-2",3:"md:col-span-3",4:"md:col-span-4",5:"md:col-span-5",6:"md:col-span-6",7:"md:col-span-7",8:"md:col-span-8",9:"md:col-span-9",10:"md:col-span-10",11:"md:col-span-11",12:"md:col-span-12",full:"md:col-span-full"},lg:{1:"lg:col-span-1",2:"lg:col-span-2",3:"lg:col-span-3",4:"lg:col-span-4",5:"lg:col-span-5",6:"lg:col-span-6",7:"lg:col-span-7",8:"lg:col-span-8",9:"lg:col-span-9",10:"lg:col-span-10",11:"lg:col-span-11",12:"lg:col-span-12",full:"lg:col-span-full"},xl:{1:"xl:col-span-1",2:"xl:col-span-2",3:"xl:col-span-3",4:"xl:col-span-4",5:"xl:col-span-5",6:"xl:col-span-6",7:"xl:col-span-7",8:"xl:col-span-8",9:"xl:col-span-9",10:"xl:col-span-10",11:"xl:col-span-11",12:"xl:col-span-12",full:"xl:col-span-full"},"2xl":{1:"2xl:col-span-1",2:"2xl:col-span-2",3:"2xl:col-span-3",4:"2xl:col-span-4",5:"2xl:col-span-5",6:"2xl:col-span-6",7:"2xl:col-span-7",8:"2xl:col-span-8",9:"2xl:col-span-9",10:"2xl:col-span-10",11:"2xl:col-span-11",12:"2xl:col-span-12",full:"2xl:col-span-full"}},R={base:{1:"columns-1",2:"columns-2",3:"columns-3",4:"columns-4",5:"columns-5",6:"columns-6",7:"columns-7",8:"columns-8",9:"columns-9",10:"columns-10",11:"columns-11",12:"columns-12"},sm:{1:"sm:columns-1",2:"sm:columns-2",3:"sm:columns-3",4:"sm:columns-4",5:"sm:columns-5",6:"sm:columns-6",7:"sm:columns-7",8:"sm:columns-8",9:"sm:columns-9",10:"sm:columns-10",11:"sm:columns-11",12:"sm:columns-12"},md:{1:"md:columns-1",2:"md:columns-2",3:"md:columns-3",4:"md:columns-4",5:"md:columns-5",6:"md:columns-6",7:"md:columns-7",8:"md:columns-8",9:"md:columns-9",10:"md:columns-10",11:"md:columns-11",12:"md:columns-12"},lg:{1:"lg:columns-1",2:"lg:columns-2",3:"lg:columns-3",4:"lg:columns-4",5:"lg:columns-5",6:"lg:columns-6",7:"lg:columns-7",8:"lg:columns-8",9:"lg:columns-9",10:"lg:columns-10",11:"lg:columns-11",12:"lg:columns-12"},xl:{1:"xl:columns-1",2:"xl:columns-2",3:"xl:columns-3",4:"xl:columns-4",5:"xl:columns-5",6:"xl:columns-6",7:"xl:columns-7",8:"xl:columns-8",9:"xl:columns-9",10:"xl:columns-10",11:"xl:columns-11",12:"xl:columns-12"},"2xl":{1:"2xl:columns-1",2:"2xl:columns-2",3:"2xl:columns-3",4:"2xl:columns-4",5:"2xl:columns-5",6:"2xl:columns-6",7:"2xl:columns-7",8:"2xl:columns-8",9:"2xl:columns-9",10:"2xl:columns-10",11:"2xl:columns-11",12:"2xl:columns-12"}},B={base:{1:"gap-1",2:"gap-2",3:"gap-3",4:"gap-4",5:"gap-5",6:"gap-6"},sm:{1:"sm:gap-1",2:"sm:gap-2",3:"sm:gap-3",4:"sm:gap-4",5:"sm:gap-5",6:"sm:gap-6"},md:{1:"md:gap-1",2:"md:gap-2",3:"md:gap-3",4:"md:gap-4",5:"md:gap-5",6:"md:gap-6"},lg:{1:"lg:gap-1",2:"lg:gap-2",3:"lg:gap-3",4:"lg:gap-4",5:"lg:gap-5",6:"lg:gap-6"},xl:{1:"xl:gap-1",2:"xl:gap-2",3:"xl:gap-3",4:"xl:gap-4",5:"xl:gap-5",6:"xl:gap-6"},"2xl":{1:"2xl:gap-1",2:"2xl:gap-2",3:"2xl:gap-3",4:"2xl:gap-4",5:"2xl:gap-5",6:"2xl:gap-6"}}
|
|
14
14
|
function V(e){return"number"==typeof e?{base:e}:e}const A=r.forwardRef(({children:r,className:a,cols:n,gap:s=4,...o},l)=>{const d=(i=V(n))?Object.entries(i).map(([e,r])=>R[e]?.[r]??""):[]
|
|
15
15
|
var i
|
|
16
16
|
const c=function(e){return e?Object.entries(e).map(([e,r])=>B[e]?.[r]??""):[]}(V(s))
|
|
17
|
-
return e.jsx("div",{ref:l,className:t.cn("grid-mason",d,c,a),...o,children:r})}),F={outline:"border border-current",solid:""},O={"top-left":"top-5 left-5","bottom-left":"bottom-5 left-5","top-right":"top-5 right-5","bottom-right":"bottom-5 right-5"},P={success:"bg-success-30 border-success-700 text-success-700",info:"bg-info-30 border-info-700 text-info-700",warning:"bg-warning-30 border-warning-700 text-warning-700",error:"bg-error-30 border-error-700 text-error-700"},W={"top-right":"translate-x-0","bottom-right":"translate-x-0","top-left":"-translate-x-0","bottom-left":"-translate-x-0"},H={"top-right":"translate-x-40","bottom-right":"translate-x-40","top-left":"-translate-x-40","bottom-left":"-translate-x-40"},
|
|
17
|
+
return e.jsx("div",{ref:l,className:t.cn("grid-mason",d,c,a),...o,children:r})}),F={outline:"border border-current",solid:""},O={"top-left":"top-5 left-5","bottom-left":"bottom-5 left-5","top-right":"top-5 right-5","bottom-right":"bottom-5 right-5"},P={success:"bg-success-30 border-success-700 text-success-700",info:"bg-info-30 border-info-700 text-info-700",warning:"bg-warning-30 border-warning-700 text-warning-700",error:"bg-error-30 border-error-700 text-error-700"},W={"top-right":"translate-x-0","bottom-right":"translate-x-0","top-left":"-translate-x-0","bottom-left":"-translate-x-0"},H={"top-right":"translate-x-40","bottom-right":"translate-x-40","top-left":"-translate-x-40","bottom-left":"-translate-x-40"},q={"top-right":"translate-x-10","bottom-right":"translate-x-10","top-left":"-translate-x-10","bottom-left":"-translate-x-10"},U=({title:a,message:n,type:s,icon:o,position:l="bottom-right",variant:d="solid",withClose:i=!0,withLoading:c=!1,onClose:m})=>{const[u,x]=r.useState(!1),[g,b]=r.useState(!1),[p,h]=r.useState(!1),k=r.useRef(null)
|
|
18
18
|
r.useEffect(()=>{const e=setTimeout(()=>x(!0),50)
|
|
19
19
|
return k.current=setTimeout(()=>{f()},3500),()=>{clearTimeout(e),k.current&&clearTimeout(k.current)}},[])
|
|
20
20
|
const f=()=>{b(!0),setTimeout(()=>{m&&m()},500)}
|
|
21
|
-
return e.jsxs("div",{onMouseEnter:()=>{h(!0),k.current&&(clearTimeout(k.current),k.current=null)},onMouseLeave:()=>{h(!1),k.current=setTimeout(()=>{f()},3500)},className:t.cn("relative overflow-hidden flex max-w-sm items-start gap-3 p-4 mb-3 rounded-lg shadow-lg transition-all duration-500 transform",P[s],F[d],g?`opacity-0 ${H[l]}`:u?`opacity-100 ${W[l]}`:`opacity-0 ${
|
|
21
|
+
return e.jsxs("div",{onMouseEnter:()=>{h(!0),k.current&&(clearTimeout(k.current),k.current=null)},onMouseLeave:()=>{h(!1),k.current=setTimeout(()=>{f()},3500)},className:t.cn("relative overflow-hidden flex max-w-sm items-start gap-3 p-4 mb-3 rounded-lg shadow-lg transition-all duration-500 transform",P[s],F[d],g?`opacity-0 ${H[l]}`:u?`opacity-100 ${W[l]}`:`opacity-0 ${q[l]}`),children:[o&&e.jsx("div",{className:"text-2xl mt-1",children:o}),e.jsxs("div",{className:"flex-1",children:[a&&e.jsx("p",{className:"font-semibold text-base mb-1",children:a}),e.jsx("p",{className:"text-sm leading-snug",children:n})]}),i&&e.jsx("button",{onClick:f,className:"ml-2 text-lg leading-none hover:text-red-500 focus:outline-none cursor-pointer","aria-label":"Close",children:"×"}),c&&e.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-1 bg-current/20",children:e.jsx("div",{style:{width:u&&!p?"0%":"100%",transition:p?"none":"width 3500ms linear"},className:"h-full bg-current"})})]})},X=r.createContext(void 0),Z={sm:"max-w-sm",md:"max-w-md",lg:"max-w-2xl",xl:"max-w-4xl",full:"max-w-6xl"},G={sm:"w-3/4 md:w-64",md:"w-3/4 md:w-80",lg:"w-3/4 md:w-[40rem]"},K={sm:"px-3 py-1.5 text-xs font-medium rounded-lg",md:"px-3.5 py-2 text-sm font-medium rounded-lg",lg:"px-4.5 py-2.5 text-base font-medium rounded-lg"},Y={top:"left-1/2 -translate-x-1/2",bottom:"left-1/2 -translate-x-1/2",left:"top-1/2 -translate-y-1/2",right:"top-1/2 -translate-y-1/2"},_={top:"-bottom-[5px] left-1/2 -translate-x-1/2 border-r border-b",bottom:"-top-[5px] left-1/2 -translate-x-1/2 border-l border-t",left:"-right-[5px] top-1/2 -translate-y-1/2 border-t border-r",right:"-left-[5px] top-1/2 -translate-y-1/2 border-b border-l"},J={sm:{container:"text-sm",radio:"w-4 h-4",label:"pl-2"},md:{container:"text-base",radio:"w-5 h-5",label:"pl-2"},lg:{container:"text-lg",radio:"w-6 h-6",label:"pl-3"}},Q={solid:{label:"border-transparent bg-transparent hover:bg-gray-100 dark:text-white dark:hover:bg-gray-800",checked:"bg-primary/30 text-primary-700 hover:bg-primary/30 dark:bg-primary/30 dark:text-white dark:hover:bg-primary/30",radio:"border-gray-300 dark:border-gray-600",checkedRadio:"border-primary bg-primary dark:border-primary dark:bg-primary"},subtle:{label:"border-transparent bg-transparent hover:bg-gray-100 dark:text-white dark:hover:bg-gray-800",checked:"bg-primary/30 text-primary-700 hover:bg-primary/30 dark:bg-primary/30 dark:text-white dark:hover:bg-primary/30",radio:"border-gray-300 dark:border-gray-600",checkedRadio:"border-primary-700 bg-primary-700 dark:border-primary dark:bg-primary"},outline:{label:"border-secondary-700 bg-transparent hover:bg-gray-100 dark:text-white dark:border-secondary-dark dark:hover:bg-gray-800",checked:"border-primary bg-primary/30 text-primary-700 hover:bg-primary/30 dark:border-primary-700 dark:bg-primary/30 dark:text-white dark:hover:bg-primary/30",radio:"border-gray-300 dark:border-secondary-dark",checkedRadio:"border-primary bg-primary-700 dark:border-primary dark:bg-primary"}},ee={neutral:"bg-gray-900 text-white border-gray-900 dark:bg-neutral-800 dark:text-neutral-100 dark:border-neutral-700",primary:"bg-primary text-white border-primary dark:bg-primary-dark dark:border-primary-dark",secondary:"bg-secondary text-white border-secondary dark:bg-secondary-dark dark:border-secondary-dark",success:"bg-success text-white border-success dark:bg-success-dark dark:border-success-dark",warning:"bg-warning text-white border-warning dark:bg-warning-dark dark:border-warning-dark",error:"bg-error text-white border-error dark:bg-error-dark dark:border-error-dark",info:"bg-info text-white border-info dark:bg-info-dark dark:border-info-dark"},re=({children:a,text:n,showArrow:s=!0,placement:o="top",offset:l=8,color:d="neutral",isOpen:i,onOpenChange:c,disabled:m=!1,animationDuration:u=200,delay:x=300})=>{const[g,b]=r.useState(!1),p=r.useId(),h=void 0!==i,k=h?i:g,f=()=>{h||b(!0),c?.(!0)},y=()=>{h||b(!1),c?.(!1)}
|
|
22
|
+
if(m||!n)return e.jsx(e.Fragment,{children:a})
|
|
23
|
+
const w=ee[d]
|
|
24
|
+
return e.jsxs("div",{className:"relative inline-flex",onMouseEnter:f,onMouseLeave:y,onFocus:f,onBlur:y,"aria-describedby":k?p:void 0,children:[a,e.jsxs("div",{id:p,role:"tooltip",className:t.cn("absolute z-30 whitespace-nowrap rounded-md border px-2.5 py-1 text-xs font-medium tracking-tight shadow-md pointer-events-none transition-opacity",w,k?"opacity-100 visible":"opacity-0 invisible"),style:{...(()=>{switch(o){case"top":return{bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:`${l}px`}
|
|
22
25
|
case"bottom":return{top:"100%",left:"50%",transform:"translateX(-50%)",marginTop:`${l}px`}
|
|
23
26
|
case"left":return{right:"100%",top:"50%",transform:"translateY(-50%)",marginRight:`${l}px`}
|
|
24
|
-
case"right":return{left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:`${l}px`}}})(),transitionDelay:
|
|
25
|
-
|
|
26
|
-
case"
|
|
27
|
-
case"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const te={primary:"bg-primary-30 dark:bg-primary-dark-30 hover:[&::-webkit-slider-thumb]:transition-all hover:[&::-webkit-slider-thumb]:duration-300 [&::-webkit-slider-thumb]:outline-5 hover:[&::-webkit-slider-thumb]:outline-10 [&::-webkit-slider-thumb]:outline-primary-30 [&::-webkit-slider-thumb]:bg-primary dark:[&::-webkit-slider-thumb]:bg-primary-dark [&::-webkit-slider-thumb]:outline-primary-30 dark:[&::-webkit-slider-thumb]:outline-primary-dark-30",error:"bg-error-30 dark:bg-error-dark-30 [&::-webkit-slider-thumb]:outline-5 [&::-webkit-slider-thumb]:outline-error-30 [&::-webkit-slider-thumb]:bg-error dark:[&::-webkit-slider-thumb]:bg-error-dark dark:[&::-webkit-slider-thumb]:outline-5 dark:[&::-webkit-slider-thumb]:outline-error-dark-30",warning:"bg-warning-30 dark:bg-warning-dark-30 [&::-webkit-slider-thumb]:outline-5 [&::-webkit-slider-thumb]:outline-warning-30 [&::-webkit-slider-thumb]:bg-warning dark:[&::-webkit-slider-thumb]:bg-warning-dark dark:[&::-webkit-slider-thumb]:outline-5 dark:[&::-webkit-slider-thumb]:outline-warning-dark-30",success:"bg-success-30 dark:bg-success-dark-30 [&::-webkit-slider-thumb]:outline-5 [&::-webkit-slider-thumb]:outline-success-30 [&::-webkit-slider-thumb]:bg-success dark:[&::-webkit-slider-thumb]:bg-success-dark dark:[&::-webkit-slider-thumb]:outline-5 dark:[&::-webkit-slider-thumb]:outline-success-dark-30",info:"bg-info-30 dark:bg-info-dark-30 [&::-webkit-slider-thumb]:outline-5 [&::-webkit-slider-thumb]:outline-info-30 [&::-webkit-slider-thumb]:bg-info dark:[&::-webkit-slider-thumb]:bg-info-dark dark:[&::-webkit-slider-thumb]:outline-5 dark:[&::-webkit-slider-thumb]:outline-info-dark-30",secondary:"bg-secondary dark:bg-secondary-dark [&::-webkit-slider-thumb]:outline-5 [&::-webkit-slider-thumb]:outline-secondary [&::-webkit-slider-thumb]:bg-secondary-700 dark:[&::-webkit-slider-thumb]:bg-secondary-dark-700 dark:[&::-webkit-slider-thumb]:outline-5 dark:[&::-webkit-slider-thumb]:outline-secondary-dark"},ae={sm:"h-1 [&::-webkit-slider-thumb]:w-3 [&::-webkit-slider-thumb]:h-3 [&::-moz-range-thumb]:w-3 [&::-moz-range-thumb]:h-3",md:"h-2 [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-moz-range-thumb]:w-4 [&::-moz-range-thumb]:h-4",lg:"h-3 [&::-webkit-slider-thumb]:w-5 [&::-webkit-slider-thumb]:h-5 [&::-moz-range-thumb]:w-5 [&::-moz-range-thumb]:h-5",xl:"h-4 [&::-webkit-slider-thumb]:w-6 [&::-webkit-slider-thumb]:h-6 [&::-moz-range-thumb]:w-6 [&::-moz-range-thumb]:h-6"},ne={sm:"h-4 w-4 border-2",md:"h-6 w-6 border-3",lg:"h-8 w-8 border-4"},se={primary:"border-primary dark:border-primary-dark",error:"border-error dark:border-error-dark",warning:"border-warning dark:border-warning-dark",success:"border-success dark:border-success-dark",info:"border-info dark:border-info-dark",secondary:"border-secondary dark:border-secondary-dark"},oe={sm:"text-xs",md:"text-sm",lg:"text-base"},le={right:"flex-row",left:"flex-row-reverse",bottom:"flex-col",top:"flex-col-reverse"},de={sm:"text-xs py-2 px-3",md:"text-sm py-3 px-4",lg:"text-base py-3.5 px-5"},ie={line:{wrapper:"border-b border-gray-200 dark:border-neutral-800",button:"whitespace-nowrap py-3 px-3 font-medium text-sm",active:"text-primary dark:text-primary-dark",inactive:"text-gray-500 hover:text-gray-800 dark:text-neutral-400 dark:hover:text-neutral-100"},solid:{wrapper:"rounded-lg bg-gray-100 dark:bg-neutral-900 border border-gray-200 dark:border-neutral-800 p-1",button:"whitespace-nowrap py-2 px-4 font-medium text-sm rounded-md",active:"bg-primary/15 dark:bg-primary/25 text-primary dark:text-neutral-100",inactive:"text-gray-500 hover:text-gray-800 dark:text-neutral-400 dark:hover:text-neutral-100"},subtle:{wrapper:"rounded-lg bg-transparent p-1",button:"whitespace-nowrap py-2 px-4 font-medium text-sm rounded-md",active:"text-white",inactive:"text-gray-600 hover:text-primary dark:text-neutral-400 dark:hover:text-neutral-100"},inline:{wrapper:"border-b border-gray-200 dark:border-neutral-800",button:"whitespace-nowrap py-2 px-4 font-medium text-sm rounded-t-md",active:"text-white",inactive:"text-gray-500 hover:text-gray-800 dark:text-neutral-400 dark:hover:text-neutral-100"},outline:{wrapper:"border border-gray-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 rounded-lg p-1",button:"whitespace-nowrap py-2 px-4 font-medium text-sm rounded-md",active:"bg-primary/15 dark:bg-primary/25 text-primary dark:text-neutral-100",inactive:"text-gray-500 hover:text-gray-800 dark:text-neutral-400 dark:hover:text-neutral-100"},plain:{wrapper:"",button:"whitespace-nowrap py-2 px-3 font-medium text-sm",active:"text-primary dark:text-primary-dark",inactive:"text-gray-500 hover:text-gray-800 dark:text-neutral-400 dark:hover:text-neutral-100"}},ce={line:"absolute bottom-0 h-0.5 bg-primary dark:bg-primary-dark transition-all duration-300 ease-in-out z-0",solid:"absolute bottom-0 h-0.5 bg-primary dark:bg-primary-dark rounded-full transition-all duration-300 ease-in-out z-0",subtle:"absolute inset-y-0 bg-primary dark:bg-primary-dark rounded-md transition-all duration-300 ease-in-out z-0",inline:"absolute inset-y-0 bg-primary dark:bg-primary-dark rounded-t-md transition-all duration-300 ease-in-out z-0",outline:"absolute bottom-0 h-0.5 bg-primary dark:bg-primary-dark rounded-full transition-all duration-300 ease-in-out z-0",plain:"hidden"},me={success:"bg-success dark:bg-success-dark",info:"bg-info dark:bg-info-dark",error:"bg-error dark:bg-error-dark",warning:"bg-warning dark:bg-warning-dark",primary:"bg-primary dark:bg-primary-dark",default:"bg-secondary-700 dark:bg-secondary-dark"},ue={success:"border-success dark:border-success-dark md:before:border-success md:before:dark:border-success-dark",info:"border-info dark:border-info-dark md:before:border-info md:before:dark:border-info-dark",error:"border-error dark:border-error-dark md:before:border-error md:before:dark:border-error-dark",warning:"border-warning dark:border-warning-dark md:before:border-warning md:before:dark:border-warning-dark",primary:"border-primary dark:border-primary-dark md:before:border-primary md:before:dark:border-primary-dark",default:"border-secondary-700 dark:border-secondary-dark md:before:border-secondary md:before:dark:border-secondary-dark"},xe=({position:a="left",lineColor:n="default",children:s})=>{const o=r.Children.map(s,e=>r.isValidElement(e)?r.cloneElement(e,{position:a}):e),l=ue[n]
|
|
27
|
+
case"right":return{left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:`${l}px`}}})(),transitionDelay:k&&!h?`${x}ms`:"0ms",transitionDuration:`${u}ms`},children:[n,s&&e.jsx("span",{"aria-hidden":"true",className:t.cn("absolute w-2 h-2 rotate-45",w,(()=>{switch(o){case"top":return"-bottom-[5px] left-1/2 -translate-x-1/2 border-r border-b"
|
|
28
|
+
case"bottom":return"-top-[5px] left-1/2 -translate-x-1/2 border-l border-t"
|
|
29
|
+
case"left":return"-right-[5px] top-1/2 -translate-y-1/2 border-t border-r"
|
|
30
|
+
case"right":return"-left-[5px] top-1/2 -translate-y-1/2 border-b border-l"}})())})]})]})},te=r.forwardRef(({label:r,id:a,name:n,error:s,...o},l)=>e.jsxs("div",{className:"w-full",children:[r&&e.jsx("label",{htmlFor:a||n,className:"block text-sm font-medium mb-1 text-gray-900 dark:text-neutral-100",children:r}),e.jsx("input",{ref:l,id:a||n,name:n,className:t.cn("block w-full px-3 py-2 border rounded-md shadow-sm sm:text-sm transition-colors","bg-white border-gray-200 text-gray-900 placeholder:text-gray-400","dark:bg-neutral-900 dark:border-neutral-800 dark:text-neutral-100 dark:placeholder:text-neutral-500","focus:outline-none focus:ring-1 focus:ring-primary focus:border-primary dark:focus:ring-primary-dark dark:focus:border-primary-dark",s&&"border-error dark:border-error-dark focus:ring-error focus:border-error dark:focus:ring-error-dark dark:focus:border-error-dark",o.disabled&&"opacity-50 bg-gray-100 dark:bg-neutral-800 cursor-not-allowed"),...o}),s&&e.jsx("p",{className:"mt-1 text-sm text-error dark:text-error-dark",children:s})]}))
|
|
31
|
+
te.displayName="TextInput"
|
|
32
|
+
const ae={primary:"bg-primary-30 dark:bg-primary-dark-30 hover:[&::-webkit-slider-thumb]:transition-all hover:[&::-webkit-slider-thumb]:duration-300 [&::-webkit-slider-thumb]:outline-5 hover:[&::-webkit-slider-thumb]:outline-10 [&::-webkit-slider-thumb]:outline-primary-30 [&::-webkit-slider-thumb]:bg-primary dark:[&::-webkit-slider-thumb]:bg-primary-dark [&::-webkit-slider-thumb]:outline-primary-30 dark:[&::-webkit-slider-thumb]:outline-primary-dark-30",error:"bg-error-30 dark:bg-error-dark-30 [&::-webkit-slider-thumb]:outline-5 [&::-webkit-slider-thumb]:outline-error-30 [&::-webkit-slider-thumb]:bg-error dark:[&::-webkit-slider-thumb]:bg-error-dark dark:[&::-webkit-slider-thumb]:outline-5 dark:[&::-webkit-slider-thumb]:outline-error-dark-30",warning:"bg-warning-30 dark:bg-warning-dark-30 [&::-webkit-slider-thumb]:outline-5 [&::-webkit-slider-thumb]:outline-warning-30 [&::-webkit-slider-thumb]:bg-warning dark:[&::-webkit-slider-thumb]:bg-warning-dark dark:[&::-webkit-slider-thumb]:outline-5 dark:[&::-webkit-slider-thumb]:outline-warning-dark-30",success:"bg-success-30 dark:bg-success-dark-30 [&::-webkit-slider-thumb]:outline-5 [&::-webkit-slider-thumb]:outline-success-30 [&::-webkit-slider-thumb]:bg-success dark:[&::-webkit-slider-thumb]:bg-success-dark dark:[&::-webkit-slider-thumb]:outline-5 dark:[&::-webkit-slider-thumb]:outline-success-dark-30",info:"bg-info-30 dark:bg-info-dark-30 [&::-webkit-slider-thumb]:outline-5 [&::-webkit-slider-thumb]:outline-info-30 [&::-webkit-slider-thumb]:bg-info dark:[&::-webkit-slider-thumb]:bg-info-dark dark:[&::-webkit-slider-thumb]:outline-5 dark:[&::-webkit-slider-thumb]:outline-info-dark-30",secondary:"bg-secondary dark:bg-secondary-dark [&::-webkit-slider-thumb]:outline-5 [&::-webkit-slider-thumb]:outline-secondary [&::-webkit-slider-thumb]:bg-secondary-700 dark:[&::-webkit-slider-thumb]:bg-secondary-dark-700 dark:[&::-webkit-slider-thumb]:outline-5 dark:[&::-webkit-slider-thumb]:outline-secondary-dark"},ne={sm:"h-1 [&::-webkit-slider-thumb]:w-3 [&::-webkit-slider-thumb]:h-3 [&::-moz-range-thumb]:w-3 [&::-moz-range-thumb]:h-3",md:"h-2 [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-moz-range-thumb]:w-4 [&::-moz-range-thumb]:h-4",lg:"h-3 [&::-webkit-slider-thumb]:w-5 [&::-webkit-slider-thumb]:h-5 [&::-moz-range-thumb]:w-5 [&::-moz-range-thumb]:h-5",xl:"h-4 [&::-webkit-slider-thumb]:w-6 [&::-webkit-slider-thumb]:h-6 [&::-moz-range-thumb]:w-6 [&::-moz-range-thumb]:h-6"},se={sm:"h-4 w-4 border-2",md:"h-6 w-6 border-3",lg:"h-8 w-8 border-4"},oe={primary:"border-primary dark:border-primary-dark",error:"border-error dark:border-error-dark",warning:"border-warning dark:border-warning-dark",success:"border-success dark:border-success-dark",info:"border-info dark:border-info-dark",secondary:"border-secondary dark:border-secondary-dark"},le={sm:"text-xs",md:"text-sm",lg:"text-base"},de={right:"flex-row",left:"flex-row-reverse",bottom:"flex-col",top:"flex-col-reverse"},ie={sm:"text-xs py-2 px-3",md:"text-sm py-3 px-4",lg:"text-base py-3.5 px-5"},ce={line:{wrapper:"border-b border-gray-200 dark:border-neutral-800",button:"whitespace-nowrap py-3 px-3 font-medium text-sm",active:"text-primary dark:text-primary-dark",inactive:"text-gray-500 hover:text-gray-800 dark:text-neutral-400 dark:hover:text-neutral-100"},solid:{wrapper:"rounded-lg bg-gray-100 dark:bg-neutral-900 border border-gray-200 dark:border-neutral-800 p-1",button:"whitespace-nowrap py-2 px-4 font-medium text-sm rounded-md",active:"bg-primary/15 dark:bg-primary/25 text-primary dark:text-neutral-100",inactive:"text-gray-500 hover:text-gray-800 dark:text-neutral-400 dark:hover:text-neutral-100"},subtle:{wrapper:"rounded-lg bg-transparent p-1",button:"whitespace-nowrap py-2 px-4 font-medium text-sm rounded-md",active:"text-white",inactive:"text-gray-600 hover:text-primary dark:text-neutral-400 dark:hover:text-neutral-100"},inline:{wrapper:"border-b border-gray-200 dark:border-neutral-800",button:"whitespace-nowrap py-2 px-4 font-medium text-sm rounded-t-md",active:"text-white",inactive:"text-gray-500 hover:text-gray-800 dark:text-neutral-400 dark:hover:text-neutral-100"},outline:{wrapper:"border border-gray-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 rounded-lg p-1",button:"whitespace-nowrap py-2 px-4 font-medium text-sm rounded-md",active:"bg-primary/15 dark:bg-primary/25 text-primary dark:text-neutral-100",inactive:"text-gray-500 hover:text-gray-800 dark:text-neutral-400 dark:hover:text-neutral-100"},plain:{wrapper:"",button:"whitespace-nowrap py-2 px-3 font-medium text-sm",active:"text-primary dark:text-primary-dark",inactive:"text-gray-500 hover:text-gray-800 dark:text-neutral-400 dark:hover:text-neutral-100"}},me={line:"absolute bottom-0 h-0.5 bg-primary dark:bg-primary-dark transition-all duration-300 ease-in-out z-0",solid:"absolute bottom-0 h-0.5 bg-primary dark:bg-primary-dark rounded-full transition-all duration-300 ease-in-out z-0",subtle:"absolute inset-y-0 bg-primary dark:bg-primary-dark rounded-md transition-all duration-300 ease-in-out z-0",inline:"absolute inset-y-0 bg-primary dark:bg-primary-dark rounded-t-md transition-all duration-300 ease-in-out z-0",outline:"absolute bottom-0 h-0.5 bg-primary dark:bg-primary-dark rounded-full transition-all duration-300 ease-in-out z-0",plain:"hidden"},ue={success:"bg-success dark:bg-success-dark",info:"bg-info dark:bg-info-dark",error:"bg-error dark:bg-error-dark",warning:"bg-warning dark:bg-warning-dark",primary:"bg-primary dark:bg-primary-dark",default:"bg-secondary-700 dark:bg-secondary-dark"},xe={success:"border-success dark:border-success-dark md:before:border-success md:before:dark:border-success-dark",info:"border-info dark:border-info-dark md:before:border-info md:before:dark:border-info-dark",error:"border-error dark:border-error-dark md:before:border-error md:before:dark:border-error-dark",warning:"border-warning dark:border-warning-dark md:before:border-warning md:before:dark:border-warning-dark",primary:"border-primary dark:border-primary-dark md:before:border-primary md:before:dark:border-primary-dark",default:"border-secondary-700 dark:border-secondary-dark md:before:border-secondary md:before:dark:border-secondary-dark"},ge=({position:a="left",lineColor:n="default",children:s})=>{const o=r.Children.map(s,e=>r.isValidElement(e)?r.cloneElement(e,{position:a}):e),l=xe[n]
|
|
31
33
|
return e.jsx("ol",{className:t.cn("relative",{"border-s-2":"left"===a,"border-e-2":"right"===a,"border-s-2 md:border-s-0 md:before:content-[''] md:before:absolute md:before:top-0 md:before:left-1/2 md:before:h-full md:before:border-s-2 md:before:border-secondary md:before:dark:border-secondary-dark":"split"===a},l),children:o})}
|
|
32
|
-
|
|
34
|
+
ge.Item=({title:r,time:a,children:n,dotColor:s="default",icon:o,position:l})=>{const d=ue[s]
|
|
33
35
|
return e.jsxs("li",{className:t.cn("mb-5",{"ms-8":"left"===l,"me-8 text-end":"right"===l,"ms-4 md:w-1/2 ps-4 md:odd:pe-8 md:odd:ms-0 md:odd:text-end md:even:ps-8 md:even:ms-auto":"split"===l}),children:[o?e.jsx("div",{className:t.cn("flex items-center justify-center absolute w-10 h-10 rounded-full mt-1.5 outline outline-white dark:outline-secondary",d,{"-start-[20px]":"left"===l||"split"===l&&"md:hidden","-end-[21px]":"right"===l,"-start-[21px] md:start-1/2 md:-ms-[19px]":"split"===l}),children:o}):e.jsx("div",{className:t.cn("absolute w-3 h-3 rounded-full mt-1.5 outline outline-white dark:outline-secondary",d,{"-start-[7px]":"left"===l||"split"===l&&"md:hidden","-end-[7px]":"right"===l,"-start-[7.1px] md:start-1/2 md:-ms-[4.7px]":"split"===l})}),e.jsx("time",{className:"mb-1 text-sm font-normal leading-none text-gray-400 dark:text-secondary-dark",children:a}),e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:r}),e.jsx("p",{className:"mb-4 text-base font-normal text-secondary-foreground dark:text-secondary-foreground-dark",children:n})]})}
|
|
34
|
-
const
|
|
36
|
+
const be={primary:"peer-checked:bg-primary dark:peer-checked:bg-primary-dark",error:"peer-checked:bg-error dark:peer-checked:bg-error-dark",warning:"peer-checked:bg-warning dark:peer-checked:bg-warning-dark",success:"peer-checked:bg-success dark:peer-checked:bg-success-dark",info:"peer-checked:bg-info dark:peer-checked:bg-info-dark",secondary:"peer-checked:bg-secondary dark:peer-checked:bg-secondary-dark"},pe={stadium:"rounded-full after:rounded-full",rounded:"rounded-md after:rounded-sm"},he={sm:"w-9 h-5 after:h-4 after:w-4 after:start-[2px] after:top-[2px] peer-checked:after:translate-x-[16px] rtl:peer-checked:after:-translate-x-[16px]",md:"w-11 h-6 after:h-5 after:w-5 after:start-[2px] after:top-[2px] peer-checked:after:translate-x-[20px] rtl:peer-checked:after:-translate-x-[20px]",lg:"w-14 h-7 after:h-6 after:w-6 after:start-[2px] after:top-[2px] peer-checked:after:translate-x-[28px] rtl:peer-checked:after:-translate-x-[28px]"}
|
|
35
37
|
exports.Accordion=({data:a,openIndex:n,single:s=!0,onToggleItem:o,icon:l,...d})=>{const i=void 0!==n&&void 0!==o,[c,m]=r.useState([]),u=i?Array.isArray(n)?n:null!=n?[n]:[]:c
|
|
36
38
|
return e.jsx("div",{className:"space-y-2",...d,children:a.map((r,a)=>{const n=u.includes(a)
|
|
37
39
|
return e.jsxs("div",{className:"border border-gray-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 rounded-lg overflow-hidden transition-colors",children:[e.jsxs("button",{type:"button","aria-expanded":n,onClick:()=>(e=>{const r=u.includes(e),t=s?r?[]:[e]:r?u.filter(r=>r!==e):[...u,e]
|
|
@@ -54,7 +56,7 @@ r.useEffect(()=>{if(d)u(!0),g(!1)
|
|
|
54
56
|
else if(m){g(!0)
|
|
55
57
|
const e=setTimeout(()=>{u(!1),g(!1)},300)
|
|
56
58
|
return()=>clearTimeout(e)}},[d,m])
|
|
57
|
-
const b
|
|
59
|
+
const b=S[s],p=j(o,l),h=r.Children.toArray(a).map((a,n,s)=>{if(!r.isValidElement(a))return a
|
|
58
60
|
const o=s.length-1-n
|
|
59
61
|
return e.jsx("div",{style:{animationDelay:(x?100*o:100*n)+"ms"},className:t.cn(!x&&"opacity-0",x?"animate-pop-out":"animate-pop"),children:a},n)})
|
|
60
62
|
return e.jsx("div",{className:"fixed bottom-8 right-8 flex flex-col items-end z-50",children:e.jsxs("div",{className:"vertical"===n?"block":"flex",children:[e.jsx("div",{className:t.cn("flex items-center transition-all duration-300 ease-in-out",{vertical:"flex-col-reverse space-y-2 space-y-reverse mb-2",horizontal:"flex-row-reverse space-x-2 space-x-reverse mr-2"}[n]),children:m&&h}),e.jsx("button",{onClick:i,className:t.cn("shadow-lg flex w-full items-center justify-center hover:cursor-pointer",b,p),"aria-expanded":d,"aria-haspopup":"true",children:e.jsx("span",{className:"transform transition-transform duration-300 "+(d?"rotate-45":"rotate-0"),children:c})})]})})},exports.FileUpload=({acceptedFiles:a="image/*",maxFiles:n=1,inputLabel:s,maxKiloByte:o=2048,helperText:l,mediaCapture:d,mode:i="dropzone",clearable:c=!0,onFilesChange:m})=>{const[u,x]=r.useState([]),[g,b]=r.useState(""),[p,h]=r.useState(!1),k=r.useRef(null),f=e=>{const r=e.target.files?Array.from(e.target.files):[]
|
|
@@ -76,9 +78,9 @@ return"dropzone"===i?e.jsxs("div",{className:"",children:[e.jsxs("div",{classNam
|
|
|
76
78
|
const r=Array.from(e.dataTransfer.files),t=v(r)
|
|
77
79
|
if(!t.length)return
|
|
78
80
|
const a=1===n?t.slice(0,1):[...u,...t].slice(0,n)
|
|
79
|
-
x(a),m(a),b(""),k.current.value=""},onClick:w,children:[e.jsx("input",{type:"file",ref:k,className:"hidden",accept:a,multiple:n>1,capture:d,onChange:f}),u.length>0?j():e.jsx("p",{className:"text-sm md:text-base",children:"Drag & drop files here, or click to select files"})]}),g?e.jsx("p",{className:"text-error text-sm mt-2",children:g}):l&&e.jsx("p",{className:"text-sm text-gray-500 dark:text-secondary-dark mt-2",children:l})]}):e.jsxs("div",{onClick:w,className:"cursor-pointer inline-block",children:[e.jsx("input",{type:"file",ref:k,accept:a,multiple:n>1,capture:d,onChange:f,className:"hidden"}),e.jsx("div",{className:"inline-flex items-center gap-2 px-4 py-2 border border-secondary rounded bg-gray-50 hover:bg-secondary-30 text-sm dark:border-secondary-dark dark:bg-gray-700 dark:hover:bg-secondary-dark-700 dark:text-white",children:e.jsx("span",{className:"font-medium",children:u.length>0?`${u.length} file${u.length>1?"s":""} selected`:s??"Choose file"})}),u.length>0&&e.jsx("div",{className:"flex gap-5 flex-wrap mt-2",children:j()}),g?e.jsx("p",{className:"text-error text-sm mt-2",children:g}):l&&e.jsx("p",{className:"text-sm text-gray-500 dark:text-secondary-dark mt-2",children:l})]})},exports.Grid=({className:r,cols:a,gap:n,children:s,style:o,...l})=>{const d=(i=I(a))?Object.entries(i).map(([e,r])=>
|
|
81
|
+
x(a),m(a),b(""),k.current.value=""},onClick:w,children:[e.jsx("input",{type:"file",ref:k,className:"hidden",accept:a,multiple:n>1,capture:d,onChange:f}),u.length>0?j():e.jsx("p",{className:"text-sm md:text-base",children:"Drag & drop files here, or click to select files"})]}),g?e.jsx("p",{className:"text-error text-sm mt-2",children:g}):l&&e.jsx("p",{className:"text-sm text-gray-500 dark:text-secondary-dark mt-2",children:l})]}):e.jsxs("div",{onClick:w,className:"cursor-pointer inline-block",children:[e.jsx("input",{type:"file",ref:k,accept:a,multiple:n>1,capture:d,onChange:f,className:"hidden"}),e.jsx("div",{className:"inline-flex items-center gap-2 px-4 py-2 border border-secondary rounded bg-gray-50 hover:bg-secondary-30 text-sm dark:border-secondary-dark dark:bg-gray-700 dark:hover:bg-secondary-dark-700 dark:text-white",children:e.jsx("span",{className:"font-medium",children:u.length>0?`${u.length} file${u.length>1?"s":""} selected`:s??"Choose file"})}),u.length>0&&e.jsx("div",{className:"flex gap-5 flex-wrap mt-2",children:j()}),g?e.jsx("p",{className:"text-error text-sm mt-2",children:g}):l&&e.jsx("p",{className:"text-sm text-gray-500 dark:text-secondary-dark mt-2",children:l})]})},exports.Grid=({className:r,cols:a,gap:n,children:s,style:o,...l})=>{const d=(i=I(a))?Object.entries(i).map(([e,r])=>T[e]?.[r]??""):[]
|
|
80
82
|
var i
|
|
81
|
-
const c=function(e){return e?Object.entries(e).map(([e,r])
|
|
83
|
+
const c=function(e){return e?Object.entries(e).map(([e,r])=>$[e]?.[r]??""):[]}(I(n))
|
|
82
84
|
return e.jsx("div",{className:t.cn("grid",d,c,r),...l,children:s})},exports.GridItem=({className:r,colSpan:a,children:n,...s})=>{const o=(l="number"==typeof(d=a)?{base:d}:d)?Object.entries(l).map(([e,r])=>D[e]?.[r]??""):[]
|
|
83
85
|
var l,d
|
|
84
86
|
return e.jsx("div",{className:t.cn(...o,r),...s,children:n})},exports.ListCheckboxInput=({name:r,options:a,selectedValues:n,onValueChange:s,variant:o="subtle",checkboxSize:l="md",disabled:d,...i})=>{const c=L[l],m=M[o]
|
|
@@ -88,12 +90,12 @@ s(e)},disabled:d,className:t.cn("absolute opacity-0 w-full h-full cursor-pointer
|
|
|
88
90
|
return r.useEffect(()=>{let e,r
|
|
89
91
|
return a?(m(!0),e=setTimeout(()=>x(!0),15)):(x(!1),r=setTimeout(()=>m(!1),200)),()=>{clearTimeout(e),clearTimeout(r)}},[a]),r.useEffect(()=>{if(!a)return
|
|
90
92
|
const e=e=>{"Escape"===e.key&&s()},r=document.body.style.overflow
|
|
91
|
-
return document.body.style.overflow="hidden",document.addEventListener("keydown",e),()=>{document.body.style.overflow=r,document.removeEventListener("keydown",e)}},[a,s]),c?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 sm:p-6",role:"dialog","aria-modal":"true","aria-labelledby":o?g:void 0,children:[e.jsx("div",{className:t.cn("fixed inset-0 bg-black/50 backdrop-blur-xs transition-opacity duration-200",u?"opacity-100":"opacity-0"),onClick:n?s:void 0}),e.jsxs("div",{className:t.cn("relative z-10 flex flex-col w-full max-h-[90vh] rounded-xl border border-gray-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 shadow-2xl transition-all duration-200 ease-out",
|
|
93
|
+
return document.body.style.overflow="hidden",document.addEventListener("keydown",e),()=>{document.body.style.overflow=r,document.removeEventListener("keydown",e)}},[a,s]),c?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 sm:p-6",role:"dialog","aria-modal":"true","aria-labelledby":o?g:void 0,children:[e.jsx("div",{className:t.cn("fixed inset-0 bg-black/50 backdrop-blur-xs transition-opacity duration-200",u?"opacity-100":"opacity-0"),onClick:n?s:void 0}),e.jsxs("div",{className:t.cn("relative z-10 flex flex-col w-full max-h-[90vh] rounded-xl border border-gray-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 shadow-2xl transition-all duration-200 ease-out",Z[i],u?"opacity-100 scale-100 translate-y-0":"opacity-0 scale-95 translate-y-2"),onClick:e=>e.stopPropagation(),children:[(o||d)&&e.jsxs("div",{className:"flex items-center justify-between gap-4 shrink-0 px-5 py-4 border-b border-gray-200 dark:border-neutral-800",children:[o&&e.jsx("h2",{id:g,className:"text-lg font-semibold text-gray-900 dark:text-neutral-100 leading-snug",children:o}),d&&e.jsx("button",{type:"button",onClick:s,className:"ml-auto -mr-1.5 p-1.5 rounded-lg text-gray-500 hover:text-gray-800 hover:bg-gray-100 dark:text-neutral-400 dark:hover:text-neutral-100 dark:hover:bg-neutral-800 transition-colors cursor-pointer","aria-label":"Close modal",children:e.jsx("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",children:e.jsx("path",{d:"M6 18L18 6M6 6l12 12",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),e.jsx("div",{className:"p-5 overflow-y-auto text-gray-700 dark:text-neutral-300",children:l})]})]}):null},exports.Offcanvas=({isOpen:a,onClose:n,title:s,children:o,position:l="right",width:d="md",overlayClose:i=!0,showCloseButton:c=!0})=>{const m=r.useId()
|
|
92
94
|
r.useEffect(()=>{if(!a)return
|
|
93
95
|
const e=e=>{"Escape"===e.key&&n()},r=document.body.style.overflow
|
|
94
96
|
return document.body.style.overflow="hidden",document.addEventListener("keydown",e),()=>{document.body.style.overflow=r,document.removeEventListener("keydown",e)}},[a,n])
|
|
95
97
|
const u="right"===l?"right-0 border-l border-gray-200 dark:border-neutral-800":"left-0 border-r border-gray-200 dark:border-neutral-800",x=a?"translate-x-0":"right"===l?"translate-x-full":"-translate-x-full"
|
|
96
|
-
return e.jsxs(e.Fragment,{children:[e.jsx("div",{onClick:i?n:void 0,"aria-hidden":"true",className:t.cn("fixed inset-0 z-40 bg-black/50 backdrop-blur-xs transition-opacity duration-300",a?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none")}),e.jsxs("aside",{role:"dialog","aria-modal":"true","aria-hidden":!a,"aria-labelledby":s?m:void 0,className:t.cn("fixed top-0 z-50 flex flex-col h-full bg-white dark:bg-neutral-900 shadow-2xl transform transition-transform duration-300 ease-in-out",
|
|
98
|
+
return e.jsxs(e.Fragment,{children:[e.jsx("div",{onClick:i?n:void 0,"aria-hidden":"true",className:t.cn("fixed inset-0 z-40 bg-black/50 backdrop-blur-xs transition-opacity duration-300",a?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none")}),e.jsxs("aside",{role:"dialog","aria-modal":"true","aria-hidden":!a,"aria-labelledby":s?m:void 0,className:t.cn("fixed top-0 z-50 flex flex-col h-full bg-white dark:bg-neutral-900 shadow-2xl transform transition-transform duration-300 ease-in-out",G[d],u,x),children:[(s||c)&&e.jsxs("div",{className:"flex items-center justify-between gap-4 shrink-0 px-5 py-4 border-b border-gray-200 dark:border-neutral-800",children:[s&&e.jsx("h5",{id:m,className:"text-lg font-semibold text-gray-900 dark:text-neutral-100 leading-snug",children:s}),c&&e.jsx("button",{type:"button",onClick:n,className:"ml-auto -mr-1.5 p-1.5 rounded-lg text-gray-500 hover:text-gray-800 hover:bg-gray-100 dark:text-neutral-400 dark:hover:text-neutral-100 dark:hover:bg-neutral-800 transition-colors cursor-pointer","aria-label":"Close offcanvas",children:e.jsx("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",children:e.jsx("path",{d:"M6 18L18 6M6 6l12 12",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),e.jsx("div",{className:"flex-1 p-5 overflow-y-auto text-gray-700 dark:text-neutral-300",children:o})]})]})},exports.Pagination=({currentPage:r,simplified:a=!1,format:n="none",count:s,pageSize:o,asLink:l=!1,getPageHref:d,totalPages:i,onPageChange:c,siblingCount:m=1,prevIcon:u,nextIcon:x,size:g="md"})=>{void 0!==s&&void 0!==o&&void 0!==i&&Math.ceil(s/o)
|
|
97
99
|
const b=void 0!==s&&void 0!==o&&o>0?Math.ceil(s/o):i??1
|
|
98
100
|
if(b<=1)return null
|
|
99
101
|
const p="...",h=e=>{const t=Math.max(1,Math.min(e,b))
|
|
@@ -102,7 +104,7 @@ const e=Math.max(r-m,1),t=Math.min(r+m,b),a=e>2,n=t<b-1,s=b
|
|
|
102
104
|
if(!a&&n){const e=3+2*m
|
|
103
105
|
return[...Array.from({length:e},(e,r)=>r+1),p,b]}if(a&&!n){const e=3+2*m,r=Array.from({length:e},(r,t)=>b-e+1+t)
|
|
104
106
|
return[1,p,...r]}if(a&&n){const r=Array.from({length:t-e+1},(r,t)=>e+t)
|
|
105
|
-
return[1,p,...r,p,s]}return Array.from({length:b},(e,r)=>r+1)})(),f=
|
|
107
|
+
return[1,p,...r,p,s]}return Array.from({length:b},(e,r)=>r+1)})(),f=K[g],y=e=>d?.(e)??`?page=${e}`,w=t.cn("inline-flex items-center justify-center border transition-colors select-none","bg-white border-gray-200 text-gray-700 hover:bg-gray-100 hover:text-gray-900","dark:bg-neutral-900 dark:border-neutral-800 dark:text-neutral-300 dark:hover:bg-neutral-800 dark:hover:text-neutral-100",f),v=a=>{const n="prev"===a,s=n?r<=1:r>=b,o=n?r-1:r+1,d=n?"Previous page":"Next page",i=n?u??"‹":x??"›",c=t.cn(w,s?"opacity-50 pointer-events-none cursor-not-allowed":"cursor-pointer")
|
|
106
108
|
return l?e.jsx("a",{"aria-label":d,"aria-disabled":s,className:c,href:s?void 0:y(o),onClick:e=>{e.preventDefault(),s||h(o)},children:i}):e.jsx("button",{type:"button","aria-label":d,className:c,onClick:()=>h(o),disabled:s,children:i})}
|
|
107
109
|
return a?e.jsxs("nav",{"aria-label":"Pagination",className:"inline-flex items-center gap-3",children:[v("prev"),(()=>{if("long"===n&&o&&s){const t=(r-1)*o+1,a=Math.min(r*o,s)
|
|
108
110
|
return e.jsxs("p",{className:"text-sm text-gray-600 dark:text-neutral-400",children:["Showing ",e.jsx("span",{className:"font-medium text-gray-900 dark:text-neutral-100",children:t})," -"," ",e.jsx("span",{className:"font-medium text-gray-900 dark:text-neutral-100",children:a})," of"," ",e.jsx("span",{className:"font-medium text-gray-900 dark:text-neutral-100",children:s})]})}return"none"===n?e.jsxs("p",{className:"text-sm text-gray-600 dark:text-neutral-400",children:[e.jsx("span",{className:"font-medium text-gray-900 dark:text-neutral-100",children:r})," of"," ",e.jsx("span",{className:"font-medium text-gray-900 dark:text-neutral-100",children:b})]}):null})(),v("next")]}):e.jsxs("nav",{"aria-label":"Pagination",className:"inline-flex flex-wrap items-center gap-1.5",children:[v("prev"),k.map((a,n)=>{if(a===p)return e.jsx("span",{className:t.cn("inline-flex items-center justify-center text-gray-400 dark:text-neutral-500 select-none",f),children:p},`dots-${n}`)
|
|
@@ -116,30 +118,30 @@ return e.jsxs("div",{ref:g,className:"relative inline-flex",onMouseEnter:()=>{d|
|
|
|
116
118
|
switch(s){case"top":return{bottom:e}
|
|
117
119
|
case"bottom":return{top:e}
|
|
118
120
|
case"left":return{right:e}
|
|
119
|
-
case"right":return{left:e}}})(),className:t.cn("absolute z-30 w-max max-w-xs rounded-lg border border-gray-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 shadow-lg transition-opacity duration-150",
|
|
121
|
+
case"right":return{left:e}}})(),className:t.cn("absolute z-30 w-max max-w-xs rounded-lg border border-gray-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 shadow-lg transition-opacity duration-150",Y[s]),children:[k&&e.jsx("div",{className:t.cn("px-3.5 py-2 text-sm font-semibold text-gray-900 dark:text-neutral-100",f&&"border-b border-gray-200 dark:border-neutral-800"),children:a}),f&&e.jsx("div",{className:"px-3.5 py-2.5 text-sm text-gray-700 dark:text-neutral-300 leading-relaxed",children:n}),"arrow"===c&&e.jsx("span",{"aria-hidden":"true",className:t.cn("absolute w-2.5 h-2.5 rotate-45 bg-white dark:bg-neutral-900 border-gray-200 dark:border-neutral-800",_[s])})]})]})},exports.RadioInput=({name:r,options:a,selectedValue:n,onValueChange:s,variant:o="subtle",radioSize:l="md",disabled:d,...i})=>{const c=J[l],m=Q[o]
|
|
120
122
|
return e.jsx("div",{className:"flex flex-wrap gap-3",children:a.map((a,o)=>{const l=n?.value===a.value
|
|
121
123
|
return e.jsxs("label",{className:t.cn("relative flex items-center rounded-md cursor-pointer transition-all duration-200 border px-3 py-2 select-none",c.container,m.label,{[m.checked]:l,"opacity-50 cursor-not-allowed":d}),children:[e.jsx("input",{type:"radio",name:r,value:a.value,checked:l,onChange:()=>s(a),disabled:d,className:t.cn("absolute opacity-0 w-full h-full cursor-pointer",{"cursor-not-allowed":d}),...i}),e.jsx("span",{className:t.cn("flex items-center justify-center rounded-full border transition-all duration-200",c.radio,m.radio,{[m.checkedRadio]:l}),children:l&&e.jsx("span",{className:"w-1/2 h-1/2 rounded-full bg-white transition-transform duration-200 scale-100"})}),e.jsx("span",{className:t.cn("ml-2",c.label),children:a.label})]},a.value??o)})})},exports.SelectInput=({label:r,error:a,...s})=>{const o={clearIndicator:()=>"!cursor-pointer !text-gray-500 dark:!text-neutral-400 hover:!text-error dark:hover:!text-error-dark transition-colors",dropdownIndicator:()=>"!cursor-pointer !text-gray-500 dark:!text-neutral-400 hover:!text-gray-800 dark:hover:!text-neutral-100 transition-colors",indicatorSeparator:()=>"!bg-gray-200 dark:!bg-neutral-800",control:({isFocused:e,isDisabled:r})=>t.cn("!w-full !border !rounded-md !shadow-sm sm:!text-sm !min-h-[38px] !bg-white dark:!bg-neutral-900 transition-colors",r&&"!opacity-50 !bg-gray-100 dark:!bg-neutral-800 !cursor-not-allowed",a?e?"!border-error dark:!border-error-dark !ring-1 !ring-error dark:!ring-error-dark":"!border-error dark:!border-error-dark":e?"!border-primary dark:!border-primary-dark !ring-1 !ring-primary dark:!ring-primary-dark":"!border-gray-200 dark:!border-neutral-800"),option:({isFocused:e,isSelected:r})=>t.cn("!px-4 !py-2 !cursor-pointer transition-colors",r?"!bg-primary dark:!bg-primary-dark !text-white":e?"!bg-gray-100 dark:!bg-neutral-800 !text-gray-900 dark:!text-neutral-100":"!bg-white dark:!bg-neutral-900 !text-gray-700 dark:!text-neutral-300"),multiValue:()=>"!bg-gray-100 dark:!bg-neutral-800 !rounded-md !flex !items-center !mr-1",multiValueLabel:()=>"!text-gray-800 dark:!text-neutral-100 !text-sm !px-2 !py-0.5",multiValueRemove:()=>"!text-gray-500 dark:!text-neutral-400 hover:!bg-gray-200 dark:hover:!bg-neutral-700 hover:!text-gray-800 dark:hover:!text-neutral-100 !rounded-r-md !px-1 !cursor-pointer transition-colors",menu:()=>"!mt-1 !border !border-gray-200 dark:!border-neutral-800 !bg-white dark:!bg-neutral-900 !rounded-md !shadow-lg !z-20 overflow-hidden",input:()=>"!text-gray-900 dark:!text-neutral-100",placeholder:()=>"!text-gray-400 dark:!text-neutral-500",singleValue:()=>"!text-gray-900 dark:!text-neutral-100",noOptionsMessage:()=>"!text-gray-500 dark:!text-neutral-400 !py-2 !text-sm"}
|
|
122
124
|
return e.jsxs("div",{className:"w-full",children:[r&&e.jsx("label",{className:"block text-sm font-medium text-gray-900 dark:text-neutral-100 mb-1",children:r}),e.jsx(n,{classNames:o,...s}),a&&e.jsx("p",{className:"mt-1 text-sm text-error dark:text-error-dark",children:a})]})},exports.Skeleton=({width:t,height:a,rounded:n=!1,isLoading:s=!0,animode:o="flash",children:l})=>{if(!s)return e.jsx(e.Fragment,{children:l})
|
|
123
125
|
const d={width:t??"fit-content",height:a??(l?"auto":"1rem")}
|
|
124
|
-
return l?e.jsx(e.Fragment,{children:r.Children.map(l,(r,t)=>e.jsx("div",{className:`${o} ${n?"rounded-full":"rounded-sm"} mb-1`,style:d,children:e.jsx("span",{className:"invisible",children:r})},t))}):e.jsx("div",{className:`${o} ${n?"rounded-full":"rounded-sm"}`,style:d})},exports.Slider=({id:a,name:n,label:s,min:o=0,disabled:l,max:d=100,step:i=1,value:c,showTooltip:m=!0,showMarks:u=!0,onChange:x,color:g="primary",prefixIcon:b,suffixIcon:p,sliderSize:h="md"})=>{const[k,f]=r.useState(!1),y=
|
|
126
|
+
return l?e.jsx(e.Fragment,{children:r.Children.map(l,(r,t)=>e.jsx("div",{className:`${o} ${n?"rounded-full":"rounded-sm"} mb-1`,style:d,children:e.jsx("span",{className:"invisible",children:r})},t))}):e.jsx("div",{className:`${o} ${n?"rounded-full":"rounded-sm"}`,style:d})},exports.Slider=({id:a,name:n,label:s,min:o=0,disabled:l,max:d=100,step:i=1,value:c,showTooltip:m=!0,showMarks:u=!0,onChange:x,color:g="primary",prefixIcon:b,suffixIcon:p,sliderSize:h="md"})=>{const[k,f]=r.useState(!1),y=ae[g],w=ne[h],v={sm:12,md:16,lg:20,xl:24}[h]
|
|
125
127
|
return e.jsxs("div",{className:"w-full p-4 relative overflow-x-clip",children:[s&&e.jsx("label",{htmlFor:a||n,className:"block text-sm font-medium mb-1 dark:text-white",children:s}),e.jsxs("div",{className:"flex gap-3 items-center relative",children:[b,e.jsxs("div",{className:"relative w-full flex items-center",onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),children:[m&&e.jsx("div",{className:"absolute z-10 -top-7 transition-opacity duration-300",style:(()=>{const e=Number(d)-Number(o),r=0===e?0:(Number(c)-Number(o))/e
|
|
126
|
-
return{left:`calc(${100*r}% + ${r*-v+v/2}px)`,opacity:k?1:0,pointerEvents:"none"}})(),children:e.jsx(
|
|
128
|
+
return{left:`calc(${100*r}% + ${r*-v+v/2}px)`,opacity:k?1:0,pointerEvents:"none"}})(),children:e.jsx(re,{text:String(c),isOpen:k,placement:"top",children:e.jsx("div",{})})}),e.jsx("input",{disabled:l,type:"range",id:a||"slider-range",min:o,max:d,step:i,value:c,onChange:x,onMouseDown:()=>f(!0),className:t.cn("w-full rounded-full appearance-none cursor-pointer dark:bg-gray-700","transition-all duration-300 ease-in-out",w,"[&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:appearance-none","[&::-moz-range-thumb]:rounded-full [&::-moz-range-thumb]:appearance-none",y,{[ae.secondary]:l,"bg-secondary opacity-50":l})}),(()=>{if(!u||Number(i)<=1)return null
|
|
127
129
|
const r=Number(d)-Number(o),a=Math.floor(r/Number(i)),n=Array.from({length:a+1},(r,n)=>{const s=n/a*100
|
|
128
130
|
return e.jsx("div",{className:t.cn("absolute top-1/2 -translate-y-1/2 w-[2px] h-2 rounded-full",y),style:{left:`${s}%`}},n)})
|
|
129
|
-
return e.jsx("div",{className:"absolute top-full mt-2 -left-0.5 -right-0.5 h-2 me-[11px] ms-[9px]",children:n})})()]}),p,e.jsx("div",{className:"w-32",children:e.jsx(
|
|
130
|
-
return o?e.jsxs("div",{role:"status",className:t.cn("inline-flex items-center justify-center gap-2",m),children:[g,e.jsx("span",{className:t.cn(c,"text-gray-700 dark:text-neutral-200 font-medium select-none"),children:o})]}):g},exports.Table=function({columns:r,data:a,striped:n=!1,hoverable:s=!0,customEmptyData:o,size:l="md",caption:d,captionPosition:i="bottom",stickyHeader:c=!1,selectable:m=!1,onSelectionChange:u,selectedRows:x=[]}){const g=
|
|
131
|
+
return e.jsx("div",{className:"absolute top-full mt-2 -left-0.5 -right-0.5 h-2 me-[11px] ms-[9px]",children:n})})()]}),p,e.jsx("div",{className:"w-32",children:e.jsx(te,{min:o,max:d,step:i,type:Number(c)<=0?"text":"number",value:Number(c)<=0?"":c,onChange:x})})]})]})},exports.Spinner=({color:r="primary",size:a="md",duration:n=1e3,thickness:s,label:o,labelPosition:l="right"})=>{const d=oe[r],i=se[a],c=le[a],m=de[l],u=`${n}ms`,x=s?`${s}px`:void 0,g=e.jsx("span",{"aria-hidden":Boolean(o),role:o?void 0:"status","aria-label":o?void 0:"Loading",className:t.cn(i,d,"inline-block shrink-0 rounded-full animate-spin border-t-transparent dark:border-t-transparent"),style:{animationDuration:u,borderWidth:x}})
|
|
132
|
+
return o?e.jsxs("div",{role:"status",className:t.cn("inline-flex items-center justify-center gap-2",m),children:[g,e.jsx("span",{className:t.cn(c,"text-gray-700 dark:text-neutral-200 font-medium select-none"),children:o})]}):g},exports.Table=function({columns:r,data:a,striped:n=!1,hoverable:s=!0,customEmptyData:o,size:l="md",caption:d,captionPosition:i="bottom",stickyHeader:c=!1,selectable:m=!1,onSelectionChange:u,selectedRows:x=[]}){const g=ie[l],b=a.length>0&&x.length===a.length,p=x.length>0&&x.length<a.length
|
|
131
133
|
return e.jsxs("div",{className:"w-full",children:[d&&"top"===i&&e.jsx("p",{className:"text-center text-sm font-medium mb-2 text-gray-600 dark:text-neutral-400",children:d}),e.jsx("div",{className:t.cn("overflow-x-auto w-full rounded-lg border border-gray-200 dark:border-neutral-800 bg-white dark:bg-neutral-900",c&&"max-h-[400px] overflow-y-auto"),children:e.jsxs("table",{className:"min-w-full border-collapse text-left",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-neutral-800 text-gray-700 dark:text-neutral-200",children:e.jsxs("tr",{children:[m&&e.jsx("th",{className:t.cn("w-12 font-semibold border-b border-gray-200 dark:border-neutral-800",g,c&&"sticky top-0 bg-gray-50 dark:bg-neutral-800 z-10"),children:e.jsx(z,{checked:b,indeterminate:p,onChange:e=>{e.target.checked?u?.(a):u?.([])}})}),r.map((r,a)=>e.jsx("th",{className:t.cn("font-semibold whitespace-nowrap border-b border-gray-200 dark:border-neutral-800",g,c&&"sticky top-0 bg-gray-50 dark:bg-neutral-800 z-10"),children:r.header},a))]})}),e.jsx("tbody",{className:"divide-y divide-gray-200 dark:divide-neutral-800 text-gray-700 dark:text-neutral-300",children:a.length>0?a.map((a,o)=>{const l=m&&x.some(e=>e.id===a.id)
|
|
132
134
|
return e.jsxs("tr",{className:t.cn("transition-colors",n&&o%2!=0&&"bg-gray-50/70 dark:bg-neutral-800/40",s&&"hover:bg-gray-100/80 dark:hover:bg-neutral-800/70",l&&"bg-primary/10 dark:bg-primary/20"),children:[m&&e.jsx("td",{className:t.cn(g),children:e.jsx(z,{checked:l,onChange:()=>(e=>{const r=x.some(r=>r.id===e.id)
|
|
133
|
-
u?.(r?x.filter(r=>r.id!==e.id):[...x,e])})(a)})}),r.map((r,n)=>e.jsx("td",{className:t.cn(g),children:r.render?r.render(a[r.accessor],a):null!=a[r.accessor]?String(a[r.accessor]):"-"},n))]},a.id??o)}):e.jsx("tr",{children:e.jsx("td",{colSpan:r.length+(m?1:0),className:t.cn("py-8 text-center text-gray-500 dark:text-neutral-400",g),children:o??"Tidak ada data."})})})]})}),d&&"bottom"===i&&e.jsx("p",{className:"text-center text-sm font-medium mt-2 text-gray-600 dark:text-neutral-400",children:d})]})},exports.Tabs=({tabs:a,fitted:n=!1,variant:s="line",activeTab:o,onTabChange:l})=>{const[d,i]=r.useState(0),c=void 0!==o&&void 0!==l,m=c?o:d,u=
|
|
135
|
+
u?.(r?x.filter(r=>r.id!==e.id):[...x,e])})(a)})}),r.map((r,n)=>e.jsx("td",{className:t.cn(g),children:r.render?r.render(a[r.accessor],a):null!=a[r.accessor]?String(a[r.accessor]):"-"},n))]},a.id??o)}):e.jsx("tr",{children:e.jsx("td",{colSpan:r.length+(m?1:0),className:t.cn("py-8 text-center text-gray-500 dark:text-neutral-400",g),children:o??"Tidak ada data."})})})]})}),d&&"bottom"===i&&e.jsx("p",{className:"text-center text-sm font-medium mt-2 text-gray-600 dark:text-neutral-400",children:d})]})},exports.Tabs=({tabs:a,fitted:n=!1,variant:s="line",activeTab:o,onTabChange:l})=>{const[d,i]=r.useState(0),c=void 0!==o&&void 0!==l,m=c?o:d,u=ce[s],x=me[s],g=r.useRef(null),b=r.useRef([]),p=r.useRef(null)
|
|
134
136
|
return r.useEffect(()=>{!c&&m>=a.length&&i(Math.max(0,a.length-1))},[a.length,m,c]),r.useEffect(()=>{const e=b.current[m],r=p.current,t=g.current
|
|
135
137
|
if(e&&r){const a=e.offsetLeft,n=e.offsetWidth
|
|
136
138
|
if(r.style.transform=`translateX(${a}px)`,r.style.width=`${n}px`,t){const e=a-t.clientWidth/2+n/2
|
|
137
139
|
t.scrollTo({left:e,behavior:"smooth"})}}},[m,a,n,s]),e.jsxs("div",{className:"w-full",children:[e.jsx("div",{className:t.cn("relative",u.wrapper),children:e.jsxs("nav",{ref:g,role:"tablist","aria-label":"Tabs",className:"relative flex space-x-1 overflow-x-auto scroll-smooth",children:[a.map((r,a)=>{const s=m===a,o=t.cn("relative z-10 inline-flex items-center justify-center transition-colors duration-200 select-none",n&&"flex-1",u.button,s?u.active:u.inactive,r.disabled?"cursor-not-allowed opacity-50":"cursor-pointer")
|
|
138
|
-
return r.link?e.jsx("a",{role:"tab","aria-selected":s,"aria-disabled":r.disabled,href:r.disabled?void 0:r.link,ref:e=>{b.current[a]=e},className:o,onClick:e=>{r.disabled&&e.preventDefault()},children:r.label},`${r.label}-${a}`):e.jsx("button",{type:"button",role:"tab","aria-selected":s,ref:e=>{b.current[a]=e},onClick:()=>(e=>{c?l(e):i(e)})(a),disabled:r.disabled,className:o,children:r.label},`${r.label}-${a}`)}),e.jsx("div",{ref:p,className:x,style:{width:0,transform:"translateX(0px)"}})]})}),e.jsx("div",{role:"tabpanel",className:"mt-4 text-gray-700 dark:text-neutral-300",children:a[m]?.content})]})},exports.TextInput=
|
|
140
|
+
return r.link?e.jsx("a",{role:"tab","aria-selected":s,"aria-disabled":r.disabled,href:r.disabled?void 0:r.link,ref:e=>{b.current[a]=e},className:o,onClick:e=>{r.disabled&&e.preventDefault()},children:r.label},`${r.label}-${a}`):e.jsx("button",{type:"button",role:"tab","aria-selected":s,ref:e=>{b.current[a]=e},onClick:()=>(e=>{c?l(e):i(e)})(a),disabled:r.disabled,className:o,children:r.label},`${r.label}-${a}`)}),e.jsx("div",{ref:p,className:x,style:{width:0,transform:"translateX(0px)"}})]})}),e.jsx("div",{role:"tabpanel",className:"mt-4 text-gray-700 dark:text-neutral-300",children:a[m]?.content})]})},exports.TextInput=te,exports.Textarea=({label:a,id:n,name:s,error:o,autoResize:l=!1,onInput:d,...i})=>{const c=r.useRef(null),m=()=>{const e=c.current
|
|
139
141
|
e&&(e.style.height="auto",e.style.height=`${e.scrollHeight}px`)}
|
|
140
|
-
return r.useEffect(()=>{l&&m()},[l,i.value]),e.jsxs("div",{className:"w-full",children:[a&&e.jsx("label",{htmlFor:n||s,className:"inline-block text-sm font-medium mb-1 text-gray-900 dark:text-neutral-100",children:a}),e.jsx("textarea",{id:n||s,name:s,rows:l?1:5,ref:c,onInput:e=>{l&&m(),d?.(e)},className:t.cn("w-full block px-3 py-2 border rounded-md shadow-sm sm:text-sm min-h-[58px] max-h-[10rem] transition-colors","bg-white border-gray-200 text-gray-900 placeholder:text-gray-400","dark:bg-neutral-900 dark:border-neutral-800 dark:text-neutral-100 dark:placeholder:text-neutral-500","focus:outline-none focus:ring-1 focus:ring-primary focus:border-primary dark:focus:ring-primary-dark dark:focus:border-primary-dark",l?"resize-none overflow-hidden":"resize-y overflow-y-auto",o&&"border-error dark:border-error-dark focus:ring-error focus:border-error dark:focus:ring-error-dark dark:focus:border-error-dark",i.disabled&&"opacity-50 bg-gray-100 dark:bg-neutral-800 cursor-not-allowed"),...i}),o&&e.jsx("p",{className:"mt-1 text-sm text-error dark:text-error-dark",children:o})]})},exports.Timeline=
|
|
141
|
-
return e.jsxs(
|
|
142
|
-
n(n=>[...n,{title:e,id:c,message:r,type:t,variant:a,icon:s,withClose:o,withLoading:l,onClose:d,position:i}])}},children:[t,s.map(r=>e.jsx("div",{className:`fixed z-50 ${O[r]}`,children:a.filter(e=>e.position===r).map(r=>e.jsx(
|
|
143
|
-
r.onClose?.(),e=r.id,n(r=>r.filter(r=>r.id!==e))}},r.id))},r))]})},exports.Toggle=({variant:r="primary",size:a="md",shape:n="stadium",label:s,disabled:o,...l})=>e.jsxs("label",{className:t.cn("relative inline-flex items-center select-none",o?"cursor-not-allowed opacity-50":"cursor-pointer"),children:[e.jsx("input",{type:"checkbox",disabled:o,className:"sr-only peer pointer-events-none",...l}),e.jsx("div",{className:t.cn("relative shrink-0 transition-colors duration-300","bg-gray-300 dark:bg-neutral-800","peer-focus-visible:ring-2 peer-focus-visible:ring-primary/50 dark:peer-focus-visible:ring-primary-dark/50","after:content-[''] after:absolute after:bg-white after:shadow-xs after:transition-transform after:duration-300",
|
|
142
|
+
return r.useEffect(()=>{l&&m()},[l,i.value]),e.jsxs("div",{className:"w-full",children:[a&&e.jsx("label",{htmlFor:n||s,className:"inline-block text-sm font-medium mb-1 text-gray-900 dark:text-neutral-100",children:a}),e.jsx("textarea",{id:n||s,name:s,rows:l?1:5,ref:c,onInput:e=>{l&&m(),d?.(e)},className:t.cn("w-full block px-3 py-2 border rounded-md shadow-sm sm:text-sm min-h-[58px] max-h-[10rem] transition-colors","bg-white border-gray-200 text-gray-900 placeholder:text-gray-400","dark:bg-neutral-900 dark:border-neutral-800 dark:text-neutral-100 dark:placeholder:text-neutral-500","focus:outline-none focus:ring-1 focus:ring-primary focus:border-primary dark:focus:ring-primary-dark dark:focus:border-primary-dark",l?"resize-none overflow-hidden":"resize-y overflow-y-auto",o&&"border-error dark:border-error-dark focus:ring-error focus:border-error dark:focus:ring-error-dark dark:focus:border-error-dark",i.disabled&&"opacity-50 bg-gray-100 dark:bg-neutral-800 cursor-not-allowed"),...i}),o&&e.jsx("p",{className:"mt-1 text-sm text-error dark:text-error-dark",children:o})]})},exports.Timeline=ge,exports.ToastProvider=({children:t})=>{const[a,n]=r.useState([]),s=Object.keys(O)
|
|
143
|
+
return e.jsxs(X.Provider,{value:{addToast:({title:e,message:r,type:t,variant:a,icon:s,withClose:o=!0,withLoading:l=!1,onClose:d,position:i="bottom-right"})=>{const c=Date.now()+Math.random()
|
|
144
|
+
n(n=>[...n,{title:e,id:c,message:r,type:t,variant:a,icon:s,withClose:o,withLoading:l,onClose:d,position:i}])}},children:[t,s.map(r=>e.jsx("div",{className:`fixed z-50 ${O[r]}`,children:a.filter(e=>e.position===r).map(r=>e.jsx(U,{title:r.title,message:r.message,type:r.type,variant:r.variant,icon:r.icon,withClose:r.withClose,withLoading:r.withLoading,position:r.position,onClose:()=>{var e
|
|
145
|
+
r.onClose?.(),e=r.id,n(r=>r.filter(r=>r.id!==e))}},r.id))},r))]})},exports.Toggle=({variant:r="primary",size:a="md",shape:n="stadium",label:s,disabled:o,...l})=>e.jsxs("label",{className:t.cn("relative inline-flex items-center select-none",o?"cursor-not-allowed opacity-50":"cursor-pointer"),children:[e.jsx("input",{type:"checkbox",disabled:o,className:"sr-only peer pointer-events-none",...l}),e.jsx("div",{className:t.cn("relative shrink-0 transition-colors duration-300","bg-gray-300 dark:bg-neutral-800","peer-focus-visible:ring-2 peer-focus-visible:ring-primary/50 dark:peer-focus-visible:ring-primary-dark/50","after:content-[''] after:absolute after:bg-white after:shadow-xs after:transition-transform after:duration-300",he[a],be[r],pe[n])}),s&&e.jsx("span",{className:"ms-3 text-sm font-medium text-gray-900 dark:text-neutral-100",children:s})]}),exports.Tooltip=re,exports.getVariantClasses=j,exports.useToast=()=>{const e=r.useContext(X)
|
|
144
146
|
if(!e)throw new Error("useToast must be used within a ToastProvider")
|
|
145
147
|
return e}
|
package/dist/main.js
CHANGED
|
@@ -2612,20 +2612,40 @@ const Skeleton = ({
|
|
|
2612
2612
|
}
|
|
2613
2613
|
);
|
|
2614
2614
|
};
|
|
2615
|
+
const TooltipColors = {
|
|
2616
|
+
neutral: "bg-gray-900 text-white border-gray-900 dark:bg-neutral-800 dark:text-neutral-100 dark:border-neutral-700",
|
|
2617
|
+
primary: "bg-primary text-white border-primary dark:bg-primary-dark dark:border-primary-dark",
|
|
2618
|
+
secondary: "bg-secondary text-white border-secondary dark:bg-secondary-dark dark:border-secondary-dark",
|
|
2619
|
+
success: "bg-success text-white border-success dark:bg-success-dark dark:border-success-dark",
|
|
2620
|
+
warning: "bg-warning text-white border-warning dark:bg-warning-dark dark:border-warning-dark",
|
|
2621
|
+
error: "bg-error text-white border-error dark:bg-error-dark dark:border-error-dark",
|
|
2622
|
+
info: "bg-info text-white border-info dark:bg-info-dark dark:border-info-dark"
|
|
2623
|
+
};
|
|
2615
2624
|
const Tooltip = ({
|
|
2616
2625
|
children,
|
|
2617
2626
|
text,
|
|
2618
2627
|
showArrow = true,
|
|
2619
2628
|
placement = "top",
|
|
2620
2629
|
offset = 8,
|
|
2621
|
-
|
|
2630
|
+
color = "neutral",
|
|
2622
2631
|
isOpen: controlledIsOpen,
|
|
2623
2632
|
onOpenChange,
|
|
2624
2633
|
disabled = false,
|
|
2625
|
-
animationDuration =
|
|
2626
|
-
delay =
|
|
2634
|
+
animationDuration = 200,
|
|
2635
|
+
delay = 300
|
|
2627
2636
|
}) => {
|
|
2628
2637
|
const [isHovering, setIsHovering] = useState(false);
|
|
2638
|
+
const tooltipId = useId();
|
|
2639
|
+
const isControlled = controlledIsOpen !== void 0;
|
|
2640
|
+
const isVisible = isControlled ? controlledIsOpen : isHovering;
|
|
2641
|
+
const handleOpen = () => {
|
|
2642
|
+
if (!isControlled) setIsHovering(true);
|
|
2643
|
+
onOpenChange?.(true);
|
|
2644
|
+
};
|
|
2645
|
+
const handleClose = () => {
|
|
2646
|
+
if (!isControlled) setIsHovering(false);
|
|
2647
|
+
onOpenChange?.(false);
|
|
2648
|
+
};
|
|
2629
2649
|
const getTooltipPosition = () => {
|
|
2630
2650
|
switch (placement) {
|
|
2631
2651
|
case "top":
|
|
@@ -2636,59 +2656,61 @@ const Tooltip = ({
|
|
|
2636
2656
|
return { right: "100%", top: "50%", transform: "translateY(-50%)", marginRight: `${offset}px` };
|
|
2637
2657
|
case "right":
|
|
2638
2658
|
return { left: "100%", top: "50%", transform: "translateY(-50%)", marginLeft: `${offset}px` };
|
|
2639
|
-
default:
|
|
2640
|
-
return { bottom: "100%", left: "50%", transform: "translateX(-50%)", marginBottom: `${offset}px` };
|
|
2641
2659
|
}
|
|
2642
2660
|
};
|
|
2643
|
-
const
|
|
2661
|
+
const getArrowClass = () => {
|
|
2644
2662
|
switch (placement) {
|
|
2645
2663
|
case "top":
|
|
2646
|
-
return
|
|
2664
|
+
return "-bottom-[5px] left-1/2 -translate-x-1/2 border-r border-b";
|
|
2647
2665
|
case "bottom":
|
|
2648
|
-
return
|
|
2666
|
+
return "-top-[5px] left-1/2 -translate-x-1/2 border-l border-t";
|
|
2649
2667
|
case "left":
|
|
2650
|
-
return
|
|
2668
|
+
return "-right-[5px] top-1/2 -translate-y-1/2 border-t border-r";
|
|
2651
2669
|
case "right":
|
|
2652
|
-
return
|
|
2653
|
-
default:
|
|
2654
|
-
return { bottom: "-4px", left: "50%", transform: "translateX(-50%) rotate(45deg)" };
|
|
2670
|
+
return "-left-[5px] top-1/2 -translate-y-1/2 border-b border-l";
|
|
2655
2671
|
}
|
|
2656
2672
|
};
|
|
2657
|
-
|
|
2658
|
-
const tooltipStyle = {
|
|
2659
|
-
...getTooltipPosition(),
|
|
2660
|
-
transitionDelay: isVisible && !controlledIsOpen ? `${delay}ms` : "0ms",
|
|
2661
|
-
transitionDuration: `${animationDuration}ms`
|
|
2662
|
-
};
|
|
2663
|
-
if (disabled) {
|
|
2673
|
+
if (disabled || !text) {
|
|
2664
2674
|
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
2665
2675
|
}
|
|
2676
|
+
const colorClass = TooltipColors[color];
|
|
2666
2677
|
return /* @__PURE__ */ jsxs(
|
|
2667
2678
|
"div",
|
|
2668
2679
|
{
|
|
2669
|
-
className: "relative inline-
|
|
2670
|
-
onMouseEnter:
|
|
2671
|
-
onMouseLeave:
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2680
|
+
className: "relative inline-flex",
|
|
2681
|
+
onMouseEnter: handleOpen,
|
|
2682
|
+
onMouseLeave: handleClose,
|
|
2683
|
+
onFocus: handleOpen,
|
|
2684
|
+
onBlur: handleClose,
|
|
2685
|
+
"aria-describedby": isVisible ? tooltipId : void 0,
|
|
2675
2686
|
children: [
|
|
2676
2687
|
children,
|
|
2677
2688
|
/* @__PURE__ */ jsxs(
|
|
2678
2689
|
"div",
|
|
2679
2690
|
{
|
|
2691
|
+
id: tooltipId,
|
|
2692
|
+
role: "tooltip",
|
|
2680
2693
|
className: cn(
|
|
2681
|
-
|
|
2694
|
+
"absolute z-30 whitespace-nowrap rounded-md border px-2.5 py-1 text-xs font-medium tracking-tight shadow-md pointer-events-none transition-opacity",
|
|
2695
|
+
colorClass,
|
|
2682
2696
|
isVisible ? "opacity-100 visible" : "opacity-0 invisible"
|
|
2683
2697
|
),
|
|
2684
|
-
style:
|
|
2698
|
+
style: {
|
|
2699
|
+
...getTooltipPosition(),
|
|
2700
|
+
transitionDelay: isVisible && !isControlled ? `${delay}ms` : "0ms",
|
|
2701
|
+
transitionDuration: `${animationDuration}ms`
|
|
2702
|
+
},
|
|
2685
2703
|
children: [
|
|
2686
2704
|
text,
|
|
2687
2705
|
showArrow && /* @__PURE__ */ jsx(
|
|
2688
|
-
"
|
|
2706
|
+
"span",
|
|
2689
2707
|
{
|
|
2690
|
-
|
|
2691
|
-
|
|
2708
|
+
"aria-hidden": "true",
|
|
2709
|
+
className: cn(
|
|
2710
|
+
"absolute w-2 h-2 rotate-45",
|
|
2711
|
+
colorClass,
|
|
2712
|
+
getArrowClass()
|
|
2713
|
+
)
|
|
2692
2714
|
}
|
|
2693
2715
|
)
|
|
2694
2716
|
]
|