@yuhuanowo/yunui 0.2.6 → 0.2.7

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 CHANGED
@@ -91,7 +91,7 @@ Without a provider, YunUI uses zero-dependency defaults (`<a>` / `<img>` / ident
91
91
 
92
92
  | Entry | Contents |
93
93
  | --- | --- |
94
- | `@yuhuanowo/yunui` | Atomic components: Button / IconButton / Input / Textarea / PasswordInput / NumberInput / Card / Badge / Kbd / Dialog / Select / Slider / Progress / Tabs / Avatar / Tooltip / DropdownMenu / Skeleton / Spinner / PageLoader / EmptyState / Label; layout primitives Flex / Grid / Row / Column / Stack; data display Table / Breadcrumb / Pagination; interactive Accordion / RadioGroup / Switch / Checkbox / Combobox / CustomSelect / SegmentedSelect / NavTabs / Collapsible / Popover / Modal / Sheet / ConfirmModal / ThemeToggle; plus ShinyButton / Marquee / BentoGrid / AnimatedNumber and the MotionDiv · fadeIn · stagger animation presets |
94
+ | `@yuhuanowo/yunui` | Atomic components: Button / IconButton / Input / Textarea / PasswordInput / NumberInput / SearchInput / Card / Badge / Kbd / Separator / Alert / Tag / AvatarGroup / StatusIndicator / InlineCode / Steps / Dialog / Select / Slider / Progress / Tabs / Avatar / Tooltip / DropdownMenu / Skeleton / Spinner / PageLoader / EmptyState / Label; layout primitives Flex / Grid / Row / Column / Stack; data display Table / Breadcrumb / Pagination; interactive Accordion / RadioGroup / Switch / Checkbox / Combobox / CustomSelect / SegmentedSelect / NavTabs / Collapsible / Popover / Modal / Sheet / ConfirmModal / ThemeToggle; plus ShinyButton / Marquee / BentoGrid / AnimatedNumber and the MotionDiv · fadeIn · stagger animation presets |
95
95
  | `@yuhuanowo/yunui/css` | Design-system stylesheet (token variables, `@theme` mappings, global `.btn` / `.card` / `.glass` classes, animation keyframes) |
96
96
  | `@yuhuanowo/yunui/adapters` | `YunUIProvider` / `useYunUI` and the adapter interfaces |
97
97
  | `@yuhuanowo/yunui/patterns` | Page-level components: FAQ, StatCard (`tone` / `inline` / `valueFirst` variants), BlogCard, CodeBlock, Sidebar, PageHeader, BackgroundEffects, and more |
@@ -12,7 +12,7 @@ import * as ProgressPrimitive from '@radix-ui/react-progress';
12
12
  import * as TabsPrimitive from '@radix-ui/react-tabs';
13
13
  import * as AvatarPrimitive from '@radix-ui/react-avatar';
14
14
  import { motion, AnimatePresence, useSpring, useTransform } from 'framer-motion';
15
- import { Check, ChevronDown, ChevronLeft, ChevronRight, Loader2, AlertCircle, EyeOff, Eye, Minus, Plus, X, CheckCircle2, CheckCircle, Info, RefreshCw, Trash2, Search, ArrowRight, AlertTriangle } from 'lucide-react';
15
+ import { Check, ChevronDown, ChevronLeft, ChevronRight, Loader2, AlertCircle, EyeOff, Eye, Minus, Plus, Search, X, CheckCircle2, CheckCircle, Info, RefreshCw, Trash2, ArrowRight, AlertTriangle } from 'lucide-react';
16
16
  import { createPortal } from 'react-dom';
17
17
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
18
18
  import * as AccordionPrimitive from '@radix-ui/react-accordion';
@@ -1545,6 +1545,64 @@ function Kbd({ className, ...props }) {
1545
1545
  }
1546
1546
  );
1547
1547
  }
1548
+ var SearchInput = React7.forwardRef(
1549
+ ({ className, value, onChange, clearable = true, clearLabel, disabled, ...props }, ref) => {
1550
+ const innerRef = React7.useRef(null);
1551
+ const setRef = React7.useCallback(
1552
+ (node) => {
1553
+ innerRef.current = node;
1554
+ if (typeof ref === "function") ref(node);
1555
+ else if (ref) ref.current = node;
1556
+ },
1557
+ [ref]
1558
+ );
1559
+ const showClear = clearable && !!value && !disabled;
1560
+ const handleClear = () => {
1561
+ onChange?.("");
1562
+ innerRef.current?.focus();
1563
+ };
1564
+ return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
1565
+ /* @__PURE__ */ jsx(
1566
+ Search,
1567
+ {
1568
+ "aria-hidden": "true",
1569
+ className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"
1570
+ }
1571
+ ),
1572
+ /* @__PURE__ */ jsx(
1573
+ "input",
1574
+ {
1575
+ ref: setRef,
1576
+ type: "text",
1577
+ role: "searchbox",
1578
+ value,
1579
+ onChange: (e) => onChange?.(e.target.value),
1580
+ disabled,
1581
+ className: cn(
1582
+ "w-full h-10 pl-10 bg-background border border-border rounded-xl text-sm outline-none transition-colors",
1583
+ "placeholder:text-muted-foreground",
1584
+ "focus:border-ring focus:ring-2 focus:ring-ring/20",
1585
+ "disabled:opacity-50 disabled:cursor-not-allowed",
1586
+ showClear ? "pr-10" : "pr-4",
1587
+ className
1588
+ ),
1589
+ ...props
1590
+ }
1591
+ ),
1592
+ showClear && /* @__PURE__ */ jsx(
1593
+ "button",
1594
+ {
1595
+ type: "button",
1596
+ onClick: handleClear,
1597
+ "aria-label": clearLabel ?? "Clear search",
1598
+ className: "absolute right-2.5 top-1/2 -translate-y-1/2 rounded-md p-0.5 text-muted-foreground hover:text-foreground hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
1599
+ children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" })
1600
+ }
1601
+ )
1602
+ ] });
1603
+ }
1604
+ );
1605
+ SearchInput.displayName = "SearchInput";
1548
1606
  var Card = React7.forwardRef(
1549
1607
  ({ className, hover, ...props }, ref) => {
1550
1608
  return /* @__PURE__ */ jsx(
@@ -1584,6 +1642,165 @@ function Badge({ className, variant = "default", ...props }) {
1584
1642
  }
1585
1643
  );
1586
1644
  }
1645
+ function Separator2({
1646
+ className,
1647
+ orientation = "horizontal",
1648
+ decorative = false,
1649
+ ...props
1650
+ }) {
1651
+ return /* @__PURE__ */ jsx(
1652
+ "div",
1653
+ {
1654
+ role: decorative ? "none" : "separator",
1655
+ "aria-orientation": !decorative && orientation === "vertical" ? "vertical" : void 0,
1656
+ className: cn(
1657
+ "shrink-0 bg-border",
1658
+ orientation === "horizontal" ? "h-px w-full" : "h-full w-px",
1659
+ className
1660
+ ),
1661
+ ...props
1662
+ }
1663
+ );
1664
+ }
1665
+ function Alert({ className, variant = "info", title, icon, children, ...props }) {
1666
+ const styles = {
1667
+ info: "bg-blue-50 text-blue-800 border-blue-200 dark:bg-blue-900/20 dark:text-blue-300 dark:border-blue-900",
1668
+ success: "bg-green-50 text-green-800 border-green-200 dark:bg-green-900/20 dark:text-green-300 dark:border-green-900",
1669
+ warning: "bg-amber-50 text-amber-800 border-amber-200 dark:bg-amber-900/20 dark:text-amber-300 dark:border-amber-900",
1670
+ error: "bg-red-50 text-red-800 border-red-200 dark:bg-red-900/20 dark:text-red-300 dark:border-red-900"
1671
+ };
1672
+ const defaultIcon = {
1673
+ info: /* @__PURE__ */ jsx(Info, { className: "h-4 w-4" }),
1674
+ success: /* @__PURE__ */ jsx(CheckCircle2, { className: "h-4 w-4" }),
1675
+ warning: /* @__PURE__ */ jsx(AlertTriangle, { className: "h-4 w-4" }),
1676
+ error: /* @__PURE__ */ jsx(AlertCircle, { className: "h-4 w-4" })
1677
+ };
1678
+ const resolvedIcon = icon === void 0 ? defaultIcon[variant] : icon;
1679
+ return /* @__PURE__ */ jsxs(
1680
+ "div",
1681
+ {
1682
+ role: "alert",
1683
+ className: cn("flex gap-3 rounded-xl border p-3 text-sm", styles[variant], className),
1684
+ ...props,
1685
+ children: [
1686
+ resolvedIcon && /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "mt-0.5 shrink-0", children: resolvedIcon }),
1687
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
1688
+ title && /* @__PURE__ */ jsx("p", { className: "font-medium", children: title }),
1689
+ children && /* @__PURE__ */ jsx("div", { className: cn(title && "mt-0.5", "opacity-90"), children })
1690
+ ] })
1691
+ ]
1692
+ }
1693
+ );
1694
+ }
1695
+ function Tag({ className, children, onRemove, removeLabel, ...props }) {
1696
+ return /* @__PURE__ */ jsxs(
1697
+ "span",
1698
+ {
1699
+ className: cn(
1700
+ "inline-flex items-center gap-1 rounded-md bg-muted px-2 py-0.5 text-xs font-medium text-foreground/80",
1701
+ className
1702
+ ),
1703
+ ...props,
1704
+ children: [
1705
+ children,
1706
+ onRemove && /* @__PURE__ */ jsx(
1707
+ "button",
1708
+ {
1709
+ type: "button",
1710
+ onClick: onRemove,
1711
+ "aria-label": removeLabel ?? "Remove",
1712
+ className: "-mr-0.5 rounded-sm p-0.5 text-muted-foreground hover:bg-foreground/10 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
1713
+ children: /* @__PURE__ */ jsx(X, { className: "h-3 w-3" })
1714
+ }
1715
+ )
1716
+ ]
1717
+ }
1718
+ );
1719
+ }
1720
+ function StatusIndicator({
1721
+ status = "neutral",
1722
+ pulse = false,
1723
+ className,
1724
+ children,
1725
+ ...props
1726
+ }) {
1727
+ const color = {
1728
+ online: "bg-green-500",
1729
+ offline: "bg-zinc-400",
1730
+ busy: "bg-red-500",
1731
+ away: "bg-amber-500",
1732
+ neutral: "bg-muted-foreground"
1733
+ }[status];
1734
+ return /* @__PURE__ */ jsxs("span", { className: cn("inline-flex items-center gap-1.5 text-sm", className), ...props, children: [
1735
+ /* @__PURE__ */ jsxs("span", { className: "relative flex h-2 w-2 shrink-0", children: [
1736
+ pulse && /* @__PURE__ */ jsx(
1737
+ "span",
1738
+ {
1739
+ "aria-hidden": "true",
1740
+ className: cn("absolute inline-flex h-full w-full animate-ping rounded-full opacity-75", color)
1741
+ }
1742
+ ),
1743
+ /* @__PURE__ */ jsx("span", { className: cn("relative inline-flex h-2 w-2 rounded-full", color) })
1744
+ ] }),
1745
+ children
1746
+ ] });
1747
+ }
1748
+ function InlineCode({ className, ...props }) {
1749
+ return /* @__PURE__ */ jsx(
1750
+ "code",
1751
+ {
1752
+ className: cn(
1753
+ "rounded bg-muted px-1.5 py-0.5 font-mono text-[0.85em] text-foreground/90",
1754
+ className
1755
+ ),
1756
+ ...props
1757
+ }
1758
+ );
1759
+ }
1760
+ function Steps({ steps, current = 0, className, ...props }) {
1761
+ return /* @__PURE__ */ jsx("ol", { className: cn("flex flex-col", className), ...props, children: steps.map((step, i) => {
1762
+ const state = i < current ? "done" : i === current ? "active" : "upcoming";
1763
+ const isLast = i === steps.length - 1;
1764
+ return /* @__PURE__ */ jsxs("li", { className: "flex gap-3", children: [
1765
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center", children: [
1766
+ /* @__PURE__ */ jsx(
1767
+ "span",
1768
+ {
1769
+ "aria-hidden": "true",
1770
+ className: cn(
1771
+ "flex h-6 w-6 shrink-0 items-center justify-center rounded-full border text-xs font-medium",
1772
+ state === "done" && "border-transparent bg-primary text-primary-foreground",
1773
+ state === "active" && "border-primary text-primary",
1774
+ state === "upcoming" && "border-border text-muted-foreground"
1775
+ ),
1776
+ children: state === "done" ? /* @__PURE__ */ jsx(Check, { className: "h-3.5 w-3.5" }) : i + 1
1777
+ }
1778
+ ),
1779
+ !isLast && /* @__PURE__ */ jsx(
1780
+ "span",
1781
+ {
1782
+ "aria-hidden": "true",
1783
+ className: cn("w-px flex-1 my-1", i < current ? "bg-primary" : "bg-border")
1784
+ }
1785
+ )
1786
+ ] }),
1787
+ /* @__PURE__ */ jsxs("div", { className: cn("pb-6", isLast && "pb-0"), children: [
1788
+ /* @__PURE__ */ jsx(
1789
+ "p",
1790
+ {
1791
+ className: cn(
1792
+ "text-sm font-medium leading-6",
1793
+ state === "upcoming" ? "text-muted-foreground" : "text-foreground"
1794
+ ),
1795
+ "aria-current": state === "active" ? "step" : void 0,
1796
+ children: step.title
1797
+ }
1798
+ ),
1799
+ step.description && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground mt-0.5", children: step.description })
1800
+ ] })
1801
+ ] }, i);
1802
+ }) });
1803
+ }
1587
1804
  var Dialog = DialogPrimitive.Root;
1588
1805
  var DialogTrigger = DialogPrimitive.Trigger;
1589
1806
  var DialogPortal = DialogPrimitive.Portal;
@@ -1823,6 +2040,26 @@ var AvatarFallback = React7.forwardRef(({ className, ...props }, ref) => /* @__P
1823
2040
  }
1824
2041
  ));
1825
2042
  AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
2043
+ function AvatarGroup({ className, max, children, ...props }) {
2044
+ const items = React7.Children.toArray(children);
2045
+ const shown = max != null ? items.slice(0, max) : items;
2046
+ const overflow = items.length - shown.length;
2047
+ const ring = { boxShadow: "0 0 0 2px var(--color-background)" };
2048
+ return /* @__PURE__ */ jsxs("div", { className: cn("flex items-center -space-x-2", className), ...props, children: [
2049
+ shown.map((child, i) => /* @__PURE__ */ jsx("div", { className: "rounded-full", style: ring, children: child }, i)),
2050
+ overflow > 0 && /* @__PURE__ */ jsxs(
2051
+ "div",
2052
+ {
2053
+ className: "flex h-10 w-10 items-center justify-center rounded-full bg-muted text-xs font-medium text-muted-foreground",
2054
+ style: ring,
2055
+ children: [
2056
+ "+",
2057
+ overflow
2058
+ ]
2059
+ }
2060
+ )
2061
+ ] });
2062
+ }
1826
2063
  var TooltipProvider = TooltipPrimitive.Provider;
1827
2064
  var Tooltip = TooltipPrimitive.Root;
1828
2065
  var TooltipTrigger = TooltipPrimitive.Trigger;
@@ -2710,6 +2947,6 @@ function useYunUITheme(defaults = {}) {
2710
2947
  return [theme, update];
2711
2948
  }
2712
2949
 
2713
- export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AnimatedNumber, Avatar, AvatarFallback, AvatarImage, Badge, BentoCard, BentoGrid, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Card, Checkbox, Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, Column, Combobox, ConfirmModal, CustomSelect, DeleteConfirmModal, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, Flex, Grid, IconButton, Input, Kbd, Label2 as Label, Marquee, Modal, MotionDiv, MotionSpan, NavTabs, NumberInput, PageLoader, Pagination, PasswordInput, Popover, PopoverClose2 as PopoverClose, PopoverContent, PopoverTrigger, Progress, RadioGroup, RadioGroupItem, RegenerateConfirmModal, Row, SegmentedSelect, Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue, Sheet, ShinyButton, Skeleton, Slider, Spinner, Stack, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, YUNUI_PALETTES, applyTheme, fadeIn, readTheme, staggerContainer, staggerItem, toast, useBodyScrollLock, useEscapeKey, useFocusTrap, useModalBehavior, useYunUITheme };
2714
- //# sourceMappingURL=chunk-D2KGK2LY.js.map
2715
- //# sourceMappingURL=chunk-D2KGK2LY.js.map
2950
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AnimatedNumber, Avatar, AvatarFallback, AvatarGroup, AvatarImage, Badge, BentoCard, BentoGrid, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Card, Checkbox, Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, Column, Combobox, ConfirmModal, CustomSelect, DeleteConfirmModal, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, Flex, Grid, IconButton, InlineCode, Input, Kbd, Label2 as Label, Marquee, Modal, MotionDiv, MotionSpan, NavTabs, NumberInput, PageLoader, Pagination, PasswordInput, Popover, PopoverClose2 as PopoverClose, PopoverContent, PopoverTrigger, Progress, RadioGroup, RadioGroupItem, RegenerateConfirmModal, Row, SearchInput, SegmentedSelect, Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue, Separator2 as Separator, Sheet, ShinyButton, Skeleton, Slider, Spinner, Stack, StatusIndicator, Steps, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Tag, Textarea, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, YUNUI_PALETTES, applyTheme, fadeIn, readTheme, staggerContainer, staggerItem, toast, useBodyScrollLock, useEscapeKey, useFocusTrap, useModalBehavior, useYunUITheme };
2951
+ //# sourceMappingURL=chunk-EROX7LXU.js.map
2952
+ //# sourceMappingURL=chunk-EROX7LXU.js.map