@foundrykit/primitives 1.0.7 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/components/badge/index.d.cts +1 -1
- package/dist/components/badge/index.d.ts +1 -1
- package/dist/components/button/index.d.cts +1 -1
- package/dist/components/button/index.d.ts +1 -1
- package/dist/index.cjs +195 -2
- package/dist/index.d.cts +18 -1
- package/dist/index.d.ts +18 -1
- package/dist/index.js +187 -6
- package/package.json +5 -4
- package/src/components/sheet/config.ts +16 -0
- package/src/components/sheet/index.tsx +139 -0
- package/src/components/tooltip/config.ts +16 -0
- package/src/components/tooltip/index.tsx +61 -0
- package/src/index.ts +16 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @foundrykit/primitives
|
|
2
2
|
|
|
3
|
+
## 1.0.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updating components and primitives as well as improving the registry demo
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @foundrykit/utils@1.0.5
|
|
10
|
+
|
|
11
|
+
## 1.0.8
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updating the file path in the config for sheet
|
|
16
|
+
|
|
3
17
|
## 1.0.7
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -4,7 +4,7 @@ import * as React from 'react';
|
|
|
4
4
|
import { VariantProps } from 'class-variance-authority';
|
|
5
5
|
|
|
6
6
|
declare const badgeVariants: (props?: ({
|
|
7
|
-
variant?: "default" | "
|
|
7
|
+
variant?: "default" | "secondary" | "destructive" | "outline" | null | undefined;
|
|
8
8
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
9
9
|
declare function Badge({ className, variant, asChild, ...props }: React.ComponentProps<'span'> & VariantProps<typeof badgeVariants> & {
|
|
10
10
|
asChild?: boolean;
|
|
@@ -4,7 +4,7 @@ import * as React from 'react';
|
|
|
4
4
|
import { VariantProps } from 'class-variance-authority';
|
|
5
5
|
|
|
6
6
|
declare const badgeVariants: (props?: ({
|
|
7
|
-
variant?: "default" | "
|
|
7
|
+
variant?: "default" | "secondary" | "destructive" | "outline" | null | undefined;
|
|
8
8
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
9
9
|
declare function Badge({ className, variant, asChild, ...props }: React.ComponentProps<'span'> & VariantProps<typeof badgeVariants> & {
|
|
10
10
|
asChild?: boolean;
|
|
@@ -4,7 +4,7 @@ import * as React from 'react';
|
|
|
4
4
|
import { VariantProps } from 'class-variance-authority';
|
|
5
5
|
|
|
6
6
|
declare const buttonVariants: (props?: ({
|
|
7
|
-
variant?: "default" | "
|
|
7
|
+
variant?: "default" | "secondary" | "destructive" | "outline" | "link" | "ghost" | null | undefined;
|
|
8
8
|
size?: "default" | "sm" | "lg" | "icon" | null | undefined;
|
|
9
9
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
10
10
|
interface ButtonProps extends React.ComponentProps<'button'>, VariantProps<typeof buttonVariants> {
|
|
@@ -4,7 +4,7 @@ import * as React from 'react';
|
|
|
4
4
|
import { VariantProps } from 'class-variance-authority';
|
|
5
5
|
|
|
6
6
|
declare const buttonVariants: (props?: ({
|
|
7
|
-
variant?: "default" | "
|
|
7
|
+
variant?: "default" | "secondary" | "destructive" | "outline" | "link" | "ghost" | null | undefined;
|
|
8
8
|
size?: "default" | "sm" | "lg" | "icon" | null | undefined;
|
|
9
9
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
10
10
|
interface ButtonProps extends React.ComponentProps<'button'>, VariantProps<typeof buttonVariants> {
|
package/dist/index.cjs
CHANGED
|
@@ -91,6 +91,14 @@ __export(index_exports, {
|
|
|
91
91
|
SelectTrigger: () => SelectTrigger,
|
|
92
92
|
SelectValue: () => SelectValue,
|
|
93
93
|
Separator: () => Separator3,
|
|
94
|
+
Sheet: () => Sheet,
|
|
95
|
+
SheetClose: () => SheetClose,
|
|
96
|
+
SheetContent: () => SheetContent,
|
|
97
|
+
SheetDescription: () => SheetDescription,
|
|
98
|
+
SheetFooter: () => SheetFooter,
|
|
99
|
+
SheetHeader: () => SheetHeader,
|
|
100
|
+
SheetTitle: () => SheetTitle,
|
|
101
|
+
SheetTrigger: () => SheetTrigger,
|
|
94
102
|
Skeleton: () => Skeleton,
|
|
95
103
|
Switch: () => Switch,
|
|
96
104
|
Tabs: () => Tabs,
|
|
@@ -99,9 +107,13 @@ __export(index_exports, {
|
|
|
99
107
|
TabsTrigger: () => TabsTrigger,
|
|
100
108
|
Textarea: () => Textarea,
|
|
101
109
|
Toggle: () => Toggle,
|
|
110
|
+
Tooltip: () => Tooltip,
|
|
111
|
+
TooltipContent: () => TooltipContent,
|
|
112
|
+
TooltipProvider: () => TooltipProvider,
|
|
113
|
+
TooltipTrigger: () => TooltipTrigger,
|
|
102
114
|
badgeVariants: () => badgeVariants,
|
|
103
115
|
buttonVariants: () => buttonVariants,
|
|
104
|
-
cn: () =>
|
|
116
|
+
cn: () => import_utils22.cn,
|
|
105
117
|
toggleVariants: () => toggleVariants
|
|
106
118
|
});
|
|
107
119
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -1240,8 +1252,177 @@ function DialogDescription({
|
|
|
1240
1252
|
);
|
|
1241
1253
|
}
|
|
1242
1254
|
|
|
1243
|
-
// src/index.
|
|
1255
|
+
// src/components/sheet/index.tsx
|
|
1256
|
+
var SheetPrimitive = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
1257
|
+
var import_lucide_react7 = require("lucide-react");
|
|
1244
1258
|
var import_utils20 = require("@foundrykit/utils");
|
|
1259
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1260
|
+
function Sheet({ ...props }) {
|
|
1261
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(SheetPrimitive.Root, { "data-slot": "sheet", ...props });
|
|
1262
|
+
}
|
|
1263
|
+
function SheetTrigger({
|
|
1264
|
+
...props
|
|
1265
|
+
}) {
|
|
1266
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(SheetPrimitive.Trigger, { "data-slot": "sheet-trigger", ...props });
|
|
1267
|
+
}
|
|
1268
|
+
function SheetClose({
|
|
1269
|
+
...props
|
|
1270
|
+
}) {
|
|
1271
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(SheetPrimitive.Close, { "data-slot": "sheet-close", ...props });
|
|
1272
|
+
}
|
|
1273
|
+
function SheetPortal({
|
|
1274
|
+
...props
|
|
1275
|
+
}) {
|
|
1276
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(SheetPrimitive.Portal, { "data-slot": "sheet-portal", ...props });
|
|
1277
|
+
}
|
|
1278
|
+
function SheetOverlay({
|
|
1279
|
+
className,
|
|
1280
|
+
...props
|
|
1281
|
+
}) {
|
|
1282
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1283
|
+
SheetPrimitive.Overlay,
|
|
1284
|
+
{
|
|
1285
|
+
"data-slot": "sheet-overlay",
|
|
1286
|
+
className: (0, import_utils20.cn)(
|
|
1287
|
+
"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",
|
|
1288
|
+
className
|
|
1289
|
+
),
|
|
1290
|
+
...props
|
|
1291
|
+
}
|
|
1292
|
+
);
|
|
1293
|
+
}
|
|
1294
|
+
function SheetContent({
|
|
1295
|
+
className,
|
|
1296
|
+
children,
|
|
1297
|
+
side = "right",
|
|
1298
|
+
...props
|
|
1299
|
+
}) {
|
|
1300
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(SheetPortal, { children: [
|
|
1301
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(SheetOverlay, {}),
|
|
1302
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
1303
|
+
SheetPrimitive.Content,
|
|
1304
|
+
{
|
|
1305
|
+
"data-slot": "sheet-content",
|
|
1306
|
+
className: (0, import_utils20.cn)(
|
|
1307
|
+
"bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",
|
|
1308
|
+
side === "right" && "data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",
|
|
1309
|
+
side === "left" && "data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",
|
|
1310
|
+
side === "top" && "data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",
|
|
1311
|
+
side === "bottom" && "data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",
|
|
1312
|
+
className
|
|
1313
|
+
),
|
|
1314
|
+
...props,
|
|
1315
|
+
children: [
|
|
1316
|
+
children,
|
|
1317
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(SheetPrimitive.Close, { className: "ring-offset-background focus:ring-ring data-[state=open]:bg-secondary rounded-xs focus:outline-hidden absolute right-4 top-4 opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 disabled:pointer-events-none", children: [
|
|
1318
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react7.XIcon, { className: "size-4" }),
|
|
1319
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "sr-only", children: "Close" })
|
|
1320
|
+
] })
|
|
1321
|
+
]
|
|
1322
|
+
}
|
|
1323
|
+
)
|
|
1324
|
+
] });
|
|
1325
|
+
}
|
|
1326
|
+
function SheetHeader({ className, ...props }) {
|
|
1327
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1328
|
+
"div",
|
|
1329
|
+
{
|
|
1330
|
+
"data-slot": "sheet-header",
|
|
1331
|
+
className: (0, import_utils20.cn)("flex flex-col gap-1.5 p-4", className),
|
|
1332
|
+
...props
|
|
1333
|
+
}
|
|
1334
|
+
);
|
|
1335
|
+
}
|
|
1336
|
+
function SheetFooter({ className, ...props }) {
|
|
1337
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1338
|
+
"div",
|
|
1339
|
+
{
|
|
1340
|
+
"data-slot": "sheet-footer",
|
|
1341
|
+
className: (0, import_utils20.cn)("mt-auto flex flex-col gap-2 p-4", className),
|
|
1342
|
+
...props
|
|
1343
|
+
}
|
|
1344
|
+
);
|
|
1345
|
+
}
|
|
1346
|
+
function SheetTitle({
|
|
1347
|
+
className,
|
|
1348
|
+
...props
|
|
1349
|
+
}) {
|
|
1350
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1351
|
+
SheetPrimitive.Title,
|
|
1352
|
+
{
|
|
1353
|
+
"data-slot": "sheet-title",
|
|
1354
|
+
className: (0, import_utils20.cn)("text-foreground font-semibold", className),
|
|
1355
|
+
...props
|
|
1356
|
+
}
|
|
1357
|
+
);
|
|
1358
|
+
}
|
|
1359
|
+
function SheetDescription({
|
|
1360
|
+
className,
|
|
1361
|
+
...props
|
|
1362
|
+
}) {
|
|
1363
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1364
|
+
SheetPrimitive.Description,
|
|
1365
|
+
{
|
|
1366
|
+
"data-slot": "sheet-description",
|
|
1367
|
+
className: (0, import_utils20.cn)("text-muted-foreground text-sm", className),
|
|
1368
|
+
...props
|
|
1369
|
+
}
|
|
1370
|
+
);
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1373
|
+
// src/components/tooltip/index.tsx
|
|
1374
|
+
var TooltipPrimitive = __toESM(require("@radix-ui/react-tooltip"), 1);
|
|
1375
|
+
var import_utils21 = require("@foundrykit/utils");
|
|
1376
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1377
|
+
function TooltipProvider({
|
|
1378
|
+
delayDuration = 0,
|
|
1379
|
+
...props
|
|
1380
|
+
}) {
|
|
1381
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1382
|
+
TooltipPrimitive.Provider,
|
|
1383
|
+
{
|
|
1384
|
+
"data-slot": "tooltip-provider",
|
|
1385
|
+
delayDuration,
|
|
1386
|
+
...props
|
|
1387
|
+
}
|
|
1388
|
+
);
|
|
1389
|
+
}
|
|
1390
|
+
function Tooltip({
|
|
1391
|
+
...props
|
|
1392
|
+
}) {
|
|
1393
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipPrimitive.Root, { "data-slot": "tooltip", ...props }) });
|
|
1394
|
+
}
|
|
1395
|
+
function TooltipTrigger({
|
|
1396
|
+
...props
|
|
1397
|
+
}) {
|
|
1398
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipPrimitive.Trigger, { "data-slot": "tooltip-trigger", ...props });
|
|
1399
|
+
}
|
|
1400
|
+
function TooltipContent({
|
|
1401
|
+
className,
|
|
1402
|
+
sideOffset = 0,
|
|
1403
|
+
children,
|
|
1404
|
+
...props
|
|
1405
|
+
}) {
|
|
1406
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipPrimitive.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
1407
|
+
TooltipPrimitive.Content,
|
|
1408
|
+
{
|
|
1409
|
+
"data-slot": "tooltip-content",
|
|
1410
|
+
sideOffset,
|
|
1411
|
+
className: (0, import_utils21.cn)(
|
|
1412
|
+
"bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-tooltip-content-transform-origin) z-50 w-fit text-balance rounded-md px-3 py-1.5 text-xs",
|
|
1413
|
+
className
|
|
1414
|
+
),
|
|
1415
|
+
...props,
|
|
1416
|
+
children: [
|
|
1417
|
+
children,
|
|
1418
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipPrimitive.Arrow, { className: "bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" })
|
|
1419
|
+
]
|
|
1420
|
+
}
|
|
1421
|
+
) });
|
|
1422
|
+
}
|
|
1423
|
+
|
|
1424
|
+
// src/index.ts
|
|
1425
|
+
var import_utils22 = require("@foundrykit/utils");
|
|
1245
1426
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1246
1427
|
0 && (module.exports = {
|
|
1247
1428
|
Avatar,
|
|
@@ -1305,6 +1486,14 @@ var import_utils20 = require("@foundrykit/utils");
|
|
|
1305
1486
|
SelectTrigger,
|
|
1306
1487
|
SelectValue,
|
|
1307
1488
|
Separator,
|
|
1489
|
+
Sheet,
|
|
1490
|
+
SheetClose,
|
|
1491
|
+
SheetContent,
|
|
1492
|
+
SheetDescription,
|
|
1493
|
+
SheetFooter,
|
|
1494
|
+
SheetHeader,
|
|
1495
|
+
SheetTitle,
|
|
1496
|
+
SheetTrigger,
|
|
1308
1497
|
Skeleton,
|
|
1309
1498
|
Switch,
|
|
1310
1499
|
Tabs,
|
|
@@ -1313,6 +1502,10 @@ var import_utils20 = require("@foundrykit/utils");
|
|
|
1313
1502
|
TabsTrigger,
|
|
1314
1503
|
Textarea,
|
|
1315
1504
|
Toggle,
|
|
1505
|
+
Tooltip,
|
|
1506
|
+
TooltipContent,
|
|
1507
|
+
TooltipProvider,
|
|
1508
|
+
TooltipTrigger,
|
|
1316
1509
|
badgeVariants,
|
|
1317
1510
|
buttonVariants,
|
|
1318
1511
|
cn,
|
package/dist/index.d.cts
CHANGED
|
@@ -21,6 +21,7 @@ export { Textarea } from './components/textarea/index.cjs';
|
|
|
21
21
|
export { Skeleton } from './components/skeleton/index.cjs';
|
|
22
22
|
export { Popover, PopoverAnchor, PopoverContent, PopoverTrigger } from './components/popover/index.cjs';
|
|
23
23
|
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
24
|
+
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
24
25
|
export { cn } from '@foundrykit/utils';
|
|
25
26
|
import '@radix-ui/react-avatar';
|
|
26
27
|
import '@radix-ui/react-checkbox';
|
|
@@ -50,4 +51,20 @@ declare function DialogFooter({ className, ...props }: React.ComponentProps<'div
|
|
|
50
51
|
declare function DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>): react_jsx_runtime.JSX.Element;
|
|
51
52
|
declare function DialogDescription({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Description>): react_jsx_runtime.JSX.Element;
|
|
52
53
|
|
|
53
|
-
|
|
54
|
+
declare function Sheet({ ...props }: React.ComponentProps<typeof DialogPrimitive.Root>): react_jsx_runtime.JSX.Element;
|
|
55
|
+
declare function SheetTrigger({ ...props }: React.ComponentProps<typeof DialogPrimitive.Trigger>): react_jsx_runtime.JSX.Element;
|
|
56
|
+
declare function SheetClose({ ...props }: React.ComponentProps<typeof DialogPrimitive.Close>): react_jsx_runtime.JSX.Element;
|
|
57
|
+
declare function SheetContent({ className, children, side, ...props }: React.ComponentProps<typeof DialogPrimitive.Content> & {
|
|
58
|
+
side?: 'top' | 'right' | 'bottom' | 'left';
|
|
59
|
+
}): react_jsx_runtime.JSX.Element;
|
|
60
|
+
declare function SheetHeader({ className, ...props }: React.ComponentProps<'div'>): react_jsx_runtime.JSX.Element;
|
|
61
|
+
declare function SheetFooter({ className, ...props }: React.ComponentProps<'div'>): react_jsx_runtime.JSX.Element;
|
|
62
|
+
declare function SheetTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>): react_jsx_runtime.JSX.Element;
|
|
63
|
+
declare function SheetDescription({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Description>): react_jsx_runtime.JSX.Element;
|
|
64
|
+
|
|
65
|
+
declare function TooltipProvider({ delayDuration, ...props }: React.ComponentProps<typeof TooltipPrimitive.Provider>): react_jsx_runtime.JSX.Element;
|
|
66
|
+
declare function Tooltip({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Root>): react_jsx_runtime.JSX.Element;
|
|
67
|
+
declare function TooltipTrigger({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Trigger>): react_jsx_runtime.JSX.Element;
|
|
68
|
+
declare function TooltipContent({ className, sideOffset, children, ...props }: React.ComponentProps<typeof TooltipPrimitive.Content>): react_jsx_runtime.JSX.Element;
|
|
69
|
+
|
|
70
|
+
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Toggle, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, toggleVariants };
|
package/dist/index.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export { Textarea } from './components/textarea/index.js';
|
|
|
21
21
|
export { Skeleton } from './components/skeleton/index.js';
|
|
22
22
|
export { Popover, PopoverAnchor, PopoverContent, PopoverTrigger } from './components/popover/index.js';
|
|
23
23
|
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
24
|
+
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
24
25
|
export { cn } from '@foundrykit/utils';
|
|
25
26
|
import '@radix-ui/react-avatar';
|
|
26
27
|
import '@radix-ui/react-checkbox';
|
|
@@ -50,4 +51,20 @@ declare function DialogFooter({ className, ...props }: React.ComponentProps<'div
|
|
|
50
51
|
declare function DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>): react_jsx_runtime.JSX.Element;
|
|
51
52
|
declare function DialogDescription({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Description>): react_jsx_runtime.JSX.Element;
|
|
52
53
|
|
|
53
|
-
|
|
54
|
+
declare function Sheet({ ...props }: React.ComponentProps<typeof DialogPrimitive.Root>): react_jsx_runtime.JSX.Element;
|
|
55
|
+
declare function SheetTrigger({ ...props }: React.ComponentProps<typeof DialogPrimitive.Trigger>): react_jsx_runtime.JSX.Element;
|
|
56
|
+
declare function SheetClose({ ...props }: React.ComponentProps<typeof DialogPrimitive.Close>): react_jsx_runtime.JSX.Element;
|
|
57
|
+
declare function SheetContent({ className, children, side, ...props }: React.ComponentProps<typeof DialogPrimitive.Content> & {
|
|
58
|
+
side?: 'top' | 'right' | 'bottom' | 'left';
|
|
59
|
+
}): react_jsx_runtime.JSX.Element;
|
|
60
|
+
declare function SheetHeader({ className, ...props }: React.ComponentProps<'div'>): react_jsx_runtime.JSX.Element;
|
|
61
|
+
declare function SheetFooter({ className, ...props }: React.ComponentProps<'div'>): react_jsx_runtime.JSX.Element;
|
|
62
|
+
declare function SheetTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>): react_jsx_runtime.JSX.Element;
|
|
63
|
+
declare function SheetDescription({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Description>): react_jsx_runtime.JSX.Element;
|
|
64
|
+
|
|
65
|
+
declare function TooltipProvider({ delayDuration, ...props }: React.ComponentProps<typeof TooltipPrimitive.Provider>): react_jsx_runtime.JSX.Element;
|
|
66
|
+
declare function Tooltip({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Root>): react_jsx_runtime.JSX.Element;
|
|
67
|
+
declare function TooltipTrigger({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Trigger>): react_jsx_runtime.JSX.Element;
|
|
68
|
+
declare function TooltipContent({ className, sideOffset, children, ...props }: React.ComponentProps<typeof TooltipPrimitive.Content>): react_jsx_runtime.JSX.Element;
|
|
69
|
+
|
|
70
|
+
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Toggle, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, toggleVariants };
|
package/dist/index.js
CHANGED
|
@@ -44,15 +44,15 @@ import {
|
|
|
44
44
|
import {
|
|
45
45
|
Switch
|
|
46
46
|
} from "./chunk-U2EIVYWP.js";
|
|
47
|
+
import {
|
|
48
|
+
Badge,
|
|
49
|
+
badgeVariants
|
|
50
|
+
} from "./chunk-FUWID6MC.js";
|
|
47
51
|
import {
|
|
48
52
|
Avatar,
|
|
49
53
|
AvatarFallback,
|
|
50
54
|
AvatarImage
|
|
51
55
|
} from "./chunk-VVNIYCKH.js";
|
|
52
|
-
import {
|
|
53
|
-
Badge,
|
|
54
|
-
badgeVariants
|
|
55
|
-
} from "./chunk-FUWID6MC.js";
|
|
56
56
|
import {
|
|
57
57
|
Breadcrumb,
|
|
58
58
|
BreadcrumbEllipsis,
|
|
@@ -262,8 +262,177 @@ function DialogDescription({
|
|
|
262
262
|
);
|
|
263
263
|
}
|
|
264
264
|
|
|
265
|
-
// src/index.
|
|
265
|
+
// src/components/sheet/index.tsx
|
|
266
|
+
import * as SheetPrimitive from "@radix-ui/react-dialog";
|
|
267
|
+
import { XIcon as XIcon2 } from "lucide-react";
|
|
266
268
|
import { cn as cn3 } from "@foundrykit/utils";
|
|
269
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
270
|
+
function Sheet({ ...props }) {
|
|
271
|
+
return /* @__PURE__ */ jsx3(SheetPrimitive.Root, { "data-slot": "sheet", ...props });
|
|
272
|
+
}
|
|
273
|
+
function SheetTrigger({
|
|
274
|
+
...props
|
|
275
|
+
}) {
|
|
276
|
+
return /* @__PURE__ */ jsx3(SheetPrimitive.Trigger, { "data-slot": "sheet-trigger", ...props });
|
|
277
|
+
}
|
|
278
|
+
function SheetClose({
|
|
279
|
+
...props
|
|
280
|
+
}) {
|
|
281
|
+
return /* @__PURE__ */ jsx3(SheetPrimitive.Close, { "data-slot": "sheet-close", ...props });
|
|
282
|
+
}
|
|
283
|
+
function SheetPortal({
|
|
284
|
+
...props
|
|
285
|
+
}) {
|
|
286
|
+
return /* @__PURE__ */ jsx3(SheetPrimitive.Portal, { "data-slot": "sheet-portal", ...props });
|
|
287
|
+
}
|
|
288
|
+
function SheetOverlay({
|
|
289
|
+
className,
|
|
290
|
+
...props
|
|
291
|
+
}) {
|
|
292
|
+
return /* @__PURE__ */ jsx3(
|
|
293
|
+
SheetPrimitive.Overlay,
|
|
294
|
+
{
|
|
295
|
+
"data-slot": "sheet-overlay",
|
|
296
|
+
className: cn3(
|
|
297
|
+
"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",
|
|
298
|
+
className
|
|
299
|
+
),
|
|
300
|
+
...props
|
|
301
|
+
}
|
|
302
|
+
);
|
|
303
|
+
}
|
|
304
|
+
function SheetContent({
|
|
305
|
+
className,
|
|
306
|
+
children,
|
|
307
|
+
side = "right",
|
|
308
|
+
...props
|
|
309
|
+
}) {
|
|
310
|
+
return /* @__PURE__ */ jsxs2(SheetPortal, { children: [
|
|
311
|
+
/* @__PURE__ */ jsx3(SheetOverlay, {}),
|
|
312
|
+
/* @__PURE__ */ jsxs2(
|
|
313
|
+
SheetPrimitive.Content,
|
|
314
|
+
{
|
|
315
|
+
"data-slot": "sheet-content",
|
|
316
|
+
className: cn3(
|
|
317
|
+
"bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",
|
|
318
|
+
side === "right" && "data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",
|
|
319
|
+
side === "left" && "data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",
|
|
320
|
+
side === "top" && "data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",
|
|
321
|
+
side === "bottom" && "data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",
|
|
322
|
+
className
|
|
323
|
+
),
|
|
324
|
+
...props,
|
|
325
|
+
children: [
|
|
326
|
+
children,
|
|
327
|
+
/* @__PURE__ */ jsxs2(SheetPrimitive.Close, { className: "ring-offset-background focus:ring-ring data-[state=open]:bg-secondary rounded-xs focus:outline-hidden absolute right-4 top-4 opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 disabled:pointer-events-none", children: [
|
|
328
|
+
/* @__PURE__ */ jsx3(XIcon2, { className: "size-4" }),
|
|
329
|
+
/* @__PURE__ */ jsx3("span", { className: "sr-only", children: "Close" })
|
|
330
|
+
] })
|
|
331
|
+
]
|
|
332
|
+
}
|
|
333
|
+
)
|
|
334
|
+
] });
|
|
335
|
+
}
|
|
336
|
+
function SheetHeader({ className, ...props }) {
|
|
337
|
+
return /* @__PURE__ */ jsx3(
|
|
338
|
+
"div",
|
|
339
|
+
{
|
|
340
|
+
"data-slot": "sheet-header",
|
|
341
|
+
className: cn3("flex flex-col gap-1.5 p-4", className),
|
|
342
|
+
...props
|
|
343
|
+
}
|
|
344
|
+
);
|
|
345
|
+
}
|
|
346
|
+
function SheetFooter({ className, ...props }) {
|
|
347
|
+
return /* @__PURE__ */ jsx3(
|
|
348
|
+
"div",
|
|
349
|
+
{
|
|
350
|
+
"data-slot": "sheet-footer",
|
|
351
|
+
className: cn3("mt-auto flex flex-col gap-2 p-4", className),
|
|
352
|
+
...props
|
|
353
|
+
}
|
|
354
|
+
);
|
|
355
|
+
}
|
|
356
|
+
function SheetTitle({
|
|
357
|
+
className,
|
|
358
|
+
...props
|
|
359
|
+
}) {
|
|
360
|
+
return /* @__PURE__ */ jsx3(
|
|
361
|
+
SheetPrimitive.Title,
|
|
362
|
+
{
|
|
363
|
+
"data-slot": "sheet-title",
|
|
364
|
+
className: cn3("text-foreground font-semibold", className),
|
|
365
|
+
...props
|
|
366
|
+
}
|
|
367
|
+
);
|
|
368
|
+
}
|
|
369
|
+
function SheetDescription({
|
|
370
|
+
className,
|
|
371
|
+
...props
|
|
372
|
+
}) {
|
|
373
|
+
return /* @__PURE__ */ jsx3(
|
|
374
|
+
SheetPrimitive.Description,
|
|
375
|
+
{
|
|
376
|
+
"data-slot": "sheet-description",
|
|
377
|
+
className: cn3("text-muted-foreground text-sm", className),
|
|
378
|
+
...props
|
|
379
|
+
}
|
|
380
|
+
);
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
// src/components/tooltip/index.tsx
|
|
384
|
+
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
385
|
+
import { cn as cn4 } from "@foundrykit/utils";
|
|
386
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
387
|
+
function TooltipProvider({
|
|
388
|
+
delayDuration = 0,
|
|
389
|
+
...props
|
|
390
|
+
}) {
|
|
391
|
+
return /* @__PURE__ */ jsx4(
|
|
392
|
+
TooltipPrimitive.Provider,
|
|
393
|
+
{
|
|
394
|
+
"data-slot": "tooltip-provider",
|
|
395
|
+
delayDuration,
|
|
396
|
+
...props
|
|
397
|
+
}
|
|
398
|
+
);
|
|
399
|
+
}
|
|
400
|
+
function Tooltip({
|
|
401
|
+
...props
|
|
402
|
+
}) {
|
|
403
|
+
return /* @__PURE__ */ jsx4(TooltipProvider, { children: /* @__PURE__ */ jsx4(TooltipPrimitive.Root, { "data-slot": "tooltip", ...props }) });
|
|
404
|
+
}
|
|
405
|
+
function TooltipTrigger({
|
|
406
|
+
...props
|
|
407
|
+
}) {
|
|
408
|
+
return /* @__PURE__ */ jsx4(TooltipPrimitive.Trigger, { "data-slot": "tooltip-trigger", ...props });
|
|
409
|
+
}
|
|
410
|
+
function TooltipContent({
|
|
411
|
+
className,
|
|
412
|
+
sideOffset = 0,
|
|
413
|
+
children,
|
|
414
|
+
...props
|
|
415
|
+
}) {
|
|
416
|
+
return /* @__PURE__ */ jsx4(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsxs3(
|
|
417
|
+
TooltipPrimitive.Content,
|
|
418
|
+
{
|
|
419
|
+
"data-slot": "tooltip-content",
|
|
420
|
+
sideOffset,
|
|
421
|
+
className: cn4(
|
|
422
|
+
"bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-tooltip-content-transform-origin) z-50 w-fit text-balance rounded-md px-3 py-1.5 text-xs",
|
|
423
|
+
className
|
|
424
|
+
),
|
|
425
|
+
...props,
|
|
426
|
+
children: [
|
|
427
|
+
children,
|
|
428
|
+
/* @__PURE__ */ jsx4(TooltipPrimitive.Arrow, { className: "bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" })
|
|
429
|
+
]
|
|
430
|
+
}
|
|
431
|
+
) });
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
// src/index.ts
|
|
435
|
+
import { cn as cn5 } from "@foundrykit/utils";
|
|
267
436
|
export {
|
|
268
437
|
Avatar,
|
|
269
438
|
AvatarFallback,
|
|
@@ -326,6 +495,14 @@ export {
|
|
|
326
495
|
SelectTrigger,
|
|
327
496
|
SelectValue,
|
|
328
497
|
Separator,
|
|
498
|
+
Sheet,
|
|
499
|
+
SheetClose,
|
|
500
|
+
SheetContent,
|
|
501
|
+
SheetDescription,
|
|
502
|
+
SheetFooter,
|
|
503
|
+
SheetHeader,
|
|
504
|
+
SheetTitle,
|
|
505
|
+
SheetTrigger,
|
|
329
506
|
Skeleton,
|
|
330
507
|
Switch,
|
|
331
508
|
Tabs,
|
|
@@ -334,8 +511,12 @@ export {
|
|
|
334
511
|
TabsTrigger,
|
|
335
512
|
Textarea,
|
|
336
513
|
Toggle,
|
|
514
|
+
Tooltip,
|
|
515
|
+
TooltipContent,
|
|
516
|
+
TooltipProvider,
|
|
517
|
+
TooltipTrigger,
|
|
337
518
|
badgeVariants,
|
|
338
519
|
buttonVariants,
|
|
339
|
-
|
|
520
|
+
cn5 as cn,
|
|
340
521
|
toggleVariants
|
|
341
522
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@foundrykit/primitives",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"@radix-ui/react-switch": "^1.2.6",
|
|
34
34
|
"@radix-ui/react-tabs": "^1.1.13",
|
|
35
35
|
"@radix-ui/react-toggle": "^1.1.10",
|
|
36
|
+
"@radix-ui/react-tooltip": "^1.2.8",
|
|
36
37
|
"class-variance-authority": "^0.7.1",
|
|
37
38
|
"clsx": "^2.1.1",
|
|
38
39
|
"lucide-react": "^0.475.0",
|
|
@@ -42,7 +43,7 @@
|
|
|
42
43
|
"tailwind-merge": "^3.3.1",
|
|
43
44
|
"zod": "^3.25.76",
|
|
44
45
|
"@foundrykit/types": "1.0.7",
|
|
45
|
-
"@foundrykit/utils": "1.0.
|
|
46
|
+
"@foundrykit/utils": "1.0.5"
|
|
46
47
|
},
|
|
47
48
|
"devDependencies": {
|
|
48
49
|
"@types/node": "^20.19.9",
|
|
@@ -52,8 +53,8 @@
|
|
|
52
53
|
"fs-extra": "^11.2.0",
|
|
53
54
|
"tsup": "^8.0.0",
|
|
54
55
|
"typescript": "^5.9.2",
|
|
55
|
-
"@foundrykit/
|
|
56
|
-
"@foundrykit/
|
|
56
|
+
"@foundrykit/eslint-config": "1.0.4",
|
|
57
|
+
"@foundrykit/typescript-config": "1.0.4"
|
|
57
58
|
},
|
|
58
59
|
"peerDependencies": {
|
|
59
60
|
"react": "^19.1.1",
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ComponentConfig } from '@foundrykit/types';
|
|
2
|
+
|
|
3
|
+
export const sheetConfig: ComponentConfig = {
|
|
4
|
+
name: 'Sheet',
|
|
5
|
+
description: 'Sheet component for displaying content in a floating panel',
|
|
6
|
+
category: 'primitives',
|
|
7
|
+
tags: ['overlay', 'modal', 'interactive'],
|
|
8
|
+
preview: {
|
|
9
|
+
type: 'static',
|
|
10
|
+
html: '<div class="flex h-12 w-full items-center justify-center rounded-md bg-gray-200"><div class="h-8 w-20 rounded bg-gray-400 flex items-center justify-center text-xs text-white">Sheet</div></div>',
|
|
11
|
+
},
|
|
12
|
+
variants: [],
|
|
13
|
+
dependencies: ['utils'],
|
|
14
|
+
packageDependencies: ['@radix-ui/react-dialog', 'lucide-react'],
|
|
15
|
+
files: ['components/primitives/sheet/index.tsx'],
|
|
16
|
+
};
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import * as SheetPrimitive from '@radix-ui/react-dialog';
|
|
5
|
+
import { XIcon } from 'lucide-react';
|
|
6
|
+
|
|
7
|
+
import { cn } from '@foundrykit/utils';
|
|
8
|
+
|
|
9
|
+
function Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>) {
|
|
10
|
+
return <SheetPrimitive.Root data-slot='sheet' {...props} />;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function SheetTrigger({
|
|
14
|
+
...props
|
|
15
|
+
}: React.ComponentProps<typeof SheetPrimitive.Trigger>) {
|
|
16
|
+
return <SheetPrimitive.Trigger data-slot='sheet-trigger' {...props} />;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function SheetClose({
|
|
20
|
+
...props
|
|
21
|
+
}: React.ComponentProps<typeof SheetPrimitive.Close>) {
|
|
22
|
+
return <SheetPrimitive.Close data-slot='sheet-close' {...props} />;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function SheetPortal({
|
|
26
|
+
...props
|
|
27
|
+
}: React.ComponentProps<typeof SheetPrimitive.Portal>) {
|
|
28
|
+
return <SheetPrimitive.Portal data-slot='sheet-portal' {...props} />;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function SheetOverlay({
|
|
32
|
+
className,
|
|
33
|
+
...props
|
|
34
|
+
}: React.ComponentProps<typeof SheetPrimitive.Overlay>) {
|
|
35
|
+
return (
|
|
36
|
+
<SheetPrimitive.Overlay
|
|
37
|
+
data-slot='sheet-overlay'
|
|
38
|
+
className={cn(
|
|
39
|
+
'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',
|
|
40
|
+
className
|
|
41
|
+
)}
|
|
42
|
+
{...props}
|
|
43
|
+
/>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function SheetContent({
|
|
48
|
+
className,
|
|
49
|
+
children,
|
|
50
|
+
side = 'right',
|
|
51
|
+
...props
|
|
52
|
+
}: React.ComponentProps<typeof SheetPrimitive.Content> & {
|
|
53
|
+
side?: 'top' | 'right' | 'bottom' | 'left';
|
|
54
|
+
}) {
|
|
55
|
+
return (
|
|
56
|
+
<SheetPortal>
|
|
57
|
+
<SheetOverlay />
|
|
58
|
+
<SheetPrimitive.Content
|
|
59
|
+
data-slot='sheet-content'
|
|
60
|
+
className={cn(
|
|
61
|
+
'bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500',
|
|
62
|
+
side === 'right' &&
|
|
63
|
+
'data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm',
|
|
64
|
+
side === 'left' &&
|
|
65
|
+
'data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm',
|
|
66
|
+
side === 'top' &&
|
|
67
|
+
'data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b',
|
|
68
|
+
side === 'bottom' &&
|
|
69
|
+
'data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t',
|
|
70
|
+
className
|
|
71
|
+
)}
|
|
72
|
+
{...props}
|
|
73
|
+
>
|
|
74
|
+
{children}
|
|
75
|
+
<SheetPrimitive.Close className='ring-offset-background focus:ring-ring data-[state=open]:bg-secondary rounded-xs focus:outline-hidden absolute right-4 top-4 opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 disabled:pointer-events-none'>
|
|
76
|
+
<XIcon className='size-4' />
|
|
77
|
+
<span className='sr-only'>Close</span>
|
|
78
|
+
</SheetPrimitive.Close>
|
|
79
|
+
</SheetPrimitive.Content>
|
|
80
|
+
</SheetPortal>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function SheetHeader({ className, ...props }: React.ComponentProps<'div'>) {
|
|
85
|
+
return (
|
|
86
|
+
<div
|
|
87
|
+
data-slot='sheet-header'
|
|
88
|
+
className={cn('flex flex-col gap-1.5 p-4', className)}
|
|
89
|
+
{...props}
|
|
90
|
+
/>
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function SheetFooter({ className, ...props }: React.ComponentProps<'div'>) {
|
|
95
|
+
return (
|
|
96
|
+
<div
|
|
97
|
+
data-slot='sheet-footer'
|
|
98
|
+
className={cn('mt-auto flex flex-col gap-2 p-4', className)}
|
|
99
|
+
{...props}
|
|
100
|
+
/>
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function SheetTitle({
|
|
105
|
+
className,
|
|
106
|
+
...props
|
|
107
|
+
}: React.ComponentProps<typeof SheetPrimitive.Title>) {
|
|
108
|
+
return (
|
|
109
|
+
<SheetPrimitive.Title
|
|
110
|
+
data-slot='sheet-title'
|
|
111
|
+
className={cn('text-foreground font-semibold', className)}
|
|
112
|
+
{...props}
|
|
113
|
+
/>
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function SheetDescription({
|
|
118
|
+
className,
|
|
119
|
+
...props
|
|
120
|
+
}: React.ComponentProps<typeof SheetPrimitive.Description>) {
|
|
121
|
+
return (
|
|
122
|
+
<SheetPrimitive.Description
|
|
123
|
+
data-slot='sheet-description'
|
|
124
|
+
className={cn('text-muted-foreground text-sm', className)}
|
|
125
|
+
{...props}
|
|
126
|
+
/>
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export {
|
|
131
|
+
Sheet,
|
|
132
|
+
SheetTrigger,
|
|
133
|
+
SheetClose,
|
|
134
|
+
SheetContent,
|
|
135
|
+
SheetHeader,
|
|
136
|
+
SheetFooter,
|
|
137
|
+
SheetTitle,
|
|
138
|
+
SheetDescription,
|
|
139
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ComponentConfig } from '@foundrykit/types';
|
|
2
|
+
|
|
3
|
+
export const tooltipConfig: ComponentConfig = {
|
|
4
|
+
name: 'Tooltip',
|
|
5
|
+
description: 'Tooltip component for displaying content in a floating panel',
|
|
6
|
+
category: 'primitives',
|
|
7
|
+
tags: ['overlay', 'interactive', 'ui'],
|
|
8
|
+
preview: {
|
|
9
|
+
type: 'static',
|
|
10
|
+
html: '<div class="flex h-12 w-full items-center justify-center rounded-md bg-gray-200"><div class="relative"><div class="h-8 w-20 rounded border border-gray-400 bg-white flex items-center justify-center text-xs">Trigger</div><div class="absolute top-full left-0 mt-1 w-32 rounded border border-gray-300 bg-white shadow-lg p-2"><div class="text-xs">Tooltip content</div></div></div></div>',
|
|
11
|
+
},
|
|
12
|
+
variants: [],
|
|
13
|
+
dependencies: ['utils'],
|
|
14
|
+
packageDependencies: ['@radix-ui/react-tooltip'],
|
|
15
|
+
files: ['components/primitives/tooltip/index.tsx'],
|
|
16
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
5
|
+
|
|
6
|
+
import { cn } from '@foundrykit/utils';
|
|
7
|
+
|
|
8
|
+
function TooltipProvider({
|
|
9
|
+
delayDuration = 0,
|
|
10
|
+
...props
|
|
11
|
+
}: React.ComponentProps<typeof TooltipPrimitive.Provider>) {
|
|
12
|
+
return (
|
|
13
|
+
<TooltipPrimitive.Provider
|
|
14
|
+
data-slot='tooltip-provider'
|
|
15
|
+
delayDuration={delayDuration}
|
|
16
|
+
{...props}
|
|
17
|
+
/>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function Tooltip({
|
|
22
|
+
...props
|
|
23
|
+
}: React.ComponentProps<typeof TooltipPrimitive.Root>) {
|
|
24
|
+
return (
|
|
25
|
+
<TooltipProvider>
|
|
26
|
+
<TooltipPrimitive.Root data-slot='tooltip' {...props} />
|
|
27
|
+
</TooltipProvider>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function TooltipTrigger({
|
|
32
|
+
...props
|
|
33
|
+
}: React.ComponentProps<typeof TooltipPrimitive.Trigger>) {
|
|
34
|
+
return <TooltipPrimitive.Trigger data-slot='tooltip-trigger' {...props} />;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function TooltipContent({
|
|
38
|
+
className,
|
|
39
|
+
sideOffset = 0,
|
|
40
|
+
children,
|
|
41
|
+
...props
|
|
42
|
+
}: React.ComponentProps<typeof TooltipPrimitive.Content>) {
|
|
43
|
+
return (
|
|
44
|
+
<TooltipPrimitive.Portal>
|
|
45
|
+
<TooltipPrimitive.Content
|
|
46
|
+
data-slot='tooltip-content'
|
|
47
|
+
sideOffset={sideOffset}
|
|
48
|
+
className={cn(
|
|
49
|
+
'bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-tooltip-content-transform-origin) z-50 w-fit text-balance rounded-md px-3 py-1.5 text-xs',
|
|
50
|
+
className
|
|
51
|
+
)}
|
|
52
|
+
{...props}
|
|
53
|
+
>
|
|
54
|
+
{children}
|
|
55
|
+
<TooltipPrimitive.Arrow className='bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]' />
|
|
56
|
+
</TooltipPrimitive.Content>
|
|
57
|
+
</TooltipPrimitive.Portal>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
|
package/src/index.ts
CHANGED
|
@@ -83,6 +83,22 @@ export {
|
|
|
83
83
|
DialogDescription,
|
|
84
84
|
DialogClose,
|
|
85
85
|
} from './components/dialog/index.js';
|
|
86
|
+
export {
|
|
87
|
+
Sheet,
|
|
88
|
+
SheetTrigger,
|
|
89
|
+
SheetContent,
|
|
90
|
+
SheetHeader,
|
|
91
|
+
SheetFooter,
|
|
92
|
+
SheetTitle,
|
|
93
|
+
SheetDescription,
|
|
94
|
+
SheetClose,
|
|
95
|
+
} from './components/sheet/index.js';
|
|
96
|
+
export {
|
|
97
|
+
Tooltip,
|
|
98
|
+
TooltipTrigger,
|
|
99
|
+
TooltipContent,
|
|
100
|
+
TooltipProvider,
|
|
101
|
+
} from './components/tooltip/index.js';
|
|
86
102
|
|
|
87
103
|
// Export utilities from utils package
|
|
88
104
|
export { cn } from '@foundrykit/utils';
|