@lerianstudio/sindarian-ui 1.0.0-beta.41 → 1.0.0-beta.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/page/index.js +1 -1
- package/dist/components/ui/badge/index.d.ts +1 -1
- package/dist/components/ui/badge/index.d.ts.map +1 -1
- package/dist/components/ui/badge/index.js +5 -1
- package/dist/components/ui/input/styles.css +1 -1
- package/dist/components/ui/multiple-select/index.js +3 -3
- package/dist/components/ui/select/styles.css +1 -1
- package/dist/components/ui/sheet/index.d.ts +1 -1
- package/dist/components/ui/sheet/index.d.ts.map +1 -1
- package/dist/components/ui/sheet/index.js +11 -2
- package/dist/components/ui/sidebar/sidebar-root.js +1 -1
- package/dist/components/ui/toast/index.d.ts +16 -15
- package/dist/components/ui/toast/index.d.ts.map +1 -1
- package/dist/components/ui/toast/index.js +0 -77
- package/dist/components/ui/toast/toaster.d.ts +5 -1
- package/dist/components/ui/toast/toaster.d.ts.map +1 -1
- package/dist/components/ui/toast/toaster.js +5 -7
- package/dist/globals.css +141 -2
- package/dist/hooks/use-toast.d.ts +19 -33
- package/dist/hooks/use-toast.d.ts.map +1 -1
- package/dist/hooks/use-toast.js +49 -150
- package/package.json +2 -2
- package/dist/utilities.css +0 -22
|
@@ -12,5 +12,5 @@ function PageView({ className, ...props }) {
|
|
|
12
12
|
return ((0, jsx_runtime_1.jsx)("div", { "data-slot": "page-view", className: (0, utils_1.cn)('flex min-h-0 flex-1', className), ...props }));
|
|
13
13
|
}
|
|
14
14
|
function PageContent({ className, ...props }) {
|
|
15
|
-
return ((0, jsx_runtime_1.jsx)("div", { "data-slot": "page-content", className: (0, utils_1.cn)('flex grow flex-col overflow-y-auto p-16
|
|
15
|
+
return ((0, jsx_runtime_1.jsx)("div", { "data-slot": "page-content", className: (0, utils_1.cn)('flex grow flex-col overflow-y-auto p-16', className), ...props }));
|
|
16
16
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type VariantProps } from 'class-variance-authority';
|
|
3
3
|
declare const badgeVariants: (props?: ({
|
|
4
|
-
variant?: "default" | "secondary" | "outline" | "destructive" | "active" | "inactive" | null | undefined;
|
|
4
|
+
variant?: "default" | "secondary" | "outline" | "alert" | "destructive" | "success" | "active" | "inactive" | "error" | "info" | null | undefined;
|
|
5
5
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
6
6
|
export type BadgeProps = React.ComponentProps<'span'> & VariantProps<typeof badgeVariants> & {
|
|
7
7
|
asChild?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/badge/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAKjE,QAAA,MAAM,aAAa;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/badge/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAKjE,QAAA,MAAM,aAAa;;8EA4BlB,CAAA;AAED,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,GACnD,YAAY,CAAC,OAAO,aAAa,CAAC,GAAG;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAA;AAE5D,iBAAS,KAAK,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,EAAE,UAAU,2CAUnE;AAED,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,CAAA"}
|
|
@@ -12,8 +12,12 @@ const badgeVariants = (0, class_variance_authority_1.cva)('inline-flex items-cen
|
|
|
12
12
|
default: 'border-transparent bg-primary text-primary-foreground hover:bg-primary/80',
|
|
13
13
|
active: 'bg-system-success-surface text-system-success-h1a border-none py-[2px] px-3',
|
|
14
14
|
inactive: 'bg-muted text-foreground border-none py-[2px] px-3',
|
|
15
|
-
secondary: 'border-transparent bg-muted text-
|
|
15
|
+
secondary: 'border-transparent bg-muted-foreground text-white dark:text-black',
|
|
16
16
|
destructive: 'border-transparent bg-red-500 text-primary-foreground hover:bg-red-500/80',
|
|
17
|
+
error: 'border-system-error-border bg-system-error-surface text-system-error-text px-[10px] py-1',
|
|
18
|
+
success: 'border-system-success-border bg-system-success-surface text-system-success-text px-[10px] py-1',
|
|
19
|
+
info: 'border-system-info-border bg-system-info-surface text-system-info-text px-[10px] py-1',
|
|
20
|
+
alert: 'border-system-alert-border bg-system-alert-surface text-system-alert-text px-[10px] py-1',
|
|
17
21
|
outline: 'text-foreground'
|
|
18
22
|
}
|
|
19
23
|
},
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
--spacing-input-wrapper-p: calc(var(--spacing) * 2);
|
|
4
4
|
--spacing-input-px: calc(var(--spacing) * 4);
|
|
5
5
|
--color-input-foreground: var(--color-foreground);
|
|
6
|
-
--color-input-placeholder: var(--color-
|
|
6
|
+
--color-input-placeholder: var(--color-muted-foreground);
|
|
7
7
|
--color-input-border: var(--color-shadcn-400);
|
|
8
8
|
|
|
9
9
|
--color-input-adornment: var(--color-container-text);
|
|
@@ -77,9 +77,9 @@ exports.MultipleSelectTrigger = react_1.default.forwardRef(({ className, childre
|
|
|
77
77
|
setOpen(false);
|
|
78
78
|
inputRef.current?.blur();
|
|
79
79
|
});
|
|
80
|
-
return ((0, jsx_runtime_1.jsxs)("div", { ref: _ref, className: (0, utils_1.cn)('bg-background ring-offset-background placeholder:text-shadcn-400 focus:ring-ring border-
|
|
81
|
-
'h-
|
|
82
|
-
'min-h-
|
|
80
|
+
return ((0, jsx_runtime_1.jsxs)("div", { ref: _ref, className: (0, utils_1.cn)('bg-background ring-offset-background placeholder:text-shadcn-400 focus:ring-ring border-shadcn-400 flex flex-row rounded-md border text-sm focus:ring-2 focus:ring-offset-0 focus:outline-hidden focus-visible:outline-hidden md:text-sm [&>span]:line-clamp-1', {
|
|
81
|
+
'h-10': value.length === 0,
|
|
82
|
+
'min-h-10': value.length > 0,
|
|
83
83
|
'cursor-text': !disabled && !readOnly && value.length !== 0,
|
|
84
84
|
'bg-shadcn-100 cursor-not-allowed opacity-50': disabled
|
|
85
85
|
}, readOnly && [
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
--spacing-select-py: calc(var(--spacing) * 2);
|
|
5
5
|
|
|
6
6
|
--color-select-foreground: var(--color-foreground);
|
|
7
|
-
--color-select-placeholder: var(--color-
|
|
7
|
+
--color-select-placeholder: var(--color-muted-foreground);
|
|
8
8
|
--color-select-border: var(--color-shadcn-400);
|
|
9
9
|
--color-select-chevron: var(--color-container-text);
|
|
10
10
|
}
|
|
@@ -10,7 +10,7 @@ declare const sheetVariants: (props?: ({
|
|
|
10
10
|
side?: "top" | "right" | "bottom" | "left" | null | undefined;
|
|
11
11
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
12
12
|
type SheetContentProps = React.ComponentProps<typeof SheetPrimitive.Content> & VariantProps<typeof sheetVariants>;
|
|
13
|
-
declare function SheetContent({ side, className, children, ...props }: SheetContentProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
declare function SheetContent({ side, className, children, onInteractOutside, ...props }: SheetContentProps): import("react/jsx-runtime").JSX.Element;
|
|
14
14
|
declare function SheetHeader({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
15
15
|
declare function SheetFooter({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
16
16
|
declare function SheetTitle({ className, ...props }: React.ComponentProps<typeof SheetPrimitive.Title>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/sheet/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,cAAc,MAAM,wBAAwB,CAAA;AACxD,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAIjE,iBAAS,KAAK,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,IAAI,CAAC,2CAE5E;AAED,iBAAS,YAAY,CAAC,EACpB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,OAAO,CAAC,2CAErD;AAED,iBAAS,UAAU,CAAC,EAClB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,KAAK,CAAC,2CAEnD;AAED,iBAAS,WAAW,CAAC,EACnB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,MAAM,CAAC,2CAEpD;AAED,iBAAS,YAAY,CAAC,EACpB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,OAAO,CAAC,2CAWrD;AAED,QAAA,MAAM,aAAa;;8EAiBlB,CAAA;AAED,KAAK,iBAAiB,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,OAAO,CAAC,GAC1E,YAAY,CAAC,OAAO,aAAa,CAAC,CAAA;AAEpC,iBAAS,YAAY,CAAC,EACpB,IAAc,EACd,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/sheet/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,cAAc,MAAM,wBAAwB,CAAA;AACxD,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAIjE,iBAAS,KAAK,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,IAAI,CAAC,2CAE5E;AAED,iBAAS,YAAY,CAAC,EACpB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,OAAO,CAAC,2CAErD;AAED,iBAAS,UAAU,CAAC,EAClB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,KAAK,CAAC,2CAEnD;AAED,iBAAS,WAAW,CAAC,EACnB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,MAAM,CAAC,2CAEpD;AAED,iBAAS,YAAY,CAAC,EACpB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,OAAO,CAAC,2CAWrD;AAED,QAAA,MAAM,aAAa;;8EAiBlB,CAAA;AAED,KAAK,iBAAiB,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,OAAO,CAAC,GAC1E,YAAY,CAAC,OAAO,aAAa,CAAC,CAAA;AAEpC,iBAAS,YAAY,CAAC,EACpB,IAAc,EACd,SAAS,EACT,QAAQ,EACR,iBAAiB,EACjB,GAAG,KAAK,EACT,EAAE,iBAAiB,2CAsCnB;AAED,iBAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,2CAWxE;AAED,iBAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,2CAWxE;AAED,iBAAS,UAAU,CAAC,EAClB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,KAAK,CAAC,2CAWnD;AAED,iBAAS,gBAAgB,CAAC,EACxB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,WAAW,CAAC,2CAQzD;AAED,OAAO,EACL,KAAK,EACL,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,WAAW,EACX,WAAW,EACX,UAAU,EACV,gBAAgB,EACjB,CAAA"}
|
|
@@ -45,6 +45,7 @@ exports.SheetFooter = SheetFooter;
|
|
|
45
45
|
exports.SheetTitle = SheetTitle;
|
|
46
46
|
exports.SheetDescription = SheetDescription;
|
|
47
47
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
48
|
+
const React = __importStar(require("react"));
|
|
48
49
|
const SheetPrimitive = __importStar(require("@radix-ui/react-dialog"));
|
|
49
50
|
const class_variance_authority_1 = require("class-variance-authority");
|
|
50
51
|
const lucide_react_1 = require("lucide-react");
|
|
@@ -77,8 +78,16 @@ const sheetVariants = (0, class_variance_authority_1.cva)('fixed z-50 gap-4 bg-b
|
|
|
77
78
|
side: 'right'
|
|
78
79
|
}
|
|
79
80
|
});
|
|
80
|
-
function SheetContent({ side = 'right', className, children, ...props }) {
|
|
81
|
-
|
|
81
|
+
function SheetContent({ side = 'right', className, children, onInteractOutside, ...props }) {
|
|
82
|
+
const handleInteractOutside = React.useCallback((event) => {
|
|
83
|
+
const target = event.target;
|
|
84
|
+
if (target?.closest('[data-sonner-toaster]')) {
|
|
85
|
+
event.preventDefault();
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
onInteractOutside?.(event);
|
|
89
|
+
}, [onInteractOutside]);
|
|
90
|
+
return ((0, jsx_runtime_1.jsxs)(SheetPortal, { children: [(0, jsx_runtime_1.jsx)(SheetOverlay, {}), (0, jsx_runtime_1.jsxs)(SheetPrimitive.Content, { "data-slot": "sheet-content", className: (0, utils_1.cn)('flex max-h-screen flex-col overflow-x-auto px-8 pb-0', sheetVariants({ side }), className), onInteractOutside: handleInteractOutside, ...props, children: [children, (0, jsx_runtime_1.jsxs)(SheetPrimitive.Close, { className: "data-[state=open]:bg-secondary absolute top-7 right-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-hidden disabled:pointer-events-none", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.X, { className: "h-6 w-6" }), (0, jsx_runtime_1.jsx)("span", { className: "sr-only", children: "Close" })] })] })] }));
|
|
82
91
|
}
|
|
83
92
|
function SheetHeader({ className, ...props }) {
|
|
84
93
|
return ((0, jsx_runtime_1.jsx)("div", { "data-slot": "sheet-header", className: (0, utils_1.cn)('mb-4 flex flex-col space-y-2 text-center sm:text-left', className), ...props }));
|
|
@@ -6,7 +6,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
6
6
|
const class_variance_authority_1 = require("class-variance-authority");
|
|
7
7
|
const sidebar_provider_1 = require("./sidebar-provider");
|
|
8
8
|
const utils_1 = require("../../../lib/utils");
|
|
9
|
-
const sidebarVariants = (0, class_variance_authority_1.cva)('group/sidebar shadow-sidebar relative flex flex-col transition-[width] duration-300 ease-in-out
|
|
9
|
+
const sidebarVariants = (0, class_variance_authority_1.cva)('group/sidebar shadow-sidebar relative flex flex-col transition-[width] duration-300 ease-in-out', {
|
|
10
10
|
variants: {
|
|
11
11
|
collapsed: {
|
|
12
12
|
true: 'w-[72px]',
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Backward-compatible type exports.
|
|
4
|
+
*
|
|
5
|
+
* The Radix Toast primitives (ToastProvider, ToastViewport, Toast, etc.) are
|
|
6
|
+
* no longer used -- Sonner manages rendering internally. These types are kept
|
|
7
|
+
* so that any downstream code referencing ToastProps or ToastActionElement
|
|
8
|
+
* continues to compile.
|
|
9
|
+
*/
|
|
10
|
+
export type ToastActionElement = React.ReactElement;
|
|
11
|
+
export type ToastProps = {
|
|
12
|
+
variant?: 'default' | 'success' | 'destructive';
|
|
13
|
+
className?: string;
|
|
14
|
+
open?: boolean;
|
|
15
|
+
onOpenChange?: (open: boolean) => void;
|
|
16
|
+
duration?: number;
|
|
17
|
+
};
|
|
17
18
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/toast/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/toast/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B;;;;;;;GAOG;AAEH,MAAM,MAAM,kBAAkB,GAAG,KAAK,CAAC,YAAY,CAAA;AAEnD,MAAM,MAAM,UAAU,GAAG;IACvB,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,aAAa,CAAA;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA"}
|
|
@@ -1,80 +1,3 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
"use strict";
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
-
var ownKeys = function(o) {
|
|
21
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
-
var ar = [];
|
|
23
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
-
return ar;
|
|
25
|
-
};
|
|
26
|
-
return ownKeys(o);
|
|
27
|
-
};
|
|
28
|
-
return function (mod) {
|
|
29
|
-
if (mod && mod.__esModule) return mod;
|
|
30
|
-
var result = {};
|
|
31
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
-
__setModuleDefault(result, mod);
|
|
33
|
-
return result;
|
|
34
|
-
};
|
|
35
|
-
})();
|
|
36
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
-
exports.ToastProvider = void 0;
|
|
38
|
-
exports.ToastViewport = ToastViewport;
|
|
39
|
-
exports.Toast = Toast;
|
|
40
|
-
exports.ToastTitle = ToastTitle;
|
|
41
|
-
exports.ToastDescription = ToastDescription;
|
|
42
|
-
exports.ToastClose = ToastClose;
|
|
43
|
-
exports.ToastAction = ToastAction;
|
|
44
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
45
|
-
const ToastPrimitives = __importStar(require("@radix-ui/react-toast"));
|
|
46
|
-
const class_variance_authority_1 = require("class-variance-authority");
|
|
47
|
-
const lucide_react_1 = require("lucide-react");
|
|
48
|
-
const utils_1 = require("../../../lib/utils");
|
|
49
|
-
const ToastProvider = ToastPrimitives.Provider;
|
|
50
|
-
exports.ToastProvider = ToastProvider;
|
|
51
|
-
function ToastViewport({ className, ...props }) {
|
|
52
|
-
return ((0, jsx_runtime_1.jsx)(ToastPrimitives.Viewport, { "data-slot": "toast-viewport", className: (0, utils_1.cn)('z-100 fixed top-0 flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]', className), ...props }));
|
|
53
|
-
}
|
|
54
|
-
const toastVariants = (0, class_variance_authority_1.cva)('group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border border-border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-(--radix-toast-swipe-end-x) data-[swipe=move]:translate-x-(--radix-toast-swipe-move-x) data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full', {
|
|
55
|
-
variants: {
|
|
56
|
-
variant: {
|
|
57
|
-
default: 'border bg-card text-foreground',
|
|
58
|
-
success: 'success group border-green-500 bg-green-500 text-primary-foreground',
|
|
59
|
-
destructive: 'destructive group border-red-500 bg-red-500 text-primary-foreground'
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
defaultVariants: {
|
|
63
|
-
variant: 'default'
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
function Toast({ className, variant, ...props }) {
|
|
67
|
-
return ((0, jsx_runtime_1.jsx)(ToastPrimitives.Root, { "data-slot": "toast", className: (0, utils_1.cn)(toastVariants({ variant }), className), ...props }));
|
|
68
|
-
}
|
|
69
|
-
function ToastAction({ className, ...props }) {
|
|
70
|
-
return ((0, jsx_runtime_1.jsx)(ToastPrimitives.Action, { "data-slot": "toast-action", className: (0, utils_1.cn)('focus:outline-hidden border-border ring-offset-background hover:bg-muted focus:ring-ring group-[.destructive]:border-muted/40 hover:group-[.destructive]:text-primary-foreground inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors focus:ring-2 focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 hover:group-[.destructive]:border-red-500/30 hover:group-[.destructive]:bg-red-500 focus:group-[.destructive]:ring-red-500', className), ...props }));
|
|
71
|
-
}
|
|
72
|
-
function ToastClose({ className, ...props }) {
|
|
73
|
-
return ((0, jsx_runtime_1.jsx)(ToastPrimitives.Close, { "data-slot": "toast-close", className: (0, utils_1.cn)('ring-offset-background text-foreground/50 hover:text-foreground absolute right-2 top-2 rounded-md p-1 opacity-0 transition-opacity focus-visible:opacity-100 focus-visible:outline-hidden focus-visible:ring-ring focus-visible:ring-2 focus-visible:ring-offset-2 group-hover:opacity-100 group-[.destructive]:text-red-300 hover:group-[.destructive]:text-red-50 focus-visible:group-[.destructive]:ring-red-400 focus-visible:group-[.destructive]:ring-offset-red-600', className), "toast-close": "", ...props, children: (0, jsx_runtime_1.jsx)(lucide_react_1.X, { className: "h-4 w-4" }) }));
|
|
74
|
-
}
|
|
75
|
-
function ToastTitle({ className, ...props }) {
|
|
76
|
-
return ((0, jsx_runtime_1.jsx)(ToastPrimitives.Title, { "data-slot": "toast-title", className: (0, utils_1.cn)('text-sm font-semibold', className), ...props }));
|
|
77
|
-
}
|
|
78
|
-
function ToastDescription({ className, ...props }) {
|
|
79
|
-
return ((0, jsx_runtime_1.jsx)(ToastPrimitives.Description, { "data-slot": "toast-description", className: (0, utils_1.cn)('text-sm opacity-90', className), ...props }));
|
|
80
|
-
}
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
type ToasterProps = {
|
|
2
|
+
theme?: 'light' | 'dark' | 'system';
|
|
3
|
+
};
|
|
4
|
+
export declare function Toaster({ theme }: ToasterProps): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export {};
|
|
2
6
|
//# sourceMappingURL=toaster.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toaster.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/toast/toaster.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"toaster.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/toast/toaster.tsx"],"names":[],"mappings":"AAIA,KAAK,YAAY,GAAG;IAClB,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAA;CACpC,CAAA;AAED,wBAAgB,OAAO,CAAC,EAAE,KAAgB,EAAE,EAAE,YAAY,2CAiBzD"}
|
|
@@ -3,11 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.Toaster = Toaster;
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return ((0, jsx_runtime_1.jsxs)(toast_1.Toast, { ...props, children: [(0, jsx_runtime_1.jsxs)("div", { className: "grid gap-1", children: [title && (0, jsx_runtime_1.jsx)(toast_1.ToastTitle, { children: title }), description && ((0, jsx_runtime_1.jsx)(toast_1.ToastDescription, { children: description }))] }), action, (0, jsx_runtime_1.jsx)(toast_1.ToastClose, {})] }, id));
|
|
12
|
-
}), (0, jsx_runtime_1.jsx)(toast_1.ToastViewport, {})] }));
|
|
6
|
+
const sonner_1 = require("sonner");
|
|
7
|
+
function Toaster({ theme = 'system' }) {
|
|
8
|
+
return ((0, jsx_runtime_1.jsx)(sonner_1.Toaster, { theme: theme, position: "bottom-right", visibleToasts: 3, duration: 10000, expand: false, closeButton: true, richColors: false, offset: 16, gap: 8, toastOptions: {
|
|
9
|
+
className: 'font-sans !text-sm !font-medium'
|
|
10
|
+
} }));
|
|
13
11
|
}
|
package/dist/globals.css
CHANGED
|
@@ -10,8 +10,6 @@
|
|
|
10
10
|
@import './components/ui/stepper/styles.css';
|
|
11
11
|
@import './components/ui/tabs/styles.css';
|
|
12
12
|
@import './components/ui/dialog/styles.css';
|
|
13
|
-
@import './utilities.css';
|
|
14
|
-
|
|
15
13
|
@custom-variant dark (&:is(.dark *));
|
|
16
14
|
|
|
17
15
|
@theme inline {
|
|
@@ -327,6 +325,147 @@
|
|
|
327
325
|
}
|
|
328
326
|
}
|
|
329
327
|
|
|
328
|
+
/* Sonner toast overrides — solid bold backgrounds (Radix parity) */
|
|
329
|
+
[data-sonner-toaster] {
|
|
330
|
+
--width: 420px;
|
|
331
|
+
pointer-events: auto !important;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
[data-sonner-toast] {
|
|
335
|
+
--normal-bg: hsl(var(--card));
|
|
336
|
+
--normal-text: hsl(var(--foreground));
|
|
337
|
+
--normal-border: hsl(var(--border));
|
|
338
|
+
padding: 24px 32px 24px 24px !important;
|
|
339
|
+
border-radius: var(--radius);
|
|
340
|
+
box-shadow:
|
|
341
|
+
0 10px 15px -3px rgba(0, 0, 0, 0.1),
|
|
342
|
+
0 4px 6px -4px rgba(0, 0, 0, 0.1);
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
[data-sonner-toast][data-type='success'] {
|
|
346
|
+
--normal-bg: #22c55e;
|
|
347
|
+
--normal-text: #ffffff;
|
|
348
|
+
--normal-border: transparent;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
[data-sonner-toast][data-type='error'] {
|
|
352
|
+
--normal-bg: #ef4444;
|
|
353
|
+
--normal-text: #ffffff;
|
|
354
|
+
--normal-border: transparent;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
[data-sonner-toast][data-type='warning'] {
|
|
358
|
+
--normal-bg: #f59e0b;
|
|
359
|
+
--normal-text: #422006;
|
|
360
|
+
--normal-border: transparent;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
[data-sonner-toast][data-type='info'] {
|
|
364
|
+
--normal-bg: hsl(var(--card));
|
|
365
|
+
--normal-text: hsl(var(--foreground));
|
|
366
|
+
--normal-border: hsl(var(--border));
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
[data-sonner-toast] [data-title] {
|
|
370
|
+
font-weight: 600;
|
|
371
|
+
font-size: 0.875rem;
|
|
372
|
+
line-height: 1.25rem;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
[data-sonner-toast] [data-description],
|
|
376
|
+
[data-sonner-toast][data-styled='true'] [data-description] {
|
|
377
|
+
font-size: 0.875rem;
|
|
378
|
+
font-weight: 600 !important;
|
|
379
|
+
line-height: 1.25rem;
|
|
380
|
+
color: var(--normal-text) !important;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
/* Hide icons from all sonner toast variants */
|
|
384
|
+
[data-sonner-toast] [data-icon] {
|
|
385
|
+
display: none !important;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
[data-sonner-toast] [data-close-button] {
|
|
389
|
+
color: hsl(var(--foreground) / 0.5);
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
[data-sonner-toast] [data-close-button]:hover {
|
|
393
|
+
color: #ffffff !important;
|
|
394
|
+
background-color: hsl(var(--foreground)) !important;
|
|
395
|
+
border-color: hsl(var(--foreground)) !important;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
.dark [data-sonner-toast] [data-close-button]:hover {
|
|
399
|
+
color: #ffffff !important;
|
|
400
|
+
background-color: hsl(240 5% 26%) !important;
|
|
401
|
+
border-color: hsl(240 5% 26%) !important;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
[data-sonner-toast][data-type='success'] [data-close-button],
|
|
405
|
+
[data-sonner-toast][data-type='error'] [data-close-button] {
|
|
406
|
+
color: rgba(255, 255, 255, 0.6);
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
[data-sonner-toast][data-type='success'] [data-close-button]:hover,
|
|
410
|
+
[data-sonner-toast][data-type='error'] [data-close-button]:hover {
|
|
411
|
+
color: #ffffff !important;
|
|
412
|
+
background-color: hsl(var(--foreground)) !important;
|
|
413
|
+
border-color: hsl(var(--foreground)) !important;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
[data-sonner-toast][data-type='warning'] [data-close-button] {
|
|
417
|
+
color: rgba(66, 32, 6, 0.5);
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
[data-sonner-toast][data-type='warning'] [data-close-button]:hover {
|
|
421
|
+
color: #422006 !important;
|
|
422
|
+
background-color: rgba(66, 32, 6, 0.15) !important;
|
|
423
|
+
border-color: rgba(66, 32, 6, 0.15) !important;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
.dark [data-sonner-toast] {
|
|
427
|
+
box-shadow:
|
|
428
|
+
0 10px 15px -3px rgba(0, 0, 0, 0.3),
|
|
429
|
+
0 4px 6px -4px rgba(0, 0, 0, 0.2);
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
/* Autofill — remove browser default blue/white background */
|
|
433
|
+
@layer base {
|
|
434
|
+
input:-webkit-autofill,
|
|
435
|
+
input:-webkit-autofill:hover,
|
|
436
|
+
input:-webkit-autofill:focus,
|
|
437
|
+
input:-webkit-autofill:active {
|
|
438
|
+
-webkit-box-shadow: 0 0 0 1000px var(--color-background) inset !important;
|
|
439
|
+
-webkit-text-fill-color: var(--color-foreground) !important;
|
|
440
|
+
transition: background-color 5000s ease-in-out 0s;
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
/* Scrollbar — thin translucent thumb for scrollable layout containers */
|
|
445
|
+
@layer base {
|
|
446
|
+
* {
|
|
447
|
+
scrollbar-width: thin;
|
|
448
|
+
scrollbar-color: var(--color-shadcn-300) transparent;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
*::-webkit-scrollbar {
|
|
452
|
+
width: 4px;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
*::-webkit-scrollbar-track {
|
|
456
|
+
background: transparent;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
*::-webkit-scrollbar-thumb {
|
|
460
|
+
background-color: var(--color-shadcn-300);
|
|
461
|
+
border-radius: 9999px;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
*::-webkit-scrollbar-thumb:hover {
|
|
465
|
+
background-color: var(--color-shadcn-400);
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
|
|
330
469
|
.ticket {
|
|
331
470
|
mask: radial-gradient(21px 13px at 50% 102%, #0000 98%, #000) 50%
|
|
332
471
|
calc(100% - 16px) / 64px 100% repeat-x;
|
|
@@ -1,45 +1,31 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
type ToasterToast =
|
|
4
|
-
id: string;
|
|
1
|
+
import type { ToastActionElement } from '../components/ui/toast';
|
|
2
|
+
type ToastVariant = 'default' | 'success' | 'destructive';
|
|
3
|
+
type ToasterToast = {
|
|
4
|
+
id: string | number;
|
|
5
5
|
title?: React.ReactNode;
|
|
6
6
|
description?: React.ReactNode;
|
|
7
|
+
variant?: ToastVariant;
|
|
7
8
|
action?: ToastActionElement;
|
|
8
9
|
};
|
|
9
|
-
declare const actionTypes: {
|
|
10
|
-
readonly ADD_TOAST: "ADD_TOAST";
|
|
11
|
-
readonly UPDATE_TOAST: "UPDATE_TOAST";
|
|
12
|
-
readonly DISMISS_TOAST: "DISMISS_TOAST";
|
|
13
|
-
readonly REMOVE_TOAST: "REMOVE_TOAST";
|
|
14
|
-
};
|
|
15
|
-
type ActionType = typeof actionTypes;
|
|
16
|
-
type Action = {
|
|
17
|
-
type: ActionType['ADD_TOAST'];
|
|
18
|
-
toast: ToasterToast;
|
|
19
|
-
} | {
|
|
20
|
-
type: ActionType['UPDATE_TOAST'];
|
|
21
|
-
toast: Partial<ToasterToast>;
|
|
22
|
-
} | {
|
|
23
|
-
type: ActionType['DISMISS_TOAST'];
|
|
24
|
-
toastId?: ToasterToast['id'];
|
|
25
|
-
} | {
|
|
26
|
-
type: ActionType['REMOVE_TOAST'];
|
|
27
|
-
toastId?: ToasterToast['id'];
|
|
28
|
-
};
|
|
29
|
-
interface State {
|
|
30
|
-
toasts: ToasterToast[];
|
|
31
|
-
}
|
|
32
|
-
export declare const reducer: (state: State, action: Action) => State;
|
|
33
10
|
type Toast = Omit<ToasterToast, 'id'>;
|
|
34
|
-
declare function toast({ ...
|
|
35
|
-
id: string;
|
|
36
|
-
dismiss: () =>
|
|
37
|
-
update: (props: ToasterToast) => void;
|
|
11
|
+
declare function toast({ title, description, variant, ...rest }: Toast): {
|
|
12
|
+
id: string | number;
|
|
13
|
+
dismiss: () => string | number;
|
|
14
|
+
update: (props: Partial<ToasterToast>) => void;
|
|
38
15
|
};
|
|
16
|
+
/**
|
|
17
|
+
* Backward-compatible hook that wraps Sonner's toast API.
|
|
18
|
+
*
|
|
19
|
+
* Returns the same shape as the original Radix-based useToast:
|
|
20
|
+
* - `toast()` to create a toast
|
|
21
|
+
* - `dismiss()` to dismiss a toast by id (or all if no id)
|
|
22
|
+
* - `toasts` array (always empty -- Sonner manages its own state internally)
|
|
23
|
+
*/
|
|
39
24
|
declare function useToast(): {
|
|
40
25
|
toast: typeof toast;
|
|
41
|
-
dismiss: (toastId?: string) => void;
|
|
26
|
+
dismiss: (toastId?: string | number) => void;
|
|
42
27
|
toasts: ToasterToast[];
|
|
43
28
|
};
|
|
44
29
|
export { useToast, toast };
|
|
30
|
+
export type { ToasterToast, Toast, ToastVariant };
|
|
45
31
|
//# sourceMappingURL=use-toast.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-toast.d.ts","sourceRoot":"","sources":["../../src/hooks/use-toast.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-toast.d.ts","sourceRoot":"","sources":["../../src/hooks/use-toast.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAK/D,KAAK,YAAY,GAAG,SAAS,GAAG,SAAS,GAAG,aAAa,CAAA;AAEzD,KAAK,YAAY,GAAG;IAClB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACvB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC7B,OAAO,CAAC,EAAE,YAAY,CAAA;IACtB,MAAM,CAAC,EAAE,kBAAkB,CAAA;CAC5B,CAAA;AAED,KAAK,KAAK,GAAG,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,CAAA;AAErC,iBAAS,KAAK,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,EAAE,KAAK;;;oBA2B1C,OAAO,CAAC,YAAY,CAAC;EAQxC;AAED;;;;;;;GAOG;AACH,iBAAS,QAAQ;;wBAGO,MAAM,GAAG,MAAM;YAOrB,YAAY,EAAE;EAE/B;AAED,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAA;AAC1B,YAAY,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE,CAAA"}
|
package/dist/hooks/use-toast.js
CHANGED
|
@@ -1,164 +1,63 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
"use strict";
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
-
var ownKeys = function(o) {
|
|
21
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
-
var ar = [];
|
|
23
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
-
return ar;
|
|
25
|
-
};
|
|
26
|
-
return ownKeys(o);
|
|
27
|
-
};
|
|
28
|
-
return function (mod) {
|
|
29
|
-
if (mod && mod.__esModule) return mod;
|
|
30
|
-
var result = {};
|
|
31
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
-
__setModuleDefault(result, mod);
|
|
33
|
-
return result;
|
|
34
|
-
};
|
|
35
|
-
})();
|
|
36
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
-
exports.reducer = void 0;
|
|
38
4
|
exports.useToast = useToast;
|
|
39
5
|
exports.toast = toast;
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
};
|
|
49
|
-
let
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
toastId: toastId
|
|
64
|
-
});
|
|
65
|
-
}, TOAST_REMOVE_DELAY);
|
|
66
|
-
toastTimeouts.set(toastId, timeout);
|
|
67
|
-
};
|
|
68
|
-
const reducer = (state, action) => {
|
|
69
|
-
switch (action.type) {
|
|
70
|
-
case 'ADD_TOAST':
|
|
71
|
-
return {
|
|
72
|
-
...state,
|
|
73
|
-
toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT)
|
|
74
|
-
};
|
|
75
|
-
case 'UPDATE_TOAST':
|
|
76
|
-
return {
|
|
77
|
-
...state,
|
|
78
|
-
toasts: state.toasts.map((t) => t.id === action.toast.id ? { ...t, ...action.toast } : t)
|
|
79
|
-
};
|
|
80
|
-
case 'DISMISS_TOAST': {
|
|
81
|
-
const { toastId } = action;
|
|
82
|
-
// but I'll keep it here for simplicity
|
|
83
|
-
if (toastId) {
|
|
84
|
-
addToRemoveQueue(toastId);
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
state.toasts.forEach((toast) => {
|
|
88
|
-
addToRemoveQueue(toast.id);
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
return {
|
|
92
|
-
...state,
|
|
93
|
-
toasts: state.toasts.map((t) => t.id === toastId || toastId === undefined
|
|
94
|
-
? {
|
|
95
|
-
...t,
|
|
96
|
-
open: false
|
|
97
|
-
}
|
|
98
|
-
: t)
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
case 'REMOVE_TOAST':
|
|
102
|
-
if (action.toastId === undefined) {
|
|
103
|
-
return {
|
|
104
|
-
...state,
|
|
105
|
-
toasts: []
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
return {
|
|
109
|
-
...state,
|
|
110
|
-
toasts: state.toasts.filter((t) => t.id !== action.toastId)
|
|
111
|
-
};
|
|
6
|
+
const sonner_1 = require("sonner");
|
|
7
|
+
const DEFAULT_DURATION = 10000;
|
|
8
|
+
const DESTRUCTIVE_DURATION = Infinity;
|
|
9
|
+
function toast({ title, description, variant, ...rest }) {
|
|
10
|
+
const message = title ?? '';
|
|
11
|
+
const options = {
|
|
12
|
+
description,
|
|
13
|
+
...rest
|
|
14
|
+
};
|
|
15
|
+
let id;
|
|
16
|
+
switch (variant) {
|
|
17
|
+
case 'success':
|
|
18
|
+
options.duration = DEFAULT_DURATION;
|
|
19
|
+
id = sonner_1.toast.success(message, options);
|
|
20
|
+
break;
|
|
21
|
+
case 'destructive':
|
|
22
|
+
options.duration = DESTRUCTIVE_DURATION;
|
|
23
|
+
id = sonner_1.toast.error(message, options);
|
|
24
|
+
break;
|
|
25
|
+
default:
|
|
26
|
+
options.duration = DEFAULT_DURATION;
|
|
27
|
+
id = (0, sonner_1.toast)(message, options);
|
|
28
|
+
break;
|
|
112
29
|
}
|
|
113
|
-
};
|
|
114
|
-
exports.reducer = reducer;
|
|
115
|
-
const listeners = [];
|
|
116
|
-
let memoryState = { toasts: [] };
|
|
117
|
-
function dispatch(action) {
|
|
118
|
-
memoryState = (0, exports.reducer)(memoryState, action);
|
|
119
|
-
listeners.forEach((listener) => {
|
|
120
|
-
listener(memoryState);
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
function toast({ ...props }) {
|
|
124
|
-
const id = genId();
|
|
125
|
-
const update = (props) => dispatch({
|
|
126
|
-
type: 'UPDATE_TOAST',
|
|
127
|
-
toast: { ...props, id }
|
|
128
|
-
});
|
|
129
|
-
const dismiss = () => dispatch({ type: 'DISMISS_TOAST', toastId: id });
|
|
130
|
-
dispatch({
|
|
131
|
-
type: 'ADD_TOAST',
|
|
132
|
-
toast: {
|
|
133
|
-
...props,
|
|
134
|
-
id,
|
|
135
|
-
open: true,
|
|
136
|
-
onOpenChange: (open) => {
|
|
137
|
-
if (!open)
|
|
138
|
-
dismiss();
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
30
|
return {
|
|
143
|
-
id
|
|
144
|
-
dismiss,
|
|
145
|
-
update
|
|
31
|
+
id,
|
|
32
|
+
dismiss: () => sonner_1.toast.dismiss(id),
|
|
33
|
+
update: (props) => {
|
|
34
|
+
(0, sonner_1.toast)(props.title ?? message, {
|
|
35
|
+
id,
|
|
36
|
+
description: props.description ?? description,
|
|
37
|
+
...rest
|
|
38
|
+
});
|
|
39
|
+
}
|
|
146
40
|
};
|
|
147
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Backward-compatible hook that wraps Sonner's toast API.
|
|
44
|
+
*
|
|
45
|
+
* Returns the same shape as the original Radix-based useToast:
|
|
46
|
+
* - `toast()` to create a toast
|
|
47
|
+
* - `dismiss()` to dismiss a toast by id (or all if no id)
|
|
48
|
+
* - `toasts` array (always empty -- Sonner manages its own state internally)
|
|
49
|
+
*/
|
|
148
50
|
function useToast() {
|
|
149
|
-
const [state, setState] = React.useState(memoryState);
|
|
150
|
-
React.useEffect(() => {
|
|
151
|
-
listeners.push(setState);
|
|
152
|
-
return () => {
|
|
153
|
-
const index = listeners.indexOf(setState);
|
|
154
|
-
if (index > -1) {
|
|
155
|
-
listeners.splice(index, 1);
|
|
156
|
-
}
|
|
157
|
-
};
|
|
158
|
-
}, [state]);
|
|
159
51
|
return {
|
|
160
|
-
...state,
|
|
161
52
|
toast,
|
|
162
|
-
dismiss: (toastId) =>
|
|
53
|
+
dismiss: (toastId) => {
|
|
54
|
+
if (toastId !== undefined) {
|
|
55
|
+
sonner_1.toast.dismiss(toastId);
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
sonner_1.toast.dismiss();
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
toasts: []
|
|
163
62
|
};
|
|
164
63
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lerianstudio/sindarian-ui",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.43",
|
|
4
4
|
"description": "Sindarian UI - A UI library for Midaz Console",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": {
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@radix-ui/react-slot": "^1.2.4",
|
|
46
46
|
"@radix-ui/react-switch": "^1.2.6",
|
|
47
47
|
"@radix-ui/react-tabs": "^1.1.13",
|
|
48
|
-
"
|
|
48
|
+
"sonner": "^2.0.7",
|
|
49
49
|
"@radix-ui/react-tooltip": "^1.2.8",
|
|
50
50
|
"@tailwindcss/postcss": "^4.1.18",
|
|
51
51
|
"class-variance-authority": "^0.7.1",
|
package/dist/utilities.css
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/* Scrollbar — thin translucent thumb for scrollable layout containers */
|
|
2
|
-
@utility scrollbar-thin-translucent {
|
|
3
|
-
scrollbar-width: thin;
|
|
4
|
-
scrollbar-color: var(--color-shadcn-300) transparent;
|
|
5
|
-
|
|
6
|
-
&::-webkit-scrollbar {
|
|
7
|
-
width: 4px;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
&::-webkit-scrollbar-track {
|
|
11
|
-
background: transparent;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
&::-webkit-scrollbar-thumb {
|
|
15
|
-
background-color: var(--color-shadcn-300);
|
|
16
|
-
border-radius: 9999px;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
&::-webkit-scrollbar-thumb:hover {
|
|
20
|
-
background-color: var(--color-shadcn-400);
|
|
21
|
-
}
|
|
22
|
-
}
|