@codefast/ui 0.3.11-canary.1 → 0.3.11-canary.2

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.
Files changed (148) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/components/accordion.d.ts +29 -10
  3. package/dist/components/accordion.js +38 -37
  4. package/dist/components/alert-dialog.d.ts +60 -24
  5. package/dist/components/alert-dialog.js +69 -72
  6. package/dist/components/alert.d.ts +27 -15
  7. package/dist/components/alert.js +29 -31
  8. package/dist/components/aspect-ratio.d.ts +8 -4
  9. package/dist/components/aspect-ratio.js +7 -5
  10. package/dist/components/avatar.d.ts +17 -6
  11. package/dist/components/avatar.js +19 -17
  12. package/dist/components/badge.d.ts +21 -14
  13. package/dist/components/badge.js +19 -22
  14. package/dist/components/breadcrumb.d.ts +35 -12
  15. package/dist/components/breadcrumb.js +48 -54
  16. package/dist/components/button-group.d.ts +29 -14
  17. package/dist/components/button-group.js +27 -32
  18. package/dist/components/button.d.ts +35 -25
  19. package/dist/components/button.js +50 -48
  20. package/dist/components/calendar.d.ts +24 -9
  21. package/dist/components/calendar.js +92 -98
  22. package/dist/components/card.d.ts +34 -10
  23. package/dist/components/card.js +39 -37
  24. package/dist/components/carousel.d.ts +55 -24
  25. package/dist/components/carousel.js +113 -130
  26. package/dist/components/chart.d.ts +72 -36
  27. package/dist/components/chart.js +154 -166
  28. package/dist/components/checkbox-cards.d.ts +15 -8
  29. package/dist/components/checkbox-cards.js +22 -25
  30. package/dist/components/checkbox-group.d.ts +16 -8
  31. package/dist/components/checkbox-group.js +19 -19
  32. package/dist/components/checkbox.d.ts +9 -4
  33. package/dist/components/checkbox.js +14 -14
  34. package/dist/components/collapsible.d.ts +14 -6
  35. package/dist/components/collapsible.js +18 -16
  36. package/dist/components/command.d.ts +55 -23
  37. package/dist/components/command.js +70 -85
  38. package/dist/components/context-menu.d.ts +72 -22
  39. package/dist/components/context-menu.js +88 -109
  40. package/dist/components/dialog.d.ts +53 -22
  41. package/dist/components/dialog.js +71 -85
  42. package/dist/components/drawer.d.ts +60 -28
  43. package/dist/components/drawer.js +59 -67
  44. package/dist/components/dropdown-menu.d.ts +73 -22
  45. package/dist/components/dropdown-menu.js +95 -112
  46. package/dist/components/empty.d.ts +37 -15
  47. package/dist/components/empty.js +43 -45
  48. package/dist/components/field.d.ts +63 -25
  49. package/dist/components/field.js +88 -104
  50. package/dist/components/form.d.ts +37 -15
  51. package/dist/components/form.js +65 -70
  52. package/dist/components/hover-card.d.ts +21 -7
  53. package/dist/components/hover-card.js +24 -24
  54. package/dist/components/input-group.d.ts +53 -28
  55. package/dist/components/input-group.js +63 -77
  56. package/dist/components/input-number.d.ts +28 -7
  57. package/dist/components/input-number.js +55 -59
  58. package/dist/components/input-otp.d.ts +24 -10
  59. package/dist/components/input-otp.js +33 -37
  60. package/dist/components/input-password.d.ts +12 -5
  61. package/dist/components/input-password.js +31 -32
  62. package/dist/components/input-search.d.ts +18 -8
  63. package/dist/components/input-search.js +43 -41
  64. package/dist/components/input.d.ts +10 -4
  65. package/dist/components/input.js +9 -7
  66. package/dist/components/item.d.ts +69 -32
  67. package/dist/components/item.js +89 -92
  68. package/dist/components/kbd.d.ts +13 -5
  69. package/dist/components/kbd.js +13 -11
  70. package/dist/components/label.d.ts +9 -4
  71. package/dist/components/label.js +9 -7
  72. package/dist/components/menubar.d.ts +80 -23
  73. package/dist/components/menubar.js +97 -118
  74. package/dist/components/native-select.d.ts +16 -6
  75. package/dist/components/native-select.js +25 -26
  76. package/dist/components/navigation-menu.d.ts +36 -12
  77. package/dist/components/navigation-menu.js +60 -75
  78. package/dist/components/pagination.d.ts +35 -14
  79. package/dist/components/pagination.js +54 -69
  80. package/dist/components/popover.d.ts +24 -8
  81. package/dist/components/popover.js +28 -28
  82. package/dist/components/progress-circle.d.ts +106 -88
  83. package/dist/components/progress-circle.js +106 -138
  84. package/dist/components/progress.d.ts +10 -4
  85. package/dist/components/progress.js +14 -14
  86. package/dist/components/radio-cards.d.ts +10 -4
  87. package/dist/components/radio-cards.js +22 -23
  88. package/dist/components/radio-group.d.ts +13 -5
  89. package/dist/components/radio-group.js +18 -16
  90. package/dist/components/radio.d.ts +12 -5
  91. package/dist/components/radio.js +10 -8
  92. package/dist/components/resizable.d.ts +18 -7
  93. package/dist/components/resizable.js +22 -22
  94. package/dist/components/scroll-area.d.ts +33 -20
  95. package/dist/components/scroll-area.js +84 -88
  96. package/dist/components/select.d.ts +50 -16
  97. package/dist/components/select.js +77 -96
  98. package/dist/components/separator.d.ts +29 -19
  99. package/dist/components/separator.js +36 -34
  100. package/dist/components/sheet.d.ts +62 -29
  101. package/dist/components/sheet.js +79 -100
  102. package/dist/components/sidebar.d.ts +160 -66
  103. package/dist/components/sidebar.js +294 -336
  104. package/dist/components/skeleton.d.ts +9 -4
  105. package/dist/components/skeleton.js +8 -6
  106. package/dist/components/slider.d.ts +13 -4
  107. package/dist/components/slider.js +34 -40
  108. package/dist/components/sonner.d.ts +10 -7
  109. package/dist/components/sonner.js +16 -14
  110. package/dist/components/spinner.d.ts +12 -5
  111. package/dist/components/spinner.js +33 -35
  112. package/dist/components/switch.d.ts +9 -4
  113. package/dist/components/switch.js +13 -11
  114. package/dist/components/table.d.ts +37 -11
  115. package/dist/components/table.js +47 -45
  116. package/dist/components/tabs.d.ts +21 -7
  117. package/dist/components/tabs.js +24 -22
  118. package/dist/components/textarea.d.ts +9 -4
  119. package/dist/components/textarea.js +8 -6
  120. package/dist/components/toggle-group.d.ts +24 -9
  121. package/dist/components/toggle-group.js +41 -42
  122. package/dist/components/toggle.d.ts +25 -17
  123. package/dist/components/toggle.js +30 -28
  124. package/dist/components/tooltip.d.ts +24 -8
  125. package/dist/components/tooltip.js +29 -32
  126. package/dist/hooks/use-animated-value.d.ts +4 -1
  127. package/dist/hooks/use-animated-value.js +57 -36
  128. package/dist/hooks/use-copy-to-clipboard.d.ts +11 -5
  129. package/dist/hooks/use-copy-to-clipboard.js +39 -20
  130. package/dist/hooks/use-is-mobile.d.ts +4 -1
  131. package/dist/hooks/use-is-mobile.js +21 -1
  132. package/dist/hooks/use-media-query.d.ts +4 -1
  133. package/dist/hooks/use-media-query.js +45 -18
  134. package/dist/hooks/use-mutation-observer.d.ts +6 -2
  135. package/dist/hooks/use-mutation-observer.js +34 -16
  136. package/dist/hooks/use-pagination.d.ts +22 -14
  137. package/dist/hooks/use-pagination.js +100 -49
  138. package/dist/index.d.ts +69 -130
  139. package/dist/index.js +11 -11
  140. package/dist/primitives/checkbox-group.d.ts +105 -83
  141. package/dist/primitives/checkbox-group.js +111 -84
  142. package/dist/primitives/input-number.d.ts +51 -40
  143. package/dist/primitives/input-number.js +483 -350
  144. package/dist/primitives/input.d.ts +48 -42
  145. package/dist/primitives/input.js +65 -43
  146. package/dist/primitives/progress-circle.d.ts +79 -48
  147. package/dist/primitives/progress-circle.js +154 -105
  148. package/package.json +6 -7
@@ -1,26 +1,28 @@
1
1
  "use client";
2
- import { jsx } from "react/jsx-runtime";
3
2
  import { cn } from "@codefast/tailwind-variants";
4
- import { Fallback, Image, Root } from "@radix-ui/react-avatar";
3
+ import { jsx } from "react/jsx-runtime";
4
+ import * as AvatarPrimitive from "@radix-ui/react-avatar";
5
+ //#region src/components/avatar.tsx
5
6
  function Avatar({ className, ...props }) {
6
- return /*#__PURE__*/ jsx(Root, {
7
- className: cn("relative flex size-8 shrink-0 overflow-hidden rounded-full", className),
8
- "data-slot": "avatar",
9
- ...props
10
- });
7
+ return /* @__PURE__ */ jsx(AvatarPrimitive.Root, {
8
+ className: cn("relative flex size-8 shrink-0 overflow-hidden rounded-full", className),
9
+ "data-slot": "avatar",
10
+ ...props
11
+ });
11
12
  }
12
13
  function AvatarImage({ className, ...props }) {
13
- return /*#__PURE__*/ jsx(Image, {
14
- className: cn("aspect-square size-full", className),
15
- "data-slot": "avatar-image",
16
- ...props
17
- });
14
+ return /* @__PURE__ */ jsx(AvatarPrimitive.Image, {
15
+ className: cn("aspect-square size-full", className),
16
+ "data-slot": "avatar-image",
17
+ ...props
18
+ });
18
19
  }
19
20
  function AvatarFallback({ className, ...props }) {
20
- return /*#__PURE__*/ jsx(Fallback, {
21
- className: cn("flex size-full items-center justify-center rounded-full bg-muted", className),
22
- "data-slot": "avatar-fallback",
23
- ...props
24
- });
21
+ return /* @__PURE__ */ jsx(AvatarPrimitive.Fallback, {
22
+ className: cn("flex size-full items-center justify-center rounded-full bg-muted", className),
23
+ "data-slot": "avatar-fallback",
24
+ ...props
25
+ });
25
26
  }
27
+ //#endregion
26
28
  export { Avatar, AvatarFallback, AvatarImage };
@@ -1,17 +1,24 @@
1
- import type { VariantProps } from "@codefast/tailwind-variants";
2
- import type { ComponentProps, JSX } from "react";
3
- declare const badgeVariants: import("@codefast/tailwind-variants").VariantFunctionType<{
4
- variant: {
5
- default: string;
6
- destructive: string;
7
- outline: string;
8
- secondary: string;
9
- };
1
+ import * as _$_codefast_tailwind_variants0 from "@codefast/tailwind-variants";
2
+ import { VariantProps } from "@codefast/tailwind-variants";
3
+ import { ComponentProps, JSX } from "react";
4
+
5
+ //#region src/components/badge.d.ts
6
+ declare const badgeVariants: _$_codefast_tailwind_variants0.VariantFunctionType<{
7
+ variant: {
8
+ default: string;
9
+ destructive: string;
10
+ outline: string;
11
+ secondary: string;
12
+ };
10
13
  }, Record<string, never>>;
11
14
  interface BadgeProps extends ComponentProps<"span">, VariantProps<typeof badgeVariants> {
12
- asChild?: boolean;
15
+ asChild?: boolean;
13
16
  }
14
- declare function Badge({ asChild, className, variant, ...props }: BadgeProps): JSX.Element;
15
- export { badgeVariants };
16
- export { Badge };
17
- export type { BadgeProps };
17
+ declare function Badge({
18
+ asChild,
19
+ className,
20
+ variant,
21
+ ...props
22
+ }: BadgeProps): JSX.Element;
23
+ //#endregion
24
+ export { Badge, type BadgeProps, badgeVariants };
@@ -1,30 +1,27 @@
1
1
  "use client";
2
- import { jsx } from "react/jsx-runtime";
3
2
  import { tv } from "@codefast/tailwind-variants";
4
3
  import { Slot } from "@radix-ui/react-slot";
4
+ import { jsx } from "react/jsx-runtime";
5
+ //#region src/components/badge.tsx
5
6
  const badgeVariants = tv({
6
- base: "inline-flex w-fit shrink-0 items-center justify-center gap-2 rounded-md border px-1.5 py-0.5 text-xs font-medium whitespace-nowrap outline-hidden transition focus-visible:ring-3 focus-visible:ring-ring/50 [&>svg]:size-3 [&>svg]:shrink-0",
7
- defaultVariants: {
8
- variant: "default"
9
- },
10
- variants: {
11
- variant: {
12
- default: "border-transparent bg-primary text-primary-foreground focus-visible:ring-primary/20 dark:focus-visible:ring-primary/40 [a&]:hover:bg-primary/80",
13
- destructive: "border-transparent bg-destructive text-white focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40 [a&]:hover:bg-destructive/90",
14
- outline: "border-input bg-background focus-visible:border-ring [a&]:hover:border-ring/60 [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",
15
- secondary: "border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/80"
16
- }
17
- }
7
+ base: "inline-flex w-fit shrink-0 items-center justify-center gap-2 rounded-md border px-1.5 py-0.5 text-xs font-medium whitespace-nowrap outline-hidden transition focus-visible:ring-3 focus-visible:ring-ring/50 [&>svg]:size-3 [&>svg]:shrink-0",
8
+ defaultVariants: { variant: "default" },
9
+ variants: { variant: {
10
+ default: "border-transparent bg-primary text-primary-foreground focus-visible:ring-primary/20 dark:focus-visible:ring-primary/40 [a&]:hover:bg-primary/80",
11
+ destructive: "border-transparent bg-destructive text-white focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40 [a&]:hover:bg-destructive/90",
12
+ outline: "border-input bg-background focus-visible:border-ring [a&]:hover:border-ring/60 [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",
13
+ secondary: "border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/80"
14
+ } }
18
15
  });
19
16
  function Badge({ asChild, className, variant, ...props }) {
20
- const Component = asChild ? Slot : "span";
21
- return /*#__PURE__*/ jsx(Component, {
22
- className: badgeVariants({
23
- className,
24
- variant
25
- }),
26
- "data-slot": "badge",
27
- ...props
28
- });
17
+ return /* @__PURE__ */ jsx(asChild ? Slot : "span", {
18
+ className: badgeVariants({
19
+ className,
20
+ variant
21
+ }),
22
+ "data-slot": "badge",
23
+ ...props
24
+ });
29
25
  }
26
+ //#endregion
30
27
  export { Badge, badgeVariants };
@@ -1,21 +1,44 @@
1
- import type { ComponentProps, JSX, ReactNode } from "react";
1
+ import { ComponentProps, JSX, ReactNode } from "react";
2
+
3
+ //#region src/components/breadcrumb.d.ts
2
4
  interface BreadcrumbProps extends ComponentProps<"nav"> {
3
- separator?: ReactNode;
5
+ separator?: ReactNode;
4
6
  }
5
- declare function Breadcrumb({ ...props }: BreadcrumbProps): JSX.Element;
7
+ declare function Breadcrumb({
8
+ ...props
9
+ }: BreadcrumbProps): JSX.Element;
6
10
  type BreadcrumbListProps = ComponentProps<"ol">;
7
- declare function BreadcrumbList({ className, ...props }: BreadcrumbListProps): JSX.Element;
11
+ declare function BreadcrumbList({
12
+ className,
13
+ ...props
14
+ }: BreadcrumbListProps): JSX.Element;
8
15
  type BreadcrumbItemProps = ComponentProps<"li">;
9
- declare function BreadcrumbItem({ className, ...props }: BreadcrumbItemProps): JSX.Element;
16
+ declare function BreadcrumbItem({
17
+ className,
18
+ ...props
19
+ }: BreadcrumbItemProps): JSX.Element;
10
20
  interface BreadcrumbLinkProps extends ComponentProps<"a"> {
11
- asChild?: boolean;
21
+ asChild?: boolean;
12
22
  }
13
- declare function BreadcrumbLink({ asChild, className, ...props }: BreadcrumbLinkProps): JSX.Element;
23
+ declare function BreadcrumbLink({
24
+ asChild,
25
+ className,
26
+ ...props
27
+ }: BreadcrumbLinkProps): JSX.Element;
14
28
  type BreadcrumbPageProps = ComponentProps<"span">;
15
- declare function BreadcrumbPage({ className, ...props }: BreadcrumbPageProps): JSX.Element;
29
+ declare function BreadcrumbPage({
30
+ className,
31
+ ...props
32
+ }: BreadcrumbPageProps): JSX.Element;
16
33
  type BreadcrumbSeparatorProps = ComponentProps<"li">;
17
- declare function BreadcrumbSeparator({ children, ...props }: BreadcrumbSeparatorProps): JSX.Element;
34
+ declare function BreadcrumbSeparator({
35
+ children,
36
+ ...props
37
+ }: BreadcrumbSeparatorProps): JSX.Element;
18
38
  type BreadcrumbEllipsisProps = ComponentProps<"span">;
19
- declare function BreadcrumbEllipsis({ className, ...props }: BreadcrumbEllipsisProps): JSX.Element;
20
- export { Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, };
21
- export type { BreadcrumbEllipsisProps, BreadcrumbItemProps, BreadcrumbLinkProps, BreadcrumbListProps, BreadcrumbPageProps, BreadcrumbProps, BreadcrumbSeparatorProps, };
39
+ declare function BreadcrumbEllipsis({
40
+ className,
41
+ ...props
42
+ }: BreadcrumbEllipsisProps): JSX.Element;
43
+ //#endregion
44
+ export { Breadcrumb, BreadcrumbEllipsis, type BreadcrumbEllipsisProps, BreadcrumbItem, type BreadcrumbItemProps, BreadcrumbLink, type BreadcrumbLinkProps, BreadcrumbList, type BreadcrumbListProps, BreadcrumbPage, type BreadcrumbPageProps, type BreadcrumbProps, BreadcrumbSeparator, type BreadcrumbSeparatorProps };
@@ -1,73 +1,67 @@
1
1
  "use client";
2
- import { jsx, jsxs } from "react/jsx-runtime";
3
2
  import { cn } from "@codefast/tailwind-variants";
4
3
  import { Slot } from "@radix-ui/react-slot";
5
4
  import { ChevronRightIcon, EllipsisIcon } from "lucide-react";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ //#region src/components/breadcrumb.tsx
6
7
  function Breadcrumb({ ...props }) {
7
- return /*#__PURE__*/ jsx("nav", {
8
- "aria-label": "breadcrumb",
9
- "data-slot": "breadcrumb",
10
- ...props
11
- });
8
+ return /* @__PURE__ */ jsx("nav", {
9
+ "aria-label": "breadcrumb",
10
+ "data-slot": "breadcrumb",
11
+ ...props
12
+ });
12
13
  }
13
14
  function BreadcrumbList({ className, ...props }) {
14
- return /*#__PURE__*/ jsx("ol", {
15
- className: cn("flex flex-wrap items-center gap-1.5 text-sm break-words text-muted-foreground sm:gap-2", className),
16
- "data-slot": "breadcrumb-list",
17
- ...props
18
- });
15
+ return /* @__PURE__ */ jsx("ol", {
16
+ className: cn("flex flex-wrap items-center gap-1.5 text-sm break-words text-muted-foreground sm:gap-2", className),
17
+ "data-slot": "breadcrumb-list",
18
+ ...props
19
+ });
19
20
  }
20
21
  function BreadcrumbItem({ className, ...props }) {
21
- return /*#__PURE__*/ jsx("li", {
22
- className: cn("inline-flex items-center gap-1.5", className),
23
- "data-slot": "breadcrumb-item",
24
- ...props
25
- });
22
+ return /* @__PURE__ */ jsx("li", {
23
+ className: cn("inline-flex items-center gap-1.5", className),
24
+ "data-slot": "breadcrumb-item",
25
+ ...props
26
+ });
26
27
  }
27
28
  function BreadcrumbLink({ asChild, className, ...props }) {
28
- const Component = asChild ? Slot : "a";
29
- return /*#__PURE__*/ jsx(Component, {
30
- className: cn("transition-colors hover:text-foreground", className),
31
- "data-slot": "breadcrumb-link",
32
- ...props
33
- });
29
+ return /* @__PURE__ */ jsx(asChild ? Slot : "a", {
30
+ className: cn("transition-colors hover:text-foreground", className),
31
+ "data-slot": "breadcrumb-link",
32
+ ...props
33
+ });
34
34
  }
35
35
  function BreadcrumbPage({ className, ...props }) {
36
- return /*#__PURE__*/ jsx("span", {
37
- "aria-current": "page",
38
- "aria-disabled": "true",
39
- className: cn("font-normal text-foreground", className),
40
- "data-slot": "breadcrumb-page",
41
- ...props
42
- });
36
+ return /* @__PURE__ */ jsx("span", {
37
+ "aria-current": "page",
38
+ "aria-disabled": "true",
39
+ className: cn("font-normal text-foreground", className),
40
+ "data-slot": "breadcrumb-page",
41
+ ...props
42
+ });
43
43
  }
44
44
  function BreadcrumbSeparator({ children, ...props }) {
45
- return /*#__PURE__*/ jsx("li", {
46
- "aria-hidden": "true",
47
- "data-slot": "breadcrumb-separator",
48
- role: "presentation",
49
- ...props,
50
- children: children ?? /*#__PURE__*/ jsx(ChevronRightIcon, {
51
- className: "size-3.5"
52
- })
53
- });
45
+ return /* @__PURE__ */ jsx("li", {
46
+ "aria-hidden": "true",
47
+ "data-slot": "breadcrumb-separator",
48
+ role: "presentation",
49
+ ...props,
50
+ children: children ?? /* @__PURE__ */ jsx(ChevronRightIcon, { className: "size-3.5" })
51
+ });
54
52
  }
55
53
  function BreadcrumbEllipsis({ className, ...props }) {
56
- return /*#__PURE__*/ jsxs("span", {
57
- "aria-hidden": "true",
58
- className: cn("flex size-4 items-center justify-center", className),
59
- "data-slot": "breadcrumb-ellipsis",
60
- role: "presentation",
61
- ...props,
62
- children: [
63
- /*#__PURE__*/ jsx(EllipsisIcon, {
64
- className: "size-4"
65
- }),
66
- /*#__PURE__*/ jsx("span", {
67
- className: "sr-only",
68
- children: "More"
69
- })
70
- ]
71
- });
54
+ return /* @__PURE__ */ jsxs("span", {
55
+ "aria-hidden": "true",
56
+ className: cn("flex size-4 items-center justify-center", className),
57
+ "data-slot": "breadcrumb-ellipsis",
58
+ role: "presentation",
59
+ ...props,
60
+ children: [/* @__PURE__ */ jsx(EllipsisIcon, { className: "size-4" }), /* @__PURE__ */ jsx("span", {
61
+ className: "sr-only",
62
+ children: "More"
63
+ })]
64
+ });
72
65
  }
66
+ //#endregion
73
67
  export { Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator };
@@ -1,19 +1,34 @@
1
- import type { VariantProps } from "@codefast/tailwind-variants";
2
- import type { ComponentProps, JSX } from "react";
3
- import { Separator } from "./separator";
4
- declare const buttonGroupVariants: import("@codefast/tailwind-variants").VariantFunctionType<{
5
- orientation: {
6
- horizontal: string;
7
- vertical: string;
8
- };
1
+ import { Separator } from "./separator.js";
2
+ import * as _$_codefast_tailwind_variants0 from "@codefast/tailwind-variants";
3
+ import { VariantProps } from "@codefast/tailwind-variants";
4
+ import { ComponentProps, JSX } from "react";
5
+
6
+ //#region src/components/button-group.d.ts
7
+ declare const buttonGroupVariants: _$_codefast_tailwind_variants0.VariantFunctionType<{
8
+ orientation: {
9
+ horizontal: string;
10
+ vertical: string;
11
+ };
9
12
  }, Record<string, never>>;
10
13
  type ButtonGroupProps = ComponentProps<"div"> & VariantProps<typeof buttonGroupVariants>;
11
- declare function ButtonGroup({ className, orientation, ...props }: ButtonGroupProps): JSX.Element;
14
+ declare function ButtonGroup({
15
+ className,
16
+ orientation,
17
+ ...props
18
+ }: ButtonGroupProps): JSX.Element;
12
19
  interface ButtonGroupTextProps extends ComponentProps<"div"> {
13
- asChild?: boolean;
20
+ asChild?: boolean;
14
21
  }
15
- declare function ButtonGroupText({ asChild, className, ...props }: ButtonGroupTextProps): JSX.Element;
22
+ declare function ButtonGroupText({
23
+ asChild,
24
+ className,
25
+ ...props
26
+ }: ButtonGroupTextProps): JSX.Element;
16
27
  type ButtonGroupSeparatorProps = ComponentProps<typeof Separator>;
17
- declare function ButtonGroupSeparator({ className, orientation, ...props }: ButtonGroupSeparatorProps): JSX.Element;
18
- export { ButtonGroup, ButtonGroupSeparator, ButtonGroupText, buttonGroupVariants };
19
- export type { ButtonGroupProps, ButtonGroupSeparatorProps, ButtonGroupTextProps };
28
+ declare function ButtonGroupSeparator({
29
+ className,
30
+ orientation,
31
+ ...props
32
+ }: ButtonGroupSeparatorProps): JSX.Element;
33
+ //#endregion
34
+ export { ButtonGroup, type ButtonGroupProps, ButtonGroupSeparator, type ButtonGroupSeparatorProps, ButtonGroupText, type ButtonGroupTextProps, buttonGroupVariants };
@@ -1,44 +1,39 @@
1
1
  "use client";
2
- import { jsx } from "react/jsx-runtime";
2
+ import { Separator } from "./separator.js";
3
3
  import { cn, tv } from "@codefast/tailwind-variants";
4
4
  import { Slot } from "@radix-ui/react-slot";
5
- import { Separator } from "./separator.js";
5
+ import { jsx } from "react/jsx-runtime";
6
+ //#region src/components/button-group.tsx
6
7
  const buttonGroupVariants = tv({
7
- base: cn("flex w-fit items-stretch has-[>[data-slot=button-group]]:gap-2", "[&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit", "[&>*]:focus-visible:relative [&>*]:focus-visible:z-10 [&>input]:flex-1", "has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-lg"),
8
- defaultVariants: {
9
- orientation: "horizontal"
10
- },
11
- variants: {
12
- orientation: {
13
- horizontal: "[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none",
14
- vertical: "flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none"
15
- }
16
- }
8
+ base: cn("flex w-fit items-stretch has-[>[data-slot=button-group]]:gap-2", "[&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit", "[&>*]:focus-visible:relative [&>*]:focus-visible:z-10 [&>input]:flex-1", "has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-lg"),
9
+ defaultVariants: { orientation: "horizontal" },
10
+ variants: { orientation: {
11
+ horizontal: "[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none",
12
+ vertical: "flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none"
13
+ } }
17
14
  });
18
15
  function ButtonGroup({ className, orientation, ...props }) {
19
- return /*#__PURE__*/ jsx("div", {
20
- className: cn(buttonGroupVariants({
21
- orientation
22
- }), className),
23
- "data-orientation": orientation,
24
- "data-slot": "button-group",
25
- role: "group",
26
- ...props
27
- });
16
+ return /* @__PURE__ */ jsx("div", {
17
+ className: cn(buttonGroupVariants({ orientation }), className),
18
+ "data-orientation": orientation,
19
+ "data-slot": "button-group",
20
+ role: "group",
21
+ ...props
22
+ });
28
23
  }
29
24
  function ButtonGroupText({ asChild = false, className, ...props }) {
30
- const Component = asChild ? Slot : "div";
31
- return /*#__PURE__*/ jsx(Component, {
32
- className: cn("flex items-center gap-2 rounded-lg border bg-muted px-4 text-sm font-medium shadow-xs [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4", className),
33
- ...props
34
- });
25
+ return /* @__PURE__ */ jsx(asChild ? Slot : "div", {
26
+ className: cn("flex items-center gap-2 rounded-lg border bg-muted px-4 text-sm font-medium shadow-xs [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4", className),
27
+ ...props
28
+ });
35
29
  }
36
30
  function ButtonGroupSeparator({ className, orientation = "vertical", ...props }) {
37
- return /*#__PURE__*/ jsx(Separator, {
38
- className: cn("relative !m-0 self-stretch bg-input data-[orientation=vertical]:h-auto", className),
39
- "data-slot": "button-group-separator",
40
- orientation: orientation,
41
- ...props
42
- });
31
+ return /* @__PURE__ */ jsx(Separator, {
32
+ className: cn("relative !m-0 self-stretch bg-input data-[orientation=vertical]:h-auto", className),
33
+ "data-slot": "button-group-separator",
34
+ orientation,
35
+ ...props
36
+ });
43
37
  }
38
+ //#endregion
44
39
  export { ButtonGroup, ButtonGroupSeparator, ButtonGroupText, buttonGroupVariants };
@@ -1,28 +1,38 @@
1
- import type { VariantProps } from "@codefast/tailwind-variants";
2
- import type { ComponentProps, JSX } from "react";
3
- declare const buttonVariants: import("@codefast/tailwind-variants").VariantFunctionType<{
4
- size: {
5
- "icon-sm": string;
6
- icon: string;
7
- "icon-lg": string;
8
- sm: string;
9
- md: string;
10
- lg: string;
11
- };
12
- variant: {
13
- default: string;
14
- destructive: string;
15
- ghost: string;
16
- link: string;
17
- outline: string;
18
- secondary: string;
19
- };
1
+ import * as _$_codefast_tailwind_variants0 from "@codefast/tailwind-variants";
2
+ import { VariantProps } from "@codefast/tailwind-variants";
3
+ import { ComponentProps, JSX } from "react";
4
+
5
+ //#region src/components/button.d.ts
6
+ declare const buttonVariants: _$_codefast_tailwind_variants0.VariantFunctionType<{
7
+ size: {
8
+ "icon-sm": string;
9
+ icon: string;
10
+ "icon-lg": string;
11
+ sm: string;
12
+ md: string;
13
+ lg: string;
14
+ };
15
+ variant: {
16
+ default: string;
17
+ destructive: string;
18
+ ghost: string;
19
+ link: string;
20
+ outline: string;
21
+ secondary: string;
22
+ };
20
23
  }, Record<string, never>>;
21
24
  type ButtonProps = ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
22
- asChild?: boolean;
23
- type?: ComponentProps<"button">["type"];
25
+ asChild?: boolean;
26
+ type?: ComponentProps<"button">["type"];
24
27
  };
25
- declare function Button({ asChild, children, className, size, type, variant, ...props }: ButtonProps): JSX.Element;
26
- export { buttonVariants };
27
- export { Button };
28
- export type { ButtonProps };
28
+ declare function Button({
29
+ asChild,
30
+ children,
31
+ className,
32
+ size,
33
+ type,
34
+ variant,
35
+ ...props
36
+ }: ButtonProps): JSX.Element;
37
+ //#endregion
38
+ export { Button, type ButtonProps, buttonVariants };
@@ -1,55 +1,57 @@
1
- import { jsx } from "react/jsx-runtime";
2
1
  import { tv } from "@codefast/tailwind-variants";
3
2
  import { Slot } from "@radix-ui/react-slot";
3
+ import { jsx } from "react/jsx-runtime";
4
+ //#region src/components/button.tsx
4
5
  const buttonVariants = tv({
5
- base: "inline-flex shrink-0 items-center justify-center gap-2 rounded-lg text-sm font-medium whitespace-nowrap outline-hidden transition select-none focus-visible:ring-3 disabled:opacity-50 [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
6
- defaultVariants: {
7
- size: "md",
8
- variant: "default"
9
- },
10
- variants: {
11
- size: {
12
- "icon-sm": "size-8",
13
- icon: "size-9",
14
- "icon-lg": "size-10",
15
- sm: "h-8 px-3 has-[>svg]:px-2.5",
16
- md: "h-9 px-4 has-[>svg]:px-3",
17
- lg: "h-10 px-6 has-[>svg]:px-4"
18
- },
19
- variant: {
20
- default: "bg-primary text-primary-foreground hover:not-disabled:bg-primary/80 focus-visible:ring-primary/20 dark:focus-visible:ring-primary/40",
21
- destructive: "bg-destructive text-white hover:not-disabled:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40",
22
- ghost: "hover:not-disabled:bg-secondary hover:not-disabled:text-secondary-foreground focus-visible:ring-ring/50 dark:hover:not-disabled:bg-secondary/50",
23
- link: "text-primary underline-offset-4 hover:not-disabled:underline focus-visible:ring-ring/50",
24
- outline: "border border-input shadow-xs hover:not-disabled:border-ring/60 hover:not-disabled:bg-secondary hover:not-disabled:text-secondary-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive focus-within:aria-invalid:ring-destructive/20 hover:not-disabled:aria-invalid:border-destructive/60 dark:bg-input/30 dark:hover:not-disabled:bg-input/50 dark:aria-invalid:border-destructive/70 dark:focus-within:aria-invalid:ring-destructive/40",
25
- secondary: "bg-secondary text-secondary-foreground hover:not-disabled:bg-secondary/80 focus-visible:ring-ring/50"
26
- }
27
- }
6
+ base: "inline-flex shrink-0 items-center justify-center gap-2 rounded-lg text-sm font-medium whitespace-nowrap outline-hidden transition select-none focus-visible:ring-3 disabled:opacity-50 [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
7
+ defaultVariants: {
8
+ size: "md",
9
+ variant: "default"
10
+ },
11
+ variants: {
12
+ size: {
13
+ "icon-sm": "size-8",
14
+ icon: "size-9",
15
+ "icon-lg": "size-10",
16
+ sm: "h-8 px-3 has-[>svg]:px-2.5",
17
+ md: "h-9 px-4 has-[>svg]:px-3",
18
+ lg: "h-10 px-6 has-[>svg]:px-4"
19
+ },
20
+ variant: {
21
+ default: "bg-primary text-primary-foreground hover:not-disabled:bg-primary/80 focus-visible:ring-primary/20 dark:focus-visible:ring-primary/40",
22
+ destructive: "bg-destructive text-white hover:not-disabled:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40",
23
+ ghost: "hover:not-disabled:bg-secondary hover:not-disabled:text-secondary-foreground focus-visible:ring-ring/50 dark:hover:not-disabled:bg-secondary/50",
24
+ link: "text-primary underline-offset-4 hover:not-disabled:underline focus-visible:ring-ring/50",
25
+ outline: "border border-input shadow-xs hover:not-disabled:border-ring/60 hover:not-disabled:bg-secondary hover:not-disabled:text-secondary-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive focus-within:aria-invalid:ring-destructive/20 hover:not-disabled:aria-invalid:border-destructive/60 dark:bg-input/30 dark:hover:not-disabled:bg-input/50 dark:aria-invalid:border-destructive/70 dark:focus-within:aria-invalid:ring-destructive/40",
26
+ secondary: "bg-secondary text-secondary-foreground hover:not-disabled:bg-secondary/80 focus-visible:ring-ring/50"
27
+ }
28
+ }
28
29
  });
29
30
  function Button({ asChild = false, children, className, size, type = "button", variant, ...props }) {
30
- const Comp = asChild ? Slot : "button";
31
- if (asChild) return /*#__PURE__*/ jsx(Comp, {
32
- className: buttonVariants({
33
- className,
34
- size,
35
- variant
36
- }),
37
- "data-slot": "button",
38
- "data-variant": variant,
39
- ...props,
40
- children: children
41
- });
42
- return /*#__PURE__*/ jsx("button", {
43
- className: buttonVariants({
44
- className,
45
- size,
46
- variant
47
- }),
48
- "data-slot": "button",
49
- "data-variant": variant,
50
- type: type,
51
- ...props,
52
- children: children
53
- });
31
+ const Comp = asChild ? Slot : "button";
32
+ if (asChild) return /* @__PURE__ */ jsx(Comp, {
33
+ className: buttonVariants({
34
+ className,
35
+ size,
36
+ variant
37
+ }),
38
+ "data-slot": "button",
39
+ "data-variant": variant,
40
+ ...props,
41
+ children
42
+ });
43
+ return /* @__PURE__ */ jsx("button", {
44
+ className: buttonVariants({
45
+ className,
46
+ size,
47
+ variant
48
+ }),
49
+ "data-slot": "button",
50
+ "data-variant": variant,
51
+ type,
52
+ ...props,
53
+ children
54
+ });
54
55
  }
56
+ //#endregion
55
57
  export { Button, buttonVariants };