@yuhuanowo/yunui 0.2.13 → 0.2.15

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-6MZN3GOP.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-LLNTUA5K.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
@@ -711,6 +734,21 @@ function PageHeader({ title, description, actions, className }) {
711
734
  actions && /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2 shrink-0", children: actions })
712
735
  ] });
713
736
  }
737
+ function PageLayout({
738
+ children,
739
+ navbar,
740
+ footer,
741
+ hideFooter = false,
742
+ transparentBg = false,
743
+ mainClassName,
744
+ className
745
+ }) {
746
+ return /* @__PURE__ */ jsxs("div", { className: cn("min-h-dvh flex flex-col relative", !transparentBg && "bg-background", className), children: [
747
+ navbar,
748
+ /* @__PURE__ */ jsx("main", { className: cn("flex-1 pt-28", mainClassName), children }),
749
+ !hideFooter && footer
750
+ ] });
751
+ }
714
752
  function PageLoadingState({ message }) {
715
753
  return /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center py-16", children: [
716
754
  /* @__PURE__ */ jsx(Spinner, { size: "lg" }),
@@ -719,12 +757,12 @@ function PageLoadingState({ message }) {
719
757
  }
720
758
  function PageErrorState({ message, onRetry, retryLabel = "Retry" }) {
721
759
  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 }),
760
+ /* @__PURE__ */ jsx("div", { className: "text-error font-medium mb-2", children: message }),
723
761
  onRetry && /* @__PURE__ */ jsx(
724
762
  "button",
725
763
  {
726
764
  onClick: onRetry,
727
- className: "text-sm text-muted-foreground hover:text-foreground transition-colors underline",
765
+ className: "text-sm text-muted-foreground hover:text-foreground transition-colors underline outline-none focus-visible:ring-2 focus-visible:ring-ring rounded",
728
766
  children: retryLabel
729
767
  }
730
768
  )
@@ -808,7 +846,7 @@ function FellowsBanner({
808
846
  Link,
809
847
  {
810
848
  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}`,
849
+ 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
850
  children: [
813
851
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4 flex-1 min-w-0", children: [
814
852
  /* @__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 +870,7 @@ function ErrorFallback({
832
870
  labels
833
871
  }) {
834
872
  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" }) }),
873
+ /* @__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
874
  /* @__PURE__ */ jsx("h2", { className: "text-xl font-semibold mb-2", children: labels?.title ?? "Something went wrong" }),
837
875
  /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-center mb-4 max-w-md", children: error?.message || labels?.message || "An unexpected error occurred." }),
838
876
  /* @__PURE__ */ jsxs(Button, { variant: "secondary", onClick: onRetry, className: "whitespace-nowrap", children: [
@@ -887,7 +925,7 @@ function AccountLockedCard({
887
925
  /* @__PURE__ */ jsx("span", { className: "font-semibold text-[15px]", children: appName })
888
926
  ] }),
889
927
  /* @__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 }),
928
+ /* @__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
929
  /* @__PURE__ */ jsx("h1", { className: "text-xl font-semibold mb-2 text-center", children: title }),
892
930
  /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground mb-5 text-center", children: subtitle }),
893
931
  children,
@@ -898,7 +936,7 @@ function AccountLockedCard({
898
936
  type: "button",
899
937
  onClick: onBack,
900
938
  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",
939
+ 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
940
  children: backLabel
903
941
  }
904
942
  )
@@ -918,7 +956,7 @@ function MediaPageHeader({ title, description, isSyncing, syncError, onSync, sta
918
956
  /* @__PURE__ */ jsx("span", { className: "ml-2", children: isSyncing ? t("syncing") : t("sync") })
919
957
  ] })
920
958
  ] }),
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: [
959
+ 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
960
  /* @__PURE__ */ jsx(AlertCircle, { size: 16 }),
923
961
  /* @__PURE__ */ jsx("span", { children: syncError })
924
962
  ] }),
@@ -947,8 +985,8 @@ function MediaLoadingState({ message }) {
947
985
  function MediaErrorState({ message, onRetry }) {
948
986
  const t = useYunUI().useT("components.mediaPageHeader");
949
987
  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") }),
988
+ /* @__PURE__ */ jsx(AlertCircle, { size: 40, className: "text-error opacity-50 mb-3" }),
989
+ /* @__PURE__ */ jsx("div", { className: "font-medium text-error mb-1", children: t("error") }),
952
990
  /* @__PURE__ */ jsx("div", { className: "text-caption mb-4", children: message }),
953
991
  onRetry && /* @__PURE__ */ jsxs(Button, { variant: "outline", size: "sm", onClick: onRetry, children: [
954
992
  /* @__PURE__ */ jsx(RefreshCw, { size: 14, className: "mr-2" }),
@@ -1035,7 +1073,386 @@ function DeprecatedBadge({ isDeprecated }) {
1035
1073
  if (!isDeprecated) return null;
1036
1074
  return /* @__PURE__ */ jsx("span", { className: "badge", children: t("deprecated") });
1037
1075
  }
1076
+ function FeatureLockedState({ icon, title, description, noteTitle, noteText, className }) {
1077
+ 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: [
1078
+ /* @__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" }) }),
1079
+ /* @__PURE__ */ jsx("h2", { className: "text-2xl font-semibold mb-2", children: title }),
1080
+ description && /* @__PURE__ */ jsx("p", { className: "text-muted-foreground mb-6", children: description }),
1081
+ (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: [
1082
+ /* @__PURE__ */ jsx(AlertCircle, { className: "w-5 h-5 shrink-0 mt-0.5" }),
1083
+ /* @__PURE__ */ jsxs("div", { className: "text-left", children: [
1084
+ noteTitle && /* @__PURE__ */ jsx("p", { className: "font-medium mb-1", children: noteTitle }),
1085
+ noteText && /* @__PURE__ */ jsx("p", { children: noteText })
1086
+ ] })
1087
+ ] }) })
1088
+ ] }) });
1089
+ }
1090
+ function SessionItem({
1091
+ icon,
1092
+ name,
1093
+ detail,
1094
+ ip,
1095
+ time,
1096
+ current,
1097
+ currentLabel,
1098
+ inactive,
1099
+ inactiveLabel,
1100
+ onRevoke,
1101
+ revoking,
1102
+ revokeLabel,
1103
+ className
1104
+ }) {
1105
+ return /* @__PURE__ */ jsxs("div", { className: cn("flex items-start gap-3 p-2 rounded-lg bg-(--bg-elevated) relative", inactive && "opacity-50", className), children: [
1106
+ icon != null && /* @__PURE__ */ jsx("div", { className: "w-8 h-8 rounded-lg bg-muted flex items-center justify-center shrink-0", children: icon }),
1107
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
1108
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
1109
+ /* @__PURE__ */ jsx("span", { className: "text-xs font-medium truncate", children: name }),
1110
+ current && /* @__PURE__ */ jsx("span", { className: "text-[10px] px-1.5 py-0.5 rounded-full badge-success shrink-0", children: currentLabel }),
1111
+ inactive && /* @__PURE__ */ jsx("span", { className: "text-[10px] px-1.5 py-0.5 rounded-full badge-neutral shrink-0", children: inactiveLabel })
1112
+ ] }),
1113
+ detail && /* @__PURE__ */ jsx("div", { className: "text-[10px] text-(--text-tertiary) mt-0.5 truncate", children: detail }),
1114
+ (ip != null || time != null) && /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-2 mt-1 text-[10px] text-(--text-tertiary)", children: [
1115
+ ip != null && /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-0.5", children: [
1116
+ /* @__PURE__ */ jsx(Globe, { size: 8 }),
1117
+ ip
1118
+ ] }),
1119
+ time != null && /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-0.5", children: [
1120
+ /* @__PURE__ */ jsx(Clock, { size: 8 }),
1121
+ time
1122
+ ] })
1123
+ ] })
1124
+ ] }),
1125
+ !current && onRevoke && /* @__PURE__ */ jsx(
1126
+ "button",
1127
+ {
1128
+ type: "button",
1129
+ onClick: onRevoke,
1130
+ disabled: revoking,
1131
+ "aria-label": revokeLabel,
1132
+ title: revokeLabel,
1133
+ 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",
1134
+ children: revoking ? /* @__PURE__ */ jsx(Loader2, { size: 12, className: "animate-spin" }) : /* @__PURE__ */ jsx(LogOut, { size: 12 })
1135
+ }
1136
+ )
1137
+ ] });
1138
+ }
1139
+ function MetricBar({ icon, label, value, percentage, color, className }) {
1140
+ return /* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-3", className), children: [
1141
+ icon != null ? icon : /* @__PURE__ */ jsx("div", { className: "w-3 h-3 rounded-full shrink-0", style: { backgroundColor: color } }),
1142
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
1143
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-1 gap-2", children: [
1144
+ /* @__PURE__ */ jsx("span", { className: "text-sm font-medium truncate", children: label }),
1145
+ value != null && /* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground shrink-0", children: value })
1146
+ ] }),
1147
+ /* @__PURE__ */ jsx("div", { className: "h-1.5 bg-muted rounded-full overflow-hidden", children: /* @__PURE__ */ jsx(
1148
+ "div",
1149
+ {
1150
+ role: "progressbar",
1151
+ "aria-valuenow": Math.max(0, Math.min(100, percentage)),
1152
+ "aria-valuemin": 0,
1153
+ "aria-valuemax": 100,
1154
+ className: "h-full rounded-full transition-all duration-300",
1155
+ style: { width: `${Math.max(0, Math.min(100, percentage))}%`, backgroundColor: color }
1156
+ }
1157
+ ) })
1158
+ ] })
1159
+ ] });
1160
+ }
1161
+ var TONES2 = {
1162
+ info: {
1163
+ bg: "bg-linear-to-r from-blue-500/10 via-blue-500/5 to-blue-500/10",
1164
+ border: "border-blue-500/25",
1165
+ text: "text-blue-700 dark:text-blue-300",
1166
+ icon: "text-blue-500",
1167
+ dismissHover: "hover:bg-blue-500/10",
1168
+ defaultIcon: /* @__PURE__ */ jsx(Info, { size: 16 })
1169
+ },
1170
+ warning: {
1171
+ bg: "bg-linear-to-r from-amber-500/10 via-amber-500/5 to-amber-500/10",
1172
+ border: "border-amber-500/25",
1173
+ text: "text-amber-700 dark:text-amber-300",
1174
+ icon: "text-amber-500",
1175
+ dismissHover: "hover:bg-amber-500/10",
1176
+ defaultIcon: /* @__PURE__ */ jsx(AlertTriangle, { size: 16 })
1177
+ },
1178
+ critical: {
1179
+ bg: "bg-linear-to-r from-red-500/10 via-red-500/5 to-red-500/10",
1180
+ border: "border-red-500/25",
1181
+ text: "text-red-700 dark:text-red-300",
1182
+ icon: "text-red-500",
1183
+ dismissHover: "hover:bg-red-500/10",
1184
+ defaultIcon: /* @__PURE__ */ jsx(AlertCircle, { size: 16 })
1185
+ },
1186
+ success: {
1187
+ bg: "bg-linear-to-r from-green-500/10 via-green-500/5 to-green-500/10",
1188
+ border: "border-green-500/25",
1189
+ text: "text-green-700 dark:text-green-300",
1190
+ icon: "text-green-500",
1191
+ dismissHover: "hover:bg-green-500/10",
1192
+ defaultIcon: /* @__PURE__ */ jsx(CheckCircle2, { size: 16 })
1193
+ },
1194
+ neutral: {
1195
+ bg: "bg-muted/40",
1196
+ border: "border-border",
1197
+ text: "text-foreground",
1198
+ icon: "text-muted-foreground",
1199
+ dismissHover: "hover:bg-muted",
1200
+ defaultIcon: /* @__PURE__ */ jsx(Info, { size: 16 })
1201
+ }
1202
+ };
1203
+ function Banner({
1204
+ tone = "info",
1205
+ icon,
1206
+ title,
1207
+ description,
1208
+ meta,
1209
+ actions,
1210
+ dismissible,
1211
+ onDismiss,
1212
+ dismissLabel,
1213
+ className
1214
+ }) {
1215
+ const t = TONES2[tone];
1216
+ const resolvedIcon = icon === void 0 ? t.defaultIcon : icon;
1217
+ 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: [
1218
+ resolvedIcon != null && /* @__PURE__ */ jsx("span", { className: cn("shrink-0", t.icon), "aria-hidden": "true", children: resolvedIcon }),
1219
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
1220
+ /* @__PURE__ */ jsx("span", { className: cn("text-sm font-medium", t.text), children: title }),
1221
+ description && /* @__PURE__ */ jsx("span", { className: cn("text-sm ml-2 hidden sm:inline opacity-70", t.text), children: description })
1222
+ ] }),
1223
+ meta != null && /* @__PURE__ */ jsx("span", { className: "text-[10px] text-muted-foreground/70 shrink-0", children: meta }),
1224
+ actions && /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2 shrink-0", children: actions }),
1225
+ dismissible && /* @__PURE__ */ jsx(
1226
+ "button",
1227
+ {
1228
+ type: "button",
1229
+ onClick: onDismiss,
1230
+ "aria-label": dismissLabel,
1231
+ className: cn("p-1 rounded-lg transition-colors shrink-0 outline-none focus-visible:ring-2 focus-visible:ring-ring", t.dismissHover),
1232
+ children: /* @__PURE__ */ jsx(X, { size: 14, className: "text-muted-foreground/70" })
1233
+ }
1234
+ )
1235
+ ] }) });
1236
+ }
1237
+ function NotificationBell({ count = 0, max = 99, label, icon, onClick, className }) {
1238
+ return /* @__PURE__ */ jsxs(
1239
+ "button",
1240
+ {
1241
+ type: "button",
1242
+ onClick,
1243
+ "aria-label": label,
1244
+ className: cn(
1245
+ "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",
1246
+ className
1247
+ ),
1248
+ children: [
1249
+ icon ?? /* @__PURE__ */ jsx(Bell, { size: 18 }),
1250
+ 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 })
1251
+ ]
1252
+ }
1253
+ );
1254
+ }
1255
+ function NotificationItem({
1256
+ icon,
1257
+ iconClassName,
1258
+ title,
1259
+ body,
1260
+ time,
1261
+ unread,
1262
+ href,
1263
+ onSelect,
1264
+ dismissible,
1265
+ onDismiss,
1266
+ dismissLabel,
1267
+ className
1268
+ }) {
1269
+ const { Link } = useYunUI();
1270
+ const inner = /* @__PURE__ */ jsxs(Fragment, { children: [
1271
+ icon != null && /* @__PURE__ */ jsx("div", { className: cn("shrink-0 rounded-lg p-1.5", iconClassName ?? "bg-muted"), children: icon }),
1272
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
1273
+ /* @__PURE__ */ jsx("p", { className: cn("text-sm leading-snug truncate", unread ? "font-medium" : "text-muted-foreground"), children: title }),
1274
+ body && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground/60 mt-0.5 line-clamp-1", children: body })
1275
+ ] }),
1276
+ time != null && /* @__PURE__ */ jsx("span", { className: "shrink-0 self-center text-[10px] text-muted-foreground/50", children: time })
1277
+ ] });
1278
+ const rowClass = cn("flex items-center gap-2.5 px-3 py-2.5", dismissible ? "pr-9" : "pr-3");
1279
+ return /* @__PURE__ */ jsxs("div", { className: cn("group/notif relative rounded-xl hover:bg-foreground/5 transition-colors", className), children: [
1280
+ 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 }),
1281
+ dismissible && /* @__PURE__ */ jsx(
1282
+ "button",
1283
+ {
1284
+ type: "button",
1285
+ "aria-label": dismissLabel,
1286
+ onClick: (e) => {
1287
+ e.stopPropagation();
1288
+ e.preventDefault();
1289
+ onDismiss?.();
1290
+ },
1291
+ 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",
1292
+ children: /* @__PURE__ */ jsx(Trash2, { size: 12, className: "text-muted-foreground/40 hover:text-error" })
1293
+ }
1294
+ )
1295
+ ] });
1296
+ }
1297
+ function NotificationPanel({
1298
+ title,
1299
+ unreadCount = 0,
1300
+ unreadLabel,
1301
+ loading,
1302
+ loadingLabel,
1303
+ empty,
1304
+ emptyLabel,
1305
+ footer,
1306
+ children,
1307
+ className
1308
+ }) {
1309
+ return /* @__PURE__ */ jsxs(
1310
+ "div",
1311
+ {
1312
+ className: cn(
1313
+ "w-80 sm:w-[400px] rounded-2xl border border-border bg-background/60 backdrop-blur-2xl shadow-lg shadow-black/5",
1314
+ className
1315
+ ),
1316
+ children: [
1317
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-4 py-3", children: [
1318
+ /* @__PURE__ */ jsx("h3", { className: "text-sm font-semibold", children: title }),
1319
+ unreadCount > 0 && /* @__PURE__ */ jsxs("span", { className: "text-[10px] font-medium text-primary", children: [
1320
+ unreadCount,
1321
+ unreadLabel ? /* @__PURE__ */ jsxs(Fragment, { children: [
1322
+ " ",
1323
+ unreadLabel
1324
+ ] }) : null
1325
+ ] })
1326
+ ] }),
1327
+ /* @__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: [
1328
+ /* @__PURE__ */ jsx(Bell, { size: 24, className: "mx-auto mb-2 text-muted-foreground/40" }),
1329
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: emptyLabel })
1330
+ ] }) : children }),
1331
+ 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 })
1332
+ ]
1333
+ }
1334
+ );
1335
+ }
1336
+ function SettingRow({ title, description, control, className }) {
1337
+ return /* @__PURE__ */ jsxs("div", { className: cn("flex items-center justify-between gap-4 py-3 border-b border-border last:border-0", className), children: [
1338
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
1339
+ /* @__PURE__ */ jsx("div", { className: "text-sm font-medium", children: title }),
1340
+ description && /* @__PURE__ */ jsx("div", { className: "text-xs text-(--text-tertiary) mt-0.5 leading-relaxed whitespace-normal wrap-break-word", children: description })
1341
+ ] }),
1342
+ control != null && /* @__PURE__ */ jsx("div", { className: "shrink-0", children: control })
1343
+ ] });
1344
+ }
1345
+ function LinkRow({ icon, title, description, href, external, className }) {
1346
+ const { Link } = useYunUI();
1347
+ const inner = /* @__PURE__ */ jsxs(Fragment, { children: [
1348
+ icon != null && /* @__PURE__ */ jsx("span", { className: "text-(--text-tertiary) shrink-0", children: icon }),
1349
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
1350
+ /* @__PURE__ */ jsx("div", { className: "text-sm font-medium truncate", children: title }),
1351
+ description && /* @__PURE__ */ jsx("div", { className: "text-xs text-(--text-tertiary) truncate", children: description })
1352
+ ] }),
1353
+ /* @__PURE__ */ jsx(ChevronRight, { size: 16, className: "text-(--text-muted) shrink-0" })
1354
+ ] });
1355
+ const cls = cn(
1356
+ "flex items-center gap-3 p-3 rounded-lg border border-border hover:bg-(--bg-elevated) transition-colors",
1357
+ className
1358
+ );
1359
+ if (external) {
1360
+ return /* @__PURE__ */ jsx("a", { href, target: "_blank", rel: "noopener noreferrer", className: cls, children: inner });
1361
+ }
1362
+ return /* @__PURE__ */ jsx(Link, { href, className: cls, children: inner });
1363
+ }
1364
+ function ConnectedAccountRow({
1365
+ icon,
1366
+ badge,
1367
+ avatarUrl,
1368
+ name,
1369
+ subname,
1370
+ detail,
1371
+ time,
1372
+ onUnlink,
1373
+ unlinking,
1374
+ unlinkLabel,
1375
+ className
1376
+ }) {
1377
+ return /* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-3 p-3 rounded-xl bg-(--bg-elevated) border border-border", className), children: [
1378
+ /* @__PURE__ */ jsxs("div", { className: "relative shrink-0", children: [
1379
+ avatarUrl ? (
1380
+ // eslint-disable-next-line @next/next/no-img-element
1381
+ /* @__PURE__ */ jsx("img", { src: avatarUrl, alt: "", className: "w-9 h-9 rounded-full object-cover ring-2 ring-border" })
1382
+ ) : /* @__PURE__ */ jsx("div", { className: "w-9 h-9 rounded-full bg-muted flex items-center justify-center ring-2 ring-border", children: icon }),
1383
+ 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 })
1384
+ ] }),
1385
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
1386
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
1387
+ /* @__PURE__ */ jsx("span", { className: "text-sm font-medium capitalize", children: name }),
1388
+ subname != null && /* @__PURE__ */ jsxs("span", { className: "text-xs text-(--text-secondary) truncate", children: [
1389
+ "\xB7 ",
1390
+ subname
1391
+ ] })
1392
+ ] }),
1393
+ detail != null && /* @__PURE__ */ jsx("div", { className: "text-xs text-(--text-tertiary) truncate", children: detail }),
1394
+ time != null && /* @__PURE__ */ jsxs("div", { className: "text-[10px] text-(--text-tertiary) flex items-center gap-1 mt-0.5", children: [
1395
+ /* @__PURE__ */ jsx(Clock, { size: 8 }),
1396
+ time
1397
+ ] })
1398
+ ] }),
1399
+ onUnlink && /* @__PURE__ */ jsx(
1400
+ "button",
1401
+ {
1402
+ type: "button",
1403
+ onClick: onUnlink,
1404
+ disabled: unlinking,
1405
+ title: unlinkLabel,
1406
+ "aria-label": unlinkLabel,
1407
+ 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",
1408
+ children: unlinking ? /* @__PURE__ */ jsx(Loader2, { size: 14, className: "animate-spin" }) : /* @__PURE__ */ jsx(X, { size: 14 })
1409
+ }
1410
+ )
1411
+ ] });
1412
+ }
1413
+ function AvatarUploader({
1414
+ src,
1415
+ fallback,
1416
+ size = 48,
1417
+ uploading,
1418
+ onSelectFile,
1419
+ label,
1420
+ className
1421
+ }) {
1422
+ const inputRef = useRef(null);
1423
+ return /* @__PURE__ */ jsxs(
1424
+ "button",
1425
+ {
1426
+ type: "button",
1427
+ onClick: () => inputRef.current?.click(),
1428
+ "aria-label": label,
1429
+ className: cn("relative group cursor-pointer shrink-0 rounded-full outline-none focus-visible:ring-2 focus-visible:ring-ring", className),
1430
+ style: { width: size, height: size },
1431
+ children: [
1432
+ /* @__PURE__ */ jsx(
1433
+ "input",
1434
+ {
1435
+ ref: inputRef,
1436
+ type: "file",
1437
+ accept: "image/*",
1438
+ className: "hidden",
1439
+ onChange: (e) => {
1440
+ const file = e.target.files?.[0];
1441
+ if (file) onSelectFile?.(file);
1442
+ e.target.value = "";
1443
+ }
1444
+ }
1445
+ ),
1446
+ src ? (
1447
+ // eslint-disable-next-line @next/next/no-img-element
1448
+ /* @__PURE__ */ jsx("img", { src, alt: "", className: "w-full h-full rounded-full object-cover ring-2 ring-border group-hover:ring-primary transition-all" })
1449
+ ) : /* @__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 }),
1450
+ /* @__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" }) })
1451
+ ]
1452
+ }
1453
+ );
1454
+ }
1038
1455
 
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 };
1456
+ 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, PageLayout, PageLoadingState, SessionItem, SettingRow, Sidebar, SimplePagination, SourceBadge, StatCard, StatusBadge, ViewOptions };
1040
1457
  //# sourceMappingURL=patterns.js.map
1041
1458
  //# sourceMappingURL=patterns.js.map