@codefast/ui 0.3.16-canary.1 → 0.3.16-canary.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/CHANGELOG.md +30 -0
- package/README.md +1 -1
- package/dist/components/accordion.mjs +2 -2
- package/dist/components/alert-dialog.d.mts +1 -1
- package/dist/components/alert-dialog.mjs +4 -4
- package/dist/components/alert.d.mts +3 -13
- package/dist/components/alert.mjs +3 -23
- package/dist/components/badge.d.mts +3 -15
- package/dist/components/badge.mjs +2 -44
- package/dist/components/breadcrumb.mjs +1 -1
- package/dist/components/button-group.d.mts +3 -13
- package/dist/components/button-group.mjs +3 -24
- package/dist/components/button.d.mts +3 -25
- package/dist/components/button.mjs +2 -72
- package/dist/components/calendar.mjs +2 -1
- package/dist/components/carousel.d.mts +1 -2
- package/dist/components/chart.d.mts +2 -4
- package/dist/components/checkbox.mjs +2 -2
- package/dist/components/context-menu.mjs +2 -2
- package/dist/components/dialog.d.mts +1 -1
- package/dist/components/dialog.mjs +4 -4
- package/dist/components/drawer.d.mts +1 -1
- package/dist/components/drawer.mjs +2 -2
- package/dist/components/dropdown-menu.mjs +2 -2
- package/dist/components/empty.d.mts +3 -13
- package/dist/components/empty.mjs +3 -18
- package/dist/components/field.d.mts +3 -14
- package/dist/components/field.mjs +3 -32
- package/dist/components/form.d.mts +2 -4
- package/dist/components/hover-card.mjs +1 -1
- package/dist/components/input-group.d.mts +4 -31
- package/dist/components/input-group.mjs +3 -90
- package/dist/components/input-number.mjs +4 -4
- package/dist/components/input-otp.mjs +2 -2
- package/dist/components/input.mjs +1 -1
- package/dist/components/item.d.mts +4 -29
- package/dist/components/item.mjs +3 -56
- package/dist/components/menubar.mjs +2 -2
- package/dist/components/native-select.mjs +1 -1
- package/dist/components/navigation-menu.d.mts +1 -6
- package/dist/components/navigation-menu.mjs +8 -15
- package/dist/components/pagination.d.mts +1 -1
- package/dist/components/pagination.mjs +1 -1
- package/dist/components/popover.mjs +1 -1
- package/dist/components/progress-circle.d.mts +3 -47
- package/dist/components/progress-circle.mjs +2 -47
- package/dist/components/progress.mjs +1 -1
- package/dist/components/radio-group.mjs +1 -1
- package/dist/components/radio.mjs +1 -1
- package/dist/components/scroll-area.d.mts +3 -19
- package/dist/components/scroll-area.mjs +4 -61
- package/dist/components/select.d.mts +1 -1
- package/dist/components/select.mjs +3 -3
- package/dist/components/separator.d.mts +3 -18
- package/dist/components/separator.mjs +3 -23
- package/dist/components/sheet.d.mts +6 -18
- package/dist/components/sheet.mjs +6 -49
- package/dist/components/sidebar.d.mts +4 -19
- package/dist/components/sidebar.mjs +10 -46
- package/dist/components/skeleton.mjs +1 -1
- package/dist/components/slider.mjs +1 -1
- package/dist/components/spinner.mjs +1 -1
- package/dist/components/switch.mjs +2 -2
- package/dist/components/table.mjs +1 -1
- package/dist/components/tabs.mjs +1 -1
- package/dist/components/textarea.mjs +1 -1
- package/dist/components/toggle-group.d.mts +3 -2
- package/dist/components/toggle-group.mjs +1 -1
- package/dist/components/toggle.d.mts +2 -21
- package/dist/components/toggle.mjs +2 -39
- package/dist/components/tooltip.mjs +1 -1
- package/dist/index.d.mts +31 -16
- package/dist/index.mjs +30 -15
- package/dist/lib/utils.d.mts +1 -12
- package/dist/lib/utils.mjs +1 -9
- package/dist/primitives/checkbox-group.d.mts +1 -2
- package/dist/primitives/input-number.d.mts +1 -2
- package/dist/primitives/input.d.mts +1 -2
- package/dist/primitives/progress-circle.d.mts +1 -2
- package/dist/variants/alert.d.mts +18 -0
- package/dist/variants/alert.mjs +25 -0
- package/dist/variants/badge.d.mts +20 -0
- package/dist/variants/badge.mjs +46 -0
- package/dist/variants/button-group.d.mts +18 -0
- package/dist/variants/button-group.mjs +26 -0
- package/dist/variants/button.d.mts +30 -0
- package/dist/variants/button.mjs +76 -0
- package/dist/variants/empty.d.mts +18 -0
- package/dist/variants/empty.mjs +20 -0
- package/dist/variants/field.d.mts +19 -0
- package/dist/variants/field.mjs +34 -0
- package/dist/variants/input-group.d.mts +43 -0
- package/dist/variants/input-group.mjs +93 -0
- package/dist/variants/item.d.mts +37 -0
- package/dist/variants/item.mjs +60 -0
- package/dist/variants/navigation-menu.d.mts +13 -0
- package/dist/variants/navigation-menu.mjs +12 -0
- package/dist/variants/progress-circle.d.mts +52 -0
- package/dist/variants/progress-circle.mjs +49 -0
- package/dist/variants/scroll-area.d.mts +24 -0
- package/dist/variants/scroll-area.mjs +63 -0
- package/dist/variants/separator.d.mts +23 -0
- package/dist/variants/separator.mjs +25 -0
- package/dist/variants/sheet.d.mts +20 -0
- package/dist/variants/sheet.mjs +50 -0
- package/dist/variants/sidebar.d.mts +23 -0
- package/dist/variants/sidebar.mjs +42 -0
- package/dist/variants/toggle.d.mts +23 -0
- package/dist/variants/toggle.mjs +43 -0
- package/package.json +169 -21
- package/src/components/accordion.tsx +156 -0
- package/src/components/alert-dialog.tsx +314 -0
- package/src/components/alert.tsx +86 -0
- package/src/components/aspect-ratio.tsx +28 -0
- package/src/components/avatar.tsx +84 -0
- package/src/components/badge.tsx +38 -0
- package/src/components/breadcrumb.tsx +197 -0
- package/src/components/button-group.tsx +107 -0
- package/src/components/button.tsx +66 -0
- package/src/components/calendar.tsx +277 -0
- package/src/components/card.tsx +175 -0
- package/src/components/carousel.tsx +367 -0
- package/src/components/chart.tsx +587 -0
- package/src/components/checkbox-cards.tsx +92 -0
- package/src/components/checkbox-group.tsx +83 -0
- package/src/components/checkbox.tsx +65 -0
- package/src/components/collapsible.tsx +60 -0
- package/src/components/command.tsx +311 -0
- package/src/components/context-menu.tsx +489 -0
- package/src/components/dialog.tsx +295 -0
- package/src/components/drawer.tsx +271 -0
- package/src/components/dropdown-menu.tsx +498 -0
- package/src/components/empty.tsx +169 -0
- package/src/components/field.tsx +362 -0
- package/src/components/form.tsx +300 -0
- package/src/components/hover-card.tsx +116 -0
- package/src/components/input-group.tsx +224 -0
- package/src/components/input-number.tsx +161 -0
- package/src/components/input-otp.tsx +151 -0
- package/src/components/input-password.tsx +74 -0
- package/src/components/input-search.tsx +98 -0
- package/src/components/input.tsx +52 -0
- package/src/components/item.tsx +280 -0
- package/src/components/kbd.tsx +59 -0
- package/src/components/label.tsx +44 -0
- package/src/components/menubar.tsx +531 -0
- package/src/components/native-select.tsx +96 -0
- package/src/components/navigation-menu.tsx +295 -0
- package/src/components/pagination.tsx +204 -0
- package/src/components/popover.tsx +139 -0
- package/src/components/progress-circle.tsx +203 -0
- package/src/components/progress.tsx +54 -0
- package/src/components/radio-cards.tsx +85 -0
- package/src/components/radio-group.tsx +79 -0
- package/src/components/radio.tsx +61 -0
- package/src/components/resizable.tsx +99 -0
- package/src/components/scroll-area.tsx +115 -0
- package/src/components/select.tsx +319 -0
- package/src/components/separator.tsx +74 -0
- package/src/components/sheet.tsx +278 -0
- package/src/components/sidebar.tsx +1056 -0
- package/src/components/skeleton.tsx +37 -0
- package/src/components/slider.tsx +95 -0
- package/src/components/sonner.tsx +47 -0
- package/src/components/spinner.tsx +75 -0
- package/src/components/switch.tsx +66 -0
- package/src/components/table.tsx +200 -0
- package/src/components/tabs.tsx +128 -0
- package/src/components/textarea.tsx +49 -0
- package/src/components/toggle-group.tsx +141 -0
- package/src/components/toggle.tsx +39 -0
- package/src/components/tooltip.tsx +141 -0
- package/src/css/amber.css +59 -22
- package/src/css/blue.css +59 -22
- package/src/css/cyan.css +59 -22
- package/src/css/emerald.css +59 -22
- package/src/css/fuchsia.css +59 -22
- package/src/css/gray.css +59 -22
- package/src/css/green.css +59 -22
- package/src/css/indigo.css +59 -22
- package/src/css/lime.css +59 -22
- package/src/css/neutral.css +59 -22
- package/src/css/orange.css +59 -22
- package/src/css/pink.css +59 -22
- package/src/css/preset.css +32 -13
- package/src/css/purple.css +59 -22
- package/src/css/red.css +59 -22
- package/src/css/rose.css +59 -22
- package/src/css/sky.css +59 -22
- package/src/css/slate.css +59 -22
- package/src/css/stone.css +59 -22
- package/src/css/teal.css +59 -22
- package/src/css/violet.css +59 -22
- package/src/css/yellow.css +59 -22
- package/src/css/zinc.css +59 -22
- package/src/hooks/use-animated-value.ts +97 -0
- package/src/hooks/use-copy-to-clipboard.ts +63 -0
- package/src/hooks/use-is-mobile.ts +27 -0
- package/src/hooks/use-media-query.ts +71 -0
- package/src/hooks/use-mutation-observer.ts +54 -0
- package/src/hooks/use-pagination.ts +166 -0
- package/src/index.ts +720 -0
- package/src/lib/utils.ts +5 -0
- package/src/primitives/checkbox-group.tsx +360 -0
- package/src/primitives/input-number.tsx +1013 -0
- package/src/primitives/input.tsx +243 -0
- package/src/primitives/progress-circle.tsx +537 -0
- package/src/variants/alert.ts +45 -0
- package/src/variants/badge.ts +66 -0
- package/src/variants/button-group.ts +49 -0
- package/src/variants/button.ts +93 -0
- package/src/variants/empty.ts +43 -0
- package/src/variants/field.ts +50 -0
- package/src/variants/input-group.ts +132 -0
- package/src/variants/item.ts +90 -0
- package/src/variants/navigation-menu.ts +32 -0
- package/src/variants/progress-circle.ts +47 -0
- package/src/variants/scroll-area.ts +79 -0
- package/src/variants/separator.ts +41 -0
- package/src/variants/sheet.ts +70 -0
- package/src/variants/sidebar.ts +61 -0
- package/src/variants/toggle.ts +59 -0
- package/dist/node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/clsx.d.mts +0 -6
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { cn } from "#/lib/utils";
|
|
4
|
+
import type { ComponentProps, JSX, MouseEventHandler } from "react";
|
|
5
|
+
|
|
6
|
+
import { EyeIcon, EyeOffIcon } from "lucide-react";
|
|
7
|
+
import { useCallback, useState } from "react";
|
|
8
|
+
|
|
9
|
+
import { InputGroup, InputGroupButton, InputGroupInput } from "#/components/input-group";
|
|
10
|
+
|
|
11
|
+
/* -----------------------------------------------------------------------------
|
|
12
|
+
* Component: InputPassword
|
|
13
|
+
* -------------------------------------------------------------------------- */
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @since 0.3.16-canary.0
|
|
17
|
+
*/
|
|
18
|
+
type InputPasswordProps = Omit<ComponentProps<typeof InputGroupInput>, "type">;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @since 0.3.16-canary.0
|
|
22
|
+
*/
|
|
23
|
+
function InputPassword({
|
|
24
|
+
className,
|
|
25
|
+
disabled,
|
|
26
|
+
readOnly,
|
|
27
|
+
...props
|
|
28
|
+
}: InputPasswordProps): JSX.Element {
|
|
29
|
+
const [type, setType] = useState<"password" | "text">("password");
|
|
30
|
+
|
|
31
|
+
const togglePasswordVisibility = useCallback<MouseEventHandler<HTMLButtonElement>>(() => {
|
|
32
|
+
setType((previous) => (previous === "password" ? "text" : "password"));
|
|
33
|
+
}, []);
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<InputGroup
|
|
37
|
+
className={className}
|
|
38
|
+
data-disabled={disabled ? "true" : undefined}
|
|
39
|
+
data-slot="input-password"
|
|
40
|
+
>
|
|
41
|
+
<InputGroupInput
|
|
42
|
+
autoCapitalize="none"
|
|
43
|
+
data-slot="input-password-item"
|
|
44
|
+
disabled={disabled}
|
|
45
|
+
readOnly={readOnly}
|
|
46
|
+
type={type}
|
|
47
|
+
{...props}
|
|
48
|
+
/>
|
|
49
|
+
<InputGroupButton
|
|
50
|
+
aria-label={type === "password" ? "Show password" : "Hide password"}
|
|
51
|
+
className={cn(
|
|
52
|
+
"rounded-full",
|
|
53
|
+
"focus-visible:ring-0",
|
|
54
|
+
"focus-visible:not-disabled:bg-input",
|
|
55
|
+
)}
|
|
56
|
+
data-slot="input-password-toggle"
|
|
57
|
+
disabled={disabled}
|
|
58
|
+
size="icon-sm"
|
|
59
|
+
type="button"
|
|
60
|
+
variant="ghost"
|
|
61
|
+
onClick={togglePasswordVisibility}
|
|
62
|
+
>
|
|
63
|
+
{type === "password" ? <EyeOffIcon /> : <EyeIcon />}
|
|
64
|
+
</InputGroupButton>
|
|
65
|
+
</InputGroup>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/* -----------------------------------------------------------------------------
|
|
70
|
+
* Exports
|
|
71
|
+
* -------------------------------------------------------------------------- */
|
|
72
|
+
|
|
73
|
+
export { InputPassword };
|
|
74
|
+
export type { InputPasswordProps };
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { cn } from "#/lib/utils";
|
|
4
|
+
import type { ComponentProps, JSX } from "react";
|
|
5
|
+
|
|
6
|
+
import { useControllableState } from "@radix-ui/react-use-controllable-state";
|
|
7
|
+
import { SearchIcon, XIcon } from "lucide-react";
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
InputGroup,
|
|
11
|
+
InputGroupAddon,
|
|
12
|
+
InputGroupButton,
|
|
13
|
+
InputGroupInput,
|
|
14
|
+
} from "#/components/input-group";
|
|
15
|
+
|
|
16
|
+
/* -----------------------------------------------------------------------------
|
|
17
|
+
* Component: InputSearch
|
|
18
|
+
* -------------------------------------------------------------------------- */
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @since 0.3.16-canary.0
|
|
22
|
+
*/
|
|
23
|
+
interface InputSearchProps extends Omit<
|
|
24
|
+
ComponentProps<typeof InputGroupInput>,
|
|
25
|
+
"defaultValue" | "onChange" | "type" | "value"
|
|
26
|
+
> {
|
|
27
|
+
defaultValue?: string;
|
|
28
|
+
onChange?: (value?: string) => void;
|
|
29
|
+
value?: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @since 0.3.16-canary.0
|
|
34
|
+
*/
|
|
35
|
+
function InputSearch({
|
|
36
|
+
className,
|
|
37
|
+
defaultValue,
|
|
38
|
+
disabled,
|
|
39
|
+
onChange,
|
|
40
|
+
readOnly,
|
|
41
|
+
value: valueProperty,
|
|
42
|
+
...props
|
|
43
|
+
}: InputSearchProps): JSX.Element {
|
|
44
|
+
const [value, setValue] = useControllableState<string | undefined>({
|
|
45
|
+
defaultProp: defaultValue,
|
|
46
|
+
onChange,
|
|
47
|
+
prop: valueProperty,
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<InputGroup
|
|
52
|
+
className={className}
|
|
53
|
+
data-disabled={disabled ? "true" : undefined}
|
|
54
|
+
data-slot="input-search"
|
|
55
|
+
>
|
|
56
|
+
<InputGroupAddon align="inline-start">
|
|
57
|
+
<SearchIcon />
|
|
58
|
+
</InputGroupAddon>
|
|
59
|
+
<InputGroupInput
|
|
60
|
+
data-slot="input-search-item"
|
|
61
|
+
disabled={disabled}
|
|
62
|
+
readOnly={readOnly}
|
|
63
|
+
type="search"
|
|
64
|
+
value={value ?? ""}
|
|
65
|
+
onChange={(event) => {
|
|
66
|
+
setValue(event.target.value);
|
|
67
|
+
}}
|
|
68
|
+
{...props}
|
|
69
|
+
/>
|
|
70
|
+
{value ? (
|
|
71
|
+
<InputGroupButton
|
|
72
|
+
aria-label="Clear search"
|
|
73
|
+
className={cn(
|
|
74
|
+
"rounded-full",
|
|
75
|
+
"focus-visible:ring-0",
|
|
76
|
+
"focus-visible:not-disabled:bg-input",
|
|
77
|
+
)}
|
|
78
|
+
data-slot="input-search-clear"
|
|
79
|
+
disabled={disabled ?? readOnly}
|
|
80
|
+
size="icon-sm"
|
|
81
|
+
variant="ghost"
|
|
82
|
+
onClick={() => {
|
|
83
|
+
setValue("");
|
|
84
|
+
}}
|
|
85
|
+
>
|
|
86
|
+
<XIcon />
|
|
87
|
+
</InputGroupButton>
|
|
88
|
+
) : null}
|
|
89
|
+
</InputGroup>
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/* -----------------------------------------------------------------------------
|
|
94
|
+
* Exports
|
|
95
|
+
* -------------------------------------------------------------------------- */
|
|
96
|
+
|
|
97
|
+
export { InputSearch };
|
|
98
|
+
export type { InputSearchProps };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import type { ComponentProps, JSX } from "react";
|
|
4
|
+
|
|
5
|
+
import { cn } from "#/lib/utils";
|
|
6
|
+
|
|
7
|
+
/* -----------------------------------------------------------------------------
|
|
8
|
+
* Component: Input
|
|
9
|
+
* -------------------------------------------------------------------------- */
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @since 0.3.16-canary.0
|
|
13
|
+
*/
|
|
14
|
+
type InputProps = ComponentProps<"input">;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @since 0.3.16-canary.0
|
|
18
|
+
*/
|
|
19
|
+
function Input({ className, type, ...props }: InputProps): JSX.Element {
|
|
20
|
+
return (
|
|
21
|
+
<input
|
|
22
|
+
className={cn(
|
|
23
|
+
"h-9 w-full min-w-0 px-3 py-1",
|
|
24
|
+
"rounded-lg border border-input",
|
|
25
|
+
"bg-transparent shadow-xs outline-none",
|
|
26
|
+
"text-base",
|
|
27
|
+
"transition-[color,box-shadow] duration-150 ease-snappy",
|
|
28
|
+
"motion-reduce:transition-none motion-reduce:duration-0",
|
|
29
|
+
"selection:bg-primary selection:text-primary-foreground",
|
|
30
|
+
"file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground",
|
|
31
|
+
"placeholder:text-muted-foreground",
|
|
32
|
+
"disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",
|
|
33
|
+
"md:text-sm",
|
|
34
|
+
"dark:bg-input/30",
|
|
35
|
+
"focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50",
|
|
36
|
+
"aria-invalid:border-destructive aria-invalid:ring-destructive/20",
|
|
37
|
+
"dark:aria-invalid:ring-destructive/40",
|
|
38
|
+
className,
|
|
39
|
+
)}
|
|
40
|
+
data-slot="input"
|
|
41
|
+
type={type}
|
|
42
|
+
{...props}
|
|
43
|
+
/>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/* -----------------------------------------------------------------------------
|
|
48
|
+
* Exports
|
|
49
|
+
* -------------------------------------------------------------------------- */
|
|
50
|
+
|
|
51
|
+
export { Input };
|
|
52
|
+
export type { InputProps };
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
import type { ItemMediaVariants, ItemVariants } from "#/variants/item";
|
|
2
|
+
import type { ComponentProps, JSX } from "react";
|
|
3
|
+
|
|
4
|
+
import { cn } from "#/lib/utils";
|
|
5
|
+
|
|
6
|
+
import { itemMediaVariants, itemVariants } from "#/variants/item";
|
|
7
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
8
|
+
|
|
9
|
+
import { Separator } from "#/components/separator";
|
|
10
|
+
|
|
11
|
+
/* -----------------------------------------------------------------------------
|
|
12
|
+
* Component: ItemGroup
|
|
13
|
+
* -------------------------------------------------------------------------- */
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @since 0.3.16-canary.0
|
|
17
|
+
*/
|
|
18
|
+
type ItemGroupProps = ComponentProps<"div">;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @since 0.3.16-canary.0
|
|
22
|
+
*/
|
|
23
|
+
function ItemGroup({ className, ...props }: ItemGroupProps): JSX.Element {
|
|
24
|
+
return (
|
|
25
|
+
<div
|
|
26
|
+
className={cn("group/item-group flex flex-col", className)}
|
|
27
|
+
data-slot="item-group"
|
|
28
|
+
role="list"
|
|
29
|
+
{...props}
|
|
30
|
+
/>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/* -----------------------------------------------------------------------------
|
|
35
|
+
* Component: ItemSeparator
|
|
36
|
+
* -------------------------------------------------------------------------- */
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @since 0.3.16-canary.0
|
|
40
|
+
*/
|
|
41
|
+
type ItemSeparatorProps = ComponentProps<typeof Separator>;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @since 0.3.16-canary.0
|
|
45
|
+
*/
|
|
46
|
+
function ItemSeparator({ className, ...props }: ItemSeparatorProps): JSX.Element {
|
|
47
|
+
return (
|
|
48
|
+
<Separator
|
|
49
|
+
className={cn("my-0", className)}
|
|
50
|
+
data-slot="item-separator"
|
|
51
|
+
orientation="horizontal"
|
|
52
|
+
{...props}
|
|
53
|
+
/>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/* -----------------------------------------------------------------------------
|
|
58
|
+
* Component: Item
|
|
59
|
+
* -------------------------------------------------------------------------- */
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* @since 0.3.16-canary.0
|
|
63
|
+
*/
|
|
64
|
+
type ItemProps = ComponentProps<"div"> &
|
|
65
|
+
ItemVariants & {
|
|
66
|
+
asChild?: boolean;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* @since 0.3.16-canary.0
|
|
71
|
+
*/
|
|
72
|
+
function Item({
|
|
73
|
+
asChild = false,
|
|
74
|
+
className,
|
|
75
|
+
size = "default",
|
|
76
|
+
variant = "default",
|
|
77
|
+
...props
|
|
78
|
+
}: ItemProps): JSX.Element {
|
|
79
|
+
const Component = asChild ? Slot : "div";
|
|
80
|
+
|
|
81
|
+
return (
|
|
82
|
+
<Component
|
|
83
|
+
className={itemVariants({ className, size, variant })}
|
|
84
|
+
data-size={size}
|
|
85
|
+
data-slot="item"
|
|
86
|
+
data-variant={variant}
|
|
87
|
+
{...props}
|
|
88
|
+
/>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/* -----------------------------------------------------------------------------
|
|
93
|
+
* Component: ItemMedia
|
|
94
|
+
* -------------------------------------------------------------------------- */
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* @since 0.3.16-canary.0
|
|
98
|
+
*/
|
|
99
|
+
type ItemMediaProps = ComponentProps<"div"> & ItemMediaVariants;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* @since 0.3.16-canary.0
|
|
103
|
+
*/
|
|
104
|
+
function ItemMedia({ className, variant = "default", ...props }: ItemMediaProps): JSX.Element {
|
|
105
|
+
return (
|
|
106
|
+
<div
|
|
107
|
+
className={itemMediaVariants({ className, variant })}
|
|
108
|
+
data-slot="item-media"
|
|
109
|
+
data-variant={variant}
|
|
110
|
+
{...props}
|
|
111
|
+
/>
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/* -----------------------------------------------------------------------------
|
|
116
|
+
* Component: ItemContent
|
|
117
|
+
* -------------------------------------------------------------------------- */
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* @since 0.3.16-canary.0
|
|
121
|
+
*/
|
|
122
|
+
type ItemContentProps = ComponentProps<"div">;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* @since 0.3.16-canary.0
|
|
126
|
+
*/
|
|
127
|
+
function ItemContent({ className, ...props }: ItemContentProps): JSX.Element {
|
|
128
|
+
return (
|
|
129
|
+
<div
|
|
130
|
+
className={cn(
|
|
131
|
+
"flex flex-1 flex-col gap-1",
|
|
132
|
+
"[&+[data-slot=item-content]]:flex-none",
|
|
133
|
+
className,
|
|
134
|
+
)}
|
|
135
|
+
data-slot="item-content"
|
|
136
|
+
{...props}
|
|
137
|
+
/>
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/* -----------------------------------------------------------------------------
|
|
142
|
+
* Component: ItemTitle
|
|
143
|
+
* -------------------------------------------------------------------------- */
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* @since 0.3.16-canary.0
|
|
147
|
+
*/
|
|
148
|
+
type ItemTitleProps = ComponentProps<"div">;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* @since 0.3.16-canary.0
|
|
152
|
+
*/
|
|
153
|
+
function ItemTitle({ className, ...props }: ItemTitleProps): JSX.Element {
|
|
154
|
+
return (
|
|
155
|
+
<div
|
|
156
|
+
className={cn("flex w-fit items-center gap-2", "text-sm leading-snug font-medium", className)}
|
|
157
|
+
data-slot="item-title"
|
|
158
|
+
{...props}
|
|
159
|
+
/>
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/* -----------------------------------------------------------------------------
|
|
164
|
+
* Component: ItemDescription
|
|
165
|
+
* -------------------------------------------------------------------------- */
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* @since 0.3.16-canary.0
|
|
169
|
+
*/
|
|
170
|
+
type ItemDescriptionProps = ComponentProps<"p">;
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* @since 0.3.16-canary.0
|
|
174
|
+
*/
|
|
175
|
+
function ItemDescription({ className, ...props }: ItemDescriptionProps): JSX.Element {
|
|
176
|
+
return (
|
|
177
|
+
<p
|
|
178
|
+
className={cn(
|
|
179
|
+
"line-clamp-2 text-sm leading-normal font-normal text-balance text-muted-foreground",
|
|
180
|
+
"[&>a]:underline [&>a]:underline-offset-4",
|
|
181
|
+
"[&>a:hover]:text-primary",
|
|
182
|
+
className,
|
|
183
|
+
)}
|
|
184
|
+
data-slot="item-description"
|
|
185
|
+
{...props}
|
|
186
|
+
/>
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/* -----------------------------------------------------------------------------
|
|
191
|
+
* Component: ItemActions
|
|
192
|
+
* -------------------------------------------------------------------------- */
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* @since 0.3.16-canary.0
|
|
196
|
+
*/
|
|
197
|
+
type ItemActionsProps = ComponentProps<"div">;
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* @since 0.3.16-canary.0
|
|
201
|
+
*/
|
|
202
|
+
function ItemActions({ className, ...props }: ItemActionsProps): JSX.Element {
|
|
203
|
+
return (
|
|
204
|
+
<div className={cn("flex items-center gap-2", className)} data-slot="item-actions" {...props} />
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/* -----------------------------------------------------------------------------
|
|
209
|
+
* Component: ItemHeader
|
|
210
|
+
* -------------------------------------------------------------------------- */
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* @since 0.3.16-canary.0
|
|
214
|
+
*/
|
|
215
|
+
type ItemHeaderProps = ComponentProps<"div">;
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* @since 0.3.16-canary.0
|
|
219
|
+
*/
|
|
220
|
+
function ItemHeader({ className, ...props }: ItemHeaderProps): JSX.Element {
|
|
221
|
+
return (
|
|
222
|
+
<div
|
|
223
|
+
className={cn("flex basis-full items-center justify-between gap-2", className)}
|
|
224
|
+
data-slot="item-header"
|
|
225
|
+
{...props}
|
|
226
|
+
/>
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/* -----------------------------------------------------------------------------
|
|
231
|
+
* Component: ItemFooter
|
|
232
|
+
* -------------------------------------------------------------------------- */
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* @since 0.3.16-canary.0
|
|
236
|
+
*/
|
|
237
|
+
type ItemFooterProps = ComponentProps<"div">;
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* @since 0.3.16-canary.0
|
|
241
|
+
*/
|
|
242
|
+
function ItemFooter({ className, ...props }: ItemFooterProps): JSX.Element {
|
|
243
|
+
return (
|
|
244
|
+
<div
|
|
245
|
+
className={cn("flex basis-full items-center justify-between gap-2", className)}
|
|
246
|
+
data-slot="item-footer"
|
|
247
|
+
{...props}
|
|
248
|
+
/>
|
|
249
|
+
);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/* -----------------------------------------------------------------------------
|
|
253
|
+
* Exports
|
|
254
|
+
* -------------------------------------------------------------------------- */
|
|
255
|
+
|
|
256
|
+
export {
|
|
257
|
+
Item,
|
|
258
|
+
ItemActions,
|
|
259
|
+
ItemContent,
|
|
260
|
+
ItemDescription,
|
|
261
|
+
ItemFooter,
|
|
262
|
+
ItemGroup,
|
|
263
|
+
ItemHeader,
|
|
264
|
+
ItemMedia,
|
|
265
|
+
ItemSeparator,
|
|
266
|
+
ItemTitle,
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
export type {
|
|
270
|
+
ItemActionsProps,
|
|
271
|
+
ItemContentProps,
|
|
272
|
+
ItemDescriptionProps,
|
|
273
|
+
ItemFooterProps,
|
|
274
|
+
ItemGroupProps,
|
|
275
|
+
ItemHeaderProps,
|
|
276
|
+
ItemMediaProps,
|
|
277
|
+
ItemProps,
|
|
278
|
+
ItemSeparatorProps,
|
|
279
|
+
ItemTitleProps,
|
|
280
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { ComponentProps, JSX } from "react";
|
|
2
|
+
|
|
3
|
+
import { cn } from "#/lib/utils";
|
|
4
|
+
|
|
5
|
+
/* -----------------------------------------------------------------------------
|
|
6
|
+
* Component: Kbd
|
|
7
|
+
* -------------------------------------------------------------------------- */
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @since 0.3.16-canary.0
|
|
11
|
+
*/
|
|
12
|
+
type KbdProps = ComponentProps<"kbd">;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @since 0.3.16-canary.0
|
|
16
|
+
*/
|
|
17
|
+
function Kbd({ className, ...props }: KbdProps): JSX.Element {
|
|
18
|
+
return (
|
|
19
|
+
<kbd
|
|
20
|
+
className={cn(
|
|
21
|
+
"inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 px-1",
|
|
22
|
+
"rounded-md",
|
|
23
|
+
"bg-muted font-sans text-xs font-medium text-muted-foreground",
|
|
24
|
+
"pointer-events-none select-none",
|
|
25
|
+
"in-data-[slot=tooltip-content]:bg-background/20 in-data-[slot=tooltip-content]:text-background",
|
|
26
|
+
"dark:in-data-[slot=tooltip-content]:bg-background/10",
|
|
27
|
+
"[&_svg:not([class*='size-'])]:size-3",
|
|
28
|
+
className,
|
|
29
|
+
)}
|
|
30
|
+
data-slot="kbd"
|
|
31
|
+
{...props}
|
|
32
|
+
/>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @since 0.3.16-canary.0
|
|
38
|
+
*/
|
|
39
|
+
type KbdGroupProps = ComponentProps<"kbd">;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @since 0.3.16-canary.0
|
|
43
|
+
*/
|
|
44
|
+
function KbdGroup({ className, ...props }: KbdGroupProps): JSX.Element {
|
|
45
|
+
return (
|
|
46
|
+
<kbd
|
|
47
|
+
className={cn("inline-flex items-center gap-1", className)}
|
|
48
|
+
data-slot="kbd-group"
|
|
49
|
+
{...props}
|
|
50
|
+
/>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/* -----------------------------------------------------------------------------
|
|
55
|
+
* Exports
|
|
56
|
+
* -------------------------------------------------------------------------- */
|
|
57
|
+
|
|
58
|
+
export { Kbd, KbdGroup };
|
|
59
|
+
export type { KbdGroupProps, KbdProps };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import type { ComponentProps, JSX } from "react";
|
|
4
|
+
|
|
5
|
+
import { cn } from "#/lib/utils";
|
|
6
|
+
import * as LabelPrimitive from "@radix-ui/react-label";
|
|
7
|
+
|
|
8
|
+
/* -----------------------------------------------------------------------------
|
|
9
|
+
* Component: Label
|
|
10
|
+
* -------------------------------------------------------------------------- */
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @since 0.3.16-canary.0
|
|
14
|
+
*/
|
|
15
|
+
type LabelProps = ComponentProps<typeof LabelPrimitive.Root>;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @since 0.3.16-canary.0
|
|
19
|
+
*/
|
|
20
|
+
function Label({ className, ...props }: LabelProps): JSX.Element {
|
|
21
|
+
return (
|
|
22
|
+
<LabelPrimitive.Root
|
|
23
|
+
className={cn(
|
|
24
|
+
"inline-block",
|
|
25
|
+
"text-sm leading-none font-medium",
|
|
26
|
+
"group-data-disabled:opacity-50",
|
|
27
|
+
"peer-disabled:opacity-50",
|
|
28
|
+
"peer-aria-invalid:text-destructive",
|
|
29
|
+
"peer-data-disabled:opacity-50",
|
|
30
|
+
"data-invalid:text-destructive",
|
|
31
|
+
className,
|
|
32
|
+
)}
|
|
33
|
+
data-slot="label"
|
|
34
|
+
{...props}
|
|
35
|
+
/>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/* -----------------------------------------------------------------------------
|
|
40
|
+
* Exports
|
|
41
|
+
* -------------------------------------------------------------------------- */
|
|
42
|
+
|
|
43
|
+
export { Label };
|
|
44
|
+
export type { LabelProps };
|