@yuhuanowo/yunui 0.2.13 → 0.2.14

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/patterns.js CHANGED
@@ -1,12 +1,12 @@
1
1
  "use client";
2
- import { Button, Card, Badge, Avatar, AvatarImage, AvatarFallback, IconButton, Spinner } from './chunk-MTEICYIC.js';
2
+ import { Button, Card, Badge, Avatar, AvatarImage, AvatarFallback, IconButton, Spinner } from './chunk-VXFEANVX.js';
3
3
  import { copyToClipboard } from './chunk-N53PNMPJ.js';
4
4
  export { Footer } from './chunk-N53PNMPJ.js';
5
- import { cn } from './chunk-TFZKMJGF.js';
5
+ import { cn } from './chunk-GHO4RCDR.js';
6
6
  import { useYunUI } from './chunk-U2LNRVMI.js';
7
7
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
8
8
  import React, { useState, useEffect, useCallback, useRef } from 'react';
9
- import { AlertCircle, RefreshCw, Check, Copy, Plus, FileText, ExternalLink, Calendar, Clock, User, ChevronLeft, ChevronRight, PanelLeftClose, X, ArrowUpRight, ArrowDownRight, GraduationCap, ArrowRight, Award, Waves, SlidersHorizontal, Layers, Fingerprint, Ban, Image, Brain, Eye, Code, MessageSquare, XCircle, Zap, CheckCircle, FileCode, EyeOff } from 'lucide-react';
9
+ import { AlertCircle, RefreshCw, Check, Copy, Plus, FileText, ExternalLink, Calendar, Clock, User, ChevronLeft, ChevronRight, PanelLeftClose, X, ArrowUpRight, ArrowDownRight, GraduationCap, ArrowRight, Award, Waves, SlidersHorizontal, Layers, Fingerprint, Ban, Image, Brain, Eye, Code, MessageSquare, XCircle, Zap, CheckCircle, FileCode, EyeOff, Sparkles, Globe, Loader2, LogOut, Bell, Trash2, Camera, Info, CheckCircle2, AlertTriangle } from 'lucide-react';
10
10
 
11
11
  function BackgroundEffects() {
12
12
  return /* @__PURE__ */ jsx("div", { className: "absolute inset-0 -z-10 h-full w-full pointer-events-none select-none overflow-hidden bg-(--bg-base)", children: /* @__PURE__ */ jsx(
@@ -175,7 +175,7 @@ function CodeBlock({
175
175
  {
176
176
  onClick: () => handleTabChange(index),
177
177
  className: cn(
178
- "px-3 py-1 rounded-md text-xs font-medium transition-all",
178
+ "px-3 py-1 rounded-md text-xs font-medium transition-all outline-none focus-visible:ring-2 focus-visible:ring-ring",
179
179
  activeTab === index ? "bg-(--accent-subtle) text-(--text-primary)" : "text-(--text-tertiary) hover:text-(--text-secondary) hover:bg-(--accent-subtle)/50"
180
180
  ),
181
181
  children: tab.label
@@ -187,7 +187,7 @@ function CodeBlock({
187
187
  "button",
188
188
  {
189
189
  onClick: handleCopy,
190
- className: "flex items-center gap-1.5 px-2.5 py-1 rounded-md text-xs font-medium transition-all hover:bg-(--accent-subtle)",
190
+ className: "flex items-center gap-1.5 px-2.5 py-1 rounded-md text-xs font-medium transition-all hover:bg-(--accent-subtle) outline-none focus-visible:ring-2 focus-visible:ring-ring",
191
191
  children: copied ? /* @__PURE__ */ jsxs(Fragment, { children: [
192
192
  /* @__PURE__ */ jsx(Check, { className: "w-3.5 h-3.5 text-(--success)" }),
193
193
  /* @__PURE__ */ jsx("span", { className: "text-(--success)", children: t("copied") })
@@ -268,14 +268,15 @@ function FAQ({ items, defaultOpenIndex = 0 }) {
268
268
  {
269
269
  className: cn(
270
270
  "glass-card overflow-hidden transition-all duration-300",
271
- openIndex === i ? "bg-card/60 ring-1 ring-accent-muted" : "hover:bg-card/50"
271
+ openIndex === i ? "bg-card/60 ring-1 ring-(--accent-muted)" : "hover:bg-card/50"
272
272
  ),
273
273
  children: [
274
274
  /* @__PURE__ */ jsxs(
275
275
  "button",
276
276
  {
277
277
  onClick: () => setOpenIndex(openIndex === i ? null : i),
278
- className: "w-full flex items-center justify-between p-6 text-left gap-4",
278
+ "aria-expanded": openIndex === i,
279
+ className: "w-full flex items-center justify-between p-6 text-left gap-4 outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset rounded-[inherit]",
279
280
  children: [
280
281
  /* @__PURE__ */ jsx("span", { className: "font-semibold text-foreground flex-1 min-w-0", children: faq.question }),
281
282
  /* @__PURE__ */ jsx("span", { className: cn("text-muted-foreground transition-transform duration-300 shrink-0", openIndex === i ? "rotate-45" : ""), children: /* @__PURE__ */ jsx(Plus, { className: "w-5 h-5" }) })
@@ -392,7 +393,8 @@ function BlogCard({
392
393
  const { Link } = useYunUI();
393
394
  const formattedDate = date ? formatDate(date, locale) : null;
394
395
  const isFeatured = variant === "featured";
395
- return /* @__PURE__ */ jsx(Link, { href: url, className: "block h-full", children: /* @__PURE__ */ jsxs(Card, { hover: true, className: `overflow-hidden h-full flex flex-col ${isFeatured ? "md:col-span-2" : ""}`, children: [
396
+ return /* @__PURE__ */ jsxs(Card, { hover: true, className: `group relative overflow-hidden h-full flex flex-col ${isFeatured ? "md:col-span-2" : ""}`, children: [
397
+ /* @__PURE__ */ jsx(Link, { href: url, "aria-label": title, className: "absolute inset-0 z-0 outline-none focus-visible:ring-2 focus-visible:ring-ring rounded-[inherit]" }),
396
398
  /* @__PURE__ */ jsx("div", { className: "aspect-video w-full overflow-hidden bg-muted flex-shrink-0", children: coverImage ? /* @__PURE__ */ jsx(
397
399
  "img",
398
400
  {
@@ -420,16 +422,11 @@ function BlogCard({
420
422
  author.name
421
423
  ] })
422
424
  ] }),
423
- tags && tags.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1 mt-3", children: tags.slice(0, 3).map((tag) => /* @__PURE__ */ jsxs(
424
- "button",
425
+ tags && tags.length > 0 && /* @__PURE__ */ jsx("div", { className: "relative z-10 flex flex-wrap gap-1 mt-3", children: tags.slice(0, 3).map((tag) => /* @__PURE__ */ jsxs(
426
+ Link,
425
427
  {
426
- type: "button",
427
- onClick: (e) => {
428
- e.preventDefault();
429
- e.stopPropagation();
430
- window.location.href = `/blog?tag=${tag}`;
431
- },
432
- className: "text-xs bg-muted px-2 py-0.5 rounded hover:bg-muted/80 transition-colors cursor-pointer",
428
+ href: `/blog?tag=${tag}`,
429
+ className: "text-xs bg-muted px-2 py-0.5 rounded hover:bg-muted/80 transition-colors cursor-pointer outline-none focus-visible:ring-2 focus-visible:ring-ring",
433
430
  children: [
434
431
  "#",
435
432
  tag
@@ -438,7 +435,7 @@ function BlogCard({
438
435
  tag
439
436
  )) })
440
437
  ] })
441
- ] }) });
438
+ ] });
442
439
  }
443
440
  function BlogPostHeader({
444
441
  title,
@@ -564,6 +561,30 @@ function BlogPagination({
564
561
  )
565
562
  ] });
566
563
  }
564
+ function SimplePagination({
565
+ currentPage,
566
+ hasPrevious,
567
+ hasNext,
568
+ onPrevious,
569
+ onNext,
570
+ labels
571
+ }) {
572
+ const canPrev = hasPrevious ?? currentPage > 1;
573
+ const previousLabel = labels?.previous ?? "Previous";
574
+ const nextLabel = labels?.next ?? "Next";
575
+ const pageNode = labels?.page ? labels.page(currentPage) : `Page ${currentPage}`;
576
+ return /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center gap-1.5 sm:gap-2", children: [
577
+ /* @__PURE__ */ jsxs(Button, { variant: "ghost", size: "sm", onClick: onPrevious, disabled: !canPrev, children: [
578
+ /* @__PURE__ */ jsx(ChevronLeft, { size: 16 }),
579
+ /* @__PURE__ */ jsx("span", { className: "ml-1 hidden sm:inline", children: previousLabel })
580
+ ] }),
581
+ /* @__PURE__ */ jsx("span", { className: "px-3 text-sm font-medium tabular-nums whitespace-nowrap", children: pageNode }),
582
+ /* @__PURE__ */ jsxs(Button, { variant: "ghost", size: "sm", onClick: onNext, disabled: !hasNext, children: [
583
+ /* @__PURE__ */ jsx("span", { className: "mr-1 hidden sm:inline", children: nextLabel }),
584
+ /* @__PURE__ */ jsx(ChevronRight, { size: 16 })
585
+ ] })
586
+ ] });
587
+ }
567
588
  function CategoryFilter({
568
589
  categories,
569
590
  selectedCategory,
@@ -578,6 +599,7 @@ function CategoryFilter({
578
599
  variant: "ghost",
579
600
  size: "sm",
580
601
  onClick: () => handleCategoryClick(null),
602
+ "aria-pressed": !selectedCategory,
581
603
  className: !selectedCategory ? "font-semibold" : "",
582
604
  style: !selectedCategory ? { background: "var(--bg-elevated)", color: "var(--text-primary)" } : void 0,
583
605
  children: allLabel
@@ -589,6 +611,7 @@ function CategoryFilter({
589
611
  variant: "ghost",
590
612
  size: "sm",
591
613
  onClick: () => handleCategoryClick(category),
614
+ "aria-pressed": selectedCategory === category,
592
615
  className: selectedCategory === category ? "font-semibold" : "",
593
616
  style: selectedCategory === category ? { background: "var(--bg-elevated)", color: "var(--text-primary)" } : void 0,
594
617
  children: category
@@ -719,12 +742,12 @@ function PageLoadingState({ message }) {
719
742
  }
720
743
  function PageErrorState({ message, onRetry, retryLabel = "Retry" }) {
721
744
  return /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center py-16 text-center", children: [
722
- /* @__PURE__ */ jsx("div", { className: "text-red-600 dark:text-red-400 font-medium mb-2", children: message }),
745
+ /* @__PURE__ */ jsx("div", { className: "text-error font-medium mb-2", children: message }),
723
746
  onRetry && /* @__PURE__ */ jsx(
724
747
  "button",
725
748
  {
726
749
  onClick: onRetry,
727
- className: "text-sm text-muted-foreground hover:text-foreground transition-colors underline",
750
+ className: "text-sm text-muted-foreground hover:text-foreground transition-colors underline outline-none focus-visible:ring-2 focus-visible:ring-ring rounded",
728
751
  children: retryLabel
729
752
  }
730
753
  )
@@ -808,7 +831,7 @@ function FellowsBanner({
808
831
  Link,
809
832
  {
810
833
  href,
811
- className: `card p-5 flex flex-col gap-4 sm:flex-row sm:items-center border-2 border-primary/20 bg-gradient-to-r from-primary/5 to-transparent hover:border-primary/40 transition-all group ${className}`,
834
+ className: `card p-5 flex flex-col gap-4 sm:flex-row sm:items-center border-2 border-primary/20 bg-linear-to-r from-primary/5 to-transparent hover:border-primary/40 transition-all group outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background ${className}`,
812
835
  children: [
813
836
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4 flex-1 min-w-0", children: [
814
837
  /* @__PURE__ */ jsx("div", { className: "p-3 bg-primary/10 rounded-xl shrink-0", children: /* @__PURE__ */ jsx(GraduationCap, { className: "w-6 h-6 text-primary" }) }),
@@ -832,7 +855,7 @@ function ErrorFallback({
832
855
  labels
833
856
  }) {
834
857
  return /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center min-h-100 p-8", children: [
835
- /* @__PURE__ */ jsx("div", { className: "w-16 h-16 rounded-full bg-red-100 dark:bg-red-900/20 flex items-center justify-center mb-4", children: /* @__PURE__ */ jsx(AlertCircle, { size: 32, className: "text-red-500" }) }),
858
+ /* @__PURE__ */ jsx("div", { className: "w-16 h-16 rounded-full bg-error-soft flex items-center justify-center mb-4", children: /* @__PURE__ */ jsx(AlertCircle, { size: 32, className: "text-error" }) }),
836
859
  /* @__PURE__ */ jsx("h2", { className: "text-xl font-semibold mb-2", children: labels?.title ?? "Something went wrong" }),
837
860
  /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-center mb-4 max-w-md", children: error?.message || labels?.message || "An unexpected error occurred." }),
838
861
  /* @__PURE__ */ jsxs(Button, { variant: "secondary", onClick: onRetry, className: "whitespace-nowrap", children: [
@@ -887,7 +910,7 @@ function AccountLockedCard({
887
910
  /* @__PURE__ */ jsx("span", { className: "font-semibold text-[15px]", children: appName })
888
911
  ] }),
889
912
  /* @__PURE__ */ jsxs("div", { className: "p-6 bg-card border border-border rounded-xl", children: [
890
- /* @__PURE__ */ jsx("div", { className: "mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-error/10", children: icon }),
913
+ /* @__PURE__ */ jsx("div", { className: "mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-error-soft", children: icon }),
891
914
  /* @__PURE__ */ jsx("h1", { className: "text-xl font-semibold mb-2 text-center", children: title }),
892
915
  /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground mb-5 text-center", children: subtitle }),
893
916
  children,
@@ -898,7 +921,7 @@ function AccountLockedCard({
898
921
  type: "button",
899
922
  onClick: onBack,
900
923
  disabled: loading,
901
- className: "w-full h-10 rounded-lg bg-primary text-primary-foreground text-sm font-medium hover:opacity-90 transition-opacity disabled:opacity-60",
924
+ className: "w-full h-10 rounded-lg bg-primary text-primary-foreground text-sm font-medium hover:opacity-90 transition-opacity disabled:opacity-60 outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
902
925
  children: backLabel
903
926
  }
904
927
  )
@@ -918,7 +941,7 @@ function MediaPageHeader({ title, description, isSyncing, syncError, onSync, sta
918
941
  /* @__PURE__ */ jsx("span", { className: "ml-2", children: isSyncing ? t("syncing") : t("sync") })
919
942
  ] })
920
943
  ] }),
921
- syncError && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 p-3 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 text-red-700 dark:text-red-300 text-sm", children: [
944
+ syncError && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 p-3 rounded-lg bg-error-soft border border-error-soft text-error text-sm", children: [
922
945
  /* @__PURE__ */ jsx(AlertCircle, { size: 16 }),
923
946
  /* @__PURE__ */ jsx("span", { children: syncError })
924
947
  ] }),
@@ -947,8 +970,8 @@ function MediaLoadingState({ message }) {
947
970
  function MediaErrorState({ message, onRetry }) {
948
971
  const t = useYunUI().useT("components.mediaPageHeader");
949
972
  return /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center py-16 text-center", children: [
950
- /* @__PURE__ */ jsx(AlertCircle, { size: 40, className: "text-red-500/50 mb-3" }),
951
- /* @__PURE__ */ jsx("div", { className: "font-medium text-red-600 dark:text-red-400 mb-1", children: t("error") }),
973
+ /* @__PURE__ */ jsx(AlertCircle, { size: 40, className: "text-error opacity-50 mb-3" }),
974
+ /* @__PURE__ */ jsx("div", { className: "font-medium text-error mb-1", children: t("error") }),
952
975
  /* @__PURE__ */ jsx("div", { className: "text-caption mb-4", children: message }),
953
976
  onRetry && /* @__PURE__ */ jsxs(Button, { variant: "outline", size: "sm", onClick: onRetry, children: [
954
977
  /* @__PURE__ */ jsx(RefreshCw, { size: 14, className: "mr-2" }),
@@ -1035,7 +1058,386 @@ function DeprecatedBadge({ isDeprecated }) {
1035
1058
  if (!isDeprecated) return null;
1036
1059
  return /* @__PURE__ */ jsx("span", { className: "badge", children: t("deprecated") });
1037
1060
  }
1061
+ function FeatureLockedState({ icon, title, description, noteTitle, noteText, className }) {
1062
+ return /* @__PURE__ */ jsx("div", { className: cn("flex items-center justify-center min-h-[60vh]", className), children: /* @__PURE__ */ jsxs("div", { className: "text-center max-w-md mx-auto p-8", children: [
1063
+ /* @__PURE__ */ jsx("div", { className: "w-16 h-16 rounded-full bg-muted/50 flex items-center justify-center mx-auto mb-4", children: icon ?? /* @__PURE__ */ jsx(Sparkles, { className: "w-8 h-8 text-muted-foreground" }) }),
1064
+ /* @__PURE__ */ jsx("h2", { className: "text-2xl font-semibold mb-2", children: title }),
1065
+ description && /* @__PURE__ */ jsx("p", { className: "text-muted-foreground mb-6", children: description }),
1066
+ (noteTitle || noteText) && /* @__PURE__ */ jsx("div", { className: "card p-4 bg-muted/30 border border-dashed", children: /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3 text-sm text-muted-foreground", children: [
1067
+ /* @__PURE__ */ jsx(AlertCircle, { className: "w-5 h-5 shrink-0 mt-0.5" }),
1068
+ /* @__PURE__ */ jsxs("div", { className: "text-left", children: [
1069
+ noteTitle && /* @__PURE__ */ jsx("p", { className: "font-medium mb-1", children: noteTitle }),
1070
+ noteText && /* @__PURE__ */ jsx("p", { children: noteText })
1071
+ ] })
1072
+ ] }) })
1073
+ ] }) });
1074
+ }
1075
+ function SessionItem({
1076
+ icon,
1077
+ name,
1078
+ detail,
1079
+ ip,
1080
+ time,
1081
+ current,
1082
+ currentLabel,
1083
+ inactive,
1084
+ inactiveLabel,
1085
+ onRevoke,
1086
+ revoking,
1087
+ revokeLabel,
1088
+ className
1089
+ }) {
1090
+ return /* @__PURE__ */ jsxs("div", { className: cn("flex items-start gap-3 p-2 rounded-lg bg-(--bg-elevated) relative", inactive && "opacity-50", className), children: [
1091
+ icon != null && /* @__PURE__ */ jsx("div", { className: "w-8 h-8 rounded-lg bg-muted flex items-center justify-center shrink-0", children: icon }),
1092
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
1093
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
1094
+ /* @__PURE__ */ jsx("span", { className: "text-xs font-medium truncate", children: name }),
1095
+ current && /* @__PURE__ */ jsx("span", { className: "text-[10px] px-1.5 py-0.5 rounded-full badge-success shrink-0", children: currentLabel }),
1096
+ inactive && /* @__PURE__ */ jsx("span", { className: "text-[10px] px-1.5 py-0.5 rounded-full badge-neutral shrink-0", children: inactiveLabel })
1097
+ ] }),
1098
+ detail && /* @__PURE__ */ jsx("div", { className: "text-[10px] text-(--text-tertiary) mt-0.5", children: detail }),
1099
+ (ip != null || time != null) && /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-2 mt-1 text-[10px] text-(--text-tertiary)", children: [
1100
+ ip != null && /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-0.5", children: [
1101
+ /* @__PURE__ */ jsx(Globe, { size: 8 }),
1102
+ ip
1103
+ ] }),
1104
+ time != null && /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-0.5", children: [
1105
+ /* @__PURE__ */ jsx(Clock, { size: 8 }),
1106
+ time
1107
+ ] })
1108
+ ] })
1109
+ ] }),
1110
+ !current && onRevoke && /* @__PURE__ */ jsx(
1111
+ "button",
1112
+ {
1113
+ type: "button",
1114
+ onClick: onRevoke,
1115
+ disabled: revoking,
1116
+ "aria-label": revokeLabel,
1117
+ title: revokeLabel,
1118
+ className: "p-1.5 hover:bg-error-soft rounded text-(--text-tertiary) hover:text-error transition-colors shrink-0 outline-none focus-visible:ring-2 focus-visible:ring-ring",
1119
+ children: revoking ? /* @__PURE__ */ jsx(Loader2, { size: 12, className: "animate-spin" }) : /* @__PURE__ */ jsx(LogOut, { size: 12 })
1120
+ }
1121
+ )
1122
+ ] });
1123
+ }
1124
+ function MetricBar({ icon, label, value, percentage, color, className }) {
1125
+ return /* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-3", className), children: [
1126
+ icon != null ? icon : /* @__PURE__ */ jsx("div", { className: "w-3 h-3 rounded-full shrink-0", style: { backgroundColor: color } }),
1127
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
1128
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-1 gap-2", children: [
1129
+ /* @__PURE__ */ jsx("span", { className: "text-sm font-medium truncate", children: label }),
1130
+ value != null && /* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground shrink-0", children: value })
1131
+ ] }),
1132
+ /* @__PURE__ */ jsx("div", { className: "h-1.5 bg-muted rounded-full overflow-hidden", children: /* @__PURE__ */ jsx(
1133
+ "div",
1134
+ {
1135
+ role: "progressbar",
1136
+ "aria-valuenow": Math.max(0, Math.min(100, percentage)),
1137
+ "aria-valuemin": 0,
1138
+ "aria-valuemax": 100,
1139
+ className: "h-full rounded-full transition-all duration-300",
1140
+ style: { width: `${Math.max(0, Math.min(100, percentage))}%`, backgroundColor: color }
1141
+ }
1142
+ ) })
1143
+ ] })
1144
+ ] });
1145
+ }
1146
+ var TONES2 = {
1147
+ info: {
1148
+ bg: "bg-linear-to-r from-blue-500/10 via-blue-500/5 to-blue-500/10",
1149
+ border: "border-blue-500/25",
1150
+ text: "text-blue-700 dark:text-blue-300",
1151
+ icon: "text-blue-500",
1152
+ dismissHover: "hover:bg-blue-500/10",
1153
+ defaultIcon: /* @__PURE__ */ jsx(Info, { size: 16 })
1154
+ },
1155
+ warning: {
1156
+ bg: "bg-linear-to-r from-amber-500/10 via-amber-500/5 to-amber-500/10",
1157
+ border: "border-amber-500/25",
1158
+ text: "text-amber-700 dark:text-amber-300",
1159
+ icon: "text-amber-500",
1160
+ dismissHover: "hover:bg-amber-500/10",
1161
+ defaultIcon: /* @__PURE__ */ jsx(AlertTriangle, { size: 16 })
1162
+ },
1163
+ critical: {
1164
+ bg: "bg-linear-to-r from-red-500/10 via-red-500/5 to-red-500/10",
1165
+ border: "border-red-500/25",
1166
+ text: "text-red-700 dark:text-red-300",
1167
+ icon: "text-red-500",
1168
+ dismissHover: "hover:bg-red-500/10",
1169
+ defaultIcon: /* @__PURE__ */ jsx(AlertCircle, { size: 16 })
1170
+ },
1171
+ success: {
1172
+ bg: "bg-linear-to-r from-green-500/10 via-green-500/5 to-green-500/10",
1173
+ border: "border-green-500/25",
1174
+ text: "text-green-700 dark:text-green-300",
1175
+ icon: "text-green-500",
1176
+ dismissHover: "hover:bg-green-500/10",
1177
+ defaultIcon: /* @__PURE__ */ jsx(CheckCircle2, { size: 16 })
1178
+ },
1179
+ neutral: {
1180
+ bg: "bg-muted/40",
1181
+ border: "border-border",
1182
+ text: "text-foreground",
1183
+ icon: "text-muted-foreground",
1184
+ dismissHover: "hover:bg-muted",
1185
+ defaultIcon: /* @__PURE__ */ jsx(Info, { size: 16 })
1186
+ }
1187
+ };
1188
+ function Banner({
1189
+ tone = "info",
1190
+ icon,
1191
+ title,
1192
+ description,
1193
+ meta,
1194
+ actions,
1195
+ dismissible,
1196
+ onDismiss,
1197
+ dismissLabel,
1198
+ className
1199
+ }) {
1200
+ const t = TONES2[tone];
1201
+ const resolvedIcon = icon === void 0 ? t.defaultIcon : icon;
1202
+ return /* @__PURE__ */ jsx("div", { className: cn("card", t.bg, t.border, className), children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 px-4 py-2.5", children: [
1203
+ resolvedIcon != null && /* @__PURE__ */ jsx("span", { className: cn("shrink-0", t.icon), "aria-hidden": "true", children: resolvedIcon }),
1204
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
1205
+ /* @__PURE__ */ jsx("span", { className: cn("text-sm font-medium", t.text), children: title }),
1206
+ description && /* @__PURE__ */ jsx("span", { className: cn("text-sm ml-2 hidden sm:inline opacity-70", t.text), children: description })
1207
+ ] }),
1208
+ meta != null && /* @__PURE__ */ jsx("span", { className: "text-[10px] text-muted-foreground/70 shrink-0", children: meta }),
1209
+ actions && /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2 shrink-0", children: actions }),
1210
+ dismissible && /* @__PURE__ */ jsx(
1211
+ "button",
1212
+ {
1213
+ type: "button",
1214
+ onClick: onDismiss,
1215
+ "aria-label": dismissLabel,
1216
+ className: cn("p-1 rounded-lg transition-colors shrink-0 outline-none focus-visible:ring-2 focus-visible:ring-ring", t.dismissHover),
1217
+ children: /* @__PURE__ */ jsx(X, { size: 14, className: "text-muted-foreground/70" })
1218
+ }
1219
+ )
1220
+ ] }) });
1221
+ }
1222
+ function NotificationBell({ count = 0, max = 99, label, icon, onClick, className }) {
1223
+ return /* @__PURE__ */ jsxs(
1224
+ "button",
1225
+ {
1226
+ type: "button",
1227
+ onClick,
1228
+ "aria-label": label,
1229
+ className: cn(
1230
+ "relative flex items-center justify-center rounded-lg px-2 py-1.5 text-muted-foreground hover:text-foreground hover:bg-muted transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring",
1231
+ className
1232
+ ),
1233
+ children: [
1234
+ icon ?? /* @__PURE__ */ jsx(Bell, { size: 18 }),
1235
+ count > 0 && /* @__PURE__ */ jsx("span", { className: "absolute -top-0.5 -right-0.5 flex h-4 min-w-4 items-center justify-center rounded-full bg-(--error) text-[10px] font-bold text-pure-white px-1", children: count > max ? `${max}+` : count })
1236
+ ]
1237
+ }
1238
+ );
1239
+ }
1240
+ function NotificationItem({
1241
+ icon,
1242
+ iconClassName,
1243
+ title,
1244
+ body,
1245
+ time,
1246
+ unread,
1247
+ href,
1248
+ onSelect,
1249
+ dismissible,
1250
+ onDismiss,
1251
+ dismissLabel,
1252
+ className
1253
+ }) {
1254
+ const { Link } = useYunUI();
1255
+ const inner = /* @__PURE__ */ jsxs(Fragment, { children: [
1256
+ icon != null && /* @__PURE__ */ jsx("div", { className: cn("shrink-0 rounded-lg p-1.5", iconClassName ?? "bg-muted"), children: icon }),
1257
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
1258
+ /* @__PURE__ */ jsx("p", { className: cn("text-sm leading-snug truncate", unread ? "font-medium" : "text-muted-foreground"), children: title }),
1259
+ body && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground/60 mt-0.5 line-clamp-1", children: body })
1260
+ ] }),
1261
+ time != null && /* @__PURE__ */ jsx("span", { className: "shrink-0 self-center text-[10px] text-muted-foreground/50", children: time })
1262
+ ] });
1263
+ const rowClass = cn("flex items-center gap-2.5 px-3 py-2.5", dismissible ? "pr-9" : "pr-3");
1264
+ return /* @__PURE__ */ jsxs("div", { className: cn("group/notif relative rounded-xl hover:bg-foreground/5 transition-colors", className), children: [
1265
+ href ? /* @__PURE__ */ jsx(Link, { href, onClick: onSelect, className: rowClass, children: inner }) : /* @__PURE__ */ jsx("button", { type: "button", onClick: onSelect, className: cn(rowClass, "w-full text-left outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset rounded-xl"), children: inner }),
1266
+ dismissible && /* @__PURE__ */ jsx(
1267
+ "button",
1268
+ {
1269
+ type: "button",
1270
+ "aria-label": dismissLabel,
1271
+ onClick: (e) => {
1272
+ e.stopPropagation();
1273
+ e.preventDefault();
1274
+ onDismiss?.();
1275
+ },
1276
+ className: "absolute right-1.5 top-1/2 -translate-y-1/2 p-1 rounded-lg opacity-0 group-hover/notif:opacity-100 group-focus-within/notif:opacity-100 hover:bg-muted transition-all outline-none focus-visible:opacity-100 focus-visible:ring-2 focus-visible:ring-ring",
1277
+ children: /* @__PURE__ */ jsx(Trash2, { size: 12, className: "text-muted-foreground/40 hover:text-error" })
1278
+ }
1279
+ )
1280
+ ] });
1281
+ }
1282
+ function NotificationPanel({
1283
+ title,
1284
+ unreadCount = 0,
1285
+ unreadLabel,
1286
+ loading,
1287
+ loadingLabel,
1288
+ empty,
1289
+ emptyLabel,
1290
+ footer,
1291
+ children,
1292
+ className
1293
+ }) {
1294
+ return /* @__PURE__ */ jsxs(
1295
+ "div",
1296
+ {
1297
+ className: cn(
1298
+ "w-80 sm:w-[400px] rounded-2xl border border-border bg-background/60 backdrop-blur-2xl shadow-lg shadow-black/5",
1299
+ className
1300
+ ),
1301
+ children: [
1302
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-4 py-3", children: [
1303
+ /* @__PURE__ */ jsx("h3", { className: "text-sm font-semibold", children: title }),
1304
+ unreadCount > 0 && /* @__PURE__ */ jsxs("span", { className: "text-[10px] font-medium text-primary", children: [
1305
+ unreadCount,
1306
+ unreadLabel ? /* @__PURE__ */ jsxs(Fragment, { children: [
1307
+ " ",
1308
+ unreadLabel
1309
+ ] }) : null
1310
+ ] })
1311
+ ] }),
1312
+ /* @__PURE__ */ jsx("div", { className: "max-h-[400px] overflow-y-auto px-2 pb-2 flex flex-col gap-1", children: loading ? /* @__PURE__ */ jsx("div", { className: "p-4 text-center text-sm text-muted-foreground", children: loadingLabel }) : empty ? /* @__PURE__ */ jsxs("div", { className: "p-6 text-center", children: [
1313
+ /* @__PURE__ */ jsx(Bell, { size: 24, className: "mx-auto mb-2 text-muted-foreground/40" }),
1314
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: emptyLabel })
1315
+ ] }) : children }),
1316
+ footer && /* @__PURE__ */ jsx("div", { className: "text-center text-xs text-muted-foreground hover:text-foreground transition-colors [&>a]:block [&>a]:py-2.5", children: footer })
1317
+ ]
1318
+ }
1319
+ );
1320
+ }
1321
+ function SettingRow({ title, description, control, className }) {
1322
+ return /* @__PURE__ */ jsxs("div", { className: cn("flex items-center justify-between gap-4 py-3 border-b border-border last:border-0", className), children: [
1323
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
1324
+ /* @__PURE__ */ jsx("div", { className: "text-sm font-medium", children: title }),
1325
+ description && /* @__PURE__ */ jsx("div", { className: "text-xs text-(--text-tertiary) mt-0.5 leading-relaxed whitespace-normal wrap-break-word", children: description })
1326
+ ] }),
1327
+ control != null && /* @__PURE__ */ jsx("div", { className: "shrink-0", children: control })
1328
+ ] });
1329
+ }
1330
+ function LinkRow({ icon, title, description, href, external, className }) {
1331
+ const { Link } = useYunUI();
1332
+ const inner = /* @__PURE__ */ jsxs(Fragment, { children: [
1333
+ icon != null && /* @__PURE__ */ jsx("span", { className: "text-(--text-tertiary) shrink-0", children: icon }),
1334
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
1335
+ /* @__PURE__ */ jsx("div", { className: "text-sm font-medium", children: title }),
1336
+ description && /* @__PURE__ */ jsx("div", { className: "text-xs text-(--text-tertiary) truncate", children: description })
1337
+ ] }),
1338
+ /* @__PURE__ */ jsx(ChevronRight, { size: 16, className: "text-(--text-muted) shrink-0" })
1339
+ ] });
1340
+ const cls = cn(
1341
+ "flex items-center gap-3 p-3 rounded-lg border border-border hover:bg-(--bg-elevated) transition-colors",
1342
+ className
1343
+ );
1344
+ if (external) {
1345
+ return /* @__PURE__ */ jsx("a", { href, target: "_blank", rel: "noopener noreferrer", className: cls, children: inner });
1346
+ }
1347
+ return /* @__PURE__ */ jsx(Link, { href, className: cls, children: inner });
1348
+ }
1349
+ function ConnectedAccountRow({
1350
+ icon,
1351
+ badge,
1352
+ avatarUrl,
1353
+ name,
1354
+ subname,
1355
+ detail,
1356
+ time,
1357
+ onUnlink,
1358
+ unlinking,
1359
+ unlinkLabel,
1360
+ className
1361
+ }) {
1362
+ return /* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-3 p-3 rounded-xl bg-(--bg-elevated) border border-border", className), children: [
1363
+ /* @__PURE__ */ jsxs("div", { className: "relative shrink-0", children: [
1364
+ avatarUrl ? (
1365
+ // eslint-disable-next-line @next/next/no-img-element
1366
+ /* @__PURE__ */ jsx("img", { src: avatarUrl, alt: "", className: "w-9 h-9 rounded-full object-cover ring-2 ring-border" })
1367
+ ) : /* @__PURE__ */ jsx("div", { className: "w-9 h-9 rounded-full bg-muted flex items-center justify-center ring-2 ring-border", children: icon }),
1368
+ badge != null && /* @__PURE__ */ jsx("div", { className: "absolute bottom-0 right-0 w-5 h-5 rounded-full bg-(--bg-elevated) border border-border flex items-center justify-center", children: badge })
1369
+ ] }),
1370
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
1371
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
1372
+ /* @__PURE__ */ jsx("span", { className: "text-sm font-medium capitalize", children: name }),
1373
+ subname != null && /* @__PURE__ */ jsxs("span", { className: "text-xs text-(--text-secondary) truncate", children: [
1374
+ "\xB7 ",
1375
+ subname
1376
+ ] })
1377
+ ] }),
1378
+ detail != null && /* @__PURE__ */ jsx("div", { className: "text-xs text-(--text-tertiary) truncate", children: detail }),
1379
+ time != null && /* @__PURE__ */ jsxs("div", { className: "text-[10px] text-(--text-tertiary) flex items-center gap-1 mt-0.5", children: [
1380
+ /* @__PURE__ */ jsx(Clock, { size: 8 }),
1381
+ time
1382
+ ] })
1383
+ ] }),
1384
+ onUnlink && /* @__PURE__ */ jsx(
1385
+ "button",
1386
+ {
1387
+ type: "button",
1388
+ onClick: onUnlink,
1389
+ disabled: unlinking,
1390
+ title: unlinkLabel,
1391
+ "aria-label": unlinkLabel,
1392
+ className: "p-1.5 hover:bg-error-soft rounded text-(--text-tertiary) hover:text-error transition-colors shrink-0 outline-none focus-visible:ring-2 focus-visible:ring-ring",
1393
+ children: unlinking ? /* @__PURE__ */ jsx(Loader2, { size: 14, className: "animate-spin" }) : /* @__PURE__ */ jsx(X, { size: 14 })
1394
+ }
1395
+ )
1396
+ ] });
1397
+ }
1398
+ function AvatarUploader({
1399
+ src,
1400
+ fallback,
1401
+ size = 48,
1402
+ uploading,
1403
+ onSelectFile,
1404
+ label,
1405
+ className
1406
+ }) {
1407
+ const inputRef = useRef(null);
1408
+ return /* @__PURE__ */ jsxs(
1409
+ "button",
1410
+ {
1411
+ type: "button",
1412
+ onClick: () => inputRef.current?.click(),
1413
+ "aria-label": label,
1414
+ className: cn("relative group cursor-pointer shrink-0 rounded-full outline-none focus-visible:ring-2 focus-visible:ring-ring", className),
1415
+ style: { width: size, height: size },
1416
+ children: [
1417
+ /* @__PURE__ */ jsx(
1418
+ "input",
1419
+ {
1420
+ ref: inputRef,
1421
+ type: "file",
1422
+ accept: "image/*",
1423
+ className: "hidden",
1424
+ onChange: (e) => {
1425
+ const file = e.target.files?.[0];
1426
+ if (file) onSelectFile?.(file);
1427
+ e.target.value = "";
1428
+ }
1429
+ }
1430
+ ),
1431
+ src ? (
1432
+ // eslint-disable-next-line @next/next/no-img-element
1433
+ /* @__PURE__ */ jsx("img", { src, alt: "", className: "w-full h-full rounded-full object-cover ring-2 ring-border group-hover:ring-primary transition-all" })
1434
+ ) : /* @__PURE__ */ jsx("div", { className: "w-full h-full rounded-full bg-linear-to-br from-primary to-primary/60 flex items-center justify-center text-primary-foreground font-semibold ring-2 ring-border group-hover:ring-primary transition-all", style: { fontSize: size * 0.36 }, children: fallback }),
1435
+ /* @__PURE__ */ jsx("div", { className: "absolute inset-0 rounded-full bg-black/50 sm:opacity-0 sm:group-hover:opacity-100 group-focus-visible:opacity-100 transition-opacity flex items-center justify-center", children: uploading ? /* @__PURE__ */ jsx(Loader2, { size: Math.round(size / 3), className: "text-pure-white animate-spin" }) : /* @__PURE__ */ jsx(Camera, { size: Math.round(size / 3), className: "text-pure-white" }) })
1436
+ ]
1437
+ }
1438
+ );
1439
+ }
1038
1440
 
1039
- export { AccountLockedCard, ActiveBadge, BackgroundEffects, BlogCard, BlogPagination, BlogPostHeader, CapabilityBadge, CategoryFilter, CodeBlock, CodeDemo, DeprecatedBadge, ErrorBoundary, FAQ, FellowBadge, FellowsBanner, LLMCopyButton, MediaEmptyState, MediaErrorState, MediaLoadingState, MediaPageHeader, PageEmptyState, PageErrorState, PageHeader, PageLoadingState, Sidebar, SourceBadge, StatCard, StatusBadge, ViewOptions };
1441
+ export { AccountLockedCard, ActiveBadge, AvatarUploader, BackgroundEffects, Banner, BlogCard, BlogPagination, BlogPostHeader, CapabilityBadge, CategoryFilter, CodeBlock, CodeDemo, ConnectedAccountRow, DeprecatedBadge, ErrorBoundary, FAQ, FeatureLockedState, FellowBadge, FellowsBanner, LLMCopyButton, LinkRow, MediaEmptyState, MediaErrorState, MediaLoadingState, MediaPageHeader, MetricBar, NotificationBell, NotificationItem, NotificationPanel, PageEmptyState, PageErrorState, PageHeader, PageLoadingState, SessionItem, SettingRow, Sidebar, SimplePagination, SourceBadge, StatCard, StatusBadge, ViewOptions };
1040
1442
  //# sourceMappingURL=patterns.js.map
1041
1443
  //# sourceMappingURL=patterns.js.map