@silicajs/ui 0.1.1 → 0.1.3
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 +5 -5
- package/postcss.config.mjs +1 -1
- package/src/components/avatar.tsx +109 -0
- package/src/components/badge.tsx +9 -9
- package/src/components/breadcrumb.tsx +18 -21
- package/src/components/button.tsx +7 -7
- package/src/components/card.tsx +15 -15
- package/src/components/collapsible.tsx +6 -6
- package/src/components/command.tsx +47 -49
- package/src/components/dialog.tsx +24 -25
- package/src/components/dropdown-menu.tsx +47 -43
- package/src/components/input-group.tsx +25 -25
- package/src/components/input.tsx +6 -6
- package/src/components/scroll-area.tsx +8 -8
- package/src/components/separator.tsx +6 -6
- package/src/components/sheet.tsx +22 -23
- package/src/components/sidebar.tsx +124 -124
- package/src/components/skeleton.tsx +3 -3
- package/src/components/textarea.tsx +5 -5
- package/src/components/toc-list.tsx +5 -2
- package/src/components/tooltip.tsx +9 -9
- package/src/hooks/use-mobile.ts +13 -11
- package/src/lib/utils.ts +3 -3
- package/src/styles/globals.css +100 -2
|
@@ -18,7 +18,10 @@ export type TocListProps = {
|
|
|
18
18
|
export function TocList({ items, activeId, className }: TocListProps) {
|
|
19
19
|
if (items.length === 0) return null;
|
|
20
20
|
return (
|
|
21
|
-
<ol
|
|
21
|
+
<ol
|
|
22
|
+
data-slot="toc-list"
|
|
23
|
+
className={cn("flex flex-col gap-1 text-sm", className)}
|
|
24
|
+
>
|
|
22
25
|
{items.map((item) => {
|
|
23
26
|
const isActive = activeId === item.id;
|
|
24
27
|
return (
|
|
@@ -32,7 +35,7 @@ export function TocList({ items, activeId, className }: TocListProps) {
|
|
|
32
35
|
"block rounded-md px-2 py-1 transition-colors",
|
|
33
36
|
isActive
|
|
34
37
|
? "font-medium text-primary"
|
|
35
|
-
: "text-muted-foreground hover:text-foreground"
|
|
38
|
+
: "text-muted-foreground hover:text-foreground",
|
|
36
39
|
)}
|
|
37
40
|
>
|
|
38
41
|
{item.label}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use client"
|
|
1
|
+
"use client";
|
|
2
2
|
|
|
3
|
-
import { Tooltip as TooltipPrimitive } from "@base-ui/react/tooltip"
|
|
3
|
+
import { Tooltip as TooltipPrimitive } from "@base-ui/react/tooltip";
|
|
4
4
|
|
|
5
|
-
import { cn } from "@silicajs/ui/lib/utils"
|
|
5
|
+
import { cn } from "@silicajs/ui/lib/utils";
|
|
6
6
|
|
|
7
7
|
function TooltipProvider({
|
|
8
8
|
delay = 0,
|
|
@@ -14,15 +14,15 @@ function TooltipProvider({
|
|
|
14
14
|
delay={delay}
|
|
15
15
|
{...props}
|
|
16
16
|
/>
|
|
17
|
-
)
|
|
17
|
+
);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
function Tooltip({ ...props }: TooltipPrimitive.Root.Props) {
|
|
21
|
-
return <TooltipPrimitive.Root data-slot="tooltip" {...props}
|
|
21
|
+
return <TooltipPrimitive.Root data-slot="tooltip" {...props} />;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
function TooltipTrigger({ ...props }: TooltipPrimitive.Trigger.Props) {
|
|
25
|
-
return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props}
|
|
25
|
+
return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
function TooltipContent({
|
|
@@ -51,7 +51,7 @@ function TooltipContent({
|
|
|
51
51
|
data-slot="tooltip-content"
|
|
52
52
|
className={cn(
|
|
53
53
|
"z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
|
|
54
|
-
className
|
|
54
|
+
className,
|
|
55
55
|
)}
|
|
56
56
|
{...props}
|
|
57
57
|
>
|
|
@@ -60,7 +60,7 @@ function TooltipContent({
|
|
|
60
60
|
</TooltipPrimitive.Popup>
|
|
61
61
|
</TooltipPrimitive.Positioner>
|
|
62
62
|
</TooltipPrimitive.Portal>
|
|
63
|
-
)
|
|
63
|
+
);
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }
|
|
66
|
+
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
|
package/src/hooks/use-mobile.ts
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
import * as React from "react"
|
|
1
|
+
import * as React from "react";
|
|
2
2
|
|
|
3
|
-
const MOBILE_BREAKPOINT = 768
|
|
3
|
+
const MOBILE_BREAKPOINT = 768;
|
|
4
4
|
|
|
5
5
|
export function useIsMobile() {
|
|
6
|
-
const [isMobile, setIsMobile] = React.useState<boolean | undefined>(
|
|
6
|
+
const [isMobile, setIsMobile] = React.useState<boolean | undefined>(
|
|
7
|
+
undefined,
|
|
8
|
+
);
|
|
7
9
|
|
|
8
10
|
React.useEffect(() => {
|
|
9
|
-
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`)
|
|
11
|
+
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
|
|
10
12
|
const onChange = () => {
|
|
11
|
-
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)
|
|
12
|
-
}
|
|
13
|
-
mql.addEventListener("change", onChange)
|
|
14
|
-
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)
|
|
15
|
-
return () => mql.removeEventListener("change", onChange)
|
|
16
|
-
}, [])
|
|
13
|
+
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
14
|
+
};
|
|
15
|
+
mql.addEventListener("change", onChange);
|
|
16
|
+
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
17
|
+
return () => mql.removeEventListener("change", onChange);
|
|
18
|
+
}, []);
|
|
17
19
|
|
|
18
|
-
return !!isMobile
|
|
20
|
+
return !!isMobile;
|
|
19
21
|
}
|
package/src/lib/utils.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { clsx, type ClassValue } from "clsx"
|
|
2
|
-
import { twMerge } from "tailwind-merge"
|
|
1
|
+
import { clsx, type ClassValue } from "clsx";
|
|
2
|
+
import { twMerge } from "tailwind-merge";
|
|
3
3
|
|
|
4
4
|
export function cn(...inputs: ClassValue[]) {
|
|
5
|
-
return twMerge(clsx(inputs))
|
|
5
|
+
return twMerge(clsx(inputs));
|
|
6
6
|
}
|
package/src/styles/globals.css
CHANGED
|
@@ -1,6 +1,102 @@
|
|
|
1
1
|
@import "tailwindcss";
|
|
2
2
|
@import "tw-animate-css";
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
/* Ejected from shadcn@4.10.0. Re-run shadcn eject when updating shadcn. */
|
|
5
|
+
@theme inline {
|
|
6
|
+
@keyframes accordion-down {
|
|
7
|
+
from {
|
|
8
|
+
height: 0;
|
|
9
|
+
}
|
|
10
|
+
to {
|
|
11
|
+
height: var(
|
|
12
|
+
--radix-accordion-content-height,
|
|
13
|
+
var(--accordion-panel-height, auto)
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@keyframes accordion-up {
|
|
19
|
+
from {
|
|
20
|
+
height: var(
|
|
21
|
+
--radix-accordion-content-height,
|
|
22
|
+
var(--accordion-panel-height, auto)
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
to {
|
|
26
|
+
height: 0;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* Custom variants */
|
|
32
|
+
@custom-variant data-open {
|
|
33
|
+
&:where([data-state="open"]),
|
|
34
|
+
&:where([data-open]:not([data-open="false"])) {
|
|
35
|
+
@slot;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@custom-variant data-closed {
|
|
40
|
+
&:where([data-state="closed"]),
|
|
41
|
+
&:where([data-closed]:not([data-closed="false"])) {
|
|
42
|
+
@slot;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@custom-variant data-checked {
|
|
47
|
+
&:where([data-state="checked"]),
|
|
48
|
+
&:where([data-checked]:not([data-checked="false"])) {
|
|
49
|
+
@slot;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@custom-variant data-unchecked {
|
|
54
|
+
&:where([data-state="unchecked"]),
|
|
55
|
+
&:where([data-unchecked]:not([data-unchecked="false"])) {
|
|
56
|
+
@slot;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@custom-variant data-selected {
|
|
61
|
+
&:where([data-selected="true"]) {
|
|
62
|
+
@slot;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
@custom-variant data-disabled {
|
|
67
|
+
&:where([data-disabled="true"]),
|
|
68
|
+
&:where([data-disabled]:not([data-disabled="false"])) {
|
|
69
|
+
@slot;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@custom-variant data-active {
|
|
74
|
+
&:where([data-state="active"]),
|
|
75
|
+
&:where([data-active]:not([data-active="false"])) {
|
|
76
|
+
@slot;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
@custom-variant data-horizontal {
|
|
81
|
+
&:where([data-orientation="horizontal"]) {
|
|
82
|
+
@slot;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
@custom-variant data-vertical {
|
|
87
|
+
&:where([data-orientation="vertical"]) {
|
|
88
|
+
@slot;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
@utility no-scrollbar {
|
|
93
|
+
-ms-overflow-style: none;
|
|
94
|
+
scrollbar-width: none;
|
|
95
|
+
|
|
96
|
+
&::-webkit-scrollbar {
|
|
97
|
+
display: none;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
4
100
|
|
|
5
101
|
@custom-variant dark (&:is(.dark *));
|
|
6
102
|
@source "../**/*.{ts,tsx}";
|
|
@@ -127,7 +223,9 @@
|
|
|
127
223
|
@apply bg-background text-foreground;
|
|
128
224
|
}
|
|
129
225
|
button:not(:disabled),
|
|
130
|
-
[role="button"]:not([aria-disabled="true"])
|
|
226
|
+
[role="button"]:not([aria-disabled="true"]),
|
|
227
|
+
[role="menuitem"]:not([aria-disabled="true"]),
|
|
228
|
+
[role="option"]:not([aria-disabled="true"]) {
|
|
131
229
|
cursor: pointer;
|
|
132
230
|
}
|
|
133
231
|
}
|