@foundrykit/primitives 1.0.10 → 1.0.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @foundrykit/primitives
2
2
 
3
+ ## 1.0.11
4
+
5
+ ### Patch Changes
6
+
7
+ - adding in the scroll-area primitive
8
+
3
9
  ## 1.0.10
4
10
 
5
11
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -80,6 +80,8 @@ __export(index_exports, {
80
80
  PopoverTrigger: () => PopoverTrigger,
81
81
  RadioGroup: () => RadioGroup2,
82
82
  RadioGroupItem: () => RadioGroupItem,
83
+ ScrollArea: () => ScrollArea,
84
+ ScrollBar: () => ScrollBar,
83
85
  Select: () => Select,
84
86
  SelectContent: () => SelectContent,
85
87
  SelectGroup: () => SelectGroup,
@@ -113,7 +115,7 @@ __export(index_exports, {
113
115
  TooltipTrigger: () => TooltipTrigger,
114
116
  badgeVariants: () => badgeVariants,
115
117
  buttonVariants: () => buttonVariants,
116
- cn: () => import_utils22.cn,
118
+ cn: () => import_utils23.cn,
117
119
  toggleVariants: () => toggleVariants
118
120
  });
119
121
  module.exports = __toCommonJS(index_exports);
@@ -1421,8 +1423,66 @@ function TooltipContent({
1421
1423
  ) });
1422
1424
  }
1423
1425
 
1424
- // src/index.ts
1426
+ // src/components/scroll-area/index.tsx
1427
+ var ScrollAreaPrimitive = __toESM(require("@radix-ui/react-scroll-area"), 1);
1425
1428
  var import_utils22 = require("@foundrykit/utils");
1429
+ var import_jsx_runtime22 = require("react/jsx-runtime");
1430
+ function ScrollArea({
1431
+ className,
1432
+ children,
1433
+ ...props
1434
+ }) {
1435
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
1436
+ ScrollAreaPrimitive.Root,
1437
+ {
1438
+ "data-slot": "scroll-area",
1439
+ className: (0, import_utils22.cn)("relative", className),
1440
+ ...props,
1441
+ children: [
1442
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
1443
+ ScrollAreaPrimitive.Viewport,
1444
+ {
1445
+ "data-slot": "scroll-area-viewport",
1446
+ className: "focus-visible:ring-ring/50 size-full rounded-[inherit] outline-none transition-[color,box-shadow] focus-visible:outline-1 focus-visible:ring-[3px]",
1447
+ children
1448
+ }
1449
+ ),
1450
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ScrollBar, {}),
1451
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ScrollAreaPrimitive.Corner, {})
1452
+ ]
1453
+ }
1454
+ );
1455
+ }
1456
+ function ScrollBar({
1457
+ className,
1458
+ orientation = "vertical",
1459
+ ...props
1460
+ }) {
1461
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
1462
+ ScrollAreaPrimitive.ScrollAreaScrollbar,
1463
+ {
1464
+ "data-slot": "scroll-area-scrollbar",
1465
+ orientation,
1466
+ className: (0, import_utils22.cn)(
1467
+ "flex touch-none select-none p-px transition-colors",
1468
+ orientation === "vertical" && "h-full w-2.5 border-l border-l-transparent",
1469
+ orientation === "horizontal" && "h-2.5 flex-col border-t border-t-transparent",
1470
+ className
1471
+ ),
1472
+ ...props,
1473
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
1474
+ ScrollAreaPrimitive.ScrollAreaThumb,
1475
+ {
1476
+ "data-slot": "scroll-area-thumb",
1477
+ className: "bg-border relative flex-1 rounded-full"
1478
+ }
1479
+ )
1480
+ }
1481
+ );
1482
+ }
1483
+
1484
+ // src/index.ts
1485
+ var import_utils23 = require("@foundrykit/utils");
1426
1486
  // Annotate the CommonJS export names for ESM import in node:
1427
1487
  0 && (module.exports = {
1428
1488
  Avatar,
@@ -1475,6 +1535,8 @@ var import_utils22 = require("@foundrykit/utils");
1475
1535
  PopoverTrigger,
1476
1536
  RadioGroup,
1477
1537
  RadioGroupItem,
1538
+ ScrollArea,
1539
+ ScrollBar,
1478
1540
  Select,
1479
1541
  SelectContent,
1480
1542
  SelectGroup,
package/dist/index.d.cts CHANGED
@@ -22,6 +22,7 @@ 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
24
  import * as TooltipPrimitive from '@radix-ui/react-tooltip';
25
+ import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
25
26
  export { cn } from '@foundrykit/utils';
26
27
  import '@radix-ui/react-avatar';
27
28
  import '@radix-ui/react-checkbox';
@@ -67,4 +68,7 @@ declare function Tooltip({ ...props }: React.ComponentProps<typeof TooltipPrimit
67
68
  declare function TooltipTrigger({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Trigger>): react_jsx_runtime.JSX.Element;
68
69
  declare function TooltipContent({ className, sideOffset, children, ...props }: React.ComponentProps<typeof TooltipPrimitive.Content>): react_jsx_runtime.JSX.Element;
69
70
 
70
- export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Toggle, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, toggleVariants };
71
+ declare function ScrollArea({ className, children, ...props }: React.ComponentProps<typeof ScrollAreaPrimitive.Root>): react_jsx_runtime.JSX.Element;
72
+ declare function ScrollBar({ className, orientation, ...props }: React.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>): react_jsx_runtime.JSX.Element;
73
+
74
+ export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, ScrollArea, ScrollBar, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Toggle, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, toggleVariants };
package/dist/index.d.ts CHANGED
@@ -22,6 +22,7 @@ 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
24
  import * as TooltipPrimitive from '@radix-ui/react-tooltip';
25
+ import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
25
26
  export { cn } from '@foundrykit/utils';
26
27
  import '@radix-ui/react-avatar';
27
28
  import '@radix-ui/react-checkbox';
@@ -67,4 +68,7 @@ declare function Tooltip({ ...props }: React.ComponentProps<typeof TooltipPrimit
67
68
  declare function TooltipTrigger({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Trigger>): react_jsx_runtime.JSX.Element;
68
69
  declare function TooltipContent({ className, sideOffset, children, ...props }: React.ComponentProps<typeof TooltipPrimitive.Content>): react_jsx_runtime.JSX.Element;
69
70
 
70
- export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Toggle, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, toggleVariants };
71
+ declare function ScrollArea({ className, children, ...props }: React.ComponentProps<typeof ScrollAreaPrimitive.Root>): react_jsx_runtime.JSX.Element;
72
+ declare function ScrollBar({ className, orientation, ...props }: React.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>): react_jsx_runtime.JSX.Element;
73
+
74
+ export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, ScrollArea, ScrollBar, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Toggle, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, toggleVariants };
package/dist/index.js CHANGED
@@ -66,6 +66,9 @@ import {
66
66
  Button,
67
67
  buttonVariants
68
68
  } from "./chunk-YTUI6MCB.js";
69
+ import {
70
+ Checkbox
71
+ } from "./chunk-A3U73FA7.js";
69
72
  import {
70
73
  Card,
71
74
  CardContent,
@@ -74,9 +77,6 @@ import {
74
77
  CardHeader,
75
78
  CardTitle
76
79
  } from "./chunk-UZIMC7AQ.js";
77
- import {
78
- Checkbox
79
- } from "./chunk-A3U73FA7.js";
80
80
  import {
81
81
  DropdownMenu,
82
82
  DropdownMenuCheckboxItem,
@@ -431,8 +431,66 @@ function TooltipContent({
431
431
  ) });
432
432
  }
433
433
 
434
- // src/index.ts
434
+ // src/components/scroll-area/index.tsx
435
+ import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
435
436
  import { cn as cn5 } from "@foundrykit/utils";
437
+ import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
438
+ function ScrollArea({
439
+ className,
440
+ children,
441
+ ...props
442
+ }) {
443
+ return /* @__PURE__ */ jsxs4(
444
+ ScrollAreaPrimitive.Root,
445
+ {
446
+ "data-slot": "scroll-area",
447
+ className: cn5("relative", className),
448
+ ...props,
449
+ children: [
450
+ /* @__PURE__ */ jsx5(
451
+ ScrollAreaPrimitive.Viewport,
452
+ {
453
+ "data-slot": "scroll-area-viewport",
454
+ className: "focus-visible:ring-ring/50 size-full rounded-[inherit] outline-none transition-[color,box-shadow] focus-visible:outline-1 focus-visible:ring-[3px]",
455
+ children
456
+ }
457
+ ),
458
+ /* @__PURE__ */ jsx5(ScrollBar, {}),
459
+ /* @__PURE__ */ jsx5(ScrollAreaPrimitive.Corner, {})
460
+ ]
461
+ }
462
+ );
463
+ }
464
+ function ScrollBar({
465
+ className,
466
+ orientation = "vertical",
467
+ ...props
468
+ }) {
469
+ return /* @__PURE__ */ jsx5(
470
+ ScrollAreaPrimitive.ScrollAreaScrollbar,
471
+ {
472
+ "data-slot": "scroll-area-scrollbar",
473
+ orientation,
474
+ className: cn5(
475
+ "flex touch-none select-none p-px transition-colors",
476
+ orientation === "vertical" && "h-full w-2.5 border-l border-l-transparent",
477
+ orientation === "horizontal" && "h-2.5 flex-col border-t border-t-transparent",
478
+ className
479
+ ),
480
+ ...props,
481
+ children: /* @__PURE__ */ jsx5(
482
+ ScrollAreaPrimitive.ScrollAreaThumb,
483
+ {
484
+ "data-slot": "scroll-area-thumb",
485
+ className: "bg-border relative flex-1 rounded-full"
486
+ }
487
+ )
488
+ }
489
+ );
490
+ }
491
+
492
+ // src/index.ts
493
+ import { cn as cn6 } from "@foundrykit/utils";
436
494
  export {
437
495
  Avatar,
438
496
  AvatarFallback,
@@ -484,6 +542,8 @@ export {
484
542
  PopoverTrigger,
485
543
  RadioGroup,
486
544
  RadioGroupItem,
545
+ ScrollArea,
546
+ ScrollBar,
487
547
  Select,
488
548
  SelectContent,
489
549
  SelectGroup,
@@ -517,6 +577,6 @@ export {
517
577
  TooltipTrigger,
518
578
  badgeVariants,
519
579
  buttonVariants,
520
- cn5 as cn,
580
+ cn6 as cn,
521
581
  toggleVariants
522
582
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@foundrykit/primitives",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "main": "./dist/index.js",
@@ -27,6 +27,7 @@
27
27
  "@radix-ui/react-label": "^2.1.7",
28
28
  "@radix-ui/react-popover": "^1.1.15",
29
29
  "@radix-ui/react-radio-group": "^1.3.8",
30
+ "@radix-ui/react-scroll-area": "^1.2.10",
30
31
  "@radix-ui/react-select": "^2.2.6",
31
32
  "@radix-ui/react-separator": "^1.1.7",
32
33
  "@radix-ui/react-slot": "^1.2.3",
@@ -0,0 +1,17 @@
1
+ import type { ComponentConfig } from '@foundrykit/types';
2
+
3
+ export const scrollAreaConfig: ComponentConfig = {
4
+ name: 'ScrollArea',
5
+ description:
6
+ 'ScrollArea component for displaying content in a scrollable area',
7
+ category: 'primitives',
8
+ tags: ['layout', 'ui'],
9
+ preview: {
10
+ type: 'static',
11
+ 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">ScrollArea</div></div>',
12
+ },
13
+ variants: [],
14
+ dependencies: ['utils'],
15
+ packageDependencies: ['@radix-ui/react-scroll-area'],
16
+ files: ['components/primitives/scroll-area/index.tsx'],
17
+ };
@@ -0,0 +1,58 @@
1
+ 'use client';
2
+
3
+ import * as React from 'react';
4
+ import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
5
+
6
+ import { cn } from '@foundrykit/utils';
7
+
8
+ function ScrollArea({
9
+ className,
10
+ children,
11
+ ...props
12
+ }: React.ComponentProps<typeof ScrollAreaPrimitive.Root>) {
13
+ return (
14
+ <ScrollAreaPrimitive.Root
15
+ data-slot='scroll-area'
16
+ className={cn('relative', className)}
17
+ {...props}
18
+ >
19
+ <ScrollAreaPrimitive.Viewport
20
+ data-slot='scroll-area-viewport'
21
+ className='focus-visible:ring-ring/50 size-full rounded-[inherit] outline-none transition-[color,box-shadow] focus-visible:outline-1 focus-visible:ring-[3px]'
22
+ >
23
+ {children}
24
+ </ScrollAreaPrimitive.Viewport>
25
+ <ScrollBar />
26
+ <ScrollAreaPrimitive.Corner />
27
+ </ScrollAreaPrimitive.Root>
28
+ );
29
+ }
30
+
31
+ function ScrollBar({
32
+ className,
33
+ orientation = 'vertical',
34
+ ...props
35
+ }: React.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>) {
36
+ return (
37
+ <ScrollAreaPrimitive.ScrollAreaScrollbar
38
+ data-slot='scroll-area-scrollbar'
39
+ orientation={orientation}
40
+ className={cn(
41
+ 'flex touch-none select-none p-px transition-colors',
42
+ orientation === 'vertical' &&
43
+ 'h-full w-2.5 border-l border-l-transparent',
44
+ orientation === 'horizontal' &&
45
+ 'h-2.5 flex-col border-t border-t-transparent',
46
+ className
47
+ )}
48
+ {...props}
49
+ >
50
+ <ScrollAreaPrimitive.ScrollAreaThumb
51
+ data-slot='scroll-area-thumb'
52
+ className='bg-border relative flex-1 rounded-full'
53
+ />
54
+ </ScrollAreaPrimitive.ScrollAreaScrollbar>
55
+ );
56
+ }
57
+
58
+ export { ScrollArea, ScrollBar };
package/src/index.ts CHANGED
@@ -99,6 +99,7 @@ export {
99
99
  TooltipContent,
100
100
  TooltipProvider,
101
101
  } from './components/tooltip/index.js';
102
+ export { ScrollArea, ScrollBar } from './components/scroll-area/index.js';
102
103
 
103
104
  // Export utilities from utils package
104
105
  export { cn } from '@foundrykit/utils';