@sarunyu/system-one 4.9.13 → 4.9.22
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/index.cjs +28 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +28 -14
- package/dist/index.js.map +1 -1
- package/dist/src/components/alert.d.ts +1 -0
- package/dist/src/components/alert.d.ts.map +1 -1
- package/dist/src/components/toast.d.ts.map +1 -1
- package/dist/style.css +2 -1
- package/llms.txt +26 -19
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -344,8 +344,9 @@ function AlertStatusIcon({
|
|
|
344
344
|
if (status === "critical") return /* @__PURE__ */ jsxRuntime.jsx(react.XCircle, { size: 16, weight: "fill", className });
|
|
345
345
|
return /* @__PURE__ */ jsxRuntime.jsx(react.Info, { size: 16, weight: "fill", className });
|
|
346
346
|
}
|
|
347
|
-
const Alert = React.forwardRef(function Alert2({ status = "normal", message, multiline = false, className }, ref) {
|
|
347
|
+
const Alert = React.forwardRef(function Alert2({ status = "normal", title, message, multiline = false, className }, ref) {
|
|
348
348
|
const style = alertStyles[status];
|
|
349
|
+
const hasTitle = Boolean(title);
|
|
349
350
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
350
351
|
"div",
|
|
351
352
|
{
|
|
@@ -353,23 +354,33 @@ const Alert = React.forwardRef(function Alert2({ status = "normal", message, mul
|
|
|
353
354
|
role: "status",
|
|
354
355
|
className: cn(
|
|
355
356
|
"flex w-full items-center gap-1.5 rounded px-2 py-1",
|
|
356
|
-
multiline && "items-start",
|
|
357
|
+
(multiline || hasTitle) && "items-start",
|
|
357
358
|
style.container,
|
|
358
359
|
className
|
|
359
360
|
),
|
|
360
361
|
children: [
|
|
361
|
-
/* @__PURE__ */ jsxRuntime.jsx(AlertStatusIcon, { status, className: cn("shrink-0", multiline && "mt-0.5", style.icon) }),
|
|
362
362
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
363
|
-
|
|
363
|
+
AlertStatusIcon,
|
|
364
364
|
{
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
multiline ? "line-clamp-2" : "truncate",
|
|
368
|
-
style.text
|
|
369
|
-
),
|
|
370
|
-
children: message
|
|
365
|
+
status,
|
|
366
|
+
className: cn("shrink-0 mt-0.5", style.icon)
|
|
371
367
|
}
|
|
372
|
-
)
|
|
368
|
+
),
|
|
369
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1 flex flex-col gap-0.5", children: [
|
|
370
|
+
hasTitle && /* @__PURE__ */ jsxRuntime.jsx("p", { className: cn("text-sm leading-5 font-medium", style.text), children: title }),
|
|
371
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
372
|
+
"p",
|
|
373
|
+
{
|
|
374
|
+
className: cn(
|
|
375
|
+
"text-sm leading-5 font-normal",
|
|
376
|
+
!hasTitle && !multiline && "truncate",
|
|
377
|
+
!hasTitle && multiline && "line-clamp-2",
|
|
378
|
+
style.text
|
|
379
|
+
),
|
|
380
|
+
children: message
|
|
381
|
+
}
|
|
382
|
+
)
|
|
383
|
+
] })
|
|
373
384
|
]
|
|
374
385
|
}
|
|
375
386
|
);
|
|
@@ -4186,7 +4197,7 @@ const Toast = React.forwardRef(function Toast2({
|
|
|
4186
4197
|
);
|
|
4187
4198
|
});
|
|
4188
4199
|
Toast.displayName = "Toast";
|
|
4189
|
-
function ToastStack({ items, className, renderItem }) {
|
|
4200
|
+
function ToastStack({ items = [], className, renderItem }) {
|
|
4190
4201
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("flex flex-col gap-2", className), children: items.map(
|
|
4191
4202
|
(item) => renderItem ? /* @__PURE__ */ jsxRuntime.jsx("div", { children: renderItem(item) }, item.id) : /* @__PURE__ */ jsxRuntime.jsx(Toast, { ...item }, item.id)
|
|
4192
4203
|
) });
|
|
@@ -4194,6 +4205,9 @@ function ToastStack({ items, className, renderItem }) {
|
|
|
4194
4205
|
function Toaster({ items, renderItem, className, duration = 4e3, onRemove }) {
|
|
4195
4206
|
const timers = React.useRef(/* @__PURE__ */ new Map());
|
|
4196
4207
|
React.useEffect(() => {
|
|
4208
|
+
if (duration > 0 && !onRemove) {
|
|
4209
|
+
console.warn("[Toaster] duration is set but onRemove is not provided — toasts will never dismiss. Pass onRemove={(id) => setToasts(t => t.filter(x => x.id !== id))} to enable auto-dismiss.");
|
|
4210
|
+
}
|
|
4197
4211
|
if (!onRemove || duration === 0) return;
|
|
4198
4212
|
items.forEach((item) => {
|
|
4199
4213
|
if (!timers.current.has(item.id)) {
|
|
@@ -4663,7 +4677,7 @@ const Tag = React.forwardRef(function Tag2({
|
|
|
4663
4677
|
{
|
|
4664
4678
|
ref,
|
|
4665
4679
|
className: cn(
|
|
4666
|
-
"inline-flex items-center justify-center rounded-[4px]",
|
|
4680
|
+
"inline-flex w-fit items-center justify-center rounded-[4px]",
|
|
4667
4681
|
(icon || close) && "gap-[2px]",
|
|
4668
4682
|
s.container,
|
|
4669
4683
|
bgClass,
|
|
@@ -4716,7 +4730,7 @@ function StatusTag({ type = "stop", text, className }) {
|
|
|
4716
4730
|
"div",
|
|
4717
4731
|
{
|
|
4718
4732
|
className: cn(
|
|
4719
|
-
"inline-flex items-center justify-center gap-1 rounded-[8px] px-2 py-1",
|
|
4733
|
+
"inline-flex w-fit items-center justify-center gap-1 rounded-[8px] px-2 py-1",
|
|
4720
4734
|
className
|
|
4721
4735
|
),
|
|
4722
4736
|
children: [
|