@avenue-ticketing/ui 0.12.0-beta.3 → 0.12.0-beta.5
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/react/toast.css +67 -0
- package/dist/react/toast.css.map +1 -0
- package/dist/react/toast.d.ts +116 -0
- package/dist/react/toast.js +620 -0
- package/dist/react/toast.js.map +1 -0
- package/package.json +2 -1
- package/theme.css +21 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/* ../../components/application/toast/toast.css */
|
|
2
|
+
[data-sonner-toast].avenue-toast {
|
|
3
|
+
display: grid !important;
|
|
4
|
+
grid-template-columns: auto minmax(0, 1fr);
|
|
5
|
+
align-items: start;
|
|
6
|
+
justify-items: start;
|
|
7
|
+
column-gap: 12px;
|
|
8
|
+
row-gap: 4px;
|
|
9
|
+
}
|
|
10
|
+
[data-sonner-toast].avenue-toast [data-icon] {
|
|
11
|
+
grid-column: 1;
|
|
12
|
+
grid-row: 1;
|
|
13
|
+
position: relative;
|
|
14
|
+
display: flex;
|
|
15
|
+
width: 20px;
|
|
16
|
+
min-width: 20px;
|
|
17
|
+
height: 24px;
|
|
18
|
+
align-items: center;
|
|
19
|
+
justify-content: flex-start;
|
|
20
|
+
align-self: start;
|
|
21
|
+
}
|
|
22
|
+
[data-sonner-toast].avenue-toast [data-content] {
|
|
23
|
+
grid-column: 2;
|
|
24
|
+
grid-row: 1;
|
|
25
|
+
min-width: 0;
|
|
26
|
+
text-align: left;
|
|
27
|
+
}
|
|
28
|
+
[data-sonner-toast].avenue-toast:not(:has([data-icon])) [data-content] {
|
|
29
|
+
grid-column: 1 / -1;
|
|
30
|
+
}
|
|
31
|
+
[data-sonner-toast].avenue-toast [data-title],
|
|
32
|
+
[data-sonner-toast].avenue-toast [data-description] {
|
|
33
|
+
text-align: left;
|
|
34
|
+
}
|
|
35
|
+
[data-sonner-toast].avenue-toast [data-toast-actions] {
|
|
36
|
+
grid-column: 1 / -1;
|
|
37
|
+
grid-row: 2;
|
|
38
|
+
display: flex;
|
|
39
|
+
flex-wrap: wrap;
|
|
40
|
+
align-items: center;
|
|
41
|
+
gap: 12px;
|
|
42
|
+
}
|
|
43
|
+
[data-sonner-toast].avenue-toast:has([data-icon]) [data-toast-actions] {
|
|
44
|
+
padding-left: 32px;
|
|
45
|
+
}
|
|
46
|
+
[data-sonner-toast].avenue-toast [data-toast-actions] button {
|
|
47
|
+
margin: 0;
|
|
48
|
+
}
|
|
49
|
+
[data-sonner-toast].avenue-toast:not([data-type=loading]) .sonner-loader,
|
|
50
|
+
[data-sonner-toast].avenue-toast:not([data-type=loading]) .sonner-loading-wrapper {
|
|
51
|
+
display: none !important;
|
|
52
|
+
}
|
|
53
|
+
[data-sonner-toast].avenue-toast[data-type=loading] .sonner-loader {
|
|
54
|
+
position: static !important;
|
|
55
|
+
top: auto !important;
|
|
56
|
+
left: auto !important;
|
|
57
|
+
transform: none !important;
|
|
58
|
+
}
|
|
59
|
+
[data-sonner-toast].avenue-toast[data-promise=true]:not([data-type=loading]) [data-icon] svg {
|
|
60
|
+
opacity: 1 !important;
|
|
61
|
+
transform: none !important;
|
|
62
|
+
animation: none !important;
|
|
63
|
+
}
|
|
64
|
+
[data-sonner-toast].avenue-toast[data-promise=true]:not([data-type=loading]) {
|
|
65
|
+
height: auto !important;
|
|
66
|
+
}
|
|
67
|
+
/*# sourceMappingURL=toast.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../components/application/toast/toast.css"],"sourcesContent":["/**\n * Sonner injects global styles even when `unstyled` is true. Layout + resets live here.\n */\n\n[data-sonner-toast].avenue-toast {\n display: grid !important;\n grid-template-columns: auto minmax(0, 1fr);\n align-items: start;\n justify-items: start;\n column-gap: 12px;\n row-gap: 4px;\n}\n\n[data-sonner-toast].avenue-toast [data-icon] {\n grid-column: 1;\n grid-row: 1;\n position: relative;\n display: flex;\n width: 20px;\n min-width: 20px;\n height: 24px;\n align-items: center;\n justify-content: flex-start;\n align-self: start;\n}\n\n[data-sonner-toast].avenue-toast [data-content] {\n grid-column: 2;\n grid-row: 1;\n min-width: 0;\n text-align: left;\n}\n\n[data-sonner-toast].avenue-toast:not(:has([data-icon])) [data-content] {\n grid-column: 1 / -1;\n}\n\n[data-sonner-toast].avenue-toast [data-title],\n[data-sonner-toast].avenue-toast [data-description] {\n text-align: left;\n}\n\n[data-sonner-toast].avenue-toast [data-toast-actions] {\n grid-column: 1 / -1;\n grid-row: 2;\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: 12px;\n}\n\n[data-sonner-toast].avenue-toast:has([data-icon]) [data-toast-actions] {\n padding-left: 32px;\n}\n\n[data-sonner-toast].avenue-toast [data-toast-actions] button {\n margin: 0;\n}\n\n/* Sonner keeps rendering .sonner-loader after promise resolve — hide it once loading ends. */\n[data-sonner-toast].avenue-toast:not([data-type=\"loading\"]) .sonner-loader,\n[data-sonner-toast].avenue-toast:not([data-type=\"loading\"]) .sonner-loading-wrapper {\n display: none !important;\n}\n\n/* Phosphor loader — undo Sonner's absolutely-centered .sonner-loader wrapper. */\n[data-sonner-toast].avenue-toast[data-type=\"loading\"] .sonner-loader {\n position: static !important;\n top: auto !important;\n left: auto !important;\n transform: none !important;\n}\n\n/* Promise toasts keep data-promise=true after resolve — show the success/error icon immediately. */\n[data-sonner-toast].avenue-toast[data-promise=\"true\"]:not([data-type=\"loading\"]) [data-icon] svg {\n opacity: 1 !important;\n transform: none !important;\n animation: none !important;\n}\n\n/* Let resolved promise toasts resize when the message changes. */\n[data-sonner-toast].avenue-toast[data-promise=\"true\"]:not([data-type=\"loading\"]) {\n height: auto !important;\n}\n"],"mappings":";AAIA,CAAC,kBAAkB,CAAC;AAChB,WAAS;AACT,yBAAuB,KAAK,OAAO,CAAC,EAAE;AACtC,eAAa;AACb,iBAAe;AACf,cAAY;AACZ,WAAS;AACb;AAEA,CAAC,kBAAkB,CATC,aASa,CAAC;AAC9B,eAAa;AACb,YAAU;AACV,YAAU;AACV,WAAS;AACT,SAAO;AACP,aAAW;AACX,UAAQ;AACR,eAAa;AACb,mBAAiB;AACjB,cAAY;AAChB;AAEA,CAAC,kBAAkB,CAtBC,aAsBa,CAAC;AAC9B,eAAa;AACb,YAAU;AACV,aAAW;AACX,cAAY;AAChB;AAEA,CAAC,kBAAkB,CA7BC,YA6BY,KAAK,KAAK,CAAC,aAAa,CAAC;AACrD,eAAa,EAAE,EAAE;AACrB;AAEA,CAAC,kBAAkB,CAjCC,aAiCa,CAAC;AAClC,CAAC,kBAAkB,CAlCC,aAkCa,CAAC;AAC9B,cAAY;AAChB;AAEA,CAAC,kBAAkB,CAtCC,aAsCa,CAAC;AAC9B,eAAa,EAAE,EAAE;AACjB,YAAU;AACV,WAAS;AACT,aAAW;AACX,eAAa;AACb,OAAK;AACT;AAEA,CAAC,kBAAkB,CA/CC,YA+CY,KAAK,CAAC,YAAY,CAAC;AAC/C,gBAAc;AAClB;AAEA,CAAC,kBAAkB,CAnDC,aAmDa,CAAC,oBAAoB;AAClD,UAAQ;AACZ;AAGA,CAAC,kBAAkB,CAxDC,YAwDY,KAAK,CAAC,oBAAsB,CAAC;AAC7D,CAAC,kBAAkB,CAzDC,YAyDY,KAAK,CAAC,oBAAsB,CAAC;AACzD,WAAS;AACb;AAGA,CAAC,kBAAkB,CA9DC,YA8DY,CAAC,mBAAqB,CANO;AAOzD,YAAU;AACV,OAAK;AACL,QAAM;AACN,aAAW;AACf;AAGA,CAAC,kBAAkB,CAtEC,YAsEY,CAAC,kBAAoB,KAAK,CAAC,oBAAsB,CAAC,WAAW;AACzF,WAAS;AACT,aAAW;AACX,aAAW;AACf;AAGA,CAAC,kBAAkB,CA7EC,YA6EY,CAAC,kBAAoB,KAAK,CAAC;AACvD,UAAQ;AACZ;","names":[]}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode, FC, ComponentProps, ReactElement } from 'react';
|
|
3
|
+
import { ExternalToast, Toaster as Toaster$1, ToastT, ToastToDismiss } from 'sonner';
|
|
4
|
+
|
|
5
|
+
type ToastColor = "default" | "neutral" | "brand" | "success" | "warning" | "error";
|
|
6
|
+
interface ToastProps {
|
|
7
|
+
/**
|
|
8
|
+
* Primary message shown in the toast.
|
|
9
|
+
*/
|
|
10
|
+
title: ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* Optional supporting text below the title.
|
|
13
|
+
*/
|
|
14
|
+
description?: ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* Semantic color variant for the toast surface and leading icon.
|
|
17
|
+
*
|
|
18
|
+
* @default "default"
|
|
19
|
+
*/
|
|
20
|
+
color?: ToastColor;
|
|
21
|
+
/**
|
|
22
|
+
* Custom leading icon. Pass `null` to hide the icon.
|
|
23
|
+
*/
|
|
24
|
+
icon?: FC<{
|
|
25
|
+
className?: string;
|
|
26
|
+
}> | ReactNode | null;
|
|
27
|
+
/**
|
|
28
|
+
* Custom action element. Overrides `actionLabel` / `onAction`.
|
|
29
|
+
*/
|
|
30
|
+
action?: ReactNode;
|
|
31
|
+
/**
|
|
32
|
+
* Label for the default action button.
|
|
33
|
+
*/
|
|
34
|
+
actionLabel?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Handler for the default action button.
|
|
37
|
+
*/
|
|
38
|
+
onAction?: () => void;
|
|
39
|
+
/**
|
|
40
|
+
* Called after the dismiss animation completes.
|
|
41
|
+
*/
|
|
42
|
+
onClose?: () => void;
|
|
43
|
+
/**
|
|
44
|
+
* Whether to show the dismiss control.
|
|
45
|
+
*
|
|
46
|
+
* @default true when `onClose` is provided
|
|
47
|
+
*/
|
|
48
|
+
showClose?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Auto-dismiss duration in milliseconds. Pass `null` to disable.
|
|
51
|
+
*
|
|
52
|
+
* @default 6000
|
|
53
|
+
*/
|
|
54
|
+
duration?: number | null;
|
|
55
|
+
/**
|
|
56
|
+
* Uses `role="alert"` instead of `role="status"`.
|
|
57
|
+
* Defaults to `true` for `error` and `warning` colors.
|
|
58
|
+
*/
|
|
59
|
+
isUrgent?: boolean;
|
|
60
|
+
className?: string;
|
|
61
|
+
}
|
|
62
|
+
declare const Toast: {
|
|
63
|
+
({ title, description, color, icon, action, actionLabel, onAction, onClose, showClose, duration, isUrgent, className, }: ToastProps): react.JSX.Element | null;
|
|
64
|
+
displayName: string;
|
|
65
|
+
};
|
|
66
|
+
interface ToastStackProps {
|
|
67
|
+
children: ReactNode;
|
|
68
|
+
className?: string;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Static layout helper for previewing multiple toasts in Storybook.
|
|
72
|
+
*/
|
|
73
|
+
declare const ToastStack: {
|
|
74
|
+
({ children, className }: ToastStackProps): react.JSX.Element;
|
|
75
|
+
displayName: string;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
type ToasterProps = Omit<ComponentProps<typeof Toaster$1>, "theme" | "richColors">;
|
|
79
|
+
/** Matches Sonner's `ExternalToast` — pass `action`, `cancel`, or JSX freely. */
|
|
80
|
+
type ToastOptions = ExternalToast;
|
|
81
|
+
type Title = ReactNode | (() => ReactNode);
|
|
82
|
+
type ToastId = string | number;
|
|
83
|
+
type ToastHandler = (message: Title, data?: ToastOptions) => ToastId;
|
|
84
|
+
type ToastPromiseData<T = unknown> = Omit<ExternalToast, "description"> & {
|
|
85
|
+
loading?: ReactNode;
|
|
86
|
+
success?: ReactNode | string | ((data: T) => ReactNode | string | Promise<ReactNode | string>);
|
|
87
|
+
error?: ReactNode | string | ((data: unknown) => ReactNode | string | Promise<ReactNode | string>);
|
|
88
|
+
description?: ReactNode | string | ((data: T) => ReactNode | string | Promise<ReactNode | string>);
|
|
89
|
+
finally?: () => void | Promise<void>;
|
|
90
|
+
};
|
|
91
|
+
type ToastPromiseReturn<T> = ToastId & {
|
|
92
|
+
unwrap: () => Promise<T>;
|
|
93
|
+
};
|
|
94
|
+
type AvenueToast = ToastHandler & {
|
|
95
|
+
success: ToastHandler;
|
|
96
|
+
info: ToastHandler;
|
|
97
|
+
warning: ToastHandler;
|
|
98
|
+
error: ToastHandler;
|
|
99
|
+
neutral: ToastHandler;
|
|
100
|
+
loading: ToastHandler;
|
|
101
|
+
promise: <T>(promise: Promise<T> | (() => Promise<T>), data?: ToastPromiseData<T>) => ToastPromiseReturn<T>;
|
|
102
|
+
custom: (jsx: (id: ToastId) => ReactElement, data?: ToastOptions) => ToastId;
|
|
103
|
+
dismiss: (id?: ToastId) => ToastId;
|
|
104
|
+
getHistory: () => (ToastT | ToastToDismiss)[];
|
|
105
|
+
getToasts: () => (ToastT | ToastToDismiss)[];
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Imperative toast API backed by Sonner. Matches the [`toast` API](https://sonner.emilkowal.ski/toast).
|
|
109
|
+
*/
|
|
110
|
+
declare const toast: AvenueToast;
|
|
111
|
+
declare const Toaster: {
|
|
112
|
+
({ toastOptions, className, icons, duration, closeButton, ...props }: ToasterProps): react.JSX.Element;
|
|
113
|
+
displayName: string;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
export { Toast, type ToastColor, type ToastOptions, type ToastProps, ToastStack, type ToastStackProps, Toaster, type ToasterProps, toast };
|
|
@@ -0,0 +1,620 @@
|
|
|
1
|
+
import { isValidElement, useState, useCallback, useEffect } from 'react';
|
|
2
|
+
import { CheckCircleIcon } from '@phosphor-icons/react/dist/csr/CheckCircle';
|
|
3
|
+
import { InfoIcon } from '@phosphor-icons/react/dist/csr/Info';
|
|
4
|
+
import { WarningCircleIcon } from '@phosphor-icons/react/dist/csr/WarningCircle';
|
|
5
|
+
import { XCircleIcon } from '@phosphor-icons/react/dist/csr/XCircle';
|
|
6
|
+
import { XIcon } from '@phosphor-icons/react/dist/csr/X';
|
|
7
|
+
import { Link, Button as Button$1 } from 'react-aria-components';
|
|
8
|
+
import { extendTailwindMerge } from 'tailwind-merge';
|
|
9
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
10
|
+
import { CircleNotchIcon } from '@phosphor-icons/react/dist/csr/CircleNotch';
|
|
11
|
+
import { toast as toast$1, Toaster as Toaster$1 } from 'sonner';
|
|
12
|
+
|
|
13
|
+
// ../../components/application/toast/toast.tsx
|
|
14
|
+
var twMerge = extendTailwindMerge({
|
|
15
|
+
extend: {
|
|
16
|
+
theme: {
|
|
17
|
+
text: ["display-xs", "display-sm", "display-md", "display-lg", "display-xl", "display-2xl"]
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
var cx = twMerge;
|
|
22
|
+
function sortCx(classes) {
|
|
23
|
+
return classes;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// ../../utils/is-react-component.ts
|
|
27
|
+
var isFunctionComponent = (component) => {
|
|
28
|
+
return typeof component === "function";
|
|
29
|
+
};
|
|
30
|
+
var isClassComponent = (component) => {
|
|
31
|
+
return typeof component === "function" && component.prototype && (!!component.prototype.isReactComponent || !!component.prototype.render);
|
|
32
|
+
};
|
|
33
|
+
var isForwardRefComponent = (component) => {
|
|
34
|
+
return typeof component === "object" && component !== null && component.$$typeof.toString() === "Symbol(react.forward_ref)";
|
|
35
|
+
};
|
|
36
|
+
var isReactComponent = (component) => {
|
|
37
|
+
return isFunctionComponent(component) || isForwardRefComponent(component) || isClassComponent(component);
|
|
38
|
+
};
|
|
39
|
+
var focusShadowPlain = "focus-visible:outline-none focus-visible:[box-shadow:0px_0px_0px_2px_var(--color-bg-primary),0px_0px_0px_4px_var(--color-focus-ring)]";
|
|
40
|
+
var focusShadowSkeuomorphic = "focus-visible:outline-none focus-visible:[box-shadow:var(--shadow-xs-skeuomorphic),0px_0px_0px_2px_var(--color-bg-primary),0px_0px_0px_4px_var(--color-focus-ring)]";
|
|
41
|
+
var skeuomorphicGradientBorderClass = [
|
|
42
|
+
"ring-1 ring-inset ring-transparent",
|
|
43
|
+
"before:pointer-events-none before:absolute before:inset-px before:rounded-[inherit] before:border before:border-[#ffffff1f] before:content-['']",
|
|
44
|
+
"before:[mask-image:linear-gradient(to_bottom,#000,transparent)]"
|
|
45
|
+
].join(" ");
|
|
46
|
+
var skeuomorphicShadowClass = ["shadow-xs-skeuomorphic", focusShadowSkeuomorphic, "overflow-hidden"].join(" ");
|
|
47
|
+
var focusShadowSecondary = "focus-visible:outline-none focus-visible:[box-shadow:0px_1px_2px_0px_rgba(0,0,0,0.05),0px_0px_0px_2px_var(--color-bg-primary),0px_0px_0px_4px_var(--color-focus-ring)]";
|
|
48
|
+
var secondaryInnerShadow = "after:pointer-events-none after:absolute after:inset-0 after:rounded-[inherit] after:content-[''] after:[box-shadow:inset_0px_-1px_0px_0px_rgba(0,0,0,0.05)]";
|
|
49
|
+
var secondaryShadowClass = ["relative overflow-hidden shadow-xs", secondaryInnerShadow, focusShadowSecondary].join(" ");
|
|
50
|
+
var inputNumberButtonClass = [
|
|
51
|
+
"in-data-number-input:border-0 in-data-number-input:shadow-none in-data-number-input:!rounded-none in-data-number-input:!h-full in-data-number-input:!min-h-0 in-data-number-input:self-stretch in-data-number-input:overflow-hidden",
|
|
52
|
+
"in-data-number-input:before:hidden in-data-number-input:after:hidden",
|
|
53
|
+
"in-data-number-input:focus-visible:outline-none in-data-number-input:focus-visible:shadow-none in-data-number-input:focus-visible:ring-0 in-data-number-input:focus-visible:![box-shadow:none]"
|
|
54
|
+
].join(" ");
|
|
55
|
+
var inputAddonButtonClass = [
|
|
56
|
+
"in-data-input-wrapper:border-0 in-data-input-wrapper:shadow-none in-data-input-wrapper:!rounded-none in-data-input-wrapper:overflow-hidden",
|
|
57
|
+
"in-data-input-wrapper:in-data-trailing:border-l in-data-input-wrapper:in-data-trailing:border-solid in-data-input-wrapper:in-data-trailing:border-primary",
|
|
58
|
+
"in-data-input-wrapper:in-data-leading:border-r in-data-input-wrapper:in-data-leading:border-solid in-data-input-wrapper:in-data-leading:border-primary",
|
|
59
|
+
"in-data-input-wrapper:group-invalid:in-data-trailing:border-error_subtle in-data-input-wrapper:group-invalid:in-data-leading:border-error_subtle",
|
|
60
|
+
"in-data-input-wrapper:before:hidden in-data-input-wrapper:after:hidden",
|
|
61
|
+
"in-data-input-wrapper:focus-visible:outline-none in-data-input-wrapper:focus-visible:shadow-none in-data-input-wrapper:focus-visible:ring-0 in-data-input-wrapper:focus-visible:![box-shadow:none]"
|
|
62
|
+
].join(" ");
|
|
63
|
+
var styles = sortCx({
|
|
64
|
+
common: {
|
|
65
|
+
root: [
|
|
66
|
+
"group relative inline-flex shrink-0 cursor-pointer items-center justify-center whitespace-nowrap rounded-full font-body outline-none before:absolute",
|
|
67
|
+
"font-semibold transition-[color,background-color,border-color,box-shadow,opacity,transform] duration-150 ease-out",
|
|
68
|
+
"pressed:scale-[0.985] pressed:duration-100 pressed:ease-linear motion-reduce:pressed:scale-100",
|
|
69
|
+
"disabled:pointer-events-none disabled:cursor-not-allowed in-data-input-wrapper:disabled:opacity-100",
|
|
70
|
+
inputAddonButtonClass,
|
|
71
|
+
inputNumberButtonClass,
|
|
72
|
+
// Stretch to InputGroup row height; padding/typography follow `data-input-size` on the field (Figma 85:1269).
|
|
73
|
+
"in-data-input-wrapper:!h-full in-data-input-wrapper:!min-h-0 in-data-input-wrapper:self-stretch",
|
|
74
|
+
"in-data-input-wrapper:in-data-[input-size=sm]:gap-1 in-data-input-wrapper:in-data-[input-size=sm]:px-3 in-data-input-wrapper:in-data-[input-size=sm]:py-2 in-data-input-wrapper:in-data-[input-size=sm]:text-sm",
|
|
75
|
+
"in-data-input-wrapper:in-data-[input-size=md]:gap-1 in-data-input-wrapper:in-data-[input-size=md]:px-3.5 in-data-input-wrapper:in-data-[input-size=md]:py-2.5 in-data-input-wrapper:in-data-[input-size=md]:text-sm",
|
|
76
|
+
"in-data-input-wrapper:in-data-[input-size=lg]:gap-1.5 in-data-input-wrapper:in-data-[input-size=lg]:px-4 in-data-input-wrapper:in-data-[input-size=lg]:py-2.5 in-data-input-wrapper:in-data-[input-size=lg]:text-md",
|
|
77
|
+
"*:data-icon:pointer-events-none *:data-icon:shrink-0 *:data-icon:transition-inherit-all"
|
|
78
|
+
].join(" "),
|
|
79
|
+
icon: "pointer-events-none shrink-0 transition-inherit-all"
|
|
80
|
+
},
|
|
81
|
+
sizes: {
|
|
82
|
+
xs: {
|
|
83
|
+
root: [
|
|
84
|
+
"h-8 min-h-8 gap-1 px-[0.625rem] py-1.5 text-sm data-icon-only:size-8 data-icon-only:min-h-8 data-icon-only:min-w-8 data-icon-only:p-2",
|
|
85
|
+
"in-data-input-wrapper:data-icon-only:p-2.5",
|
|
86
|
+
"*:data-icon:size-4"
|
|
87
|
+
].join(" "),
|
|
88
|
+
linkRoot: "h-auto min-h-0 gap-1 px-0! py-0! text-sm *:data-text:underline-offset-3"
|
|
89
|
+
},
|
|
90
|
+
sm: {
|
|
91
|
+
root: [
|
|
92
|
+
"h-9 min-h-9 gap-1 px-3 py-2 text-sm data-icon-only:size-9 data-icon-only:min-h-9 data-icon-only:min-w-9 data-icon-only:p-2",
|
|
93
|
+
"in-data-input-wrapper:data-icon-only:p-2.5",
|
|
94
|
+
"*:data-icon:size-5"
|
|
95
|
+
].join(" "),
|
|
96
|
+
linkRoot: "h-auto min-h-0 gap-1 px-0! py-0! text-sm *:data-text:underline-offset-3"
|
|
97
|
+
},
|
|
98
|
+
md: {
|
|
99
|
+
root: [
|
|
100
|
+
"h-10 min-h-10 gap-1 px-3.5 py-2.5 text-sm data-icon-only:size-10 data-icon-only:min-h-10 data-icon-only:min-w-10 data-icon-only:p-2.5",
|
|
101
|
+
"in-data-input-wrapper:data-icon-only:p-3",
|
|
102
|
+
"*:data-icon:size-5"
|
|
103
|
+
].join(" "),
|
|
104
|
+
linkRoot: "h-auto min-h-0 gap-1 px-0! py-0! text-sm *:data-text:underline-offset-4"
|
|
105
|
+
},
|
|
106
|
+
lg: {
|
|
107
|
+
root: "h-11 min-h-11 gap-1.5 px-4 py-2.5 text-md data-icon-only:size-11 data-icon-only:min-h-11 data-icon-only:min-w-11 data-icon-only:p-3 *:data-icon:size-5",
|
|
108
|
+
linkRoot: "h-auto min-h-0 gap-1.5 px-0! py-0! text-md *:data-text:underline-offset-4"
|
|
109
|
+
},
|
|
110
|
+
xl: {
|
|
111
|
+
root: "h-12 min-h-12 gap-1.5 px-[1.125rem] py-3 text-md data-icon-only:size-12 data-icon-only:min-h-12 data-icon-only:min-w-12 data-icon-only:p-3 data-icon-only:*:data-icon:size-6 *:data-icon:size-5",
|
|
112
|
+
linkRoot: "h-auto min-h-0 gap-1.5 px-0! py-0! text-md *:data-text:underline-offset-4"
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
colors: {
|
|
116
|
+
/** Figma Hierarchy=Primary — dark neutral solid; hover lightens to fg-tertiary_hover (#404040). */
|
|
117
|
+
primary: {
|
|
118
|
+
root: [
|
|
119
|
+
"bg-primary-solid text-white",
|
|
120
|
+
skeuomorphicShadowClass,
|
|
121
|
+
skeuomorphicGradientBorderClass,
|
|
122
|
+
"hover:bg-fg-tertiary_hover dark:hover:bg-quaternary",
|
|
123
|
+
"disabled:opacity-30",
|
|
124
|
+
"data-loading:bg-fg-tertiary_hover dark:data-loading:bg-quaternary",
|
|
125
|
+
"*:data-icon:not([data-icon=loading]):text-white/70"
|
|
126
|
+
].join(" ")
|
|
127
|
+
},
|
|
128
|
+
/** Figma Hierarchy=Brand — purple solid; hover darkens to bg-brand-solid_hover (#6d28d9). */
|
|
129
|
+
brand: {
|
|
130
|
+
root: [
|
|
131
|
+
"bg-brand-solid text-primary_on-brand",
|
|
132
|
+
skeuomorphicShadowClass,
|
|
133
|
+
skeuomorphicGradientBorderClass,
|
|
134
|
+
"hover:bg-brand-solid_hover",
|
|
135
|
+
"disabled:opacity-50",
|
|
136
|
+
"data-loading:bg-brand-solid_hover",
|
|
137
|
+
"*:data-icon:not([data-icon=loading]):text-primary_on-brand"
|
|
138
|
+
].join(" ")
|
|
139
|
+
},
|
|
140
|
+
/** Figma Hierarchy=Secondary — border-primary + shadow-xs + skeuomorphic inner rim overlay. */
|
|
141
|
+
secondary: {
|
|
142
|
+
root: [
|
|
143
|
+
"border border-solid border-primary bg-primary text-secondary",
|
|
144
|
+
secondaryShadowClass,
|
|
145
|
+
"hover:bg-primary_hover hover:text-secondary_hover",
|
|
146
|
+
"disabled:opacity-50",
|
|
147
|
+
"data-loading:bg-primary_hover",
|
|
148
|
+
"*:data-icon:text-fg-secondary"
|
|
149
|
+
].join(" ")
|
|
150
|
+
},
|
|
151
|
+
/** Figma Hierarchy=Tertiary */
|
|
152
|
+
tertiary: {
|
|
153
|
+
root: [
|
|
154
|
+
"border border-transparent bg-transparent text-tertiary",
|
|
155
|
+
focusShadowPlain,
|
|
156
|
+
"hover:bg-primary_hover hover:text-tertiary_hover",
|
|
157
|
+
"disabled:opacity-50",
|
|
158
|
+
"*:data-icon:text-fg-tertiary"
|
|
159
|
+
].join(" ")
|
|
160
|
+
},
|
|
161
|
+
/** Figma Hierarchy=Link color — text + icons share brand-secondary; hover underlines with fg-brand-secondary. */
|
|
162
|
+
"link-color": {
|
|
163
|
+
root: [
|
|
164
|
+
"h-auto min-h-0 border-0 bg-transparent px-0! py-0! text-brand-secondary shadow-none",
|
|
165
|
+
focusShadowPlain,
|
|
166
|
+
"hover:text-brand-secondary_hover",
|
|
167
|
+
"disabled:opacity-50",
|
|
168
|
+
"*:data-text:underline *:data-text:decoration-transparent *:data-text:decoration-solid hover:*:data-text:decoration-fg-brand-secondary"
|
|
169
|
+
].join(" ")
|
|
170
|
+
},
|
|
171
|
+
/** Figma Hierarchy=Link gray — text + icons share tertiary; hover underlines with fg-quaternary. */
|
|
172
|
+
"link-gray": {
|
|
173
|
+
root: [
|
|
174
|
+
"h-auto min-h-0 border-0 bg-transparent px-0! py-0! text-tertiary shadow-none",
|
|
175
|
+
focusShadowPlain,
|
|
176
|
+
"hover:text-tertiary_hover",
|
|
177
|
+
"disabled:opacity-50",
|
|
178
|
+
"*:data-text:underline *:data-text:decoration-transparent *:data-text:decoration-solid hover:*:data-text:decoration-fg-quaternary"
|
|
179
|
+
].join(" ")
|
|
180
|
+
},
|
|
181
|
+
"primary-destructive": {
|
|
182
|
+
root: [
|
|
183
|
+
"bg-error-solid text-white",
|
|
184
|
+
skeuomorphicShadowClass,
|
|
185
|
+
skeuomorphicGradientBorderClass,
|
|
186
|
+
"hover:bg-error-solid_hover",
|
|
187
|
+
"disabled:opacity-50",
|
|
188
|
+
"data-loading:bg-error-solid_hover",
|
|
189
|
+
"*:data-icon:not([data-icon=loading]):text-white/70"
|
|
190
|
+
].join(" ")
|
|
191
|
+
},
|
|
192
|
+
"secondary-destructive": {
|
|
193
|
+
root: [
|
|
194
|
+
"border border-solid border-primary bg-primary text-error-primary",
|
|
195
|
+
secondaryShadowClass,
|
|
196
|
+
"hover:bg-error-primary hover:text-error-primary_hover",
|
|
197
|
+
"disabled:opacity-50",
|
|
198
|
+
"data-loading:bg-error-primary",
|
|
199
|
+
"*:data-icon:text-fg-error-secondary hover:*:data-icon:text-fg-error-primary"
|
|
200
|
+
].join(" ")
|
|
201
|
+
},
|
|
202
|
+
"tertiary-destructive": {
|
|
203
|
+
root: [
|
|
204
|
+
"border border-transparent bg-transparent text-error-primary",
|
|
205
|
+
focusShadowPlain,
|
|
206
|
+
"hover:bg-error-primary hover:text-error-primary_hover",
|
|
207
|
+
"disabled:opacity-50",
|
|
208
|
+
"*:data-icon:text-fg-error-secondary hover:*:data-icon:text-fg-error-primary"
|
|
209
|
+
].join(" ")
|
|
210
|
+
},
|
|
211
|
+
/** Figma Hierarchy=Link (destructive) — text + icons share error-primary; hover underlines. */
|
|
212
|
+
"link-destructive": {
|
|
213
|
+
root: [
|
|
214
|
+
"h-auto min-h-0 border-0 bg-transparent px-0! py-0! text-error-primary shadow-none",
|
|
215
|
+
focusShadowPlain,
|
|
216
|
+
"hover:text-error-primary_hover",
|
|
217
|
+
"disabled:opacity-50",
|
|
218
|
+
"*:data-text:underline *:data-text:decoration-transparent *:data-text:decoration-solid hover:*:data-text:decoration-current"
|
|
219
|
+
].join(" ")
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
var Button = ({
|
|
224
|
+
size = "md",
|
|
225
|
+
color = "primary",
|
|
226
|
+
children,
|
|
227
|
+
className,
|
|
228
|
+
noTextPadding,
|
|
229
|
+
iconLeading: IconLeading,
|
|
230
|
+
iconTrailing: IconTrailing,
|
|
231
|
+
isDisabled: disabled,
|
|
232
|
+
isLoading: loading,
|
|
233
|
+
showTextWhileLoading,
|
|
234
|
+
...props
|
|
235
|
+
}) => {
|
|
236
|
+
const href = "href" in props ? props.href : void 0;
|
|
237
|
+
const isIcon = (IconLeading || IconTrailing) && !children;
|
|
238
|
+
const isLinkType = ["link-gray", "link-color", "link-destructive"].includes(color);
|
|
239
|
+
noTextPadding = isLinkType || noTextPadding;
|
|
240
|
+
const commonChildren = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
241
|
+
isValidElement(IconLeading) && IconLeading,
|
|
242
|
+
isReactComponent(IconLeading) && /* @__PURE__ */ jsx(IconLeading, { "data-icon": "leading", className: styles.common.icon }),
|
|
243
|
+
loading && /* @__PURE__ */ jsx(
|
|
244
|
+
"svg",
|
|
245
|
+
{
|
|
246
|
+
fill: "none",
|
|
247
|
+
"data-icon": "loading",
|
|
248
|
+
viewBox: "0 0 256 256",
|
|
249
|
+
"aria-hidden": true,
|
|
250
|
+
className: cx(
|
|
251
|
+
styles.common.icon,
|
|
252
|
+
"size-5 animate-spin",
|
|
253
|
+
!showTextWhileLoading && "absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2"
|
|
254
|
+
),
|
|
255
|
+
children: /* @__PURE__ */ jsx(
|
|
256
|
+
"path",
|
|
257
|
+
{
|
|
258
|
+
fill: "currentColor",
|
|
259
|
+
d: "M232,128a104,104,0,0,1-208,0c0-41,23.81-78.36,60.66-95.27a8,8,0,0,1,6.68,14.54C60,61.46,40,93.27,40,128a88,88,0,0,0,176,0c0-34.73-20-66.54-51.34-80.73a8,8,0,0,1,6.68-14.54C208.19,49.64,232,87,232,128Z"
|
|
260
|
+
}
|
|
261
|
+
)
|
|
262
|
+
}
|
|
263
|
+
),
|
|
264
|
+
children && /* @__PURE__ */ jsx("span", { "data-text": true, className: cx("transition-inherit-all", !noTextPadding && !isLinkType && "px-0.5"), children }),
|
|
265
|
+
isValidElement(IconTrailing) && IconTrailing,
|
|
266
|
+
isReactComponent(IconTrailing) && /* @__PURE__ */ jsx(IconTrailing, { "data-icon": "trailing", className: styles.common.icon })
|
|
267
|
+
] });
|
|
268
|
+
const commonProps = {
|
|
269
|
+
"data-icon-only": isIcon ? true : void 0,
|
|
270
|
+
"data-loading": loading ? true : void 0,
|
|
271
|
+
...props,
|
|
272
|
+
isDisabled: disabled || loading,
|
|
273
|
+
className: cx(
|
|
274
|
+
styles.common.root,
|
|
275
|
+
styles.sizes[size].root,
|
|
276
|
+
styles.colors[color].root,
|
|
277
|
+
isLinkType && styles.sizes[size].linkRoot,
|
|
278
|
+
(loading || href && (disabled || loading)) && "pointer-events-none",
|
|
279
|
+
loading && (showTextWhileLoading ? "[&>*:not([data-icon=loading]):not([data-text])]:hidden" : "[&>*:not([data-icon=loading])]:invisible"),
|
|
280
|
+
className
|
|
281
|
+
),
|
|
282
|
+
children: commonChildren
|
|
283
|
+
};
|
|
284
|
+
if ("href" in commonProps) {
|
|
285
|
+
return /* @__PURE__ */ jsx(Link, { ...commonProps, href: disabled || loading ? void 0 : href });
|
|
286
|
+
}
|
|
287
|
+
return /* @__PURE__ */ jsx(Button$1, { ...commonProps, type: commonProps.type || "button", isPending: loading });
|
|
288
|
+
};
|
|
289
|
+
var DEFAULT_TOAST_DURATION_MS = 6e3;
|
|
290
|
+
var defaultIcons = {
|
|
291
|
+
default: InfoIcon,
|
|
292
|
+
neutral: InfoIcon,
|
|
293
|
+
brand: InfoIcon,
|
|
294
|
+
success: CheckCircleIcon,
|
|
295
|
+
warning: WarningCircleIcon,
|
|
296
|
+
error: XCircleIcon
|
|
297
|
+
};
|
|
298
|
+
var variantStyles = sortCx({
|
|
299
|
+
default: {
|
|
300
|
+
root: "border-white/10 bg-primary-solid dark:border-secondary dark:bg-utility-neutral-900",
|
|
301
|
+
title: "text-white dark:text-utility-neutral-50",
|
|
302
|
+
description: "text-white dark:text-utility-neutral-200",
|
|
303
|
+
icon: "text-fg-white dark:text-utility-neutral-50"
|
|
304
|
+
},
|
|
305
|
+
neutral: {
|
|
306
|
+
root: "border-white/10 bg-secondary-solid",
|
|
307
|
+
title: "text-white",
|
|
308
|
+
description: "text-white",
|
|
309
|
+
icon: "text-fg-white"
|
|
310
|
+
},
|
|
311
|
+
brand: {
|
|
312
|
+
root: "border-white/10 bg-brand-solid",
|
|
313
|
+
title: "text-white",
|
|
314
|
+
description: "text-white",
|
|
315
|
+
icon: "text-fg-white"
|
|
316
|
+
},
|
|
317
|
+
success: {
|
|
318
|
+
root: "border-white/10 bg-success-solid",
|
|
319
|
+
title: "text-white",
|
|
320
|
+
description: "text-white",
|
|
321
|
+
icon: "text-fg-white"
|
|
322
|
+
},
|
|
323
|
+
warning: {
|
|
324
|
+
root: "border-white/10 bg-warning-solid",
|
|
325
|
+
title: "text-white",
|
|
326
|
+
description: "text-white",
|
|
327
|
+
icon: "text-fg-white"
|
|
328
|
+
},
|
|
329
|
+
error: {
|
|
330
|
+
root: "border-white/10 bg-error-solid",
|
|
331
|
+
title: "text-white",
|
|
332
|
+
description: "text-white",
|
|
333
|
+
icon: "text-fg-white"
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
var toastActionLinkClassName = cx(
|
|
337
|
+
"text-white! hover:text-white/80! *:data-text:no-underline! hover:*:data-text:underline! hover:*:data-text:decoration-white/80",
|
|
338
|
+
"group-data-[type=default]/toast:dark:text-utility-neutral-50! group-data-[type=loading]/toast:dark:text-utility-neutral-50!",
|
|
339
|
+
"group-data-[type=default]/toast:dark:hover:text-utility-neutral-200! group-data-[type=loading]/toast:dark:hover:text-utility-neutral-200!",
|
|
340
|
+
"group-data-[type=default]/toast:dark:hover:*:data-text:decoration-utility-neutral-200! group-data-[type=loading]/toast:dark:hover:*:data-text:decoration-utility-neutral-200!"
|
|
341
|
+
);
|
|
342
|
+
var dismissButtonClassName = cx(
|
|
343
|
+
"relative z-20 flex size-9 shrink-0 cursor-pointer items-center justify-center rounded-full border-0 bg-transparent shadow-none",
|
|
344
|
+
"text-fg-white [&_svg]:opacity-70",
|
|
345
|
+
"transition duration-100 ease-linear",
|
|
346
|
+
"hover:bg-white/20 hover:[&_svg]:opacity-100",
|
|
347
|
+
"active:scale-[0.96]",
|
|
348
|
+
"focus-visible:outline-none focus-visible:[box-shadow:0px_0px_0px_2px_var(--color-bg-primary),0px_0px_0px_4px_var(--color-focus-ring)]",
|
|
349
|
+
"group-data-[type=default]/toast:dark:text-fg-quaternary group-data-[type=default]/toast:dark:[&_svg]:opacity-70",
|
|
350
|
+
"group-data-[type=default]/toast:dark:hover:bg-utility-neutral-800 group-data-[type=default]/toast:dark:hover:text-fg-quaternary_hover group-data-[type=default]/toast:dark:hover:[&_svg]:opacity-100",
|
|
351
|
+
"group-data-[type=loading]/toast:dark:text-fg-quaternary group-data-[type=loading]/toast:dark:[&_svg]:opacity-70",
|
|
352
|
+
"group-data-[type=loading]/toast:dark:hover:bg-utility-neutral-800 group-data-[type=loading]/toast:dark:hover:text-fg-quaternary_hover group-data-[type=loading]/toast:dark:hover:[&_svg]:opacity-100"
|
|
353
|
+
);
|
|
354
|
+
var Toast = ({
|
|
355
|
+
title,
|
|
356
|
+
description,
|
|
357
|
+
color = "default",
|
|
358
|
+
icon,
|
|
359
|
+
action,
|
|
360
|
+
actionLabel,
|
|
361
|
+
onAction,
|
|
362
|
+
onClose,
|
|
363
|
+
showClose = Boolean(onClose),
|
|
364
|
+
duration = DEFAULT_TOAST_DURATION_MS,
|
|
365
|
+
isUrgent,
|
|
366
|
+
className
|
|
367
|
+
}) => {
|
|
368
|
+
const styles2 = variantStyles[color];
|
|
369
|
+
const resolvedIcon = icon === null ? null : icon ?? defaultIcons[color];
|
|
370
|
+
const hasAction = Boolean(action || actionLabel);
|
|
371
|
+
const hasIcon = resolvedIcon != null;
|
|
372
|
+
const role = isUrgent ?? (color === "error" || color === "warning") ? "alert" : "status";
|
|
373
|
+
const [isVisible, setIsVisible] = useState(true);
|
|
374
|
+
const dismiss = useCallback(() => {
|
|
375
|
+
setIsVisible(false);
|
|
376
|
+
onClose?.();
|
|
377
|
+
}, [onClose]);
|
|
378
|
+
useEffect(() => {
|
|
379
|
+
if (duration == null || duration <= 0 || !isVisible) return;
|
|
380
|
+
const timer = window.setTimeout(dismiss, duration);
|
|
381
|
+
return () => window.clearTimeout(timer);
|
|
382
|
+
}, [duration, dismiss, isVisible]);
|
|
383
|
+
const renderIcon = () => {
|
|
384
|
+
if (!hasIcon) return null;
|
|
385
|
+
const Icon = isReactComponent(resolvedIcon) ? resolvedIcon : null;
|
|
386
|
+
if (Icon) {
|
|
387
|
+
return /* @__PURE__ */ jsx(Icon, { "data-icon": true, className: cx("size-5 shrink-0", styles2.icon), "aria-hidden": "true" });
|
|
388
|
+
}
|
|
389
|
+
if (isValidElement(resolvedIcon)) {
|
|
390
|
+
return resolvedIcon;
|
|
391
|
+
}
|
|
392
|
+
return null;
|
|
393
|
+
};
|
|
394
|
+
const renderCloseButton = () => {
|
|
395
|
+
if (!showClose) return null;
|
|
396
|
+
return /* @__PURE__ */ jsxs(
|
|
397
|
+
"button",
|
|
398
|
+
{
|
|
399
|
+
type: "button",
|
|
400
|
+
"aria-label": "Close",
|
|
401
|
+
className: cx(
|
|
402
|
+
dismissButtonClassName,
|
|
403
|
+
color === "default" && "dark:text-fg-quaternary dark:[&_svg]:opacity-70 dark:hover:bg-utility-neutral-800 dark:hover:text-fg-quaternary_hover dark:hover:[&_svg]:opacity-100",
|
|
404
|
+
"absolute top-2.5 right-2"
|
|
405
|
+
),
|
|
406
|
+
onClick: dismiss,
|
|
407
|
+
children: [
|
|
408
|
+
/* @__PURE__ */ jsx(XIcon, { className: "size-5", "aria-hidden": "true" }),
|
|
409
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
|
|
410
|
+
]
|
|
411
|
+
}
|
|
412
|
+
);
|
|
413
|
+
};
|
|
414
|
+
if (!isVisible) return null;
|
|
415
|
+
return /* @__PURE__ */ jsxs(
|
|
416
|
+
"div",
|
|
417
|
+
{
|
|
418
|
+
role,
|
|
419
|
+
"aria-live": role === "alert" ? "assertive" : "polite",
|
|
420
|
+
className: cx(
|
|
421
|
+
"relative w-full max-w-100 rounded-xl border p-4 shadow-md",
|
|
422
|
+
!hasIcon && "pl-5",
|
|
423
|
+
styles2.root,
|
|
424
|
+
className
|
|
425
|
+
),
|
|
426
|
+
children: [
|
|
427
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 gap-3", children: [
|
|
428
|
+
hasIcon && /* @__PURE__ */ jsx("div", { className: "flex h-6 shrink-0 items-center self-start", children: renderIcon() }),
|
|
429
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
|
|
430
|
+
/* @__PURE__ */ jsx("p", { className: cx("text-md font-semibold", styles2.title), children: title }),
|
|
431
|
+
description && /* @__PURE__ */ jsx("p", { className: cx("text-sm", styles2.description), children: description }),
|
|
432
|
+
hasAction && /* @__PURE__ */ jsx("div", { className: "mt-1", children: action ?? /* @__PURE__ */ jsx(
|
|
433
|
+
Button,
|
|
434
|
+
{
|
|
435
|
+
color: "link-gray",
|
|
436
|
+
size: "sm",
|
|
437
|
+
className: cx(
|
|
438
|
+
toastActionLinkClassName,
|
|
439
|
+
color === "default" && "dark:text-utility-neutral-50! dark:hover:text-utility-neutral-200! dark:hover:*:data-text:decoration-utility-neutral-200!"
|
|
440
|
+
),
|
|
441
|
+
onPress: onAction,
|
|
442
|
+
children: actionLabel
|
|
443
|
+
}
|
|
444
|
+
) })
|
|
445
|
+
] })
|
|
446
|
+
] }),
|
|
447
|
+
renderCloseButton()
|
|
448
|
+
]
|
|
449
|
+
}
|
|
450
|
+
);
|
|
451
|
+
};
|
|
452
|
+
Toast.displayName = "Toast";
|
|
453
|
+
var ToastStack = ({ children, className }) => {
|
|
454
|
+
return /* @__PURE__ */ jsx("div", { className: cx("flex w-full max-w-100 flex-col gap-3 overflow-hidden", className), role: "presentation", children });
|
|
455
|
+
};
|
|
456
|
+
ToastStack.displayName = "ToastStack";
|
|
457
|
+
var DEFAULT_TOAST_DURATION_MS2 = 6e3;
|
|
458
|
+
var isAction = (value) => {
|
|
459
|
+
return typeof value === "object" && value !== null && !isValidElement(value) && "label" in value && "onClick" in value;
|
|
460
|
+
};
|
|
461
|
+
var withDefaultType = (data) => {
|
|
462
|
+
return {
|
|
463
|
+
...data,
|
|
464
|
+
type: "default",
|
|
465
|
+
className: cx("bg-primary-solid dark:border-secondary dark:bg-utility-neutral-900", data?.className)
|
|
466
|
+
};
|
|
467
|
+
};
|
|
468
|
+
var createActionClickEvent = () => {
|
|
469
|
+
let defaultPrevented = false;
|
|
470
|
+
return {
|
|
471
|
+
preventDefault: () => {
|
|
472
|
+
defaultPrevented = true;
|
|
473
|
+
},
|
|
474
|
+
get defaultPrevented() {
|
|
475
|
+
return defaultPrevented;
|
|
476
|
+
}
|
|
477
|
+
};
|
|
478
|
+
};
|
|
479
|
+
var renderNativeActionButton = (action, onPress) => /* @__PURE__ */ jsx(Button, { color: "link-gray", size: "sm", className: toastActionLinkClassName, onPress, children: action.label });
|
|
480
|
+
var wrapToastFooter = (options = {}) => {
|
|
481
|
+
const nativeAction = isAction(options.action) ? options.action : null;
|
|
482
|
+
const nativeCancel = isAction(options.cancel) ? options.cancel : null;
|
|
483
|
+
const customAction = options.action && isValidElement(options.action) ? options.action : null;
|
|
484
|
+
if (!nativeAction && !nativeCancel && !customAction) {
|
|
485
|
+
return options;
|
|
486
|
+
}
|
|
487
|
+
if (customAction) {
|
|
488
|
+
if (customAction.props && typeof customAction.props === "object" && "data-toast-actions" in customAction.props) {
|
|
489
|
+
return { ...options, cancel: void 0 };
|
|
490
|
+
}
|
|
491
|
+
return {
|
|
492
|
+
...options,
|
|
493
|
+
cancel: void 0,
|
|
494
|
+
action: /* @__PURE__ */ jsx("div", { "data-toast-actions": true, className: "flex flex-wrap items-center gap-3", children: customAction })
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
const id = options.id ?? `toast-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
|
|
498
|
+
return {
|
|
499
|
+
...options,
|
|
500
|
+
id,
|
|
501
|
+
cancel: void 0,
|
|
502
|
+
action: /* @__PURE__ */ jsxs("div", { "data-toast-actions": true, className: "flex flex-wrap items-center gap-3", children: [
|
|
503
|
+
nativeCancel && renderNativeActionButton(nativeCancel, () => {
|
|
504
|
+
nativeCancel.onClick(createActionClickEvent());
|
|
505
|
+
toast$1.dismiss(id);
|
|
506
|
+
}),
|
|
507
|
+
nativeAction && renderNativeActionButton(nativeAction, () => {
|
|
508
|
+
const event = createActionClickEvent();
|
|
509
|
+
nativeAction.onClick(event);
|
|
510
|
+
if (!event.defaultPrevented) {
|
|
511
|
+
toast$1.dismiss(id);
|
|
512
|
+
}
|
|
513
|
+
})
|
|
514
|
+
] })
|
|
515
|
+
};
|
|
516
|
+
};
|
|
517
|
+
var mapToastOptions = (data, config) => {
|
|
518
|
+
let options;
|
|
519
|
+
if (config?.variant === "neutral") {
|
|
520
|
+
options = {
|
|
521
|
+
...data,
|
|
522
|
+
className: cx("!border-white/10 !bg-secondary-solid", data?.className),
|
|
523
|
+
classNames: {
|
|
524
|
+
toast: "!border-white/10 !bg-secondary-solid",
|
|
525
|
+
title: "!text-white",
|
|
526
|
+
description: "!text-white",
|
|
527
|
+
icon: "!text-fg-white",
|
|
528
|
+
...data?.classNames
|
|
529
|
+
},
|
|
530
|
+
icon: data?.icon === void 0 ? /* @__PURE__ */ jsx(InfoIcon, { "aria-hidden": "true", className: "size-5 shrink-0 text-fg-white" }) : data.icon
|
|
531
|
+
};
|
|
532
|
+
} else {
|
|
533
|
+
options = withDefaultType(data);
|
|
534
|
+
}
|
|
535
|
+
return wrapToastFooter(options);
|
|
536
|
+
};
|
|
537
|
+
var resolveTitle = (message) => typeof message === "function" ? message() : message;
|
|
538
|
+
var toastPromise = (promise, data) => toast$1.promise(promise, data);
|
|
539
|
+
var toast = Object.assign(
|
|
540
|
+
(message, data) => toast$1(resolveTitle(message), mapToastOptions(data)),
|
|
541
|
+
{
|
|
542
|
+
success: (message, data) => toast$1.success(resolveTitle(message), mapToastOptions(data)),
|
|
543
|
+
info: (message, data) => toast$1.info(resolveTitle(message), mapToastOptions(data)),
|
|
544
|
+
warning: (message, data) => toast$1.warning(resolveTitle(message), mapToastOptions(data)),
|
|
545
|
+
error: (message, data) => toast$1.error(resolveTitle(message), mapToastOptions(data)),
|
|
546
|
+
neutral: (message, data) => toast$1(resolveTitle(message), mapToastOptions(data, { variant: "neutral" })),
|
|
547
|
+
loading: (message, data) => toast$1.loading(resolveTitle(message), mapToastOptions(data)),
|
|
548
|
+
promise: toastPromise,
|
|
549
|
+
custom: toast$1.custom,
|
|
550
|
+
dismiss: toast$1.dismiss,
|
|
551
|
+
getHistory: toast$1.getHistory,
|
|
552
|
+
getToasts: toast$1.getToasts
|
|
553
|
+
}
|
|
554
|
+
);
|
|
555
|
+
var toastClassNames = {
|
|
556
|
+
toast: cx(
|
|
557
|
+
"avenue-toast group/toast relative w-full max-w-100 rounded-xl border border-white/10 p-4 pr-10 shadow-md",
|
|
558
|
+
"data-[type=default]:bg-primary-solid data-[type=default]:dark:border-secondary data-[type=default]:dark:bg-utility-neutral-900",
|
|
559
|
+
"data-[type=loading]:bg-primary-solid data-[type=loading]:dark:border-secondary data-[type=loading]:dark:bg-utility-neutral-900",
|
|
560
|
+
"data-[type=success]:bg-success-solid",
|
|
561
|
+
"data-[type=warning]:bg-warning-solid",
|
|
562
|
+
"data-[type=error]:bg-error-solid",
|
|
563
|
+
"data-[type=info]:bg-brand-solid"
|
|
564
|
+
),
|
|
565
|
+
content: "flex min-w-0 flex-col gap-1",
|
|
566
|
+
title: "text-md font-semibold text-white group-data-[type=default]/toast:dark:text-utility-neutral-50 group-data-[type=loading]/toast:dark:text-utility-neutral-50",
|
|
567
|
+
description: "text-sm text-white group-data-[type=default]/toast:dark:text-utility-neutral-200 group-data-[type=loading]/toast:dark:text-utility-neutral-200",
|
|
568
|
+
icon: cx(
|
|
569
|
+
"[&_svg]:size-5 [&_svg]:shrink-0 text-fg-white group-data-[type=default]/toast:dark:text-utility-neutral-50 group-data-[type=loading]/toast:dark:text-utility-neutral-50"
|
|
570
|
+
),
|
|
571
|
+
loader: "[&_svg]:size-5 [&_svg]:shrink-0",
|
|
572
|
+
closeButton: cx(
|
|
573
|
+
dismissButtonClassName,
|
|
574
|
+
"absolute top-2.5 right-2 !border-0 !shadow-none hover:!bg-white/20",
|
|
575
|
+
"group-data-[type=default]/toast:dark:hover:!bg-utility-neutral-800",
|
|
576
|
+
"group-data-[type=loading]/toast:dark:hover:!bg-utility-neutral-800"
|
|
577
|
+
)
|
|
578
|
+
};
|
|
579
|
+
var toastIcons = {
|
|
580
|
+
default: /* @__PURE__ */ jsx(InfoIcon, { "aria-hidden": "true", className: "size-5 shrink-0" }),
|
|
581
|
+
success: /* @__PURE__ */ jsx(CheckCircleIcon, { "aria-hidden": "true", className: "size-5 shrink-0" }),
|
|
582
|
+
info: /* @__PURE__ */ jsx(InfoIcon, { "aria-hidden": "true", className: "size-5 shrink-0" }),
|
|
583
|
+
warning: /* @__PURE__ */ jsx(WarningCircleIcon, { "aria-hidden": "true", className: "size-5 shrink-0" }),
|
|
584
|
+
error: /* @__PURE__ */ jsx(XCircleIcon, { "aria-hidden": "true", className: "size-5 shrink-0" }),
|
|
585
|
+
loading: /* @__PURE__ */ jsx(CircleNotchIcon, { "aria-hidden": "true", className: "size-5 shrink-0 animate-spin" }),
|
|
586
|
+
close: /* @__PURE__ */ jsx(XIcon, { "aria-hidden": "true", className: "size-5" })
|
|
587
|
+
};
|
|
588
|
+
var Toaster = ({
|
|
589
|
+
toastOptions,
|
|
590
|
+
className,
|
|
591
|
+
icons,
|
|
592
|
+
duration = DEFAULT_TOAST_DURATION_MS2,
|
|
593
|
+
closeButton = true,
|
|
594
|
+
...props
|
|
595
|
+
}) => {
|
|
596
|
+
return /* @__PURE__ */ jsx(
|
|
597
|
+
Toaster$1,
|
|
598
|
+
{
|
|
599
|
+
className: className ?? "toaster group",
|
|
600
|
+
duration,
|
|
601
|
+
closeButton,
|
|
602
|
+
richColors: false,
|
|
603
|
+
icons: { ...toastIcons, ...icons },
|
|
604
|
+
toastOptions: {
|
|
605
|
+
unstyled: true,
|
|
606
|
+
...toastOptions,
|
|
607
|
+
classNames: {
|
|
608
|
+
...toastClassNames,
|
|
609
|
+
...toastOptions?.classNames
|
|
610
|
+
}
|
|
611
|
+
},
|
|
612
|
+
...props
|
|
613
|
+
}
|
|
614
|
+
);
|
|
615
|
+
};
|
|
616
|
+
Toaster.displayName = "Toaster";
|
|
617
|
+
|
|
618
|
+
export { Toast, ToastStack, Toaster, toast };
|
|
619
|
+
//# sourceMappingURL=toast.js.map
|
|
620
|
+
//# sourceMappingURL=toast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../utils/cx.ts","../../../../utils/is-react-component.ts","../../../../components/base/buttons/button.tsx","../../../../components/application/toast/toast.tsx","../../../../components/application/toast/toaster.tsx"],"names":["AriaLink","AriaButton","InfoCircle","CheckCircle","AlertCircle","XCircle","styles","jsx","isValidElement","jsxs","X","DEFAULT_TOAST_DURATION_MS","sonnerToast","CircleNotch","SonnerToaster"],"mappings":";;;;;;;;;;;;;AAEA,IAAM,UAAU,mBAAA,CAAoB;AAAA,EAChC,MAAA,EAAQ;AAAA,IACJ,KAAA,EAAO;AAAA,MACH,MAAM,CAAC,YAAA,EAAc,cAAc,YAAA,EAAc,YAAA,EAAc,cAAc,aAAa;AAAA;AAC9F;AAER,CAAC,CAAA;AAMM,IAAM,EAAA,GAAK,OAAA;AAOX,SAAS,OAA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,EACA,QAAA,GAAWC,0BAAAA;AAAA,EACX,WAAA,GAAc,IAAA;AAAA,EACd,GAAG;AACP,CAAA,KAAoB;AAChB,EAAA,uBACIJ,GAAAA;AAAA,IAACO,SAAA;AAAA,IAAA;AAAA,MACG,WAAW,SAAA,IAAa,eAAA;AAAA,MACxB,QAAA;AAAA,MACA,WAAA;AAAA,MACA,UAAA,EAAY,KAAA;AAAA,MACZ,KAAA,EAAO,EAAE,GAAG,UAAA,EAAY,GAAG,KAAA,EAAM;AAAA,MACjC,YAAA,EAAc;AAAA,QACV,QAAA,EAAU,IAAA;AAAA,QACV,GAAG,YAAA;AAAA,QACH,UAAA,EAAY;AAAA,UACR,GAAG,eAAA;AAAA,UACH,GAAG,YAAA,EAAc;AAAA;AACrB,OACJ;AAAA,MACC,GAAG;AAAA;AAAA,GACR;AAER;AAEA,OAAA,CAAQ,WAAA,GAAc,SAAA","file":"toast.js","sourcesContent":["import { extendTailwindMerge } from \"tailwind-merge\";\n\nconst twMerge = extendTailwindMerge({\n extend: {\n theme: {\n text: [\"display-xs\", \"display-sm\", \"display-md\", \"display-lg\", \"display-xl\", \"display-2xl\"],\n },\n },\n});\n\n/**\n * This function is a wrapper around the twMerge function.\n * It is used to merge the classes inside style objects.\n */\nexport const cx = twMerge;\n\n/**\n * This function does nothing besides helping us to be able to\n * sort the classes inside style objects which is not supported\n * by the Tailwind IntelliSense by default.\n */\nexport function sortCx<T extends Record<string, string | number | Record<string, string | number | Record<string, string | number>>>>(classes: T): T {\n return classes;\n}\n","/* We cannot use type `unknown` instead of `any` here because it will break the type assertion `isReactComponent` function is providing. */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type React from \"react\";\n\ntype ReactComponent = React.FC<any> | React.ComponentClass<any, any>;\n\n/**\n * Checks if a given value is a function component.\n */\nexport const isFunctionComponent = (component: any): component is React.FC<any> => {\n return typeof component === \"function\";\n};\n\n/**\n * Checks if a given value is a class component.\n */\nexport const isClassComponent = (component: any): component is React.ComponentClass<any, any> => {\n return typeof component === \"function\" && component.prototype && (!!component.prototype.isReactComponent || !!component.prototype.render);\n};\n\n/**\n * Checks if a given value is a forward ref component.\n */\nexport const isForwardRefComponent = (component: any): component is React.ForwardRefExoticComponent<any> => {\n return typeof component === \"object\" && component !== null && component.$$typeof.toString() === \"Symbol(react.forward_ref)\";\n};\n\n/**\n * Checks if a given value is a valid React component.\n */\nexport const isReactComponent = (component: any): component is ReactComponent => {\n return isFunctionComponent(component) || isForwardRefComponent(component) || isClassComponent(component);\n};\n","\"use client\";\n\nimport type { FC, ReactElement, ReactNode } from \"react\";\nimport React, { isValidElement } from \"react\";\nimport type { ButtonProps as AriaButtonProps, LinkProps as AriaLinkProps } from \"react-aria-components\";\nimport { Button as AriaButton, Link as AriaLink } from \"react-aria-components\";\nimport { cx, sortCx } from \"@/utils/cx\";\nimport { isReactComponent } from \"@/utils/is-react-component\";\n\n/**\n * Figma: Buttons/Button (3287:427074), Buttons/Button destructive (6218:85578)\n *\n * Hierarchy mapping (Figma → Untitled `color` prop):\n * - Primary → `primary` (dark neutral solid — default CTA, black in light mode)\n * - Brand → `brand` (purple solid)\n * - Secondary / Tertiary / Link color / Link gray → same names\n *\n * Focus: Figma spread-shadow ring (2px surface gap + 4px focus-ring), not outline.\n * Skeuomorphic: shadow-xs-skeuomorphic + gradient top rim (#ffffff1f).\n */\n\n/** Plain focus — Tertiary, Link color, Link gray (Figma Focus rings/focus-ring). */\nconst focusShadowPlain =\n \"focus-visible:outline-none focus-visible:[box-shadow:0px_0px_0px_2px_var(--color-bg-primary),0px_0px_0px_4px_var(--color-focus-ring)]\";\n\n/** Skeuomorphic focus — Primary, Brand, Secondary (Figma focus-ring-shadow-xs-skeuomorphic). */\nconst focusShadowSkeuomorphic =\n \"focus-visible:outline-none focus-visible:[box-shadow:var(--shadow-xs-skeuomorphic),0px_0px_0px_2px_var(--color-bg-primary),0px_0px_0px_4px_var(--color-focus-ring)]\";\n\n/** Figma Gradient/skeuemorphic-gradient-border — 1px inner rim, strongest at top. */\nconst skeuomorphicGradientBorderClass = [\n \"ring-1 ring-inset ring-transparent\",\n \"before:pointer-events-none before:absolute before:inset-px before:rounded-[inherit] before:border before:border-[#ffffff1f] before:content-['']\",\n \"before:[mask-image:linear-gradient(to_bottom,#000,transparent)]\",\n].join(\" \");\n\nconst skeuomorphicShadowClass = [\"shadow-xs-skeuomorphic\", focusShadowSkeuomorphic, \"overflow-hidden\"].join(\" \");\n\n/** Secondary focus — shadow-xs + spread focus ring (Figma focus-ring-shadow-xs-skeuomorphic; keeps real border). */\nconst focusShadowSecondary =\n \"focus-visible:outline-none focus-visible:[box-shadow:0px_1px_2px_0px_rgba(0,0,0,0.05),0px_0px_0px_2px_var(--color-bg-primary),0px_0px_0px_4px_var(--color-focus-ring)]\";\n\n/** Secondary depth — bottom inset only; outer edge is border-primary (inner 1px rim stacks visually with border). */\nconst secondaryInnerShadow =\n \"after:pointer-events-none after:absolute after:inset-0 after:rounded-[inherit] after:content-[''] after:[box-shadow:inset_0px_-1px_0px_0px_rgba(0,0,0,0.05)]\";\n\nconst secondaryShadowClass = [\"relative overflow-hidden shadow-xs\", secondaryInnerShadow, focusShadowSecondary].join(\" \");\n\n/** Number input stepper buttons — shell owns border/focus; match outer rounded-lg corners. */\nconst inputNumberButtonClass =\n [\n \"in-data-number-input:border-0 in-data-number-input:shadow-none in-data-number-input:!rounded-none in-data-number-input:!h-full in-data-number-input:!min-h-0 in-data-number-input:self-stretch in-data-number-input:overflow-hidden\",\n \"in-data-number-input:before:hidden in-data-number-input:after:hidden\",\n \"in-data-number-input:focus-visible:outline-none in-data-number-input:focus-visible:shadow-none in-data-number-input:focus-visible:ring-0 in-data-number-input:focus-visible:![box-shadow:none]\",\n ].join(\" \");\n\n/** InputGroup addon buttons — shell owns outer border/corners; button is a flat inner segment (like NativeSelect). */\nconst inputAddonButtonClass =\n [\n \"in-data-input-wrapper:border-0 in-data-input-wrapper:shadow-none in-data-input-wrapper:!rounded-none in-data-input-wrapper:overflow-hidden\",\n \"in-data-input-wrapper:in-data-trailing:border-l in-data-input-wrapper:in-data-trailing:border-solid in-data-input-wrapper:in-data-trailing:border-primary\",\n \"in-data-input-wrapper:in-data-leading:border-r in-data-input-wrapper:in-data-leading:border-solid in-data-input-wrapper:in-data-leading:border-primary\",\n \"in-data-input-wrapper:group-invalid:in-data-trailing:border-error_subtle in-data-input-wrapper:group-invalid:in-data-leading:border-error_subtle\",\n \"in-data-input-wrapper:before:hidden in-data-input-wrapper:after:hidden\",\n \"in-data-input-wrapper:focus-visible:outline-none in-data-input-wrapper:focus-visible:shadow-none in-data-input-wrapper:focus-visible:ring-0 in-data-input-wrapper:focus-visible:![box-shadow:none]\",\n ].join(\" \");\n\nconst styles = sortCx({\n common: {\n root: [\n \"group relative inline-flex shrink-0 cursor-pointer items-center justify-center whitespace-nowrap rounded-full font-body outline-none before:absolute\",\n \"font-semibold transition-[color,background-color,border-color,box-shadow,opacity,transform] duration-150 ease-out\",\n \"pressed:scale-[0.985] pressed:duration-100 pressed:ease-linear motion-reduce:pressed:scale-100\",\n \"disabled:pointer-events-none disabled:cursor-not-allowed in-data-input-wrapper:disabled:opacity-100\",\n inputAddonButtonClass,\n inputNumberButtonClass,\n // Stretch to InputGroup row height; padding/typography follow `data-input-size` on the field (Figma 85:1269).\n \"in-data-input-wrapper:!h-full in-data-input-wrapper:!min-h-0 in-data-input-wrapper:self-stretch\",\n \"in-data-input-wrapper:in-data-[input-size=sm]:gap-1 in-data-input-wrapper:in-data-[input-size=sm]:px-3 in-data-input-wrapper:in-data-[input-size=sm]:py-2 in-data-input-wrapper:in-data-[input-size=sm]:text-sm\",\n \"in-data-input-wrapper:in-data-[input-size=md]:gap-1 in-data-input-wrapper:in-data-[input-size=md]:px-3.5 in-data-input-wrapper:in-data-[input-size=md]:py-2.5 in-data-input-wrapper:in-data-[input-size=md]:text-sm\",\n \"in-data-input-wrapper:in-data-[input-size=lg]:gap-1.5 in-data-input-wrapper:in-data-[input-size=lg]:px-4 in-data-input-wrapper:in-data-[input-size=lg]:py-2.5 in-data-input-wrapper:in-data-[input-size=lg]:text-md\",\n \"*:data-icon:pointer-events-none *:data-icon:shrink-0 *:data-icon:transition-inherit-all\",\n ].join(\" \"),\n icon: \"pointer-events-none shrink-0 transition-inherit-all\",\n },\n sizes: {\n xs: {\n root: [\n \"h-8 min-h-8 gap-1 px-[0.625rem] py-1.5 text-sm data-icon-only:size-8 data-icon-only:min-h-8 data-icon-only:min-w-8 data-icon-only:p-2\",\n \"in-data-input-wrapper:data-icon-only:p-2.5\",\n \"*:data-icon:size-4\",\n ].join(\" \"),\n linkRoot: \"h-auto min-h-0 gap-1 px-0! py-0! text-sm *:data-text:underline-offset-3\",\n },\n sm: {\n root: [\n \"h-9 min-h-9 gap-1 px-3 py-2 text-sm data-icon-only:size-9 data-icon-only:min-h-9 data-icon-only:min-w-9 data-icon-only:p-2\",\n \"in-data-input-wrapper:data-icon-only:p-2.5\",\n \"*:data-icon:size-5\",\n ].join(\" \"),\n linkRoot: \"h-auto min-h-0 gap-1 px-0! py-0! text-sm *:data-text:underline-offset-3\",\n },\n md: {\n root: [\n \"h-10 min-h-10 gap-1 px-3.5 py-2.5 text-sm data-icon-only:size-10 data-icon-only:min-h-10 data-icon-only:min-w-10 data-icon-only:p-2.5\",\n \"in-data-input-wrapper:data-icon-only:p-3\",\n \"*:data-icon:size-5\",\n ].join(\" \"),\n linkRoot: \"h-auto min-h-0 gap-1 px-0! py-0! text-sm *:data-text:underline-offset-4\",\n },\n lg: {\n root: \"h-11 min-h-11 gap-1.5 px-4 py-2.5 text-md data-icon-only:size-11 data-icon-only:min-h-11 data-icon-only:min-w-11 data-icon-only:p-3 *:data-icon:size-5\",\n linkRoot: \"h-auto min-h-0 gap-1.5 px-0! py-0! text-md *:data-text:underline-offset-4\",\n },\n xl: {\n root: \"h-12 min-h-12 gap-1.5 px-[1.125rem] py-3 text-md data-icon-only:size-12 data-icon-only:min-h-12 data-icon-only:min-w-12 data-icon-only:p-3 data-icon-only:*:data-icon:size-6 *:data-icon:size-5\",\n linkRoot: \"h-auto min-h-0 gap-1.5 px-0! py-0! text-md *:data-text:underline-offset-4\",\n },\n },\n\n colors: {\n /** Figma Hierarchy=Primary — dark neutral solid; hover lightens to fg-tertiary_hover (#404040). */\n primary: {\n root: [\n \"bg-primary-solid text-white\",\n skeuomorphicShadowClass,\n skeuomorphicGradientBorderClass,\n \"hover:bg-fg-tertiary_hover dark:hover:bg-quaternary\",\n \"disabled:opacity-30\",\n \"data-loading:bg-fg-tertiary_hover dark:data-loading:bg-quaternary\",\n \"*:data-icon:not([data-icon=loading]):text-white/70\",\n ].join(\" \"),\n },\n /** Figma Hierarchy=Brand — purple solid; hover darkens to bg-brand-solid_hover (#6d28d9). */\n brand: {\n root: [\n \"bg-brand-solid text-primary_on-brand\",\n skeuomorphicShadowClass,\n skeuomorphicGradientBorderClass,\n \"hover:bg-brand-solid_hover\",\n \"disabled:opacity-50\",\n \"data-loading:bg-brand-solid_hover\",\n \"*:data-icon:not([data-icon=loading]):text-primary_on-brand\",\n ].join(\" \"),\n },\n /** Figma Hierarchy=Secondary — border-primary + shadow-xs + skeuomorphic inner rim overlay. */\n secondary: {\n root: [\n \"border border-solid border-primary bg-primary text-secondary\",\n secondaryShadowClass,\n \"hover:bg-primary_hover hover:text-secondary_hover\",\n \"disabled:opacity-50\",\n \"data-loading:bg-primary_hover\",\n \"*:data-icon:text-fg-secondary\",\n ].join(\" \"),\n },\n /** Figma Hierarchy=Tertiary */\n tertiary: {\n root: [\n \"border border-transparent bg-transparent text-tertiary\",\n focusShadowPlain,\n \"hover:bg-primary_hover hover:text-tertiary_hover\",\n \"disabled:opacity-50\",\n \"*:data-icon:text-fg-tertiary\",\n ].join(\" \"),\n },\n /** Figma Hierarchy=Link color — text + icons share brand-secondary; hover underlines with fg-brand-secondary. */\n \"link-color\": {\n root: [\n \"h-auto min-h-0 border-0 bg-transparent px-0! py-0! text-brand-secondary shadow-none\",\n focusShadowPlain,\n \"hover:text-brand-secondary_hover\",\n \"disabled:opacity-50\",\n \"*:data-text:underline *:data-text:decoration-transparent *:data-text:decoration-solid hover:*:data-text:decoration-fg-brand-secondary\",\n ].join(\" \"),\n },\n /** Figma Hierarchy=Link gray — text + icons share tertiary; hover underlines with fg-quaternary. */\n \"link-gray\": {\n root: [\n \"h-auto min-h-0 border-0 bg-transparent px-0! py-0! text-tertiary shadow-none\",\n focusShadowPlain,\n \"hover:text-tertiary_hover\",\n \"disabled:opacity-50\",\n \"*:data-text:underline *:data-text:decoration-transparent *:data-text:decoration-solid hover:*:data-text:decoration-fg-quaternary\",\n ].join(\" \"),\n },\n \"primary-destructive\": {\n root: [\n \"bg-error-solid text-white\",\n skeuomorphicShadowClass,\n skeuomorphicGradientBorderClass,\n \"hover:bg-error-solid_hover\",\n \"disabled:opacity-50\",\n \"data-loading:bg-error-solid_hover\",\n \"*:data-icon:not([data-icon=loading]):text-white/70\",\n ].join(\" \"),\n },\n \"secondary-destructive\": {\n root: [\n \"border border-solid border-primary bg-primary text-error-primary\",\n secondaryShadowClass,\n \"hover:bg-error-primary hover:text-error-primary_hover\",\n \"disabled:opacity-50\",\n \"data-loading:bg-error-primary\",\n \"*:data-icon:text-fg-error-secondary hover:*:data-icon:text-fg-error-primary\",\n ].join(\" \"),\n },\n \"tertiary-destructive\": {\n root: [\n \"border border-transparent bg-transparent text-error-primary\",\n focusShadowPlain,\n \"hover:bg-error-primary hover:text-error-primary_hover\",\n \"disabled:opacity-50\",\n \"*:data-icon:text-fg-error-secondary hover:*:data-icon:text-fg-error-primary\",\n ].join(\" \"),\n },\n /** Figma Hierarchy=Link (destructive) — text + icons share error-primary; hover underlines. */\n \"link-destructive\": {\n root: [\n \"h-auto min-h-0 border-0 bg-transparent px-0! py-0! text-error-primary shadow-none\",\n focusShadowPlain,\n \"hover:text-error-primary_hover\",\n \"disabled:opacity-50\",\n \"*:data-text:underline *:data-text:decoration-transparent *:data-text:decoration-solid hover:*:data-text:decoration-current\",\n ].join(\" \"),\n },\n },\n});\n\n/**\n * Common props shared between button and anchor variants\n */\nexport interface CommonProps {\n /** Disables the button and shows a disabled state */\n isDisabled?: boolean;\n /** Shows a loading spinner and disables the button */\n isLoading?: boolean;\n /** The size variant of the button */\n size?: keyof typeof styles.sizes;\n /** The color variant of the button */\n color?: keyof typeof styles.colors;\n /** Icon component or element to show before the text */\n iconLeading?: FC<{ className?: string }> | ReactNode;\n /** Icon component or element to show after the text */\n iconTrailing?: FC<{ className?: string }> | ReactNode;\n /** Removes horizontal padding from the text content */\n noTextPadding?: boolean;\n /** When true, keeps the text visible during loading state */\n showTextWhileLoading?: boolean;\n\n children?: ReactNode;\n className?: string;\n}\n\n/**\n * Props for the button variant (non-link)\n */\nexport interface ButtonProps extends CommonProps, Omit<AriaButtonProps, \"children\" | \"className\"> {}\n/**\n * Props for the link variant (anchor tag)\n */\ninterface LinkProps extends CommonProps, Omit<AriaLinkProps, \"children\" | \"className\"> {\n href: NonNullable<AriaLinkProps[\"href\"]>;\n}\n\n/** Union type of button and link props */\nexport type Props = ButtonProps | LinkProps;\n\nexport const Button: {\n (props: LinkProps): ReactElement<LinkProps>;\n (props: ButtonProps): ReactElement<ButtonProps>;\n} = ({\n size = \"md\",\n color = \"primary\",\n children,\n className,\n noTextPadding,\n iconLeading: IconLeading,\n iconTrailing: IconTrailing,\n isDisabled: disabled,\n isLoading: loading,\n showTextWhileLoading,\n ...props\n}) => {\n const href = \"href\" in props ? props.href : undefined;\n\n const isIcon = (IconLeading || IconTrailing) && !children;\n const isLinkType = [\"link-gray\", \"link-color\", \"link-destructive\"].includes(color);\n\n noTextPadding = isLinkType || noTextPadding;\n\n const commonChildren = (\n <>\n {isValidElement(IconLeading) && IconLeading}\n {isReactComponent(IconLeading) && <IconLeading data-icon=\"leading\" className={styles.common.icon} />}\n\n {loading && (\n <svg\n fill=\"none\"\n data-icon=\"loading\"\n viewBox=\"0 0 256 256\"\n aria-hidden\n className={cx(\n styles.common.icon,\n \"size-5 animate-spin\",\n !showTextWhileLoading && \"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2\",\n )}\n >\n <path\n fill=\"currentColor\"\n d=\"M232,128a104,104,0,0,1-208,0c0-41,23.81-78.36,60.66-95.27a8,8,0,0,1,6.68,14.54C60,61.46,40,93.27,40,128a88,88,0,0,0,176,0c0-34.73-20-66.54-51.34-80.73a8,8,0,0,1,6.68-14.54C208.19,49.64,232,87,232,128Z\"\n />\n </svg>\n )}\n\n {children && (\n <span data-text className={cx(\"transition-inherit-all\", !noTextPadding && !isLinkType && \"px-0.5\")}>\n {children}\n </span>\n )}\n\n {isValidElement(IconTrailing) && IconTrailing}\n {isReactComponent(IconTrailing) && <IconTrailing data-icon=\"trailing\" className={styles.common.icon} />}\n </>\n );\n\n const commonProps = {\n \"data-icon-only\": isIcon ? true : undefined,\n \"data-loading\": loading ? true : undefined,\n ...props,\n isDisabled: disabled || loading,\n className: cx(\n styles.common.root,\n styles.sizes[size].root,\n styles.colors[color].root,\n isLinkType && styles.sizes[size].linkRoot,\n (loading || (href && (disabled || loading))) && \"pointer-events-none\",\n loading && (showTextWhileLoading ? \"[&>*:not([data-icon=loading]):not([data-text])]:hidden\" : \"[&>*:not([data-icon=loading])]:invisible\"),\n className,\n ),\n children: commonChildren,\n };\n\n if (\"href\" in commonProps) {\n return <AriaLink {...commonProps} href={disabled || loading ? undefined : href} />;\n }\n\n return <AriaButton {...commonProps} type={commonProps.type || \"button\"} isPending={loading} />;\n};\n","\"use client\";\n\nimport type { FC, ReactNode } from \"react\";\nimport { isValidElement, useCallback, useEffect, useState } from \"react\";\nimport { CheckCircleIcon as CheckCircle } from \"@phosphor-icons/react/dist/csr/CheckCircle\";\nimport { InfoIcon as InfoCircle } from \"@phosphor-icons/react/dist/csr/Info\";\nimport { WarningCircleIcon as AlertCircle } from \"@phosphor-icons/react/dist/csr/WarningCircle\";\nimport { XCircleIcon as XCircle } from \"@phosphor-icons/react/dist/csr/XCircle\";\nimport { XIcon as X } from \"@phosphor-icons/react/dist/csr/X\";\nimport { Button } from \"@/components/base/buttons/button\";\nimport { cx, sortCx } from \"@/utils/cx\";\nimport { isReactComponent } from \"@/utils/is-react-component\";\n\nexport type ToastColor = \"default\" | \"neutral\" | \"brand\" | \"success\" | \"warning\" | \"error\";\n\nconst DEFAULT_TOAST_DURATION_MS = 6000;\n\nconst defaultIcons: Record<ToastColor, FC<{ className?: string }>> = {\n default: InfoCircle,\n neutral: InfoCircle,\n brand: InfoCircle,\n success: CheckCircle,\n warning: AlertCircle,\n error: XCircle,\n};\n\nconst variantStyles = sortCx({\n default: {\n root: \"border-white/10 bg-primary-solid dark:border-secondary dark:bg-utility-neutral-900\",\n title: \"text-white dark:text-utility-neutral-50\",\n description: \"text-white dark:text-utility-neutral-200\",\n icon: \"text-fg-white dark:text-utility-neutral-50\",\n },\n neutral: {\n root: \"border-white/10 bg-secondary-solid\",\n title: \"text-white\",\n description: \"text-white\",\n icon: \"text-fg-white\",\n },\n brand: {\n root: \"border-white/10 bg-brand-solid\",\n title: \"text-white\",\n description: \"text-white\",\n icon: \"text-fg-white\",\n },\n success: {\n root: \"border-white/10 bg-success-solid\",\n title: \"text-white\",\n description: \"text-white\",\n icon: \"text-fg-white\",\n },\n warning: {\n root: \"border-white/10 bg-warning-solid\",\n title: \"text-white\",\n description: \"text-white\",\n icon: \"text-fg-white\",\n },\n error: {\n root: \"border-white/10 bg-error-solid\",\n title: \"text-white\",\n description: \"text-white\",\n icon: \"text-fg-white\",\n },\n});\n\n/** Shared with `Toaster` — not part of the public package API. */\nexport const toastActionLinkClassName = cx(\n \"text-white! hover:text-white/80! *:data-text:no-underline! hover:*:data-text:underline! hover:*:data-text:decoration-white/80\",\n \"group-data-[type=default]/toast:dark:text-utility-neutral-50! group-data-[type=loading]/toast:dark:text-utility-neutral-50!\",\n \"group-data-[type=default]/toast:dark:hover:text-utility-neutral-200! group-data-[type=loading]/toast:dark:hover:text-utility-neutral-200!\",\n \"group-data-[type=default]/toast:dark:hover:*:data-text:decoration-utility-neutral-200! group-data-[type=loading]/toast:dark:hover:*:data-text:decoration-utility-neutral-200!\",\n);\n\n/** Shared with `Toaster` — not part of the public package API. */\nexport const dismissButtonClassName = cx(\n \"relative z-20 flex size-9 shrink-0 cursor-pointer items-center justify-center rounded-full border-0 bg-transparent shadow-none\",\n \"text-fg-white [&_svg]:opacity-70\",\n \"transition duration-100 ease-linear\",\n \"hover:bg-white/20 hover:[&_svg]:opacity-100\",\n \"active:scale-[0.96]\",\n \"focus-visible:outline-none focus-visible:[box-shadow:0px_0px_0px_2px_var(--color-bg-primary),0px_0px_0px_4px_var(--color-focus-ring)]\",\n \"group-data-[type=default]/toast:dark:text-fg-quaternary group-data-[type=default]/toast:dark:[&_svg]:opacity-70\",\n \"group-data-[type=default]/toast:dark:hover:bg-utility-neutral-800 group-data-[type=default]/toast:dark:hover:text-fg-quaternary_hover group-data-[type=default]/toast:dark:hover:[&_svg]:opacity-100\",\n \"group-data-[type=loading]/toast:dark:text-fg-quaternary group-data-[type=loading]/toast:dark:[&_svg]:opacity-70\",\n \"group-data-[type=loading]/toast:dark:hover:bg-utility-neutral-800 group-data-[type=loading]/toast:dark:hover:text-fg-quaternary_hover group-data-[type=loading]/toast:dark:hover:[&_svg]:opacity-100\",\n);\n\nexport interface ToastProps {\n /**\n * Primary message shown in the toast.\n */\n title: ReactNode;\n /**\n * Optional supporting text below the title.\n */\n description?: ReactNode;\n /**\n * Semantic color variant for the toast surface and leading icon.\n *\n * @default \"default\"\n */\n color?: ToastColor;\n /**\n * Custom leading icon. Pass `null` to hide the icon.\n */\n icon?: FC<{ className?: string }> | ReactNode | null;\n /**\n * Custom action element. Overrides `actionLabel` / `onAction`.\n */\n action?: ReactNode;\n /**\n * Label for the default action button.\n */\n actionLabel?: string;\n /**\n * Handler for the default action button.\n */\n onAction?: () => void;\n /**\n * Called after the dismiss animation completes.\n */\n onClose?: () => void;\n /**\n * Whether to show the dismiss control.\n *\n * @default true when `onClose` is provided\n */\n showClose?: boolean;\n /**\n * Auto-dismiss duration in milliseconds. Pass `null` to disable.\n *\n * @default 6000\n */\n duration?: number | null;\n /**\n * Uses `role=\"alert\"` instead of `role=\"status\"`.\n * Defaults to `true` for `error` and `warning` colors.\n */\n isUrgent?: boolean;\n className?: string;\n}\n\nexport const Toast = ({\n title,\n description,\n color = \"default\",\n icon,\n action,\n actionLabel,\n onAction,\n onClose,\n showClose = Boolean(onClose),\n duration = DEFAULT_TOAST_DURATION_MS,\n isUrgent,\n className,\n}: ToastProps) => {\n const styles = variantStyles[color];\n const resolvedIcon = icon === null ? null : (icon ?? defaultIcons[color]);\n const hasAction = Boolean(action || actionLabel);\n const hasIcon = resolvedIcon != null;\n const role = (isUrgent ?? (color === \"error\" || color === \"warning\")) ? \"alert\" : \"status\";\n\n const [isVisible, setIsVisible] = useState(true);\n\n const dismiss = useCallback(() => {\n setIsVisible(false);\n onClose?.();\n }, [onClose]);\n\n useEffect(() => {\n if (duration == null || duration <= 0 || !isVisible) return;\n\n const timer = window.setTimeout(dismiss, duration);\n return () => window.clearTimeout(timer);\n }, [duration, dismiss, isVisible]);\n\n const renderIcon = (): ReactNode => {\n if (!hasIcon) return null;\n\n const Icon = isReactComponent(resolvedIcon) ? resolvedIcon : null;\n\n if (Icon) {\n return <Icon data-icon className={cx(\"size-5 shrink-0\", styles.icon)} aria-hidden=\"true\" />;\n }\n\n if (isValidElement(resolvedIcon)) {\n return resolvedIcon;\n }\n\n return null;\n };\n\n const renderCloseButton = () => {\n if (!showClose) return null;\n\n return (\n <button\n type=\"button\"\n aria-label=\"Close\"\n className={cx(\n dismissButtonClassName,\n color === \"default\" &&\n \"dark:text-fg-quaternary dark:[&_svg]:opacity-70 dark:hover:bg-utility-neutral-800 dark:hover:text-fg-quaternary_hover dark:hover:[&_svg]:opacity-100\",\n \"absolute top-2.5 right-2\",\n )}\n onClick={dismiss}\n >\n <X className=\"size-5\" aria-hidden=\"true\" />\n <span className=\"sr-only\">Close</span>\n </button>\n );\n };\n\n if (!isVisible) return null;\n\n return (\n <div\n role={role}\n aria-live={role === \"alert\" ? \"assertive\" : \"polite\"}\n className={cx(\n \"relative w-full max-w-100 rounded-xl border p-4 shadow-md\",\n !hasIcon && \"pl-5\",\n styles.root,\n className,\n )}\n >\n <div className=\"flex min-w-0 gap-3\">\n {hasIcon && <div className=\"flex h-6 shrink-0 items-center self-start\">{renderIcon()}</div>}\n\n <div className=\"flex min-w-0 flex-1 flex-col gap-1\">\n <p className={cx(\"text-md font-semibold\", styles.title)}>{title}</p>\n\n {description && <p className={cx(\"text-sm\", styles.description)}>{description}</p>}\n\n {hasAction && (\n <div className=\"mt-1\">\n {action ?? (\n <Button\n color=\"link-gray\"\n size=\"sm\"\n className={cx(\n toastActionLinkClassName,\n color === \"default\" &&\n \"dark:text-utility-neutral-50! dark:hover:text-utility-neutral-200! dark:hover:*:data-text:decoration-utility-neutral-200!\",\n )}\n onPress={onAction}\n >\n {actionLabel}\n </Button>\n )}\n </div>\n )}\n </div>\n </div>\n\n {renderCloseButton()}\n </div>\n );\n};\n\nToast.displayName = \"Toast\";\n\nexport interface ToastStackProps {\n children: ReactNode;\n className?: string;\n}\n\n/**\n * Static layout helper for previewing multiple toasts in Storybook.\n */\nexport const ToastStack = ({ children, className }: ToastStackProps) => {\n return (\n <div className={cx(\"flex w-full max-w-100 flex-col gap-3 overflow-hidden\", className)} role=\"presentation\">\n {children}\n </div>\n );\n};\n\nToastStack.displayName = \"ToastStack\";\n","\"use client\";\n\nimport type { ComponentProps, MouseEvent, ReactElement, ReactNode } from \"react\";\nimport { isValidElement } from \"react\";\nimport { CheckCircleIcon as CheckCircle } from \"@phosphor-icons/react/dist/csr/CheckCircle\";\nimport { CircleNotchIcon as CircleNotch } from \"@phosphor-icons/react/dist/csr/CircleNotch\";\nimport { InfoIcon as InfoCircle } from \"@phosphor-icons/react/dist/csr/Info\";\nimport { WarningCircleIcon as AlertCircle } from \"@phosphor-icons/react/dist/csr/WarningCircle\";\nimport { XIcon as X } from \"@phosphor-icons/react/dist/csr/X\";\nimport { XCircleIcon as XCircle } from \"@phosphor-icons/react/dist/csr/XCircle\";\nimport { Toaster as SonnerToaster, toast as sonnerToast } from \"sonner\";\nimport type { Action, ExternalToast, ToastT, ToastToDismiss } from \"sonner\";\nimport { dismissButtonClassName, toastActionLinkClassName } from \"@/components/application/toast/toast\";\nimport { Button } from \"@/components/base/buttons/button\";\nimport { cx } from \"@/utils/cx\";\nimport \"./toast.css\";\n\nconst DEFAULT_TOAST_DURATION_MS = 6000;\n\nexport type ToasterProps = Omit<ComponentProps<typeof SonnerToaster>, \"theme\" | \"richColors\">;\n\n/** Matches Sonner's `ExternalToast` — pass `action`, `cancel`, or JSX freely. */\nexport type ToastOptions = ExternalToast;\n\nconst isAction = (value: Action | ReactNode): value is Action => {\n return typeof value === \"object\" && value !== null && !isValidElement(value) && \"label\" in value && \"onClick\" in value;\n};\n\nconst withDefaultType = (data?: ExternalToast): ExternalToast => {\n return {\n ...data,\n type: \"default\",\n className: cx(\"bg-primary-solid dark:border-secondary dark:bg-utility-neutral-900\", data?.className),\n } as ExternalToast;\n};\n\nconst createActionClickEvent = (): MouseEvent<HTMLButtonElement> => {\n let defaultPrevented = false;\n\n return {\n preventDefault: () => {\n defaultPrevented = true;\n },\n get defaultPrevented() {\n return defaultPrevented;\n },\n } as MouseEvent<HTMLButtonElement>;\n};\n\nconst renderNativeActionButton = (action: Action, onPress: () => void) => (\n <Button color=\"link-gray\" size=\"sm\" className={toastActionLinkClassName} onPress={onPress}>\n {action.label}\n </Button>\n);\n\n/** Sonner renders action/cancel as flex siblings — wrap them for a stable grid footer row. */\nconst wrapToastFooter = (options: ExternalToast = {}): ExternalToast => {\n const nativeAction = isAction(options.action) ? options.action : null;\n const nativeCancel = isAction(options.cancel) ? options.cancel : null;\n const customAction = options.action && isValidElement(options.action) ? options.action : null;\n\n if (!nativeAction && !nativeCancel && !customAction) {\n return options;\n }\n\n if (customAction) {\n if (customAction.props && typeof customAction.props === \"object\" && \"data-toast-actions\" in customAction.props) {\n return { ...options, cancel: undefined };\n }\n\n return {\n ...options,\n cancel: undefined,\n action: (\n <div data-toast-actions className=\"flex flex-wrap items-center gap-3\">\n {customAction}\n </div>\n ),\n };\n }\n\n const id = options.id ?? `toast-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;\n\n return {\n ...options,\n id,\n cancel: undefined,\n action: (\n <div data-toast-actions className=\"flex flex-wrap items-center gap-3\">\n {nativeCancel &&\n renderNativeActionButton(nativeCancel, () => {\n nativeCancel.onClick(createActionClickEvent());\n sonnerToast.dismiss(id);\n })}\n {nativeAction &&\n renderNativeActionButton(nativeAction, () => {\n const event = createActionClickEvent();\n nativeAction.onClick(event);\n if (!event.defaultPrevented) {\n sonnerToast.dismiss(id);\n }\n })}\n </div>\n ),\n };\n};\n\nconst mapToastOptions = (data?: ExternalToast, config?: { variant?: \"neutral\" }): ExternalToast => {\n let options: ExternalToast;\n\n if (config?.variant === \"neutral\") {\n options = {\n ...data,\n className: cx(\"!border-white/10 !bg-secondary-solid\", data?.className),\n classNames: {\n toast: \"!border-white/10 !bg-secondary-solid\",\n title: \"!text-white\",\n description: \"!text-white\",\n icon: \"!text-fg-white\",\n ...data?.classNames,\n },\n icon:\n data?.icon === undefined ? (\n <InfoCircle aria-hidden=\"true\" className=\"size-5 shrink-0 text-fg-white\" />\n ) : (\n data.icon\n ),\n };\n } else {\n options = withDefaultType(data);\n }\n\n return wrapToastFooter(options);\n};\n\ntype Title = ReactNode | (() => ReactNode);\n\ntype ToastId = string | number;\n\ntype ToastHandler = (message: Title, data?: ToastOptions) => ToastId;\n\nexport type ToastPromiseData<T = unknown> = Omit<ExternalToast, \"description\"> & {\n loading?: ReactNode;\n success?: ReactNode | string | ((data: T) => ReactNode | string | Promise<ReactNode | string>);\n error?: ReactNode | string | ((data: unknown) => ReactNode | string | Promise<ReactNode | string>);\n description?: ReactNode | string | ((data: T) => ReactNode | string | Promise<ReactNode | string>);\n finally?: () => void | Promise<void>;\n};\n\ntype ToastPromiseReturn<T> = ToastId & { unwrap: () => Promise<T> };\n\nexport type AvenueToast = ToastHandler & {\n success: ToastHandler;\n info: ToastHandler;\n warning: ToastHandler;\n error: ToastHandler;\n neutral: ToastHandler;\n loading: ToastHandler;\n promise: <T>(promise: Promise<T> | (() => Promise<T>), data?: ToastPromiseData<T>) => ToastPromiseReturn<T>;\n custom: (jsx: (id: ToastId) => ReactElement, data?: ToastOptions) => ToastId;\n dismiss: (id?: ToastId) => ToastId;\n getHistory: () => (ToastT | ToastToDismiss)[];\n getToasts: () => (ToastT | ToastToDismiss)[];\n};\n\nconst resolveTitle = (message: Title) => (typeof message === \"function\" ? message() : message);\n\nconst toastPromise = <T,>(promise: Promise<T> | (() => Promise<T>), data?: ToastPromiseData<T>): ToastPromiseReturn<T> =>\n sonnerToast.promise(promise, data as Parameters<typeof sonnerToast.promise>[1]) as ToastPromiseReturn<T>;\n\n/**\n * Imperative toast API backed by Sonner. Matches the [`toast` API](https://sonner.emilkowal.ski/toast).\n */\nexport const toast: AvenueToast = Object.assign(\n (message: Title, data?: ToastOptions) => sonnerToast(resolveTitle(message), mapToastOptions(data)),\n {\n success: (message: Title, data?: ToastOptions) => sonnerToast.success(resolveTitle(message), mapToastOptions(data)),\n info: (message: Title, data?: ToastOptions) => sonnerToast.info(resolveTitle(message), mapToastOptions(data)),\n warning: (message: Title, data?: ToastOptions) => sonnerToast.warning(resolveTitle(message), mapToastOptions(data)),\n error: (message: Title, data?: ToastOptions) => sonnerToast.error(resolveTitle(message), mapToastOptions(data)),\n neutral: (message: Title, data?: ToastOptions) => sonnerToast(resolveTitle(message), mapToastOptions(data, { variant: \"neutral\" })),\n loading: (message: Title, data?: ToastOptions) => sonnerToast.loading(resolveTitle(message), mapToastOptions(data)),\n promise: toastPromise,\n custom: sonnerToast.custom,\n dismiss: sonnerToast.dismiss,\n getHistory: sonnerToast.getHistory,\n getToasts: sonnerToast.getToasts,\n },\n);\n\nconst toastClassNames = {\n toast: cx(\n \"avenue-toast group/toast relative w-full max-w-100 rounded-xl border border-white/10 p-4 pr-10 shadow-md\",\n \"data-[type=default]:bg-primary-solid data-[type=default]:dark:border-secondary data-[type=default]:dark:bg-utility-neutral-900\",\n \"data-[type=loading]:bg-primary-solid data-[type=loading]:dark:border-secondary data-[type=loading]:dark:bg-utility-neutral-900\",\n \"data-[type=success]:bg-success-solid\",\n \"data-[type=warning]:bg-warning-solid\",\n \"data-[type=error]:bg-error-solid\",\n \"data-[type=info]:bg-brand-solid\",\n ),\n content: \"flex min-w-0 flex-col gap-1\",\n title: \"text-md font-semibold text-white group-data-[type=default]/toast:dark:text-utility-neutral-50 group-data-[type=loading]/toast:dark:text-utility-neutral-50\",\n description: \"text-sm text-white group-data-[type=default]/toast:dark:text-utility-neutral-200 group-data-[type=loading]/toast:dark:text-utility-neutral-200\",\n icon: cx(\n \"[&_svg]:size-5 [&_svg]:shrink-0 text-fg-white group-data-[type=default]/toast:dark:text-utility-neutral-50 group-data-[type=loading]/toast:dark:text-utility-neutral-50\",\n ),\n loader: \"[&_svg]:size-5 [&_svg]:shrink-0\",\n closeButton: cx(\n dismissButtonClassName,\n \"absolute top-2.5 right-2 !border-0 !shadow-none hover:!bg-white/20\",\n \"group-data-[type=default]/toast:dark:hover:!bg-utility-neutral-800\",\n \"group-data-[type=loading]/toast:dark:hover:!bg-utility-neutral-800\",\n ),\n};\n\nconst toastIcons = {\n default: <InfoCircle aria-hidden=\"true\" className=\"size-5 shrink-0\" />,\n success: <CheckCircle aria-hidden=\"true\" className=\"size-5 shrink-0\" />,\n info: <InfoCircle aria-hidden=\"true\" className=\"size-5 shrink-0\" />,\n warning: <AlertCircle aria-hidden=\"true\" className=\"size-5 shrink-0\" />,\n error: <XCircle aria-hidden=\"true\" className=\"size-5 shrink-0\" />,\n loading: <CircleNotch aria-hidden=\"true\" className=\"size-5 shrink-0 animate-spin\" />,\n close: <X aria-hidden=\"true\" className=\"size-5\" />,\n};\n\nexport const Toaster = ({\n toastOptions,\n className,\n icons,\n duration = DEFAULT_TOAST_DURATION_MS,\n closeButton = true,\n ...props\n}: ToasterProps) => {\n return (\n <SonnerToaster\n className={className ?? \"toaster group\"}\n duration={duration}\n closeButton={closeButton}\n richColors={false}\n icons={{ ...toastIcons, ...icons }}\n toastOptions={{\n unstyled: true,\n ...toastOptions,\n classNames: {\n ...toastClassNames,\n ...toastOptions?.classNames,\n },\n }}\n {...props}\n />\n );\n};\n\nToaster.displayName = \"Toaster\";\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@avenue-ticketing/ui",
|
|
3
|
-
"version": "0.12.0-beta.
|
|
3
|
+
"version": "0.12.0-beta.5",
|
|
4
4
|
"description": "Avenue UI components for React (Untitled UI beta)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
"react-aria": "^3.47.0",
|
|
48
48
|
"react-aria-components": "^1.16.0",
|
|
49
49
|
"react-hook-form": "^7.71.2",
|
|
50
|
+
"sonner": "^2.0.7",
|
|
50
51
|
"tailwind-merge": "^3.5.0"
|
|
51
52
|
},
|
|
52
53
|
"devDependencies": {
|
package/theme.css
CHANGED
|
@@ -6,6 +6,27 @@
|
|
|
6
6
|
|
|
7
7
|
@source "./dist/**/*.js";
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Pointer-hover + touch-press parity: hover utilities also apply on RAC press
|
|
11
|
+
* (data-pressed) and native :active, so mobile tap matches desktop hover.
|
|
12
|
+
*/
|
|
13
|
+
@custom-variant hover {
|
|
14
|
+
@media (hover: hover) {
|
|
15
|
+
&:hover {
|
|
16
|
+
@slot;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
&:where([data-rac])[data-hovered] {
|
|
20
|
+
@slot;
|
|
21
|
+
}
|
|
22
|
+
&:where([data-rac])[data-pressed] {
|
|
23
|
+
@slot;
|
|
24
|
+
}
|
|
25
|
+
&:active {
|
|
26
|
+
@slot;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
9
30
|
@custom-variant dark (&:where(.dark, .dark *));
|
|
10
31
|
@custom-variant label (& [data-label]);
|
|
11
32
|
@custom-variant focus-input-within (&:has(input:focus));
|