@sniptide/ui 0.4.0 → 0.5.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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sniptide/ui",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"gitHead": "
|
|
3
|
+
"version": "0.5.0",
|
|
4
|
+
"gitHead": "32a2b8c1eca3d578844a1f3718fac6fe33e38f4d",
|
|
5
5
|
"description": "Sniptide's shared React components and Tailwind theme, used by the app and the website.",
|
|
6
6
|
"license": "AGPL-3.0-only",
|
|
7
7
|
"homepage": "https://sniptide.com",
|
|
@@ -2,21 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
import { Checkbox as CheckboxPrimitive } from "@base-ui/react/checkbox"
|
|
4
4
|
import { cn } from "cn"
|
|
5
|
-
import { CheckIcon } from "lucide-react"
|
|
5
|
+
import { CheckIcon, MinusIcon } from "lucide-react"
|
|
6
6
|
|
|
7
7
|
function Checkbox({ className, ...props }: CheckboxPrimitive.Root.Props) {
|
|
8
8
|
return (
|
|
9
9
|
<CheckboxPrimitive.Root
|
|
10
10
|
data-slot="checkbox"
|
|
11
11
|
className={cn(
|
|
12
|
-
"flex size-4 shrink-0 items-center justify-center rounded-sm border border-input bg-background text-primary-foreground outline-none transition-colors focus-visible:ring-3 focus-visible:ring-ring/30 data-checked:border-primary data-checked:bg-primary data-disabled:border-border data-disabled:bg-muted",
|
|
12
|
+
"flex size-4 shrink-0 items-center justify-center rounded-sm border border-input bg-background text-primary-foreground outline-none transition-colors focus-visible:ring-3 focus-visible:ring-ring/30 data-checked:border-primary data-checked:bg-primary data-indeterminate:border-primary data-indeterminate:bg-primary data-disabled:border-border data-disabled:bg-muted",
|
|
13
13
|
className,
|
|
14
14
|
)}
|
|
15
15
|
{...props}
|
|
16
16
|
>
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
{/* A select-all box shows a dash while only some of its rows are checked. */}
|
|
18
|
+
<CheckboxPrimitive.Indicator
|
|
19
|
+
className="flex items-center justify-center"
|
|
20
|
+
render={(indicatorProps, state) => (
|
|
21
|
+
<span {...indicatorProps}>
|
|
22
|
+
{state.indeterminate ? (
|
|
23
|
+
<MinusIcon className="size-3" strokeWidth={3} />
|
|
24
|
+
) : (
|
|
25
|
+
<CheckIcon className="size-3" strokeWidth={3} />
|
|
26
|
+
)}
|
|
27
|
+
</span>
|
|
28
|
+
)}
|
|
29
|
+
/>
|
|
20
30
|
</CheckboxPrimitive.Root>
|
|
21
31
|
)
|
|
22
32
|
}
|
package/src/components/table.tsx
CHANGED
|
@@ -50,7 +50,7 @@ function TableRow({ className, ...props }: React.ComponentProps<"tr">) {
|
|
|
50
50
|
return (
|
|
51
51
|
<tr
|
|
52
52
|
className={cn(
|
|
53
|
-
"group/row border-b border-border/70 transition-colors hover:bg-muted/40",
|
|
53
|
+
"group/row border-b border-border/70 transition-colors hover:bg-muted/40 data-[selected=true]:bg-muted/70",
|
|
54
54
|
className,
|
|
55
55
|
)}
|
|
56
56
|
{...props}
|
|
@@ -74,11 +74,12 @@ function TableCell({ className, ...props }: React.ComponentProps<"td">) {
|
|
|
74
74
|
return <td className={cn("h-16 px-5 align-middle whitespace-nowrap", className)} {...props} />
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
+
// A checked row (`data-selected`) takes a deeper tint than hover, so a selection reads at a glance.
|
|
77
78
|
// The actions column stays at the right edge while the other columns scroll under it. It paints an
|
|
78
79
|
// opaque fill, so the row's hover tint is mixed into it rather than layered on top. A short fade on
|
|
79
80
|
// its left edge shows that more columns sit behind it.
|
|
80
81
|
const pinned =
|
|
81
|
-
"sticky right-0 bg-background before:pointer-events-none before:absolute before:inset-y-0 before:right-full before:w-8 before:bg-linear-to-l before:from-background before:to-transparent before:transition-opacity group-data-[at-end=true]/scroll:before:opacity-0 group-hover/row:bg-[color-mix(in_oklab,var(--background),var(--muted)_40%)] group-hover/row:before:from-[color-mix(in_oklab,var(--background),var(--muted)_40%)]"
|
|
82
|
+
"sticky right-0 bg-background before:pointer-events-none before:absolute before:inset-y-0 before:right-full before:w-8 before:bg-linear-to-l before:from-background before:to-transparent before:transition-opacity group-data-[at-end=true]/scroll:before:opacity-0 group-hover/row:bg-[color-mix(in_oklab,var(--background),var(--muted)_40%)] group-hover/row:before:from-[color-mix(in_oklab,var(--background),var(--muted)_40%)] group-data-[selected=true]/row:bg-[color-mix(in_oklab,var(--background),var(--muted)_70%)] group-data-[selected=true]/row:before:from-[color-mix(in_oklab,var(--background),var(--muted)_70%)]"
|
|
82
83
|
|
|
83
84
|
function TablePinnedHead({ className, ...props }: React.ComponentProps<"th">) {
|
|
84
85
|
return (
|