@kinetixui/ui 0.12.0 → 0.14.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.
- package/dist/index.d.ts +21 -1
- package/dist/index.js +634 -621
- package/package.json +3 -2
- package/src/components/alert.tsx +1 -1
- package/src/components/app-bar.tsx +2 -2
- package/src/components/dialog.tsx +3 -2
- package/src/components/direction-provider.tsx +27 -0
- package/src/components/drawer.tsx +1 -1
- package/src/components/dropdown-menu.tsx +9 -9
- package/src/components/input-group.tsx +2 -2
- package/src/components/kanban-board.tsx +2 -1
- package/src/components/native-select.tsx +2 -2
- package/src/components/select.tsx +2 -2
- package/src/components/sheet.tsx +5 -2
- package/src/index.ts +4 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kinetixui/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "KinetixUI React components — CVA + Radix + Tailwind on the KinetixUI token contract. Also distributed via the kinetixui CLI as a component registry.",
|
|
6
6
|
"keywords": [
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
"@dnd-kit/sortable": "^10.0.0",
|
|
45
45
|
"@dnd-kit/utilities": "^3.2.2",
|
|
46
46
|
"@hookform/resolvers": "^5.9.1",
|
|
47
|
+
"@kinetixui/tokens": "0.14.0",
|
|
47
48
|
"@radix-ui/react-accordion": "^1.2.20",
|
|
48
49
|
"@radix-ui/react-alert-dialog": "^1.1.23",
|
|
49
50
|
"@radix-ui/react-aspect-ratio": "^1.1.15",
|
|
@@ -52,6 +53,7 @@
|
|
|
52
53
|
"@radix-ui/react-collapsible": "^1.1.20",
|
|
53
54
|
"@radix-ui/react-context-menu": "^2.3.7",
|
|
54
55
|
"@radix-ui/react-dialog": "^1.1.23",
|
|
56
|
+
"@radix-ui/react-direction": "^1.1.4",
|
|
55
57
|
"@radix-ui/react-dropdown-menu": "^2.1.24",
|
|
56
58
|
"@radix-ui/react-hover-card": "^1.1.23",
|
|
57
59
|
"@radix-ui/react-label": "^2.1.15",
|
|
@@ -93,7 +95,6 @@
|
|
|
93
95
|
"react-dom": ">=18"
|
|
94
96
|
},
|
|
95
97
|
"devDependencies": {
|
|
96
|
-
"@kinetixui/tokens": "0.12.0",
|
|
97
98
|
"@testing-library/jest-dom": "^7.0.1",
|
|
98
99
|
"@testing-library/react": "^16.3.3",
|
|
99
100
|
"@testing-library/user-event": "^14.6.7",
|
package/src/components/alert.tsx
CHANGED
|
@@ -5,7 +5,7 @@ import { cva, type VariantProps } from "class-variance-authority";
|
|
|
5
5
|
import { cn } from "../lib/utils";
|
|
6
6
|
|
|
7
7
|
const alertVariants = cva(
|
|
8
|
-
"relative w-full rounded-lg border px-4 py-3 text-sm font-sans [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:
|
|
8
|
+
"relative w-full rounded-lg border px-4 py-3 text-sm font-sans [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:start-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:ps-7",
|
|
9
9
|
{
|
|
10
10
|
variants: {
|
|
11
11
|
variant: {
|
|
@@ -63,7 +63,7 @@ const AppBar = React.forwardRef<HTMLElement, React.HTMLAttributes<HTMLElement>>(
|
|
|
63
63
|
aria-expanded={open}
|
|
64
64
|
onClick={() => setOpen((o) => !o)}
|
|
65
65
|
className={cn(
|
|
66
|
-
"
|
|
66
|
+
"ms-auto inline-flex size-9 items-center justify-center rounded-md text-foreground outline-none transition-colors md:hidden",
|
|
67
67
|
"hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring",
|
|
68
68
|
)}
|
|
69
69
|
>
|
|
@@ -131,7 +131,7 @@ AppBarLink.displayName = "AppBarLink";
|
|
|
131
131
|
|
|
132
132
|
const AppBarActions = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
|
133
133
|
({ className, ...props }, ref) => (
|
|
134
|
-
<div ref={ref} className={cn("
|
|
134
|
+
<div ref={ref} className={cn("ms-auto flex shrink-0 items-center gap-2", className)} {...props} />
|
|
135
135
|
),
|
|
136
136
|
);
|
|
137
137
|
AppBarActions.displayName = "AppBarActions";
|
|
@@ -34,6 +34,7 @@ const DialogContent = React.forwardRef<
|
|
|
34
34
|
<DialogPrimitive.Content
|
|
35
35
|
ref={ref}
|
|
36
36
|
className={cn(
|
|
37
|
+
// rtl-ok: centering trick (left-1/2 + -translate-x-1/2), direction-agnostic by construction
|
|
37
38
|
"fixed left-1/2 top-1/2 z-overlay grid w-full max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 border bg-background p-6 shadow-lg sm:rounded-xl font-sans",
|
|
38
39
|
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",
|
|
39
40
|
className,
|
|
@@ -41,7 +42,7 @@ const DialogContent = React.forwardRef<
|
|
|
41
42
|
{...props}
|
|
42
43
|
>
|
|
43
44
|
{children}
|
|
44
|
-
<DialogPrimitive.Close className="absolute
|
|
45
|
+
<DialogPrimitive.Close className="absolute end-4 top-4 rounded-sm opacity-muted transition-opacity hover:opacity-visible focus:outline-none focus:ring-2 focus:ring-ring disabled:pointer-events-none">
|
|
45
46
|
<X className="size-4" />
|
|
46
47
|
<span className="sr-only">Close</span>
|
|
47
48
|
</DialogPrimitive.Close>
|
|
@@ -51,7 +52,7 @@ const DialogContent = React.forwardRef<
|
|
|
51
52
|
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
52
53
|
|
|
53
54
|
const DialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
|
|
54
|
-
<div className={cn("flex flex-col space-y-1.5 text-center sm:text-
|
|
55
|
+
<div className={cn("flex flex-col space-y-1.5 text-center sm:text-start", className)} {...props} />
|
|
55
56
|
);
|
|
56
57
|
DialogHeader.displayName = "DialogHeader";
|
|
57
58
|
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { DirectionProvider as RadixDirectionProvider } from "@radix-ui/react-direction";
|
|
5
|
+
|
|
6
|
+
export interface KinetixDirectionProviderProps {
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
dir: "ltr" | "rtl";
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Every Radix primitive this library builds on (Select, DropdownMenu, Popover,
|
|
13
|
+
* Tooltip, ContextMenu, Menubar, NavigationMenu, HoverCard, …) reads direction
|
|
14
|
+
* from a `DirectionContext`, not from the ambient `dir` attribute — with no
|
|
15
|
+
* provider in the tree it defaults hard to `"ltr"` and stamps that onto its own
|
|
16
|
+
* portaled content, regardless of what `<html dir="rtl">` says. Logical-property
|
|
17
|
+
* CSS (see RTL.md) mirrors layout; this is what makes Radix's own positioning
|
|
18
|
+
* and portaled content agree with it. Wrap your app root in this alongside
|
|
19
|
+
* setting `dir` on `<html>`:
|
|
20
|
+
*
|
|
21
|
+
* <html dir={dir}>
|
|
22
|
+
* <KinetixDirectionProvider dir={dir}>{children}</KinetixDirectionProvider>
|
|
23
|
+
* </html>
|
|
24
|
+
*/
|
|
25
|
+
export function KinetixDirectionProvider({ dir, children }: KinetixDirectionProviderProps) {
|
|
26
|
+
return <RadixDirectionProvider dir={dir}>{children}</RadixDirectionProvider>;
|
|
27
|
+
}
|
|
@@ -43,7 +43,7 @@ const DrawerContent = React.forwardRef<
|
|
|
43
43
|
DrawerContent.displayName = "DrawerContent";
|
|
44
44
|
|
|
45
45
|
const DrawerHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
|
|
46
|
-
<div className={cn("grid gap-1.5 p-4 text-center sm:text-
|
|
46
|
+
<div className={cn("grid gap-1.5 p-4 text-center sm:text-start", className)} {...props} />
|
|
47
47
|
);
|
|
48
48
|
DrawerHeader.displayName = "DrawerHeader";
|
|
49
49
|
|
|
@@ -31,7 +31,7 @@ const DropdownMenuItem = React.forwardRef<
|
|
|
31
31
|
React.ElementRef<typeof DropdownMenuPrimitive.Item>,
|
|
32
32
|
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & { inset?: boolean }
|
|
33
33
|
>(({ className, inset, ...props }, ref) => (
|
|
34
|
-
<DropdownMenuPrimitive.Item ref={ref} className={cn(itemCls, inset && "
|
|
34
|
+
<DropdownMenuPrimitive.Item ref={ref} className={cn(itemCls, inset && "ps-8", className)} {...props} />
|
|
35
35
|
));
|
|
36
36
|
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
|
|
37
37
|
|
|
@@ -39,8 +39,8 @@ const DropdownMenuCheckboxItem = React.forwardRef<
|
|
|
39
39
|
React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,
|
|
40
40
|
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>
|
|
41
41
|
>(({ className, children, checked, ...props }, ref) => (
|
|
42
|
-
<DropdownMenuPrimitive.CheckboxItem ref={ref} className={cn(itemCls, "
|
|
43
|
-
<span className="absolute
|
|
42
|
+
<DropdownMenuPrimitive.CheckboxItem ref={ref} className={cn(itemCls, "ps-8", className)} checked={checked} {...props}>
|
|
43
|
+
<span className="absolute start-2 flex size-3.5 items-center justify-center">
|
|
44
44
|
<DropdownMenuPrimitive.ItemIndicator>
|
|
45
45
|
<Check className="size-4" />
|
|
46
46
|
</DropdownMenuPrimitive.ItemIndicator>
|
|
@@ -54,8 +54,8 @@ const DropdownMenuRadioItem = React.forwardRef<
|
|
|
54
54
|
React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,
|
|
55
55
|
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>
|
|
56
56
|
>(({ className, children, ...props }, ref) => (
|
|
57
|
-
<DropdownMenuPrimitive.RadioItem ref={ref} className={cn(itemCls, "
|
|
58
|
-
<span className="absolute
|
|
57
|
+
<DropdownMenuPrimitive.RadioItem ref={ref} className={cn(itemCls, "ps-8", className)} {...props}>
|
|
58
|
+
<span className="absolute start-2 flex size-3.5 items-center justify-center">
|
|
59
59
|
<DropdownMenuPrimitive.ItemIndicator>
|
|
60
60
|
<Circle className="size-2 fill-current" />
|
|
61
61
|
</DropdownMenuPrimitive.ItemIndicator>
|
|
@@ -71,7 +71,7 @@ const DropdownMenuLabel = React.forwardRef<
|
|
|
71
71
|
>(({ className, inset, ...props }, ref) => (
|
|
72
72
|
<DropdownMenuPrimitive.Label
|
|
73
73
|
ref={ref}
|
|
74
|
-
className={cn("px-2 py-1.5 text-sm font-semibold", inset && "
|
|
74
|
+
className={cn("px-2 py-1.5 text-sm font-semibold", inset && "ps-8", className)}
|
|
75
75
|
{...props}
|
|
76
76
|
/>
|
|
77
77
|
));
|
|
@@ -88,7 +88,7 @@ DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
|
|
|
88
88
|
// opacity-60 (not --opacity-muted's 0.7) is a pre-existing inconsistency —
|
|
89
89
|
// left as a literal rather than silently changing the rendered value.
|
|
90
90
|
const DropdownMenuShortcut = ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) => (
|
|
91
|
-
<span className={cn("
|
|
91
|
+
<span className={cn("ms-auto text-xs tracking-widest opacity-60", className)} {...props} />
|
|
92
92
|
);
|
|
93
93
|
DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
94
94
|
|
|
@@ -98,11 +98,11 @@ const DropdownMenuSubTrigger = React.forwardRef<
|
|
|
98
98
|
>(({ className, inset, children, ...props }, ref) => (
|
|
99
99
|
<DropdownMenuPrimitive.SubTrigger
|
|
100
100
|
ref={ref}
|
|
101
|
-
className={cn(itemCls, "data-[state=open]:bg-accent", inset && "
|
|
101
|
+
className={cn(itemCls, "data-[state=open]:bg-accent", inset && "ps-8", className)}
|
|
102
102
|
{...props}
|
|
103
103
|
>
|
|
104
104
|
{children}
|
|
105
|
-
<ChevronRight className="
|
|
105
|
+
<ChevronRight className="ms-auto size-4 rtl:-scale-x-100" />
|
|
106
106
|
</DropdownMenuPrimitive.SubTrigger>
|
|
107
107
|
));
|
|
108
108
|
DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
|
|
@@ -52,7 +52,7 @@ const InputGroupInput = React.forwardRef<
|
|
|
52
52
|
InputGroupInput.displayName = "InputGroupInput";
|
|
53
53
|
|
|
54
54
|
const addonVariants = cva("flex shrink-0 items-center gap-2 text-muted-foreground [&_svg]:size-4 [&_svg]:shrink-0", {
|
|
55
|
-
variants: { align: { start: "
|
|
55
|
+
variants: { align: { start: "ps-3", end: "pe-3" } },
|
|
56
56
|
defaultVariants: { align: "start" },
|
|
57
57
|
});
|
|
58
58
|
|
|
@@ -83,7 +83,7 @@ const InputGroupButton = React.forwardRef<
|
|
|
83
83
|
ref={ref}
|
|
84
84
|
type={type}
|
|
85
85
|
className={cn(
|
|
86
|
-
"flex h-full shrink-0 items-center gap-1.5 self-stretch border-
|
|
86
|
+
"flex h-full shrink-0 items-center gap-1.5 self-stretch border-s border-input bg-muted px-3 text-label-md text-foreground",
|
|
87
87
|
// base is bg-muted and muted==accent on dark, so the fill is a no-op there — the ring carries it
|
|
88
88
|
"outline-none transition-colors hover:bg-accent hover:ring-1 hover:ring-inset hover:ring-ring focus-visible:bg-accent focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-disabled",
|
|
89
89
|
"[&_svg]:size-4 [&_svg]:shrink-0",
|
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
verticalListSortingStrategy,
|
|
27
27
|
} from "@dnd-kit/sortable";
|
|
28
28
|
import { CSS } from "@dnd-kit/utilities";
|
|
29
|
+
import { tokens } from "@kinetixui/tokens";
|
|
29
30
|
import { cn } from "../lib/utils";
|
|
30
31
|
|
|
31
32
|
export interface KanbanCard {
|
|
@@ -78,7 +79,7 @@ export interface KanbanBoardProps extends Omit<React.HTMLAttributes<HTMLDivEleme
|
|
|
78
79
|
const KanbanBoard = React.forwardRef<HTMLDivElement, KanbanBoardProps>(
|
|
79
80
|
({ columns, onColumnsChange, className, ...props }, ref) => {
|
|
80
81
|
const sensors = useSensors(
|
|
81
|
-
useSensor(PointerSensor, { activationConstraint: { distance:
|
|
82
|
+
useSensor(PointerSensor, { activationConstraint: { distance: tokens.interaction.drag.threshold } }),
|
|
82
83
|
useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates }),
|
|
83
84
|
);
|
|
84
85
|
const [activeCard, setActiveCard] = React.useState<KanbanCard | null>(null);
|
|
@@ -15,7 +15,7 @@ import { cn } from "../lib/utils";
|
|
|
15
15
|
*/
|
|
16
16
|
const nativeSelectVariants = cva(
|
|
17
17
|
[
|
|
18
|
-
"flex w-full appearance-none border border-input bg-background px-3 py-3
|
|
18
|
+
"flex w-full appearance-none border border-input bg-background px-3 py-3 pe-9",
|
|
19
19
|
"font-sans text-[14px] leading-5 tracking-[0.25px] text-foreground",
|
|
20
20
|
"outline-none transition-colors",
|
|
21
21
|
"focus-visible:border-primary focus-visible:shadow-focus",
|
|
@@ -59,7 +59,7 @@ const NativeSelect = React.forwardRef<HTMLSelectElement, NativeSelectProps>(
|
|
|
59
59
|
>
|
|
60
60
|
{children}
|
|
61
61
|
</select>
|
|
62
|
-
<ChevronDown className="pointer-events-none absolute
|
|
62
|
+
<ChevronDown className="pointer-events-none absolute end-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground" />
|
|
63
63
|
</div>
|
|
64
64
|
),
|
|
65
65
|
);
|
|
@@ -90,13 +90,13 @@ const SelectItem = React.forwardRef<
|
|
|
90
90
|
<SelectPrimitive.Item
|
|
91
91
|
ref={ref}
|
|
92
92
|
className={cn(
|
|
93
|
-
"relative flex w-full cursor-default select-none items-center rounded-sm py-1.5
|
|
93
|
+
"relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 ps-8 pe-2 text-sm outline-none",
|
|
94
94
|
"focus:bg-accent focus:text-accent-foreground focus:ring-1 focus:ring-inset focus:ring-ring data-[disabled]:pointer-events-none data-[disabled]:opacity-disabled",
|
|
95
95
|
className,
|
|
96
96
|
)}
|
|
97
97
|
{...props}
|
|
98
98
|
>
|
|
99
|
-
<span className="absolute
|
|
99
|
+
<span className="absolute start-2 flex size-3.5 items-center justify-center">
|
|
100
100
|
<SelectPrimitive.ItemIndicator>
|
|
101
101
|
<Check className="size-4" />
|
|
102
102
|
</SelectPrimitive.ItemIndicator>
|
package/src/components/sheet.tsx
CHANGED
|
@@ -30,6 +30,8 @@ const sheetVariants = cva(
|
|
|
30
30
|
"fixed z-overlay gap-4 bg-background p-6 shadow-lg transition ease-standard data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-base data-[state=open]:duration-slow font-sans",
|
|
31
31
|
{
|
|
32
32
|
variants: {
|
|
33
|
+
// rtl-ok-start: `side` picks a physical screen edge on purpose (a caller-chosen
|
|
34
|
+
// slide-in direction, not text-direction-relative) — left/right stay physical.
|
|
33
35
|
side: {
|
|
34
36
|
top: "inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",
|
|
35
37
|
bottom:
|
|
@@ -38,6 +40,7 @@ const sheetVariants = cva(
|
|
|
38
40
|
right:
|
|
39
41
|
"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm",
|
|
40
42
|
},
|
|
43
|
+
// rtl-ok-end
|
|
41
44
|
},
|
|
42
45
|
defaultVariants: { side: "right" },
|
|
43
46
|
},
|
|
@@ -55,7 +58,7 @@ const SheetContent = React.forwardRef<
|
|
|
55
58
|
<SheetOverlay />
|
|
56
59
|
<SheetPrimitive.Content ref={ref} className={cn(sheetVariants({ side }), className)} {...props}>
|
|
57
60
|
{children}
|
|
58
|
-
<SheetPrimitive.Close className="absolute
|
|
61
|
+
<SheetPrimitive.Close className="absolute end-4 top-4 rounded-sm opacity-muted transition-opacity hover:opacity-visible focus:outline-none focus:ring-2 focus:ring-ring">
|
|
59
62
|
<X className="size-4" />
|
|
60
63
|
<span className="sr-only">Close</span>
|
|
61
64
|
</SheetPrimitive.Close>
|
|
@@ -65,7 +68,7 @@ const SheetContent = React.forwardRef<
|
|
|
65
68
|
SheetContent.displayName = SheetPrimitive.Content.displayName;
|
|
66
69
|
|
|
67
70
|
const SheetHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
|
|
68
|
-
<div className={cn("flex flex-col space-y-2 text-center sm:text-
|
|
71
|
+
<div className={cn("flex flex-col space-y-2 text-center sm:text-start", className)} {...props} />
|
|
69
72
|
);
|
|
70
73
|
SheetHeader.displayName = "SheetHeader";
|
|
71
74
|
|
package/src/index.ts
CHANGED
|
@@ -24,6 +24,10 @@ export {
|
|
|
24
24
|
AlertDialogCancel,
|
|
25
25
|
} from "./components/alert-dialog";
|
|
26
26
|
export { AspectRatio } from "./components/aspect-ratio";
|
|
27
|
+
export {
|
|
28
|
+
KinetixDirectionProvider,
|
|
29
|
+
type KinetixDirectionProviderProps,
|
|
30
|
+
} from "./components/direction-provider";
|
|
27
31
|
export { Avatar, AvatarImage, AvatarFallback, AvatarGroup, type AvatarGroupProps } from "./components/avatar";
|
|
28
32
|
export { Badge, badgeVariants, type BadgeProps } from "./components/badge";
|
|
29
33
|
export {
|