@bricks-toolkit/toolkit 0.1.0 → 0.1.1
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/Button.types-BsQYqZml.d.ts +27 -0
- package/dist/Button.types-D-srlWFf.d.mts +27 -0
- package/dist/TextInput.types-DRI8HQza.d.mts +32 -0
- package/dist/TextInput.types-DRI8HQza.d.ts +32 -0
- package/dist/Tooltip.types-PbUasE3C.d.mts +36 -0
- package/dist/Tooltip.types-PbUasE3C.d.ts +36 -0
- package/dist/avatar/index.cjs +1 -0
- package/dist/avatar/index.d.mts +29 -0
- package/dist/avatar/index.d.ts +29 -0
- package/dist/avatar/index.mjs +1 -0
- package/dist/badge/index.cjs +1 -0
- package/dist/badge/index.d.mts +57 -0
- package/dist/badge/index.d.ts +57 -0
- package/dist/badge/index.mjs +1 -0
- package/dist/breadcrumbs/index.cjs +1 -0
- package/dist/breadcrumbs/index.d.mts +32 -0
- package/dist/breadcrumbs/index.d.ts +32 -0
- package/dist/breadcrumbs/index.mjs +1 -0
- package/dist/button/index.cjs +2 -0
- package/dist/button/index.d.mts +8 -0
- package/dist/button/index.d.ts +8 -0
- package/dist/button/index.mjs +2 -0
- package/dist/card/index.cjs +1 -0
- package/dist/card/index.d.mts +42 -0
- package/dist/card/index.d.ts +42 -0
- package/dist/card/index.mjs +1 -0
- package/dist/checkbox/index.cjs +1 -0
- package/dist/checkbox/index.d.mts +36 -0
- package/dist/checkbox/index.d.ts +36 -0
- package/dist/checkbox/index.mjs +1 -0
- package/dist/combo-box/index.cjs +1 -0
- package/dist/combo-box/index.d.mts +62 -0
- package/dist/combo-box/index.d.ts +62 -0
- package/dist/combo-box/index.mjs +1 -0
- package/dist/date-picker/index.cjs +2 -0
- package/dist/date-picker/index.d.mts +32 -0
- package/dist/date-picker/index.d.ts +32 -0
- package/dist/date-picker/index.mjs +2 -0
- package/dist/dialog/index.cjs +1 -0
- package/dist/dialog/index.d.mts +61 -0
- package/dist/dialog/index.d.ts +61 -0
- package/dist/dialog/index.mjs +1 -0
- package/dist/dropdown-menu/index.cjs +1 -0
- package/dist/dropdown-menu/index.d.mts +34 -0
- package/dist/dropdown-menu/index.d.ts +34 -0
- package/dist/dropdown-menu/index.mjs +1 -0
- package/dist/email/index.cjs +2 -0
- package/dist/email/index.d.mts +38 -0
- package/dist/email/index.d.ts +38 -0
- package/dist/email/index.mjs +2 -0
- package/dist/file-upload/index.cjs +1 -0
- package/dist/file-upload/index.d.mts +27 -0
- package/dist/file-upload/index.d.ts +27 -0
- package/dist/file-upload/index.mjs +1 -0
- package/dist/header/index.cjs +2 -0
- package/dist/header/index.d.mts +28 -0
- package/dist/header/index.d.ts +28 -0
- package/dist/header/index.mjs +2 -0
- package/dist/icon-button/index.cjs +2 -0
- package/dist/icon-button/index.d.mts +16 -0
- package/dist/icon-button/index.d.ts +16 -0
- package/dist/icon-button/index.mjs +2 -0
- package/dist/image/index.cjs +1 -0
- package/dist/image/index.d.mts +48 -0
- package/dist/image/index.d.ts +48 -0
- package/dist/image/index.mjs +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.d.mts +141 -0
- package/dist/index.mjs +2 -0
- package/dist/link/index.cjs +1 -0
- package/dist/link/index.d.mts +25 -0
- package/dist/link/index.d.ts +25 -0
- package/dist/link/index.mjs +1 -0
- package/dist/loader/index.cjs +2 -0
- package/dist/loader/index.d.mts +21 -0
- package/dist/loader/index.d.ts +21 -0
- package/dist/loader/index.mjs +2 -0
- package/dist/modal/index.cjs +1 -0
- package/dist/modal/index.d.mts +116 -0
- package/dist/modal/index.d.ts +116 -0
- package/dist/modal/index.mjs +1 -0
- package/dist/multi-select/index.cjs +2 -0
- package/dist/multi-select/index.d.mts +59 -0
- package/dist/multi-select/index.d.ts +59 -0
- package/dist/multi-select/index.mjs +2 -0
- package/dist/otp-input/index.cjs +1 -0
- package/dist/otp-input/index.d.mts +57 -0
- package/dist/otp-input/index.d.ts +57 -0
- package/dist/otp-input/index.mjs +1 -0
- package/dist/password-input/index.cjs +2 -0
- package/dist/password-input/index.d.mts +32 -0
- package/dist/password-input/index.d.ts +32 -0
- package/dist/password-input/index.mjs +2 -0
- package/dist/phone/index.cjs +2 -0
- package/dist/phone/index.d.mts +41 -0
- package/dist/phone/index.d.ts +41 -0
- package/dist/phone/index.mjs +2 -0
- package/dist/radio-button/index.cjs +1 -0
- package/dist/radio-button/index.d.mts +56 -0
- package/dist/radio-button/index.d.ts +56 -0
- package/dist/radio-button/index.mjs +1 -0
- package/dist/search-input/index.cjs +2 -0
- package/dist/search-input/index.d.mts +22 -0
- package/dist/search-input/index.d.ts +22 -0
- package/dist/search-input/index.mjs +2 -0
- package/dist/select/index.cjs +2 -0
- package/dist/select/index.d.mts +36 -0
- package/dist/select/index.d.ts +36 -0
- package/dist/select/index.mjs +2 -0
- package/dist/sidebar/index.cjs +1 -0
- package/dist/sidebar/index.d.mts +96 -0
- package/dist/sidebar/index.d.ts +96 -0
- package/dist/sidebar/index.mjs +1 -0
- package/dist/skeleton/index.cjs +1 -0
- package/dist/skeleton/index.d.mts +76 -0
- package/dist/skeleton/index.d.ts +76 -0
- package/dist/skeleton/index.mjs +1 -0
- package/dist/styles.css +2 -0
- package/dist/styles.d.mts +2 -0
- package/dist/styles.d.ts +2 -0
- package/dist/table/index.cjs +1 -0
- package/dist/table/index.d.mts +92 -0
- package/dist/table/index.d.ts +92 -0
- package/dist/table/index.mjs +1 -0
- package/dist/tabs/index.cjs +2 -0
- package/dist/tabs/index.d.mts +26 -0
- package/dist/tabs/index.d.ts +26 -0
- package/dist/tabs/index.mjs +2 -0
- package/dist/text-input/index.cjs +2 -0
- package/dist/text-input/index.d.mts +7 -0
- package/dist/text-input/index.d.ts +7 -0
- package/dist/text-input/index.mjs +2 -0
- package/dist/theme-provider/index.cjs +1 -0
- package/dist/theme-provider/index.d.mts +122 -0
- package/dist/theme-provider/index.d.ts +122 -0
- package/dist/theme-provider/index.mjs +1 -0
- package/dist/time-picker/index.cjs +2 -0
- package/dist/time-picker/index.d.mts +32 -0
- package/dist/time-picker/index.d.ts +32 -0
- package/dist/time-picker/index.mjs +2 -0
- package/dist/toaster/index.cjs +1 -0
- package/dist/toaster/index.d.mts +28 -0
- package/dist/toaster/index.d.ts +28 -0
- package/dist/toaster/index.mjs +1 -0
- package/dist/tooltip/index.cjs +1 -0
- package/dist/tooltip/index.d.mts +7 -0
- package/dist/tooltip/index.d.ts +7 -0
- package/dist/tooltip/index.mjs +1 -0
- package/package.json +56 -54
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ReactNode, HTMLAttributes, ButtonHTMLAttributes } from 'react';
|
|
3
|
+
|
|
4
|
+
type DropdownMenuSize = 'sm' | 'md' | 'lg';
|
|
5
|
+
type DropdownMenuVariant = 'default' | 'subtle' | 'ghost';
|
|
6
|
+
interface DropdownMenuProps {
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
open?: boolean;
|
|
9
|
+
onOpenChange?: (open: boolean) => void;
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
interface DropdownMenuTriggerProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
13
|
+
size?: DropdownMenuSize;
|
|
14
|
+
variant?: DropdownMenuVariant;
|
|
15
|
+
}
|
|
16
|
+
interface DropdownMenuContentProps extends HTMLAttributes<HTMLDivElement> {
|
|
17
|
+
align?: 'left' | 'right' | 'center';
|
|
18
|
+
width?: string | number;
|
|
19
|
+
}
|
|
20
|
+
interface DropdownMenuItemProps extends HTMLAttributes<HTMLDivElement> {
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
destructive?: boolean;
|
|
23
|
+
icon?: ReactNode;
|
|
24
|
+
shortcut?: string;
|
|
25
|
+
}
|
|
26
|
+
type DropdownMenuSeparatorProps = HTMLAttributes<HTMLDivElement>;
|
|
27
|
+
|
|
28
|
+
declare const DropdownMenu: React.FC<DropdownMenuProps>;
|
|
29
|
+
declare const DropdownMenuTrigger: React.ForwardRefExoticComponent<DropdownMenuTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
30
|
+
declare const DropdownMenuContent: React.ForwardRefExoticComponent<DropdownMenuContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
31
|
+
declare const DropdownMenuItem: React.ForwardRefExoticComponent<DropdownMenuItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
32
|
+
declare const DropdownMenuSeparator: React.FC<DropdownMenuSeparatorProps>;
|
|
33
|
+
|
|
34
|
+
export { DropdownMenu, DropdownMenuContent, type DropdownMenuContentProps, DropdownMenuItem, type DropdownMenuItemProps, type DropdownMenuProps, DropdownMenuSeparator, type DropdownMenuSeparatorProps, type DropdownMenuSize, DropdownMenuTrigger, type DropdownMenuTriggerProps, type DropdownMenuVariant };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ReactNode, HTMLAttributes, ButtonHTMLAttributes } from 'react';
|
|
3
|
+
|
|
4
|
+
type DropdownMenuSize = 'sm' | 'md' | 'lg';
|
|
5
|
+
type DropdownMenuVariant = 'default' | 'subtle' | 'ghost';
|
|
6
|
+
interface DropdownMenuProps {
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
open?: boolean;
|
|
9
|
+
onOpenChange?: (open: boolean) => void;
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
interface DropdownMenuTriggerProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
13
|
+
size?: DropdownMenuSize;
|
|
14
|
+
variant?: DropdownMenuVariant;
|
|
15
|
+
}
|
|
16
|
+
interface DropdownMenuContentProps extends HTMLAttributes<HTMLDivElement> {
|
|
17
|
+
align?: 'left' | 'right' | 'center';
|
|
18
|
+
width?: string | number;
|
|
19
|
+
}
|
|
20
|
+
interface DropdownMenuItemProps extends HTMLAttributes<HTMLDivElement> {
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
destructive?: boolean;
|
|
23
|
+
icon?: ReactNode;
|
|
24
|
+
shortcut?: string;
|
|
25
|
+
}
|
|
26
|
+
type DropdownMenuSeparatorProps = HTMLAttributes<HTMLDivElement>;
|
|
27
|
+
|
|
28
|
+
declare const DropdownMenu: React.FC<DropdownMenuProps>;
|
|
29
|
+
declare const DropdownMenuTrigger: React.ForwardRefExoticComponent<DropdownMenuTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
30
|
+
declare const DropdownMenuContent: React.ForwardRefExoticComponent<DropdownMenuContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
31
|
+
declare const DropdownMenuItem: React.ForwardRefExoticComponent<DropdownMenuItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
32
|
+
declare const DropdownMenuSeparator: React.FC<DropdownMenuSeparatorProps>;
|
|
33
|
+
|
|
34
|
+
export { DropdownMenu, DropdownMenuContent, type DropdownMenuContentProps, DropdownMenuItem, type DropdownMenuItemProps, type DropdownMenuProps, DropdownMenuSeparator, type DropdownMenuSeparatorProps, type DropdownMenuSize, DropdownMenuTrigger, type DropdownMenuTriggerProps, type DropdownMenuVariant };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as t from'react';import {ChevronDownIcon}from'@heroicons/react/20/solid';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {jsxs,jsx}from'react/jsx-runtime';function w(...n){return twMerge(clsx(n))}var v=t.createContext(null);function M(){let n=t.useContext(v);if(!n)throw new Error("DropdownMenu components must be used within a DropdownMenu");return n}var R=({children:n,open:s,onOpenChange:o,className:m})=>{let[i,u]=t.useState(false),[e,d]=t.useState(null),l=s??i,a=t.useCallback(r=>{u(r),o?.(r);},[o]);return t.useEffect(()=>{if(!l)return;let r=p=>{e&&!e.contains(p.target)&&!p.target.closest("[data-dropdown-content]")&&a(false);};return document.addEventListener("mousedown",r),()=>{document.removeEventListener("mousedown",r);}},[l,a,e]),t.useEffect(()=>{if(!l)return;let r=p=>{p.key==="Escape"&&(a(false),e?.focus());};return document.addEventListener("keydown",r),()=>{document.removeEventListener("keydown",r);}},[l,a,e]),jsx(v.Provider,{value:{open:l,setOpen:a,triggerElement:e,setTriggerElement:d},children:jsx("div",{className:w("relative inline-block",m),children:n})})},y={sm:"h-8 px-3 text-xs",md:"h-10 px-4 text-sm",lg:"h-11 px-5 text-base"},h={default:"bg-surface border border-border text-text shadow-sm hover:bg-hover focus:ring-2 focus:ring-primary/40",subtle:"bg-surface-secondary text-text hover:bg-active",ghost:"bg-transparent text-text-secondary hover:bg-hover"},C=t.forwardRef(({children:n,className:s,size:o="md",variant:m="default",onClick:i,...u},e)=>{let{open:d,setOpen:l,setTriggerElement:a}=M(),r=t.useCallback(g=>{a(g),typeof e=="function"?e(g):e&&(e.current=g);},[e,a]),p=g=>{l(!d),i?.(g);};return jsxs("button",{ref:r,type:"button","aria-expanded":d,"aria-haspopup":"menu",className:w("inline-flex items-center justify-center rounded-md font-bold uppercase tracking-widest transition-all duration-normal focus:outline-none disabled:opacity-50 disabled:pointer-events-none",y[o],h[m],s),onClick:p,...u,children:[n,jsx(ChevronDownIcon,{className:w("ml-2 h-4 w-4 transition-transform duration-200",d&&"rotate-180")})]})}),T=t.forwardRef(({children:n,className:s,align:o="left",width:m=220,...i},u)=>{let{open:e}=M();return e?jsx("div",{ref:u,"data-dropdown-content":true,role:"menu",style:{width:m},className:w("absolute top-full z-dropdown mt-2 min-w-32 overflow-hidden rounded-lg border border-border bg-surface p-1.5 text-text shadow-lg ring-1 ring-border/5 animate-in fade-in zoom-in-95 duration-normal",{left:"left-0",right:"right-0",center:"left-1/2 -translate-x-1/2"}[o],s),...i,children:n}):null}),L=t.forwardRef(({children:n,className:s,disabled:o,destructive:m,icon:i,shortcut:u,onClick:e,...d},l)=>{let{setOpen:a}=M(),r=f=>{o||(e?.(f),a(false));},p=f=>{o||(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),e?.(f),a(false));};return jsxs("div",{ref:l,role:"menuitem","aria-disabled":o,tabIndex:o?-1:0,className:w("relative flex cursor-default select-none items-center rounded-sm px-3 py-2 text-sm outline-none transition-all duration-fast focus:bg-hover data-disabled:pointer-events-none data-disabled:opacity-50 hover:bg-hover font-medium",m&&"text-error hover:bg-error/10 hover:text-error",o&&"opacity-50 pointer-events-none",s),onClick:r,onKeyDown:p,...d,children:[i&&jsx("span",{className:"mr-2 flex h-4 w-4 items-center justify-center",children:i}),jsx("span",{className:"flex-1",children:n}),u&&jsx("span",{className:"ml-auto text-xs tracking-widest text-text-muted font-bold",children:u})]})}),H=({className:n,...s})=>jsx("div",{className:w("-mx-1.5 my-1 h-px bg-divider",n),...s});R.displayName="DropdownMenu";C.displayName="DropdownMenuTrigger";T.displayName="DropdownMenuContent";L.displayName="DropdownMenuItem";H.displayName="DropdownMenuSeparator";export{R as DropdownMenu,T as DropdownMenuContent,L as DropdownMenuItem,H as DropdownMenuSeparator,C as DropdownMenuTrigger};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var react=require('react'),solid=require('@heroicons/react/20/solid'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),jsxRuntime=require('react/jsx-runtime');function t(...r){return tailwindMerge.twMerge(clsx.clsx(r))}var ee={xs:"h-6 px-2 text-xs",sm:"h-8 px-3 text-sm",md:"h-10 px-3 text-sm",lg:"h-11 px-4 text-base",xl:"h-12 px-4 text-lg"},re={xs:"text-xs",sm:"text-xs",md:"text-sm",lg:"text-sm",xl:"text-base"},te={default:"rounded-md border border-border bg-surface shadow-sm focus:outline-none",filled:"rounded-md border border-transparent bg-surface-secondary focus:bg-surface focus:outline-none",flushed:"rounded-none border-0 border-b border-border bg-transparent focus:outline-none",unstyled:"border-0 bg-transparent p-0 focus:outline-none"},ne={default:{default:"border-border focus:border-primary",filled:"focus:border-primary",flushed:"border-border focus:border-primary",unstyled:""},error:{default:"border-error focus:border-error",filled:"bg-error/5 focus:border-error",flushed:"border-error focus:border-error",unstyled:""},success:{default:"border-success focus:border-success",filled:"bg-success/5 focus:border-success",flushed:"border-success focus:border-success",unstyled:""},warning:{default:"border-warning focus:border-warning",filled:"bg-warning/5 border-warning focus:border-warning",flushed:"border-warning focus:border-warning",unstyled:""}},se={default:"text-text-muted",error:"text-error",success:"text-success",warning:"text-warning"};function oe(r,n,a,s){if(r==="error"&&n)return n;if(r==="success"&&a)return a;if(r==="warning"&&s)return s}function V({children:r,side:n}){return jsxRuntime.jsx("span",{"aria-hidden":"true",className:t("inline-flex items-center border border-border bg-surface-secondary px-3 text-sm text-text-secondary select-none",n==="left"?"rounded-l-md border-r-0":"rounded-r-md border-l-0"),children:r})}var ae=react.forwardRef(function({label:n,required:a=false,helperText:s,errorMessage:M,successMessage:z,warningMessage:A,variant:b="default",size:g="md",state:i="default",fullWidth:x=true,leftElement:h,rightElement:y,prefix:w,suffix:v,wrapperClassName:B,inputGroupClassName:P,inputClassName:H,labelClassName:j,helperClassName:E,id:L,disabled:N,className:T,clearable:D,isLoading:u,multiple:F=false,autoCapitalize:O="none",autoComplete:$="email",spellCheck:X=false,value:l,onChange:f,...q},o){let G=react.useId(),c=L??G,R=`${c}-helper`,C=`${c}-state`,m=D&&(typeof l=="string"||typeof l=="number")&&String(l).length>0,S=h!==void 0,I=y!==void 0||!!m||!!u,p=oe(i,M,z,A),J=[s?R:null,p?C:null].filter(Boolean).join(" ")||void 0,K=()=>{if(o&&typeof o!="function"&&o.current){Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"value")?.set?.call(o.current,"");let k=new Event("input",{bubbles:true});o.current.dispatchEvent(k);}else f&&f({target:{value:""},currentTarget:{value:""},preventDefault:()=>{},stopPropagation:()=>{}});},Q=()=>u?jsxRuntime.jsxs("svg",{className:"animate-spin h-5 w-5 text-text-muted",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}):m?jsxRuntime.jsx("button",{type:"button",onClick:K,className:"flex items-center justify-center rounded-full text-text-muted hover:text-text hover:bg-interaction-hover p-0.5 transition w-6 h-6 border-0 bg-transparent cursor-pointer","aria-label":"Clear input",children:jsxRuntime.jsx(solid.XMarkIcon,{className:"w-5 h-5"})}):y;return jsxRuntime.jsxs("div",{className:t("flex flex-col gap-1",x?"w-full":"w-fit",B,T),children:[n!==void 0&&jsxRuntime.jsxs("label",{htmlFor:c,className:t("font-black leading-none text-text mb-2 uppercase tracking-widest",re[g],j),children:[n,a&&jsxRuntime.jsx("span",{"aria-hidden":"true",className:"ml-1 text-error",children:"*"})]}),jsxRuntime.jsxs("div",{className:t("flex items-stretch transition-all duration-150 overflow-hidden",te[b],ne[i][b],x?"w-full":"w-fit","focus-within:ring-4 focus-within:ring-primary/20 focus-within:border-primary",N&&"opacity-50 cursor-not-allowed bg-surface-secondary",P),children:[w!==void 0&&jsxRuntime.jsx(V,{side:"left",children:w}),jsxRuntime.jsxs("div",{className:"flex flex-1 items-center min-w-0",children:[S&&jsxRuntime.jsx("div",{className:"pl-3 shrink-0 flex items-center justify-center",children:h}),jsxRuntime.jsx("div",{className:"flex-1 min-w-0 h-full",children:jsxRuntime.jsx("input",{ref:o,...q,id:c,disabled:!!N||!!u,type:"email",multiple:F,autoCapitalize:O,autoComplete:$,spellCheck:X,value:l,onChange:f,"aria-invalid":i==="error"?true:void 0,"aria-describedby":J,"aria-required":a,className:t("w-full bg-transparent border-0 focus:outline-none focus:ring-0 outline-none h-full",ee[g],H),style:{paddingLeft:S?"0.5rem":void 0,paddingRight:I||m?"0.5rem":void 0}})}),I&&jsxRuntime.jsx("div",{className:"pr-3 shrink-0 flex items-center justify-center text-text-secondary",style:{width:"2.5rem"},children:Q()})]}),v!==void 0&&jsxRuntime.jsx(V,{side:"right",children:v})]}),s!==void 0&&jsxRuntime.jsx("p",{id:R,className:t("text-xs leading-tight text-text-muted",E),children:s}),p!==void 0&&jsxRuntime.jsx("p",{id:C,role:i==="error"?"alert":void 0,className:t("text-xs leading-tight mt-1 ",se[i],E),children:p})]})});ae.displayName="Email";
|
|
2
|
+
exports.Email=ae;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { InputHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
type EmailVariant = 'default' | 'filled' | 'flushed' | 'unstyled';
|
|
4
|
+
type EmailSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
5
|
+
type EmailState = 'default' | 'error' | 'success' | 'warning';
|
|
6
|
+
interface EmailProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'prefix' | 'type'> {
|
|
7
|
+
label?: string;
|
|
8
|
+
required?: boolean;
|
|
9
|
+
helperText?: string;
|
|
10
|
+
errorMessage?: string;
|
|
11
|
+
successMessage?: string;
|
|
12
|
+
warningMessage?: string;
|
|
13
|
+
variant?: EmailVariant;
|
|
14
|
+
size?: EmailSize;
|
|
15
|
+
state?: EmailState;
|
|
16
|
+
fullWidth?: boolean;
|
|
17
|
+
leftElement?: ReactNode;
|
|
18
|
+
rightElement?: ReactNode;
|
|
19
|
+
prefix?: ReactNode;
|
|
20
|
+
suffix?: ReactNode;
|
|
21
|
+
wrapperClassName?: string;
|
|
22
|
+
inputGroupClassName?: string;
|
|
23
|
+
inputClassName?: string;
|
|
24
|
+
labelClassName?: string;
|
|
25
|
+
helperClassName?: string;
|
|
26
|
+
clearable?: boolean;
|
|
27
|
+
isLoading?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* If true, allows the user to enter multiple email addresses separated by commas.
|
|
30
|
+
* Useful for "To" fields in email composers.
|
|
31
|
+
* @default false
|
|
32
|
+
*/
|
|
33
|
+
multiple?: boolean;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
declare const Email: React.ForwardRefExoticComponent<EmailProps & React.RefAttributes<HTMLInputElement>>;
|
|
37
|
+
|
|
38
|
+
export { Email, type EmailProps, type EmailSize, type EmailState, type EmailVariant };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { InputHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
type EmailVariant = 'default' | 'filled' | 'flushed' | 'unstyled';
|
|
4
|
+
type EmailSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
5
|
+
type EmailState = 'default' | 'error' | 'success' | 'warning';
|
|
6
|
+
interface EmailProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'prefix' | 'type'> {
|
|
7
|
+
label?: string;
|
|
8
|
+
required?: boolean;
|
|
9
|
+
helperText?: string;
|
|
10
|
+
errorMessage?: string;
|
|
11
|
+
successMessage?: string;
|
|
12
|
+
warningMessage?: string;
|
|
13
|
+
variant?: EmailVariant;
|
|
14
|
+
size?: EmailSize;
|
|
15
|
+
state?: EmailState;
|
|
16
|
+
fullWidth?: boolean;
|
|
17
|
+
leftElement?: ReactNode;
|
|
18
|
+
rightElement?: ReactNode;
|
|
19
|
+
prefix?: ReactNode;
|
|
20
|
+
suffix?: ReactNode;
|
|
21
|
+
wrapperClassName?: string;
|
|
22
|
+
inputGroupClassName?: string;
|
|
23
|
+
inputClassName?: string;
|
|
24
|
+
labelClassName?: string;
|
|
25
|
+
helperClassName?: string;
|
|
26
|
+
clearable?: boolean;
|
|
27
|
+
isLoading?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* If true, allows the user to enter multiple email addresses separated by commas.
|
|
30
|
+
* Useful for "To" fields in email composers.
|
|
31
|
+
* @default false
|
|
32
|
+
*/
|
|
33
|
+
multiple?: boolean;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
declare const Email: React.ForwardRefExoticComponent<EmailProps & React.RefAttributes<HTMLInputElement>>;
|
|
37
|
+
|
|
38
|
+
export { Email, type EmailProps, type EmailSize, type EmailState, type EmailVariant };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {forwardRef,useId}from'react';import {XMarkIcon}from'@heroicons/react/20/solid';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {jsxs,jsx}from'react/jsx-runtime';function t(...r){return twMerge(clsx(r))}var ee={xs:"h-6 px-2 text-xs",sm:"h-8 px-3 text-sm",md:"h-10 px-3 text-sm",lg:"h-11 px-4 text-base",xl:"h-12 px-4 text-lg"},re={xs:"text-xs",sm:"text-xs",md:"text-sm",lg:"text-sm",xl:"text-base"},te={default:"rounded-md border border-border bg-surface shadow-sm focus:outline-none",filled:"rounded-md border border-transparent bg-surface-secondary focus:bg-surface focus:outline-none",flushed:"rounded-none border-0 border-b border-border bg-transparent focus:outline-none",unstyled:"border-0 bg-transparent p-0 focus:outline-none"},ne={default:{default:"border-border focus:border-primary",filled:"focus:border-primary",flushed:"border-border focus:border-primary",unstyled:""},error:{default:"border-error focus:border-error",filled:"bg-error/5 focus:border-error",flushed:"border-error focus:border-error",unstyled:""},success:{default:"border-success focus:border-success",filled:"bg-success/5 focus:border-success",flushed:"border-success focus:border-success",unstyled:""},warning:{default:"border-warning focus:border-warning",filled:"bg-warning/5 border-warning focus:border-warning",flushed:"border-warning focus:border-warning",unstyled:""}},se={default:"text-text-muted",error:"text-error",success:"text-success",warning:"text-warning"};function oe(r,n,a,s){if(r==="error"&&n)return n;if(r==="success"&&a)return a;if(r==="warning"&&s)return s}function V({children:r,side:n}){return jsx("span",{"aria-hidden":"true",className:t("inline-flex items-center border border-border bg-surface-secondary px-3 text-sm text-text-secondary select-none",n==="left"?"rounded-l-md border-r-0":"rounded-r-md border-l-0"),children:r})}var ae=forwardRef(function({label:n,required:a=false,helperText:s,errorMessage:M,successMessage:z,warningMessage:A,variant:b="default",size:g="md",state:i="default",fullWidth:x=true,leftElement:h,rightElement:y,prefix:w,suffix:v,wrapperClassName:B,inputGroupClassName:P,inputClassName:H,labelClassName:j,helperClassName:E,id:L,disabled:N,className:T,clearable:D,isLoading:u,multiple:F=false,autoCapitalize:O="none",autoComplete:$="email",spellCheck:X=false,value:l,onChange:f,...q},o){let G=useId(),c=L??G,R=`${c}-helper`,C=`${c}-state`,m=D&&(typeof l=="string"||typeof l=="number")&&String(l).length>0,S=h!==void 0,I=y!==void 0||!!m||!!u,p=oe(i,M,z,A),J=[s?R:null,p?C:null].filter(Boolean).join(" ")||void 0,K=()=>{if(o&&typeof o!="function"&&o.current){Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"value")?.set?.call(o.current,"");let k=new Event("input",{bubbles:true});o.current.dispatchEvent(k);}else f&&f({target:{value:""},currentTarget:{value:""},preventDefault:()=>{},stopPropagation:()=>{}});},Q=()=>u?jsxs("svg",{className:"animate-spin h-5 w-5 text-text-muted",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}):m?jsx("button",{type:"button",onClick:K,className:"flex items-center justify-center rounded-full text-text-muted hover:text-text hover:bg-interaction-hover p-0.5 transition w-6 h-6 border-0 bg-transparent cursor-pointer","aria-label":"Clear input",children:jsx(XMarkIcon,{className:"w-5 h-5"})}):y;return jsxs("div",{className:t("flex flex-col gap-1",x?"w-full":"w-fit",B,T),children:[n!==void 0&&jsxs("label",{htmlFor:c,className:t("font-black leading-none text-text mb-2 uppercase tracking-widest",re[g],j),children:[n,a&&jsx("span",{"aria-hidden":"true",className:"ml-1 text-error",children:"*"})]}),jsxs("div",{className:t("flex items-stretch transition-all duration-150 overflow-hidden",te[b],ne[i][b],x?"w-full":"w-fit","focus-within:ring-4 focus-within:ring-primary/20 focus-within:border-primary",N&&"opacity-50 cursor-not-allowed bg-surface-secondary",P),children:[w!==void 0&&jsx(V,{side:"left",children:w}),jsxs("div",{className:"flex flex-1 items-center min-w-0",children:[S&&jsx("div",{className:"pl-3 shrink-0 flex items-center justify-center",children:h}),jsx("div",{className:"flex-1 min-w-0 h-full",children:jsx("input",{ref:o,...q,id:c,disabled:!!N||!!u,type:"email",multiple:F,autoCapitalize:O,autoComplete:$,spellCheck:X,value:l,onChange:f,"aria-invalid":i==="error"?true:void 0,"aria-describedby":J,"aria-required":a,className:t("w-full bg-transparent border-0 focus:outline-none focus:ring-0 outline-none h-full",ee[g],H),style:{paddingLeft:S?"0.5rem":void 0,paddingRight:I||m?"0.5rem":void 0}})}),I&&jsx("div",{className:"pr-3 shrink-0 flex items-center justify-center text-text-secondary",style:{width:"2.5rem"},children:Q()})]}),v!==void 0&&jsx(V,{side:"right",children:v})]}),s!==void 0&&jsx("p",{id:R,className:t("text-xs leading-tight text-text-muted",E),children:s}),p!==void 0&&jsx("p",{id:C,role:i==="error"?"alert":void 0,className:t("text-xs leading-tight mt-1 ",se[i],E),children:p})]})});ae.displayName="Email";
|
|
2
|
+
export{ae as Email};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var react=require('react'),outline=require('@heroicons/react/24/outline'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),jsxRuntime=require('react/jsx-runtime');function r(...m){return tailwindMerge.twMerge(clsx.clsx(m))}var ee={sm:"p-4 text-sm",md:"p-8 text-sm",lg:"p-12 text-base"},te={sm:"text-xs",md:"text-sm",lg:"text-sm"},re={default:"border-border hover:border-primary-hover bg-surface focus-within:ring-2 focus-within:ring-primary/20 focus-within:border-primary",error:"border-error bg-error/5 focus-within:ring-2 focus-within:ring-error/20",success:"border-success bg-success/5 focus-within:ring-2 focus-within:ring-success/20",warning:"border-warning bg-warning/5 focus-within:ring-2 focus-within:ring-warning/20"},E={default:"text-text-muted",error:"text-error font-medium",success:"text-success font-medium",warning:"text-warning font-medium"},ne=react.forwardRef(function({label:g,required:F=false,helperText:x,errorMessage:C,successMessage:M,warningMessage:U,size:h="md",state:t="default",fullWidth:I=true,wrapperClassName:N,labelClassName:R,helperClassName:v,dropzoneClassName:L,icon:k,maxSize:i,maxFiles:c,onFilesSelected:y,accept:p,multiple:H,disabled:n,id:T,className:A,...S},l){let K=react.useId(),d=T??K,f=react.useRef(null),[$,u]=react.useState(false),P=e=>{e.preventDefault(),n||u(true);},z=()=>{u(false);},O=e=>{if(e.preventDefault(),u(false),n)return;let o=Array.from(e.dataTransfer.files);b(o);},V=e=>{e.target.files&&b(Array.from(e.target.files));},b=e=>{let o=e;c&&e.length>c&&(o=e.slice(0,c)),i&&(o=o.filter(G=>G.size<=i)),y&&y(o);},w=()=>{f.current&&f.current.click();},B=`${d}-helper`,j=`${d}-state`,D=t==="error"?C:t==="success"?M:t==="warning"?U:void 0,q=e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),w());};return jsxRuntime.jsxs("div",{className:r("flex flex-col gap-1.5",I?"w-full":"w-fit",N,A),children:[g&&jsxRuntime.jsxs("label",{htmlFor:d,className:r("font-black leading-none text-text uppercase tracking-widest",te[h],R),children:[g,F&&jsxRuntime.jsx("span",{"aria-hidden":"true",className:"ml-1 text-error",children:"*"})]}),jsxRuntime.jsxs("div",{onDragOver:P,onDragLeave:z,onDrop:O,onClick:w,onKeyDown:q,role:"button",tabIndex:n?-1:0,"aria-disabled":n,className:r("relative flex flex-col items-center justify-center border-2 border-dashed rounded-lg transition-all cursor-pointer group",ee[h],re[t],$&&"border-primary bg-primary/5 scale-[1.01] shadow-md",n&&"opacity-50 cursor-not-allowed bg-surface-secondary border-border",L),children:[jsxRuntime.jsx("input",{...S,ref:e=>{f.current=e,typeof l=="function"?l(e):l&&(l.current=e);},id:d,type:"file",accept:p,multiple:H,disabled:n,onChange:V,className:"sr-only"}),jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-2 text-center pointer-events-none",children:[k??jsxRuntime.jsx(outline.CloudArrowUpIcon,{className:r("w-10 h-10 mb-2 transition-all duration-normal group-hover:scale-110",t==="default"?"text-text-muted":E[t])}),jsxRuntime.jsx("span",{className:"font-bold text-text transition-colors group-hover:text-primary",children:"Click to upload or drag and drop"}),jsxRuntime.jsxs("span",{className:"text-xs text-text-muted font-medium",children:[p?`Available formats: ${p}`:"Any file type",i&&` (Max ${String(Math.round(i/1024/1024))}MB)`]})]})]}),x&&jsxRuntime.jsx("p",{id:B,className:r("text-xs text-text-muted font-medium mt-1",v),children:x}),D&&jsxRuntime.jsx("p",{id:j,role:t==="error"?"alert":void 0,className:r("text-xs font-bold mt-1",E[t],v),children:D})]})});ne.displayName="FileUpload";exports.FileUpload=ne;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { InputHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
type FileUploadSize = 'sm' | 'md' | 'lg';
|
|
4
|
+
type FileUploadState = 'default' | 'error' | 'success' | 'warning';
|
|
5
|
+
interface FileUploadProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'type' | 'value' | 'onChange'> {
|
|
6
|
+
label?: string;
|
|
7
|
+
required?: boolean;
|
|
8
|
+
helperText?: string;
|
|
9
|
+
errorMessage?: string;
|
|
10
|
+
successMessage?: string;
|
|
11
|
+
warningMessage?: string;
|
|
12
|
+
size?: FileUploadSize;
|
|
13
|
+
state?: FileUploadState;
|
|
14
|
+
fullWidth?: boolean;
|
|
15
|
+
wrapperClassName?: string;
|
|
16
|
+
labelClassName?: string;
|
|
17
|
+
helperClassName?: string;
|
|
18
|
+
dropzoneClassName?: string;
|
|
19
|
+
icon?: ReactNode;
|
|
20
|
+
maxSize?: number;
|
|
21
|
+
maxFiles?: number;
|
|
22
|
+
onFilesSelected?: (files: File[]) => void;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
declare const FileUpload: React.ForwardRefExoticComponent<FileUploadProps & React.RefAttributes<HTMLInputElement>>;
|
|
26
|
+
|
|
27
|
+
export { FileUpload, type FileUploadProps, type FileUploadSize, type FileUploadState };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { InputHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
type FileUploadSize = 'sm' | 'md' | 'lg';
|
|
4
|
+
type FileUploadState = 'default' | 'error' | 'success' | 'warning';
|
|
5
|
+
interface FileUploadProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'type' | 'value' | 'onChange'> {
|
|
6
|
+
label?: string;
|
|
7
|
+
required?: boolean;
|
|
8
|
+
helperText?: string;
|
|
9
|
+
errorMessage?: string;
|
|
10
|
+
successMessage?: string;
|
|
11
|
+
warningMessage?: string;
|
|
12
|
+
size?: FileUploadSize;
|
|
13
|
+
state?: FileUploadState;
|
|
14
|
+
fullWidth?: boolean;
|
|
15
|
+
wrapperClassName?: string;
|
|
16
|
+
labelClassName?: string;
|
|
17
|
+
helperClassName?: string;
|
|
18
|
+
dropzoneClassName?: string;
|
|
19
|
+
icon?: ReactNode;
|
|
20
|
+
maxSize?: number;
|
|
21
|
+
maxFiles?: number;
|
|
22
|
+
onFilesSelected?: (files: File[]) => void;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
declare const FileUpload: React.ForwardRefExoticComponent<FileUploadProps & React.RefAttributes<HTMLInputElement>>;
|
|
26
|
+
|
|
27
|
+
export { FileUpload, type FileUploadProps, type FileUploadSize, type FileUploadState };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {forwardRef,useId,useRef,useState}from'react';import {CloudArrowUpIcon}from'@heroicons/react/24/outline';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {jsxs,jsx}from'react/jsx-runtime';function r(...m){return twMerge(clsx(m))}var ee={sm:"p-4 text-sm",md:"p-8 text-sm",lg:"p-12 text-base"},te={sm:"text-xs",md:"text-sm",lg:"text-sm"},re={default:"border-border hover:border-primary-hover bg-surface focus-within:ring-2 focus-within:ring-primary/20 focus-within:border-primary",error:"border-error bg-error/5 focus-within:ring-2 focus-within:ring-error/20",success:"border-success bg-success/5 focus-within:ring-2 focus-within:ring-success/20",warning:"border-warning bg-warning/5 focus-within:ring-2 focus-within:ring-warning/20"},E={default:"text-text-muted",error:"text-error font-medium",success:"text-success font-medium",warning:"text-warning font-medium"},ne=forwardRef(function({label:g,required:F=false,helperText:x,errorMessage:C,successMessage:M,warningMessage:U,size:h="md",state:t="default",fullWidth:I=true,wrapperClassName:N,labelClassName:R,helperClassName:v,dropzoneClassName:L,icon:k,maxSize:i,maxFiles:c,onFilesSelected:y,accept:p,multiple:H,disabled:n,id:T,className:A,...S},l){let K=useId(),d=T??K,f=useRef(null),[$,u]=useState(false),P=e=>{e.preventDefault(),n||u(true);},z=()=>{u(false);},O=e=>{if(e.preventDefault(),u(false),n)return;let o=Array.from(e.dataTransfer.files);b(o);},V=e=>{e.target.files&&b(Array.from(e.target.files));},b=e=>{let o=e;c&&e.length>c&&(o=e.slice(0,c)),i&&(o=o.filter(G=>G.size<=i)),y&&y(o);},w=()=>{f.current&&f.current.click();},B=`${d}-helper`,j=`${d}-state`,D=t==="error"?C:t==="success"?M:t==="warning"?U:void 0,q=e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),w());};return jsxs("div",{className:r("flex flex-col gap-1.5",I?"w-full":"w-fit",N,A),children:[g&&jsxs("label",{htmlFor:d,className:r("font-black leading-none text-text uppercase tracking-widest",te[h],R),children:[g,F&&jsx("span",{"aria-hidden":"true",className:"ml-1 text-error",children:"*"})]}),jsxs("div",{onDragOver:P,onDragLeave:z,onDrop:O,onClick:w,onKeyDown:q,role:"button",tabIndex:n?-1:0,"aria-disabled":n,className:r("relative flex flex-col items-center justify-center border-2 border-dashed rounded-lg transition-all cursor-pointer group",ee[h],re[t],$&&"border-primary bg-primary/5 scale-[1.01] shadow-md",n&&"opacity-50 cursor-not-allowed bg-surface-secondary border-border",L),children:[jsx("input",{...S,ref:e=>{f.current=e,typeof l=="function"?l(e):l&&(l.current=e);},id:d,type:"file",accept:p,multiple:H,disabled:n,onChange:V,className:"sr-only"}),jsxs("div",{className:"flex flex-col items-center gap-2 text-center pointer-events-none",children:[k??jsx(CloudArrowUpIcon,{className:r("w-10 h-10 mb-2 transition-all duration-normal group-hover:scale-110",t==="default"?"text-text-muted":E[t])}),jsx("span",{className:"font-bold text-text transition-colors group-hover:text-primary",children:"Click to upload or drag and drop"}),jsxs("span",{className:"text-xs text-text-muted font-medium",children:[p?`Available formats: ${p}`:"Any file type",i&&` (Max ${String(Math.round(i/1024/1024))}MB)`]})]})]}),x&&jsx("p",{id:B,className:r("text-xs text-text-muted font-medium mt-1",v),children:x}),D&&jsx("p",{id:j,role:t==="error"?"alert":void 0,className:r("text-xs font-bold mt-1",E[t],v),children:D})]})});ne.displayName="FileUpload";export{ne as FileUpload};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),react=require('react'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime'),outline=require('@heroicons/react/24/outline');function r(...p){return tailwindMerge.twMerge(clsx.clsx(p))}var ae=150,ye={top:"-translate-x-1/2 -translate-y-full",bottom:"-translate-x-1/2",left:"-translate-x-full -translate-y-1/2",right:"-translate-y-1/2"},ve={top:"top-full left-1/2 -translate-x-1/2",bottom:"bottom-full left-1/2 -translate-x-1/2",left:"left-full top-1/2 -translate-y-1/2",right:"right-full top-1/2 -translate-y-1/2"},we={top:"border-l-transparent border-r-transparent border-b-transparent",bottom:"border-l-transparent border-r-transparent border-t-transparent",left:"border-t-transparent border-b-transparent border-r-transparent",right:"border-t-transparent border-b-transparent border-l-transparent"},Te={top:"translate-y-1",bottom:"-translate-y-1",left:"translate-x-1",right:"-translate-x-1"},Re={sm:"px-2 py-1 text-xs rounded-md",md:"px-3 py-1.5 text-sm rounded-lg",lg:"px-4 py-2 text-sm rounded-xl"},Be={dark:["bg-gray-900 text-gray-50","shadow-[0_4px_16px_rgba(0,0,0,0.35)]","ring-1 ring-white/10"].join(" "),primary:["bg-gradient-to-b from-blue-500 to-blue-600 text-white","shadow-[0_4px_16px_rgba(59,130,246,0.45)]","ring-1 ring-blue-400/30"].join(" "),light:["bg-white text-gray-800","border border-gray-200/80","shadow-[0_4px_16px_rgba(0,0,0,0.10)]"].join(" ")},Ee={dark:{top:"border-t-gray-900",bottom:"border-b-gray-900",left:"border-l-gray-900",right:"border-r-gray-900"},primary:{top:"border-t-blue-600",bottom:"border-b-blue-500",left:"border-l-blue-600",right:"border-r-blue-500"},light:{top:"border-t-gray-200",bottom:"border-b-gray-200",left:"border-l-gray-200",right:"border-r-gray-200"}};function le({content:p,children:x,placement:t="top",trigger:n="hover",showDelay:s=0,hideDelay:d=100,size:o="md",variant:m="dark",open:H,disabled:a=false,maxWidth:z=240,className:M,wrapperClassName:V}){let[F,w]=react.useState(false),[L,T]=react.useState(false),[S,B]=react.useState(false),[U,de]=react.useState({top:0,left:0}),[E,me]=react.useState(t),y=H!==void 0,u=y?H:F,K=react.useRef(null),$=react.useRef(null),j=react.useRef(null),q=react.useRef(null),N=react.useRef(null),G=react.useId(),i=react.useCallback(()=>{j.current&&clearTimeout(j.current),q.current&&clearTimeout(q.current),N.current&&clearTimeout(N.current);},[]),Q=react.useCallback(()=>{if(a||y)return;i();let e=()=>{w(true);};s>0?j.current=setTimeout(e,s):e();},[a,y,i,s]),Y=react.useCallback(()=>{y||(i(),q.current=setTimeout(()=>{w(false);},d));},[y,i,d]),Z=react.useCallback(()=>{a||y||w(e=>!e);},[a,y]);react.useEffect(()=>{let e=null;return u&&!a?(i(),e=requestAnimationFrame(()=>{T(true),e=requestAnimationFrame(()=>{B(true);});})):(e=requestAnimationFrame(()=>{B(false);}),N.current=setTimeout(()=>{T(false);},ae)),()=>{e&&cancelAnimationFrame(e),N.current&&clearTimeout(N.current);}},[u,a,i]);let ee=react.useCallback(()=>{if(!K.current||!u)return;let e=K.current.getBoundingClientRect(),l=$.current,b=8,f=t,te=g=>{switch(g){case "top":return {t:e.top-b,l:e.left+e.width/2};case "bottom":return {t:e.bottom+b,l:e.left+e.width/2};case "left":return {t:e.top+e.height/2,l:e.left-b};case "right":return {t:e.top+e.height/2,l:e.right+b}}},re=te(t),I=re.t,A=re.l;if(l){let g=l.getBoundingClientRect(),h=12;if(t==="top"&&e.top-g.height-b<h?f="bottom":t==="bottom"&&e.bottom+g.height+b>window.innerHeight-h?f="top":t==="left"&&e.left-g.width-b<h?f="right":t==="right"&&e.right+g.width+b>window.innerWidth-h&&(f="left"),f!==t){let se=te(f);I=se.t,A=se.l;}let oe=g.width/2,ne=g.height/2;f==="top"||f==="bottom"?A=Math.max(h+oe,Math.min(window.innerWidth-h-oe,A)):I=Math.max(h+ne,Math.min(window.innerHeight-h-ne,I));}me(f),de({top:I,left:A});},[u,t]);react.useLayoutEffect(()=>{if(!u)return;let e=null,l=()=>{e=requestAnimationFrame(ee);};return l(),window.addEventListener("resize",l),window.addEventListener("scroll",l,true),()=>{e!==null&&cancelAnimationFrame(e),window.removeEventListener("resize",l),window.removeEventListener("scroll",l,true);}},[u,ee]),react.useEffect(()=>{if(!u)return;let e=l=>{l.key==="Escape"&&(i(),w(false));};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e);}},[u,i]),react.useEffect(()=>i,[i]);let v={};(n==="hover"||n==="focus")&&(v.onFocus=Q,v.onBlur=Y),n==="hover"?(v.onMouseEnter=Q,v.onMouseLeave=Y):n==="click"&&(v.onClick=Z),v.onKeyDown=e=>{(e.key==="Enter"||e.key===" ")&&Z();};let ue=x;return jsxRuntime.jsxs("span",{ref:K,className:r("relative inline-flex isolate z-0",V),"aria-describedby":u&&!a?G:void 0,...v,children:[jsxRuntime.jsx("span",{className:"relative z-0",children:ue}),L&&!a&&reactDom.createPortal(jsxRuntime.jsx("div",{ref:$,className:r("pointer-events-none fixed z-[9999]",ye[E]),style:{top:U.top,left:U.left},children:jsxRuntime.jsxs("div",{id:G,role:"tooltip",style:{maxWidth:z,transitionDuration:`${ae.toString()}ms`},className:r("relative min-w-max whitespace-normal break-words","font-sans font-medium tracking-tight text-center leading-snug","transition-[opacity,transform] ease-out",S?"opacity-100 translate-x-0 translate-y-0":["opacity-0",Te[E]].join(" "),Be[m],Re[o],M),children:[jsxRuntime.jsx("div",{"aria-hidden":"true",className:r("absolute border-[6px]","drop-shadow-sm",ve[E],we[E],Ee[m][E])}),p]})}),document.body)]})}var Ce={xs:"h-6 px-2.5 text-xs",sm:"h-8 px-3 text-sm",md:"h-10 px-4 text-sm",lg:"h-11 px-6 text-base",xl:"h-12 px-8 text-lg"},Pe={xs:"w-3 h-3",sm:"w-3.5 h-3.5",md:"w-4 h-4",lg:"w-5 h-5",xl:"w-5 h-5"},ke={primary:"bg-primary text-text-inverse hover:bg-primary-hover hover:shadow-xl hover:shadow-primary/20 active:scale-95 border border-transparent shadow-md focus-visible:ring-primary/40 transition-all duration-normal",secondary:"bg-secondary text-text hover:bg-secondary-hover border border-transparent focus-visible:ring-primary/40",outline:"bg-transparent text-text border border-border hover:bg-hover hover:text-text focus-visible:ring-primary/40",ghost:"bg-transparent text-text border border-transparent hover:bg-hover hover:text-text focus-visible:ring-primary/40",danger:"bg-error text-text-inverse hover:bg-error/90 border border-transparent shadow-sm focus-visible:ring-error/40",success:"bg-success text-text-inverse hover:bg-success/90 border border-transparent shadow-sm focus-visible:ring-success/40",warning:"bg-warning text-text-inverse hover:bg-warning/90 border border-transparent shadow-sm focus-visible:ring-warning/40",info:"bg-info text-text-inverse hover:bg-info/90 border border-transparent shadow-sm focus-visible:ring-info/40"},He="opacity-50 cursor-not-allowed shadow-none",O=react.forwardRef(function({children:x,className:t,variant:n="primary",size:s="md",fullWidth:d=false,isLoading:o=false,loadingText:m,disabled:H=false,leftIcon:a,rightIcon:z,tooltip:M,tooltipPlacement:V="top",type:F="button",...w},L){let T=H||o,S=jsxRuntime.jsxs("div",{className:r("relative flex items-center justify-center",Pe[s]),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 rounded-full border-1 border-current opacity-20 animate-ping"}),jsxRuntime.jsxs("svg",{className:"animate-spin relative z-10 w-full h-full",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",role:"status",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),jsxRuntime.jsx("path",{className:"opacity-90",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})]}),B=jsxRuntime.jsx("button",{ref:L,type:F,disabled:T,"aria-disabled":T,"aria-busy":o,className:r("relative inline-flex items-center justify-center gap-2 font-bold rounded-md transition-[background-color,border-color,color,box-shadow,transform,opacity] duration-normal focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-offset-surface",Ce[s],ke[n],d?"w-full":"",T?He:"",t),...w,children:o&&m?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[S,jsxRuntime.jsx("span",{children:m})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[a&&jsxRuntime.jsx("span",{className:r("inline-flex shrink-0",o&&"invisible opacity-0"),children:a}),jsxRuntime.jsx("span",{className:r("truncate flex items-center justify-center",o&&"invisible opacity-0"),children:x}),z&&jsxRuntime.jsx("span",{className:r("inline-flex shrink-0",o&&"invisible opacity-0"),children:z}),o&&!m&&jsxRuntime.jsx("span",{className:"absolute inset-0 flex items-center justify-center",children:S})]})});return M?jsxRuntime.jsx(le,{content:M,placement:V,wrapperClassName:d?"w-full":"",children:B}):B});O.displayName="Button";var Me={xs:"w-6 h-6",sm:"w-8 h-8",md:"w-10 h-10",lg:"w-11 h-11",xl:"w-12 h-12"},W=react.forwardRef(({icon:p,"aria-label":x,isRound:t,className:n,size:s="md",...d},o)=>jsxRuntime.jsx(O,{ref:o,size:s,className:r("p-0 flex-shrink-0 min-w-0",Me[s],t&&"rounded-full",n),"aria-label":x,...d,children:p}));W.displayName="IconButton";var pe=({logo:p,children:x,actions:t,userSection:n,isSticky:s=true,className:d,glass:o=false,onMenuToggle:m})=>jsxRuntime.jsxs("header",{className:r("h-16 flex items-center justify-between px-6 bg-surface border-b border-border transition-all duration-normal",s&&"sticky top-0 z-index-sticky",o&&"glass",d),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[m&&jsxRuntime.jsx(W,{icon:jsxRuntime.jsx(outline.Bars3Icon,{className:"w-5 h-5"}),"aria-label":"Toggle Menu",variant:"ghost",size:"sm",onClick:m,className:"lg:hidden"}),p&&jsxRuntime.jsx("div",{className:"flex items-center",children:p})]}),jsxRuntime.jsx("div",{className:"flex-1 max-w-xl px-8 hidden md:block",children:x}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[t&&jsxRuntime.jsx("div",{className:"flex items-center gap-1",children:t}),n&&jsxRuntime.jsx("div",{className:"flex items-center pl-2 ml-2 border-l border-border h-8",children:n})]})]});pe.displayName="Header";
|
|
2
|
+
exports.Header=pe;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
interface HeaderProps {
|
|
4
|
+
/** Logo or brand element to display on the left. */
|
|
5
|
+
logo?: ReactNode;
|
|
6
|
+
/** Middle section content, often used for search. */
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
/** Array of menu items or icons for the right side actions. */
|
|
9
|
+
actions?: ReactNode;
|
|
10
|
+
/** Optional user profile section content. */
|
|
11
|
+
userSection?: ReactNode;
|
|
12
|
+
/** Whether the header is sticky at the top. */
|
|
13
|
+
isSticky?: boolean;
|
|
14
|
+
/** Additional CSS classes for the container. */
|
|
15
|
+
className?: string;
|
|
16
|
+
/** Whether to show the glass effect. */
|
|
17
|
+
glass?: boolean;
|
|
18
|
+
/** Sidebar toggle click handler (for mobile). */
|
|
19
|
+
onMenuToggle?: () => void;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface HeaderComponent {
|
|
23
|
+
(props: HeaderProps): React.JSX.Element;
|
|
24
|
+
displayName?: string;
|
|
25
|
+
}
|
|
26
|
+
declare const Header: HeaderComponent;
|
|
27
|
+
|
|
28
|
+
export { Header, type HeaderProps };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
interface HeaderProps {
|
|
4
|
+
/** Logo or brand element to display on the left. */
|
|
5
|
+
logo?: ReactNode;
|
|
6
|
+
/** Middle section content, often used for search. */
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
/** Array of menu items or icons for the right side actions. */
|
|
9
|
+
actions?: ReactNode;
|
|
10
|
+
/** Optional user profile section content. */
|
|
11
|
+
userSection?: ReactNode;
|
|
12
|
+
/** Whether the header is sticky at the top. */
|
|
13
|
+
isSticky?: boolean;
|
|
14
|
+
/** Additional CSS classes for the container. */
|
|
15
|
+
className?: string;
|
|
16
|
+
/** Whether to show the glass effect. */
|
|
17
|
+
glass?: boolean;
|
|
18
|
+
/** Sidebar toggle click handler (for mobile). */
|
|
19
|
+
onMenuToggle?: () => void;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface HeaderComponent {
|
|
23
|
+
(props: HeaderProps): React.JSX.Element;
|
|
24
|
+
displayName?: string;
|
|
25
|
+
}
|
|
26
|
+
declare const Header: HeaderComponent;
|
|
27
|
+
|
|
28
|
+
export { Header, type HeaderProps };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {forwardRef,useState,useRef,useId,useCallback,useEffect,useLayoutEffect}from'react';import {createPortal}from'react-dom';import {jsxs,jsx,Fragment}from'react/jsx-runtime';import {Bars3Icon}from'@heroicons/react/24/outline';function r(...p){return twMerge(clsx(p))}var ae=150,ye={top:"-translate-x-1/2 -translate-y-full",bottom:"-translate-x-1/2",left:"-translate-x-full -translate-y-1/2",right:"-translate-y-1/2"},ve={top:"top-full left-1/2 -translate-x-1/2",bottom:"bottom-full left-1/2 -translate-x-1/2",left:"left-full top-1/2 -translate-y-1/2",right:"right-full top-1/2 -translate-y-1/2"},we={top:"border-l-transparent border-r-transparent border-b-transparent",bottom:"border-l-transparent border-r-transparent border-t-transparent",left:"border-t-transparent border-b-transparent border-r-transparent",right:"border-t-transparent border-b-transparent border-l-transparent"},Te={top:"translate-y-1",bottom:"-translate-y-1",left:"translate-x-1",right:"-translate-x-1"},Re={sm:"px-2 py-1 text-xs rounded-md",md:"px-3 py-1.5 text-sm rounded-lg",lg:"px-4 py-2 text-sm rounded-xl"},Be={dark:["bg-gray-900 text-gray-50","shadow-[0_4px_16px_rgba(0,0,0,0.35)]","ring-1 ring-white/10"].join(" "),primary:["bg-gradient-to-b from-blue-500 to-blue-600 text-white","shadow-[0_4px_16px_rgba(59,130,246,0.45)]","ring-1 ring-blue-400/30"].join(" "),light:["bg-white text-gray-800","border border-gray-200/80","shadow-[0_4px_16px_rgba(0,0,0,0.10)]"].join(" ")},Ee={dark:{top:"border-t-gray-900",bottom:"border-b-gray-900",left:"border-l-gray-900",right:"border-r-gray-900"},primary:{top:"border-t-blue-600",bottom:"border-b-blue-500",left:"border-l-blue-600",right:"border-r-blue-500"},light:{top:"border-t-gray-200",bottom:"border-b-gray-200",left:"border-l-gray-200",right:"border-r-gray-200"}};function le({content:p,children:x,placement:t="top",trigger:n="hover",showDelay:s=0,hideDelay:d=100,size:o="md",variant:m="dark",open:H,disabled:a=false,maxWidth:z=240,className:M,wrapperClassName:V}){let[F,w]=useState(false),[L,T]=useState(false),[S,B]=useState(false),[U,de]=useState({top:0,left:0}),[E,me]=useState(t),y=H!==void 0,u=y?H:F,K=useRef(null),$=useRef(null),j=useRef(null),q=useRef(null),N=useRef(null),G=useId(),i=useCallback(()=>{j.current&&clearTimeout(j.current),q.current&&clearTimeout(q.current),N.current&&clearTimeout(N.current);},[]),Q=useCallback(()=>{if(a||y)return;i();let e=()=>{w(true);};s>0?j.current=setTimeout(e,s):e();},[a,y,i,s]),Y=useCallback(()=>{y||(i(),q.current=setTimeout(()=>{w(false);},d));},[y,i,d]),Z=useCallback(()=>{a||y||w(e=>!e);},[a,y]);useEffect(()=>{let e=null;return u&&!a?(i(),e=requestAnimationFrame(()=>{T(true),e=requestAnimationFrame(()=>{B(true);});})):(e=requestAnimationFrame(()=>{B(false);}),N.current=setTimeout(()=>{T(false);},ae)),()=>{e&&cancelAnimationFrame(e),N.current&&clearTimeout(N.current);}},[u,a,i]);let ee=useCallback(()=>{if(!K.current||!u)return;let e=K.current.getBoundingClientRect(),l=$.current,b=8,f=t,te=g=>{switch(g){case "top":return {t:e.top-b,l:e.left+e.width/2};case "bottom":return {t:e.bottom+b,l:e.left+e.width/2};case "left":return {t:e.top+e.height/2,l:e.left-b};case "right":return {t:e.top+e.height/2,l:e.right+b}}},re=te(t),I=re.t,A=re.l;if(l){let g=l.getBoundingClientRect(),h=12;if(t==="top"&&e.top-g.height-b<h?f="bottom":t==="bottom"&&e.bottom+g.height+b>window.innerHeight-h?f="top":t==="left"&&e.left-g.width-b<h?f="right":t==="right"&&e.right+g.width+b>window.innerWidth-h&&(f="left"),f!==t){let se=te(f);I=se.t,A=se.l;}let oe=g.width/2,ne=g.height/2;f==="top"||f==="bottom"?A=Math.max(h+oe,Math.min(window.innerWidth-h-oe,A)):I=Math.max(h+ne,Math.min(window.innerHeight-h-ne,I));}me(f),de({top:I,left:A});},[u,t]);useLayoutEffect(()=>{if(!u)return;let e=null,l=()=>{e=requestAnimationFrame(ee);};return l(),window.addEventListener("resize",l),window.addEventListener("scroll",l,true),()=>{e!==null&&cancelAnimationFrame(e),window.removeEventListener("resize",l),window.removeEventListener("scroll",l,true);}},[u,ee]),useEffect(()=>{if(!u)return;let e=l=>{l.key==="Escape"&&(i(),w(false));};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e);}},[u,i]),useEffect(()=>i,[i]);let v={};(n==="hover"||n==="focus")&&(v.onFocus=Q,v.onBlur=Y),n==="hover"?(v.onMouseEnter=Q,v.onMouseLeave=Y):n==="click"&&(v.onClick=Z),v.onKeyDown=e=>{(e.key==="Enter"||e.key===" ")&&Z();};let ue=x;return jsxs("span",{ref:K,className:r("relative inline-flex isolate z-0",V),"aria-describedby":u&&!a?G:void 0,...v,children:[jsx("span",{className:"relative z-0",children:ue}),L&&!a&&createPortal(jsx("div",{ref:$,className:r("pointer-events-none fixed z-[9999]",ye[E]),style:{top:U.top,left:U.left},children:jsxs("div",{id:G,role:"tooltip",style:{maxWidth:z,transitionDuration:`${ae.toString()}ms`},className:r("relative min-w-max whitespace-normal break-words","font-sans font-medium tracking-tight text-center leading-snug","transition-[opacity,transform] ease-out",S?"opacity-100 translate-x-0 translate-y-0":["opacity-0",Te[E]].join(" "),Be[m],Re[o],M),children:[jsx("div",{"aria-hidden":"true",className:r("absolute border-[6px]","drop-shadow-sm",ve[E],we[E],Ee[m][E])}),p]})}),document.body)]})}var Ce={xs:"h-6 px-2.5 text-xs",sm:"h-8 px-3 text-sm",md:"h-10 px-4 text-sm",lg:"h-11 px-6 text-base",xl:"h-12 px-8 text-lg"},Pe={xs:"w-3 h-3",sm:"w-3.5 h-3.5",md:"w-4 h-4",lg:"w-5 h-5",xl:"w-5 h-5"},ke={primary:"bg-primary text-text-inverse hover:bg-primary-hover hover:shadow-xl hover:shadow-primary/20 active:scale-95 border border-transparent shadow-md focus-visible:ring-primary/40 transition-all duration-normal",secondary:"bg-secondary text-text hover:bg-secondary-hover border border-transparent focus-visible:ring-primary/40",outline:"bg-transparent text-text border border-border hover:bg-hover hover:text-text focus-visible:ring-primary/40",ghost:"bg-transparent text-text border border-transparent hover:bg-hover hover:text-text focus-visible:ring-primary/40",danger:"bg-error text-text-inverse hover:bg-error/90 border border-transparent shadow-sm focus-visible:ring-error/40",success:"bg-success text-text-inverse hover:bg-success/90 border border-transparent shadow-sm focus-visible:ring-success/40",warning:"bg-warning text-text-inverse hover:bg-warning/90 border border-transparent shadow-sm focus-visible:ring-warning/40",info:"bg-info text-text-inverse hover:bg-info/90 border border-transparent shadow-sm focus-visible:ring-info/40"},He="opacity-50 cursor-not-allowed shadow-none",O=forwardRef(function({children:x,className:t,variant:n="primary",size:s="md",fullWidth:d=false,isLoading:o=false,loadingText:m,disabled:H=false,leftIcon:a,rightIcon:z,tooltip:M,tooltipPlacement:V="top",type:F="button",...w},L){let T=H||o,S=jsxs("div",{className:r("relative flex items-center justify-center",Pe[s]),children:[jsx("div",{className:"absolute inset-0 rounded-full border-1 border-current opacity-20 animate-ping"}),jsxs("svg",{className:"animate-spin relative z-10 w-full h-full",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",role:"status",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),jsx("path",{className:"opacity-90",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})]}),B=jsx("button",{ref:L,type:F,disabled:T,"aria-disabled":T,"aria-busy":o,className:r("relative inline-flex items-center justify-center gap-2 font-bold rounded-md transition-[background-color,border-color,color,box-shadow,transform,opacity] duration-normal focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-offset-surface",Ce[s],ke[n],d?"w-full":"",T?He:"",t),...w,children:o&&m?jsxs(Fragment,{children:[S,jsx("span",{children:m})]}):jsxs(Fragment,{children:[a&&jsx("span",{className:r("inline-flex shrink-0",o&&"invisible opacity-0"),children:a}),jsx("span",{className:r("truncate flex items-center justify-center",o&&"invisible opacity-0"),children:x}),z&&jsx("span",{className:r("inline-flex shrink-0",o&&"invisible opacity-0"),children:z}),o&&!m&&jsx("span",{className:"absolute inset-0 flex items-center justify-center",children:S})]})});return M?jsx(le,{content:M,placement:V,wrapperClassName:d?"w-full":"",children:B}):B});O.displayName="Button";var Me={xs:"w-6 h-6",sm:"w-8 h-8",md:"w-10 h-10",lg:"w-11 h-11",xl:"w-12 h-12"},W=forwardRef(({icon:p,"aria-label":x,isRound:t,className:n,size:s="md",...d},o)=>jsx(O,{ref:o,size:s,className:r("p-0 flex-shrink-0 min-w-0",Me[s],t&&"rounded-full",n),"aria-label":x,...d,children:p}));W.displayName="IconButton";var pe=({logo:p,children:x,actions:t,userSection:n,isSticky:s=true,className:d,glass:o=false,onMenuToggle:m})=>jsxs("header",{className:r("h-16 flex items-center justify-between px-6 bg-surface border-b border-border transition-all duration-normal",s&&"sticky top-0 z-index-sticky",o&&"glass",d),children:[jsxs("div",{className:"flex items-center gap-4",children:[m&&jsx(W,{icon:jsx(Bars3Icon,{className:"w-5 h-5"}),"aria-label":"Toggle Menu",variant:"ghost",size:"sm",onClick:m,className:"lg:hidden"}),p&&jsx("div",{className:"flex items-center",children:p})]}),jsx("div",{className:"flex-1 max-w-xl px-8 hidden md:block",children:x}),jsxs("div",{className:"flex items-center gap-2",children:[t&&jsx("div",{className:"flex items-center gap-1",children:t}),n&&jsx("div",{className:"flex items-center pl-2 ml-2 border-l border-border h-8",children:n})]})]});pe.displayName="Header";
|
|
2
|
+
export{pe as Header};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var react=require('react'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime');function r(...y){return tailwindMerge.twMerge(clsx.clsx(y))}var ot=150,bt={top:"-translate-x-1/2 -translate-y-full",bottom:"-translate-x-1/2",left:"-translate-x-full -translate-y-1/2",right:"-translate-y-1/2"},gt={top:"top-full left-1/2 -translate-x-1/2",bottom:"bottom-full left-1/2 -translate-x-1/2",left:"left-full top-1/2 -translate-y-1/2",right:"right-full top-1/2 -translate-y-1/2"},ht={top:"border-l-transparent border-r-transparent border-b-transparent",bottom:"border-l-transparent border-r-transparent border-t-transparent",left:"border-t-transparent border-b-transparent border-r-transparent",right:"border-t-transparent border-b-transparent border-l-transparent"},yt={top:"translate-y-1",bottom:"-translate-y-1",left:"translate-x-1",right:"-translate-x-1"},xt={sm:"px-2 py-1 text-xs rounded-md",md:"px-3 py-1.5 text-sm rounded-lg",lg:"px-4 py-2 text-sm rounded-xl"},wt={dark:["bg-gray-900 text-gray-50","shadow-[0_4px_16px_rgba(0,0,0,0.35)]","ring-1 ring-white/10"].join(" "),primary:["bg-gradient-to-b from-blue-500 to-blue-600 text-white","shadow-[0_4px_16px_rgba(59,130,246,0.45)]","ring-1 ring-blue-400/30"].join(" "),light:["bg-white text-gray-800","border border-gray-200/80","shadow-[0_4px_16px_rgba(0,0,0,0.10)]"].join(" ")},vt={dark:{top:"border-t-gray-900",bottom:"border-b-gray-900",left:"border-l-gray-900",right:"border-r-gray-900"},primary:{top:"border-t-blue-600",bottom:"border-b-blue-500",left:"border-l-blue-600",right:"border-r-blue-500"},light:{top:"border-t-gray-200",bottom:"border-b-gray-200",left:"border-l-gray-200",right:"border-r-gray-200"}};function st({content:y,children:T,placement:e="top",trigger:p="hover",showDelay:l=0,hideDelay:b=100,size:o="md",variant:x="dark",open:N,disabled:n=false,maxWidth:z=240,className:M,wrapperClassName:H}){let[V,w]=react.useState(false),[F,v]=react.useState(false),[S,R]=react.useState(false),[D,it]=react.useState({top:0,left:0}),[B,lt]=react.useState(e),g=N!==void 0,c=g?N:V,L=react.useRef(null),U=react.useRef(null),K=react.useRef(null),j=react.useRef(null),E=react.useRef(null),X=react.useId(),s=react.useCallback(()=>{K.current&&clearTimeout(K.current),j.current&&clearTimeout(j.current),E.current&&clearTimeout(E.current);},[]),J=react.useCallback(()=>{if(n||g)return;s();let t=()=>{w(true);};l>0?K.current=setTimeout(t,l):t();},[n,g,s,l]),$=react.useCallback(()=>{g||(s(),j.current=setTimeout(()=>{w(false);},b));},[g,s,b]),G=react.useCallback(()=>{n||g||w(t=>!t);},[n,g]);react.useEffect(()=>{let t=null;return c&&!n?(s(),t=requestAnimationFrame(()=>{v(true),t=requestAnimationFrame(()=>{R(true);});})):(t=requestAnimationFrame(()=>{R(false);}),E.current=setTimeout(()=>{v(false);},ot)),()=>{t&&cancelAnimationFrame(t),E.current&&clearTimeout(E.current);}},[c,n,s]);let Q=react.useCallback(()=>{if(!L.current||!c)return;let t=L.current.getBoundingClientRect(),a=U.current,d=8,u=e,Y=m=>{switch(m){case "top":return {t:t.top-d,l:t.left+t.width/2};case "bottom":return {t:t.bottom+d,l:t.left+t.width/2};case "left":return {t:t.top+t.height/2,l:t.left-d};case "right":return {t:t.top+t.height/2,l:t.right+d}}},Z=Y(e),I=Z.t,A=Z.l;if(a){let m=a.getBoundingClientRect(),f=12;if(e==="top"&&t.top-m.height-d<f?u="bottom":e==="bottom"&&t.bottom+m.height+d>window.innerHeight-f?u="top":e==="left"&&t.left-m.width-d<f?u="right":e==="right"&&t.right+m.width+d>window.innerWidth-f&&(u="left"),u!==e){let rt=Y(u);I=rt.t,A=rt.l;}let tt=m.width/2,et=m.height/2;u==="top"||u==="bottom"?A=Math.max(f+tt,Math.min(window.innerWidth-f-tt,A)):I=Math.max(f+et,Math.min(window.innerHeight-f-et,I));}lt(u),it({top:I,left:A});},[c,e]);react.useLayoutEffect(()=>{if(!c)return;let t=null,a=()=>{t=requestAnimationFrame(Q);};return a(),window.addEventListener("resize",a),window.addEventListener("scroll",a,true),()=>{t!==null&&cancelAnimationFrame(t),window.removeEventListener("resize",a),window.removeEventListener("scroll",a,true);}},[c,Q]),react.useEffect(()=>{if(!c)return;let t=a=>{a.key==="Escape"&&(s(),w(false));};return document.addEventListener("keydown",t),()=>{document.removeEventListener("keydown",t);}},[c,s]),react.useEffect(()=>s,[s]);let h={};(p==="hover"||p==="focus")&&(h.onFocus=J,h.onBlur=$),p==="hover"?(h.onMouseEnter=J,h.onMouseLeave=$):p==="click"&&(h.onClick=G),h.onKeyDown=t=>{(t.key==="Enter"||t.key===" ")&&G();};let ct=T;return jsxRuntime.jsxs("span",{ref:L,className:r("relative inline-flex isolate z-0",H),"aria-describedby":c&&!n?X:void 0,...h,children:[jsxRuntime.jsx("span",{className:"relative z-0",children:ct}),F&&!n&&reactDom.createPortal(jsxRuntime.jsx("div",{ref:U,className:r("pointer-events-none fixed z-[9999]",bt[B]),style:{top:D.top,left:D.left},children:jsxRuntime.jsxs("div",{id:X,role:"tooltip",style:{maxWidth:z,transitionDuration:`${ot.toString()}ms`},className:r("relative min-w-max whitespace-normal break-words","font-sans font-medium tracking-tight text-center leading-snug","transition-[opacity,transform] ease-out",S?"opacity-100 translate-x-0 translate-y-0":["opacity-0",yt[B]].join(" "),wt[x],xt[o],M),children:[jsxRuntime.jsx("div",{"aria-hidden":"true",className:r("absolute border-[6px]","drop-shadow-sm",gt[B],ht[B],vt[x][B])}),y]})}),document.body)]})}var Rt={xs:"h-6 px-2.5 text-xs",sm:"h-8 px-3 text-sm",md:"h-10 px-4 text-sm",lg:"h-11 px-6 text-base",xl:"h-12 px-8 text-lg"},Bt={xs:"w-3 h-3",sm:"w-3.5 h-3.5",md:"w-4 h-4",lg:"w-5 h-5",xl:"w-5 h-5"},Et={primary:"bg-primary text-text-inverse hover:bg-primary-hover hover:shadow-xl hover:shadow-primary/20 active:scale-95 border border-transparent shadow-md focus-visible:ring-primary/40 transition-all duration-normal",secondary:"bg-secondary text-text hover:bg-secondary-hover border border-transparent focus-visible:ring-primary/40",outline:"bg-transparent text-text border border-border hover:bg-hover hover:text-text focus-visible:ring-primary/40",ghost:"bg-transparent text-text border border-transparent hover:bg-hover hover:text-text focus-visible:ring-primary/40",danger:"bg-error text-text-inverse hover:bg-error/90 border border-transparent shadow-sm focus-visible:ring-error/40",success:"bg-success text-text-inverse hover:bg-success/90 border border-transparent shadow-sm focus-visible:ring-success/40",warning:"bg-warning text-text-inverse hover:bg-warning/90 border border-transparent shadow-sm focus-visible:ring-warning/40",info:"bg-info text-text-inverse hover:bg-info/90 border border-transparent shadow-sm focus-visible:ring-info/40"},Ct="opacity-50 cursor-not-allowed shadow-none",W=react.forwardRef(function({children:T,className:e,variant:p="primary",size:l="md",fullWidth:b=false,isLoading:o=false,loadingText:x,disabled:N=false,leftIcon:n,rightIcon:z,tooltip:M,tooltipPlacement:H="top",type:V="button",...w},F){let v=N||o,S=jsxRuntime.jsxs("div",{className:r("relative flex items-center justify-center",Bt[l]),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 rounded-full border-1 border-current opacity-20 animate-ping"}),jsxRuntime.jsxs("svg",{className:"animate-spin relative z-10 w-full h-full",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",role:"status",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),jsxRuntime.jsx("path",{className:"opacity-90",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})]}),R=jsxRuntime.jsx("button",{ref:F,type:V,disabled:v,"aria-disabled":v,"aria-busy":o,className:r("relative inline-flex items-center justify-center gap-2 font-bold rounded-md transition-[background-color,border-color,color,box-shadow,transform,opacity] duration-normal focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-offset-surface",Rt[l],Et[p],b?"w-full":"",v?Ct:"",e),...w,children:o&&x?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[S,jsxRuntime.jsx("span",{children:x})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[n&&jsxRuntime.jsx("span",{className:r("inline-flex shrink-0",o&&"invisible opacity-0"),children:n}),jsxRuntime.jsx("span",{className:r("truncate flex items-center justify-center",o&&"invisible opacity-0"),children:T}),z&&jsxRuntime.jsx("span",{className:r("inline-flex shrink-0",o&&"invisible opacity-0"),children:z}),o&&!x&&jsxRuntime.jsx("span",{className:"absolute inset-0 flex items-center justify-center",children:S})]})});return M?jsxRuntime.jsx(st,{content:M,placement:H,wrapperClassName:b?"w-full":"",children:R}):R});W.displayName="Button";var kt={xs:"w-6 h-6",sm:"w-8 h-8",md:"w-10 h-10",lg:"w-11 h-11",xl:"w-12 h-12"},Nt=react.forwardRef(({icon:y,"aria-label":T,isRound:e,className:p,size:l="md",...b},o)=>jsxRuntime.jsx(W,{ref:o,size:l,className:r("p-0 flex-shrink-0 min-w-0",kt[l],e&&"rounded-full",p),"aria-label":T,...b,children:y}));Nt.displayName="IconButton";
|
|
2
|
+
exports.IconButton=Nt;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { B as ButtonProps } from '../Button.types-D-srlWFf.mjs';
|
|
3
|
+
import '../Tooltip.types-PbUasE3C.mjs';
|
|
4
|
+
|
|
5
|
+
interface IconButtonProps extends Omit<ButtonProps, 'children' | 'leftIcon' | 'rightIcon' | 'loadingText' | 'fullWidth'> {
|
|
6
|
+
/** The icon to display inside the button */
|
|
7
|
+
icon: ReactNode;
|
|
8
|
+
/** Accessible label for the icon button */
|
|
9
|
+
'aria-label': string;
|
|
10
|
+
/** Whether the button should be rounded/circular */
|
|
11
|
+
isRound?: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
declare const IconButton: React.ForwardRefExoticComponent<IconButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
15
|
+
|
|
16
|
+
export { IconButton, type IconButtonProps };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { B as ButtonProps } from '../Button.types-BsQYqZml.js';
|
|
3
|
+
import '../Tooltip.types-PbUasE3C.js';
|
|
4
|
+
|
|
5
|
+
interface IconButtonProps extends Omit<ButtonProps, 'children' | 'leftIcon' | 'rightIcon' | 'loadingText' | 'fullWidth'> {
|
|
6
|
+
/** The icon to display inside the button */
|
|
7
|
+
icon: ReactNode;
|
|
8
|
+
/** Accessible label for the icon button */
|
|
9
|
+
'aria-label': string;
|
|
10
|
+
/** Whether the button should be rounded/circular */
|
|
11
|
+
isRound?: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
declare const IconButton: React.ForwardRefExoticComponent<IconButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
15
|
+
|
|
16
|
+
export { IconButton, type IconButtonProps };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {forwardRef,useState,useRef,useId,useCallback,useEffect,useLayoutEffect}from'react';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {createPortal}from'react-dom';import {jsxs,jsx,Fragment}from'react/jsx-runtime';function r(...y){return twMerge(clsx(y))}var ot=150,bt={top:"-translate-x-1/2 -translate-y-full",bottom:"-translate-x-1/2",left:"-translate-x-full -translate-y-1/2",right:"-translate-y-1/2"},gt={top:"top-full left-1/2 -translate-x-1/2",bottom:"bottom-full left-1/2 -translate-x-1/2",left:"left-full top-1/2 -translate-y-1/2",right:"right-full top-1/2 -translate-y-1/2"},ht={top:"border-l-transparent border-r-transparent border-b-transparent",bottom:"border-l-transparent border-r-transparent border-t-transparent",left:"border-t-transparent border-b-transparent border-r-transparent",right:"border-t-transparent border-b-transparent border-l-transparent"},yt={top:"translate-y-1",bottom:"-translate-y-1",left:"translate-x-1",right:"-translate-x-1"},xt={sm:"px-2 py-1 text-xs rounded-md",md:"px-3 py-1.5 text-sm rounded-lg",lg:"px-4 py-2 text-sm rounded-xl"},wt={dark:["bg-gray-900 text-gray-50","shadow-[0_4px_16px_rgba(0,0,0,0.35)]","ring-1 ring-white/10"].join(" "),primary:["bg-gradient-to-b from-blue-500 to-blue-600 text-white","shadow-[0_4px_16px_rgba(59,130,246,0.45)]","ring-1 ring-blue-400/30"].join(" "),light:["bg-white text-gray-800","border border-gray-200/80","shadow-[0_4px_16px_rgba(0,0,0,0.10)]"].join(" ")},vt={dark:{top:"border-t-gray-900",bottom:"border-b-gray-900",left:"border-l-gray-900",right:"border-r-gray-900"},primary:{top:"border-t-blue-600",bottom:"border-b-blue-500",left:"border-l-blue-600",right:"border-r-blue-500"},light:{top:"border-t-gray-200",bottom:"border-b-gray-200",left:"border-l-gray-200",right:"border-r-gray-200"}};function st({content:y,children:T,placement:e="top",trigger:p="hover",showDelay:l=0,hideDelay:b=100,size:o="md",variant:x="dark",open:N,disabled:n=false,maxWidth:z=240,className:M,wrapperClassName:H}){let[V,w]=useState(false),[F,v]=useState(false),[S,R]=useState(false),[D,it]=useState({top:0,left:0}),[B,lt]=useState(e),g=N!==void 0,c=g?N:V,L=useRef(null),U=useRef(null),K=useRef(null),j=useRef(null),E=useRef(null),X=useId(),s=useCallback(()=>{K.current&&clearTimeout(K.current),j.current&&clearTimeout(j.current),E.current&&clearTimeout(E.current);},[]),J=useCallback(()=>{if(n||g)return;s();let t=()=>{w(true);};l>0?K.current=setTimeout(t,l):t();},[n,g,s,l]),$=useCallback(()=>{g||(s(),j.current=setTimeout(()=>{w(false);},b));},[g,s,b]),G=useCallback(()=>{n||g||w(t=>!t);},[n,g]);useEffect(()=>{let t=null;return c&&!n?(s(),t=requestAnimationFrame(()=>{v(true),t=requestAnimationFrame(()=>{R(true);});})):(t=requestAnimationFrame(()=>{R(false);}),E.current=setTimeout(()=>{v(false);},ot)),()=>{t&&cancelAnimationFrame(t),E.current&&clearTimeout(E.current);}},[c,n,s]);let Q=useCallback(()=>{if(!L.current||!c)return;let t=L.current.getBoundingClientRect(),a=U.current,d=8,u=e,Y=m=>{switch(m){case "top":return {t:t.top-d,l:t.left+t.width/2};case "bottom":return {t:t.bottom+d,l:t.left+t.width/2};case "left":return {t:t.top+t.height/2,l:t.left-d};case "right":return {t:t.top+t.height/2,l:t.right+d}}},Z=Y(e),I=Z.t,A=Z.l;if(a){let m=a.getBoundingClientRect(),f=12;if(e==="top"&&t.top-m.height-d<f?u="bottom":e==="bottom"&&t.bottom+m.height+d>window.innerHeight-f?u="top":e==="left"&&t.left-m.width-d<f?u="right":e==="right"&&t.right+m.width+d>window.innerWidth-f&&(u="left"),u!==e){let rt=Y(u);I=rt.t,A=rt.l;}let tt=m.width/2,et=m.height/2;u==="top"||u==="bottom"?A=Math.max(f+tt,Math.min(window.innerWidth-f-tt,A)):I=Math.max(f+et,Math.min(window.innerHeight-f-et,I));}lt(u),it({top:I,left:A});},[c,e]);useLayoutEffect(()=>{if(!c)return;let t=null,a=()=>{t=requestAnimationFrame(Q);};return a(),window.addEventListener("resize",a),window.addEventListener("scroll",a,true),()=>{t!==null&&cancelAnimationFrame(t),window.removeEventListener("resize",a),window.removeEventListener("scroll",a,true);}},[c,Q]),useEffect(()=>{if(!c)return;let t=a=>{a.key==="Escape"&&(s(),w(false));};return document.addEventListener("keydown",t),()=>{document.removeEventListener("keydown",t);}},[c,s]),useEffect(()=>s,[s]);let h={};(p==="hover"||p==="focus")&&(h.onFocus=J,h.onBlur=$),p==="hover"?(h.onMouseEnter=J,h.onMouseLeave=$):p==="click"&&(h.onClick=G),h.onKeyDown=t=>{(t.key==="Enter"||t.key===" ")&&G();};let ct=T;return jsxs("span",{ref:L,className:r("relative inline-flex isolate z-0",H),"aria-describedby":c&&!n?X:void 0,...h,children:[jsx("span",{className:"relative z-0",children:ct}),F&&!n&&createPortal(jsx("div",{ref:U,className:r("pointer-events-none fixed z-[9999]",bt[B]),style:{top:D.top,left:D.left},children:jsxs("div",{id:X,role:"tooltip",style:{maxWidth:z,transitionDuration:`${ot.toString()}ms`},className:r("relative min-w-max whitespace-normal break-words","font-sans font-medium tracking-tight text-center leading-snug","transition-[opacity,transform] ease-out",S?"opacity-100 translate-x-0 translate-y-0":["opacity-0",yt[B]].join(" "),wt[x],xt[o],M),children:[jsx("div",{"aria-hidden":"true",className:r("absolute border-[6px]","drop-shadow-sm",gt[B],ht[B],vt[x][B])}),y]})}),document.body)]})}var Rt={xs:"h-6 px-2.5 text-xs",sm:"h-8 px-3 text-sm",md:"h-10 px-4 text-sm",lg:"h-11 px-6 text-base",xl:"h-12 px-8 text-lg"},Bt={xs:"w-3 h-3",sm:"w-3.5 h-3.5",md:"w-4 h-4",lg:"w-5 h-5",xl:"w-5 h-5"},Et={primary:"bg-primary text-text-inverse hover:bg-primary-hover hover:shadow-xl hover:shadow-primary/20 active:scale-95 border border-transparent shadow-md focus-visible:ring-primary/40 transition-all duration-normal",secondary:"bg-secondary text-text hover:bg-secondary-hover border border-transparent focus-visible:ring-primary/40",outline:"bg-transparent text-text border border-border hover:bg-hover hover:text-text focus-visible:ring-primary/40",ghost:"bg-transparent text-text border border-transparent hover:bg-hover hover:text-text focus-visible:ring-primary/40",danger:"bg-error text-text-inverse hover:bg-error/90 border border-transparent shadow-sm focus-visible:ring-error/40",success:"bg-success text-text-inverse hover:bg-success/90 border border-transparent shadow-sm focus-visible:ring-success/40",warning:"bg-warning text-text-inverse hover:bg-warning/90 border border-transparent shadow-sm focus-visible:ring-warning/40",info:"bg-info text-text-inverse hover:bg-info/90 border border-transparent shadow-sm focus-visible:ring-info/40"},Ct="opacity-50 cursor-not-allowed shadow-none",W=forwardRef(function({children:T,className:e,variant:p="primary",size:l="md",fullWidth:b=false,isLoading:o=false,loadingText:x,disabled:N=false,leftIcon:n,rightIcon:z,tooltip:M,tooltipPlacement:H="top",type:V="button",...w},F){let v=N||o,S=jsxs("div",{className:r("relative flex items-center justify-center",Bt[l]),children:[jsx("div",{className:"absolute inset-0 rounded-full border-1 border-current opacity-20 animate-ping"}),jsxs("svg",{className:"animate-spin relative z-10 w-full h-full",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",role:"status",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),jsx("path",{className:"opacity-90",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})]}),R=jsx("button",{ref:F,type:V,disabled:v,"aria-disabled":v,"aria-busy":o,className:r("relative inline-flex items-center justify-center gap-2 font-bold rounded-md transition-[background-color,border-color,color,box-shadow,transform,opacity] duration-normal focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-offset-surface",Rt[l],Et[p],b?"w-full":"",v?Ct:"",e),...w,children:o&&x?jsxs(Fragment,{children:[S,jsx("span",{children:x})]}):jsxs(Fragment,{children:[n&&jsx("span",{className:r("inline-flex shrink-0",o&&"invisible opacity-0"),children:n}),jsx("span",{className:r("truncate flex items-center justify-center",o&&"invisible opacity-0"),children:T}),z&&jsx("span",{className:r("inline-flex shrink-0",o&&"invisible opacity-0"),children:z}),o&&!x&&jsx("span",{className:"absolute inset-0 flex items-center justify-center",children:S})]})});return M?jsx(st,{content:M,placement:H,wrapperClassName:b?"w-full":"",children:R}):R});W.displayName="Button";var kt={xs:"w-6 h-6",sm:"w-8 h-8",md:"w-10 h-10",lg:"w-11 h-11",xl:"w-12 h-12"},Nt=forwardRef(({icon:y,"aria-label":T,isRound:e,className:p,size:l="md",...b},o)=>jsx(W,{ref:o,size:l,className:r("p-0 flex-shrink-0 min-w-0",kt[l],e&&"rounded-full",p),"aria-label":T,...b,children:y}));Nt.displayName="IconButton";
|
|
2
|
+
export{Nt as IconButton};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var react=require('react'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),jsxRuntime=require('react/jsx-runtime');function l(...p){return tailwindMerge.twMerge(clsx.clsx(p))}var V={default:"animate-pulse bg-skeleton",wave:"skeleton-wave bg-skeleton",pulse:"animate-pulse bg-skeleton-shine"},_={rectangle:"rounded-sm",circle:"rounded-full",rounded:"rounded-md"},i=react.forwardRef(function({className:t,variant:r="wave",shape:o="rectangle",width:e,height:n,style:d,...a},m){return jsxRuntime.jsx("div",{ref:m,role:"status","aria-busy":"true","aria-label":"Loading",style:{width:e!==void 0?typeof e=="number"?`${String(e)}px`:e:void 0,height:n!==void 0?typeof n=="number"?`${String(n)}px`:n:void 0,...d},className:l("overflow-hidden",V[r],_[o],t),...a})});i.displayName="Skeleton";var R=react.forwardRef(function({lines:t=3,variant:r="wave",shortLast:o=true,className:e,...n},d){return jsxRuntime.jsx("div",{ref:d,className:l("flex flex-col gap-2",e),role:"status","aria-busy":"true","aria-label":"Loading",...n,children:Array.from({length:t}).map((a,m)=>{let c=m===t-1;return jsxRuntime.jsx(i,{variant:r,height:14,className:l(c&&o?"w-3/5":"w-full")},m)})})});R.displayName="SkeletonText";var $=react.forwardRef(function({size:t=40,variant:r="wave",className:o,...e},n){return jsxRuntime.jsx(i,{ref:n,variant:r,shape:"circle",width:t,height:t,className:l("shrink-0",o),...e})});$.displayName="SkeletonAvatar";var j=react.forwardRef(function({showImage:t=true,imageHeight:r=160,lines:o=3,variant:e="wave",className:n,...d},a){return jsxRuntime.jsxs("div",{ref:a,className:l("rounded-lg border border-border bg-surface overflow-hidden flex flex-col",n),role:"status","aria-busy":"true","aria-label":"Loading",...d,children:[t&&jsxRuntime.jsx(i,{variant:e,shape:"rectangle",height:r,className:"w-full rounded-none"}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2 p-4",children:[jsxRuntime.jsx(i,{variant:e,height:20,className:"w-2/3"}),jsxRuntime.jsx(R,{lines:o,variant:e,className:"mt-1"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[jsxRuntime.jsx(i,{variant:e,width:80,height:32,shape:"rounded"}),jsxRuntime.jsx(i,{variant:e,width:80,height:32,shape:"rounded"})]})]})]})});j.displayName="SkeletonCard";var z=react.forwardRef(function({rows:t=5,columns:r=4,variant:o="wave",showHeader:e=true,className:n,...d},a){return jsxRuntime.jsxs("div",{ref:a,className:l("w-full rounded-lg border border-border overflow-hidden bg-surface",n),role:"status","aria-busy":"true","aria-label":"Loading",...d,children:[e&&jsxRuntime.jsx("div",{className:"flex items-center gap-4 border-b border-border px-4 py-2 bg-surface-secondary",children:Array.from({length:r}).map((m,c)=>jsxRuntime.jsx(i,{variant:o,height:14,className:l(c===0?"w-1/4":c===r-1?"w-16":"flex-1")},c))}),Array.from({length:t}).map((m,c)=>jsxRuntime.jsx("div",{className:l("flex items-center gap-4 px-4 py-2",c<t-1&&"border-b border-border"),children:Array.from({length:r}).map((b,v)=>jsxRuntime.jsx(i,{variant:o,height:14,className:l(v===0?"w-1/4":v===r-1?"w-16":"flex-1")},v))},c))]})});z.displayName="SkeletonTable";var W=react.forwardRef(function({src:t,alt:r,fallback:o,loadingComponent:e,showSkeleton:n=true,aspectRatio:d,objectFit:a="cover",className:m,containerClassName:c,onLoad:b,onError:v,style:N,...y},L){let[w,S]=react.useState(true),[E,x]=react.useState(false),[T,P]=react.useState(t);t!==T&&(P(t),S(true),x(false));let C=u=>{S(false),b?.(u);},M=u=>{S(false),x(true),v?.(u);},A=()=>{let u=l("h-full w-full",a==="cover"&&"object-cover",a==="contain"&&"object-contain",a==="fill"&&"object-fill",a==="none"&&"object-none",a==="scale-down"&&"object-scale-down",m);return typeof o=="string"?jsxRuntime.jsx("img",{src:o,alt:r,className:u,...y}):jsxRuntime.jsx("div",{className:u,children:o??jsxRuntime.jsx("div",{className:"flex h-full w-full items-center justify-center bg-surface-secondary text-text-tertiary",children:jsxRuntime.jsx("svg",{className:"h-1/3 w-1/3 opacity-20",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})})})})},H={aspectRatio:d,...N};return jsxRuntime.jsxs("div",{className:l("relative overflow-hidden",!d&&"h-full w-full",c),style:H,children:[w&&n&&jsxRuntime.jsx("div",{className:"absolute inset-0 z-10",children:e??jsxRuntime.jsx(i,{className:"h-full w-full",variant:"wave"})}),E?A():jsxRuntime.jsx("img",{ref:L,src:t,alt:r,onLoad:C,onError:M,className:l("transition-opacity duration-500 ease-in-out",w?"opacity-0":"opacity-100",a==="cover"&&"object-cover",a==="contain"&&"object-contain",a==="fill"&&"object-fill",a==="none"&&"object-none",a==="scale-down"&&"object-scale-down","h-full w-full",m),...y})]})});W.displayName="Image";exports.Image=W;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React__default, { ImgHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
interface ImageProps extends ImgHTMLAttributes<HTMLImageElement> {
|
|
4
|
+
/**
|
|
5
|
+
* The source URL of the image.
|
|
6
|
+
*/
|
|
7
|
+
src: string;
|
|
8
|
+
/**
|
|
9
|
+
* The alt text for the image.
|
|
10
|
+
*/
|
|
11
|
+
alt: string;
|
|
12
|
+
/**
|
|
13
|
+
* Optional fallback component or image URL to show if the image fails to load.
|
|
14
|
+
*/
|
|
15
|
+
fallback?: ReactNode;
|
|
16
|
+
/**
|
|
17
|
+
* Optional component to show while the image is loading.
|
|
18
|
+
* If not provided, a default Skeleton will be used.
|
|
19
|
+
*/
|
|
20
|
+
loadingComponent?: ReactNode;
|
|
21
|
+
/**
|
|
22
|
+
* Whether to show a skeleton loader while loading.
|
|
23
|
+
* @default true
|
|
24
|
+
*/
|
|
25
|
+
showSkeleton?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* The aspect ratio of the image container.
|
|
28
|
+
* Useful to prevent layout shift.
|
|
29
|
+
* Example: '16/9', '1/1', '4/3'
|
|
30
|
+
*/
|
|
31
|
+
aspectRatio?: string;
|
|
32
|
+
/**
|
|
33
|
+
* How the image should be fitted in its container.
|
|
34
|
+
* @default 'cover'
|
|
35
|
+
*/
|
|
36
|
+
objectFit?: 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';
|
|
37
|
+
/**
|
|
38
|
+
* Container className.
|
|
39
|
+
*/
|
|
40
|
+
containerClassName?: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* A robust Image component with built-in loading states and error handling.
|
|
45
|
+
*/
|
|
46
|
+
declare const Image: React__default.ForwardRefExoticComponent<ImageProps & React__default.RefAttributes<HTMLImageElement>>;
|
|
47
|
+
|
|
48
|
+
export { Image, type ImageProps };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React__default, { ImgHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
interface ImageProps extends ImgHTMLAttributes<HTMLImageElement> {
|
|
4
|
+
/**
|
|
5
|
+
* The source URL of the image.
|
|
6
|
+
*/
|
|
7
|
+
src: string;
|
|
8
|
+
/**
|
|
9
|
+
* The alt text for the image.
|
|
10
|
+
*/
|
|
11
|
+
alt: string;
|
|
12
|
+
/**
|
|
13
|
+
* Optional fallback component or image URL to show if the image fails to load.
|
|
14
|
+
*/
|
|
15
|
+
fallback?: ReactNode;
|
|
16
|
+
/**
|
|
17
|
+
* Optional component to show while the image is loading.
|
|
18
|
+
* If not provided, a default Skeleton will be used.
|
|
19
|
+
*/
|
|
20
|
+
loadingComponent?: ReactNode;
|
|
21
|
+
/**
|
|
22
|
+
* Whether to show a skeleton loader while loading.
|
|
23
|
+
* @default true
|
|
24
|
+
*/
|
|
25
|
+
showSkeleton?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* The aspect ratio of the image container.
|
|
28
|
+
* Useful to prevent layout shift.
|
|
29
|
+
* Example: '16/9', '1/1', '4/3'
|
|
30
|
+
*/
|
|
31
|
+
aspectRatio?: string;
|
|
32
|
+
/**
|
|
33
|
+
* How the image should be fitted in its container.
|
|
34
|
+
* @default 'cover'
|
|
35
|
+
*/
|
|
36
|
+
objectFit?: 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';
|
|
37
|
+
/**
|
|
38
|
+
* Container className.
|
|
39
|
+
*/
|
|
40
|
+
containerClassName?: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* A robust Image component with built-in loading states and error handling.
|
|
45
|
+
*/
|
|
46
|
+
declare const Image: React__default.ForwardRefExoticComponent<ImageProps & React__default.RefAttributes<HTMLImageElement>>;
|
|
47
|
+
|
|
48
|
+
export { Image, type ImageProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {forwardRef,useState}from'react';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {jsx,jsxs}from'react/jsx-runtime';function l(...p){return twMerge(clsx(p))}var V={default:"animate-pulse bg-skeleton",wave:"skeleton-wave bg-skeleton",pulse:"animate-pulse bg-skeleton-shine"},_={rectangle:"rounded-sm",circle:"rounded-full",rounded:"rounded-md"},i=forwardRef(function({className:t,variant:r="wave",shape:o="rectangle",width:e,height:n,style:d,...a},m){return jsx("div",{ref:m,role:"status","aria-busy":"true","aria-label":"Loading",style:{width:e!==void 0?typeof e=="number"?`${String(e)}px`:e:void 0,height:n!==void 0?typeof n=="number"?`${String(n)}px`:n:void 0,...d},className:l("overflow-hidden",V[r],_[o],t),...a})});i.displayName="Skeleton";var R=forwardRef(function({lines:t=3,variant:r="wave",shortLast:o=true,className:e,...n},d){return jsx("div",{ref:d,className:l("flex flex-col gap-2",e),role:"status","aria-busy":"true","aria-label":"Loading",...n,children:Array.from({length:t}).map((a,m)=>{let c=m===t-1;return jsx(i,{variant:r,height:14,className:l(c&&o?"w-3/5":"w-full")},m)})})});R.displayName="SkeletonText";var $=forwardRef(function({size:t=40,variant:r="wave",className:o,...e},n){return jsx(i,{ref:n,variant:r,shape:"circle",width:t,height:t,className:l("shrink-0",o),...e})});$.displayName="SkeletonAvatar";var j=forwardRef(function({showImage:t=true,imageHeight:r=160,lines:o=3,variant:e="wave",className:n,...d},a){return jsxs("div",{ref:a,className:l("rounded-lg border border-border bg-surface overflow-hidden flex flex-col",n),role:"status","aria-busy":"true","aria-label":"Loading",...d,children:[t&&jsx(i,{variant:e,shape:"rectangle",height:r,className:"w-full rounded-none"}),jsxs("div",{className:"flex flex-col gap-2 p-4",children:[jsx(i,{variant:e,height:20,className:"w-2/3"}),jsx(R,{lines:o,variant:e,className:"mt-1"}),jsxs("div",{className:"flex items-center gap-2 mt-2",children:[jsx(i,{variant:e,width:80,height:32,shape:"rounded"}),jsx(i,{variant:e,width:80,height:32,shape:"rounded"})]})]})]})});j.displayName="SkeletonCard";var z=forwardRef(function({rows:t=5,columns:r=4,variant:o="wave",showHeader:e=true,className:n,...d},a){return jsxs("div",{ref:a,className:l("w-full rounded-lg border border-border overflow-hidden bg-surface",n),role:"status","aria-busy":"true","aria-label":"Loading",...d,children:[e&&jsx("div",{className:"flex items-center gap-4 border-b border-border px-4 py-2 bg-surface-secondary",children:Array.from({length:r}).map((m,c)=>jsx(i,{variant:o,height:14,className:l(c===0?"w-1/4":c===r-1?"w-16":"flex-1")},c))}),Array.from({length:t}).map((m,c)=>jsx("div",{className:l("flex items-center gap-4 px-4 py-2",c<t-1&&"border-b border-border"),children:Array.from({length:r}).map((b,v)=>jsx(i,{variant:o,height:14,className:l(v===0?"w-1/4":v===r-1?"w-16":"flex-1")},v))},c))]})});z.displayName="SkeletonTable";var W=forwardRef(function({src:t,alt:r,fallback:o,loadingComponent:e,showSkeleton:n=true,aspectRatio:d,objectFit:a="cover",className:m,containerClassName:c,onLoad:b,onError:v,style:N,...y},L){let[w,S]=useState(true),[E,x]=useState(false),[T,P]=useState(t);t!==T&&(P(t),S(true),x(false));let C=u=>{S(false),b?.(u);},M=u=>{S(false),x(true),v?.(u);},A=()=>{let u=l("h-full w-full",a==="cover"&&"object-cover",a==="contain"&&"object-contain",a==="fill"&&"object-fill",a==="none"&&"object-none",a==="scale-down"&&"object-scale-down",m);return typeof o=="string"?jsx("img",{src:o,alt:r,className:u,...y}):jsx("div",{className:u,children:o??jsx("div",{className:"flex h-full w-full items-center justify-center bg-surface-secondary text-text-tertiary",children:jsx("svg",{className:"h-1/3 w-1/3 opacity-20",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})})})})},H={aspectRatio:d,...N};return jsxs("div",{className:l("relative overflow-hidden",!d&&"h-full w-full",c),style:H,children:[w&&n&&jsx("div",{className:"absolute inset-0 z-10",children:e??jsx(i,{className:"h-full w-full",variant:"wave"})}),E?A():jsx("img",{ref:L,src:t,alt:r,onLoad:C,onError:M,className:l("transition-opacity duration-500 ease-in-out",w?"opacity-0":"opacity-100",a==="cover"&&"object-cover",a==="contain"&&"object-contain",a==="fill"&&"object-fill",a==="none"&&"object-none",a==="scale-down"&&"object-scale-down","h-full w-full",m),...y})]})});W.displayName="Image";export{W as Image};
|