@codefast/ui 0.3.11-canary.1 → 0.3.11

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 (149) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.md +34 -14
  3. package/dist/components/accordion.d.ts +29 -10
  4. package/dist/components/accordion.js +38 -37
  5. package/dist/components/alert-dialog.d.ts +60 -24
  6. package/dist/components/alert-dialog.js +69 -72
  7. package/dist/components/alert.d.ts +27 -15
  8. package/dist/components/alert.js +29 -31
  9. package/dist/components/aspect-ratio.d.ts +8 -4
  10. package/dist/components/aspect-ratio.js +7 -5
  11. package/dist/components/avatar.d.ts +17 -6
  12. package/dist/components/avatar.js +19 -17
  13. package/dist/components/badge.d.ts +21 -14
  14. package/dist/components/badge.js +19 -22
  15. package/dist/components/breadcrumb.d.ts +35 -12
  16. package/dist/components/breadcrumb.js +48 -54
  17. package/dist/components/button-group.d.ts +29 -14
  18. package/dist/components/button-group.js +27 -32
  19. package/dist/components/button.d.ts +35 -25
  20. package/dist/components/button.js +50 -48
  21. package/dist/components/calendar.d.ts +24 -9
  22. package/dist/components/calendar.js +92 -98
  23. package/dist/components/card.d.ts +34 -10
  24. package/dist/components/card.js +39 -37
  25. package/dist/components/carousel.d.ts +55 -24
  26. package/dist/components/carousel.js +113 -130
  27. package/dist/components/chart.d.ts +72 -36
  28. package/dist/components/chart.js +154 -166
  29. package/dist/components/checkbox-cards.d.ts +15 -8
  30. package/dist/components/checkbox-cards.js +22 -25
  31. package/dist/components/checkbox-group.d.ts +16 -8
  32. package/dist/components/checkbox-group.js +19 -19
  33. package/dist/components/checkbox.d.ts +9 -4
  34. package/dist/components/checkbox.js +14 -14
  35. package/dist/components/collapsible.d.ts +14 -6
  36. package/dist/components/collapsible.js +18 -16
  37. package/dist/components/command.d.ts +55 -23
  38. package/dist/components/command.js +70 -85
  39. package/dist/components/context-menu.d.ts +72 -22
  40. package/dist/components/context-menu.js +88 -109
  41. package/dist/components/dialog.d.ts +53 -22
  42. package/dist/components/dialog.js +71 -85
  43. package/dist/components/drawer.d.ts +60 -28
  44. package/dist/components/drawer.js +59 -67
  45. package/dist/components/dropdown-menu.d.ts +73 -22
  46. package/dist/components/dropdown-menu.js +95 -112
  47. package/dist/components/empty.d.ts +37 -15
  48. package/dist/components/empty.js +43 -45
  49. package/dist/components/field.d.ts +63 -25
  50. package/dist/components/field.js +88 -104
  51. package/dist/components/form.d.ts +37 -15
  52. package/dist/components/form.js +65 -70
  53. package/dist/components/hover-card.d.ts +21 -7
  54. package/dist/components/hover-card.js +24 -24
  55. package/dist/components/input-group.d.ts +53 -28
  56. package/dist/components/input-group.js +63 -77
  57. package/dist/components/input-number.d.ts +28 -7
  58. package/dist/components/input-number.js +55 -59
  59. package/dist/components/input-otp.d.ts +24 -10
  60. package/dist/components/input-otp.js +33 -37
  61. package/dist/components/input-password.d.ts +12 -5
  62. package/dist/components/input-password.js +31 -32
  63. package/dist/components/input-search.d.ts +18 -8
  64. package/dist/components/input-search.js +43 -41
  65. package/dist/components/input.d.ts +10 -4
  66. package/dist/components/input.js +9 -7
  67. package/dist/components/item.d.ts +69 -32
  68. package/dist/components/item.js +89 -92
  69. package/dist/components/kbd.d.ts +13 -5
  70. package/dist/components/kbd.js +13 -11
  71. package/dist/components/label.d.ts +9 -4
  72. package/dist/components/label.js +9 -7
  73. package/dist/components/menubar.d.ts +80 -23
  74. package/dist/components/menubar.js +97 -118
  75. package/dist/components/native-select.d.ts +16 -6
  76. package/dist/components/native-select.js +25 -26
  77. package/dist/components/navigation-menu.d.ts +36 -12
  78. package/dist/components/navigation-menu.js +60 -75
  79. package/dist/components/pagination.d.ts +35 -14
  80. package/dist/components/pagination.js +54 -69
  81. package/dist/components/popover.d.ts +24 -8
  82. package/dist/components/popover.js +28 -28
  83. package/dist/components/progress-circle.d.ts +106 -88
  84. package/dist/components/progress-circle.js +106 -138
  85. package/dist/components/progress.d.ts +10 -4
  86. package/dist/components/progress.js +14 -14
  87. package/dist/components/radio-cards.d.ts +10 -4
  88. package/dist/components/radio-cards.js +22 -23
  89. package/dist/components/radio-group.d.ts +13 -5
  90. package/dist/components/radio-group.js +18 -16
  91. package/dist/components/radio.d.ts +12 -5
  92. package/dist/components/radio.js +10 -8
  93. package/dist/components/resizable.d.ts +18 -7
  94. package/dist/components/resizable.js +22 -22
  95. package/dist/components/scroll-area.d.ts +33 -20
  96. package/dist/components/scroll-area.js +84 -88
  97. package/dist/components/select.d.ts +50 -16
  98. package/dist/components/select.js +77 -96
  99. package/dist/components/separator.d.ts +29 -19
  100. package/dist/components/separator.js +36 -34
  101. package/dist/components/sheet.d.ts +62 -29
  102. package/dist/components/sheet.js +79 -100
  103. package/dist/components/sidebar.d.ts +160 -66
  104. package/dist/components/sidebar.js +294 -336
  105. package/dist/components/skeleton.d.ts +9 -4
  106. package/dist/components/skeleton.js +8 -6
  107. package/dist/components/slider.d.ts +13 -4
  108. package/dist/components/slider.js +34 -40
  109. package/dist/components/sonner.d.ts +10 -7
  110. package/dist/components/sonner.js +16 -14
  111. package/dist/components/spinner.d.ts +12 -5
  112. package/dist/components/spinner.js +33 -35
  113. package/dist/components/switch.d.ts +9 -4
  114. package/dist/components/switch.js +13 -11
  115. package/dist/components/table.d.ts +37 -11
  116. package/dist/components/table.js +47 -45
  117. package/dist/components/tabs.d.ts +21 -7
  118. package/dist/components/tabs.js +24 -22
  119. package/dist/components/textarea.d.ts +9 -4
  120. package/dist/components/textarea.js +8 -6
  121. package/dist/components/toggle-group.d.ts +24 -9
  122. package/dist/components/toggle-group.js +41 -42
  123. package/dist/components/toggle.d.ts +25 -17
  124. package/dist/components/toggle.js +30 -28
  125. package/dist/components/tooltip.d.ts +24 -8
  126. package/dist/components/tooltip.js +29 -32
  127. package/dist/hooks/use-animated-value.d.ts +4 -1
  128. package/dist/hooks/use-animated-value.js +57 -36
  129. package/dist/hooks/use-copy-to-clipboard.d.ts +11 -5
  130. package/dist/hooks/use-copy-to-clipboard.js +39 -20
  131. package/dist/hooks/use-is-mobile.d.ts +4 -1
  132. package/dist/hooks/use-is-mobile.js +21 -1
  133. package/dist/hooks/use-media-query.d.ts +4 -1
  134. package/dist/hooks/use-media-query.js +45 -18
  135. package/dist/hooks/use-mutation-observer.d.ts +6 -2
  136. package/dist/hooks/use-mutation-observer.js +34 -16
  137. package/dist/hooks/use-pagination.d.ts +22 -14
  138. package/dist/hooks/use-pagination.js +100 -49
  139. package/dist/index.d.ts +69 -130
  140. package/dist/index.js +11 -11
  141. package/dist/primitives/checkbox-group.d.ts +105 -83
  142. package/dist/primitives/checkbox-group.js +111 -84
  143. package/dist/primitives/input-number.d.ts +51 -40
  144. package/dist/primitives/input-number.js +483 -350
  145. package/dist/primitives/input.d.ts +48 -42
  146. package/dist/primitives/input.js +65 -43
  147. package/dist/primitives/progress-circle.d.ts +79 -48
  148. package/dist/primitives/progress-circle.js +154 -105
  149. package/package.json +6 -7
@@ -1,148 +1,116 @@
1
1
  "use client";
2
- import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useAnimatedValue } from "../hooks/use-animated-value.js";
3
+ import { Indicator as ProgressCircleIndicator, ProgressCircle as ProgressCircle$1, ProgressCircleProvider, ProgressCircleSVG, ProgressCircleTrack, ProgressCircleValue } from "../primitives/progress-circle.js";
3
4
  import { tv } from "@codefast/tailwind-variants";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
4
6
  import { useCallback, useMemo } from "react";
5
- import { useAnimatedValue } from "../hooks/use-animated-value.js";
6
- import { Indicator, Provider, Root, SVG, Track, Value } from "../primitives/progress-circle.js";
7
+ //#region src/components/progress-circle.tsx
7
8
  const progressCircleVariants = tv({
8
- defaultVariants: {
9
- size: "md",
10
- thickness: "regular",
11
- variant: "default"
12
- },
13
- slots: {
14
- indicator: "origin-center",
15
- label: "absolute inset-0 flex items-center justify-center text-xs font-medium",
16
- root: "relative inline-flex items-center justify-center",
17
- svg: "size-full",
18
- track: "origin-center"
19
- },
20
- variants: {
21
- size: {
22
- sm: {
23
- label: "text-[0.625rem]"
24
- },
25
- md: {
26
- label: "text-xs"
27
- },
28
- lg: {
29
- label: "text-sm"
30
- },
31
- xl: {
32
- label: "text-base"
33
- },
34
- "2xl": {
35
- label: "text-lg"
36
- }
37
- },
38
- thickness: {
39
- regular: {},
40
- thick: {},
41
- thin: {}
42
- },
43
- variant: {
44
- default: {
45
- indicator: "text-primary",
46
- track: "text-primary/20"
47
- },
48
- destructive: {
49
- indicator: "text-destructive",
50
- track: "text-destructive/20"
51
- }
52
- }
53
- }
9
+ defaultVariants: {
10
+ size: "md",
11
+ thickness: "regular",
12
+ variant: "default"
13
+ },
14
+ slots: {
15
+ indicator: "origin-center",
16
+ label: "absolute inset-0 flex items-center justify-center text-xs font-medium",
17
+ root: "relative inline-flex items-center justify-center",
18
+ svg: "size-full",
19
+ track: "origin-center"
20
+ },
21
+ variants: {
22
+ size: {
23
+ sm: { label: "text-[0.625rem]" },
24
+ md: { label: "text-xs" },
25
+ lg: { label: "text-sm" },
26
+ xl: { label: "text-base" },
27
+ "2xl": { label: "text-lg" }
28
+ },
29
+ thickness: {
30
+ regular: {},
31
+ thick: {},
32
+ thin: {}
33
+ },
34
+ variant: {
35
+ default: {
36
+ indicator: "text-primary",
37
+ track: "text-primary/20"
38
+ },
39
+ destructive: {
40
+ indicator: "text-destructive",
41
+ track: "text-destructive/20"
42
+ }
43
+ }
44
+ }
54
45
  });
55
- function ProgressCircle({ animate = true, animationDuration = 1000, className, classNames, customLabel, showValue = false, size, sizeInPixels, strokeWidth, thickness = "regular", value = 0, variant = "default", ...props }) {
56
- const displayValue = useAnimatedValue(value, animationDuration, animate);
57
- const actualSize = useMemo(()=>sizeInPixels ?? getActualSize(size), [
58
- sizeInPixels,
59
- size
60
- ]);
61
- const actualThickness = useMemo(()=>strokeWidth ?? getStrokeWidth(thickness, actualSize), [
62
- strokeWidth,
63
- thickness,
64
- actualSize
65
- ]);
66
- const slots = useMemo(()=>progressCircleVariants({
67
- size,
68
- thickness,
69
- variant
70
- }), [
71
- variant,
72
- size,
73
- thickness
74
- ]);
75
- const shouldShowLabel = showValue || Boolean(customLabel);
76
- const renderLabel = useCallback(()=>{
77
- if (customLabel) return customLabel({
78
- value: displayValue
79
- });
80
- return `${displayValue.toString()}%`;
81
- }, [
82
- customLabel,
83
- displayValue
84
- ]);
85
- return /*#__PURE__*/ jsx(Provider, {
86
- size: actualSize,
87
- strokeWidth: actualThickness,
88
- value: value,
89
- ...props,
90
- children: /*#__PURE__*/ jsxs(Root, {
91
- className: slots.root({
92
- className: [
93
- className,
94
- classNames?.root
95
- ]
96
- }),
97
- children: [
98
- /*#__PURE__*/ jsxs(SVG, {
99
- className: slots.svg({
100
- className: classNames?.svg
101
- }),
102
- children: [
103
- /*#__PURE__*/ jsx(Track, {
104
- className: slots.track({
105
- className: classNames?.track
106
- })
107
- }),
108
- /*#__PURE__*/ jsx(Indicator, {
109
- className: slots.indicator({
110
- className: classNames?.indicator
111
- }),
112
- style: {
113
- transitionDuration: `${animationDuration.toString()}ms`,
114
- transitionProperty: "stroke-dashoffset"
115
- }
116
- })
117
- ]
118
- }),
119
- shouldShowLabel ? /*#__PURE__*/ jsx(Value, {
120
- className: slots.label({
121
- className: classNames?.label
122
- }),
123
- children: renderLabel()
124
- }) : null
125
- ]
126
- })
127
- });
46
+ function ProgressCircle({ animate = true, animationDuration = 1e3, className, classNames, customLabel, showValue = false, size, sizeInPixels, strokeWidth, thickness = "regular", value = 0, variant = "default", ...props }) {
47
+ const displayValue = useAnimatedValue(value, animationDuration, animate);
48
+ const actualSize = useMemo(() => sizeInPixels ?? getActualSize(size), [sizeInPixels, size]);
49
+ const actualThickness = useMemo(() => strokeWidth ?? getStrokeWidth(thickness, actualSize), [
50
+ strokeWidth,
51
+ thickness,
52
+ actualSize
53
+ ]);
54
+ const slots = useMemo(() => progressCircleVariants({
55
+ size,
56
+ thickness,
57
+ variant
58
+ }), [
59
+ variant,
60
+ size,
61
+ thickness
62
+ ]);
63
+ const shouldShowLabel = showValue || Boolean(customLabel);
64
+ const renderLabel = useCallback(() => {
65
+ if (customLabel) return customLabel({ value: displayValue });
66
+ return `${displayValue.toString()}%`;
67
+ }, [customLabel, displayValue]);
68
+ return /* @__PURE__ */ jsx(ProgressCircleProvider, {
69
+ size: actualSize,
70
+ strokeWidth: actualThickness,
71
+ value,
72
+ ...props,
73
+ children: /* @__PURE__ */ jsxs(ProgressCircle$1, {
74
+ className: slots.root({ className: [className, classNames?.root] }),
75
+ children: [/* @__PURE__ */ jsxs(ProgressCircleSVG, {
76
+ className: slots.svg({ className: classNames?.svg }),
77
+ children: [/* @__PURE__ */ jsx(ProgressCircleTrack, { className: slots.track({ className: classNames?.track }) }), /* @__PURE__ */ jsx(ProgressCircleIndicator, {
78
+ className: slots.indicator({ className: classNames?.indicator }),
79
+ style: {
80
+ transitionDuration: `${animationDuration.toString()}ms`,
81
+ transitionProperty: "stroke-dashoffset"
82
+ }
83
+ })]
84
+ }), shouldShowLabel ? /* @__PURE__ */ jsx(ProgressCircleValue, {
85
+ className: slots.label({ className: classNames?.label }),
86
+ children: renderLabel()
87
+ }) : null]
88
+ })
89
+ });
128
90
  }
129
91
  ProgressCircle.displayName = "ProgressCircle";
130
- const getActualSize = (size)=>{
131
- const sizeMap = {
132
- "2xl": 128,
133
- lg: 64,
134
- md: 48,
135
- sm: 32,
136
- xl: 96
137
- };
138
- return size ? sizeMap[size] : 48;
92
+ /**
93
+ * Maps size variants to actual pixel sizes
94
+ */
95
+ const getActualSize = (size) => {
96
+ return size ? {
97
+ "2xl": 128,
98
+ lg: 64,
99
+ md: 48,
100
+ sm: 32,
101
+ xl: 96
102
+ }[size] : 48;
139
103
  };
140
- const getStrokeWidth = (thickness, size)=>{
141
- const thicknessMap = {
142
- regular: Math.max(3, 0.05 * size),
143
- thick: Math.max(4, 0.075 * size),
144
- thin: Math.max(2, 0.025 * size)
145
- };
146
- return thickness ? thicknessMap[thickness] : Math.max(3, 0.05 * size);
104
+ /**
105
+ * Calculates stroke width based on thickness variant and circle size
106
+ */
107
+ const getStrokeWidth = (thickness, size) => {
108
+ const thicknessMap = {
109
+ regular: Math.max(3, size * .05),
110
+ thick: Math.max(4, size * .075),
111
+ thin: Math.max(2, size * .025)
112
+ };
113
+ return thickness ? thicknessMap[thickness] : Math.max(3, size * .05);
147
114
  };
115
+ //#endregion
148
116
  export { ProgressCircle, progressCircleVariants };
@@ -1,6 +1,12 @@
1
- import type { ComponentProps, JSX } from "react";
1
+ import { ComponentProps, JSX } from "react";
2
2
  import * as ProgressPrimitive from "@radix-ui/react-progress";
3
+
4
+ //#region src/components/progress.d.ts
3
5
  type ProgressProps = ComponentProps<typeof ProgressPrimitive.Root>;
4
- declare function Progress({ className, value, ...props }: ProgressProps): JSX.Element;
5
- export { Progress };
6
- export type { ProgressProps };
6
+ declare function Progress({
7
+ className,
8
+ value,
9
+ ...props
10
+ }: ProgressProps): JSX.Element;
11
+ //#endregion
12
+ export { Progress, type ProgressProps };
@@ -1,19 +1,19 @@
1
1
  "use client";
2
- import { jsx } from "react/jsx-runtime";
3
2
  import { cn } from "@codefast/tailwind-variants";
4
- import { Indicator, Root } from "@radix-ui/react-progress";
3
+ import { jsx } from "react/jsx-runtime";
4
+ import * as ProgressPrimitive from "@radix-ui/react-progress";
5
+ //#region src/components/progress.tsx
5
6
  function Progress({ className, value, ...props }) {
6
- return /*#__PURE__*/ jsx(Root, {
7
- className: cn("relative h-2 w-full overflow-hidden rounded-full bg-primary/20", className),
8
- "data-slot": "progress",
9
- ...props,
10
- children: /*#__PURE__*/ jsx(Indicator, {
11
- className: "size-full flex-1 bg-primary transition-all",
12
- "data-slot": "progress-indicator",
13
- style: {
14
- transform: `translateX(-${(100 - (value ?? 0)).toString()}%)`
15
- }
16
- })
17
- });
7
+ return /* @__PURE__ */ jsx(ProgressPrimitive.Root, {
8
+ className: cn("relative h-2 w-full overflow-hidden rounded-full bg-primary/20", className),
9
+ "data-slot": "progress",
10
+ ...props,
11
+ children: /* @__PURE__ */ jsx(ProgressPrimitive.Indicator, {
12
+ className: "size-full flex-1 bg-primary transition-all",
13
+ "data-slot": "progress-indicator",
14
+ style: { transform: `translateX(-${(100 - (value ?? 0)).toString()}%)` }
15
+ })
16
+ });
18
17
  }
18
+ //#endregion
19
19
  export { Progress };
@@ -1,8 +1,14 @@
1
- import type { ComponentProps, JSX } from "react";
1
+ import { ComponentProps, JSX } from "react";
2
2
  import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
3
+
4
+ //#region src/components/radio-cards.d.ts
3
5
  type RadioCardsProps = ComponentProps<typeof RadioGroupPrimitive.Root>;
4
6
  declare function RadioCards(props: RadioCardsProps): JSX.Element;
5
7
  type RadioCardsItemProps = ComponentProps<typeof RadioGroupPrimitive.Item>;
6
- declare function RadioCardsItem({ children, className, ...props }: RadioCardsItemProps): JSX.Element;
7
- export { RadioCards, RadioCardsItem };
8
- export type { RadioCardsItemProps, RadioCardsProps };
8
+ declare function RadioCardsItem({
9
+ children,
10
+ className,
11
+ ...props
12
+ }: RadioCardsItemProps): JSX.Element;
13
+ //#endregion
14
+ export { RadioCards, RadioCardsItem, type RadioCardsItemProps, type RadioCardsProps };
@@ -1,30 +1,29 @@
1
1
  "use client";
2
- import { jsx, jsxs } from "react/jsx-runtime";
3
- import { cn } from "@codefast/tailwind-variants";
4
- import { Indicator, Item, Root } from "@radix-ui/react-radio-group";
5
2
  import { Label } from "./label.js";
3
+ import { cn } from "@codefast/tailwind-variants";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
6
+ //#region src/components/radio-cards.tsx
6
7
  function RadioCards(props) {
7
- return /*#__PURE__*/ jsx(Root, {
8
- "data-slot": "radio-cards",
9
- ...props
10
- });
8
+ return /* @__PURE__ */ jsx(RadioGroupPrimitive.Root, {
9
+ "data-slot": "radio-cards",
10
+ ...props
11
+ });
11
12
  }
12
13
  function RadioCardsItem({ children, className, ...props }) {
13
- return /*#__PURE__*/ jsxs(Label, {
14
- className: "flex items-start gap-3 rounded-lg border border-input p-3 transition hover:not-has-disabled:not-has-aria-checked:bg-secondary has-focus-visible:border-ring has-disabled:opacity-50 has-aria-checked:border-primary has-aria-checked:bg-primary/10",
15
- "data-slot": "radio-card",
16
- children: [
17
- /*#__PURE__*/ jsx(Item, {
18
- className: cn("peer flex size-4 shrink-0 items-center justify-center rounded-full border border-input text-primary-foreground shadow-xs outline-hidden transition focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:not-aria-checked:border-ring aria-checked:border-primary aria-checked:bg-primary focus-visible:aria-checked:ring-primary/20 dark:bg-input/30 dark:focus-visible:aria-checked:ring-primary/40", className),
19
- "data-slot": "radio-card-item",
20
- ...props,
21
- children: /*#__PURE__*/ jsx(Indicator, {
22
- className: "size-1 rounded-full bg-background",
23
- "data-slot": "radio-card-indicator"
24
- })
25
- }),
26
- children
27
- ]
28
- });
14
+ return /* @__PURE__ */ jsxs(Label, {
15
+ className: "flex items-start gap-3 rounded-lg border border-input p-3 transition hover:not-has-disabled:not-has-aria-checked:bg-secondary has-focus-visible:border-ring has-disabled:opacity-50 has-aria-checked:border-primary has-aria-checked:bg-primary/10",
16
+ "data-slot": "radio-card",
17
+ children: [/* @__PURE__ */ jsx(RadioGroupPrimitive.Item, {
18
+ className: cn("peer flex size-4 shrink-0 items-center justify-center rounded-full border border-input text-primary-foreground shadow-xs outline-hidden transition focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:not-aria-checked:border-ring aria-checked:border-primary aria-checked:bg-primary focus-visible:aria-checked:ring-primary/20 dark:bg-input/30 dark:focus-visible:aria-checked:ring-primary/40", className),
19
+ "data-slot": "radio-card-item",
20
+ ...props,
21
+ children: /* @__PURE__ */ jsx(RadioGroupPrimitive.Indicator, {
22
+ className: "size-1 rounded-full bg-background",
23
+ "data-slot": "radio-card-indicator"
24
+ })
25
+ }), children]
26
+ });
29
27
  }
28
+ //#endregion
30
29
  export { RadioCards, RadioCardsItem };
@@ -1,8 +1,16 @@
1
- import type { ComponentProps, JSX } from "react";
1
+ import { ComponentProps, JSX } from "react";
2
2
  import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
3
+
4
+ //#region src/components/radio-group.d.ts
3
5
  type RadioGroupProps = ComponentProps<typeof RadioGroupPrimitive.Root>;
4
- declare function RadioGroup({ className, ...props }: RadioGroupProps): JSX.Element;
6
+ declare function RadioGroup({
7
+ className,
8
+ ...props
9
+ }: RadioGroupProps): JSX.Element;
5
10
  type RadioGroupItemProps = ComponentProps<typeof RadioGroupPrimitive.Item>;
6
- declare function RadioGroupItem({ className, ...props }: RadioGroupItemProps): JSX.Element;
7
- export { RadioGroup, RadioGroupItem };
8
- export type { RadioGroupItemProps, RadioGroupProps };
11
+ declare function RadioGroupItem({
12
+ className,
13
+ ...props
14
+ }: RadioGroupItemProps): JSX.Element;
15
+ //#endregion
16
+ export { RadioGroup, RadioGroupItem, type RadioGroupItemProps, type RadioGroupProps };
@@ -1,23 +1,25 @@
1
1
  "use client";
2
- import { jsx } from "react/jsx-runtime";
3
2
  import { cn } from "@codefast/tailwind-variants";
4
- import { Indicator, Item, Root } from "@radix-ui/react-radio-group";
3
+ import { jsx } from "react/jsx-runtime";
4
+ import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
5
+ //#region src/components/radio-group.tsx
5
6
  function RadioGroup({ className, ...props }) {
6
- return /*#__PURE__*/ jsx(Root, {
7
- className: cn("grid gap-2", className),
8
- "data-slot": "radio-group",
9
- ...props
10
- });
7
+ return /* @__PURE__ */ jsx(RadioGroupPrimitive.Root, {
8
+ className: cn("grid gap-2", className),
9
+ "data-slot": "radio-group",
10
+ ...props
11
+ });
11
12
  }
12
13
  function RadioGroupItem({ className, ...props }) {
13
- return /*#__PURE__*/ jsx(Item, {
14
- className: cn("peer inline-flex size-4 shrink-0 items-center justify-center rounded-full border border-input shadow-xs outline-hidden transition hover:not-disabled:not-aria-checked:border-ring/60 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:opacity-50 aria-checked:border-primary aria-checked:bg-primary focus-visible:aria-checked:ring-primary/20 aria-invalid:border-destructive aria-invalid:ring-destructive/20 hover:not-disabled:not-aria-checked:aria-invalid:border-destructive/60 aria-checked:aria-invalid:bg-destructive dark:bg-input/30 dark:focus-visible:aria-checked:ring-primary/40 dark:aria-invalid:ring-destructive/40", className),
15
- "data-slot": "radio-group-item",
16
- ...props,
17
- children: /*#__PURE__*/ jsx(Indicator, {
18
- className: "size-1 rounded-full bg-background",
19
- "data-slot": "radio-group-indicator"
20
- })
21
- });
14
+ return /* @__PURE__ */ jsx(RadioGroupPrimitive.Item, {
15
+ className: cn("peer inline-flex size-4 shrink-0 items-center justify-center rounded-full border border-input shadow-xs outline-hidden transition hover:not-disabled:not-aria-checked:border-ring/60 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:opacity-50 aria-checked:border-primary aria-checked:bg-primary focus-visible:aria-checked:ring-primary/20 aria-invalid:border-destructive aria-invalid:ring-destructive/20 hover:not-disabled:not-aria-checked:aria-invalid:border-destructive/60 aria-checked:aria-invalid:bg-destructive dark:bg-input/30 dark:focus-visible:aria-checked:ring-primary/40 dark:aria-invalid:ring-destructive/40", className),
16
+ "data-slot": "radio-group-item",
17
+ ...props,
18
+ children: /* @__PURE__ */ jsx(RadioGroupPrimitive.Indicator, {
19
+ className: "size-1 rounded-full bg-background",
20
+ "data-slot": "radio-group-indicator"
21
+ })
22
+ });
22
23
  }
24
+ //#endregion
23
25
  export { RadioGroup, RadioGroupItem };
@@ -1,7 +1,14 @@
1
- import type { ComponentProps, JSX } from "react";
1
+ import { ComponentProps, JSX } from "react";
2
+
3
+ //#region src/components/radio.d.ts
2
4
  interface RadioProps extends Omit<ComponentProps<"input">, "type"> {
3
- onValueChange?: (value: string) => void;
5
+ onValueChange?: (value: string) => void;
4
6
  }
5
- declare function Radio({ className, onChange, onValueChange, ...props }: RadioProps): JSX.Element;
6
- export { Radio };
7
- export type { RadioProps };
7
+ declare function Radio({
8
+ className,
9
+ onChange,
10
+ onValueChange,
11
+ ...props
12
+ }: RadioProps): JSX.Element;
13
+ //#endregion
14
+ export { Radio, type RadioProps };
@@ -1,14 +1,16 @@
1
1
  "use client";
2
- import { jsx } from "react/jsx-runtime";
3
2
  import { cn } from "@codefast/tailwind-variants";
3
+ import { jsx } from "react/jsx-runtime";
4
4
  import { composeEventHandlers } from "@radix-ui/primitive";
5
+ //#region src/components/radio.tsx
5
6
  function Radio({ className, onChange, onValueChange, ...props }) {
6
- return /*#__PURE__*/ jsx("input", {
7
- className: cn("peer inline-flex size-4 shrink-0 appearance-none items-center justify-center rounded-full border border-input shadow-xs outline-hidden after:size-full after:rounded-full after:bg-background after:transition-[width,height] checked:border-primary checked:bg-primary checked:after:size-1 hover:not-disabled:not-checked:border-ring/60 focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:not-checked:border-ring focus-visible:checked:ring-primary/20 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 checked:aria-invalid:bg-destructive hover:not-disabled:not-checked:aria-invalid:border-destructive/60 dark:not-checked:after:bg-input/30 dark:focus-visible:checked:ring-primary/40 dark:aria-invalid:ring-destructive/40", className),
8
- "data-slot": "radio",
9
- type: "radio",
10
- onChange: composeEventHandlers(onChange, (event)=>onValueChange?.(event.currentTarget.value)),
11
- ...props
12
- });
7
+ return /* @__PURE__ */ jsx("input", {
8
+ className: cn("peer inline-flex size-4 shrink-0 appearance-none items-center justify-center rounded-full border border-input shadow-xs outline-hidden after:size-full after:rounded-full after:bg-background after:transition-[width,height] checked:border-primary checked:bg-primary checked:after:size-1 hover:not-disabled:not-checked:border-ring/60 focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:not-checked:border-ring focus-visible:checked:ring-primary/20 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 checked:aria-invalid:bg-destructive hover:not-disabled:not-checked:aria-invalid:border-destructive/60 dark:not-checked:after:bg-input/30 dark:focus-visible:checked:ring-primary/40 dark:aria-invalid:ring-destructive/40", className),
9
+ "data-slot": "radio",
10
+ type: "radio",
11
+ onChange: composeEventHandlers(onChange, (event) => onValueChange?.(event.currentTarget.value)),
12
+ ...props
13
+ });
13
14
  }
15
+ //#endregion
14
16
  export { Radio };
@@ -1,12 +1,23 @@
1
- import type { ComponentProps, JSX } from "react";
1
+ import { ComponentProps, JSX } from "react";
2
2
  import * as ResizablePrimitive from "react-resizable-panels";
3
+
4
+ //#region src/components/resizable.d.ts
3
5
  type ResizableGroupProps = ComponentProps<typeof ResizablePrimitive.Group>;
4
- declare function ResizableGroup({ className, ...props }: ResizableGroupProps): JSX.Element;
6
+ declare function ResizableGroup({
7
+ className,
8
+ ...props
9
+ }: ResizableGroupProps): JSX.Element;
5
10
  type ResizablePanelProps = ComponentProps<typeof ResizablePrimitive.Panel>;
6
- declare function ResizablePanel({ ...props }: ResizablePanelProps): JSX.Element;
11
+ declare function ResizablePanel({
12
+ ...props
13
+ }: ResizablePanelProps): JSX.Element;
7
14
  interface ResizableSeparatorProps extends ComponentProps<typeof ResizablePrimitive.Separator> {
8
- withHandle?: boolean;
15
+ withHandle?: boolean;
9
16
  }
10
- declare function ResizableSeparator({ className, withHandle, ...props }: ResizableSeparatorProps): JSX.Element;
11
- export { ResizableGroup, ResizablePanel, ResizableSeparator };
12
- export type { ResizableGroupProps, ResizablePanelProps, ResizableSeparatorProps };
17
+ declare function ResizableSeparator({
18
+ className,
19
+ withHandle,
20
+ ...props
21
+ }: ResizableSeparatorProps): JSX.Element;
22
+ //#endregion
23
+ export { ResizableGroup, type ResizableGroupProps, ResizablePanel, type ResizablePanelProps, ResizableSeparator, type ResizableSeparatorProps };
@@ -1,32 +1,32 @@
1
1
  "use client";
2
- import { jsx } from "react/jsx-runtime";
3
2
  import { cn } from "@codefast/tailwind-variants";
4
3
  import { GripVerticalIcon } from "lucide-react";
5
- import { Group, Panel, Separator } from "react-resizable-panels";
4
+ import { jsx } from "react/jsx-runtime";
5
+ import * as ResizablePrimitive from "react-resizable-panels";
6
+ //#region src/components/resizable.tsx
6
7
  function ResizableGroup({ className, ...props }) {
7
- return /*#__PURE__*/ jsx(Group, {
8
- className: cn("flex size-full", className),
9
- "data-slot": "resizable-group",
10
- ...props
11
- });
8
+ return /* @__PURE__ */ jsx(ResizablePrimitive.Group, {
9
+ className: cn("flex size-full", className),
10
+ "data-slot": "resizable-group",
11
+ ...props
12
+ });
12
13
  }
13
14
  function ResizablePanel({ ...props }) {
14
- return /*#__PURE__*/ jsx(Panel, {
15
- "data-slot": "resizable-panel",
16
- ...props
17
- });
15
+ return /* @__PURE__ */ jsx(ResizablePrimitive.Panel, {
16
+ "data-slot": "resizable-panel",
17
+ ...props
18
+ });
18
19
  }
19
20
  function ResizableSeparator({ className, withHandle, ...props }) {
20
- return /*#__PURE__*/ jsx(Separator, {
21
- className: cn("flex items-center justify-center bg-border outline-hidden focus-visible:bg-ring focus-visible:ring-3 focus-visible:ring-ring/50", "aria-[orientation=vertical]:w-px", "aria-[orientation=horizontal]:h-px", className),
22
- "data-slot": "resizable-separator",
23
- ...props,
24
- children: withHandle ? /*#__PURE__*/ jsx("div", {
25
- className: "z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",
26
- children: /*#__PURE__*/ jsx(GripVerticalIcon, {
27
- className: "size-2.5"
28
- })
29
- }) : null
30
- });
21
+ return /* @__PURE__ */ jsx(ResizablePrimitive.Separator, {
22
+ className: cn("flex items-center justify-center bg-border outline-hidden focus-visible:bg-ring focus-visible:ring-3 focus-visible:ring-ring/50", "aria-[orientation=vertical]:w-px", "aria-[orientation=horizontal]:h-px", className),
23
+ "data-slot": "resizable-separator",
24
+ ...props,
25
+ children: withHandle ? /* @__PURE__ */ jsx("div", {
26
+ className: "z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",
27
+ children: /* @__PURE__ */ jsx(GripVerticalIcon, { className: "size-2.5" })
28
+ }) : null
29
+ });
31
30
  }
31
+ //#endregion
32
32
  export { ResizableGroup, ResizablePanel, ResizableSeparator };