@still-void/ui 2.0.1 → 3.0.0

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.
@@ -455,17 +455,16 @@ var Button = React.forwardRef(
455
455
  "button",
456
456
  {
457
457
  className: cn(
458
- "inline-flex items-center justify-center whitespace-nowrap rounded-md font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
459
- variant === "default" && "bg-sv-surface text-sv-text hover:bg-sv-surface-2",
460
- variant === "destructive" && "bg-destructive text-destructive-foreground hover:bg-destructive/90",
461
- variant === "outline" && "border border-sv-border bg-background hover:bg-sv-surface hover:text-accent",
462
- variant === "secondary" && "bg-sv-surface-2 text-sv-text hover:bg-sv-surface",
463
- variant === "ghost" && "hover:bg-sv-surface hover:text-sv-text",
464
- variant === "link" && "text-accent underline-offset-4 hover:underline",
465
- size === "default" && "h-10 px-4 py-2",
466
- size === "sm" && "h-9 rounded-md px-3 text-sm",
467
- size === "lg" && "h-11 rounded-md px-8",
468
- size === "icon" && "h-10 w-10",
458
+ "sv-btn",
459
+ variant === "destructive" && "sv-btn--destructive",
460
+ variant === "outline" && "sv-btn--outline",
461
+ variant === "secondary" && "sv-btn--secondary",
462
+ variant === "ghost" && "sv-btn--ghost",
463
+ variant === "link" && "sv-btn--link",
464
+ variant === "accent" && "sv-btn--accent",
465
+ size === "sm" && "sv-btn--sm",
466
+ size === "lg" && "sv-btn--lg",
467
+ size === "icon" && "sv-btn--icon",
469
468
  className
470
469
  ),
471
470
  ref,
@@ -476,95 +475,102 @@ var Button = React.forwardRef(
476
475
  Button.displayName = "Button";
477
476
 
478
477
  // src/components/ui/card.tsx
478
+ import * as React3 from "react";
479
+
480
+ // src/components/ui/slot.tsx
479
481
  import * as React2 from "react";
482
+ function composeRefs(...refs) {
483
+ return (node) => {
484
+ for (const ref of refs) {
485
+ if (typeof ref === "function") {
486
+ ref(node);
487
+ } else if (ref !== null && ref !== void 0) {
488
+ ;
489
+ ref.current = node;
490
+ }
491
+ }
492
+ };
493
+ }
494
+ function mergeProps(slotProps, childProps) {
495
+ const merged = { ...slotProps, ...childProps };
496
+ for (const key in childProps) {
497
+ const slotValue = slotProps[key];
498
+ const childValue = childProps[key];
499
+ const isHandler = /^on[A-Z]/.test(key);
500
+ if (isHandler && typeof slotValue === "function" && typeof childValue === "function") {
501
+ merged[key] = (...args) => {
502
+ const result = childValue(...args);
503
+ slotValue(...args);
504
+ return result;
505
+ };
506
+ } else if (key === "style") {
507
+ merged[key] = { ...slotValue, ...childValue };
508
+ } else if (key === "className") {
509
+ merged[key] = [slotValue, childValue].filter(Boolean).join(" ");
510
+ }
511
+ }
512
+ return merged;
513
+ }
514
+ var Slot = React2.forwardRef(
515
+ ({ children, ...slotProps }, forwardedRef) => {
516
+ if (!React2.isValidElement(children) || React2.Children.count(children) !== 1 || children.type === React2.Fragment) {
517
+ throw new Error(
518
+ "Slot expected a single React element child. Pass exactly one element to asChild."
519
+ );
520
+ }
521
+ const child = children;
522
+ const childRef = child.props.ref ?? null;
523
+ const mergedProps = mergeProps(slotProps, child.props);
524
+ mergedProps.ref = forwardedRef ? composeRefs(forwardedRef, childRef) : childRef;
525
+ return React2.cloneElement(child, mergedProps);
526
+ }
527
+ );
528
+ Slot.displayName = "Slot";
529
+
530
+ // src/components/ui/card.tsx
480
531
  import { jsx as jsx6 } from "react/jsx-runtime";
481
- var Card = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx6(
482
- "div",
483
- {
484
- ref,
485
- className: cn(
486
- "rounded-lg border border-sv-border bg-sv-surface text-sv-text",
487
- className
488
- ),
489
- ...props
532
+ var CARD_ELEMENTS = /* @__PURE__ */ new Set(["div", "section", "article", "li", "aside"]);
533
+ var Card = React3.forwardRef(
534
+ ({ className, as, asChild = false, ...props }, ref) => {
535
+ if (asChild) {
536
+ return /* @__PURE__ */ jsx6(Slot, { ref, className: cn("sv-card", className), ...props });
537
+ }
538
+ const Comp = as !== void 0 && CARD_ELEMENTS.has(as) ? as : "div";
539
+ return React3.createElement(Comp, {
540
+ ref,
541
+ className: cn("sv-card", className),
542
+ ...props
543
+ });
490
544
  }
491
- ));
545
+ );
492
546
  Card.displayName = "Card";
493
- var CardHeader = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx6(
494
- "div",
495
- {
496
- ref,
497
- className: cn("flex flex-col space-y-1.5 p-6", className),
498
- ...props
499
- }
500
- ));
547
+ var CardHeader = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx6("div", { ref, className: cn("sv-card__header", className), ...props }));
501
548
  CardHeader.displayName = "CardHeader";
502
- var CardTitle = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx6(
503
- "h2",
504
- {
505
- ref,
506
- className: cn(
507
- "text-2xl font-semibold leading-none tracking-tight",
508
- className
509
- ),
510
- ...props
511
- }
512
- ));
549
+ var CardTitle = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx6("h2", { ref, className: cn("sv-card__title", className), ...props }));
513
550
  CardTitle.displayName = "CardTitle";
514
- var CardDescription = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx6(
515
- "p",
516
- {
517
- ref,
518
- className: cn("text-sm text-sv-text-2", className),
519
- ...props
520
- }
521
- ));
551
+ var CardDescription = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx6("p", { ref, className: cn("sv-card__description", className), ...props }));
522
552
  CardDescription.displayName = "CardDescription";
523
- var CardContent = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx6("div", { ref, className: cn("p-6 pt-0", className), ...props }));
553
+ var CardContent = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx6("div", { ref, className: cn("sv-card__content", className), ...props }));
524
554
  CardContent.displayName = "CardContent";
525
- var CardFooter = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx6(
526
- "div",
527
- {
528
- ref,
529
- className: cn("flex items-center p-6 pt-0", className),
530
- ...props
531
- }
532
- ));
555
+ var CardFooter = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx6("div", { ref, className: cn("sv-card__footer", className), ...props }));
533
556
  CardFooter.displayName = "CardFooter";
534
557
 
535
558
  // src/components/ui/alert.tsx
536
- import * as React3 from "react";
559
+ import * as React4 from "react";
537
560
  import { jsx as jsx7 } from "react/jsx-runtime";
538
- var Alert = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx7(
561
+ var Alert = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx7(
539
562
  "div",
540
563
  {
541
564
  ref,
542
- className: cn(
543
- "relative w-full rounded-lg border border-sv-border bg-sv-surface p-4 text-sv-text [&>svg~*]:pl-7 [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-sv-text",
544
- className
545
- ),
565
+ className: cn("sv-alert", className),
546
566
  role: "alert",
547
567
  ...props
548
568
  }
549
569
  ));
550
570
  Alert.displayName = "Alert";
551
- var AlertTitle = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx7(
552
- "h5",
553
- {
554
- ref,
555
- className: cn("mb-1 font-medium leading-tight tracking-tight", className),
556
- ...props
557
- }
558
- ));
571
+ var AlertTitle = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx7("h5", { ref, className: cn("sv-alert__title", className), ...props }));
559
572
  AlertTitle.displayName = "AlertTitle";
560
- var AlertDescription = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx7(
561
- "div",
562
- {
563
- ref,
564
- className: cn("text-sm text-sv-text-2 [&_p]:leading-relaxed", className),
565
- ...props
566
- }
567
- ));
573
+ var AlertDescription = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx7("div", { ref, className: cn("sv-alert__description", className), ...props }));
568
574
  AlertDescription.displayName = "AlertDescription";
569
575
 
570
576
  // src/components/ui/badge.tsx
@@ -575,11 +581,10 @@ function Badge({ className, variant = "default", ...props }) {
575
581
  "div",
576
582
  {
577
583
  className: cn(
578
- "inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
579
- variant === "default" && "border-transparent bg-sv-signal-cyan text-sv-bg",
580
- variant === "secondary" && "border-transparent bg-sv-surface-2 text-sv-text hover:bg-sv-surface",
581
- variant === "destructive" && "border-transparent bg-red-500 text-white hover:bg-red-600",
582
- variant === "outline" && "text-sv-text border-sv-border",
584
+ "sv-badge",
585
+ variant === "secondary" && "sv-badge--secondary",
586
+ variant === "destructive" && "sv-badge--destructive",
587
+ variant === "outline" && "sv-badge--outline",
583
588
  className
584
589
  ),
585
590
  ...props
@@ -587,18 +592,95 @@ function Badge({ className, variant = "default", ...props }) {
587
592
  );
588
593
  }
589
594
 
590
- // src/components/ui/input.tsx
591
- import * as React5 from "react";
595
+ // src/components/ui/icon.tsx
596
+ import * as React6 from "react";
597
+
598
+ // src/components/ui/icon-set.ts
599
+ import {
600
+ Bars3Icon,
601
+ CheckCircleIcon,
602
+ CheckIcon,
603
+ ChevronDownIcon,
604
+ ChevronLeftIcon,
605
+ ChevronRightIcon,
606
+ ChevronUpIcon,
607
+ DocumentDuplicateIcon,
608
+ ExclamationCircleIcon,
609
+ ExclamationTriangleIcon,
610
+ InformationCircleIcon,
611
+ MagnifyingGlassIcon,
612
+ MoonIcon,
613
+ SunIcon,
614
+ XMarkIcon
615
+ } from "@heroicons/react/24/outline";
616
+ var ICON_GLYPHS = {
617
+ x: XMarkIcon,
618
+ check: CheckIcon,
619
+ "chevron-down": ChevronDownIcon,
620
+ "chevron-up": ChevronUpIcon,
621
+ "chevron-right": ChevronRightIcon,
622
+ "chevron-left": ChevronLeftIcon,
623
+ info: InformationCircleIcon,
624
+ "alert-triangle": ExclamationTriangleIcon,
625
+ "alert-circle": ExclamationCircleIcon,
626
+ "check-circle": CheckCircleIcon,
627
+ copy: DocumentDuplicateIcon,
628
+ sun: SunIcon,
629
+ moon: MoonIcon,
630
+ search: MagnifyingGlassIcon,
631
+ menu: Bars3Icon
632
+ };
633
+ var ICON_NAMES = Object.keys(ICON_GLYPHS);
634
+ var ICON_FALLBACK_NAME = "alert-circle";
635
+
636
+ // src/components/ui/icon.tsx
592
637
  import { jsx as jsx9 } from "react/jsx-runtime";
593
- var Input = React5.forwardRef(
594
- ({ className, type, ...props }, ref) => /* @__PURE__ */ jsx9(
638
+ var Icon = React6.forwardRef(
639
+ ({ name, size = "md", label, className, ...props }, ref) => {
640
+ const Glyph = ICON_GLYPHS[name] ?? ICON_GLYPHS[ICON_FALLBACK_NAME];
641
+ return /* @__PURE__ */ jsx9(
642
+ Glyph,
643
+ {
644
+ ...props,
645
+ ref,
646
+ className: cn(
647
+ "sv-icon",
648
+ size === "sm" && "sv-icon--sm",
649
+ size === "lg" && "sv-icon--lg",
650
+ className
651
+ ),
652
+ "aria-hidden": label === void 0 ? "true" : void 0,
653
+ role: label === void 0 ? void 0 : "img",
654
+ "aria-label": label
655
+ }
656
+ );
657
+ }
658
+ );
659
+ Icon.displayName = "Icon";
660
+
661
+ // src/components/ui/input.tsx
662
+ import * as React7 from "react";
663
+
664
+ // src/recipes/field.ts
665
+ function field(options = {}) {
666
+ return cx(
667
+ "sv-field",
668
+ options.variant && options.variant !== "input" && `sv-field--${options.variant}`
669
+ );
670
+ }
671
+ var fieldClasses = {
672
+ choice: "sv-choice",
673
+ srOnly: "sv-sr-only"
674
+ };
675
+
676
+ // src/components/ui/input.tsx
677
+ import { jsx as jsx10 } from "react/jsx-runtime";
678
+ var Input = React7.forwardRef(
679
+ ({ className, type, ...props }, ref) => /* @__PURE__ */ jsx10(
595
680
  "input",
596
681
  {
597
682
  type,
598
- className: cn(
599
- "flex h-10 w-full rounded-md border border-sv-border bg-sv-surface px-3 py-2 text-sm text-sv-text placeholder:text-sv-text-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
600
- className
601
- ),
683
+ className: cn(field(), className),
602
684
  ref,
603
685
  ...props
604
686
  }
@@ -606,6 +688,172 @@ var Input = React5.forwardRef(
606
688
  );
607
689
  Input.displayName = "Input";
608
690
 
691
+ // src/components/ui/textarea.tsx
692
+ import * as React8 from "react";
693
+ import { jsx as jsx11 } from "react/jsx-runtime";
694
+ var Textarea = React8.forwardRef(
695
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx11(
696
+ "textarea",
697
+ {
698
+ className: cn(field({ variant: "textarea" }), className),
699
+ ref,
700
+ ...props
701
+ }
702
+ )
703
+ );
704
+ Textarea.displayName = "Textarea";
705
+
706
+ // src/components/ui/native-select.tsx
707
+ import * as React9 from "react";
708
+ import { jsx as jsx12 } from "react/jsx-runtime";
709
+ var NativeSelect = React9.forwardRef(
710
+ ({ className, children, ...props }, ref) => /* @__PURE__ */ jsx12(
711
+ "select",
712
+ {
713
+ className: cn(field({ variant: "select" }), className),
714
+ ref,
715
+ ...props,
716
+ children
717
+ }
718
+ )
719
+ );
720
+ NativeSelect.displayName = "NativeSelect";
721
+
722
+ // src/components/ui/file-input.tsx
723
+ import * as React10 from "react";
724
+ import { jsx as jsx13 } from "react/jsx-runtime";
725
+ var FileInput = React10.forwardRef(
726
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx13(
727
+ "input",
728
+ {
729
+ className: cn(field({ variant: "file" }), className),
730
+ ref,
731
+ ...props,
732
+ type: "file"
733
+ }
734
+ )
735
+ );
736
+ FileInput.displayName = "FileInput";
737
+
738
+ // src/components/ui/checkbox.tsx
739
+ import * as React11 from "react";
740
+ import { jsx as jsx14 } from "react/jsx-runtime";
741
+ var Checkbox = React11.forwardRef(
742
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx14(
743
+ "input",
744
+ {
745
+ className: cn("sv-check", className),
746
+ ref,
747
+ ...props,
748
+ type: "checkbox"
749
+ }
750
+ )
751
+ );
752
+ Checkbox.displayName = "Checkbox";
753
+
754
+ // src/components/ui/radio-group.tsx
755
+ import * as React12 from "react";
756
+ import { jsx as jsx15, jsxs as jsxs4 } from "react/jsx-runtime";
757
+ var RadioGroupItem = React12.forwardRef(
758
+ ({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs4("label", { className: fieldClasses.choice, children: [
759
+ /* @__PURE__ */ jsx15(
760
+ "input",
761
+ {
762
+ className: cn("sv-radio", className),
763
+ ref,
764
+ ...props,
765
+ type: "radio"
766
+ }
767
+ ),
768
+ children
769
+ ] })
770
+ );
771
+ RadioGroupItem.displayName = "RadioGroupItem";
772
+ var RadioGroup = React12.forwardRef(
773
+ ({ className, legend, legendHidden, orientation = "vertical", name, children, ...props }, ref) => {
774
+ const items = React12.Children.map(children, (child) => {
775
+ if (!React12.isValidElement(child) || child.type !== RadioGroupItem) {
776
+ return child;
777
+ }
778
+ const itemProps = child.props;
779
+ if (itemProps.name !== void 0) {
780
+ return child;
781
+ }
782
+ return React12.cloneElement(child, { name });
783
+ });
784
+ return /* @__PURE__ */ jsxs4(
785
+ "fieldset",
786
+ {
787
+ className: cn(
788
+ "sv-radio-group",
789
+ orientation === "horizontal" && "sv-radio-group--horizontal",
790
+ className
791
+ ),
792
+ ref,
793
+ ...props,
794
+ children: [
795
+ legend !== void 0 && /* @__PURE__ */ jsx15("legend", { className: cn("sv-radio-group__legend", legendHidden && fieldClasses.srOnly), children: legend }),
796
+ items
797
+ ]
798
+ }
799
+ );
800
+ }
801
+ );
802
+ RadioGroup.displayName = "RadioGroup";
803
+
804
+ // src/components/ui/table.tsx
805
+ import * as React13 from "react";
806
+
807
+ // src/recipes/table.ts
808
+ function table() {
809
+ return "sv-table";
810
+ }
811
+ var tableClasses = {
812
+ container: "sv-table-container",
813
+ head: "sv-table__head",
814
+ body: "sv-table__body",
815
+ foot: "sv-table__foot",
816
+ row: "sv-table__row",
817
+ th: "sv-table__th",
818
+ td: "sv-table__td",
819
+ caption: "sv-table__caption"
820
+ };
821
+
822
+ // src/components/ui/table.tsx
823
+ import { jsx as jsx16 } from "react/jsx-runtime";
824
+ var Table = React13.forwardRef(
825
+ ({ className, containerClassName, ...props }, ref) => /* @__PURE__ */ jsx16("div", { className: cn(tableClasses.container, containerClassName), children: /* @__PURE__ */ jsx16("table", { className: cn(table(), className), ref, ...props }) })
826
+ );
827
+ Table.displayName = "Table";
828
+ var TableHeader = React13.forwardRef(
829
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx16("thead", { className: cn(tableClasses.head, className), ref, ...props })
830
+ );
831
+ TableHeader.displayName = "TableHeader";
832
+ var TableBody = React13.forwardRef(
833
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx16("tbody", { className: cn(tableClasses.body, className), ref, ...props })
834
+ );
835
+ TableBody.displayName = "TableBody";
836
+ var TableFooter = React13.forwardRef(
837
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx16("tfoot", { className: cn(tableClasses.foot, className), ref, ...props })
838
+ );
839
+ TableFooter.displayName = "TableFooter";
840
+ var TableRow = React13.forwardRef(
841
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx16("tr", { className: cn(tableClasses.row, className), ref, ...props })
842
+ );
843
+ TableRow.displayName = "TableRow";
844
+ var TableHead = React13.forwardRef(
845
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx16("th", { className: cn(tableClasses.th, className), ref, ...props })
846
+ );
847
+ TableHead.displayName = "TableHead";
848
+ var TableCell = React13.forwardRef(
849
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx16("td", { className: cn(tableClasses.td, className), ref, ...props })
850
+ );
851
+ TableCell.displayName = "TableCell";
852
+ var TableCaption = React13.forwardRef(
853
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx16("caption", { className: cn(tableClasses.caption, className), ref, ...props })
854
+ );
855
+ TableCaption.displayName = "TableCaption";
856
+
609
857
  // src/tokens/typography.ts
610
858
  var fontFamilies = {
611
859
  display: "'Sora', ui-sans-serif, system-ui, sans-serif",
@@ -709,24 +957,39 @@ export {
709
957
  CardSkeleton,
710
958
  CardTitle,
711
959
  CategoryPill,
960
+ Checkbox,
712
961
  CodeBlock,
713
962
  DEFAULT_ACCENT,
714
963
  DEFAULT_MODE,
715
964
  FeaturedPostCard,
965
+ FileInput,
716
966
  Footer,
717
967
  Header,
718
968
  Hero,
969
+ Icon,
719
970
  Input,
720
971
  Layout,
721
972
  Lead,
722
973
  Logo,
974
+ NativeSelect,
723
975
  PostCard,
724
976
  PostGrid,
725
977
  Prose,
726
978
  READING_PROGRESS_VAR,
979
+ RadioGroup,
980
+ RadioGroupItem,
727
981
  Sidebar,
728
982
  SidebarSection,
729
983
  Skeleton,
984
+ Table,
985
+ TableBody,
986
+ TableCaption,
987
+ TableCell,
988
+ TableFooter,
989
+ TableHead,
990
+ TableHeader,
991
+ TableRow,
992
+ Textarea,
730
993
  ThemeScript,
731
994
  accentNames,
732
995
  accents,
@@ -748,6 +1011,8 @@ export {
748
1011
  easings,
749
1012
  featuredPostCard,
750
1013
  featuredPostCardClasses,
1014
+ field,
1015
+ fieldClasses,
751
1016
  fontFamilies,
752
1017
  fontSizes,
753
1018
  fontWeights,
@@ -778,6 +1043,8 @@ export {
778
1043
  sidebarClasses,
779
1044
  skeletonLine,
780
1045
  spacing,
1046
+ table,
1047
+ tableClasses,
781
1048
  tableOfContents,
782
1049
  themeModes,
783
1050
  tocLink,