@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.js CHANGED
@@ -325,8 +325,9 @@ function AlertStatusIcon({
325
325
  if (status === "critical") return /* @__PURE__ */ jsx(XCircle, { size: 16, weight: "fill", className });
326
326
  return /* @__PURE__ */ jsx(Info, { size: 16, weight: "fill", className });
327
327
  }
328
- const Alert = forwardRef(function Alert2({ status = "normal", message, multiline = false, className }, ref) {
328
+ const Alert = forwardRef(function Alert2({ status = "normal", title, message, multiline = false, className }, ref) {
329
329
  const style = alertStyles[status];
330
+ const hasTitle = Boolean(title);
330
331
  return /* @__PURE__ */ jsxs(
331
332
  "div",
332
333
  {
@@ -334,23 +335,33 @@ const Alert = forwardRef(function Alert2({ status = "normal", message, multiline
334
335
  role: "status",
335
336
  className: cn(
336
337
  "flex w-full items-center gap-1.5 rounded px-2 py-1",
337
- multiline && "items-start",
338
+ (multiline || hasTitle) && "items-start",
338
339
  style.container,
339
340
  className
340
341
  ),
341
342
  children: [
342
- /* @__PURE__ */ jsx(AlertStatusIcon, { status, className: cn("shrink-0", multiline && "mt-0.5", style.icon) }),
343
343
  /* @__PURE__ */ jsx(
344
- "p",
344
+ AlertStatusIcon,
345
345
  {
346
- className: cn(
347
- "min-w-0 flex-1 text-sm leading-5 font-normal",
348
- multiline ? "line-clamp-2" : "truncate",
349
- style.text
350
- ),
351
- children: message
346
+ status,
347
+ className: cn("shrink-0 mt-0.5", style.icon)
352
348
  }
353
- )
349
+ ),
350
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1 flex flex-col gap-0.5", children: [
351
+ hasTitle && /* @__PURE__ */ jsx("p", { className: cn("text-sm leading-5 font-medium", style.text), children: title }),
352
+ /* @__PURE__ */ jsx(
353
+ "p",
354
+ {
355
+ className: cn(
356
+ "text-sm leading-5 font-normal",
357
+ !hasTitle && !multiline && "truncate",
358
+ !hasTitle && multiline && "line-clamp-2",
359
+ style.text
360
+ ),
361
+ children: message
362
+ }
363
+ )
364
+ ] })
354
365
  ]
355
366
  }
356
367
  );
@@ -4167,7 +4178,7 @@ const Toast = forwardRef(function Toast2({
4167
4178
  );
4168
4179
  });
4169
4180
  Toast.displayName = "Toast";
4170
- function ToastStack({ items, className, renderItem }) {
4181
+ function ToastStack({ items = [], className, renderItem }) {
4171
4182
  return /* @__PURE__ */ jsx("div", { className: cn("flex flex-col gap-2", className), children: items.map(
4172
4183
  (item) => renderItem ? /* @__PURE__ */ jsx("div", { children: renderItem(item) }, item.id) : /* @__PURE__ */ jsx(Toast, { ...item }, item.id)
4173
4184
  ) });
@@ -4175,6 +4186,9 @@ function ToastStack({ items, className, renderItem }) {
4175
4186
  function Toaster({ items, renderItem, className, duration = 4e3, onRemove }) {
4176
4187
  const timers = useRef(/* @__PURE__ */ new Map());
4177
4188
  useEffect(() => {
4189
+ if (duration > 0 && !onRemove) {
4190
+ 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.");
4191
+ }
4178
4192
  if (!onRemove || duration === 0) return;
4179
4193
  items.forEach((item) => {
4180
4194
  if (!timers.current.has(item.id)) {
@@ -4644,7 +4658,7 @@ const Tag = forwardRef(function Tag2({
4644
4658
  {
4645
4659
  ref,
4646
4660
  className: cn(
4647
- "inline-flex items-center justify-center rounded-[4px]",
4661
+ "inline-flex w-fit items-center justify-center rounded-[4px]",
4648
4662
  (icon || close) && "gap-[2px]",
4649
4663
  s.container,
4650
4664
  bgClass,
@@ -4697,7 +4711,7 @@ function StatusTag({ type = "stop", text, className }) {
4697
4711
  "div",
4698
4712
  {
4699
4713
  className: cn(
4700
- "inline-flex items-center justify-center gap-1 rounded-[8px] px-2 py-1",
4714
+ "inline-flex w-fit items-center justify-center gap-1 rounded-[8px] px-2 py-1",
4701
4715
  className
4702
4716
  ),
4703
4717
  children: [