@karakuri-ui/react 0.2.3 → 0.3.0
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/README.md +0 -1
- package/dist/components/ui/accordion.d.mts +40 -0
- package/dist/components/ui/accordion.d.ts +40 -0
- package/dist/components/ui/accordion.js +215 -0
- package/dist/components/ui/accordion.js.map +1 -0
- package/dist/components/ui/accordion.mjs +176 -0
- package/dist/components/ui/accordion.mjs.map +1 -0
- package/dist/components/ui/alert.d.mts +38 -0
- package/dist/components/ui/alert.d.ts +38 -0
- package/dist/components/ui/alert.js +217 -0
- package/dist/components/ui/alert.js.map +1 -0
- package/dist/components/ui/alert.mjs +180 -0
- package/dist/components/ui/alert.mjs.map +1 -0
- package/dist/components/ui/avatar.d.mts +223 -0
- package/dist/components/ui/avatar.d.ts +223 -0
- package/dist/components/ui/avatar.js +245 -0
- package/dist/components/ui/avatar.js.map +1 -0
- package/dist/components/ui/avatar.mjs +204 -0
- package/dist/components/ui/avatar.mjs.map +1 -0
- package/dist/components/ui/badge.d.mts +31 -0
- package/dist/components/ui/badge.d.ts +31 -0
- package/dist/components/ui/badge.js +205 -0
- package/dist/components/ui/badge.js.map +1 -0
- package/dist/components/ui/badge.mjs +170 -0
- package/dist/components/ui/badge.mjs.map +1 -0
- package/dist/components/ui/breadcrumb.d.mts +46 -0
- package/dist/components/ui/breadcrumb.d.ts +46 -0
- package/dist/components/ui/breadcrumb.js +201 -0
- package/dist/components/ui/breadcrumb.js.map +1 -0
- package/dist/components/ui/breadcrumb.mjs +160 -0
- package/dist/components/ui/breadcrumb.mjs.map +1 -0
- package/dist/components/ui/button-group.d.mts +22 -0
- package/dist/components/ui/button-group.d.ts +22 -0
- package/dist/components/ui/button-group.js +107 -0
- package/dist/components/ui/button-group.js.map +1 -0
- package/dist/components/ui/button-group.mjs +72 -0
- package/dist/components/ui/button-group.mjs.map +1 -0
- package/dist/components/ui/button.d.mts +31 -0
- package/dist/components/ui/button.d.ts +31 -0
- package/dist/components/ui/button.js +176 -0
- package/dist/components/ui/button.js.map +1 -0
- package/dist/components/ui/button.mjs +141 -0
- package/dist/components/ui/button.mjs.map +1 -0
- package/dist/components/ui/card.d.mts +60 -0
- package/dist/components/ui/card.d.ts +60 -0
- package/dist/components/ui/card.js +361 -0
- package/dist/components/ui/card.js.map +1 -0
- package/dist/components/ui/card.mjs +319 -0
- package/dist/components/ui/card.mjs.map +1 -0
- package/dist/{chart.d.mts → components/ui/chart.d.mts} +2 -18
- package/dist/{chart.d.ts → components/ui/chart.d.ts} +2 -18
- package/dist/{chart.js → components/ui/chart.js} +30 -55
- package/dist/components/ui/chart.js.map +1 -0
- package/dist/{chart.mjs → components/ui/chart.mjs} +22 -46
- package/dist/components/ui/chart.mjs.map +1 -0
- package/dist/components/ui/checkbox.d.mts +24 -0
- package/dist/components/ui/checkbox.d.ts +24 -0
- package/dist/components/ui/checkbox.js +173 -0
- package/dist/components/ui/checkbox.js.map +1 -0
- package/dist/components/ui/checkbox.mjs +138 -0
- package/dist/components/ui/checkbox.mjs.map +1 -0
- package/dist/components/ui/divider.d.mts +27 -0
- package/dist/components/ui/divider.d.ts +27 -0
- package/dist/components/ui/divider.js +147 -0
- package/dist/components/ui/divider.js.map +1 -0
- package/dist/components/ui/divider.mjs +112 -0
- package/dist/components/ui/divider.mjs.map +1 -0
- package/dist/components/ui/drawer.d.mts +36 -0
- package/dist/components/ui/drawer.d.ts +36 -0
- package/dist/components/ui/drawer.js +211 -0
- package/dist/components/ui/drawer.js.map +1 -0
- package/dist/components/ui/drawer.mjs +165 -0
- package/dist/components/ui/drawer.mjs.map +1 -0
- package/dist/components/ui/dropdown.d.mts +34 -0
- package/dist/components/ui/dropdown.d.ts +34 -0
- package/dist/components/ui/dropdown.js +295 -0
- package/dist/components/ui/dropdown.js.map +1 -0
- package/dist/components/ui/dropdown.mjs +248 -0
- package/dist/components/ui/dropdown.mjs.map +1 -0
- package/dist/components/ui/field.d.mts +26 -0
- package/dist/components/ui/field.d.ts +26 -0
- package/dist/components/ui/field.js +141 -0
- package/dist/components/ui/field.js.map +1 -0
- package/dist/components/ui/field.mjs +103 -0
- package/dist/components/ui/field.mjs.map +1 -0
- package/dist/components/ui/icon-button.d.mts +20 -0
- package/dist/components/ui/icon-button.d.ts +20 -0
- package/dist/components/ui/icon-button.js +147 -0
- package/dist/components/ui/icon-button.js.map +1 -0
- package/dist/components/ui/icon-button.mjs +112 -0
- package/dist/components/ui/icon-button.mjs.map +1 -0
- package/dist/components/ui/index.d.mts +55 -0
- package/dist/components/ui/index.d.ts +55 -0
- package/dist/components/ui/index.js +468 -0
- package/dist/components/ui/index.js.map +1 -0
- package/dist/components/ui/index.mjs +242 -0
- package/dist/components/ui/index.mjs.map +1 -0
- package/dist/components/ui/input.d.mts +20 -0
- package/dist/components/ui/input.d.ts +20 -0
- package/dist/components/ui/input.js +250 -0
- package/dist/components/ui/input.js.map +1 -0
- package/dist/components/ui/input.mjs +215 -0
- package/dist/components/ui/input.mjs.map +1 -0
- package/dist/components/ui/metric-card.d.mts +38 -0
- package/dist/components/ui/metric-card.d.ts +38 -0
- package/dist/components/ui/metric-card.js +250 -0
- package/dist/components/ui/metric-card.js.map +1 -0
- package/dist/components/ui/metric-card.mjs +209 -0
- package/dist/components/ui/metric-card.mjs.map +1 -0
- package/dist/components/ui/modal.d.mts +47 -0
- package/dist/components/ui/modal.d.ts +47 -0
- package/dist/components/ui/modal.js +371 -0
- package/dist/components/ui/modal.js.map +1 -0
- package/dist/components/ui/modal.mjs +313 -0
- package/dist/components/ui/modal.mjs.map +1 -0
- package/dist/components/ui/navigation-menu.d.mts +120 -0
- package/dist/components/ui/navigation-menu.d.ts +120 -0
- package/dist/components/ui/navigation-menu.js +521 -0
- package/dist/components/ui/navigation-menu.js.map +1 -0
- package/dist/components/ui/navigation-menu.mjs +478 -0
- package/dist/components/ui/navigation-menu.mjs.map +1 -0
- package/dist/components/ui/pagination.d.mts +113 -0
- package/dist/components/ui/pagination.d.ts +113 -0
- package/dist/components/ui/pagination.js +484 -0
- package/dist/components/ui/pagination.js.map +1 -0
- package/dist/components/ui/pagination.mjs +438 -0
- package/dist/components/ui/pagination.mjs.map +1 -0
- package/dist/components/ui/popover.d.mts +29 -0
- package/dist/components/ui/popover.d.ts +29 -0
- package/dist/components/ui/popover.js +165 -0
- package/dist/components/ui/popover.js.map +1 -0
- package/dist/components/ui/popover.mjs +124 -0
- package/dist/components/ui/popover.mjs.map +1 -0
- package/dist/components/ui/progress.d.mts +35 -0
- package/dist/components/ui/progress.d.ts +35 -0
- package/dist/components/ui/progress.js +194 -0
- package/dist/components/ui/progress.js.map +1 -0
- package/dist/components/ui/progress.mjs +159 -0
- package/dist/components/ui/progress.mjs.map +1 -0
- package/dist/components/ui/radio-group.d.mts +35 -0
- package/dist/components/ui/radio-group.d.ts +35 -0
- package/dist/components/ui/radio-group.js +174 -0
- package/dist/components/ui/radio-group.js.map +1 -0
- package/dist/components/ui/radio-group.mjs +137 -0
- package/dist/components/ui/radio-group.mjs.map +1 -0
- package/dist/components/ui/segmented.d.mts +25 -0
- package/dist/components/ui/segmented.d.ts +25 -0
- package/dist/components/ui/segmented.js +238 -0
- package/dist/components/ui/segmented.js.map +1 -0
- package/dist/components/ui/segmented.mjs +201 -0
- package/dist/components/ui/segmented.mjs.map +1 -0
- package/dist/components/ui/select.d.mts +20 -0
- package/dist/components/ui/select.d.ts +20 -0
- package/dist/components/ui/select.js +308 -0
- package/dist/components/ui/select.js.map +1 -0
- package/dist/components/ui/select.mjs +267 -0
- package/dist/components/ui/select.mjs.map +1 -0
- package/dist/components/ui/skeleton.d.mts +26 -0
- package/dist/components/ui/skeleton.d.ts +26 -0
- package/dist/components/ui/skeleton.js +144 -0
- package/dist/components/ui/skeleton.js.map +1 -0
- package/dist/components/ui/skeleton.mjs +109 -0
- package/dist/components/ui/skeleton.mjs.map +1 -0
- package/dist/components/ui/slider.d.mts +38 -0
- package/dist/components/ui/slider.d.ts +38 -0
- package/dist/components/ui/slider.js +180 -0
- package/dist/components/ui/slider.js.map +1 -0
- package/dist/components/ui/slider.mjs +145 -0
- package/dist/components/ui/slider.mjs.map +1 -0
- package/dist/components/ui/spinner.d.mts +23 -0
- package/dist/components/ui/spinner.d.ts +23 -0
- package/dist/components/ui/spinner.js +471 -0
- package/dist/components/ui/spinner.js.map +1 -0
- package/dist/components/ui/spinner.mjs +436 -0
- package/dist/components/ui/spinner.mjs.map +1 -0
- package/dist/components/ui/switch.d.mts +22 -0
- package/dist/components/ui/switch.d.ts +22 -0
- package/dist/components/ui/switch.js +173 -0
- package/dist/components/ui/switch.js.map +1 -0
- package/dist/components/ui/switch.mjs +138 -0
- package/dist/components/ui/switch.mjs.map +1 -0
- package/dist/components/ui/table.d.mts +60 -0
- package/dist/components/ui/table.d.ts +60 -0
- package/dist/components/ui/table.js +231 -0
- package/dist/components/ui/table.js.map +1 -0
- package/dist/components/ui/table.mjs +190 -0
- package/dist/components/ui/table.mjs.map +1 -0
- package/dist/components/ui/tabs.d.mts +31 -0
- package/dist/components/ui/tabs.d.ts +31 -0
- package/dist/components/ui/tabs.js +233 -0
- package/dist/components/ui/tabs.js.map +1 -0
- package/dist/components/ui/tabs.mjs +194 -0
- package/dist/components/ui/tabs.mjs.map +1 -0
- package/dist/components/ui/textarea.d.mts +19 -0
- package/dist/components/ui/textarea.d.ts +19 -0
- package/dist/components/ui/textarea.js +181 -0
- package/dist/components/ui/textarea.js.map +1 -0
- package/dist/components/ui/textarea.mjs +146 -0
- package/dist/components/ui/textarea.mjs.map +1 -0
- package/dist/components/ui/toast.d.mts +93 -0
- package/dist/components/ui/toast.d.ts +93 -0
- package/dist/components/ui/toast.js +429 -0
- package/dist/components/ui/toast.js.map +1 -0
- package/dist/components/ui/toast.mjs +393 -0
- package/dist/components/ui/toast.mjs.map +1 -0
- package/dist/components/ui/toggle-group.d.mts +42 -0
- package/dist/components/ui/toggle-group.d.ts +42 -0
- package/dist/components/ui/toggle-group.js +183 -0
- package/dist/components/ui/toggle-group.js.map +1 -0
- package/dist/components/ui/toggle-group.mjs +146 -0
- package/dist/components/ui/toggle-group.mjs.map +1 -0
- package/dist/components/ui/toggle.d.mts +19 -0
- package/dist/components/ui/toggle.d.ts +19 -0
- package/dist/components/ui/toggle.js +194 -0
- package/dist/components/ui/toggle.js.map +1 -0
- package/dist/components/ui/toggle.mjs +159 -0
- package/dist/components/ui/toggle.mjs.map +1 -0
- package/dist/components/ui/tooltip.d.mts +26 -0
- package/dist/components/ui/tooltip.d.ts +26 -0
- package/dist/components/ui/tooltip.js +128 -0
- package/dist/components/ui/tooltip.js.map +1 -0
- package/dist/components/ui/tooltip.mjs +88 -0
- package/dist/components/ui/tooltip.mjs.map +1 -0
- package/dist/lib/code-generator.d.mts +60 -0
- package/dist/lib/code-generator.d.ts +60 -0
- package/dist/lib/code-generator.js +224 -0
- package/dist/lib/code-generator.js.map +1 -0
- package/dist/lib/code-generator.mjs +159 -0
- package/dist/lib/code-generator.mjs.map +1 -0
- package/dist/lib/utils.d.mts +10 -0
- package/dist/lib/utils.d.ts +10 -0
- package/dist/lib/utils.js +33 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/lib/utils.mjs +9 -0
- package/dist/lib/utils.mjs.map +1 -0
- package/package.json +11 -11
- package/dist/chart.js.map +0 -1
- package/dist/chart.mjs.map +0 -1
- package/dist/index.d.mts +0 -1636
- package/dist/index.d.ts +0 -1636
- package/dist/index.js +0 -7291
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -7048
- package/dist/index.mjs.map +0 -1
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
var textarea_exports = {};
|
|
31
|
+
__export(textarea_exports, {
|
|
32
|
+
Textarea: () => Textarea,
|
|
33
|
+
textareaVariants: () => textareaVariants
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(textarea_exports);
|
|
36
|
+
var React = __toESM(require("react"));
|
|
37
|
+
var import_class_variance_authority = require("class-variance-authority");
|
|
38
|
+
var import_utils = require("../../lib/utils");
|
|
39
|
+
var import_field = require("./field");
|
|
40
|
+
const textareaVariants = (0, import_class_variance_authority.cva)(
|
|
41
|
+
[
|
|
42
|
+
"flex w-full bg-background text-foreground placeholder:text-foreground/30",
|
|
43
|
+
"border transition-colors duration-micro outline-transparent",
|
|
44
|
+
"focus:[outline:2px_solid_transparent]",
|
|
45
|
+
"disabled:cursor-not-allowed disabled:opacity-50 disabled:bg-background-muted"
|
|
46
|
+
].join(" "),
|
|
47
|
+
{
|
|
48
|
+
variants: {
|
|
49
|
+
variant: {
|
|
50
|
+
default: "border-border-form hover:border-border-form-strong",
|
|
51
|
+
filled: "border-transparent bg-background-muted"
|
|
52
|
+
},
|
|
53
|
+
focusRing: {
|
|
54
|
+
true: "",
|
|
55
|
+
false: ""
|
|
56
|
+
},
|
|
57
|
+
size: {
|
|
58
|
+
compact: "px-3 py-2 text-md",
|
|
59
|
+
// 12px padding / 14px font - compact spaces
|
|
60
|
+
default: "px-4 py-3 text-base"
|
|
61
|
+
// 16px padding / 16px font - standard
|
|
62
|
+
},
|
|
63
|
+
radius: {
|
|
64
|
+
none: "rounded-none",
|
|
65
|
+
sm: "rounded-sm",
|
|
66
|
+
base: "rounded",
|
|
67
|
+
default: "rounded-md",
|
|
68
|
+
lg: "rounded-lg",
|
|
69
|
+
xl: "rounded-xl",
|
|
70
|
+
"2xl": "rounded-2xl",
|
|
71
|
+
"3xl": "rounded-3xl",
|
|
72
|
+
full: "rounded-3xl"
|
|
73
|
+
// rounded-full looks unnatural on textarea, using 3xl instead
|
|
74
|
+
},
|
|
75
|
+
resize: {
|
|
76
|
+
none: "resize-none",
|
|
77
|
+
vertical: "resize-y",
|
|
78
|
+
horizontal: "resize-x",
|
|
79
|
+
both: "resize"
|
|
80
|
+
},
|
|
81
|
+
state: {
|
|
82
|
+
default: "",
|
|
83
|
+
error: "border-error hover:border-error focus:border-error shadow-[0_0_0_2px_var(--color-focus-ring-error)]"
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
compoundVariants: [
|
|
87
|
+
// focusRing: true → show custom focus ring
|
|
88
|
+
{ focusRing: true, className: "focus-visible:shadow-[0_0_0_2px_var(--color-focus-ring)]" },
|
|
89
|
+
// focusRing: false → keep same state as hover
|
|
90
|
+
{ variant: "default", focusRing: false, className: "focus:border-border-form-strong" },
|
|
91
|
+
// filled + error
|
|
92
|
+
{
|
|
93
|
+
variant: "filled",
|
|
94
|
+
state: "error",
|
|
95
|
+
className: "border-transparent hover:border-transparent focus:border-transparent bg-[var(--color-error-bg)] hover:bg-[var(--color-error-bg)] focus:bg-[var(--color-error-bg)] shadow-none"
|
|
96
|
+
}
|
|
97
|
+
],
|
|
98
|
+
defaultVariants: {
|
|
99
|
+
variant: "default",
|
|
100
|
+
size: "default",
|
|
101
|
+
radius: "default",
|
|
102
|
+
resize: "vertical",
|
|
103
|
+
state: "default",
|
|
104
|
+
focusRing: false
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
);
|
|
108
|
+
const Textarea = React.forwardRef(
|
|
109
|
+
({ className, variant, size, radius, resize, state, error, focusRing, id, rows = 4, onPointerDown, onFocus, onBlur, ...props }, ref) => {
|
|
110
|
+
const fieldContext = (0, import_field.useFieldContext)();
|
|
111
|
+
const resolvedError = error ?? fieldContext?.error;
|
|
112
|
+
const resolvedState = resolvedError ? "error" : state;
|
|
113
|
+
const textareaId = id ?? fieldContext?.id;
|
|
114
|
+
const isDisabled = props.disabled ?? fieldContext?.disabled;
|
|
115
|
+
const pointerRef = React.useRef(false);
|
|
116
|
+
const windowBlurredRef = React.useRef(false);
|
|
117
|
+
const [keyboardFocus, setKeyboardFocus] = React.useState(false);
|
|
118
|
+
React.useEffect(() => {
|
|
119
|
+
const onBlur2 = () => {
|
|
120
|
+
windowBlurredRef.current = true;
|
|
121
|
+
};
|
|
122
|
+
const onFocus2 = () => {
|
|
123
|
+
requestAnimationFrame(() => {
|
|
124
|
+
windowBlurredRef.current = false;
|
|
125
|
+
});
|
|
126
|
+
};
|
|
127
|
+
window.addEventListener("blur", onBlur2);
|
|
128
|
+
window.addEventListener("focus", onFocus2);
|
|
129
|
+
return () => {
|
|
130
|
+
window.removeEventListener("blur", onBlur2);
|
|
131
|
+
window.removeEventListener("focus", onFocus2);
|
|
132
|
+
};
|
|
133
|
+
}, []);
|
|
134
|
+
const handlePointerDown = React.useCallback((e) => {
|
|
135
|
+
pointerRef.current = true;
|
|
136
|
+
onPointerDown?.(e);
|
|
137
|
+
}, [onPointerDown]);
|
|
138
|
+
const handleFocus = React.useCallback((e) => {
|
|
139
|
+
if (!pointerRef.current && !focusRing && !windowBlurredRef.current) {
|
|
140
|
+
setKeyboardFocus(true);
|
|
141
|
+
}
|
|
142
|
+
pointerRef.current = false;
|
|
143
|
+
onFocus?.(e);
|
|
144
|
+
}, [focusRing, onFocus]);
|
|
145
|
+
const handleBlur = React.useCallback((e) => {
|
|
146
|
+
setKeyboardFocus(false);
|
|
147
|
+
pointerRef.current = false;
|
|
148
|
+
onBlur?.(e);
|
|
149
|
+
}, [onBlur]);
|
|
150
|
+
const ariaDescribedBy = fieldContext ? [
|
|
151
|
+
resolvedError ? `${fieldContext.id}-error` : null
|
|
152
|
+
].filter(Boolean).join(" ") || void 0 : void 0;
|
|
153
|
+
return /* @__PURE__ */ React.createElement(
|
|
154
|
+
"textarea",
|
|
155
|
+
{
|
|
156
|
+
id: textareaId,
|
|
157
|
+
rows,
|
|
158
|
+
className: (0, import_utils.cn)(
|
|
159
|
+
textareaVariants({ variant, size, radius, resize, state: resolvedState, focusRing }),
|
|
160
|
+
keyboardFocus && "shadow-[0_0_0_2px_var(--color-focus-ring)]",
|
|
161
|
+
className
|
|
162
|
+
),
|
|
163
|
+
"aria-invalid": resolvedError || void 0,
|
|
164
|
+
"aria-describedby": ariaDescribedBy,
|
|
165
|
+
disabled: isDisabled,
|
|
166
|
+
ref,
|
|
167
|
+
onPointerDown: handlePointerDown,
|
|
168
|
+
onFocus: handleFocus,
|
|
169
|
+
onBlur: handleBlur,
|
|
170
|
+
...props
|
|
171
|
+
}
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
);
|
|
175
|
+
Textarea.displayName = "Textarea";
|
|
176
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
177
|
+
0 && (module.exports = {
|
|
178
|
+
Textarea,
|
|
179
|
+
textareaVariants
|
|
180
|
+
});
|
|
181
|
+
//# sourceMappingURL=textarea.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ui/textarea.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { cn } from '../../lib/utils'\nimport { useFieldContext } from './field'\n\nconst textareaVariants = cva(\n [\n 'flex w-full bg-background text-foreground placeholder:text-foreground/30',\n 'border transition-colors duration-micro outline-transparent',\n 'focus:[outline:2px_solid_transparent]',\n 'disabled:cursor-not-allowed disabled:opacity-50 disabled:bg-background-muted',\n ].join(' '),\n {\n variants: {\n variant: {\n default: 'border-border-form hover:border-border-form-strong',\n filled: 'border-transparent bg-background-muted',\n },\n focusRing: {\n true: '',\n false: '',\n },\n size: {\n compact: 'px-3 py-2 text-md', // 12px padding / 14px font - compact spaces\n default: 'px-4 py-3 text-base', // 16px padding / 16px font - standard\n },\n radius: {\n none: 'rounded-none',\n sm: 'rounded-sm',\n base: 'rounded',\n default: 'rounded-md',\n lg: 'rounded-lg',\n xl: 'rounded-xl',\n '2xl': 'rounded-2xl',\n '3xl': 'rounded-3xl',\n full: 'rounded-3xl', // rounded-full looks unnatural on textarea, using 3xl instead\n },\n resize: {\n none: 'resize-none',\n vertical: 'resize-y',\n horizontal: 'resize-x',\n both: 'resize',\n },\n state: {\n default: '',\n error: 'border-error hover:border-error focus:border-error shadow-[0_0_0_2px_var(--color-focus-ring-error)]',\n },\n },\n compoundVariants: [\n // focusRing: true → show custom focus ring\n { focusRing: true, className: 'focus-visible:shadow-[0_0_0_2px_var(--color-focus-ring)]' },\n // focusRing: false → keep same state as hover\n { variant: 'default', focusRing: false, className: 'focus:border-border-form-strong' },\n // filled + error\n {\n variant: 'filled',\n state: 'error',\n className: 'border-transparent hover:border-transparent focus:border-transparent bg-[var(--color-error-bg)] hover:bg-[var(--color-error-bg)] focus:bg-[var(--color-error-bg)] shadow-none',\n },\n ],\n defaultVariants: {\n variant: 'default',\n size: 'default',\n radius: 'default',\n resize: 'vertical',\n state: 'default',\n focusRing: false,\n },\n }\n)\n\nexport interface TextareaProps\n extends Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'size'>,\n VariantProps<typeof textareaVariants> {\n error?: boolean\n focusRing?: boolean\n}\n\nconst Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(\n ({ className, variant, size, radius, resize, state, error, focusRing, id, rows = 4, onPointerDown, onFocus, onBlur, ...props }, ref) => {\n const fieldContext = useFieldContext()\n const resolvedError = error ?? fieldContext?.error\n const resolvedState = resolvedError ? 'error' : state\n const textareaId = id ?? fieldContext?.id\n const isDisabled = props.disabled ?? fieldContext?.disabled\n\n // Keyboard focus detection (when focusRing: false, auto-show ring on Tab navigation)\n const pointerRef = React.useRef(false)\n const windowBlurredRef = React.useRef(false)\n const [keyboardFocus, setKeyboardFocus] = React.useState(false)\n\n // Track window blur/focus to distinguish Tab navigation from window re-activation\n React.useEffect(() => {\n const onBlur = () => { windowBlurredRef.current = true }\n const onFocus = () => { requestAnimationFrame(() => { windowBlurredRef.current = false }) }\n window.addEventListener('blur', onBlur)\n window.addEventListener('focus', onFocus)\n return () => { window.removeEventListener('blur', onBlur); window.removeEventListener('focus', onFocus) }\n }, [])\n\n const handlePointerDown = React.useCallback((e: React.PointerEvent<HTMLTextAreaElement>) => {\n pointerRef.current = true\n onPointerDown?.(e)\n }, [onPointerDown])\n\n const handleFocus = React.useCallback((e: React.FocusEvent<HTMLTextAreaElement>) => {\n if (!pointerRef.current && !focusRing && !windowBlurredRef.current) {\n setKeyboardFocus(true)\n }\n pointerRef.current = false\n onFocus?.(e)\n }, [focusRing, onFocus])\n\n const handleBlur = React.useCallback((e: React.FocusEvent<HTMLTextAreaElement>) => {\n setKeyboardFocus(false)\n pointerRef.current = false\n onBlur?.(e)\n }, [onBlur])\n\n // Build aria-describedby from context\n const ariaDescribedBy = fieldContext\n ? [\n resolvedError ? `${fieldContext.id}-error` : null,\n ]\n .filter(Boolean)\n .join(' ') || undefined\n : undefined\n\n return (\n <textarea\n id={textareaId}\n rows={rows}\n className={cn(\n textareaVariants({ variant, size, radius, resize, state: resolvedState, focusRing }),\n keyboardFocus && 'shadow-[0_0_0_2px_var(--color-focus-ring)]',\n className\n )}\n aria-invalid={resolvedError || undefined}\n aria-describedby={ariaDescribedBy}\n disabled={isDisabled}\n ref={ref}\n onPointerDown={handlePointerDown}\n onFocus={handleFocus}\n onBlur={handleBlur}\n {...props}\n />\n )\n }\n)\nTextarea.displayName = 'Textarea'\n\nexport { Textarea, textareaVariants }\n"],"mappings":"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","names":["onBlur","onFocus"]}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
import { cn } from "../../lib/utils";
|
|
5
|
+
import { useFieldContext } from "./field";
|
|
6
|
+
const textareaVariants = cva(
|
|
7
|
+
[
|
|
8
|
+
"flex w-full bg-background text-foreground placeholder:text-foreground/30",
|
|
9
|
+
"border transition-colors duration-micro outline-transparent",
|
|
10
|
+
"focus:[outline:2px_solid_transparent]",
|
|
11
|
+
"disabled:cursor-not-allowed disabled:opacity-50 disabled:bg-background-muted"
|
|
12
|
+
].join(" "),
|
|
13
|
+
{
|
|
14
|
+
variants: {
|
|
15
|
+
variant: {
|
|
16
|
+
default: "border-border-form hover:border-border-form-strong",
|
|
17
|
+
filled: "border-transparent bg-background-muted"
|
|
18
|
+
},
|
|
19
|
+
focusRing: {
|
|
20
|
+
true: "",
|
|
21
|
+
false: ""
|
|
22
|
+
},
|
|
23
|
+
size: {
|
|
24
|
+
compact: "px-3 py-2 text-md",
|
|
25
|
+
// 12px padding / 14px font - compact spaces
|
|
26
|
+
default: "px-4 py-3 text-base"
|
|
27
|
+
// 16px padding / 16px font - standard
|
|
28
|
+
},
|
|
29
|
+
radius: {
|
|
30
|
+
none: "rounded-none",
|
|
31
|
+
sm: "rounded-sm",
|
|
32
|
+
base: "rounded",
|
|
33
|
+
default: "rounded-md",
|
|
34
|
+
lg: "rounded-lg",
|
|
35
|
+
xl: "rounded-xl",
|
|
36
|
+
"2xl": "rounded-2xl",
|
|
37
|
+
"3xl": "rounded-3xl",
|
|
38
|
+
full: "rounded-3xl"
|
|
39
|
+
// rounded-full looks unnatural on textarea, using 3xl instead
|
|
40
|
+
},
|
|
41
|
+
resize: {
|
|
42
|
+
none: "resize-none",
|
|
43
|
+
vertical: "resize-y",
|
|
44
|
+
horizontal: "resize-x",
|
|
45
|
+
both: "resize"
|
|
46
|
+
},
|
|
47
|
+
state: {
|
|
48
|
+
default: "",
|
|
49
|
+
error: "border-error hover:border-error focus:border-error shadow-[0_0_0_2px_var(--color-focus-ring-error)]"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
compoundVariants: [
|
|
53
|
+
// focusRing: true → show custom focus ring
|
|
54
|
+
{ focusRing: true, className: "focus-visible:shadow-[0_0_0_2px_var(--color-focus-ring)]" },
|
|
55
|
+
// focusRing: false → keep same state as hover
|
|
56
|
+
{ variant: "default", focusRing: false, className: "focus:border-border-form-strong" },
|
|
57
|
+
// filled + error
|
|
58
|
+
{
|
|
59
|
+
variant: "filled",
|
|
60
|
+
state: "error",
|
|
61
|
+
className: "border-transparent hover:border-transparent focus:border-transparent bg-[var(--color-error-bg)] hover:bg-[var(--color-error-bg)] focus:bg-[var(--color-error-bg)] shadow-none"
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
defaultVariants: {
|
|
65
|
+
variant: "default",
|
|
66
|
+
size: "default",
|
|
67
|
+
radius: "default",
|
|
68
|
+
resize: "vertical",
|
|
69
|
+
state: "default",
|
|
70
|
+
focusRing: false
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
const Textarea = React.forwardRef(
|
|
75
|
+
({ className, variant, size, radius, resize, state, error, focusRing, id, rows = 4, onPointerDown, onFocus, onBlur, ...props }, ref) => {
|
|
76
|
+
const fieldContext = useFieldContext();
|
|
77
|
+
const resolvedError = error ?? fieldContext?.error;
|
|
78
|
+
const resolvedState = resolvedError ? "error" : state;
|
|
79
|
+
const textareaId = id ?? fieldContext?.id;
|
|
80
|
+
const isDisabled = props.disabled ?? fieldContext?.disabled;
|
|
81
|
+
const pointerRef = React.useRef(false);
|
|
82
|
+
const windowBlurredRef = React.useRef(false);
|
|
83
|
+
const [keyboardFocus, setKeyboardFocus] = React.useState(false);
|
|
84
|
+
React.useEffect(() => {
|
|
85
|
+
const onBlur2 = () => {
|
|
86
|
+
windowBlurredRef.current = true;
|
|
87
|
+
};
|
|
88
|
+
const onFocus2 = () => {
|
|
89
|
+
requestAnimationFrame(() => {
|
|
90
|
+
windowBlurredRef.current = false;
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
window.addEventListener("blur", onBlur2);
|
|
94
|
+
window.addEventListener("focus", onFocus2);
|
|
95
|
+
return () => {
|
|
96
|
+
window.removeEventListener("blur", onBlur2);
|
|
97
|
+
window.removeEventListener("focus", onFocus2);
|
|
98
|
+
};
|
|
99
|
+
}, []);
|
|
100
|
+
const handlePointerDown = React.useCallback((e) => {
|
|
101
|
+
pointerRef.current = true;
|
|
102
|
+
onPointerDown?.(e);
|
|
103
|
+
}, [onPointerDown]);
|
|
104
|
+
const handleFocus = React.useCallback((e) => {
|
|
105
|
+
if (!pointerRef.current && !focusRing && !windowBlurredRef.current) {
|
|
106
|
+
setKeyboardFocus(true);
|
|
107
|
+
}
|
|
108
|
+
pointerRef.current = false;
|
|
109
|
+
onFocus?.(e);
|
|
110
|
+
}, [focusRing, onFocus]);
|
|
111
|
+
const handleBlur = React.useCallback((e) => {
|
|
112
|
+
setKeyboardFocus(false);
|
|
113
|
+
pointerRef.current = false;
|
|
114
|
+
onBlur?.(e);
|
|
115
|
+
}, [onBlur]);
|
|
116
|
+
const ariaDescribedBy = fieldContext ? [
|
|
117
|
+
resolvedError ? `${fieldContext.id}-error` : null
|
|
118
|
+
].filter(Boolean).join(" ") || void 0 : void 0;
|
|
119
|
+
return /* @__PURE__ */ React.createElement(
|
|
120
|
+
"textarea",
|
|
121
|
+
{
|
|
122
|
+
id: textareaId,
|
|
123
|
+
rows,
|
|
124
|
+
className: cn(
|
|
125
|
+
textareaVariants({ variant, size, radius, resize, state: resolvedState, focusRing }),
|
|
126
|
+
keyboardFocus && "shadow-[0_0_0_2px_var(--color-focus-ring)]",
|
|
127
|
+
className
|
|
128
|
+
),
|
|
129
|
+
"aria-invalid": resolvedError || void 0,
|
|
130
|
+
"aria-describedby": ariaDescribedBy,
|
|
131
|
+
disabled: isDisabled,
|
|
132
|
+
ref,
|
|
133
|
+
onPointerDown: handlePointerDown,
|
|
134
|
+
onFocus: handleFocus,
|
|
135
|
+
onBlur: handleBlur,
|
|
136
|
+
...props
|
|
137
|
+
}
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
);
|
|
141
|
+
Textarea.displayName = "Textarea";
|
|
142
|
+
export {
|
|
143
|
+
Textarea,
|
|
144
|
+
textareaVariants
|
|
145
|
+
};
|
|
146
|
+
//# sourceMappingURL=textarea.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ui/textarea.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { cn } from '../../lib/utils'\nimport { useFieldContext } from './field'\n\nconst textareaVariants = cva(\n [\n 'flex w-full bg-background text-foreground placeholder:text-foreground/30',\n 'border transition-colors duration-micro outline-transparent',\n 'focus:[outline:2px_solid_transparent]',\n 'disabled:cursor-not-allowed disabled:opacity-50 disabled:bg-background-muted',\n ].join(' '),\n {\n variants: {\n variant: {\n default: 'border-border-form hover:border-border-form-strong',\n filled: 'border-transparent bg-background-muted',\n },\n focusRing: {\n true: '',\n false: '',\n },\n size: {\n compact: 'px-3 py-2 text-md', // 12px padding / 14px font - compact spaces\n default: 'px-4 py-3 text-base', // 16px padding / 16px font - standard\n },\n radius: {\n none: 'rounded-none',\n sm: 'rounded-sm',\n base: 'rounded',\n default: 'rounded-md',\n lg: 'rounded-lg',\n xl: 'rounded-xl',\n '2xl': 'rounded-2xl',\n '3xl': 'rounded-3xl',\n full: 'rounded-3xl', // rounded-full looks unnatural on textarea, using 3xl instead\n },\n resize: {\n none: 'resize-none',\n vertical: 'resize-y',\n horizontal: 'resize-x',\n both: 'resize',\n },\n state: {\n default: '',\n error: 'border-error hover:border-error focus:border-error shadow-[0_0_0_2px_var(--color-focus-ring-error)]',\n },\n },\n compoundVariants: [\n // focusRing: true → show custom focus ring\n { focusRing: true, className: 'focus-visible:shadow-[0_0_0_2px_var(--color-focus-ring)]' },\n // focusRing: false → keep same state as hover\n { variant: 'default', focusRing: false, className: 'focus:border-border-form-strong' },\n // filled + error\n {\n variant: 'filled',\n state: 'error',\n className: 'border-transparent hover:border-transparent focus:border-transparent bg-[var(--color-error-bg)] hover:bg-[var(--color-error-bg)] focus:bg-[var(--color-error-bg)] shadow-none',\n },\n ],\n defaultVariants: {\n variant: 'default',\n size: 'default',\n radius: 'default',\n resize: 'vertical',\n state: 'default',\n focusRing: false,\n },\n }\n)\n\nexport interface TextareaProps\n extends Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'size'>,\n VariantProps<typeof textareaVariants> {\n error?: boolean\n focusRing?: boolean\n}\n\nconst Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(\n ({ className, variant, size, radius, resize, state, error, focusRing, id, rows = 4, onPointerDown, onFocus, onBlur, ...props }, ref) => {\n const fieldContext = useFieldContext()\n const resolvedError = error ?? fieldContext?.error\n const resolvedState = resolvedError ? 'error' : state\n const textareaId = id ?? fieldContext?.id\n const isDisabled = props.disabled ?? fieldContext?.disabled\n\n // Keyboard focus detection (when focusRing: false, auto-show ring on Tab navigation)\n const pointerRef = React.useRef(false)\n const windowBlurredRef = React.useRef(false)\n const [keyboardFocus, setKeyboardFocus] = React.useState(false)\n\n // Track window blur/focus to distinguish Tab navigation from window re-activation\n React.useEffect(() => {\n const onBlur = () => { windowBlurredRef.current = true }\n const onFocus = () => { requestAnimationFrame(() => { windowBlurredRef.current = false }) }\n window.addEventListener('blur', onBlur)\n window.addEventListener('focus', onFocus)\n return () => { window.removeEventListener('blur', onBlur); window.removeEventListener('focus', onFocus) }\n }, [])\n\n const handlePointerDown = React.useCallback((e: React.PointerEvent<HTMLTextAreaElement>) => {\n pointerRef.current = true\n onPointerDown?.(e)\n }, [onPointerDown])\n\n const handleFocus = React.useCallback((e: React.FocusEvent<HTMLTextAreaElement>) => {\n if (!pointerRef.current && !focusRing && !windowBlurredRef.current) {\n setKeyboardFocus(true)\n }\n pointerRef.current = false\n onFocus?.(e)\n }, [focusRing, onFocus])\n\n const handleBlur = React.useCallback((e: React.FocusEvent<HTMLTextAreaElement>) => {\n setKeyboardFocus(false)\n pointerRef.current = false\n onBlur?.(e)\n }, [onBlur])\n\n // Build aria-describedby from context\n const ariaDescribedBy = fieldContext\n ? [\n resolvedError ? `${fieldContext.id}-error` : null,\n ]\n .filter(Boolean)\n .join(' ') || undefined\n : undefined\n\n return (\n <textarea\n id={textareaId}\n rows={rows}\n className={cn(\n textareaVariants({ variant, size, radius, resize, state: resolvedState, focusRing }),\n keyboardFocus && 'shadow-[0_0_0_2px_var(--color-focus-ring)]',\n className\n )}\n aria-invalid={resolvedError || undefined}\n aria-describedby={ariaDescribedBy}\n disabled={isDisabled}\n ref={ref}\n onPointerDown={handlePointerDown}\n onFocus={handleFocus}\n onBlur={handleBlur}\n {...props}\n />\n )\n }\n)\nTextarea.displayName = 'Textarea'\n\nexport { Textarea, textareaVariants }\n"],"mappings":"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","names":["onBlur","onFocus"]}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
declare const toastVariants: (props?: ({
|
|
5
|
+
size?: "default" | "sm" | "lg" | null | undefined;
|
|
6
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
7
|
+
type ToastType = 'default' | 'success' | 'error' | 'warning' | 'info' | 'loading';
|
|
8
|
+
type ToastPosition = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
|
|
9
|
+
type ToastSize = 'sm' | 'default' | 'lg';
|
|
10
|
+
interface ToastAction {
|
|
11
|
+
label: string;
|
|
12
|
+
onClick: () => void;
|
|
13
|
+
}
|
|
14
|
+
interface ToastData {
|
|
15
|
+
id: string;
|
|
16
|
+
type: ToastType;
|
|
17
|
+
message: React.ReactNode;
|
|
18
|
+
description?: React.ReactNode;
|
|
19
|
+
duration?: number;
|
|
20
|
+
dismissible?: boolean;
|
|
21
|
+
closeButton?: boolean;
|
|
22
|
+
icon?: React.ReactNode;
|
|
23
|
+
action?: ToastAction;
|
|
24
|
+
cancel?: ToastAction;
|
|
25
|
+
onDismiss?: (toast: ToastData) => void;
|
|
26
|
+
onAutoClose?: (toast: ToastData) => void;
|
|
27
|
+
className?: string;
|
|
28
|
+
/** Promise state — managed internally */
|
|
29
|
+
_promiseState?: 'loading' | 'success' | 'error';
|
|
30
|
+
}
|
|
31
|
+
interface ToastOptions {
|
|
32
|
+
id?: string;
|
|
33
|
+
description?: React.ReactNode;
|
|
34
|
+
duration?: number;
|
|
35
|
+
dismissible?: boolean;
|
|
36
|
+
closeButton?: boolean;
|
|
37
|
+
icon?: React.ReactNode;
|
|
38
|
+
action?: ToastAction;
|
|
39
|
+
cancel?: ToastAction;
|
|
40
|
+
onDismiss?: (toast: ToastData) => void;
|
|
41
|
+
onAutoClose?: (toast: ToastData) => void;
|
|
42
|
+
className?: string;
|
|
43
|
+
}
|
|
44
|
+
interface PromiseOptions<T> {
|
|
45
|
+
loading: React.ReactNode;
|
|
46
|
+
success: React.ReactNode | ((data: T) => React.ReactNode);
|
|
47
|
+
error: React.ReactNode | ((err: unknown) => React.ReactNode);
|
|
48
|
+
finally?: () => void;
|
|
49
|
+
description?: {
|
|
50
|
+
loading?: React.ReactNode;
|
|
51
|
+
success?: React.ReactNode | ((data: T) => React.ReactNode);
|
|
52
|
+
error?: React.ReactNode | ((err: unknown) => React.ReactNode);
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
declare function toast(message: React.ReactNode, opts?: ToastOptions): string;
|
|
56
|
+
declare namespace toast {
|
|
57
|
+
var success: (message: React.ReactNode, opts?: ToastOptions) => string;
|
|
58
|
+
var error: (message: React.ReactNode, opts?: ToastOptions) => string;
|
|
59
|
+
var warning: (message: React.ReactNode, opts?: ToastOptions) => string;
|
|
60
|
+
var info: (message: React.ReactNode, opts?: ToastOptions) => string;
|
|
61
|
+
var loading: (message: React.ReactNode, opts?: ToastOptions) => string;
|
|
62
|
+
var promise: <T>(promise: Promise<T>, opts: PromiseOptions<T>, toastOpts?: ToastOptions) => Promise<T>;
|
|
63
|
+
var dismiss: (id?: string) => void;
|
|
64
|
+
var custom: (render: (t: ToastData) => React.ReactNode, opts?: ToastOptions) => string;
|
|
65
|
+
}
|
|
66
|
+
interface ToasterProps {
|
|
67
|
+
/** Position on screen */
|
|
68
|
+
position?: ToastPosition;
|
|
69
|
+
/** Default auto-dismiss duration in ms (0 = persistent) */
|
|
70
|
+
duration?: number;
|
|
71
|
+
/** Max visible toasts */
|
|
72
|
+
visibleToasts?: number;
|
|
73
|
+
/** Show close button on all toasts */
|
|
74
|
+
closeButton?: boolean;
|
|
75
|
+
/** Use rich (filled) colors for status toasts — default: true */
|
|
76
|
+
richColors?: boolean;
|
|
77
|
+
/** Expand all toasts (no stacking) */
|
|
78
|
+
expand?: boolean;
|
|
79
|
+
/** Offset from screen edge in px */
|
|
80
|
+
offset?: number;
|
|
81
|
+
/** Gap between toasts in px */
|
|
82
|
+
gap?: number;
|
|
83
|
+
/** Toast size */
|
|
84
|
+
size?: ToastSize;
|
|
85
|
+
/** Additional className for container */
|
|
86
|
+
className?: string;
|
|
87
|
+
}
|
|
88
|
+
declare function Toaster({ position, duration, visibleToasts, closeButton, richColors, expand, offset, gap, size, className, }: ToasterProps): React.JSX.Element;
|
|
89
|
+
declare namespace Toaster {
|
|
90
|
+
var displayName: string;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export { type PromiseOptions, type ToastAction, type ToastData, type ToastOptions, type ToastPosition, type ToastSize, type ToastType, Toaster, type ToasterProps, toast, toastVariants };
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
declare const toastVariants: (props?: ({
|
|
5
|
+
size?: "default" | "sm" | "lg" | null | undefined;
|
|
6
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
7
|
+
type ToastType = 'default' | 'success' | 'error' | 'warning' | 'info' | 'loading';
|
|
8
|
+
type ToastPosition = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
|
|
9
|
+
type ToastSize = 'sm' | 'default' | 'lg';
|
|
10
|
+
interface ToastAction {
|
|
11
|
+
label: string;
|
|
12
|
+
onClick: () => void;
|
|
13
|
+
}
|
|
14
|
+
interface ToastData {
|
|
15
|
+
id: string;
|
|
16
|
+
type: ToastType;
|
|
17
|
+
message: React.ReactNode;
|
|
18
|
+
description?: React.ReactNode;
|
|
19
|
+
duration?: number;
|
|
20
|
+
dismissible?: boolean;
|
|
21
|
+
closeButton?: boolean;
|
|
22
|
+
icon?: React.ReactNode;
|
|
23
|
+
action?: ToastAction;
|
|
24
|
+
cancel?: ToastAction;
|
|
25
|
+
onDismiss?: (toast: ToastData) => void;
|
|
26
|
+
onAutoClose?: (toast: ToastData) => void;
|
|
27
|
+
className?: string;
|
|
28
|
+
/** Promise state — managed internally */
|
|
29
|
+
_promiseState?: 'loading' | 'success' | 'error';
|
|
30
|
+
}
|
|
31
|
+
interface ToastOptions {
|
|
32
|
+
id?: string;
|
|
33
|
+
description?: React.ReactNode;
|
|
34
|
+
duration?: number;
|
|
35
|
+
dismissible?: boolean;
|
|
36
|
+
closeButton?: boolean;
|
|
37
|
+
icon?: React.ReactNode;
|
|
38
|
+
action?: ToastAction;
|
|
39
|
+
cancel?: ToastAction;
|
|
40
|
+
onDismiss?: (toast: ToastData) => void;
|
|
41
|
+
onAutoClose?: (toast: ToastData) => void;
|
|
42
|
+
className?: string;
|
|
43
|
+
}
|
|
44
|
+
interface PromiseOptions<T> {
|
|
45
|
+
loading: React.ReactNode;
|
|
46
|
+
success: React.ReactNode | ((data: T) => React.ReactNode);
|
|
47
|
+
error: React.ReactNode | ((err: unknown) => React.ReactNode);
|
|
48
|
+
finally?: () => void;
|
|
49
|
+
description?: {
|
|
50
|
+
loading?: React.ReactNode;
|
|
51
|
+
success?: React.ReactNode | ((data: T) => React.ReactNode);
|
|
52
|
+
error?: React.ReactNode | ((err: unknown) => React.ReactNode);
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
declare function toast(message: React.ReactNode, opts?: ToastOptions): string;
|
|
56
|
+
declare namespace toast {
|
|
57
|
+
var success: (message: React.ReactNode, opts?: ToastOptions) => string;
|
|
58
|
+
var error: (message: React.ReactNode, opts?: ToastOptions) => string;
|
|
59
|
+
var warning: (message: React.ReactNode, opts?: ToastOptions) => string;
|
|
60
|
+
var info: (message: React.ReactNode, opts?: ToastOptions) => string;
|
|
61
|
+
var loading: (message: React.ReactNode, opts?: ToastOptions) => string;
|
|
62
|
+
var promise: <T>(promise: Promise<T>, opts: PromiseOptions<T>, toastOpts?: ToastOptions) => Promise<T>;
|
|
63
|
+
var dismiss: (id?: string) => void;
|
|
64
|
+
var custom: (render: (t: ToastData) => React.ReactNode, opts?: ToastOptions) => string;
|
|
65
|
+
}
|
|
66
|
+
interface ToasterProps {
|
|
67
|
+
/** Position on screen */
|
|
68
|
+
position?: ToastPosition;
|
|
69
|
+
/** Default auto-dismiss duration in ms (0 = persistent) */
|
|
70
|
+
duration?: number;
|
|
71
|
+
/** Max visible toasts */
|
|
72
|
+
visibleToasts?: number;
|
|
73
|
+
/** Show close button on all toasts */
|
|
74
|
+
closeButton?: boolean;
|
|
75
|
+
/** Use rich (filled) colors for status toasts — default: true */
|
|
76
|
+
richColors?: boolean;
|
|
77
|
+
/** Expand all toasts (no stacking) */
|
|
78
|
+
expand?: boolean;
|
|
79
|
+
/** Offset from screen edge in px */
|
|
80
|
+
offset?: number;
|
|
81
|
+
/** Gap between toasts in px */
|
|
82
|
+
gap?: number;
|
|
83
|
+
/** Toast size */
|
|
84
|
+
size?: ToastSize;
|
|
85
|
+
/** Additional className for container */
|
|
86
|
+
className?: string;
|
|
87
|
+
}
|
|
88
|
+
declare function Toaster({ position, duration, visibleToasts, closeButton, richColors, expand, offset, gap, size, className, }: ToasterProps): React.JSX.Element;
|
|
89
|
+
declare namespace Toaster {
|
|
90
|
+
var displayName: string;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export { type PromiseOptions, type ToastAction, type ToastData, type ToastOptions, type ToastPosition, type ToastSize, type ToastType, Toaster, type ToasterProps, toast, toastVariants };
|