@kinetixui/ui 0.1.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.
Files changed (81) hide show
  1. package/LICENSE +21 -0
  2. package/dist/index.d.ts +1176 -0
  3. package/dist/index.js +3939 -0
  4. package/package.json +106 -0
  5. package/src/components/accordion.tsx +52 -0
  6. package/src/components/alert-dialog.tsx +115 -0
  7. package/src/components/alert.tsx +47 -0
  8. package/src/components/aspect-ratio.tsx +7 -0
  9. package/src/components/audio-player.tsx +150 -0
  10. package/src/components/avatar.tsx +76 -0
  11. package/src/components/badge.tsx +40 -0
  12. package/src/components/breadcrumb.tsx +77 -0
  13. package/src/components/button.tsx +119 -0
  14. package/src/components/calendar.tsx +60 -0
  15. package/src/components/card.tsx +50 -0
  16. package/src/components/carousel.tsx +181 -0
  17. package/src/components/chart.tsx +177 -0
  18. package/src/components/checkbox.tsx +38 -0
  19. package/src/components/circular-progress.tsx +67 -0
  20. package/src/components/code-block.tsx +96 -0
  21. package/src/components/collapsible.tsx +9 -0
  22. package/src/components/command.tsx +123 -0
  23. package/src/components/context-menu.tsx +132 -0
  24. package/src/components/data-table.tsx +92 -0
  25. package/src/components/date-picker.tsx +68 -0
  26. package/src/components/dialog.tsx +101 -0
  27. package/src/components/drawer.tsx +82 -0
  28. package/src/components/dropdown-menu.tsx +132 -0
  29. package/src/components/fab.tsx +58 -0
  30. package/src/components/field.tsx +128 -0
  31. package/src/components/file-upload.tsx +183 -0
  32. package/src/components/footer.tsx +62 -0
  33. package/src/components/form.tsx +130 -0
  34. package/src/components/hover-card.tsx +28 -0
  35. package/src/components/image.tsx +87 -0
  36. package/src/components/inform.tsx +82 -0
  37. package/src/components/input-group.tsx +96 -0
  38. package/src/components/input-otp.tsx +63 -0
  39. package/src/components/input.tsx +72 -0
  40. package/src/components/label.tsx +20 -0
  41. package/src/components/list.tsx +69 -0
  42. package/src/components/menubar.tsx +168 -0
  43. package/src/components/metric.tsx +51 -0
  44. package/src/components/modal.tsx +126 -0
  45. package/src/components/navigation-bar.tsx +49 -0
  46. package/src/components/navigation-menu.tsx +117 -0
  47. package/src/components/number-input.tsx +86 -0
  48. package/src/components/pagination.tsx +77 -0
  49. package/src/components/password-input.tsx +36 -0
  50. package/src/components/popover.tsx +32 -0
  51. package/src/components/progress.tsx +24 -0
  52. package/src/components/quote.tsx +34 -0
  53. package/src/components/radio-group.tsx +44 -0
  54. package/src/components/rating.tsx +88 -0
  55. package/src/components/resizable.tsx +40 -0
  56. package/src/components/scroll-area.tsx +39 -0
  57. package/src/components/select.tsx +124 -0
  58. package/src/components/separator.tsx +25 -0
  59. package/src/components/sheet.tsx +104 -0
  60. package/src/components/sidebar.tsx +390 -0
  61. package/src/components/skeleton.tsx +9 -0
  62. package/src/components/slider.tsx +24 -0
  63. package/src/components/sonner.tsx +30 -0
  64. package/src/components/spinner.tsx +43 -0
  65. package/src/components/stepper.tsx +75 -0
  66. package/src/components/switch.tsx +37 -0
  67. package/src/components/tab-bar.tsx +58 -0
  68. package/src/components/table-of-contents.tsx +46 -0
  69. package/src/components/table.tsx +70 -0
  70. package/src/components/tabs.tsx +54 -0
  71. package/src/components/tag.tsx +56 -0
  72. package/src/components/textarea.tsx +56 -0
  73. package/src/components/toggle-group.tsx +41 -0
  74. package/src/components/toggle.tsx +34 -0
  75. package/src/components/tooltip.tsx +31 -0
  76. package/src/index.ts +305 -0
  77. package/src/lib/utils.ts +7 -0
  78. package/src/stories/Button.stories.tsx +155 -0
  79. package/src/stories/Input.stories.tsx +80 -0
  80. package/src/stories/Textarea.stories.tsx +69 -0
  81. package/tailwind.config.ts +107 -0
@@ -0,0 +1,46 @@
1
+ "use client";
2
+
3
+ import * as React from "react";
4
+ import { cn } from "../lib/utils";
5
+
6
+ /**
7
+ * TableOfContents — an anchor-link nav list with indent levels and an
8
+ * active-item state (drive `active` from your own scroll-spy).
9
+ */
10
+ export interface TocItem {
11
+ id: string;
12
+ label: React.ReactNode;
13
+ level?: number;
14
+ }
15
+
16
+ export interface TableOfContentsProps extends React.HTMLAttributes<HTMLElement> {
17
+ items: TocItem[];
18
+ active?: string;
19
+ }
20
+
21
+ const TableOfContents = React.forwardRef<HTMLElement, TableOfContentsProps>(
22
+ ({ className, items, active, ...props }, ref) => (
23
+ <nav ref={ref} aria-label="Table of contents" className={cn("flex flex-col gap-0.5 font-sans", className)} {...props}>
24
+ {items.map((item) => {
25
+ const isActive = item.id === active;
26
+ return (
27
+ <a
28
+ key={item.id}
29
+ href={`#${item.id}`}
30
+ aria-current={isActive ? "location" : undefined}
31
+ style={{ paddingInlineStart: `${((item.level ?? 1) - 1) * 12 + 12}px` }}
32
+ className={cn(
33
+ "-ms-px border-s py-1.5 text-body-sm outline-none transition-colors",
34
+ isActive ? "border-primary font-medium text-primary" : "border-transparent text-muted-foreground hover:text-foreground",
35
+ )}
36
+ >
37
+ {item.label}
38
+ </a>
39
+ );
40
+ })}
41
+ </nav>
42
+ ),
43
+ );
44
+ TableOfContents.displayName = "TableOfContents";
45
+
46
+ export { TableOfContents };
@@ -0,0 +1,70 @@
1
+ "use client";
2
+
3
+ import * as React from "react";
4
+ import { cn } from "../lib/utils";
5
+
6
+ const Table = React.forwardRef<HTMLTableElement, React.HTMLAttributes<HTMLTableElement>>(
7
+ ({ className, ...props }, ref) => (
8
+ <div className="relative w-full overflow-auto">
9
+ <table ref={ref} className={cn("w-full caption-bottom text-sm font-sans", className)} {...props} />
10
+ </div>
11
+ ),
12
+ );
13
+ Table.displayName = "Table";
14
+
15
+ const TableHeader = React.forwardRef<HTMLTableSectionElement, React.HTMLAttributes<HTMLTableSectionElement>>(
16
+ ({ className, ...props }, ref) => <thead ref={ref} className={cn("[&_tr]:border-b", className)} {...props} />,
17
+ );
18
+ TableHeader.displayName = "TableHeader";
19
+
20
+ const TableBody = React.forwardRef<HTMLTableSectionElement, React.HTMLAttributes<HTMLTableSectionElement>>(
21
+ ({ className, ...props }, ref) => (
22
+ <tbody ref={ref} className={cn("[&_tr:last-child]:border-0", className)} {...props} />
23
+ ),
24
+ );
25
+ TableBody.displayName = "TableBody";
26
+
27
+ const TableFooter = React.forwardRef<HTMLTableSectionElement, React.HTMLAttributes<HTMLTableSectionElement>>(
28
+ ({ className, ...props }, ref) => (
29
+ <tfoot ref={ref} className={cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0", className)} {...props} />
30
+ ),
31
+ );
32
+ TableFooter.displayName = "TableFooter";
33
+
34
+ const TableRow = React.forwardRef<HTMLTableRowElement, React.HTMLAttributes<HTMLTableRowElement>>(
35
+ ({ className, ...props }, ref) => (
36
+ <tr
37
+ ref={ref}
38
+ className={cn("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted", className)}
39
+ {...props}
40
+ />
41
+ ),
42
+ );
43
+ TableRow.displayName = "TableRow";
44
+
45
+ const TableHead = React.forwardRef<HTMLTableCellElement, React.ThHTMLAttributes<HTMLTableCellElement>>(
46
+ ({ className, ...props }, ref) => (
47
+ <th
48
+ ref={ref}
49
+ className={cn("h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0", className)}
50
+ {...props}
51
+ />
52
+ ),
53
+ );
54
+ TableHead.displayName = "TableHead";
55
+
56
+ const TableCell = React.forwardRef<HTMLTableCellElement, React.TdHTMLAttributes<HTMLTableCellElement>>(
57
+ ({ className, ...props }, ref) => (
58
+ <td ref={ref} className={cn("p-2 align-middle [&:has([role=checkbox])]:pr-0", className)} {...props} />
59
+ ),
60
+ );
61
+ TableCell.displayName = "TableCell";
62
+
63
+ const TableCaption = React.forwardRef<HTMLTableCaptionElement, React.HTMLAttributes<HTMLTableCaptionElement>>(
64
+ ({ className, ...props }, ref) => (
65
+ <caption ref={ref} className={cn("mt-4 text-sm text-muted-foreground", className)} {...props} />
66
+ ),
67
+ );
68
+ TableCaption.displayName = "TableCaption";
69
+
70
+ export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption };
@@ -0,0 +1,54 @@
1
+ "use client";
2
+
3
+ import * as React from "react";
4
+ import * as TabsPrimitive from "@radix-ui/react-tabs";
5
+ import { cn } from "../lib/utils";
6
+
7
+ const Tabs = TabsPrimitive.Root;
8
+
9
+ const TabsList = React.forwardRef<
10
+ React.ElementRef<typeof TabsPrimitive.List>,
11
+ React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>
12
+ >(({ className, ...props }, ref) => (
13
+ <TabsPrimitive.List
14
+ ref={ref}
15
+ className={cn(
16
+ "inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground font-sans",
17
+ className,
18
+ )}
19
+ {...props}
20
+ />
21
+ ));
22
+ TabsList.displayName = TabsPrimitive.List.displayName;
23
+
24
+ const TabsTrigger = React.forwardRef<
25
+ React.ElementRef<typeof TabsPrimitive.Trigger>,
26
+ React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>
27
+ >(({ className, ...props }, ref) => (
28
+ <TabsPrimitive.Trigger
29
+ ref={ref}
30
+ className={cn(
31
+ "inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium transition-all",
32
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
33
+ "disabled:pointer-events-none disabled:opacity-50",
34
+ "data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",
35
+ className,
36
+ )}
37
+ {...props}
38
+ />
39
+ ));
40
+ TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
41
+
42
+ const TabsContent = React.forwardRef<
43
+ React.ElementRef<typeof TabsPrimitive.Content>,
44
+ React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>
45
+ >(({ className, ...props }, ref) => (
46
+ <TabsPrimitive.Content
47
+ ref={ref}
48
+ className={cn("mt-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", className)}
49
+ {...props}
50
+ />
51
+ ));
52
+ TabsContent.displayName = TabsPrimitive.Content.displayName;
53
+
54
+ export { Tabs, TabsList, TabsTrigger, TabsContent };
@@ -0,0 +1,56 @@
1
+ "use client";
2
+
3
+ import * as React from "react";
4
+ import { cva, type VariantProps } from "class-variance-authority";
5
+ import { X } from "lucide-react";
6
+ import { cn } from "../lib/utils";
7
+
8
+ /**
9
+ * Tag — reconciled 1:1 with the KinetixUI design source, node 54855:14021.
10
+ * Container-tinted, dismissible chip (distinct from Badge, which is a solid
11
+ * pill). `rounded-sm`, `--spacing-2` / `--spacing-1` pad, Label Medium type,
12
+ * optional close button. Variants: default | secondary | destructive | warning | outline.
13
+ */
14
+ const tagVariants = cva(
15
+ "inline-flex items-center gap-1 rounded-sm px-2 py-1 text-xs font-medium font-sans tracking-[0.5px]",
16
+ {
17
+ variants: {
18
+ variant: {
19
+ default: "bg-accent text-accent-foreground",
20
+ secondary: "bg-secondary text-secondary-foreground",
21
+ destructive: "bg-destructive-foreground text-destructive",
22
+ warning: "bg-warning-foreground text-warning",
23
+ outline: "border border-input text-foreground",
24
+ },
25
+ },
26
+ defaultVariants: { variant: "default" },
27
+ },
28
+ );
29
+
30
+ export interface TagProps
31
+ extends React.HTMLAttributes<HTMLSpanElement>,
32
+ VariantProps<typeof tagVariants> {
33
+ /** show a dismiss button; called when it's clicked */
34
+ onRemove?: () => void;
35
+ }
36
+
37
+ const Tag = React.forwardRef<HTMLSpanElement, TagProps>(
38
+ ({ className, variant, onRemove, children, ...props }, ref) => (
39
+ <span ref={ref} className={cn(tagVariants({ variant }), className)} {...props}>
40
+ {children}
41
+ {onRemove && (
42
+ <button
43
+ type="button"
44
+ onClick={onRemove}
45
+ aria-label="Remove"
46
+ className="-mr-0.5 ml-0.5 rounded-[2px] opacity-70 outline-none transition-opacity hover:opacity-100 focus-visible:ring-1 focus-visible:ring-current"
47
+ >
48
+ <X className="size-3.5" />
49
+ </button>
50
+ )}
51
+ </span>
52
+ ),
53
+ );
54
+ Tag.displayName = "Tag";
55
+
56
+ export { Tag, tagVariants };
@@ -0,0 +1,56 @@
1
+ "use client";
2
+
3
+ import * as React from "react";
4
+ import { cva, type VariantProps } from "class-variance-authority";
5
+ import { cn } from "../lib/utils";
6
+
7
+ /**
8
+ * Textarea — generated from Figma "KinetixUI" › UI Components ›
9
+ * 01. Form Inputs › Textarea (node 54855:13857).
10
+ *
11
+ * Identical to `Input` except the field is multi-line: `min-h-[100px]`
12
+ * (Figma `h: 100`) and vertical resize. Same state matrix and tokens.
13
+ */
14
+ const textareaVariants = cva(
15
+ [
16
+ "flex w-full min-h-[100px] resize-y rounded-sm border border-input bg-background px-3 py-3",
17
+ "font-sans text-[14px] leading-5 tracking-[0.25px] text-foreground",
18
+ "placeholder:text-muted-foreground",
19
+ "outline-none transition-colors",
20
+ "focus-visible:border-primary focus-visible:shadow-focus",
21
+ "disabled:cursor-not-allowed disabled:opacity-50",
22
+ "aria-[invalid=true]:border-destructive aria-[invalid=true]:focus-visible:border-destructive aria-[invalid=true]:focus-visible:shadow-focus-destructive",
23
+ ],
24
+ {
25
+ variants: {
26
+ state: {
27
+ Default: "",
28
+ Focus: "border-primary shadow-focus",
29
+ Error: "border-destructive",
30
+ Disabled: "opacity-50 pointer-events-none resize-none",
31
+ },
32
+ },
33
+ defaultVariants: { state: "Default" },
34
+ },
35
+ );
36
+
37
+ export interface TextareaProps
38
+ extends React.TextareaHTMLAttributes<HTMLTextAreaElement>,
39
+ VariantProps<typeof textareaVariants> {}
40
+
41
+ const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
42
+ ({ className, state, disabled, "aria-invalid": ariaInvalid, ...props }, ref) => (
43
+ <textarea
44
+ ref={ref}
45
+ data-slot="textarea"
46
+ data-state={state ? state.toLowerCase() : undefined}
47
+ aria-invalid={ariaInvalid ?? (state === "Error" || undefined)}
48
+ disabled={disabled || state === "Disabled"}
49
+ className={cn(textareaVariants({ state }), className)}
50
+ {...props}
51
+ />
52
+ ),
53
+ );
54
+ Textarea.displayName = "Textarea";
55
+
56
+ export { Textarea, textareaVariants };
@@ -0,0 +1,41 @@
1
+ "use client";
2
+
3
+ import * as React from "react";
4
+ import * as ToggleGroupPrimitive from "@radix-ui/react-toggle-group";
5
+ import { type VariantProps } from "class-variance-authority";
6
+ import { cn } from "../lib/utils";
7
+ import { toggleVariants } from "./toggle";
8
+
9
+ const ToggleGroupContext = React.createContext<VariantProps<typeof toggleVariants>>({
10
+ size: "default",
11
+ variant: "default",
12
+ });
13
+
14
+ const ToggleGroup = React.forwardRef<
15
+ React.ElementRef<typeof ToggleGroupPrimitive.Root>,
16
+ React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Root> & VariantProps<typeof toggleVariants>
17
+ >(({ className, variant, size, children, ...props }, ref) => (
18
+ <ToggleGroupPrimitive.Root ref={ref} className={cn("flex items-center gap-1", className)} {...props}>
19
+ <ToggleGroupContext.Provider value={{ variant, size }}>{children}</ToggleGroupContext.Provider>
20
+ </ToggleGroupPrimitive.Root>
21
+ ));
22
+ ToggleGroup.displayName = ToggleGroupPrimitive.Root.displayName;
23
+
24
+ const ToggleGroupItem = React.forwardRef<
25
+ React.ElementRef<typeof ToggleGroupPrimitive.Item>,
26
+ React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Item> & VariantProps<typeof toggleVariants>
27
+ >(({ className, children, variant, size, ...props }, ref) => {
28
+ const ctx = React.useContext(ToggleGroupContext);
29
+ return (
30
+ <ToggleGroupPrimitive.Item
31
+ ref={ref}
32
+ className={cn(toggleVariants({ variant: ctx.variant || variant, size: ctx.size || size }), className)}
33
+ {...props}
34
+ >
35
+ {children}
36
+ </ToggleGroupPrimitive.Item>
37
+ );
38
+ });
39
+ ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName;
40
+
41
+ export { ToggleGroup, ToggleGroupItem };
@@ -0,0 +1,34 @@
1
+ "use client";
2
+
3
+ import * as React from "react";
4
+ import * as TogglePrimitive from "@radix-ui/react-toggle";
5
+ import { cva, type VariantProps } from "class-variance-authority";
6
+ import { cn } from "../lib/utils";
7
+
8
+ const toggleVariants = cva(
9
+ "inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium font-sans transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:size-4 [&_svg]:shrink-0",
10
+ {
11
+ variants: {
12
+ variant: {
13
+ default: "bg-transparent",
14
+ outline: "border border-input bg-transparent shadow-sm hover:bg-accent hover:text-accent-foreground",
15
+ },
16
+ size: {
17
+ default: "h-9 min-w-9 px-2",
18
+ sm: "h-8 min-w-8 px-1.5",
19
+ lg: "h-10 min-w-10 px-2.5",
20
+ },
21
+ },
22
+ defaultVariants: { variant: "default", size: "default" },
23
+ },
24
+ );
25
+
26
+ const Toggle = React.forwardRef<
27
+ React.ElementRef<typeof TogglePrimitive.Root>,
28
+ React.ComponentPropsWithoutRef<typeof TogglePrimitive.Root> & VariantProps<typeof toggleVariants>
29
+ >(({ className, variant, size, ...props }, ref) => (
30
+ <TogglePrimitive.Root ref={ref} className={cn(toggleVariants({ variant, size }), className)} {...props} />
31
+ ));
32
+ Toggle.displayName = TogglePrimitive.Root.displayName;
33
+
34
+ export { Toggle, toggleVariants };
@@ -0,0 +1,31 @@
1
+ "use client";
2
+
3
+ import * as React from "react";
4
+ import * as TooltipPrimitive from "@radix-ui/react-tooltip";
5
+ import { cn } from "../lib/utils";
6
+
7
+ const TooltipProvider = TooltipPrimitive.Provider;
8
+ const Tooltip = TooltipPrimitive.Root;
9
+ const TooltipTrigger = TooltipPrimitive.Trigger;
10
+
11
+ const TooltipContent = React.forwardRef<
12
+ React.ElementRef<typeof TooltipPrimitive.Content>,
13
+ React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>
14
+ >(({ className, sideOffset = 4, ...props }, ref) => (
15
+ <TooltipPrimitive.Portal>
16
+ <TooltipPrimitive.Content
17
+ ref={ref}
18
+ sideOffset={sideOffset}
19
+ className={cn(
20
+ "z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground font-sans",
21
+ "animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
22
+ "data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
23
+ className,
24
+ )}
25
+ {...props}
26
+ />
27
+ </TooltipPrimitive.Portal>
28
+ ));
29
+ TooltipContent.displayName = TooltipPrimitive.Content.displayName;
30
+
31
+ export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };