@foundrykit/primitives 2.1.3 → 2.3.0

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 (196) hide show
  1. package/README.md +11 -0
  2. package/dist/{chunk-SEDTBIZW.js → chunk-OMPTY5WQ.js} +1 -1
  3. package/dist/components/accordion/index.js +60 -6
  4. package/dist/components/alert/index.js +62 -6
  5. package/dist/components/alert-dialog/index.js +142 -13
  6. package/dist/components/aspect-ratio/index.js +9 -3
  7. package/dist/components/avatar/index.js +50 -5
  8. package/dist/components/badge/index.js +37 -4
  9. package/dist/components/breadcrumb/index.js +95 -9
  10. package/dist/components/button/index.js +1 -1
  11. package/dist/components/button-group/index.js +74 -6
  12. package/dist/components/card/index.js +66 -8
  13. package/dist/components/checkbox/index.js +30 -3
  14. package/dist/components/collapsible/index.js +33 -7
  15. package/dist/components/context-menu/index.js +208 -17
  16. package/dist/components/dialog/index.js +126 -12
  17. package/dist/components/direction/index.js +10 -2
  18. package/dist/components/drawer/index.js +118 -12
  19. package/dist/components/dropdown/index.js +216 -17
  20. package/dist/components/empty/index.js +95 -9
  21. package/dist/components/field/index.js +211 -13
  22. package/dist/components/hover-card/index.js +35 -5
  23. package/dist/components/input-group/index.d.ts +1 -1
  24. package/dist/components/input-group/index.js +1 -1
  25. package/dist/components/item/index.js +178 -14
  26. package/dist/components/kbd/index.js +27 -4
  27. package/dist/components/label/index.js +21 -3
  28. package/dist/components/menubar/index.js +235 -18
  29. package/dist/components/native-select/index.js +25 -3
  30. package/dist/components/navigation-menu/index.js +161 -11
  31. package/dist/components/popover/index.js +40 -6
  32. package/dist/components/progress/index.js +30 -3
  33. package/dist/components/radio-group/index.js +43 -4
  34. package/dist/components/resizable/index.js +43 -5
  35. package/dist/components/scroll-area/index.js +58 -4
  36. package/dist/components/section/index.js +13 -3
  37. package/dist/components/select/index.js +159 -12
  38. package/dist/components/sheet/index.js +118 -10
  39. package/dist/components/skeleton/index.js +13 -3
  40. package/dist/components/slider/index.js +64 -3
  41. package/dist/components/sonner/index.js +21 -4
  42. package/dist/components/spinner/index.js +19 -3
  43. package/dist/components/switch/index.js +30 -3
  44. package/dist/components/table/index.js +105 -10
  45. package/dist/components/tabs/index.js +63 -6
  46. package/dist/components/toggle/index.js +41 -4
  47. package/dist/components/toggle-group/index.js +80 -4
  48. package/dist/components/tooltip/index.js +51 -6
  49. package/dist/components/typography/index.js +147 -14
  50. package/dist/index.d.ts +1 -0
  51. package/dist/index.js +221 -254
  52. package/package.json +3 -3
  53. package/dist/chunk-25N35Z5M.js +0 -42
  54. package/dist/chunk-2JOT4DV4.js +0 -66
  55. package/dist/chunk-2SBGU5XA.js +0 -233
  56. package/dist/chunk-2UG6OCGA.js +0 -75
  57. package/dist/chunk-3BAO7TAS.js +0 -105
  58. package/dist/chunk-3NQR7JZR.js +0 -128
  59. package/dist/chunk-3QUMCM5K.js +0 -225
  60. package/dist/chunk-3TZXV53R.js +0 -55
  61. package/dist/chunk-3UKWAM5M.js +0 -33
  62. package/dist/chunk-44I6VK3H.js +0 -105
  63. package/dist/chunk-67UXTT4O.js +0 -116
  64. package/dist/chunk-727ACUWN.js +0 -82
  65. package/dist/chunk-76APYFRN.js +0 -29
  66. package/dist/chunk-AJAAMJYH.js +0 -12
  67. package/dist/chunk-B5YCE3UP.js +0 -57
  68. package/dist/chunk-BIFBYERK.js +0 -69
  69. package/dist/chunk-DXZ4GUQO.js +0 -33
  70. package/dist/chunk-ED6T7ZZN.js +0 -130
  71. package/dist/chunk-EEAK2RWF.js +0 -23
  72. package/dist/chunk-F2TEA6ER.js +0 -138
  73. package/dist/chunk-FF5D53KL.js +0 -69
  74. package/dist/chunk-FRIOQFPE.js +0 -171
  75. package/dist/chunk-G2YBCHWR.js +0 -46
  76. package/dist/chunk-GKCBSG2W.js +0 -67
  77. package/dist/chunk-GPEL656S.js +0 -84
  78. package/dist/chunk-JKKCRFYB.js +0 -36
  79. package/dist/chunk-JTSIBZS4.js +0 -194
  80. package/dist/chunk-MCXSVXO4.js +0 -24
  81. package/dist/chunk-MMZJQ7RW.js +0 -33
  82. package/dist/chunk-MYIUX3DT.js +0 -62
  83. package/dist/chunk-P5KEJOBH.js +0 -155
  84. package/dist/chunk-PAO3DSEF.js +0 -48
  85. package/dist/chunk-PLLG76QJ.js +0 -32
  86. package/dist/chunk-SDYKJVXX.js +0 -253
  87. package/dist/chunk-SIQHWNPH.js +0 -45
  88. package/dist/chunk-SKR3J46C.js +0 -17
  89. package/dist/chunk-STRBREHN.js +0 -17
  90. package/dist/chunk-SUEPE6OX.js +0 -47
  91. package/dist/chunk-TA23RNS4.js +0 -162
  92. package/dist/chunk-TRXU4SOJ.js +0 -224
  93. package/dist/chunk-U7JIOR7A.js +0 -172
  94. package/dist/chunk-VPBVKBZ7.js +0 -25
  95. package/dist/chunk-W4XY3SNY.js +0 -40
  96. package/dist/chunk-YT2ZIMZI.js +0 -16
  97. package/dist/components/accordion/index.cjs +0 -104
  98. package/dist/components/accordion/index.d.cts +0 -25
  99. package/dist/components/alert/index.cjs +0 -96
  100. package/dist/components/alert/index.d.cts +0 -28
  101. package/dist/components/alert-dialog/index.cjs +0 -200
  102. package/dist/components/alert-dialog/index.d.cts +0 -42
  103. package/dist/components/aspect-ratio/index.cjs +0 -47
  104. package/dist/components/aspect-ratio/index.d.cts +0 -19
  105. package/dist/components/avatar/index.cjs +0 -92
  106. package/dist/components/avatar/index.d.cts +0 -24
  107. package/dist/components/badge/index.cjs +0 -67
  108. package/dist/components/badge/index.d.cts +0 -24
  109. package/dist/components/breadcrumb/index.cjs +0 -135
  110. package/dist/components/breadcrumb/index.d.cts +0 -33
  111. package/dist/components/button/index.cjs +0 -87
  112. package/dist/components/button/index.d.cts +0 -28
  113. package/dist/components/button-group/index.cjs +0 -142
  114. package/dist/components/button-group/index.d.cts +0 -33
  115. package/dist/components/card/index.cjs +0 -104
  116. package/dist/components/card/index.d.cts +0 -27
  117. package/dist/components/checkbox/index.cjs +0 -68
  118. package/dist/components/checkbox/index.d.cts +0 -17
  119. package/dist/components/collapsible/index.cjs +0 -73
  120. package/dist/components/collapsible/index.d.cts +0 -22
  121. package/dist/components/context-menu/index.cjs +0 -274
  122. package/dist/components/context-menu/index.d.cts +0 -48
  123. package/dist/components/dialog/index.cjs +0 -182
  124. package/dist/components/dialog/index.d.cts +0 -38
  125. package/dist/components/direction/index.cjs +0 -39
  126. package/dist/components/direction/index.d.cts +0 -20
  127. package/dist/components/drawer/index.cjs +0 -164
  128. package/dist/components/drawer/index.d.cts +0 -35
  129. package/dist/components/dropdown/index.cjs +0 -282
  130. package/dist/components/dropdown/index.d.cts +0 -52
  131. package/dist/components/empty/index.cjs +0 -135
  132. package/dist/components/empty/index.d.cts +0 -38
  133. package/dist/components/field/index.cjs +0 -269
  134. package/dist/components/field/index.d.cts +0 -42
  135. package/dist/components/hover-card/index.cjs +0 -77
  136. package/dist/components/hover-card/index.d.cts +0 -22
  137. package/dist/components/input/index.cjs +0 -47
  138. package/dist/components/input/index.d.cts +0 -17
  139. package/dist/components/input-group/index.cjs +0 -270
  140. package/dist/components/input-group/index.d.cts +0 -44
  141. package/dist/components/item/index.cjs +0 -262
  142. package/dist/components/item/index.d.cts +0 -47
  143. package/dist/components/kbd/index.cjs +0 -57
  144. package/dist/components/kbd/index.d.cts +0 -19
  145. package/dist/components/label/index.cjs +0 -59
  146. package/dist/components/label/index.d.cts +0 -16
  147. package/dist/components/menubar/index.cjs +0 -303
  148. package/dist/components/menubar/index.d.cts +0 -49
  149. package/dist/components/native-select/index.cjs +0 -53
  150. package/dist/components/native-select/index.d.cts +0 -19
  151. package/dist/components/navigation-menu/index.cjs +0 -215
  152. package/dist/components/navigation-menu/index.d.cts +0 -37
  153. package/dist/components/popover/index.cjs +0 -84
  154. package/dist/components/popover/index.d.cts +0 -23
  155. package/dist/components/progress/index.cjs +0 -68
  156. package/dist/components/progress/index.d.cts +0 -16
  157. package/dist/components/radio-group/index.cjs +0 -83
  158. package/dist/components/radio-group/index.d.cts +0 -22
  159. package/dist/components/resizable/index.cjs +0 -75
  160. package/dist/components/resizable/index.d.cts +0 -25
  161. package/dist/components/scroll-area/index.cjs +0 -98
  162. package/dist/components/scroll-area/index.d.cts +0 -21
  163. package/dist/components/section/index.cjs +0 -41
  164. package/dist/components/section/index.d.cts +0 -27
  165. package/dist/components/select/index.cjs +0 -215
  166. package/dist/components/select/index.d.cts +0 -36
  167. package/dist/components/separator/index.cjs +0 -63
  168. package/dist/components/separator/index.d.cts +0 -18
  169. package/dist/components/sheet/index.cjs +0 -170
  170. package/dist/components/sheet/index.d.cts +0 -31
  171. package/dist/components/skeleton/index.cjs +0 -41
  172. package/dist/components/skeleton/index.d.cts +0 -14
  173. package/dist/components/slider/index.cjs +0 -102
  174. package/dist/components/slider/index.d.cts +0 -19
  175. package/dist/components/sonner/index.cjs +0 -51
  176. package/dist/components/sonner/index.d.cts +0 -18
  177. package/dist/components/spinner/index.cjs +0 -47
  178. package/dist/components/spinner/index.d.cts +0 -17
  179. package/dist/components/switch/index.cjs +0 -68
  180. package/dist/components/switch/index.d.cts +0 -17
  181. package/dist/components/table/index.cjs +0 -147
  182. package/dist/components/table/index.d.cts +0 -35
  183. package/dist/components/tabs/index.cjs +0 -107
  184. package/dist/components/tabs/index.d.cts +0 -27
  185. package/dist/components/textarea/index.cjs +0 -44
  186. package/dist/components/textarea/index.d.cts +0 -15
  187. package/dist/components/toggle/index.cjs +0 -81
  188. package/dist/components/toggle/index.d.cts +0 -26
  189. package/dist/components/toggle-group/index.cjs +0 -120
  190. package/dist/components/toggle-group/index.d.cts +0 -27
  191. package/dist/components/tooltip/index.cjs +0 -95
  192. package/dist/components/tooltip/index.d.cts +0 -25
  193. package/dist/components/typography/index.cjs +0 -197
  194. package/dist/components/typography/index.d.cts +0 -28
  195. package/dist/index.cjs +0 -4094
  196. package/dist/index.d.cts +0 -83
@@ -1,57 +0,0 @@
1
- // src/components/tooltip/index.tsx
2
- import { cn } from "@foundrykit/utils";
3
- import * as TooltipPrimitive from "@radix-ui/react-tooltip";
4
- import { jsx, jsxs } from "react/jsx-runtime";
5
- function TooltipProvider({
6
- delayDuration = 0,
7
- ...props
8
- }) {
9
- return /* @__PURE__ */ jsx(
10
- TooltipPrimitive.Provider,
11
- {
12
- "data-slot": "tooltip-provider",
13
- delayDuration,
14
- ...props
15
- }
16
- );
17
- }
18
- function Tooltip({
19
- ...props
20
- }) {
21
- return /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsx(TooltipPrimitive.Root, { "data-slot": "tooltip", ...props }) });
22
- }
23
- function TooltipTrigger({
24
- ...props
25
- }) {
26
- return /* @__PURE__ */ jsx(TooltipPrimitive.Trigger, { "data-slot": "tooltip-trigger", ...props });
27
- }
28
- function TooltipContent({
29
- className,
30
- sideOffset = 0,
31
- children,
32
- ...props
33
- }) {
34
- return /* @__PURE__ */ jsx(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
35
- TooltipPrimitive.Content,
36
- {
37
- "data-slot": "tooltip-content",
38
- sideOffset,
39
- className: cn(
40
- "bg-primary text-primary-foreground animate-in fade-in-0 motion-safe:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=left]:slide-in-from-right-2 motion-safe:data-[side=right]:slide-in-from-left-2 motion-safe:data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",
41
- className
42
- ),
43
- ...props,
44
- children: [
45
- children,
46
- /* @__PURE__ */ jsx(TooltipPrimitive.Arrow, { className: "bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" })
47
- ]
48
- }
49
- ) });
50
- }
51
-
52
- export {
53
- TooltipProvider,
54
- Tooltip,
55
- TooltipTrigger,
56
- TooltipContent
57
- };
@@ -1,69 +0,0 @@
1
- // src/components/alert/index.tsx
2
- import { cn } from "@foundrykit/utils";
3
- import { cva } from "class-variance-authority";
4
- import { jsx } from "react/jsx-runtime";
5
- var alertVariants = cva(
6
- "relative grid w-full grid-cols-[0_1fr] items-start gap-y-0.5 rounded-lg border px-4 py-3 text-sm has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] has-[>svg]:gap-x-3 [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",
7
- {
8
- variants: {
9
- variant: {
10
- default: "bg-background text-foreground",
11
- destructive: "text-destructive bg-background *:data-[slot=alert-description]:text-destructive/90 [&>svg]:text-current"
12
- }
13
- },
14
- defaultVariants: {
15
- variant: "default"
16
- }
17
- }
18
- );
19
- function Alert({
20
- className,
21
- variant,
22
- ...props
23
- }) {
24
- return /* @__PURE__ */ jsx(
25
- "div",
26
- {
27
- "data-slot": "alert",
28
- role: "alert",
29
- className: cn(alertVariants({ variant }), className),
30
- ...props
31
- }
32
- );
33
- }
34
- function AlertTitle({ className, ...props }) {
35
- return /* @__PURE__ */ jsx(
36
- "div",
37
- {
38
- "data-slot": "alert-title",
39
- className: cn(
40
- "col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",
41
- className
42
- ),
43
- ...props
44
- }
45
- );
46
- }
47
- function AlertDescription({
48
- className,
49
- ...props
50
- }) {
51
- return /* @__PURE__ */ jsx(
52
- "div",
53
- {
54
- "data-slot": "alert-description",
55
- className: cn(
56
- "text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",
57
- className
58
- ),
59
- ...props
60
- }
61
- );
62
- }
63
-
64
- export {
65
- alertVariants,
66
- Alert,
67
- AlertTitle,
68
- AlertDescription
69
- };
@@ -1,33 +0,0 @@
1
- // src/components/switch/index.tsx
2
- import { cn } from "@foundrykit/utils";
3
- import * as SwitchPrimitive from "@radix-ui/react-switch";
4
- import { jsx } from "react/jsx-runtime";
5
- function Switch({
6
- className,
7
- ...props
8
- }) {
9
- return /* @__PURE__ */ jsx(
10
- SwitchPrimitive.Root,
11
- {
12
- "data-slot": "switch",
13
- className: cn(
14
- "data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 peer inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
15
- className
16
- ),
17
- ...props,
18
- children: /* @__PURE__ */ jsx(
19
- SwitchPrimitive.Thumb,
20
- {
21
- "data-slot": "switch-thumb",
22
- className: cn(
23
- "bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0"
24
- )
25
- }
26
- )
27
- }
28
- );
29
- }
30
-
31
- export {
32
- Switch
33
- };
@@ -1,130 +0,0 @@
1
- // src/components/drawer/index.tsx
2
- import { cn } from "@foundrykit/utils";
3
- import { Drawer as DrawerPrimitive } from "vaul";
4
- import { jsx, jsxs } from "react/jsx-runtime";
5
- function Drawer({
6
- ...props
7
- }) {
8
- return /* @__PURE__ */ jsx(DrawerPrimitive.Root, { "data-slot": "drawer", ...props });
9
- }
10
- function DrawerTrigger({
11
- ...props
12
- }) {
13
- return /* @__PURE__ */ jsx(DrawerPrimitive.Trigger, { "data-slot": "drawer-trigger", ...props });
14
- }
15
- function DrawerPortal({
16
- ...props
17
- }) {
18
- return /* @__PURE__ */ jsx(DrawerPrimitive.Portal, { "data-slot": "drawer-portal", ...props });
19
- }
20
- function DrawerClose({
21
- ...props
22
- }) {
23
- return /* @__PURE__ */ jsx(DrawerPrimitive.Close, { "data-slot": "drawer-close", ...props });
24
- }
25
- function DrawerOverlay({
26
- className,
27
- ...props
28
- }) {
29
- return /* @__PURE__ */ jsx(
30
- DrawerPrimitive.Overlay,
31
- {
32
- "data-slot": "drawer-overlay",
33
- className: cn(
34
- "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
35
- className
36
- ),
37
- ...props
38
- }
39
- );
40
- }
41
- function DrawerContent({
42
- className,
43
- children,
44
- ...props
45
- }) {
46
- return /* @__PURE__ */ jsxs(DrawerPortal, { children: [
47
- /* @__PURE__ */ jsx(DrawerOverlay, {}),
48
- /* @__PURE__ */ jsxs(
49
- DrawerPrimitive.Content,
50
- {
51
- "data-slot": "drawer-content",
52
- className: cn(
53
- "group/drawer-content bg-background fixed z-50 flex h-auto flex-col",
54
- "data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg data-[vaul-drawer-direction=top]:border-b",
55
- "data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg data-[vaul-drawer-direction=bottom]:border-t",
56
- "data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=right]:sm:max-w-sm",
57
- "data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:sm:max-w-sm",
58
- className
59
- ),
60
- ...props,
61
- children: [
62
- /* @__PURE__ */ jsx("div", { className: "bg-muted mx-auto mt-4 hidden h-2 w-[100px] shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block" }),
63
- children
64
- ]
65
- }
66
- )
67
- ] });
68
- }
69
- function DrawerHeader({ className, ...props }) {
70
- return /* @__PURE__ */ jsx(
71
- "div",
72
- {
73
- "data-slot": "drawer-header",
74
- className: cn(
75
- "flex flex-col gap-0.5 p-4 group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center group-data-[vaul-drawer-direction=top]/drawer-content:text-center md:gap-1.5 md:text-left",
76
- className
77
- ),
78
- ...props
79
- }
80
- );
81
- }
82
- function DrawerFooter({ className, ...props }) {
83
- return /* @__PURE__ */ jsx(
84
- "div",
85
- {
86
- "data-slot": "drawer-footer",
87
- className: cn("mt-auto flex flex-col gap-2 p-4", className),
88
- ...props
89
- }
90
- );
91
- }
92
- function DrawerTitle({
93
- className,
94
- ...props
95
- }) {
96
- return /* @__PURE__ */ jsx(
97
- DrawerPrimitive.Title,
98
- {
99
- "data-slot": "drawer-title",
100
- className: cn("text-foreground font-semibold", className),
101
- ...props
102
- }
103
- );
104
- }
105
- function DrawerDescription({
106
- className,
107
- ...props
108
- }) {
109
- return /* @__PURE__ */ jsx(
110
- DrawerPrimitive.Description,
111
- {
112
- "data-slot": "drawer-description",
113
- className: cn("text-muted-foreground text-sm", className),
114
- ...props
115
- }
116
- );
117
- }
118
-
119
- export {
120
- Drawer,
121
- DrawerTrigger,
122
- DrawerPortal,
123
- DrawerClose,
124
- DrawerOverlay,
125
- DrawerContent,
126
- DrawerHeader,
127
- DrawerFooter,
128
- DrawerTitle,
129
- DrawerDescription
130
- };
@@ -1,23 +0,0 @@
1
- // src/components/spinner/index.tsx
2
- import { cn } from "@foundrykit/utils";
3
- import { Loader2Icon } from "lucide-react";
4
- import { jsx } from "react/jsx-runtime";
5
- function Spinner({
6
- className,
7
- ...props
8
- }) {
9
- return /* @__PURE__ */ jsx(
10
- Loader2Icon,
11
- {
12
- role: "status",
13
- "aria-label": "Loading",
14
- "data-slot": "spinner",
15
- className: cn("size-4 animate-spin", className),
16
- ...props
17
- }
18
- );
19
- }
20
-
21
- export {
22
- Spinner
23
- };
@@ -1,138 +0,0 @@
1
- // src/components/dialog/index.tsx
2
- import { cn } from "@foundrykit/utils";
3
- import * as DialogPrimitive from "@radix-ui/react-dialog";
4
- import { XIcon } from "lucide-react";
5
- import { jsx, jsxs } from "react/jsx-runtime";
6
- function Dialog({
7
- ...props
8
- }) {
9
- return /* @__PURE__ */ jsx(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
10
- }
11
- function DialogTrigger({
12
- ...props
13
- }) {
14
- return /* @__PURE__ */ jsx(DialogPrimitive.Trigger, { "data-slot": "dialog-trigger", ...props });
15
- }
16
- function DialogPortal({
17
- ...props
18
- }) {
19
- return /* @__PURE__ */ jsx(DialogPrimitive.Portal, { "data-slot": "dialog-portal", ...props });
20
- }
21
- function DialogClose({
22
- ...props
23
- }) {
24
- return /* @__PURE__ */ jsx(DialogPrimitive.Close, { "data-slot": "dialog-close", ...props });
25
- }
26
- function DialogOverlay({
27
- className,
28
- ...props
29
- }) {
30
- return /* @__PURE__ */ jsx(
31
- DialogPrimitive.Overlay,
32
- {
33
- "data-slot": "dialog-overlay",
34
- className: cn(
35
- "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
36
- className
37
- ),
38
- ...props
39
- }
40
- );
41
- }
42
- function DialogContent({
43
- className,
44
- children,
45
- showCloseButton = true,
46
- ...props
47
- }) {
48
- return /* @__PURE__ */ jsxs(DialogPortal, { "data-slot": "dialog-portal", children: [
49
- /* @__PURE__ */ jsx(DialogOverlay, {}),
50
- /* @__PURE__ */ jsxs(
51
- DialogPrimitive.Content,
52
- {
53
- "data-slot": "dialog-content",
54
- className: cn(
55
- "bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",
56
- className
57
- ),
58
- ...props,
59
- children: [
60
- children,
61
- showCloseButton && /* @__PURE__ */ jsxs(
62
- DialogPrimitive.Close,
63
- {
64
- "data-slot": "dialog-close",
65
- className: "ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
66
- children: [
67
- /* @__PURE__ */ jsx(XIcon, {}),
68
- /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
69
- ]
70
- }
71
- )
72
- ]
73
- }
74
- )
75
- ] });
76
- }
77
- function DialogHeader({ className, ...props }) {
78
- return /* @__PURE__ */ jsx(
79
- "div",
80
- {
81
- "data-slot": "dialog-header",
82
- className: cn("flex flex-col gap-2 text-center sm:text-left", className),
83
- ...props
84
- }
85
- );
86
- }
87
- function DialogFooter({ className, ...props }) {
88
- return /* @__PURE__ */ jsx(
89
- "div",
90
- {
91
- "data-slot": "dialog-footer",
92
- className: cn(
93
- "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
94
- className
95
- ),
96
- ...props
97
- }
98
- );
99
- }
100
- function DialogTitle({
101
- className,
102
- ...props
103
- }) {
104
- return /* @__PURE__ */ jsx(
105
- DialogPrimitive.Title,
106
- {
107
- "data-slot": "dialog-title",
108
- className: cn("text-lg leading-none font-semibold", className),
109
- ...props
110
- }
111
- );
112
- }
113
- function DialogDescription({
114
- className,
115
- ...props
116
- }) {
117
- return /* @__PURE__ */ jsx(
118
- DialogPrimitive.Description,
119
- {
120
- "data-slot": "dialog-description",
121
- className: cn("text-muted-foreground text-sm", className),
122
- ...props
123
- }
124
- );
125
- }
126
-
127
- export {
128
- Dialog,
129
- DialogTrigger,
130
- DialogPortal,
131
- DialogClose,
132
- DialogOverlay,
133
- DialogContent,
134
- DialogHeader,
135
- DialogFooter,
136
- DialogTitle,
137
- DialogDescription
138
- };
@@ -1,69 +0,0 @@
1
- // src/components/tabs/index.tsx
2
- import { cn } from "@foundrykit/utils";
3
- import * as TabsPrimitive from "@radix-ui/react-tabs";
4
- import { jsx } from "react/jsx-runtime";
5
- function Tabs({
6
- className,
7
- ...props
8
- }) {
9
- return /* @__PURE__ */ jsx(
10
- TabsPrimitive.Root,
11
- {
12
- "data-slot": "tabs",
13
- className: cn("flex flex-col gap-2", className),
14
- ...props
15
- }
16
- );
17
- }
18
- function TabsList({
19
- className,
20
- ...props
21
- }) {
22
- return /* @__PURE__ */ jsx(
23
- TabsPrimitive.List,
24
- {
25
- "data-slot": "tabs-list",
26
- className: cn(
27
- "bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",
28
- className
29
- ),
30
- ...props
31
- }
32
- );
33
- }
34
- function TabsTrigger({
35
- className,
36
- ...props
37
- }) {
38
- return /* @__PURE__ */ jsx(
39
- TabsPrimitive.Trigger,
40
- {
41
- "data-slot": "tabs-trigger",
42
- className: cn(
43
- "data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
44
- className
45
- ),
46
- ...props
47
- }
48
- );
49
- }
50
- function TabsContent({
51
- className,
52
- ...props
53
- }) {
54
- return /* @__PURE__ */ jsx(
55
- TabsPrimitive.Content,
56
- {
57
- "data-slot": "tabs-content",
58
- className: cn("flex-1 outline-none", className),
59
- ...props
60
- }
61
- );
62
- }
63
-
64
- export {
65
- Tabs,
66
- TabsList,
67
- TabsTrigger,
68
- TabsContent
69
- };
@@ -1,171 +0,0 @@
1
- // src/components/select/index.tsx
2
- import { cn } from "@foundrykit/utils";
3
- import * as SelectPrimitive from "@radix-ui/react-select";
4
- import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "lucide-react";
5
- import { jsx, jsxs } from "react/jsx-runtime";
6
- function Select({
7
- ...props
8
- }) {
9
- return /* @__PURE__ */ jsx(SelectPrimitive.Root, { "data-slot": "select", ...props });
10
- }
11
- function SelectGroup({
12
- ...props
13
- }) {
14
- return /* @__PURE__ */ jsx(SelectPrimitive.Group, { "data-slot": "select-group", ...props });
15
- }
16
- function SelectValue({
17
- ...props
18
- }) {
19
- return /* @__PURE__ */ jsx(SelectPrimitive.Value, { "data-slot": "select-value", ...props });
20
- }
21
- function SelectTrigger({
22
- className,
23
- size = "default",
24
- children,
25
- ...props
26
- }) {
27
- return /* @__PURE__ */ jsxs(
28
- SelectPrimitive.Trigger,
29
- {
30
- "data-slot": "select-trigger",
31
- "data-size": size,
32
- className: cn(
33
- "border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
34
- className
35
- ),
36
- ...props,
37
- children: [
38
- children,
39
- /* @__PURE__ */ jsx(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-4 opacity-50" }) })
40
- ]
41
- }
42
- );
43
- }
44
- function SelectContent({
45
- className,
46
- children,
47
- position = "popper",
48
- ...props
49
- }) {
50
- return /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
51
- SelectPrimitive.Content,
52
- {
53
- "data-slot": "select-content",
54
- className: cn(
55
- "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:zoom-in-95 motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=left]:slide-in-from-right-2 motion-safe:data-[side=right]:slide-in-from-left-2 motion-safe:data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",
56
- position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
57
- className
58
- ),
59
- position,
60
- ...props,
61
- children: [
62
- /* @__PURE__ */ jsx(SelectScrollUpButton, {}),
63
- /* @__PURE__ */ jsx(
64
- SelectPrimitive.Viewport,
65
- {
66
- className: cn(
67
- "p-1",
68
- position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"
69
- ),
70
- children
71
- }
72
- ),
73
- /* @__PURE__ */ jsx(SelectScrollDownButton, {})
74
- ]
75
- }
76
- ) });
77
- }
78
- function SelectLabel({
79
- className,
80
- ...props
81
- }) {
82
- return /* @__PURE__ */ jsx(
83
- SelectPrimitive.Label,
84
- {
85
- "data-slot": "select-label",
86
- className: cn("text-muted-foreground px-2 py-1.5 text-xs", className),
87
- ...props
88
- }
89
- );
90
- }
91
- function SelectItem({
92
- className,
93
- children,
94
- ...props
95
- }) {
96
- return /* @__PURE__ */ jsxs(
97
- SelectPrimitive.Item,
98
- {
99
- "data-slot": "select-item",
100
- className: cn(
101
- "focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
102
- className
103
- ),
104
- ...props,
105
- children: [
106
- /* @__PURE__ */ jsx("span", { className: "absolute right-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-4" }) }) }),
107
- /* @__PURE__ */ jsx(SelectPrimitive.ItemText, { children })
108
- ]
109
- }
110
- );
111
- }
112
- function SelectSeparator({
113
- className,
114
- ...props
115
- }) {
116
- return /* @__PURE__ */ jsx(
117
- SelectPrimitive.Separator,
118
- {
119
- "data-slot": "select-separator",
120
- className: cn("bg-border pointer-events-none -mx-1 my-1 h-px", className),
121
- ...props
122
- }
123
- );
124
- }
125
- function SelectScrollUpButton({
126
- className,
127
- ...props
128
- }) {
129
- return /* @__PURE__ */ jsx(
130
- SelectPrimitive.ScrollUpButton,
131
- {
132
- "data-slot": "select-scroll-up-button",
133
- className: cn(
134
- "flex cursor-default items-center justify-center py-1",
135
- className
136
- ),
137
- ...props,
138
- children: /* @__PURE__ */ jsx(ChevronUpIcon, { className: "size-4" })
139
- }
140
- );
141
- }
142
- function SelectScrollDownButton({
143
- className,
144
- ...props
145
- }) {
146
- return /* @__PURE__ */ jsx(
147
- SelectPrimitive.ScrollDownButton,
148
- {
149
- "data-slot": "select-scroll-down-button",
150
- className: cn(
151
- "flex cursor-default items-center justify-center py-1",
152
- className
153
- ),
154
- ...props,
155
- children: /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-4" })
156
- }
157
- );
158
- }
159
-
160
- export {
161
- Select,
162
- SelectGroup,
163
- SelectValue,
164
- SelectTrigger,
165
- SelectContent,
166
- SelectLabel,
167
- SelectItem,
168
- SelectSeparator,
169
- SelectScrollUpButton,
170
- SelectScrollDownButton
171
- };