@pixpilot/shadcn-ui 0.0.1 → 0.0.3

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.
@@ -85,13 +85,6 @@ interface CommandOptionListItem {
85
85
  value: string;
86
86
  label: string;
87
87
  }
88
- interface CommandOptionListProps {
89
- emptyText?: string;
90
- options: CommandOptionListItem[];
91
- value?: unknown;
92
- onChange?: (value: any) => void;
93
- }
94
- declare const CommandOptionList: React.FC<CommandOptionListProps>;
95
88
  //#endregion
96
89
  //#region src/Combobox.d.ts
97
90
  type ComboboxProps = {
@@ -325,12 +318,12 @@ interface PopoverContentProps extends React$1.ComponentProps<typeof PopoverConte
325
318
  declare const PopoverContent: React$1.FC<PopoverContentProps>;
326
319
  //#endregion
327
320
  //#region src/Select.d.ts
328
- interface Option {
321
+ interface SelectOption {
329
322
  value: string | number;
330
323
  label: string;
331
324
  }
332
325
  type BaseSelectProps = {
333
- options?: Option[];
326
+ options?: SelectOption[];
334
327
  value?: string;
335
328
  onChange?: (value: string) => void;
336
329
  placeholder?: string;
@@ -474,4 +467,4 @@ declare function toastSuccess(message: ToastMessage, duration?: number): void;
474
467
  declare function toastWarning(message: ToastMessage, duration?: number): void;
475
468
  declare function toastError(message: ToastMessage, duration?: number): void;
476
469
  //#endregion
477
- export { AbsoluteFill, Alert, AlertBaseProps, AlertProps, AlertVariant, Button, ButtonLoaderProps, ButtonProps, CloseButtonAbsolute, CloseButtonRounded, CloseButtonRoundedProps, Combobox, CommandOptionList, CommandOptionListItem, CommandOptionListProps, ConfirmationDialogProps, ContentCard, DEFAULT_ALERT_DURATION, DatePicker, DialogProvider, DialogProviderProps, FileUploadInline, FileUploadInlineProps, Loader, LoaderProps, type Option, Pagination, PaginationProps, PopoverCloseButtonProps, PopoverContent, PopoverContentProps, Select, Slider, SliderProps, Spinner, SpinnerProps, TagsInput, TagsInputProps, ThemeProvider, ThemeProviderProps, ThemeToggle, ToastMessage, cn, showConfirmDialog, toast, toastError, toastInfo, toastSuccess, toastWarning, useTheme };
470
+ export { AbsoluteFill, Alert, AlertBaseProps, AlertProps, AlertVariant, Button, ButtonLoaderProps, ButtonProps, CloseButtonAbsolute, CloseButtonRounded, CloseButtonRoundedProps, Combobox, ConfirmationDialogProps, ContentCard, DEFAULT_ALERT_DURATION, DatePicker, DialogProvider, DialogProviderProps, FileUploadInline, FileUploadInlineProps, Loader, LoaderProps, Pagination, PaginationProps, PopoverCloseButtonProps, PopoverContent, PopoverContentProps, Select, SelectOption, Slider, SliderProps, Spinner, SpinnerProps, TagsInput, TagsInputProps, ThemeProvider, ThemeProviderProps, ThemeToggle, ToastMessage, cn, showConfirmDialog, toast, toastError, toastInfo, toastSuccess, toastWarning, useTheme };
@@ -85,13 +85,6 @@ interface CommandOptionListItem {
85
85
  value: string;
86
86
  label: string;
87
87
  }
88
- interface CommandOptionListProps {
89
- emptyText?: string;
90
- options: CommandOptionListItem[];
91
- value?: unknown;
92
- onChange?: (value: any) => void;
93
- }
94
- declare const CommandOptionList: React.FC<CommandOptionListProps>;
95
88
  //#endregion
96
89
  //#region src/Combobox.d.ts
97
90
  type ComboboxProps = {
@@ -325,12 +318,12 @@ interface PopoverContentProps extends React$1.ComponentProps<typeof PopoverConte
325
318
  declare const PopoverContent: React$1.FC<PopoverContentProps>;
326
319
  //#endregion
327
320
  //#region src/Select.d.ts
328
- interface Option {
321
+ interface SelectOption {
329
322
  value: string | number;
330
323
  label: string;
331
324
  }
332
325
  type BaseSelectProps = {
333
- options?: Option[];
326
+ options?: SelectOption[];
334
327
  value?: string;
335
328
  onChange?: (value: string) => void;
336
329
  placeholder?: string;
@@ -474,4 +467,4 @@ declare function toastSuccess(message: ToastMessage, duration?: number): void;
474
467
  declare function toastWarning(message: ToastMessage, duration?: number): void;
475
468
  declare function toastError(message: ToastMessage, duration?: number): void;
476
469
  //#endregion
477
- export { AbsoluteFill, Alert, AlertBaseProps, AlertProps, AlertVariant, Button, ButtonLoaderProps, ButtonProps, CloseButtonAbsolute, CloseButtonRounded, CloseButtonRoundedProps, Combobox, CommandOptionList, CommandOptionListItem, CommandOptionListProps, ConfirmationDialogProps, ContentCard, DEFAULT_ALERT_DURATION, DatePicker, DialogProvider, DialogProviderProps, FileUploadInline, FileUploadInlineProps, Loader, LoaderProps, type Option, Pagination, PaginationProps, PopoverCloseButtonProps, PopoverContent, PopoverContentProps, Select, Slider, SliderProps, Spinner, SpinnerProps, TagsInput, TagsInputProps, ThemeProvider, ThemeProviderProps, ThemeToggle, ToastMessage, cn, showConfirmDialog, toast, toastError, toastInfo, toastSuccess, toastWarning, useTheme };
470
+ export { AbsoluteFill, Alert, AlertBaseProps, AlertProps, AlertVariant, Button, ButtonLoaderProps, ButtonProps, CloseButtonAbsolute, CloseButtonRounded, CloseButtonRoundedProps, Combobox, ConfirmationDialogProps, ContentCard, DEFAULT_ALERT_DURATION, DatePicker, DialogProvider, DialogProviderProps, FileUploadInline, FileUploadInlineProps, Loader, LoaderProps, Pagination, PaginationProps, PopoverCloseButtonProps, PopoverContent, PopoverContentProps, Select, SelectOption, Slider, SliderProps, Spinner, SpinnerProps, TagsInput, TagsInputProps, ThemeProvider, ThemeProviderProps, ThemeToggle, ToastMessage, cn, showConfirmDialog, toast, toastError, toastInfo, toastSuccess, toastWarning, useTheme };
package/dist/index.cjs CHANGED
@@ -93,4 +93,4 @@ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=
93
93
 
94
94
  If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
95
95
 
96
- For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return p.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Li=`DialogDescriptionWarning`,Ri=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Fi(Li).contentName}}.`;return p.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},zi=di,Bi=_i,Vi=yi,Hi=Si,Ui=Di,Wi=ki,Gi=ji;function Ki({...e}){return(0,m.jsx)(zi,{"data-slot":`dialog`,...e})}function qi({...e}){return(0,m.jsx)(Bi,{"data-slot":`dialog-portal`,...e})}function Ji({...e}){return(0,m.jsx)(Gi,{"data-slot":`dialog-close`,...e})}function Yi({className:e,...t}){return(0,m.jsx)(Vi,{"data-slot":`dialog-overlay`,className:G(`data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50`,e),...t})}function Xi({className:e,children:t,showCloseButton:n=!0,...r}){return(0,m.jsxs)(qi,{"data-slot":`dialog-portal`,children:[(0,m.jsx)(Yi,{}),(0,m.jsxs)(Hi,{"data-slot":`dialog-content`,className:G(`bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg`,e),...r,children:[t,n&&(0,m.jsxs)(Gi,{"data-slot":`dialog-close`,className:`ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[(0,m.jsx)(h.XIcon,{}),(0,m.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function Zi({className:e,...t}){return(0,m.jsx)(`div`,{"data-slot":`dialog-header`,className:G(`flex flex-col gap-2 text-center sm:text-left`,e),...t})}function Qi({className:e,...t}){return(0,m.jsx)(`div`,{"data-slot":`dialog-footer`,className:G(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...t})}function $i({className:e,...t}){return(0,m.jsx)(Ui,{"data-slot":`dialog-title`,className:G(`text-lg leading-none font-semibold`,e),...t})}function ea({className:e,...t}){return(0,m.jsx)(Wi,{"data-slot":`dialog-description`,className:G(`text-muted-foreground text-sm`,e),...t})}const ta=_.default.create(e=>{let{title:t=`Confirmation Dialog`}=e,n=(0,_.useModal)(),r=()=>{e.onConfirm?.(),n.resolve(!0),n.hide()},i=()=>{e.onCancel?.(),n.resolve(!1),n.hide()};return(0,m.jsx)(Ki,{open:n.visible,onOpenChange:e=>{e||i()},children:(0,m.jsxs)(Xi,{children:[(0,m.jsxs)(Zi,{children:[(0,m.jsx)($i,{children:t}),e.description!=null&&(0,m.jsx)(ea,{children:e.description})]}),(0,m.jsxs)(Qi,{children:[(0,m.jsx)(Ji,{asChild:!0,children:(0,m.jsx)(f.Button,{variant:`outline`,onClick:i,children:e.cancelText??`Cancel`})}),(0,m.jsx)(f.Button,{onClick:r,children:e.confirmText??`Confirm`})]})]})})});ta.displayName=`ConfirmationDialog`;var na=ta;async function ra(e){let t=crypto.randomUUID();return _.default.register(t,na),_.default.show(t,e)}const ia=e=>(0,m.jsx)(_.default.Provider,{children:e.children});ia.displayName=`DialogProvider`;function aa(e){let{title:t,children:n,className:r,marginBottom:i,...a}=e;return(0,m.jsx)(f.Card,{className:(0,f.cn)(`py-4 sm:py-5`,{"mb-2 sm:mb-4":i},r),...a,children:(0,m.jsxs)(f.CardContent,{className:(0,f.cn)(`px-4 sm:px-6`),children:[t!=null&&(0,m.jsx)(`h2`,{className:(0,f.cn)(`text-xl font-semibold`,`mb-1 sm:mb-2`),children:t}),n]})})}aa.displayName=`ContentBox`;function oa(e){let{value:t,onChange:n,placeholder:r=`Pick a date`,...i}=e;return(0,m.jsxs)(f.Popover,{children:[(0,m.jsx)(f.PopoverTrigger,{asChild:!0,children:(0,m.jsxs)(f.Button,{variant:`outline`,className:(0,f.cn)(`w-full justify-start text-left font-normal`,!t&&`text-muted-foreground`),children:[(0,m.jsx)(h.CalendarIcon,{className:`mr-2 h-4 w-4`}),t?t.toLocaleDateString():(0,m.jsx)(`span`,{children:r})]})}),(0,m.jsx)(f.PopoverContent,{className:`w-auto p-0`,children:(0,m.jsx)(f.Calendar,{mode:`single`,selected:t,onSelect:n,initialFocus:!0,...i})})]})}oa.displayName=`DatePicker`;function sa({value:e,onChange:t,buttonText:n=`Browse file`,showIcon:r=!0,showClear:i=!0,className:a,accept:o,disabled:s=!1,maxSize:c,maxFiles:l=2,multiple:u=!1,...d}){let g=p.useMemo(()=>e?Array.isArray(e)?e:[e]:[],[e]),_=p.useCallback(e=>{t&&t(u?e.length>0?e:null:e.length>0?e[0]:null)},[t,u]);return(0,m.jsxs)(f.FileUpload,{...d,value:g,onValueChange:_,accept:o,maxFiles:l,maxSize:c,disabled:s,multiple:u,className:(0,f.cn)(`space-y-2`,a),children:[(u||!u&&g.length===0)&&(0,m.jsxs)(`div`,{className:(0,f.cn)(`flex items-center gap-2 rounded-md border border-input bg-background px-3 `,`hover:bg-accent/50 transition-colors m-0`,s&&`cursor-not-allowed opacity-50`),children:[r&&(0,m.jsx)(h.FileIcon,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,m.jsx)(f.FileUploadTrigger,{asChild:!0,children:(0,m.jsx)(f.Button,{variant:`link`,size:`sm`,className:`h-auto py-2 px-0 text-sm text-muted-foreground hover:no-underline justify-start flex-1`,disabled:s,children:n})})]}),g.length>0&&(0,m.jsx)(f.FileUploadList,{className:`space-y-1 m-0`,children:g.map(e=>(0,m.jsxs)(f.FileUploadItem,{value:e,className:`flex items-center gap-2 rounded-md border border-input bg-background px-3 py-2 m-0`,children:[(0,m.jsx)(f.FileUploadItemMetadata,{className:`min-w-0 flex-1`}),i&&!s&&(0,m.jsx)(f.FileUploadItemDelete,{asChild:!0,children:(0,m.jsx)(f.Button,{variant:`ghost`,size:`icon`,className:`size-7 shrink-0`,"aria-label":`Remove file`,children:(0,m.jsx)(h.XIcon,{className:`h-3.5 w-3.5`})})})]},`${e.name}-${e.size}-${e.lastModified}`))})]})}const ca=0,la=e=>{let{backdrop:t=!0,placement:n=`center`,loading:r,delay:i=0}=e,[a,o]=(0,p.useReducer)((e,t)=>{switch(t.type){case`show`:return!0;case`hide`:return!1;default:return e}},!1);(0,p.useEffect)(()=>{if(r){let e=setTimeout(()=>o({type:`show`}),i);return()=>clearTimeout(e)}o({type:`hide`})},[r,i]);let s={top:`items-start pt-[50px]`,center:`items-center`,bottom:`items-end pb-[50px]`}[n];return a?(0,m.jsx)(`div`,{className:(0,f.cn)(`fixed inset-0 z-9999 flex justify-center`,s,t&&`bg-black/50`),children:(0,m.jsx)(h.Loader2,{className:`text-foreground h-10 w-10 animate-spin`})}):null},ua=({page:e,totalPages:t,onPageChange:n,maxVisiblePages:r=6,variant:i=`full`,showPageInfo:a=!1,className:o})=>{if(t<=1)return null;let s=e=>t=>{t.preventDefault(),n(t,e)},c=(()=>{let n=[];if(t<=r){for(let e=1;e<=t;e++)n.push(e);return n}let i=t,a=e<=r-1,o=e>=t-(r-2);if(a){for(let e=1;e<r;e++)n.push(e);n.push(`ellipsis-end`),n.push(i)}else if(o){n.push(1),n.push(`ellipsis-start`);for(let e=t-(r-2);e<=t;e++)n.push(e)}else{let t=r-2;n.push(1),n.push(`ellipsis-start`);let a=e-Math.floor(t/2),o=a+t-1;a=Math.max(2,a),o=Math.min(i-1,o),o-a+1<t&&(a===2?o=a+t-1:a=o-t+1);for(let e=a;e<=o;e++)n.push(e);n.push(`ellipsis-end`),n.push(i)}return n})();return i===`compact`?(0,m.jsx)(f.Pagination,{className:o,children:(0,m.jsxs)(f.PaginationContent,{children:[(0,m.jsx)(f.PaginationItem,{children:(0,m.jsx)(f.PaginationLink,{onClick:s(1),"aria-label":`Go to first page`,className:`gap-1 px-2`,children:(0,m.jsx)(h.ChevronsLeft,{className:`h-4 w-4`})})}),(0,m.jsx)(f.PaginationItem,{children:(0,m.jsx)(f.PaginationPrevious,{onClick:s(Math.max(1,e-1))})}),(0,m.jsx)(f.PaginationItem,{children:(0,m.jsxs)(`span`,{className:`flex h-9 items-center justify-center px-4 text-sm font-medium`,children:[e,`/`,t]})}),(0,m.jsx)(f.PaginationItem,{children:(0,m.jsx)(f.PaginationNext,{onClick:s(Math.min(t,e+1))})}),(0,m.jsx)(f.PaginationItem,{children:(0,m.jsx)(f.PaginationLink,{onClick:s(t),"aria-label":`Go to last page`,className:`gap-1 px-2`,children:(0,m.jsx)(h.ChevronsRight,{className:`h-4 w-4`})})})]})}):i===`simple`?(0,m.jsxs)(`div`,{className:`flex items-center justify-center gap-4 ${o??``}`,children:[a&&(0,m.jsxs)(`span`,{className:`text-sm whitespace-nowrap`,children:[`Page `,e,` of `,t]}),(0,m.jsx)(f.Pagination,{children:(0,m.jsxs)(f.PaginationContent,{children:[(0,m.jsx)(f.PaginationItem,{children:(0,m.jsx)(f.PaginationPrevious,{onClick:s(Math.max(1,e-1))})}),(0,m.jsx)(f.PaginationItem,{children:(0,m.jsx)(f.PaginationNext,{onClick:s(Math.min(t,e+1))})})]})})]}):(0,m.jsxs)(`div`,{className:`flex items-center justify-center gap-4 ${o??``}`,children:[a&&(0,m.jsxs)(`span`,{className:`text-sm whitespace-nowrap`,children:[`Page `,e,` of `,t]}),(0,m.jsx)(f.Pagination,{children:(0,m.jsxs)(f.PaginationContent,{children:[(0,m.jsx)(f.PaginationItem,{children:(0,m.jsx)(f.PaginationPrevious,{onClick:s(Math.max(1,e-1))})}),c.map(t=>typeof t==`string`?(0,m.jsx)(f.PaginationItem,{children:(0,m.jsx)(f.PaginationEllipsis,{})},t):(0,m.jsx)(f.PaginationItem,{children:(0,m.jsx)(f.PaginationLink,{onClick:s(t),isActive:t===e,children:t})},t)),(0,m.jsx)(f.PaginationItem,{children:(0,m.jsx)(f.PaginationNext,{onClick:s(Math.min(t,e+1))})})]})})]})},da=e=>(0,m.jsx)(f.PopoverContent,{...e,className:`w-auto max-w-[100vw] border-0 bg-transparent p-0 sm:max-w-[calc(100vw-2rem)]`});da.displayName=`PopoverContent`;function fa(e){let{options:t,value:n=``,onChange:r,placeholder:i,...a}=e;return(0,m.jsxs)(f.Select,{value:n,onValueChange:r,...a,children:[(0,m.jsx)(f.SelectTrigger,{className:`w-full`,children:(0,m.jsx)(f.SelectValue,{placeholder:i})}),(0,m.jsx)(f.SelectContent,{children:t?.map(e=>(0,m.jsx)(f.SelectItem,{value:String(e.value),children:e.label},e.value))})]})}const pa=e=>(0,m.jsx)(f.Slider,{...e,className:(0,f.cn)(`py-2`,e.className)});pa.displayName=`Slider`;const ma=[],ha=[];function ga({value:e=ma,onChange:t,options:n=ha,freeSolo:r=!0,placeholder:i=`Add tags...`,emptyText:a=`No options found.`,className:o,disabled:s=!1,readOnly:c=!1,maxTags:l,allowDuplicates:u=!1,editable:d=!1,label:h,delimiter:g=`,`,addOnPaste:_=!0,addOnTab:v=!0,onValidate:y}){let[b,x]=(0,p.useState)(!1),[S,C]=(0,p.useState)(``),w=(0,p.useRef)(null),T=n.length>0;(0,p.useEffect)(()=>{if(b&&w.current){let e=setTimeout(()=>{w.current?.focus()},0);return()=>{clearTimeout(e)}}},[b]);let E=(0,p.useMemo)(()=>e.map(e=>String(e)),[e]),D=(0,p.useCallback)(e=>T?n.find(t=>String(t.value)===String(e))?.label??String(e):String(e),[n,T]),O=(0,p.useMemo)(()=>T?n.filter(e=>S?e.label.toLowerCase().includes(S.toLowerCase()):!0):[],[n,S,T]),k=(0,p.useCallback)(e=>{if(C(``),T){let r=e.map(e=>n.find(t=>String(t.value)===e)?.value??e);t?.(r)}else t?.(e)},[t,n,T]),ee=(0,p.useCallback)(t=>l!==void 0&&e.length>=l||!u&&E.includes(t)||T&&!r&&!n.some(e=>String(e.value)===t)?!1:y?y(t):!0,[e,l,u,y,E,T,r,n]),A=(0,p.useCallback)(n=>{let r=e.some(e=>String(e)===String(n)),i;i=r?e.filter(e=>String(e)!==String(n)):[...e,n],t?.(i),C(``)},[e,t]);return T?(0,m.jsxs)(`div`,{className:(0,f.cn)(`relative`,o),children:[h!==void 0&&h!==``?(0,m.jsx)(f.TagsInputInLineLabel,{children:h}):null,(0,m.jsxs)(f.Popover,{open:b&&!s&&!c,onOpenChange:x,children:[(0,m.jsx)(f.PopoverTrigger,{asChild:!0,children:(0,m.jsx)(`div`,{className:`w-full`,children:(0,m.jsxs)(f.TagsInputInLineRoot,{disabled:s,editable:d,max:l,onValueChange:k,onValidate:ee,readOnly:c,value:E,delimiter:r?g:void 0,addOnPaste:r?_:!1,addOnTab:r?v:!1,children:[(0,m.jsxs)(f.TagsInputInLineList,{onClick:e=>{!s&&!c&&(e.stopPropagation(),x(!0))},children:[e.map(e=>{let t=D(e);return(0,m.jsx)(f.TagsInputInLineItem,{value:String(e),children:t},String(e))}),(0,m.jsx)(f.TagsInputInLineInput,{ref:w,placeholder:i,onFocus:e=>{e.stopPropagation(),x(!0)},onChange:e=>{e.stopPropagation(),C(e.target.value)},onKeyDown:e=>{if(b&&(e.key===`ArrowDown`||e.key===`ArrowUp`)){e.preventDefault(),e.stopPropagation();let t=document.querySelector(`[cmdk-root]`);if(t){let n=new KeyboardEvent(`keydown`,{key:e.key,bubbles:!0,cancelable:!0});t.dispatchEvent(n)}return}if(b&&e.key===`Enter`){let t=document.querySelector(`[cmdk-item][data-selected="true"]`);if(t){e.preventDefault(),e.stopPropagation(),t.click();return}}e.stopPropagation()},onMouseDown:e=>{e.stopPropagation()}})]}),e.length>0&&!s&&!c&&(0,m.jsx)(f.TagsInputInLineClear,{})]})})}),(0,m.jsx)(f.PopoverContent,{className:`p-0`,align:`start`,style:{width:`var(--radix-popover-trigger-width)`},onOpenAutoFocus:e=>{e.preventDefault()},children:(0,m.jsx)(f.Command,{shouldFilter:!1,value:S,loop:!0,children:(0,m.jsx)(kt,{options:O,value:e,onChange:A,emptyText:a})})})]})]}):(0,m.jsxs)(f.TagsInputInLineRoot,{className:o,disabled:s,editable:d,max:l,onValueChange:k,onValidate:ee,readOnly:c,value:E,delimiter:g,addOnPaste:_,addOnTab:v,children:[h!==void 0&&h!==``?(0,m.jsx)(f.TagsInputInLineLabel,{children:h}):null,(0,m.jsxs)(f.TagsInputInLineList,{children:[E.map(e=>(0,m.jsx)(f.TagsInputInLineItem,{value:e,children:e},e)),(0,m.jsx)(f.TagsInputInLineInput,{placeholder:i})]}),e.length>0&&!s&&!c&&(0,m.jsx)(f.TagsInputInLineClear,{})]})}const _a=e=>{let{children:t}=e;return(0,m.jsx)(y.ThemeProvider,{attribute:`class`,defaultTheme:`system`,enableSystem:!0,disableTransitionOnChange:!1,...e,children:t})};_a.displayName=`ThemeProvider`;function va(){return(0,m.jsx)(`svg`,{className:`h-5 w-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,children:(0,m.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z`})})}function ya(){return(0,m.jsx)(`svg`,{className:`h-5 w-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,children:(0,m.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z`})})}function ba(){return(0,m.jsx)(`svg`,{className:`h-5 w-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,children:(0,m.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z`})})}function xa(){let[e,t]=(0,p.useState)(!1),{theme:n,setTheme:r}=(0,y.useTheme)();return(0,p.useEffect)(()=>{let e=setTimeout(()=>{t(!0)},0);return()=>{clearTimeout(e)}},[]),e?(0,m.jsx)(`button`,{onClick:()=>{r(n===`light`?`dark`:n===`dark`?`system`:`light`)},className:`flex h-9 w-9 items-center justify-center rounded-md border border-gray-200 bg-white text-gray-900 transition-colors hover:bg-gray-50 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-100 dark:hover:bg-gray-800`,title:(()=>n===`light`?`Switch to Dark mode`:n===`dark`?`Switch to System mode`:`Switch to Light mode`)(),type:`button`,children:(()=>n===`light`?(0,m.jsx)(ya,{}):n===`dark`?(0,m.jsx)(ba,{}):(0,m.jsx)(va,{}))()}):(0,m.jsx)(`div`,{className:`flex h-9 w-9 items-center justify-center rounded-md border border-gray-200 dark:border-gray-700`,children:(0,m.jsx)(`div`,{className:`h-5 w-5 animate-pulse rounded bg-gray-300 dark:bg-gray-600`})})}const Sa=e=>{let{duration:t,onClose:n,...r}=e;return(0,m.jsx)(ut,{icon:!0,...r,className:(0,f.cn)(`shadow-md`,e.className,{"pr-3":n}),children:n&&(0,m.jsx)(`div`,{className:`flex items-start pt-0.5 pl-1`,children:(0,m.jsxs)(`button`,{type:`button`,className:`cursor-pointer opacity-80 transition-opacity hover:opacity-100`,onClick:n,children:[(0,m.jsx)(h.XIcon,{className:`size-4.5`}),(0,m.jsx)(`span`,{className:`sr-only`,children:`Close`})]})})})};Sa.displayName=`AlertToast`;const Ca=1e4,wa=new Map;function Ta(e){let{duration:t,...n}=e,r=`toast_${(0,b.simpleHash)(`${e.title??``}::${e.description??``}`)}`,i=wa.get(r);i?(x.toast.dismiss(i.currentId),i.counter+=1,i.currentId=`${r}_${i.counter}`):wa.set(r,{currentId:`${r}_0`,counter:0});let a=wa.get(r).currentId,o=e=>{let t=wa.get(r);t&&t.currentId===e&&wa.delete(r)};x.toast.custom(e=>(0,m.jsx)(Sa,{...n,onClose:()=>x.toast.dismiss(e)}),{duration:t??Ca,id:a,onDismiss:e=>{o(e.id)},onAutoClose(e){o(e.id)}})}function Ea(e,t,n){Ta(typeof t==`string`?{variant:e,description:t,duration:n}:{variant:e,...t,duration:n})}function Da(e,t){Ea(`info`,e,t)}function Oa(e,t){Ea(`success`,e,t)}function ka(e,t){Ea(`warning`,e,t)}function Aa(e,t){Ea(`error`,e,t)}exports.AbsoluteFill=S,exports.Alert=ut,exports.Button=Et,exports.CloseButtonAbsolute=Ot,exports.CloseButtonRounded=Dt,exports.Combobox=jt,exports.CommandOptionList=kt,exports.ContentCard=aa,exports.DEFAULT_ALERT_DURATION=Ca,exports.DatePicker=oa,exports.DialogProvider=ia,exports.FileUploadInline=sa,exports.Loader=la,exports.Pagination=ua,exports.PopoverContent=da,exports.Select=fa,exports.Slider=pa,exports.Spinner=xt,exports.TagsInput=ga,exports.ThemeProvider=_a,exports.ThemeToggle=xa,exports.cn=f.cn,exports.showConfirmDialog=ra,exports.toast=Ta,exports.toastError=Aa,exports.toastInfo=Da,exports.toastSuccess=Oa,exports.toastWarning=ka,Object.defineProperty(exports,`useTheme`,{enumerable:!0,get:function(){return y.useTheme}});
96
+ For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return p.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Li=`DialogDescriptionWarning`,Ri=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Fi(Li).contentName}}.`;return p.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},zi=di,Bi=_i,Vi=yi,Hi=Si,Ui=Di,Wi=ki,Gi=ji;function Ki({...e}){return(0,m.jsx)(zi,{"data-slot":`dialog`,...e})}function qi({...e}){return(0,m.jsx)(Bi,{"data-slot":`dialog-portal`,...e})}function Ji({...e}){return(0,m.jsx)(Gi,{"data-slot":`dialog-close`,...e})}function Yi({className:e,...t}){return(0,m.jsx)(Vi,{"data-slot":`dialog-overlay`,className:G(`data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50`,e),...t})}function Xi({className:e,children:t,showCloseButton:n=!0,...r}){return(0,m.jsxs)(qi,{"data-slot":`dialog-portal`,children:[(0,m.jsx)(Yi,{}),(0,m.jsxs)(Hi,{"data-slot":`dialog-content`,className:G(`bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg`,e),...r,children:[t,n&&(0,m.jsxs)(Gi,{"data-slot":`dialog-close`,className:`ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[(0,m.jsx)(h.XIcon,{}),(0,m.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function Zi({className:e,...t}){return(0,m.jsx)(`div`,{"data-slot":`dialog-header`,className:G(`flex flex-col gap-2 text-center sm:text-left`,e),...t})}function Qi({className:e,...t}){return(0,m.jsx)(`div`,{"data-slot":`dialog-footer`,className:G(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...t})}function $i({className:e,...t}){return(0,m.jsx)(Ui,{"data-slot":`dialog-title`,className:G(`text-lg leading-none font-semibold`,e),...t})}function ea({className:e,...t}){return(0,m.jsx)(Wi,{"data-slot":`dialog-description`,className:G(`text-muted-foreground text-sm`,e),...t})}const ta=_.default.create(e=>{let{title:t=`Confirmation Dialog`}=e,n=(0,_.useModal)(),r=()=>{e.onConfirm?.(),n.resolve(!0),n.hide()},i=()=>{e.onCancel?.(),n.resolve(!1),n.hide()};return(0,m.jsx)(Ki,{open:n.visible,onOpenChange:e=>{e||i()},children:(0,m.jsxs)(Xi,{children:[(0,m.jsxs)(Zi,{children:[(0,m.jsx)($i,{children:t}),e.description!=null&&(0,m.jsx)(ea,{children:e.description})]}),(0,m.jsxs)(Qi,{children:[(0,m.jsx)(Ji,{asChild:!0,children:(0,m.jsx)(f.Button,{variant:`outline`,onClick:i,children:e.cancelText??`Cancel`})}),(0,m.jsx)(f.Button,{onClick:r,children:e.confirmText??`Confirm`})]})]})})});ta.displayName=`ConfirmationDialog`;var na=ta;async function ra(e){let t=crypto.randomUUID();return _.default.register(t,na),_.default.show(t,e)}const ia=e=>(0,m.jsx)(_.default.Provider,{children:e.children});ia.displayName=`DialogProvider`;function aa(e){let{title:t,children:n,className:r,marginBottom:i,...a}=e;return(0,m.jsx)(f.Card,{className:(0,f.cn)(`py-4 sm:py-5`,{"mb-2 sm:mb-4":i},r),...a,children:(0,m.jsxs)(f.CardContent,{className:(0,f.cn)(`px-4 sm:px-6`),children:[t!=null&&(0,m.jsx)(`h2`,{className:(0,f.cn)(`text-xl font-semibold`,`mb-1 sm:mb-2`),children:t}),n]})})}aa.displayName=`ContentBox`;function oa(e){let{value:t,onChange:n,placeholder:r=`Pick a date`,...i}=e;return(0,m.jsxs)(f.Popover,{children:[(0,m.jsx)(f.PopoverTrigger,{asChild:!0,children:(0,m.jsxs)(f.Button,{variant:`outline`,className:(0,f.cn)(`w-full justify-start text-left font-normal`,!t&&`text-muted-foreground`),children:[(0,m.jsx)(h.CalendarIcon,{className:`mr-2 h-4 w-4`}),t?t.toLocaleDateString():(0,m.jsx)(`span`,{children:r})]})}),(0,m.jsx)(f.PopoverContent,{className:`w-auto p-0`,children:(0,m.jsx)(f.Calendar,{mode:`single`,selected:t,onSelect:n,initialFocus:!0,...i})})]})}oa.displayName=`DatePicker`;function sa({value:e,onChange:t,buttonText:n=`Browse file`,showIcon:r=!0,showClear:i=!0,className:a,accept:o,disabled:s=!1,maxSize:c,maxFiles:l=2,multiple:u=!1,...d}){let g=p.useMemo(()=>e?Array.isArray(e)?e:[e]:[],[e]),_=p.useCallback(e=>{t&&t(u?e.length>0?e:null:e.length>0?e[0]:null)},[t,u]);return(0,m.jsxs)(f.FileUpload,{...d,value:g,onValueChange:_,accept:o,maxFiles:l,maxSize:c,disabled:s,multiple:u,className:(0,f.cn)(`space-y-2`,a),children:[(u||!u&&g.length===0)&&(0,m.jsxs)(`div`,{className:(0,f.cn)(`flex items-center gap-2 rounded-md border border-input bg-background px-3 `,`hover:bg-accent/50 transition-colors m-0`,s&&`cursor-not-allowed opacity-50`),children:[r&&(0,m.jsx)(h.FileIcon,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,m.jsx)(f.FileUploadTrigger,{asChild:!0,children:(0,m.jsx)(f.Button,{variant:`link`,size:`sm`,className:`h-auto py-2 px-0 text-sm text-muted-foreground hover:no-underline justify-start flex-1`,disabled:s,children:n})})]}),g.length>0&&(0,m.jsx)(f.FileUploadList,{className:`space-y-1 m-0`,children:g.map(e=>(0,m.jsxs)(f.FileUploadItem,{value:e,className:`flex items-center gap-2 rounded-md border border-input bg-background px-3 py-2 m-0`,children:[(0,m.jsx)(f.FileUploadItemMetadata,{className:`min-w-0 flex-1`}),i&&!s&&(0,m.jsx)(f.FileUploadItemDelete,{asChild:!0,children:(0,m.jsx)(f.Button,{variant:`ghost`,size:`icon`,className:`size-7 shrink-0`,"aria-label":`Remove file`,children:(0,m.jsx)(h.XIcon,{className:`h-3.5 w-3.5`})})})]},`${e.name}-${e.size}-${e.lastModified}`))})]})}const ca=0,la=e=>{let{backdrop:t=!0,placement:n=`center`,loading:r,delay:i=0}=e,[a,o]=(0,p.useReducer)((e,t)=>{switch(t.type){case`show`:return!0;case`hide`:return!1;default:return e}},!1);(0,p.useEffect)(()=>{if(r){let e=setTimeout(()=>o({type:`show`}),i);return()=>clearTimeout(e)}o({type:`hide`})},[r,i]);let s={top:`items-start pt-[50px]`,center:`items-center`,bottom:`items-end pb-[50px]`}[n];return a?(0,m.jsx)(`div`,{className:(0,f.cn)(`fixed inset-0 z-9999 flex justify-center`,s,t&&`bg-black/50`),children:(0,m.jsx)(h.Loader2,{className:`text-foreground h-10 w-10 animate-spin`})}):null},ua=({page:e,totalPages:t,onPageChange:n,maxVisiblePages:r=6,variant:i=`full`,showPageInfo:a=!1,className:o})=>{if(t<=1)return null;let s=e=>t=>{t.preventDefault(),n(t,e)},c=(()=>{let n=[];if(t<=r){for(let e=1;e<=t;e++)n.push(e);return n}let i=t,a=e<=r-1,o=e>=t-(r-2);if(a){for(let e=1;e<r;e++)n.push(e);n.push(`ellipsis-end`),n.push(i)}else if(o){n.push(1),n.push(`ellipsis-start`);for(let e=t-(r-2);e<=t;e++)n.push(e)}else{let t=r-2;n.push(1),n.push(`ellipsis-start`);let a=e-Math.floor(t/2),o=a+t-1;a=Math.max(2,a),o=Math.min(i-1,o),o-a+1<t&&(a===2?o=a+t-1:a=o-t+1);for(let e=a;e<=o;e++)n.push(e);n.push(`ellipsis-end`),n.push(i)}return n})();return i===`compact`?(0,m.jsx)(f.Pagination,{className:o,children:(0,m.jsxs)(f.PaginationContent,{children:[(0,m.jsx)(f.PaginationItem,{children:(0,m.jsx)(f.PaginationLink,{onClick:s(1),"aria-label":`Go to first page`,className:`gap-1 px-2`,children:(0,m.jsx)(h.ChevronsLeft,{className:`h-4 w-4`})})}),(0,m.jsx)(f.PaginationItem,{children:(0,m.jsx)(f.PaginationPrevious,{onClick:s(Math.max(1,e-1))})}),(0,m.jsx)(f.PaginationItem,{children:(0,m.jsxs)(`span`,{className:`flex h-9 items-center justify-center px-4 text-sm font-medium`,children:[e,`/`,t]})}),(0,m.jsx)(f.PaginationItem,{children:(0,m.jsx)(f.PaginationNext,{onClick:s(Math.min(t,e+1))})}),(0,m.jsx)(f.PaginationItem,{children:(0,m.jsx)(f.PaginationLink,{onClick:s(t),"aria-label":`Go to last page`,className:`gap-1 px-2`,children:(0,m.jsx)(h.ChevronsRight,{className:`h-4 w-4`})})})]})}):i===`simple`?(0,m.jsxs)(`div`,{className:`flex items-center justify-center gap-4 ${o??``}`,children:[a&&(0,m.jsxs)(`span`,{className:`text-sm whitespace-nowrap`,children:[`Page `,e,` of `,t]}),(0,m.jsx)(f.Pagination,{children:(0,m.jsxs)(f.PaginationContent,{children:[(0,m.jsx)(f.PaginationItem,{children:(0,m.jsx)(f.PaginationPrevious,{onClick:s(Math.max(1,e-1))})}),(0,m.jsx)(f.PaginationItem,{children:(0,m.jsx)(f.PaginationNext,{onClick:s(Math.min(t,e+1))})})]})})]}):(0,m.jsxs)(`div`,{className:`flex items-center justify-center gap-4 ${o??``}`,children:[a&&(0,m.jsxs)(`span`,{className:`text-sm whitespace-nowrap`,children:[`Page `,e,` of `,t]}),(0,m.jsx)(f.Pagination,{children:(0,m.jsxs)(f.PaginationContent,{children:[(0,m.jsx)(f.PaginationItem,{children:(0,m.jsx)(f.PaginationPrevious,{onClick:s(Math.max(1,e-1))})}),c.map(t=>typeof t==`string`?(0,m.jsx)(f.PaginationItem,{children:(0,m.jsx)(f.PaginationEllipsis,{})},t):(0,m.jsx)(f.PaginationItem,{children:(0,m.jsx)(f.PaginationLink,{onClick:s(t),isActive:t===e,children:t})},t)),(0,m.jsx)(f.PaginationItem,{children:(0,m.jsx)(f.PaginationNext,{onClick:s(Math.min(t,e+1))})})]})})]})},da=e=>(0,m.jsx)(f.PopoverContent,{...e,className:`w-auto max-w-[100vw] border-0 bg-transparent p-0 sm:max-w-[calc(100vw-2rem)]`});da.displayName=`PopoverContent`;function fa(e){let{options:t,value:n=``,onChange:r,placeholder:i,...a}=e;return(0,m.jsxs)(f.Select,{value:n,onValueChange:r,...a,children:[(0,m.jsx)(f.SelectTrigger,{className:`w-full`,children:(0,m.jsx)(f.SelectValue,{placeholder:i})}),(0,m.jsx)(f.SelectContent,{children:t?.map(e=>(0,m.jsx)(f.SelectItem,{value:String(e.value),children:e.label},e.value))})]})}const pa=e=>(0,m.jsx)(f.Slider,{...e,className:(0,f.cn)(`py-2`,e.className)});pa.displayName=`Slider`;const ma=[],ha=[];function ga({value:e=ma,onChange:t,options:n=ha,freeSolo:r=!0,placeholder:i=`Add tags...`,emptyText:a=`No options found.`,className:o,disabled:s=!1,readOnly:c=!1,maxTags:l,allowDuplicates:u=!1,editable:d=!1,label:h,delimiter:g=`,`,addOnPaste:_=!0,addOnTab:v=!0,onValidate:y}){let[b,x]=(0,p.useState)(!1),[S,C]=(0,p.useState)(``),w=(0,p.useRef)(null),T=n.length>0;(0,p.useEffect)(()=>{if(b&&w.current){let e=setTimeout(()=>{w.current?.focus()},0);return()=>{clearTimeout(e)}}},[b]);let E=(0,p.useMemo)(()=>e.map(e=>String(e)),[e]),D=(0,p.useCallback)(e=>T?n.find(t=>String(t.value)===String(e))?.label??String(e):String(e),[n,T]),O=(0,p.useMemo)(()=>T?n.filter(e=>S?e.label.toLowerCase().includes(S.toLowerCase()):!0):[],[n,S,T]),k=(0,p.useCallback)(e=>{if(C(``),T){let r=e.map(e=>n.find(t=>String(t.value)===e)?.value??e);t?.(r)}else t?.(e)},[t,n,T]),ee=(0,p.useCallback)(t=>l!==void 0&&e.length>=l||!u&&E.includes(t)||T&&!r&&!n.some(e=>String(e.value)===t)?!1:y?y(t):!0,[e,l,u,y,E,T,r,n]),A=(0,p.useCallback)(n=>{let r=e.some(e=>String(e)===String(n)),i;i=r?e.filter(e=>String(e)!==String(n)):[...e,n],t?.(i),C(``)},[e,t]);return T?(0,m.jsxs)(`div`,{className:(0,f.cn)(`relative`,o),children:[h!==void 0&&h!==``?(0,m.jsx)(f.TagsInputInLineLabel,{children:h}):null,(0,m.jsxs)(f.Popover,{open:b&&!s&&!c,onOpenChange:x,children:[(0,m.jsx)(f.PopoverTrigger,{asChild:!0,children:(0,m.jsx)(`div`,{className:`w-full`,children:(0,m.jsxs)(f.TagsInputInLineRoot,{disabled:s,editable:d,max:l,onValueChange:k,onValidate:ee,readOnly:c,value:E,delimiter:r?g:void 0,addOnPaste:r?_:!1,addOnTab:r?v:!1,children:[(0,m.jsxs)(f.TagsInputInLineList,{onClick:e=>{!s&&!c&&(e.stopPropagation(),x(!0))},children:[e.map(e=>{let t=D(e);return(0,m.jsx)(f.TagsInputInLineItem,{value:String(e),children:t},String(e))}),(0,m.jsx)(f.TagsInputInLineInput,{ref:w,placeholder:i,onFocus:e=>{e.stopPropagation(),x(!0)},onChange:e=>{e.stopPropagation(),C(e.target.value)},onKeyDown:e=>{if(b&&(e.key===`ArrowDown`||e.key===`ArrowUp`)){e.preventDefault(),e.stopPropagation();let t=document.querySelector(`[cmdk-root]`);if(t){let n=new KeyboardEvent(`keydown`,{key:e.key,bubbles:!0,cancelable:!0});t.dispatchEvent(n)}return}if(b&&e.key===`Enter`){let t=document.querySelector(`[cmdk-item][data-selected="true"]`);if(t){e.preventDefault(),e.stopPropagation(),t.click();return}}e.stopPropagation()},onMouseDown:e=>{e.stopPropagation()}})]}),e.length>0&&!s&&!c&&(0,m.jsx)(f.TagsInputInLineClear,{})]})})}),(0,m.jsx)(f.PopoverContent,{className:`p-0`,align:`start`,style:{width:`var(--radix-popover-trigger-width)`},onOpenAutoFocus:e=>{e.preventDefault()},children:(0,m.jsx)(f.Command,{shouldFilter:!1,value:S,loop:!0,children:(0,m.jsx)(kt,{options:O,value:e,onChange:A,emptyText:a})})})]})]}):(0,m.jsxs)(f.TagsInputInLineRoot,{className:o,disabled:s,editable:d,max:l,onValueChange:k,onValidate:ee,readOnly:c,value:E,delimiter:g,addOnPaste:_,addOnTab:v,children:[h!==void 0&&h!==``?(0,m.jsx)(f.TagsInputInLineLabel,{children:h}):null,(0,m.jsxs)(f.TagsInputInLineList,{children:[E.map(e=>(0,m.jsx)(f.TagsInputInLineItem,{value:e,children:e},e)),(0,m.jsx)(f.TagsInputInLineInput,{placeholder:i})]}),e.length>0&&!s&&!c&&(0,m.jsx)(f.TagsInputInLineClear,{})]})}const _a=e=>{let{children:t}=e;return(0,m.jsx)(y.ThemeProvider,{attribute:`class`,defaultTheme:`system`,enableSystem:!0,disableTransitionOnChange:!1,...e,children:t})};_a.displayName=`ThemeProvider`;function va(){return(0,m.jsx)(`svg`,{className:`h-5 w-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,children:(0,m.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z`})})}function ya(){return(0,m.jsx)(`svg`,{className:`h-5 w-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,children:(0,m.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z`})})}function ba(){return(0,m.jsx)(`svg`,{className:`h-5 w-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,children:(0,m.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z`})})}function xa(){let[e,t]=(0,p.useState)(!1),{theme:n,setTheme:r}=(0,y.useTheme)();return(0,p.useEffect)(()=>{let e=setTimeout(()=>{t(!0)},0);return()=>{clearTimeout(e)}},[]),e?(0,m.jsx)(`button`,{onClick:()=>{r(n===`light`?`dark`:n===`dark`?`system`:`light`)},className:`flex h-9 w-9 items-center justify-center rounded-md border border-gray-200 bg-white text-gray-900 transition-colors hover:bg-gray-50 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-100 dark:hover:bg-gray-800`,title:(()=>n===`light`?`Switch to Dark mode`:n===`dark`?`Switch to System mode`:`Switch to Light mode`)(),type:`button`,children:(()=>n===`light`?(0,m.jsx)(ya,{}):n===`dark`?(0,m.jsx)(ba,{}):(0,m.jsx)(va,{}))()}):(0,m.jsx)(`div`,{className:`flex h-9 w-9 items-center justify-center rounded-md border border-gray-200 dark:border-gray-700`,children:(0,m.jsx)(`div`,{className:`h-5 w-5 animate-pulse rounded bg-gray-300 dark:bg-gray-600`})})}const Sa=e=>{let{duration:t,onClose:n,...r}=e;return(0,m.jsx)(ut,{icon:!0,...r,className:(0,f.cn)(`shadow-md`,e.className,{"pr-3":n}),children:n&&(0,m.jsx)(`div`,{className:`flex items-start pt-0.5 pl-1`,children:(0,m.jsxs)(`button`,{type:`button`,className:`cursor-pointer opacity-80 transition-opacity hover:opacity-100`,onClick:n,children:[(0,m.jsx)(h.XIcon,{className:`size-4.5`}),(0,m.jsx)(`span`,{className:`sr-only`,children:`Close`})]})})})};Sa.displayName=`AlertToast`;const Ca=1e4,wa=new Map;function Ta(e){let{duration:t,...n}=e,r=`toast_${(0,b.simpleHash)(`${e.title??``}::${e.description??``}`)}`,i=wa.get(r);i?(x.toast.dismiss(i.currentId),i.counter+=1,i.currentId=`${r}_${i.counter}`):wa.set(r,{currentId:`${r}_0`,counter:0});let a=wa.get(r).currentId,o=e=>{let t=wa.get(r);t&&t.currentId===e&&wa.delete(r)};x.toast.custom(e=>(0,m.jsx)(Sa,{...n,onClose:()=>x.toast.dismiss(e)}),{duration:t??Ca,id:a,onDismiss:e=>{o(e.id)},onAutoClose(e){o(e.id)}})}function Ea(e,t,n){Ta(typeof t==`string`?{variant:e,description:t,duration:n}:{variant:e,...t,duration:n})}function Da(e,t){Ea(`info`,e,t)}function Oa(e,t){Ea(`success`,e,t)}function ka(e,t){Ea(`warning`,e,t)}function Aa(e,t){Ea(`error`,e,t)}exports.AbsoluteFill=S,exports.Alert=ut,exports.Button=Et,exports.CloseButtonAbsolute=Ot,exports.CloseButtonRounded=Dt,exports.Combobox=jt,exports.ContentCard=aa,exports.DEFAULT_ALERT_DURATION=Ca,exports.DatePicker=oa,exports.DialogProvider=ia,exports.FileUploadInline=sa,exports.Loader=la,exports.Pagination=ua,exports.PopoverContent=da,exports.Select=fa,exports.Slider=pa,exports.Spinner=xt,exports.TagsInput=ga,exports.ThemeProvider=_a,exports.ThemeToggle=xa,exports.cn=f.cn,exports.showConfirmDialog=ra,exports.toast=Ta,exports.toastError=Aa,exports.toastInfo=Da,exports.toastSuccess=Oa,exports.toastWarning=ka,Object.defineProperty(exports,`useTheme`,{enumerable:!0,get:function(){return y.useTheme}});
package/dist/index.js CHANGED
@@ -93,4 +93,4 @@ import{createRequire as e}from"node:module";import{Button as t,Calendar as n,Car
93
93
 
94
94
  If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
95
95
 
96
- For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return I.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Ma=`DialogDescriptionWarning`,Na=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Aa(Ma).contentName}}.`;return I.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},Pa=aa,Fa=da,Ia=pa,La=_a,Ra=Sa,za=wa,Ba=Ea;function Va({...e}){return R(Pa,{"data-slot":`dialog`,...e})}function Ha({...e}){return R(Fa,{"data-slot":`dialog-portal`,...e})}function Ua({...e}){return R(Ba,{"data-slot":`dialog-close`,...e})}function Wa({className:e,...t}){return R(Ia,{"data-slot":`dialog-overlay`,className:Y(`data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50`,e),...t})}function Ga({className:e,children:t,showCloseButton:n=!0,...r}){return z(Ha,{"data-slot":`dialog-portal`,children:[R(Wa,{}),z(La,{"data-slot":`dialog-content`,className:Y(`bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg`,e),...r,children:[t,n&&z(Ba,{"data-slot":`dialog-close`,className:`ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[R(Ee,{}),R(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function Ka({className:e,...t}){return R(`div`,{"data-slot":`dialog-header`,className:Y(`flex flex-col gap-2 text-center sm:text-left`,e),...t})}function qa({className:e,...t}){return R(`div`,{"data-slot":`dialog-footer`,className:Y(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...t})}function Ja({className:e,...t}){return R(Ra,{"data-slot":`dialog-title`,className:Y(`text-lg leading-none font-semibold`,e),...t})}function Ya({className:e,...t}){return R(za,{"data-slot":`dialog-description`,className:Y(`text-muted-foreground text-sm`,e),...t})}const Xa=Oe.create(e=>{let{title:n=`Confirmation Dialog`}=e,r=ke(),i=()=>{e.onConfirm?.(),r.resolve(!0),r.hide()},a=()=>{e.onCancel?.(),r.resolve(!1),r.hide()};return R(Va,{open:r.visible,onOpenChange:e=>{e||a()},children:z(Ga,{children:[z(Ka,{children:[R(Ja,{children:n}),e.description!=null&&R(Ya,{children:e.description})]}),z(qa,{children:[R(Ua,{asChild:!0,children:R(t,{variant:`outline`,onClick:a,children:e.cancelText??`Cancel`})}),R(t,{onClick:i,children:e.confirmText??`Confirm`})]})]})})});Xa.displayName=`ConfirmationDialog`;var Za=Xa;async function Qa(e){let t=crypto.randomUUID();return Oe.register(t,Za),Oe.show(t,e)}const $a=e=>R(Oe.Provider,{children:e.children});$a.displayName=`DialogProvider`;function eo(e){let{title:t,children:n,className:a,marginBottom:o,...s}=e;return R(r,{className:F(`py-4 sm:py-5`,{"mb-2 sm:mb-4":o},a),...s,children:z(i,{className:F(`px-4 sm:px-6`),children:[t!=null&&R(`h2`,{className:F(`text-xl font-semibold`,`mb-1 sm:mb-2`),children:t}),n]})})}eo.displayName=`ContentBox`;function to(e){let{value:r,onChange:i,placeholder:a=`Pick a date`,...o}=e;return z(w,{children:[R(E,{asChild:!0,children:z(t,{variant:`outline`,className:F(`w-full justify-start text-left font-normal`,!r&&`text-muted-foreground`),children:[R(he,{className:`mr-2 h-4 w-4`}),r?r.toLocaleDateString():R(`span`,{children:a})]})}),R(T,{className:`w-auto p-0`,children:R(n,{mode:`single`,selected:r,onSelect:i,initialFocus:!0,...o})})]})}to.displayName=`DatePicker`;function no({value:e,onChange:n,buttonText:r=`Browse file`,showIcon:i=!0,showClear:a=!0,className:o,accept:s,disabled:c=!1,maxSize:l,maxFiles:u=2,multiple:_=!1,...v}){let y=I.useMemo(()=>e?Array.isArray(e)?e:[e]:[],[e]),b=I.useCallback(e=>{n&&n(_?e.length>0?e:null:e.length>0?e[0]:null)},[n,_]);return z(d,{...v,value:y,onValueChange:b,accept:s,maxFiles:u,maxSize:l,disabled:c,multiple:_,className:F(`space-y-2`,o),children:[(_||!_&&y.length===0)&&z(`div`,{className:F(`flex items-center gap-2 rounded-md border border-input bg-background px-3 `,`hover:bg-accent/50 transition-colors m-0`,c&&`cursor-not-allowed opacity-50`),children:[i&&R(Se,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),R(g,{asChild:!0,children:R(t,{variant:`link`,size:`sm`,className:`h-auto py-2 px-0 text-sm text-muted-foreground hover:no-underline justify-start flex-1`,disabled:c,children:r})})]}),y.length>0&&R(h,{className:`space-y-1 m-0`,children:y.map(e=>z(f,{value:e,className:`flex items-center gap-2 rounded-md border border-input bg-background px-3 py-2 m-0`,children:[R(m,{className:`min-w-0 flex-1`}),a&&!c&&R(p,{asChild:!0,children:R(t,{variant:`ghost`,size:`icon`,className:`size-7 shrink-0`,"aria-label":`Remove file`,children:R(Ee,{className:`h-3.5 w-3.5`})})})]},`${e.name}-${e.size}-${e.lastModified}`))})]})}const ro=e=>{let{backdrop:t=!0,placement:n=`center`,loading:r,delay:i=0}=e,[a,o]=de((e,t)=>{switch(t.type){case`show`:return!0;case`hide`:return!1;default:return e}},!1);le(()=>{if(r){let e=setTimeout(()=>o({type:`show`}),i);return()=>clearTimeout(e)}o({type:`hide`})},[r,i]);let s={top:`items-start pt-[50px]`,center:`items-center`,bottom:`items-end pb-[50px]`}[n];return a?R(`div`,{className:F(`fixed inset-0 z-9999 flex justify-center`,s,t&&`bg-black/50`),children:R(Ce,{className:`text-foreground h-10 w-10 animate-spin`})}):null},io=({page:e,totalPages:t,onPageChange:n,maxVisiblePages:r=6,variant:i=`full`,showPageInfo:a=!1,className:o})=>{if(t<=1)return null;let s=e=>t=>{t.preventDefault(),n(t,e)},c=(()=>{let n=[];if(t<=r){for(let e=1;e<=t;e++)n.push(e);return n}let i=t,a=e<=r-1,o=e>=t-(r-2);if(a){for(let e=1;e<r;e++)n.push(e);n.push(`ellipsis-end`),n.push(i)}else if(o){n.push(1),n.push(`ellipsis-start`);for(let e=t-(r-2);e<=t;e++)n.push(e)}else{let t=r-2;n.push(1),n.push(`ellipsis-start`);let a=e-Math.floor(t/2),o=a+t-1;a=Math.max(2,a),o=Math.min(i-1,o),o-a+1<t&&(a===2?o=a+t-1:a=o-t+1);for(let e=a;e<=o;e++)n.push(e);n.push(`ellipsis-end`),n.push(i)}return n})();return i===`compact`?R(_,{className:o,children:z(v,{children:[R(b,{children:R(x,{onClick:s(1),"aria-label":`Go to first page`,className:`gap-1 px-2`,children:R(_e,{className:`h-4 w-4`})})}),R(b,{children:R(C,{onClick:s(Math.max(1,e-1))})}),R(b,{children:z(`span`,{className:`flex h-9 items-center justify-center px-4 text-sm font-medium`,children:[e,`/`,t]})}),R(b,{children:R(S,{onClick:s(Math.min(t,e+1))})}),R(b,{children:R(x,{onClick:s(t),"aria-label":`Go to last page`,className:`gap-1 px-2`,children:R(ve,{className:`h-4 w-4`})})})]})}):i===`simple`?z(`div`,{className:`flex items-center justify-center gap-4 ${o??``}`,children:[a&&z(`span`,{className:`text-sm whitespace-nowrap`,children:[`Page `,e,` of `,t]}),R(_,{children:z(v,{children:[R(b,{children:R(C,{onClick:s(Math.max(1,e-1))})}),R(b,{children:R(S,{onClick:s(Math.min(t,e+1))})})]})})]}):z(`div`,{className:`flex items-center justify-center gap-4 ${o??``}`,children:[a&&z(`span`,{className:`text-sm whitespace-nowrap`,children:[`Page `,e,` of `,t]}),R(_,{children:z(v,{children:[R(b,{children:R(C,{onClick:s(Math.max(1,e-1))})}),c.map(t=>typeof t==`string`?R(b,{children:R(y,{})},t):R(b,{children:R(x,{onClick:s(t),isActive:t===e,children:t})},t)),R(b,{children:R(S,{onClick:s(Math.min(t,e+1))})})]})})]})},ao=e=>R(T,{...e,className:`w-auto max-w-[100vw] border-0 bg-transparent p-0 sm:max-w-[calc(100vw-2rem)]`});ao.displayName=`PopoverContent`;function oo(e){let{options:t,value:n=``,onChange:r,placeholder:i,...a}=e;return z(D,{value:n,onValueChange:r,...a,children:[R(te,{className:`w-full`,children:R(k,{placeholder:i})}),R(O,{children:t?.map(e=>R(ee,{value:String(e.value),children:e.label},e.value))})]})}const so=e=>R(A,{...e,className:F(`py-2`,e.className)});so.displayName=`Slider`;const co=[],lo=[];function uo({value:e=co,onChange:t,options:n=lo,freeSolo:r=!0,placeholder:i=`Add tags...`,emptyText:o=`No options found.`,className:s,disabled:c=!1,readOnly:l=!1,maxTags:u,allowDuplicates:d=!1,editable:f=!1,label:p,delimiter:m=`,`,addOnPaste:h=!0,addOnTab:g=!0,onValidate:_}){let[v,y]=pe(!1),[b,x]=pe(``),S=fe(null),C=n.length>0;le(()=>{if(v&&S.current){let e=setTimeout(()=>{S.current?.focus()},0);return()=>{clearTimeout(e)}}},[v]);let D=ue(()=>e.map(e=>String(e)),[e]),O=L(e=>C?n.find(t=>String(t.value)===String(e))?.label??String(e):String(e),[n,C]),ee=ue(()=>C?n.filter(e=>b?e.label.toLowerCase().includes(b.toLowerCase()):!0):[],[n,b,C]),te=L(e=>{if(x(``),C){let r=e.map(e=>n.find(t=>String(t.value)===e)?.value??e);t?.(r)}else t?.(e)},[t,n,C]),k=L(t=>u!==void 0&&e.length>=u||!d&&D.includes(t)||C&&!r&&!n.some(e=>String(e.value)===t)?!1:_?_(t):!0,[e,u,d,_,D,C,r,n]),A=L(n=>{let r=e.some(e=>String(e)===String(n)),i;i=r?e.filter(e=>String(e)!==String(n)):[...e,n],t?.(i),x(``)},[e,t]);return C?z(`div`,{className:F(`relative`,s),children:[p!==void 0&&p!==``?R(re,{children:p}):null,z(w,{open:v&&!c&&!l,onOpenChange:y,children:[R(E,{asChild:!0,children:R(`div`,{className:`w-full`,children:z(ae,{disabled:c,editable:f,max:u,onValueChange:te,onValidate:k,readOnly:l,value:D,delimiter:r?m:void 0,addOnPaste:r?h:!1,addOnTab:r?g:!1,children:[z(ie,{onClick:e=>{!c&&!l&&(e.stopPropagation(),y(!0))},children:[e.map(e=>{let t=O(e);return R(ne,{value:String(e),children:t},String(e))}),R(M,{ref:S,placeholder:i,onFocus:e=>{e.stopPropagation(),y(!0)},onChange:e=>{e.stopPropagation(),x(e.target.value)},onKeyDown:e=>{if(v&&(e.key===`ArrowDown`||e.key===`ArrowUp`)){e.preventDefault(),e.stopPropagation();let t=document.querySelector(`[cmdk-root]`);if(t){let n=new KeyboardEvent(`keydown`,{key:e.key,bubbles:!0,cancelable:!0});t.dispatchEvent(n)}return}if(v&&e.key===`Enter`){let t=document.querySelector(`[cmdk-item][data-selected="true"]`);if(t){e.preventDefault(),e.stopPropagation(),t.click();return}}e.stopPropagation()},onMouseDown:e=>{e.stopPropagation()}})]}),e.length>0&&!c&&!l&&R(j,{})]})})}),R(T,{className:`p-0`,align:`start`,style:{width:`var(--radix-popover-trigger-width)`},onOpenAutoFocus:e=>{e.preventDefault()},children:R(a,{shouldFilter:!1,value:b,loop:!0,children:R(Sn,{options:ee,value:e,onChange:A,emptyText:o})})})]})]}):z(ae,{className:s,disabled:c,editable:f,max:u,onValueChange:te,onValidate:k,readOnly:l,value:D,delimiter:m,addOnPaste:h,addOnTab:g,children:[p!==void 0&&p!==``?R(re,{children:p}):null,z(ie,{children:[D.map(e=>R(ne,{value:e,children:e},e)),R(M,{placeholder:i})]}),e.length>0&&!c&&!l&&R(j,{})]})}const fo=e=>{let{children:t}=e;return R(Me,{attribute:`class`,defaultTheme:`system`,enableSystem:!0,disableTransitionOnChange:!1,...e,children:t})};fo.displayName=`ThemeProvider`;function po(){return R(`svg`,{className:`h-5 w-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,children:R(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z`})})}function mo(){return R(`svg`,{className:`h-5 w-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,children:R(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z`})})}function ho(){return R(`svg`,{className:`h-5 w-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,children:R(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z`})})}function go(){let[e,t]=pe(!1),{theme:n,setTheme:r}=Pe();return le(()=>{let e=setTimeout(()=>{t(!0)},0);return()=>{clearTimeout(e)}},[]),e?R(`button`,{onClick:()=>{r(n===`light`?`dark`:n===`dark`?`system`:`light`)},className:`flex h-9 w-9 items-center justify-center rounded-md border border-gray-200 bg-white text-gray-900 transition-colors hover:bg-gray-50 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-100 dark:hover:bg-gray-800`,title:(()=>n===`light`?`Switch to Dark mode`:n===`dark`?`Switch to System mode`:`Switch to Light mode`)(),type:`button`,children:(()=>R(n===`light`?mo:n===`dark`?ho:po,{}))()}):R(`div`,{className:`flex h-9 w-9 items-center justify-center rounded-md border border-gray-200 dark:border-gray-700`,children:R(`div`,{className:`h-5 w-5 animate-pulse rounded bg-gray-300 dark:bg-gray-600`})})}const _o=e=>{let{duration:t,onClose:n,...r}=e;return R(pn,{icon:!0,...r,className:F(`shadow-md`,e.className,{"pr-3":n}),children:n&&R(`div`,{className:`flex items-start pt-0.5 pl-1`,children:z(`button`,{type:`button`,className:`cursor-pointer opacity-80 transition-opacity hover:opacity-100`,onClick:n,children:[R(Ee,{className:`size-4.5`}),R(`span`,{className:`sr-only`,children:`Close`})]})})})};_o.displayName=`AlertToast`;const vo=1e4,yo=new Map;function bo(e){let{duration:t,...n}=e,r=`toast_${Fe(`${e.title??``}::${e.description??``}`)}`,i=yo.get(r);i?(Ie.dismiss(i.currentId),i.counter+=1,i.currentId=`${r}_${i.counter}`):yo.set(r,{currentId:`${r}_0`,counter:0});let a=yo.get(r).currentId,o=e=>{let t=yo.get(r);t&&t.currentId===e&&yo.delete(r)};Ie.custom(e=>R(_o,{...n,onClose:()=>Ie.dismiss(e)}),{duration:t??vo,id:a,onDismiss:e=>{o(e.id)},onAutoClose(e){o(e.id)}})}function xo(e,t,n){bo(typeof t==`string`?{variant:e,description:t,duration:n}:{variant:e,...t,duration:n})}function So(e,t){xo(`info`,e,t)}function Co(e,t){xo(`success`,e,t)}function wo(e,t){xo(`warning`,e,t)}function To(e,t){xo(`error`,e,t)}export{We as AbsoluteFill,pn as Alert,yn as Button,xn as CloseButtonAbsolute,bn as CloseButtonRounded,wn as Combobox,Sn as CommandOptionList,eo as ContentCard,vo as DEFAULT_ALERT_DURATION,to as DatePicker,$a as DialogProvider,no as FileUploadInline,ro as Loader,io as Pagination,ao as PopoverContent,oo as Select,so as Slider,_n as Spinner,uo as TagsInput,fo as ThemeProvider,go as ThemeToggle,se as cn,Qa as showConfirmDialog,bo as toast,To as toastError,So as toastInfo,Co as toastSuccess,wo as toastWarning,Ne as useTheme};
96
+ For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return I.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Ma=`DialogDescriptionWarning`,Na=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Aa(Ma).contentName}}.`;return I.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},Pa=aa,Fa=da,Ia=pa,La=_a,Ra=Sa,za=wa,Ba=Ea;function Va({...e}){return R(Pa,{"data-slot":`dialog`,...e})}function Ha({...e}){return R(Fa,{"data-slot":`dialog-portal`,...e})}function Ua({...e}){return R(Ba,{"data-slot":`dialog-close`,...e})}function Wa({className:e,...t}){return R(Ia,{"data-slot":`dialog-overlay`,className:Y(`data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50`,e),...t})}function Ga({className:e,children:t,showCloseButton:n=!0,...r}){return z(Ha,{"data-slot":`dialog-portal`,children:[R(Wa,{}),z(La,{"data-slot":`dialog-content`,className:Y(`bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg`,e),...r,children:[t,n&&z(Ba,{"data-slot":`dialog-close`,className:`ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[R(Ee,{}),R(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function Ka({className:e,...t}){return R(`div`,{"data-slot":`dialog-header`,className:Y(`flex flex-col gap-2 text-center sm:text-left`,e),...t})}function qa({className:e,...t}){return R(`div`,{"data-slot":`dialog-footer`,className:Y(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...t})}function Ja({className:e,...t}){return R(Ra,{"data-slot":`dialog-title`,className:Y(`text-lg leading-none font-semibold`,e),...t})}function Ya({className:e,...t}){return R(za,{"data-slot":`dialog-description`,className:Y(`text-muted-foreground text-sm`,e),...t})}const Xa=Oe.create(e=>{let{title:n=`Confirmation Dialog`}=e,r=ke(),i=()=>{e.onConfirm?.(),r.resolve(!0),r.hide()},a=()=>{e.onCancel?.(),r.resolve(!1),r.hide()};return R(Va,{open:r.visible,onOpenChange:e=>{e||a()},children:z(Ga,{children:[z(Ka,{children:[R(Ja,{children:n}),e.description!=null&&R(Ya,{children:e.description})]}),z(qa,{children:[R(Ua,{asChild:!0,children:R(t,{variant:`outline`,onClick:a,children:e.cancelText??`Cancel`})}),R(t,{onClick:i,children:e.confirmText??`Confirm`})]})]})})});Xa.displayName=`ConfirmationDialog`;var Za=Xa;async function Qa(e){let t=crypto.randomUUID();return Oe.register(t,Za),Oe.show(t,e)}const $a=e=>R(Oe.Provider,{children:e.children});$a.displayName=`DialogProvider`;function eo(e){let{title:t,children:n,className:a,marginBottom:o,...s}=e;return R(r,{className:F(`py-4 sm:py-5`,{"mb-2 sm:mb-4":o},a),...s,children:z(i,{className:F(`px-4 sm:px-6`),children:[t!=null&&R(`h2`,{className:F(`text-xl font-semibold`,`mb-1 sm:mb-2`),children:t}),n]})})}eo.displayName=`ContentBox`;function to(e){let{value:r,onChange:i,placeholder:a=`Pick a date`,...o}=e;return z(w,{children:[R(E,{asChild:!0,children:z(t,{variant:`outline`,className:F(`w-full justify-start text-left font-normal`,!r&&`text-muted-foreground`),children:[R(he,{className:`mr-2 h-4 w-4`}),r?r.toLocaleDateString():R(`span`,{children:a})]})}),R(T,{className:`w-auto p-0`,children:R(n,{mode:`single`,selected:r,onSelect:i,initialFocus:!0,...o})})]})}to.displayName=`DatePicker`;function no({value:e,onChange:n,buttonText:r=`Browse file`,showIcon:i=!0,showClear:a=!0,className:o,accept:s,disabled:c=!1,maxSize:l,maxFiles:u=2,multiple:_=!1,...v}){let y=I.useMemo(()=>e?Array.isArray(e)?e:[e]:[],[e]),b=I.useCallback(e=>{n&&n(_?e.length>0?e:null:e.length>0?e[0]:null)},[n,_]);return z(d,{...v,value:y,onValueChange:b,accept:s,maxFiles:u,maxSize:l,disabled:c,multiple:_,className:F(`space-y-2`,o),children:[(_||!_&&y.length===0)&&z(`div`,{className:F(`flex items-center gap-2 rounded-md border border-input bg-background px-3 `,`hover:bg-accent/50 transition-colors m-0`,c&&`cursor-not-allowed opacity-50`),children:[i&&R(Se,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),R(g,{asChild:!0,children:R(t,{variant:`link`,size:`sm`,className:`h-auto py-2 px-0 text-sm text-muted-foreground hover:no-underline justify-start flex-1`,disabled:c,children:r})})]}),y.length>0&&R(h,{className:`space-y-1 m-0`,children:y.map(e=>z(f,{value:e,className:`flex items-center gap-2 rounded-md border border-input bg-background px-3 py-2 m-0`,children:[R(m,{className:`min-w-0 flex-1`}),a&&!c&&R(p,{asChild:!0,children:R(t,{variant:`ghost`,size:`icon`,className:`size-7 shrink-0`,"aria-label":`Remove file`,children:R(Ee,{className:`h-3.5 w-3.5`})})})]},`${e.name}-${e.size}-${e.lastModified}`))})]})}const ro=e=>{let{backdrop:t=!0,placement:n=`center`,loading:r,delay:i=0}=e,[a,o]=de((e,t)=>{switch(t.type){case`show`:return!0;case`hide`:return!1;default:return e}},!1);le(()=>{if(r){let e=setTimeout(()=>o({type:`show`}),i);return()=>clearTimeout(e)}o({type:`hide`})},[r,i]);let s={top:`items-start pt-[50px]`,center:`items-center`,bottom:`items-end pb-[50px]`}[n];return a?R(`div`,{className:F(`fixed inset-0 z-9999 flex justify-center`,s,t&&`bg-black/50`),children:R(Ce,{className:`text-foreground h-10 w-10 animate-spin`})}):null},io=({page:e,totalPages:t,onPageChange:n,maxVisiblePages:r=6,variant:i=`full`,showPageInfo:a=!1,className:o})=>{if(t<=1)return null;let s=e=>t=>{t.preventDefault(),n(t,e)},c=(()=>{let n=[];if(t<=r){for(let e=1;e<=t;e++)n.push(e);return n}let i=t,a=e<=r-1,o=e>=t-(r-2);if(a){for(let e=1;e<r;e++)n.push(e);n.push(`ellipsis-end`),n.push(i)}else if(o){n.push(1),n.push(`ellipsis-start`);for(let e=t-(r-2);e<=t;e++)n.push(e)}else{let t=r-2;n.push(1),n.push(`ellipsis-start`);let a=e-Math.floor(t/2),o=a+t-1;a=Math.max(2,a),o=Math.min(i-1,o),o-a+1<t&&(a===2?o=a+t-1:a=o-t+1);for(let e=a;e<=o;e++)n.push(e);n.push(`ellipsis-end`),n.push(i)}return n})();return i===`compact`?R(_,{className:o,children:z(v,{children:[R(b,{children:R(x,{onClick:s(1),"aria-label":`Go to first page`,className:`gap-1 px-2`,children:R(_e,{className:`h-4 w-4`})})}),R(b,{children:R(C,{onClick:s(Math.max(1,e-1))})}),R(b,{children:z(`span`,{className:`flex h-9 items-center justify-center px-4 text-sm font-medium`,children:[e,`/`,t]})}),R(b,{children:R(S,{onClick:s(Math.min(t,e+1))})}),R(b,{children:R(x,{onClick:s(t),"aria-label":`Go to last page`,className:`gap-1 px-2`,children:R(ve,{className:`h-4 w-4`})})})]})}):i===`simple`?z(`div`,{className:`flex items-center justify-center gap-4 ${o??``}`,children:[a&&z(`span`,{className:`text-sm whitespace-nowrap`,children:[`Page `,e,` of `,t]}),R(_,{children:z(v,{children:[R(b,{children:R(C,{onClick:s(Math.max(1,e-1))})}),R(b,{children:R(S,{onClick:s(Math.min(t,e+1))})})]})})]}):z(`div`,{className:`flex items-center justify-center gap-4 ${o??``}`,children:[a&&z(`span`,{className:`text-sm whitespace-nowrap`,children:[`Page `,e,` of `,t]}),R(_,{children:z(v,{children:[R(b,{children:R(C,{onClick:s(Math.max(1,e-1))})}),c.map(t=>typeof t==`string`?R(b,{children:R(y,{})},t):R(b,{children:R(x,{onClick:s(t),isActive:t===e,children:t})},t)),R(b,{children:R(S,{onClick:s(Math.min(t,e+1))})})]})})]})},ao=e=>R(T,{...e,className:`w-auto max-w-[100vw] border-0 bg-transparent p-0 sm:max-w-[calc(100vw-2rem)]`});ao.displayName=`PopoverContent`;function oo(e){let{options:t,value:n=``,onChange:r,placeholder:i,...a}=e;return z(D,{value:n,onValueChange:r,...a,children:[R(te,{className:`w-full`,children:R(k,{placeholder:i})}),R(O,{children:t?.map(e=>R(ee,{value:String(e.value),children:e.label},e.value))})]})}const so=e=>R(A,{...e,className:F(`py-2`,e.className)});so.displayName=`Slider`;const co=[],lo=[];function uo({value:e=co,onChange:t,options:n=lo,freeSolo:r=!0,placeholder:i=`Add tags...`,emptyText:o=`No options found.`,className:s,disabled:c=!1,readOnly:l=!1,maxTags:u,allowDuplicates:d=!1,editable:f=!1,label:p,delimiter:m=`,`,addOnPaste:h=!0,addOnTab:g=!0,onValidate:_}){let[v,y]=pe(!1),[b,x]=pe(``),S=fe(null),C=n.length>0;le(()=>{if(v&&S.current){let e=setTimeout(()=>{S.current?.focus()},0);return()=>{clearTimeout(e)}}},[v]);let D=ue(()=>e.map(e=>String(e)),[e]),O=L(e=>C?n.find(t=>String(t.value)===String(e))?.label??String(e):String(e),[n,C]),ee=ue(()=>C?n.filter(e=>b?e.label.toLowerCase().includes(b.toLowerCase()):!0):[],[n,b,C]),te=L(e=>{if(x(``),C){let r=e.map(e=>n.find(t=>String(t.value)===e)?.value??e);t?.(r)}else t?.(e)},[t,n,C]),k=L(t=>u!==void 0&&e.length>=u||!d&&D.includes(t)||C&&!r&&!n.some(e=>String(e.value)===t)?!1:_?_(t):!0,[e,u,d,_,D,C,r,n]),A=L(n=>{let r=e.some(e=>String(e)===String(n)),i;i=r?e.filter(e=>String(e)!==String(n)):[...e,n],t?.(i),x(``)},[e,t]);return C?z(`div`,{className:F(`relative`,s),children:[p!==void 0&&p!==``?R(re,{children:p}):null,z(w,{open:v&&!c&&!l,onOpenChange:y,children:[R(E,{asChild:!0,children:R(`div`,{className:`w-full`,children:z(ae,{disabled:c,editable:f,max:u,onValueChange:te,onValidate:k,readOnly:l,value:D,delimiter:r?m:void 0,addOnPaste:r?h:!1,addOnTab:r?g:!1,children:[z(ie,{onClick:e=>{!c&&!l&&(e.stopPropagation(),y(!0))},children:[e.map(e=>{let t=O(e);return R(ne,{value:String(e),children:t},String(e))}),R(M,{ref:S,placeholder:i,onFocus:e=>{e.stopPropagation(),y(!0)},onChange:e=>{e.stopPropagation(),x(e.target.value)},onKeyDown:e=>{if(v&&(e.key===`ArrowDown`||e.key===`ArrowUp`)){e.preventDefault(),e.stopPropagation();let t=document.querySelector(`[cmdk-root]`);if(t){let n=new KeyboardEvent(`keydown`,{key:e.key,bubbles:!0,cancelable:!0});t.dispatchEvent(n)}return}if(v&&e.key===`Enter`){let t=document.querySelector(`[cmdk-item][data-selected="true"]`);if(t){e.preventDefault(),e.stopPropagation(),t.click();return}}e.stopPropagation()},onMouseDown:e=>{e.stopPropagation()}})]}),e.length>0&&!c&&!l&&R(j,{})]})})}),R(T,{className:`p-0`,align:`start`,style:{width:`var(--radix-popover-trigger-width)`},onOpenAutoFocus:e=>{e.preventDefault()},children:R(a,{shouldFilter:!1,value:b,loop:!0,children:R(Sn,{options:ee,value:e,onChange:A,emptyText:o})})})]})]}):z(ae,{className:s,disabled:c,editable:f,max:u,onValueChange:te,onValidate:k,readOnly:l,value:D,delimiter:m,addOnPaste:h,addOnTab:g,children:[p!==void 0&&p!==``?R(re,{children:p}):null,z(ie,{children:[D.map(e=>R(ne,{value:e,children:e},e)),R(M,{placeholder:i})]}),e.length>0&&!c&&!l&&R(j,{})]})}const fo=e=>{let{children:t}=e;return R(Me,{attribute:`class`,defaultTheme:`system`,enableSystem:!0,disableTransitionOnChange:!1,...e,children:t})};fo.displayName=`ThemeProvider`;function po(){return R(`svg`,{className:`h-5 w-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,children:R(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z`})})}function mo(){return R(`svg`,{className:`h-5 w-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,children:R(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z`})})}function ho(){return R(`svg`,{className:`h-5 w-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,children:R(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z`})})}function go(){let[e,t]=pe(!1),{theme:n,setTheme:r}=Pe();return le(()=>{let e=setTimeout(()=>{t(!0)},0);return()=>{clearTimeout(e)}},[]),e?R(`button`,{onClick:()=>{r(n===`light`?`dark`:n===`dark`?`system`:`light`)},className:`flex h-9 w-9 items-center justify-center rounded-md border border-gray-200 bg-white text-gray-900 transition-colors hover:bg-gray-50 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-100 dark:hover:bg-gray-800`,title:(()=>n===`light`?`Switch to Dark mode`:n===`dark`?`Switch to System mode`:`Switch to Light mode`)(),type:`button`,children:(()=>R(n===`light`?mo:n===`dark`?ho:po,{}))()}):R(`div`,{className:`flex h-9 w-9 items-center justify-center rounded-md border border-gray-200 dark:border-gray-700`,children:R(`div`,{className:`h-5 w-5 animate-pulse rounded bg-gray-300 dark:bg-gray-600`})})}const _o=e=>{let{duration:t,onClose:n,...r}=e;return R(pn,{icon:!0,...r,className:F(`shadow-md`,e.className,{"pr-3":n}),children:n&&R(`div`,{className:`flex items-start pt-0.5 pl-1`,children:z(`button`,{type:`button`,className:`cursor-pointer opacity-80 transition-opacity hover:opacity-100`,onClick:n,children:[R(Ee,{className:`size-4.5`}),R(`span`,{className:`sr-only`,children:`Close`})]})})})};_o.displayName=`AlertToast`;const vo=1e4,yo=new Map;function bo(e){let{duration:t,...n}=e,r=`toast_${Fe(`${e.title??``}::${e.description??``}`)}`,i=yo.get(r);i?(Ie.dismiss(i.currentId),i.counter+=1,i.currentId=`${r}_${i.counter}`):yo.set(r,{currentId:`${r}_0`,counter:0});let a=yo.get(r).currentId,o=e=>{let t=yo.get(r);t&&t.currentId===e&&yo.delete(r)};Ie.custom(e=>R(_o,{...n,onClose:()=>Ie.dismiss(e)}),{duration:t??vo,id:a,onDismiss:e=>{o(e.id)},onAutoClose(e){o(e.id)}})}function xo(e,t,n){bo(typeof t==`string`?{variant:e,description:t,duration:n}:{variant:e,...t,duration:n})}function So(e,t){xo(`info`,e,t)}function Co(e,t){xo(`success`,e,t)}function wo(e,t){xo(`warning`,e,t)}function To(e,t){xo(`error`,e,t)}export{We as AbsoluteFill,pn as Alert,yn as Button,xn as CloseButtonAbsolute,bn as CloseButtonRounded,wn as Combobox,eo as ContentCard,vo as DEFAULT_ALERT_DURATION,to as DatePicker,$a as DialogProvider,no as FileUploadInline,ro as Loader,io as Pagination,ao as PopoverContent,oo as Select,so as Slider,_n as Spinner,uo as TagsInput,fo as ThemeProvider,go as ThemeToggle,se as cn,Qa as showConfirmDialog,bo as toast,To as toastError,So as toastInfo,Co as toastSuccess,wo as toastWarning,Ne as useTheme};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pixpilot/shadcn-ui",
3
3
  "type": "module",
4
- "version": "0.0.1",
4
+ "version": "0.0.3",
5
5
  "description": "Custom UI components and utilities built with shadcn/ui.",
6
6
  "author": "m.doaie <m.doaie@hotmail.com>",
7
7
  "license": "MIT",
@@ -35,7 +35,7 @@
35
35
  "lucide-react": "0.553.0",
36
36
  "next-themes": "0.4.6",
37
37
  "sonner": "2.0.7",
38
- "@pixpilot/shadcn": "0.1.0"
38
+ "@pixpilot/shadcn": "0.1.7"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@storybook/react": "^8.5.3",
@@ -47,10 +47,10 @@
47
47
  "tsdown": "^0.15.8",
48
48
  "typescript": "^5.9.3",
49
49
  "@internal/prettier-config": "0.0.1",
50
- "@internal/eslint-config": "0.3.0",
51
- "@internal/tsdown-config": "0.1.0",
50
+ "@internal/vitest-config": "0.1.0",
52
51
  "@internal/tsconfig": "0.1.0",
53
- "@internal/vitest-config": "0.1.0"
52
+ "@internal/eslint-config": "0.3.0",
53
+ "@internal/tsdown-config": "0.1.0"
54
54
  },
55
55
  "prettier": "@internal/prettier-config",
56
56
  "scripts": {