@codefast/ui 0.3.16-canary.2 → 0.4.0-canary.4
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 +81 -0
- package/README.md +28 -17
- package/dist/components/accordion.d.mts +7 -22
- package/dist/components/accordion.mjs +26 -29
- package/dist/components/alert-dialog.d.mts +27 -26
- package/dist/components/alert-dialog.mjs +53 -45
- package/dist/components/alert.d.mts +14 -14
- package/dist/components/alert.mjs +17 -28
- package/dist/components/aspect-ratio.d.mts +2 -2
- package/dist/components/aspect-ratio.mjs +2 -3
- package/dist/components/avatar.d.mts +41 -5
- package/dist/components/avatar.mjs +40 -10
- package/dist/components/badge.d.mts +3 -15
- package/dist/components/badge.mjs +6 -48
- package/dist/components/breadcrumb.d.mts +1 -0
- package/dist/components/breadcrumb.mjs +11 -10
- package/dist/components/button-group.d.mts +3 -13
- package/dist/components/button-group.mjs +9 -31
- package/dist/components/button.d.mts +3 -26
- package/dist/components/button.mjs +9 -79
- package/dist/components/calendar.d.mts +6 -2
- package/dist/components/calendar.mjs +41 -44
- package/dist/components/card.d.mts +4 -2
- package/dist/components/card.mjs +9 -9
- package/dist/components/carousel.d.mts +16 -5
- package/dist/components/carousel.mjs +24 -11
- package/dist/components/chart.d.mts +9 -6
- package/dist/components/chart.mjs +21 -15
- package/dist/components/checkbox-cards.mjs +4 -4
- package/dist/components/checkbox-group.mjs +3 -4
- package/dist/components/checkbox.d.mts +2 -2
- package/dist/components/checkbox.mjs +6 -7
- package/dist/components/collapsible.d.mts +4 -4
- package/dist/components/collapsible.mjs +4 -5
- package/dist/components/command.d.mts +11 -1
- package/dist/components/command.mjs +35 -32
- package/dist/components/context-menu.d.mts +22 -15
- package/dist/components/context-menu.mjs +44 -39
- package/dist/components/dialog.d.mts +19 -23
- package/dist/components/dialog.mjs +48 -47
- package/dist/components/direction.d.mts +24 -0
- package/dist/components/direction.mjs +18 -0
- package/dist/components/drawer.d.mts +3 -21
- package/dist/components/drawer.mjs +19 -27
- package/dist/components/dropdown-menu.d.mts +22 -15
- package/dist/components/dropdown-menu.mjs +41 -37
- package/dist/components/empty.d.mts +3 -13
- package/dist/components/empty.mjs +8 -23
- package/dist/components/field.d.mts +3 -14
- package/dist/components/field.mjs +14 -44
- package/dist/components/form.d.mts +7 -10
- package/dist/components/form.mjs +6 -7
- package/dist/components/hover-card.d.mts +5 -5
- package/dist/components/hover-card.mjs +14 -12
- package/dist/components/input-group.d.mts +4 -31
- package/dist/components/input-group.mjs +14 -96
- package/dist/components/input-number.d.mts +3 -1
- package/dist/components/input-number.mjs +50 -28
- package/dist/components/input-otp.mjs +9 -7
- package/dist/components/input-password.mjs +1 -4
- package/dist/components/input-search.mjs +3 -5
- package/dist/components/input.mjs +1 -2
- package/dist/components/item.d.mts +4 -29
- package/dist/components/item.mjs +12 -65
- package/dist/components/kbd.mjs +1 -1
- package/dist/components/label.d.mts +2 -2
- package/dist/components/label.mjs +3 -4
- package/dist/components/menubar.d.mts +22 -16
- package/dist/components/menubar.mjs +54 -47
- package/dist/components/native-select.d.mts +5 -1
- package/dist/components/native-select.mjs +9 -6
- package/dist/components/navigation-menu.d.mts +30 -13
- package/dist/components/navigation-menu.mjs +35 -32
- package/dist/components/pagination.d.mts +7 -1
- package/dist/components/pagination.mjs +27 -12
- package/dist/components/popover.d.mts +40 -7
- package/dist/components/popover.mjs +46 -14
- package/dist/components/progress-circle.d.mts +3 -47
- package/dist/components/progress-circle.mjs +2 -48
- package/dist/components/progress.d.mts +2 -2
- package/dist/components/progress.mjs +5 -6
- package/dist/components/radio-cards.d.mts +3 -3
- package/dist/components/radio-cards.mjs +11 -11
- package/dist/components/radio-group.d.mts +3 -3
- package/dist/components/radio-group.mjs +9 -9
- package/dist/components/radio.mjs +2 -3
- package/dist/components/resizable.mjs +3 -8
- package/dist/components/scroll-area.d.mts +8 -24
- package/dist/components/scroll-area.mjs +16 -70
- package/dist/components/select.d.mts +14 -14
- package/dist/components/select.mjs +47 -47
- package/dist/components/separator.d.mts +4 -19
- package/dist/components/separator.mjs +6 -27
- package/dist/components/sheet.d.mts +18 -31
- package/dist/components/sheet.mjs +46 -87
- package/dist/components/sidebar.d.mts +3 -19
- package/dist/components/sidebar.mjs +48 -84
- package/dist/components/skeleton.mjs +1 -1
- package/dist/components/slider.d.mts +2 -2
- package/dist/components/slider.mjs +9 -11
- package/dist/components/sonner.mjs +11 -3
- package/dist/components/spinner.mjs +6 -7
- package/dist/components/switch.d.mts +5 -2
- package/dist/components/switch.mjs +7 -7
- package/dist/components/table.mjs +10 -10
- package/dist/components/tabs.d.mts +8 -5
- package/dist/components/tabs.mjs +18 -12
- package/dist/components/textarea.mjs +1 -1
- package/dist/components/toggle-group.d.mts +11 -7
- package/dist/components/toggle-group.mjs +20 -21
- package/dist/components/toggle.d.mts +4 -24
- package/dist/components/toggle.mjs +6 -45
- package/dist/components/tooltip.d.mts +7 -6
- package/dist/components/tooltip.mjs +19 -17
- package/dist/hooks/use-animated-value.mjs +0 -1
- package/dist/hooks/use-copy-to-clipboard.mjs +0 -1
- package/dist/hooks/use-is-mobile.mjs +0 -1
- package/dist/hooks/use-media-query.mjs +0 -1
- package/dist/hooks/use-mutation-observer.mjs +0 -1
- package/dist/hooks/use-pagination.mjs +0 -1
- package/dist/index.d.mts +38 -21
- package/dist/index.mjs +40 -23
- package/dist/lib/utils.d.mts +1 -12
- package/dist/lib/utils.mjs +1 -9
- package/dist/primitives/checkbox-group.d.mts +9 -11
- package/dist/primitives/checkbox-group.mjs +14 -19
- package/dist/primitives/input-number.d.mts +3 -4
- package/dist/primitives/input-number.mjs +3 -5
- package/dist/primitives/input.d.mts +4 -5
- package/dist/primitives/input.mjs +2 -3
- package/dist/primitives/progress-circle.d.mts +3 -4
- package/dist/primitives/progress-circle.mjs +2 -3
- package/dist/variants/alert.d.mts +18 -0
- package/dist/variants/alert.mjs +15 -0
- package/dist/variants/badge.d.mts +22 -0
- package/dist/variants/badge.mjs +19 -0
- package/dist/variants/button-group.d.mts +18 -0
- package/dist/variants/button-group.mjs +15 -0
- package/dist/variants/button.d.mts +32 -0
- package/dist/variants/button.mjs +34 -0
- package/dist/variants/empty.d.mts +18 -0
- package/dist/variants/empty.mjs +15 -0
- package/dist/variants/field.d.mts +19 -0
- package/dist/variants/field.mjs +16 -0
- package/dist/variants/input-group.d.mts +43 -0
- package/dist/variants/input-group.mjs +34 -0
- package/dist/variants/input-number.d.mts +45 -0
- package/dist/variants/input-number.mjs +40 -0
- package/dist/variants/item.d.mts +38 -0
- package/dist/variants/item.mjs +38 -0
- package/dist/variants/navigation-menu.d.mts +13 -0
- package/dist/variants/navigation-menu.mjs +8 -0
- package/dist/variants/progress-circle.d.mts +52 -0
- package/dist/variants/progress-circle.mjs +45 -0
- package/dist/variants/scroll-area.d.mts +24 -0
- package/dist/variants/scroll-area.mjs +58 -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 +17 -0
- package/dist/variants/sidebar.d.mts +23 -0
- package/dist/variants/sidebar.mjs +25 -0
- package/dist/variants/tabs.d.mts +18 -0
- package/dist/variants/tabs.mjs +15 -0
- package/dist/variants/toggle.d.mts +23 -0
- package/dist/variants/toggle.mjs +25 -0
- package/package.json +186 -55
- package/src/components/accordion.tsx +114 -0
- package/src/components/alert-dialog.tsx +298 -0
- package/src/components/alert.tsx +94 -0
- package/src/components/aspect-ratio.tsx +25 -0
- package/src/components/avatar.tsx +171 -0
- package/src/components/badge.tsx +35 -0
- package/src/components/breadcrumb.tsx +191 -0
- package/src/components/button-group.tsx +97 -0
- package/src/components/button.tsx +55 -0
- package/src/components/calendar.tsx +222 -0
- package/src/components/card.tsx +169 -0
- package/src/components/carousel.tsx +349 -0
- package/src/components/chart.tsx +536 -0
- package/src/components/checkbox-cards.tsx +72 -0
- package/src/components/checkbox-group.tsx +60 -0
- package/src/components/checkbox.tsx +44 -0
- package/src/components/collapsible.tsx +57 -0
- package/src/components/command.tsx +298 -0
- package/src/components/context-menu.tsx +410 -0
- package/src/components/dialog.tsx +243 -0
- package/src/components/direction.tsx +32 -0
- package/src/components/drawer.tsx +209 -0
- package/src/components/dropdown-menu.tsx +419 -0
- package/src/components/empty.tsx +155 -0
- package/src/components/field.tsx +329 -0
- package/src/components/form.tsx +258 -0
- package/src/components/hover-card.tsx +93 -0
- package/src/components/input-group.tsx +185 -0
- package/src/components/input-number.tsx +141 -0
- package/src/components/input-otp.tsx +132 -0
- package/src/components/input-password.tsx +50 -0
- package/src/components/input-search.tsx +81 -0
- package/src/components/input.tsx +36 -0
- package/src/components/item.tsx +266 -0
- package/src/components/kbd.tsx +47 -0
- package/src/components/label.tsx +36 -0
- package/src/components/menubar.tsx +440 -0
- package/src/components/native-select.tsx +87 -0
- package/src/components/navigation-menu.tsx +235 -0
- package/src/components/pagination.tsx +198 -0
- package/src/components/popover.tsx +170 -0
- package/src/components/progress-circle.tsx +185 -0
- package/src/components/progress.tsx +41 -0
- package/src/components/radio-cards.tsx +66 -0
- package/src/components/radio-group.tsx +59 -0
- package/src/components/radio.tsx +40 -0
- package/src/components/resizable.tsx +78 -0
- package/src/components/scroll-area.tsx +95 -0
- package/src/components/select.tsx +296 -0
- package/src/components/separator.tsx +60 -0
- package/src/components/sheet.tsx +241 -0
- package/src/components/sidebar.tsx +926 -0
- package/src/components/skeleton.tsx +35 -0
- package/src/components/slider.tsx +66 -0
- package/src/components/sonner.tsx +57 -0
- package/src/components/spinner.tsx +66 -0
- package/src/components/switch.tsx +44 -0
- package/src/components/table.tsx +183 -0
- package/src/components/tabs.tsx +110 -0
- package/src/components/textarea.tsx +35 -0
- package/src/components/toggle-group.tsx +137 -0
- package/src/components/toggle.tsx +30 -0
- package/src/components/tooltip.tsx +115 -0
- package/src/css/foundation/base.css +50 -0
- package/src/css/foundation/motion.css +36 -0
- package/src/css/foundation/source.css +3 -0
- package/src/css/foundation/tokens.css +71 -0
- package/src/css/foundation/variants.css +113 -0
- package/src/css/preset.css +5 -195
- package/src/css/style.css +1 -1
- package/src/css/{amber.css → themes/amber.css} +59 -22
- package/src/css/{blue.css → themes/blue.css} +59 -22
- package/src/css/{cyan.css → themes/cyan.css} +59 -22
- package/src/css/{emerald.css → themes/emerald.css} +59 -22
- package/src/css/{fuchsia.css → themes/fuchsia.css} +59 -22
- package/src/css/{gray.css → themes/gray.css} +59 -22
- package/src/css/{green.css → themes/green.css} +59 -22
- package/src/css/{indigo.css → themes/indigo.css} +59 -22
- package/src/css/{lime.css → themes/lime.css} +59 -22
- package/src/css/{neutral.css → themes/neutral.css} +59 -22
- package/src/css/{orange.css → themes/orange.css} +59 -22
- package/src/css/{pink.css → themes/pink.css} +59 -22
- package/src/css/{purple.css → themes/purple.css} +59 -22
- package/src/css/{red.css → themes/red.css} +59 -22
- package/src/css/{rose.css → themes/rose.css} +59 -22
- package/src/css/{sky.css → themes/sky.css} +59 -22
- package/src/css/{slate.css → themes/slate.css} +59 -22
- package/src/css/{stone.css → themes/stone.css} +59 -22
- package/src/css/{teal.css → themes/teal.css} +59 -22
- package/src/css/{violet.css → themes/violet.css} +59 -22
- package/src/css/{yellow.css → themes/yellow.css} +59 -22
- package/src/css/{zinc.css → themes/zinc.css} +59 -22
- package/src/hooks/use-animated-value.ts +91 -0
- package/src/hooks/use-copy-to-clipboard.ts +58 -0
- package/src/hooks/use-is-mobile.ts +25 -0
- package/src/hooks/use-media-query.ts +69 -0
- package/src/hooks/use-mutation-observer.ts +51 -0
- package/src/hooks/use-pagination.ts +164 -0
- package/src/index.ts +679 -0
- package/src/lib/utils.ts +5 -0
- package/src/primitives/checkbox-group.tsx +346 -0
- package/src/primitives/input-number.tsx +967 -0
- package/src/primitives/input.tsx +227 -0
- package/src/primitives/progress-circle.tsx +507 -0
- package/src/variants/alert.ts +34 -0
- package/src/variants/badge.ts +39 -0
- package/src/variants/button-group.ts +36 -0
- package/src/variants/button.ts +56 -0
- package/src/variants/empty.ts +34 -0
- package/src/variants/field.ts +37 -0
- package/src/variants/input-group.ts +80 -0
- package/src/variants/input-number.ts +65 -0
- package/src/variants/item.ts +68 -0
- package/src/variants/navigation-menu.ts +25 -0
- package/src/variants/progress-circle.ts +46 -0
- package/src/variants/scroll-area.ts +73 -0
- package/src/variants/separator.ts +40 -0
- package/src/variants/sheet.ts +37 -0
- package/src/variants/sidebar.ts +41 -0
- package/src/variants/tabs.ts +34 -0
- package/src/variants/toggle.ts +40 -0
- package/dist/node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/clsx.d.mts +0 -6
|
@@ -1,22 +1,12 @@
|
|
|
1
|
-
import { VariantProps } from "../lib/utils.mjs";
|
|
2
1
|
import { Separator } from "./separator.mjs";
|
|
3
|
-
import
|
|
2
|
+
import { ButtonGroupVariants } from "../variants/button-group.mjs";
|
|
4
3
|
import { ComponentProps, JSX } from "react";
|
|
5
4
|
|
|
6
5
|
//#region src/components/button-group.d.ts
|
|
7
6
|
/**
|
|
8
7
|
* @since 0.3.16-canary.0
|
|
9
8
|
*/
|
|
10
|
-
|
|
11
|
-
orientation: {
|
|
12
|
-
horizontal: string[];
|
|
13
|
-
vertical: string[];
|
|
14
|
-
};
|
|
15
|
-
}, Record<string, never>>;
|
|
16
|
-
/**
|
|
17
|
-
* @since 0.3.16-canary.0
|
|
18
|
-
*/
|
|
19
|
-
type ButtonGroupProps = ComponentProps<"div"> & VariantProps<typeof buttonGroupVariants>;
|
|
9
|
+
type ButtonGroupProps = ComponentProps<"div"> & ButtonGroupVariants;
|
|
20
10
|
/**
|
|
21
11
|
* @since 0.3.16-canary.0
|
|
22
12
|
*/
|
|
@@ -52,4 +42,4 @@ declare function ButtonGroupSeparator({
|
|
|
52
42
|
...props
|
|
53
43
|
}: ButtonGroupSeparatorProps): JSX.Element;
|
|
54
44
|
//#endregion
|
|
55
|
-
export { ButtonGroup, type ButtonGroupProps, ButtonGroupSeparator, type ButtonGroupSeparatorProps, ButtonGroupText, type ButtonGroupTextProps
|
|
45
|
+
export { ButtonGroup, type ButtonGroupProps, ButtonGroupSeparator, type ButtonGroupSeparatorProps, ButtonGroupText, type ButtonGroupTextProps };
|
|
@@ -1,34 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { Slot } from "
|
|
1
|
+
import { cn } from "../lib/utils.mjs";
|
|
2
|
+
import { Separator as Separator$1 } from "./separator.mjs";
|
|
3
|
+
import { buttonGroupVariants } from "../variants/button-group.mjs";
|
|
4
|
+
import { Slot } from "radix-ui";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
//#region src/components/button-group.tsx
|
|
7
7
|
/**
|
|
8
8
|
* @since 0.3.16-canary.0
|
|
9
9
|
*/
|
|
10
|
-
const buttonGroupVariants = tv({
|
|
11
|
-
base: [
|
|
12
|
-
"flex w-fit items-stretch",
|
|
13
|
-
"has-[>[data-slot=button-group]]:gap-2",
|
|
14
|
-
"[&>*]:focus-visible:relative [&>*]:focus-visible:z-10",
|
|
15
|
-
"has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-lg",
|
|
16
|
-
"[&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit",
|
|
17
|
-
"[&>input]:flex-1"
|
|
18
|
-
],
|
|
19
|
-
defaultVariants: { orientation: "horizontal" },
|
|
20
|
-
variants: { orientation: {
|
|
21
|
-
horizontal: ["[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0", "[&>*:not(:last-child)]:rounded-r-none"],
|
|
22
|
-
vertical: [
|
|
23
|
-
"flex-col",
|
|
24
|
-
"[&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0",
|
|
25
|
-
"[&>*:not(:last-child)]:rounded-b-none"
|
|
26
|
-
]
|
|
27
|
-
} }
|
|
28
|
-
});
|
|
29
|
-
/**
|
|
30
|
-
* @since 0.3.16-canary.0
|
|
31
|
-
*/
|
|
32
10
|
function ButtonGroup({ className, orientation, ...props }) {
|
|
33
11
|
return /* @__PURE__ */ jsx("div", {
|
|
34
12
|
className: buttonGroupVariants({
|
|
@@ -45,8 +23,8 @@ function ButtonGroup({ className, orientation, ...props }) {
|
|
|
45
23
|
* @since 0.3.16-canary.0
|
|
46
24
|
*/
|
|
47
25
|
function ButtonGroupText({ asChild = false, className, ...props }) {
|
|
48
|
-
return /* @__PURE__ */ jsx(asChild ? Slot : "div", {
|
|
49
|
-
className: cn("flex items-center gap-2
|
|
26
|
+
return /* @__PURE__ */ jsx(asChild ? Slot.Root : "div", {
|
|
27
|
+
className: cn("flex items-center gap-2 rounded-md border bg-muted px-2.5 text-sm font-medium shadow-xs [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4", className),
|
|
50
28
|
...props
|
|
51
29
|
});
|
|
52
30
|
}
|
|
@@ -54,12 +32,12 @@ function ButtonGroupText({ asChild = false, className, ...props }) {
|
|
|
54
32
|
* @since 0.3.16-canary.0
|
|
55
33
|
*/
|
|
56
34
|
function ButtonGroupSeparator({ className, orientation = "vertical", ...props }) {
|
|
57
|
-
return /* @__PURE__ */ jsx(Separator, {
|
|
58
|
-
className: cn("relative self-stretch
|
|
35
|
+
return /* @__PURE__ */ jsx(Separator$1, {
|
|
36
|
+
className: cn("relative self-stretch bg-input data-horizontal:mx-px data-horizontal:w-auto data-vertical:my-px data-vertical:h-auto", className),
|
|
59
37
|
"data-slot": "button-group-separator",
|
|
60
38
|
orientation,
|
|
61
39
|
...props
|
|
62
40
|
});
|
|
63
41
|
}
|
|
64
42
|
//#endregion
|
|
65
|
-
export { ButtonGroup, ButtonGroupSeparator, ButtonGroupText
|
|
43
|
+
export { ButtonGroup, ButtonGroupSeparator, ButtonGroupText };
|
|
@@ -1,33 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import * as _$_codefast_tailwind_variants0 from "@codefast/tailwind-variants";
|
|
1
|
+
import { ButtonVariants } from "../variants/button.mjs";
|
|
3
2
|
import { ComponentProps, JSX } from "react";
|
|
4
3
|
|
|
5
4
|
//#region src/components/button.d.ts
|
|
6
5
|
/**
|
|
7
6
|
* @since 0.3.16-canary.0
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
|
-
size: {
|
|
11
|
-
"icon-sm": string;
|
|
12
|
-
icon: string;
|
|
13
|
-
"icon-lg": string;
|
|
14
|
-
sm: string[];
|
|
15
|
-
md: string[];
|
|
16
|
-
lg: string[];
|
|
17
|
-
};
|
|
18
|
-
variant: {
|
|
19
|
-
default: string[];
|
|
20
|
-
destructive: string[];
|
|
21
|
-
ghost: string[];
|
|
22
|
-
link: string[];
|
|
23
|
-
outline: string[];
|
|
24
|
-
secondary: string[];
|
|
25
|
-
};
|
|
26
|
-
}, Record<string, never>>;
|
|
27
|
-
/**
|
|
28
|
-
* @since 0.3.16-canary.0
|
|
29
|
-
*/
|
|
30
|
-
type ButtonProps = ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
|
|
8
|
+
type ButtonProps = ComponentProps<"button"> & ButtonVariants & {
|
|
31
9
|
asChild?: boolean;
|
|
32
10
|
type?: ComponentProps<"button">["type"];
|
|
33
11
|
};
|
|
@@ -36,7 +14,6 @@ type ButtonProps = ComponentProps<"button"> & VariantProps<typeof buttonVariants
|
|
|
36
14
|
*/
|
|
37
15
|
declare function Button({
|
|
38
16
|
asChild,
|
|
39
|
-
children,
|
|
40
17
|
className,
|
|
41
18
|
size,
|
|
42
19
|
type,
|
|
@@ -44,4 +21,4 @@ declare function Button({
|
|
|
44
21
|
...props
|
|
45
22
|
}: ButtonProps): JSX.Element;
|
|
46
23
|
//#endregion
|
|
47
|
-
export { Button, type ButtonProps
|
|
24
|
+
export { Button, type ButtonProps };
|
|
@@ -1,92 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Slot } from "
|
|
1
|
+
import { buttonVariants } from "../variants/button.mjs";
|
|
2
|
+
import { Slot } from "radix-ui";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
//#region src/components/button.tsx
|
|
5
5
|
/**
|
|
6
6
|
* @since 0.3.16-canary.0
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
"inline-flex shrink-0 items-center justify-center gap-2",
|
|
11
|
-
"rounded-lg outline-hidden",
|
|
12
|
-
"text-sm font-medium whitespace-nowrap",
|
|
13
|
-
"transition select-none",
|
|
14
|
-
"focus-visible:ring-3",
|
|
15
|
-
"disabled:opacity-50",
|
|
16
|
-
"[&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"
|
|
17
|
-
],
|
|
18
|
-
defaultVariants: {
|
|
19
|
-
size: "md",
|
|
20
|
-
variant: "default"
|
|
21
|
-
},
|
|
22
|
-
variants: {
|
|
23
|
-
size: {
|
|
24
|
-
"icon-sm": "size-8",
|
|
25
|
-
icon: "size-9",
|
|
26
|
-
"icon-lg": "size-10",
|
|
27
|
-
sm: ["h-8 px-3", "has-[>svg]:px-2.5"],
|
|
28
|
-
md: ["h-9 px-4", "has-[>svg]:px-3"],
|
|
29
|
-
lg: ["h-10 px-6", "has-[>svg]:px-4"]
|
|
30
|
-
},
|
|
31
|
-
variant: {
|
|
32
|
-
default: [
|
|
33
|
-
"bg-primary text-primary-foreground",
|
|
34
|
-
"hover:not-disabled:bg-primary/80",
|
|
35
|
-
"focus-visible:ring-primary/20",
|
|
36
|
-
"dark:focus-visible:ring-primary/40"
|
|
37
|
-
],
|
|
38
|
-
destructive: [
|
|
39
|
-
"bg-destructive text-white",
|
|
40
|
-
"hover:not-disabled:bg-destructive/90",
|
|
41
|
-
"focus-visible:ring-destructive/20",
|
|
42
|
-
"dark:bg-destructive/60",
|
|
43
|
-
"dark:focus-visible:ring-destructive/40"
|
|
44
|
-
],
|
|
45
|
-
ghost: [
|
|
46
|
-
"hover:not-disabled:bg-secondary hover:not-disabled:text-secondary-foreground",
|
|
47
|
-
"focus-visible:ring-ring/50",
|
|
48
|
-
"dark:hover:not-disabled:bg-secondary/50"
|
|
49
|
-
],
|
|
50
|
-
link: [
|
|
51
|
-
"text-primary underline-offset-4",
|
|
52
|
-
"hover:not-disabled:underline",
|
|
53
|
-
"focus-visible:ring-ring/50"
|
|
54
|
-
],
|
|
55
|
-
outline: [
|
|
56
|
-
"border border-input shadow-xs",
|
|
57
|
-
"hover:not-disabled:border-ring/60 hover:not-disabled:bg-secondary hover:not-disabled:text-secondary-foreground",
|
|
58
|
-
"focus-visible:border-ring focus-visible:ring-ring/50",
|
|
59
|
-
"aria-invalid:border-destructive",
|
|
60
|
-
"focus-within:aria-invalid:ring-destructive/20",
|
|
61
|
-
"hover:not-disabled:aria-invalid:border-destructive/60",
|
|
62
|
-
"dark:bg-input/30",
|
|
63
|
-
"dark:hover:not-disabled:bg-input/50",
|
|
64
|
-
"dark:aria-invalid:border-destructive/70",
|
|
65
|
-
"dark:focus-within:aria-invalid:ring-destructive/40"
|
|
66
|
-
],
|
|
67
|
-
secondary: [
|
|
68
|
-
"bg-secondary text-secondary-foreground",
|
|
69
|
-
"hover:not-disabled:bg-secondary/80",
|
|
70
|
-
"focus-visible:ring-ring/50"
|
|
71
|
-
]
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
/**
|
|
76
|
-
* @since 0.3.16-canary.0
|
|
77
|
-
*/
|
|
78
|
-
function Button({ asChild = false, children, className, size, type = "button", variant, ...props }) {
|
|
79
|
-
const Comp = asChild ? Slot : "button";
|
|
8
|
+
function Button({ asChild = false, className, size, type = "button", variant, ...props }) {
|
|
9
|
+
const Comp = asChild ? Slot.Root : "button";
|
|
80
10
|
if (asChild) return /* @__PURE__ */ jsx(Comp, {
|
|
81
11
|
className: buttonVariants({
|
|
82
12
|
className,
|
|
83
13
|
size,
|
|
84
14
|
variant
|
|
85
15
|
}),
|
|
16
|
+
"data-size": size,
|
|
86
17
|
"data-slot": "button",
|
|
87
18
|
"data-variant": variant,
|
|
88
|
-
...props
|
|
89
|
-
children
|
|
19
|
+
...props
|
|
90
20
|
});
|
|
91
21
|
return /* @__PURE__ */ jsx("button", {
|
|
92
22
|
className: buttonVariants({
|
|
@@ -94,12 +24,12 @@ function Button({ asChild = false, children, className, size, type = "button", v
|
|
|
94
24
|
size,
|
|
95
25
|
variant
|
|
96
26
|
}),
|
|
27
|
+
"data-size": size,
|
|
97
28
|
"data-slot": "button",
|
|
98
29
|
"data-variant": variant,
|
|
99
30
|
type,
|
|
100
|
-
...props
|
|
101
|
-
children
|
|
31
|
+
...props
|
|
102
32
|
});
|
|
103
33
|
}
|
|
104
34
|
//#endregion
|
|
105
|
-
export { Button
|
|
35
|
+
export { Button };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Button } from "./button.mjs";
|
|
2
|
+
import { DayButton, DayPicker, Locale } from "@daypicker/react";
|
|
2
3
|
import { ComponentProps, JSX } from "react";
|
|
3
|
-
import { DayButton, DayPicker } from "react-day-picker";
|
|
4
4
|
|
|
5
5
|
//#region src/components/calendar.d.ts
|
|
6
6
|
/**
|
|
@@ -19,19 +19,23 @@ declare function Calendar({
|
|
|
19
19
|
classNames,
|
|
20
20
|
components,
|
|
21
21
|
formatters,
|
|
22
|
+
locale,
|
|
22
23
|
showOutsideDays,
|
|
23
24
|
...props
|
|
24
25
|
}: CalendarProps): JSX.Element;
|
|
25
26
|
/**
|
|
26
27
|
* @since 0.3.16-canary.0
|
|
27
28
|
*/
|
|
28
|
-
type CalendarDayButtonProps = ComponentProps<typeof DayButton
|
|
29
|
+
type CalendarDayButtonProps = ComponentProps<typeof DayButton> & {
|
|
30
|
+
locale?: Partial<Locale>;
|
|
31
|
+
};
|
|
29
32
|
/**
|
|
30
33
|
* @since 0.3.16-canary.0
|
|
31
34
|
*/
|
|
32
35
|
declare function CalendarDayButton({
|
|
33
36
|
className,
|
|
34
37
|
day,
|
|
38
|
+
locale,
|
|
35
39
|
modifiers,
|
|
36
40
|
...props
|
|
37
41
|
}: CalendarDayButtonProps): JSX.Element;
|
|
@@ -1,75 +1,73 @@
|
|
|
1
|
-
"use client";
|
|
2
1
|
import { cn } from "../lib/utils.mjs";
|
|
3
|
-
import {
|
|
2
|
+
import { buttonVariants } from "../variants/button.mjs";
|
|
3
|
+
import { Button } from "./button.mjs";
|
|
4
4
|
import { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import { DayPicker, getDefaultClassNames } from "@daypicker/react";
|
|
6
7
|
import { useEffect, useRef } from "react";
|
|
7
|
-
import { DayPicker, getDefaultClassNames } from "react-day-picker";
|
|
8
8
|
//#region src/components/calendar.tsx
|
|
9
9
|
/**
|
|
10
10
|
* @since 0.3.16-canary.0
|
|
11
11
|
*/
|
|
12
|
-
function Calendar({ buttonVariant = "ghost", captionLayout = "label", className, classNames, components, formatters, showOutsideDays = true, ...props }) {
|
|
12
|
+
function Calendar({ buttonVariant = "ghost", captionLayout = "label", className, classNames, components, formatters, locale, showOutsideDays = true, ...props }) {
|
|
13
13
|
const defaultClassNames = getDefaultClassNames();
|
|
14
14
|
return /* @__PURE__ */ jsx(DayPicker, {
|
|
15
15
|
captionLayout,
|
|
16
|
-
className: cn("group/calendar
|
|
16
|
+
className: cn("group/calendar bg-background p-3 [--cell-radius:var(--radius-md)] [--cell-size:--spacing(8)] in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent", String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`, String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`, className),
|
|
17
17
|
classNames: {
|
|
18
|
-
button_next: buttonVariants({
|
|
19
|
-
variant: buttonVariant,
|
|
20
|
-
className: ["size-(--cell-size) p-0 select-none aria-disabled:opacity-50", defaultClassNames.button_next]
|
|
21
|
-
}),
|
|
22
|
-
button_previous: buttonVariants({
|
|
23
|
-
variant: buttonVariant,
|
|
24
|
-
className: ["size-(--cell-size) p-0 select-none aria-disabled:opacity-50", defaultClassNames.button_previous]
|
|
25
|
-
}),
|
|
26
|
-
caption_label: cn("font-medium", "select-none", captionLayout === "label" ? "text-sm" : "flex h-8 items-center gap-1 rounded-md pr-1 pl-2 text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground", defaultClassNames.caption_label),
|
|
27
|
-
day: cn("group/day relative", "aspect-square h-full w-full p-0 text-center", "select-none", "[&:last-child[data-selected=true]_button]:rounded-r-md", props.showWeekNumber ? "[&:nth-child(2)[data-selected=true]_button]:rounded-l-md" : "[&:first-child[data-selected=true]_button]:rounded-l-md", defaultClassNames.day),
|
|
28
|
-
disabled: cn("opacity-50", "text-muted-foreground", defaultClassNames.disabled),
|
|
29
|
-
dropdown: cn("absolute inset-0", "bg-popover", "opacity-0", defaultClassNames.dropdown),
|
|
30
|
-
dropdown_root: cn("relative", "rounded-md border border-input shadow-xs", "has-focus:border-ring has-focus:ring-3 has-focus:ring-ring/50", defaultClassNames.dropdown_root),
|
|
31
|
-
dropdowns: cn("flex h-(--cell-size) w-full items-center justify-center gap-1.5", "text-sm font-medium", defaultClassNames.dropdowns),
|
|
32
|
-
hidden: cn("invisible", defaultClassNames.hidden),
|
|
33
|
-
month: cn("flex w-full flex-col gap-4", defaultClassNames.month),
|
|
34
|
-
month_caption: cn("flex h-(--cell-size) w-full items-center justify-center", "px-(--cell-size)", defaultClassNames.month_caption),
|
|
35
|
-
months: cn("relative flex flex-col gap-4", "md:flex-row", defaultClassNames.months),
|
|
36
|
-
nav: cn("absolute flex w-full items-center justify-between gap-1", "inset-x-0 top-0", defaultClassNames.nav),
|
|
37
|
-
outside: cn("text-muted-foreground", "aria-selected:text-muted-foreground", defaultClassNames.outside),
|
|
38
|
-
range_end: cn("rounded-r-md", "bg-accent", defaultClassNames.range_end),
|
|
39
|
-
range_middle: cn("rounded-none", defaultClassNames.range_middle),
|
|
40
|
-
range_start: cn("rounded-l-md", "bg-accent", defaultClassNames.range_start),
|
|
41
18
|
root: cn("w-fit", defaultClassNames.root),
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
19
|
+
months: cn("relative flex flex-col gap-4 md:flex-row", defaultClassNames.months),
|
|
20
|
+
month: cn("flex w-full flex-col gap-4", defaultClassNames.month),
|
|
21
|
+
nav: cn("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1", defaultClassNames.nav),
|
|
22
|
+
button_previous: cn(buttonVariants({ variant: buttonVariant }), "size-(--cell-size) p-0 select-none aria-disabled:opacity-50", defaultClassNames.button_previous),
|
|
23
|
+
button_next: cn(buttonVariants({ variant: buttonVariant }), "size-(--cell-size) p-0 select-none aria-disabled:opacity-50", defaultClassNames.button_next),
|
|
24
|
+
month_caption: cn("flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)", defaultClassNames.month_caption),
|
|
25
|
+
dropdowns: cn("flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium", defaultClassNames.dropdowns),
|
|
26
|
+
dropdown_root: cn("relative rounded-(--cell-radius) border border-input shadow-xs has-focus:border-ring has-focus:ring-3 has-focus:ring-ring/50", defaultClassNames.dropdown_root),
|
|
27
|
+
dropdown: cn("absolute inset-0 bg-popover opacity-0", defaultClassNames.dropdown),
|
|
28
|
+
caption_label: cn("font-medium select-none", captionLayout === "label" ? "text-sm" : "flex h-8 items-center gap-1 rounded-(--cell-radius) pr-1 pl-2 text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground", defaultClassNames.caption_label),
|
|
29
|
+
month_grid: cn("w-full border-collapse", defaultClassNames.month_grid),
|
|
48
30
|
weekdays: cn("flex", defaultClassNames.weekdays),
|
|
31
|
+
weekday: cn("flex-1 rounded-(--cell-radius) text-[0.8rem] font-normal text-muted-foreground select-none", defaultClassNames.weekday),
|
|
32
|
+
week: cn("mt-2 flex w-full", defaultClassNames.week),
|
|
33
|
+
week_number_header: cn("w-(--cell-size) select-none", defaultClassNames.week_number_header),
|
|
34
|
+
week_number: cn("text-[0.8rem] text-muted-foreground select-none", defaultClassNames.week_number),
|
|
35
|
+
day: cn("group/day relative aspect-square h-full w-full rounded-(--cell-radius) p-0 text-center select-none [&:last-child[data-selected=true]_button]:rounded-r-(--cell-radius)", props.showWeekNumber ? "[&:nth-child(2)[data-selected=true]_button]:rounded-l-(--cell-radius)" : "[&:first-child[data-selected=true]_button]:rounded-l-(--cell-radius)", defaultClassNames.day),
|
|
36
|
+
range_start: cn("relative isolate z-0 rounded-l-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:right-0 after:w-4 after:bg-muted", defaultClassNames.range_start),
|
|
37
|
+
range_middle: cn("rounded-none", defaultClassNames.range_middle),
|
|
38
|
+
range_end: cn("relative isolate z-0 rounded-r-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:left-0 after:w-4 after:bg-muted", defaultClassNames.range_end),
|
|
39
|
+
today: cn("rounded-(--cell-radius) bg-muted text-foreground data-[selected=true]:rounded-none", defaultClassNames.today),
|
|
40
|
+
outside: cn("text-muted-foreground aria-selected:text-muted-foreground", defaultClassNames.outside),
|
|
41
|
+
disabled: cn("text-muted-foreground opacity-50", defaultClassNames.disabled),
|
|
42
|
+
hidden: cn("invisible", defaultClassNames.hidden),
|
|
49
43
|
...classNames
|
|
50
44
|
},
|
|
51
45
|
components: {
|
|
52
46
|
Chevron: CalendarChevron,
|
|
53
|
-
DayButton: CalendarDayButton,
|
|
47
|
+
DayButton: (dayButtonProps) => /* @__PURE__ */ jsx(CalendarDayButton, {
|
|
48
|
+
locale,
|
|
49
|
+
...dayButtonProps
|
|
50
|
+
}),
|
|
54
51
|
Root: CalendarRoot,
|
|
55
52
|
WeekNumber: CalendarWeekNumber,
|
|
56
53
|
...components
|
|
57
54
|
},
|
|
58
55
|
formatters: {
|
|
59
|
-
formatMonthDropdown: (date) => date.toLocaleString(
|
|
56
|
+
formatMonthDropdown: (date) => date.toLocaleString(locale?.code, { month: "short" }),
|
|
60
57
|
...formatters
|
|
61
58
|
},
|
|
59
|
+
locale,
|
|
62
60
|
showOutsideDays,
|
|
63
61
|
...props
|
|
64
62
|
});
|
|
65
63
|
}
|
|
66
64
|
function CalendarChevron({ className, orientation, ...props }) {
|
|
67
65
|
if (orientation === "left") return /* @__PURE__ */ jsx(ChevronLeftIcon, {
|
|
68
|
-
className: cn("size-4", className),
|
|
66
|
+
className: cn("size-4 rtl:rotate-180", className),
|
|
69
67
|
...props
|
|
70
68
|
});
|
|
71
69
|
if (orientation === "right") return /* @__PURE__ */ jsx(ChevronRightIcon, {
|
|
72
|
-
className: cn("size-4", className),
|
|
70
|
+
className: cn("size-4 rtl:rotate-180", className),
|
|
73
71
|
...props
|
|
74
72
|
});
|
|
75
73
|
return /* @__PURE__ */ jsx(ChevronDownIcon, {
|
|
@@ -77,10 +75,9 @@ function CalendarChevron({ className, orientation, ...props }) {
|
|
|
77
75
|
...props
|
|
78
76
|
});
|
|
79
77
|
}
|
|
80
|
-
function CalendarRoot({
|
|
78
|
+
function CalendarRoot({ rootRef, ...props }) {
|
|
81
79
|
return /* @__PURE__ */ jsx("div", {
|
|
82
80
|
ref: rootRef,
|
|
83
|
-
className: cn(className),
|
|
84
81
|
"data-slot": "calendar",
|
|
85
82
|
...props
|
|
86
83
|
});
|
|
@@ -89,7 +86,7 @@ function CalendarWeekNumber({ children, ...props }) {
|
|
|
89
86
|
return /* @__PURE__ */ jsx("td", {
|
|
90
87
|
...props,
|
|
91
88
|
children: /* @__PURE__ */ jsx("div", {
|
|
92
|
-
className:
|
|
89
|
+
className: "flex size-(--cell-size) items-center justify-center text-center",
|
|
93
90
|
children
|
|
94
91
|
})
|
|
95
92
|
});
|
|
@@ -97,7 +94,7 @@ function CalendarWeekNumber({ children, ...props }) {
|
|
|
97
94
|
/**
|
|
98
95
|
* @since 0.3.16-canary.0
|
|
99
96
|
*/
|
|
100
|
-
function CalendarDayButton({ className, day, modifiers, ...props }) {
|
|
97
|
+
function CalendarDayButton({ className, day, locale, modifiers, ...props }) {
|
|
101
98
|
const defaultClassNames = getDefaultClassNames();
|
|
102
99
|
const ref = useRef(null);
|
|
103
100
|
useEffect(() => {
|
|
@@ -105,8 +102,8 @@ function CalendarDayButton({ className, day, modifiers, ...props }) {
|
|
|
105
102
|
}, [modifiers.focused]);
|
|
106
103
|
return /* @__PURE__ */ jsx(Button, {
|
|
107
104
|
ref,
|
|
108
|
-
className: cn("flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal
|
|
109
|
-
"data-day": day.date.toLocaleDateString(),
|
|
105
|
+
className: cn("relative isolate z-10 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 border-0 leading-none font-normal group-data-focused/day:relative group-data-focused/day:z-10 group-data-focused/day:border-ring group-data-focused/day:ring-3 group-data-focused/day:ring-ring/50 data-[range-end=true]:rounded-(--cell-radius) data-[range-end=true]:rounded-r-(--cell-radius) data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:rounded-none data-[range-middle=true]:bg-muted data-[range-middle=true]:text-foreground data-[range-start=true]:rounded-(--cell-radius) data-[range-start=true]:rounded-l-(--cell-radius) data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground dark:hover:text-foreground [&>span]:text-xs [&>span]:opacity-70", defaultClassNames.day, className),
|
|
106
|
+
"data-day": day.date.toLocaleDateString(locale?.code),
|
|
110
107
|
"data-range-end": modifiers.range_end,
|
|
111
108
|
"data-range-middle": modifiers.range_middle,
|
|
112
109
|
"data-range-start": modifiers.range_start,
|
|
@@ -4,12 +4,15 @@ import { ComponentProps, JSX } from "react";
|
|
|
4
4
|
/**
|
|
5
5
|
* @since 0.3.16-canary.0
|
|
6
6
|
*/
|
|
7
|
-
type CardProps = ComponentProps<"div"
|
|
7
|
+
type CardProps = ComponentProps<"div"> & {
|
|
8
|
+
size?: "default" | "sm";
|
|
9
|
+
};
|
|
8
10
|
/**
|
|
9
11
|
* @since 0.3.16-canary.0
|
|
10
12
|
*/
|
|
11
13
|
declare function Card({
|
|
12
14
|
className,
|
|
15
|
+
size,
|
|
13
16
|
...props
|
|
14
17
|
}: CardProps): JSX.Element;
|
|
15
18
|
/**
|
|
@@ -31,7 +34,6 @@ type CardTitleProps = ComponentProps<"div">;
|
|
|
31
34
|
* @since 0.3.16-canary.0
|
|
32
35
|
*/
|
|
33
36
|
declare function CardTitle({
|
|
34
|
-
children,
|
|
35
37
|
className,
|
|
36
38
|
...props
|
|
37
39
|
}: CardTitleProps): JSX.Element;
|
package/dist/components/card.mjs
CHANGED
|
@@ -4,9 +4,10 @@ import { jsx } from "react/jsx-runtime";
|
|
|
4
4
|
/**
|
|
5
5
|
* @since 0.3.16-canary.0
|
|
6
6
|
*/
|
|
7
|
-
function Card({ className, ...props }) {
|
|
7
|
+
function Card({ className, size = "default", ...props }) {
|
|
8
8
|
return /* @__PURE__ */ jsx("div", {
|
|
9
|
-
className: cn("flex flex-col gap-
|
|
9
|
+
className: cn("group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl bg-card py-(--card-spacing) text-sm text-card-foreground shadow-xs ring-1 ring-foreground/10 [--card-spacing:--spacing(6)] has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(4)] *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl", className),
|
|
10
|
+
"data-size": size,
|
|
10
11
|
"data-slot": "card",
|
|
11
12
|
...props
|
|
12
13
|
});
|
|
@@ -16,7 +17,7 @@ function Card({ className, ...props }) {
|
|
|
16
17
|
*/
|
|
17
18
|
function CardHeader({ className, ...props }) {
|
|
18
19
|
return /* @__PURE__ */ jsx("div", {
|
|
19
|
-
className: cn("@container/card-header grid auto-rows-min
|
|
20
|
+
className: cn("group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-(--card-spacing) has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)", className),
|
|
20
21
|
"data-slot": "card-header",
|
|
21
22
|
...props
|
|
22
23
|
});
|
|
@@ -24,12 +25,11 @@ function CardHeader({ className, ...props }) {
|
|
|
24
25
|
/**
|
|
25
26
|
* @since 0.3.16-canary.0
|
|
26
27
|
*/
|
|
27
|
-
function CardTitle({
|
|
28
|
+
function CardTitle({ className, ...props }) {
|
|
28
29
|
return /* @__PURE__ */ jsx("div", {
|
|
29
|
-
className: cn("leading-
|
|
30
|
+
className: cn("font-heading text-base leading-normal font-medium group-data-[size=sm]/card:text-sm", className),
|
|
30
31
|
"data-slot": "card-title",
|
|
31
|
-
...props
|
|
32
|
-
children
|
|
32
|
+
...props
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
@@ -47,7 +47,7 @@ function CardDescription({ className, ...props }) {
|
|
|
47
47
|
*/
|
|
48
48
|
function CardContent({ className, ...props }) {
|
|
49
49
|
return /* @__PURE__ */ jsx("div", {
|
|
50
|
-
className: cn("px-
|
|
50
|
+
className: cn("px-(--card-spacing)", className),
|
|
51
51
|
"data-slot": "card-content",
|
|
52
52
|
...props
|
|
53
53
|
});
|
|
@@ -57,7 +57,7 @@ function CardContent({ className, ...props }) {
|
|
|
57
57
|
*/
|
|
58
58
|
function CardFooter({ className, ...props }) {
|
|
59
59
|
return /* @__PURE__ */ jsx("div", {
|
|
60
|
-
className: cn("flex items-center
|
|
60
|
+
className: cn("flex items-center rounded-b-xl px-(--card-spacing) [.border-t]:pt-(--card-spacing)", className),
|
|
61
61
|
"data-slot": "card-footer",
|
|
62
62
|
...props
|
|
63
63
|
});
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { Button } from "./button.mjs";
|
|
2
2
|
import { ComponentProps, JSX } from "react";
|
|
3
|
-
import * as _$_radix_ui_react_context0 from "@radix-ui/react-context";
|
|
4
|
-
import { Scope } from "@radix-ui/react-context";
|
|
5
3
|
import useEmblaCarousel, { UseEmblaCarouselType } from "embla-carousel-react";
|
|
4
|
+
import { Context } from "radix-ui/internal";
|
|
6
5
|
|
|
7
6
|
//#region src/components/carousel.d.ts
|
|
8
7
|
type ScopedProps<P> = P & {
|
|
9
|
-
__scopeCarousel?: Scope;
|
|
8
|
+
__scopeCarousel?: Context.Scope;
|
|
10
9
|
};
|
|
11
|
-
declare const createCarouselScope:
|
|
10
|
+
declare const createCarouselScope: Context.CreateScope;
|
|
12
11
|
/**
|
|
13
12
|
* @since 0.3.16-canary.0
|
|
14
13
|
*/
|
|
@@ -44,11 +43,23 @@ declare function Carousel({
|
|
|
44
43
|
*/
|
|
45
44
|
interface CarouselContentProps extends ComponentProps<"div"> {
|
|
46
45
|
classNames?: {
|
|
47
|
-
content?: string;
|
|
46
|
+
/** Class applied to the flex track that holds the slides. */content?: string; /** Class applied to the scroll viewport (the `overflow-hidden` element). */
|
|
48
47
|
wrapper?: string;
|
|
49
48
|
};
|
|
50
49
|
}
|
|
51
50
|
/**
|
|
51
|
+
* The scroll viewport requires `overflow-hidden` (Embla hides off-screen slides
|
|
52
|
+
* with it), so any ring/shadow on slide content that sits OUTSIDE the slide's
|
|
53
|
+
* border-box is clipped where the slide meets the viewport edge. This is
|
|
54
|
+
* inherent to every Embla-based carousel — the active slide is flush with both
|
|
55
|
+
* scroll-axis edges, so left/right rings (horizontal) cannot show without
|
|
56
|
+
* revealing the neighbouring slide.
|
|
57
|
+
*
|
|
58
|
+
* To give content shadows/rings breathing room on the CROSS axis (top/bottom
|
|
59
|
+
* for horizontal carousels), add a negative-margin + matching padding via
|
|
60
|
+
* `classNames.wrapper`, e.g. `classNames={{ wrapper: "-my-2 py-2" }}`. This
|
|
61
|
+
* shifts no layout but lets the clip happen `n`px further out.
|
|
62
|
+
*
|
|
52
63
|
* @since 0.3.16-canary.0
|
|
53
64
|
*/
|
|
54
65
|
declare function CarouselContent({
|