@pixpilot/shadcn-ui 0.0.4 → 0.0.6
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/AbsoluteFill.cjs +1 -0
- package/dist/AbsoluteFill.d.cts +18 -0
- package/dist/AbsoluteFill.d.ts +18 -0
- package/dist/AbsoluteFill.js +1 -0
- package/dist/Alert.cjs +1 -0
- package/dist/Alert.d.cts +16 -0
- package/dist/Alert.d.ts +16 -0
- package/dist/Alert.js +1 -0
- package/dist/Button.cjs +1 -0
- package/dist/Button.d.cts +47 -0
- package/dist/Button.d.ts +47 -0
- package/dist/Button.js +1 -0
- package/dist/CloseButtonAbsolute.cjs +1 -0
- package/dist/CloseButtonAbsolute.d.cts +8 -0
- package/dist/CloseButtonAbsolute.d.ts +8 -0
- package/dist/CloseButtonAbsolute.js +1 -0
- package/dist/CloseButtonRounded.cjs +1 -0
- package/dist/CloseButtonRounded.d.cts +8 -0
- package/dist/CloseButtonRounded.d.ts +8 -0
- package/dist/CloseButtonRounded.js +1 -0
- package/dist/Combobox.cjs +1 -0
- package/dist/Combobox.d.cts +16 -0
- package/dist/Combobox.d.ts +16 -0
- package/dist/Combobox.js +1 -0
- package/dist/CommandOptionList.cjs +1 -0
- package/dist/CommandOptionList.d.cts +7 -0
- package/dist/CommandOptionList.d.ts +7 -0
- package/dist/CommandOptionList.js +1 -0
- package/dist/ContentCard.cjs +1 -0
- package/dist/ContentCard.d.cts +16 -0
- package/dist/ContentCard.d.ts +16 -0
- package/dist/ContentCard.js +1 -0
- package/dist/DatePicker.cjs +1 -0
- package/dist/DatePicker.d.cts +16 -0
- package/dist/DatePicker.d.ts +16 -0
- package/dist/DatePicker.js +1 -0
- package/dist/FileUploadInline.cjs +1 -0
- package/dist/FileUploadInline.d.cts +75 -0
- package/dist/FileUploadInline.d.ts +75 -0
- package/dist/FileUploadInline.js +1 -0
- package/dist/Loader.cjs +1 -0
- package/dist/Loader.d.cts +21 -0
- package/dist/Loader.d.ts +21 -0
- package/dist/Loader.js +1 -0
- package/dist/Pagination/Pagination.cjs +1 -0
- package/dist/Pagination/Pagination.d.cts +88 -0
- package/dist/Pagination/Pagination.d.ts +88 -0
- package/dist/Pagination/Pagination.js +1 -0
- package/dist/Pagination/index.cjs +1 -0
- package/dist/Pagination/index.d.cts +1 -0
- package/dist/Pagination/index.d.ts +1 -0
- package/dist/Pagination/index.js +1 -0
- package/dist/PopoverContent.cjs +1 -0
- package/dist/PopoverContent.d.cts +8 -0
- package/dist/PopoverContent.d.ts +8 -0
- package/dist/PopoverContent.js +1 -0
- package/dist/Select.cjs +1 -0
- package/dist/Select.d.cts +18 -0
- package/dist/Select.d.ts +18 -0
- package/dist/Select.js +1 -0
- package/dist/Slider.cjs +1 -0
- package/dist/Slider.d.cts +8 -0
- package/dist/Slider.d.ts +8 -0
- package/dist/Slider.js +1 -0
- package/dist/ThemeToggle.cjs +1 -0
- package/dist/ThemeToggle.d.cts +6 -0
- package/dist/ThemeToggle.d.ts +6 -0
- package/dist/ThemeToggle.js +1 -0
- package/dist/_virtual/rolldown_runtime.cjs +1 -0
- package/dist/confirmation-dialog/ConfirmationDialog.cjs +1 -0
- package/dist/confirmation-dialog/ConfirmationDialog.d.cts +13 -0
- package/dist/confirmation-dialog/ConfirmationDialog.d.ts +14 -0
- package/dist/confirmation-dialog/ConfirmationDialog.js +1 -0
- package/dist/confirmation-dialog/DialogProvider.cjs +1 -0
- package/dist/confirmation-dialog/DialogProvider.d.cts +9 -0
- package/dist/confirmation-dialog/DialogProvider.d.ts +9 -0
- package/dist/confirmation-dialog/DialogProvider.js +1 -0
- package/dist/confirmation-dialog/confirmation-dialogs.cjs +1 -0
- package/dist/confirmation-dialog/confirmation-dialogs.d.cts +7 -0
- package/dist/confirmation-dialog/confirmation-dialogs.d.ts +7 -0
- package/dist/confirmation-dialog/confirmation-dialogs.js +1 -0
- package/dist/confirmation-dialog/index.cjs +1 -0
- package/dist/confirmation-dialog/index.d.cts +3 -0
- package/dist/confirmation-dialog/index.d.ts +3 -0
- package/dist/confirmation-dialog/index.js +1 -0
- package/dist/index.cjs +1 -96
- package/dist/index.d.cts +29 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +1 -96
- package/dist/shadcn/src/components/ui/alert.cjs +1 -0
- package/dist/shadcn/src/components/ui/alert.js +1 -0
- package/dist/shadcn/src/components/ui/dialog.cjs +1 -0
- package/dist/shadcn/src/components/ui/dialog.js +1 -0
- package/dist/shadcn/src/lib/index.cjs +1 -0
- package/dist/shadcn/src/lib/index.js +1 -0
- package/dist/shadcn/src/lib/utils.cjs +1 -0
- package/dist/shadcn/src/lib/utils.js +1 -0
- package/dist/spinner/index.cjs +1 -0
- package/dist/spinner/index.d.cts +1 -0
- package/dist/spinner/index.d.ts +1 -0
- package/dist/spinner/index.js +1 -0
- package/dist/spinner/spinner.cjs +7 -0
- package/dist/spinner/spinner.d.cts +46 -0
- package/dist/spinner/spinner.d.ts +46 -0
- package/dist/spinner/spinner.js +7 -0
- package/dist/spinner/styles.cjs +46 -0
- package/dist/spinner/styles.js +46 -0
- package/dist/tags-input.cjs +1 -0
- package/dist/tags-input.d.cts +60 -0
- package/dist/tags-input.d.ts +60 -0
- package/dist/tags-input.js +1 -0
- package/dist/theme-provider/ThemeProvider.cjs +1 -0
- package/dist/theme-provider/ThemeProvider.d.cts +16 -0
- package/dist/theme-provider/ThemeProvider.d.ts +16 -0
- package/dist/theme-provider/ThemeProvider.js +1 -0
- package/dist/theme-provider/index.cjs +1 -0
- package/dist/theme-provider/index.d.cts +3 -0
- package/dist/theme-provider/index.d.ts +3 -0
- package/dist/theme-provider/index.js +1 -0
- package/dist/toast/AlertToast.cjs +1 -0
- package/dist/toast/AlertToast.d.cts +9 -0
- package/dist/toast/AlertToast.d.ts +9 -0
- package/dist/toast/AlertToast.js +1 -0
- package/dist/toast/index.cjs +1 -0
- package/dist/toast/index.d.cts +1 -0
- package/dist/toast/index.d.ts +1 -0
- package/dist/toast/index.js +1 -0
- package/dist/toast/toast.cjs +1 -0
- package/dist/toast/toast.d.cts +20 -0
- package/dist/toast/toast.d.ts +20 -0
- package/dist/toast/toast.js +1 -0
- package/package.json +6 -6
- package/dist/index-BMHRJkpu.d.ts +0 -470
- package/dist/index-JkmaV8h2.d.cts +0 -470
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { CommandOptionListItem } from "./CommandOptionList.cjs";
|
|
2
|
+
import * as react_jsx_runtime6 from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/tags-input.d.ts
|
|
5
|
+
interface TagsInputProps {
|
|
6
|
+
value?: Array<string | number>;
|
|
7
|
+
onChange?: (value: Array<string | number>) => void;
|
|
8
|
+
options?: CommandOptionListItem[];
|
|
9
|
+
freeSolo?: boolean;
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
emptyText?: string;
|
|
12
|
+
className?: string;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
readOnly?: boolean;
|
|
15
|
+
maxTags?: number;
|
|
16
|
+
allowDuplicates?: boolean;
|
|
17
|
+
editable?: boolean;
|
|
18
|
+
label?: string;
|
|
19
|
+
delimiter?: string;
|
|
20
|
+
addOnPaste?: boolean;
|
|
21
|
+
addOnTab?: boolean;
|
|
22
|
+
onValidate?: (value: string) => boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* TagsInput component - Inline tags input based on DiceUI
|
|
26
|
+
*
|
|
27
|
+
* This is a different implementation than TagsInput, using the DiceUI library
|
|
28
|
+
* for a more streamlined inline editing experience.
|
|
29
|
+
*
|
|
30
|
+
* Features:
|
|
31
|
+
* - Inline tag display and editing
|
|
32
|
+
* - Keyboard navigation (Arrow keys, Home, End, Delete, Backspace)
|
|
33
|
+
* - Optional tag editing (editable prop)
|
|
34
|
+
* - Validation support
|
|
35
|
+
* - Paste support with delimiter parsing
|
|
36
|
+
* - Max tags limit
|
|
37
|
+
* - Options support with dropdown (like Select)
|
|
38
|
+
* - freeSolo mode for custom tags (like MUI Autocomplete)
|
|
39
|
+
*/
|
|
40
|
+
declare function TagsInput({
|
|
41
|
+
value,
|
|
42
|
+
onChange,
|
|
43
|
+
options,
|
|
44
|
+
freeSolo,
|
|
45
|
+
placeholder,
|
|
46
|
+
emptyText,
|
|
47
|
+
className,
|
|
48
|
+
disabled,
|
|
49
|
+
readOnly,
|
|
50
|
+
maxTags,
|
|
51
|
+
allowDuplicates,
|
|
52
|
+
editable,
|
|
53
|
+
label,
|
|
54
|
+
delimiter,
|
|
55
|
+
addOnPaste,
|
|
56
|
+
addOnTab,
|
|
57
|
+
onValidate
|
|
58
|
+
}: TagsInputProps): react_jsx_runtime6.JSX.Element;
|
|
59
|
+
//#endregion
|
|
60
|
+
export { TagsInput, TagsInputProps };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { CommandOptionListItem } from "./CommandOptionList.js";
|
|
2
|
+
import * as react_jsx_runtime5 from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/tags-input.d.ts
|
|
5
|
+
interface TagsInputProps {
|
|
6
|
+
value?: Array<string | number>;
|
|
7
|
+
onChange?: (value: Array<string | number>) => void;
|
|
8
|
+
options?: CommandOptionListItem[];
|
|
9
|
+
freeSolo?: boolean;
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
emptyText?: string;
|
|
12
|
+
className?: string;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
readOnly?: boolean;
|
|
15
|
+
maxTags?: number;
|
|
16
|
+
allowDuplicates?: boolean;
|
|
17
|
+
editable?: boolean;
|
|
18
|
+
label?: string;
|
|
19
|
+
delimiter?: string;
|
|
20
|
+
addOnPaste?: boolean;
|
|
21
|
+
addOnTab?: boolean;
|
|
22
|
+
onValidate?: (value: string) => boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* TagsInput component - Inline tags input based on DiceUI
|
|
26
|
+
*
|
|
27
|
+
* This is a different implementation than TagsInput, using the DiceUI library
|
|
28
|
+
* for a more streamlined inline editing experience.
|
|
29
|
+
*
|
|
30
|
+
* Features:
|
|
31
|
+
* - Inline tag display and editing
|
|
32
|
+
* - Keyboard navigation (Arrow keys, Home, End, Delete, Backspace)
|
|
33
|
+
* - Optional tag editing (editable prop)
|
|
34
|
+
* - Validation support
|
|
35
|
+
* - Paste support with delimiter parsing
|
|
36
|
+
* - Max tags limit
|
|
37
|
+
* - Options support with dropdown (like Select)
|
|
38
|
+
* - freeSolo mode for custom tags (like MUI Autocomplete)
|
|
39
|
+
*/
|
|
40
|
+
declare function TagsInput({
|
|
41
|
+
value,
|
|
42
|
+
onChange,
|
|
43
|
+
options,
|
|
44
|
+
freeSolo,
|
|
45
|
+
placeholder,
|
|
46
|
+
emptyText,
|
|
47
|
+
className,
|
|
48
|
+
disabled,
|
|
49
|
+
readOnly,
|
|
50
|
+
maxTags,
|
|
51
|
+
allowDuplicates,
|
|
52
|
+
editable,
|
|
53
|
+
label,
|
|
54
|
+
delimiter,
|
|
55
|
+
addOnPaste,
|
|
56
|
+
addOnTab,
|
|
57
|
+
onValidate
|
|
58
|
+
}: TagsInputProps): react_jsx_runtime5.JSX.Element;
|
|
59
|
+
//#endregion
|
|
60
|
+
export { TagsInput, TagsInputProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{CommandOptionList as e}from"./CommandOptionList.js";import{Command as t,Popover as n,PopoverContent as r,PopoverTrigger as i,TagsInputInLineClear as a,TagsInputInLineInput as o,TagsInputInLineItem as s,TagsInputInLineLabel as c,TagsInputInLineList as l,TagsInputInLineRoot as u,cn as d}from"@pixpilot/shadcn";import{useCallback as f,useEffect as p,useMemo as m,useRef as h,useState as g}from"react";import{jsx as _,jsxs as v}from"react/jsx-runtime";const y=[],b=[];function x({value:x=y,onChange:S,options:C=b,freeSolo:w=!0,placeholder:T=`Add tags...`,emptyText:E=`No options found.`,className:D,disabled:O=!1,readOnly:k=!1,maxTags:A,allowDuplicates:j=!1,editable:M=!1,label:N,delimiter:P=`,`,addOnPaste:F=!0,addOnTab:I=!0,onValidate:L}){let[R,z]=g(!1),[B,V]=g(``),H=h(null),U=C.length>0;p(()=>{if(R&&H.current){let e=setTimeout(()=>{H.current?.focus()},0);return()=>{clearTimeout(e)}}},[R]);let W=m(()=>x.map(e=>String(e)),[x]),G=f(e=>U?C.find(t=>String(t.value)===String(e))?.label??String(e):String(e),[C,U]),K=m(()=>U?C.filter(e=>B?e.label.toLowerCase().includes(B.toLowerCase()):!0):[],[C,B,U]),q=f(e=>{if(V(``),U){let t=e.map(e=>C.find(t=>String(t.value)===e)?.value??e);S?.(t)}else S?.(e)},[S,C,U]),J=f(e=>A!==void 0&&x.length>=A||!j&&W.includes(e)||U&&!w&&!C.some(t=>String(t.value)===e)?!1:L?L(e):!0,[x,A,j,L,W,U,w,C]),Y=f(e=>{let t=x.some(t=>String(t)===String(e)),n;n=t?x.filter(t=>String(t)!==String(e)):[...x,e],S?.(n),V(``)},[x,S]);return U?v(`div`,{className:d(`relative`,D),children:[N!==void 0&&N!==``?_(c,{children:N}):null,v(n,{open:R&&!O&&!k,onOpenChange:z,children:[_(i,{asChild:!0,children:_(`div`,{className:`w-full`,children:v(u,{disabled:O,editable:M,max:A,onValueChange:q,onValidate:J,readOnly:k,value:W,delimiter:w?P:void 0,addOnPaste:w?F:!1,addOnTab:w?I:!1,children:[v(l,{onClick:e=>{!O&&!k&&(e.stopPropagation(),z(!0))},children:[x.map(e=>{let t=G(e);return _(s,{value:String(e),children:t},String(e))}),_(o,{ref:H,placeholder:T,onFocus:e=>{e.stopPropagation(),z(!0)},onChange:e=>{e.stopPropagation(),V(e.target.value)},onKeyDown:e=>{if(R&&(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(R&&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()}})]}),x.length>0&&!O&&!k&&_(a,{})]})})}),_(r,{className:`p-0`,align:`start`,style:{width:`var(--radix-popover-trigger-width)`},onOpenAutoFocus:e=>{e.preventDefault()},children:_(t,{shouldFilter:!1,value:B,loop:!0,children:_(e,{options:K,value:x,onChange:Y,emptyText:E})})})]})]}):v(u,{className:D,disabled:O,editable:M,max:A,onValueChange:q,onValidate:J,readOnly:k,value:W,delimiter:P,addOnPaste:F,addOnTab:I,children:[N!==void 0&&N!==``?_(c,{children:N}):null,v(l,{children:[W.map(e=>_(s,{value:e,children:e},e)),_(o,{placeholder:T})]}),x.length>0&&!O&&!k&&_(a,{})]})}export{x as TagsInput};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";const e=require(`../_virtual/rolldown_runtime.cjs`);let t=require(`react`);t=e.__toESM(t);let n=require(`react/jsx-runtime`);n=e.__toESM(n);let r=require(`next-themes`);r=e.__toESM(r);const i=e=>{let{children:t}=e;return(0,n.jsx)(r.ThemeProvider,{attribute:`class`,defaultTheme:`system`,enableSystem:!0,disableTransitionOnChange:!1,...e,children:t})};i.displayName=`ThemeProvider`,exports.ThemeProvider=i;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React, { ComponentProps } from "react";
|
|
2
|
+
import { ThemeProvider } from "next-themes";
|
|
3
|
+
|
|
4
|
+
//#region src/theme-provider/ThemeProvider.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Note: In Chrome extensions, a flicker (Flash of Wrong Theme, or FOWT) may occur on page load
|
|
8
|
+
* during development mode. This is resolved in production builds where scripts are included
|
|
9
|
+
* in the HTML head to apply the theme before content renders. Do not attempt to fix this in dev.
|
|
10
|
+
*/
|
|
11
|
+
interface ThemeProviderProps extends ComponentProps<typeof ThemeProvider> {
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
}
|
|
14
|
+
declare const ThemeProvider$1: React.FC<ThemeProviderProps>;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { ThemeProvider$1 as ThemeProvider, ThemeProviderProps };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React, { ComponentProps } from "react";
|
|
2
|
+
import { ThemeProvider } from "next-themes";
|
|
3
|
+
|
|
4
|
+
//#region src/theme-provider/ThemeProvider.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Note: In Chrome extensions, a flicker (Flash of Wrong Theme, or FOWT) may occur on page load
|
|
8
|
+
* during development mode. This is resolved in production builds where scripts are included
|
|
9
|
+
* in the HTML head to apply the theme before content renders. Do not attempt to fix this in dev.
|
|
10
|
+
*/
|
|
11
|
+
interface ThemeProviderProps extends ComponentProps<typeof ThemeProvider> {
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
}
|
|
14
|
+
declare const ThemeProvider$1: React.FC<ThemeProviderProps>;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { ThemeProvider$1 as ThemeProvider, ThemeProviderProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import e from"react";import{jsx as t}from"react/jsx-runtime";import{ThemeProvider as n}from"next-themes";const r=e=>{let{children:r}=e;return t(n,{attribute:`class`,defaultTheme:`system`,enableSystem:!0,disableTransitionOnChange:!1,...e,children:r})};r.displayName=`ThemeProvider`;export{r as ThemeProvider};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`../_virtual/rolldown_runtime.cjs`),t=require(`./ThemeProvider.cjs`);let n=require(`next-themes`);n=e.__toESM(n);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ThemeProvider as e}from"./ThemeProvider.js";import{useTheme as t}from"next-themes";export{t as useTheme};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`../_virtual/rolldown_runtime.cjs`),t=require(`../Alert.cjs`);let n=require(`@pixpilot/shadcn`);n=e.__toESM(n);let r=require(`react`);r=e.__toESM(r);let i=require(`react/jsx-runtime`);i=e.__toESM(i);let a=require(`lucide-react`);a=e.__toESM(a);const o=e=>{let{duration:r,onClose:o,...s}=e;return(0,i.jsx)(t.Alert,{icon:!0,...s,className:(0,n.cn)(`shadow-md`,e.className,{"pr-3":o}),children:o&&(0,i.jsx)(`div`,{className:`flex items-start pt-0.5 pl-1`,children:(0,i.jsxs)(`button`,{type:`button`,className:`cursor-pointer opacity-80 transition-opacity hover:opacity-100`,onClick:o,children:[(0,i.jsx)(a.XIcon,{className:`size-4.5`}),(0,i.jsx)(`span`,{className:`sr-only`,children:`Close`})]})})})};o.displayName=`AlertToast`,exports.AlertToast=o;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Alert as e}from"../Alert.js";import{cn as t}from"@pixpilot/shadcn";import n from"react";import{jsx as r,jsxs as i}from"react/jsx-runtime";import{XIcon as a}from"lucide-react";const o=n=>{let{duration:o,onClose:s,...c}=n;return r(e,{icon:!0,...c,className:t(`shadow-md`,n.className,{"pr-3":s}),children:s&&r(`div`,{className:`flex items-start pt-0.5 pl-1`,children:i(`button`,{type:`button`,className:`cursor-pointer opacity-80 transition-opacity hover:opacity-100`,onClick:s,children:[r(a,{className:`size-4.5`}),r(`span`,{className:`sr-only`,children:`Close`})]})})})};o.displayName=`AlertToast`;export{o as AlertToast};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./toast.cjs`);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { DEFAULT_ALERT_DURATION, ToastMessage, toast, toastError, toastInfo, toastSuccess, toastWarning } from "./toast.cjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { DEFAULT_ALERT_DURATION, ToastMessage, toast, toastError, toastInfo, toastSuccess, toastWarning } from "./toast.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{DEFAULT_ALERT_DURATION as e,toast as t,toastError as n,toastInfo as r,toastSuccess as i,toastWarning as a}from"./toast.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`../_virtual/rolldown_runtime.cjs`),t=require(`./AlertToast.cjs`);let n=require(`react/jsx-runtime`);n=e.__toESM(n);let r=require(`@pixpilot/hash`);r=e.__toESM(r);let i=require(`sonner`);i=e.__toESM(i);const a=1e4,o=new Map;function s(e){let{duration:s,...c}=e,l=`toast_${(0,r.simpleHash)(`${e.title??``}::${e.description??``}`)}`,u=o.get(l);u?(i.toast.dismiss(u.currentId),u.counter+=1,u.currentId=`${l}_${u.counter}`):o.set(l,{currentId:`${l}_0`,counter:0});let d=o.get(l).currentId,f=e=>{let t=o.get(l);t&&t.currentId===e&&o.delete(l)};i.toast.custom(e=>(0,n.jsx)(t.AlertToast,{...c,onClose:()=>i.toast.dismiss(e)}),{duration:s??a,id:d,onDismiss:e=>{f(e.id)},onAutoClose(e){f(e.id)}})}function c(e,t,n){s(typeof t==`string`?{variant:e,description:t,duration:n}:{variant:e,...t,duration:n})}function l(e,t){c(`info`,e,t)}function u(e,t){c(`success`,e,t)}function d(e,t){c(`warning`,e,t)}function f(e,t){c(`error`,e,t)}exports.DEFAULT_ALERT_DURATION=a,exports.toast=s,exports.toastError=f,exports.toastInfo=l,exports.toastSuccess=u,exports.toastWarning=d;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AlertBaseProps } from "../Alert.cjs";
|
|
2
|
+
import { AlertToastProps } from "./AlertToast.cjs";
|
|
3
|
+
import "../index.cjs";
|
|
4
|
+
|
|
5
|
+
//#region src/toast/toast.d.ts
|
|
6
|
+
declare const DEFAULT_ALERT_DURATION = 10000;
|
|
7
|
+
interface ToastProps extends AlertBaseProps {
|
|
8
|
+
duration?: number;
|
|
9
|
+
}
|
|
10
|
+
declare function toast(props: ToastProps): void;
|
|
11
|
+
type ToastMessage = string | ({
|
|
12
|
+
title: string;
|
|
13
|
+
description: string;
|
|
14
|
+
} & AlertToastProps);
|
|
15
|
+
declare function toastInfo(message: ToastMessage, duration?: number): void;
|
|
16
|
+
declare function toastSuccess(message: ToastMessage, duration?: number): void;
|
|
17
|
+
declare function toastWarning(message: ToastMessage, duration?: number): void;
|
|
18
|
+
declare function toastError(message: ToastMessage, duration?: number): void;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { DEFAULT_ALERT_DURATION, ToastMessage, toast, toastError, toastInfo, toastSuccess, toastWarning };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AlertBaseProps } from "../Alert.js";
|
|
2
|
+
import { AlertToastProps } from "./AlertToast.js";
|
|
3
|
+
import "../index.js";
|
|
4
|
+
|
|
5
|
+
//#region src/toast/toast.d.ts
|
|
6
|
+
declare const DEFAULT_ALERT_DURATION = 10000;
|
|
7
|
+
interface ToastProps extends AlertBaseProps {
|
|
8
|
+
duration?: number;
|
|
9
|
+
}
|
|
10
|
+
declare function toast(props: ToastProps): void;
|
|
11
|
+
type ToastMessage = string | ({
|
|
12
|
+
title: string;
|
|
13
|
+
description: string;
|
|
14
|
+
} & AlertToastProps);
|
|
15
|
+
declare function toastInfo(message: ToastMessage, duration?: number): void;
|
|
16
|
+
declare function toastSuccess(message: ToastMessage, duration?: number): void;
|
|
17
|
+
declare function toastWarning(message: ToastMessage, duration?: number): void;
|
|
18
|
+
declare function toastError(message: ToastMessage, duration?: number): void;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { DEFAULT_ALERT_DURATION, ToastMessage, toast, toastError, toastInfo, toastSuccess, toastWarning };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{AlertToast as e}from"./AlertToast.js";import{jsx as t}from"react/jsx-runtime";import{simpleHash as n}from"@pixpilot/hash";import{toast as r}from"sonner";const i=1e4,a=new Map;function o(o){let{duration:s,...c}=o,l=`toast_${n(`${o.title??``}::${o.description??``}`)}`,u=a.get(l);u?(r.dismiss(u.currentId),u.counter+=1,u.currentId=`${l}_${u.counter}`):a.set(l,{currentId:`${l}_0`,counter:0});let d=a.get(l).currentId,f=e=>{let t=a.get(l);t&&t.currentId===e&&a.delete(l)};r.custom(n=>t(e,{...c,onClose:()=>r.dismiss(n)}),{duration:s??i,id:d,onDismiss:e=>{f(e.id)},onAutoClose(e){f(e.id)}})}function s(e,t,n){o(typeof t==`string`?{variant:e,description:t,duration:n}:{variant:e,...t,duration:n})}function c(e,t){s(`info`,e,t)}function l(e,t){s(`success`,e,t)}function u(e,t){s(`warning`,e,t)}function d(e,t){s(`error`,e,t)}export{i as DEFAULT_ALERT_DURATION,o as toast,d as toastError,c as toastInfo,l as toastSuccess,u as toastWarning};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pixpilot/shadcn-ui",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.6",
|
|
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.
|
|
38
|
+
"@pixpilot/shadcn": "0.1.10"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@storybook/react": "^8.5.3",
|
|
@@ -46,11 +46,11 @@
|
|
|
46
46
|
"react-dom": "19.2.0",
|
|
47
47
|
"tsdown": "^0.15.8",
|
|
48
48
|
"typescript": "^5.9.3",
|
|
49
|
-
"@internal/
|
|
50
|
-
"@internal/prettier-config": "0.0.1",
|
|
51
|
-
"@internal/vitest-config": "0.1.0",
|
|
49
|
+
"@internal/eslint-config": "0.3.0",
|
|
52
50
|
"@internal/tsdown-config": "0.1.0",
|
|
53
|
-
"@internal/
|
|
51
|
+
"@internal/prettier-config": "0.0.1",
|
|
52
|
+
"@internal/tsconfig": "0.1.0",
|
|
53
|
+
"@internal/vitest-config": "0.1.0"
|
|
54
54
|
},
|
|
55
55
|
"prettier": "@internal/prettier-config",
|
|
56
56
|
"scripts": {
|