@foundrykit/primitives 1.0.10 → 1.0.12

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,17 @@
1
1
  # @foundrykit/primitives
2
2
 
3
+ ## 1.0.12
4
+
5
+ ### Patch Changes
6
+
7
+ - Updating wrapper and scroll functionality
8
+
9
+ ## 1.0.11
10
+
11
+ ### Patch Changes
12
+
13
+ - adding in the scroll-area primitive
14
+
3
15
  ## 1.0.10
4
16
 
5
17
  ### Patch Changes
@@ -0,0 +1,62 @@
1
+ // src/components/scroll-area/index.tsx
2
+ import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
3
+ import { cn } from "@foundrykit/utils";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ function ScrollArea({
6
+ className,
7
+ children,
8
+ ...props
9
+ }) {
10
+ return /* @__PURE__ */ jsxs(
11
+ ScrollAreaPrimitive.Root,
12
+ {
13
+ "data-slot": "scroll-area",
14
+ className: cn("relative", className),
15
+ ...props,
16
+ children: [
17
+ /* @__PURE__ */ jsx(
18
+ ScrollAreaPrimitive.Viewport,
19
+ {
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
+ children
23
+ }
24
+ ),
25
+ /* @__PURE__ */ jsx(ScrollBar, {}),
26
+ /* @__PURE__ */ jsx(ScrollAreaPrimitive.Corner, {})
27
+ ]
28
+ }
29
+ );
30
+ }
31
+ function ScrollBar({
32
+ className,
33
+ orientation = "vertical",
34
+ ...props
35
+ }) {
36
+ return /* @__PURE__ */ jsx(
37
+ ScrollAreaPrimitive.ScrollAreaScrollbar,
38
+ {
39
+ "data-slot": "scroll-area-scrollbar",
40
+ orientation,
41
+ className: cn(
42
+ "flex touch-none select-none p-px transition-colors",
43
+ orientation === "vertical" && "h-full w-2.5 border-l border-l-transparent",
44
+ orientation === "horizontal" && "h-2.5 flex-col border-t border-t-transparent",
45
+ className
46
+ ),
47
+ ...props,
48
+ children: /* @__PURE__ */ jsx(
49
+ ScrollAreaPrimitive.ScrollAreaThumb,
50
+ {
51
+ "data-slot": "scroll-area-thumb",
52
+ className: "bg-border relative flex-1 rounded-full"
53
+ }
54
+ )
55
+ }
56
+ );
57
+ }
58
+
59
+ export {
60
+ ScrollArea,
61
+ ScrollBar
62
+ };
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+ "use client";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+
31
+ // src/components/scroll-area/index.tsx
32
+ var scroll_area_exports = {};
33
+ __export(scroll_area_exports, {
34
+ ScrollArea: () => ScrollArea,
35
+ ScrollBar: () => ScrollBar
36
+ });
37
+ module.exports = __toCommonJS(scroll_area_exports);
38
+ var ScrollAreaPrimitive = __toESM(require("@radix-ui/react-scroll-area"), 1);
39
+ var import_utils = require("@foundrykit/utils");
40
+ var import_jsx_runtime = require("react/jsx-runtime");
41
+ function ScrollArea({
42
+ className,
43
+ children,
44
+ ...props
45
+ }) {
46
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
47
+ ScrollAreaPrimitive.Root,
48
+ {
49
+ "data-slot": "scroll-area",
50
+ className: (0, import_utils.cn)("relative", className),
51
+ ...props,
52
+ children: [
53
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
54
+ ScrollAreaPrimitive.Viewport,
55
+ {
56
+ "data-slot": "scroll-area-viewport",
57
+ className: "focus-visible:ring-ring/50 size-full rounded-[inherit] outline-none transition-[color,box-shadow] focus-visible:outline-1 focus-visible:ring-[3px]",
58
+ children
59
+ }
60
+ ),
61
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ScrollBar, {}),
62
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ScrollAreaPrimitive.Corner, {})
63
+ ]
64
+ }
65
+ );
66
+ }
67
+ function ScrollBar({
68
+ className,
69
+ orientation = "vertical",
70
+ ...props
71
+ }) {
72
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
73
+ ScrollAreaPrimitive.ScrollAreaScrollbar,
74
+ {
75
+ "data-slot": "scroll-area-scrollbar",
76
+ orientation,
77
+ className: (0, import_utils.cn)(
78
+ "flex touch-none select-none p-px transition-colors",
79
+ orientation === "vertical" && "h-full w-2.5 border-l border-l-transparent",
80
+ orientation === "horizontal" && "h-2.5 flex-col border-t border-t-transparent",
81
+ className
82
+ ),
83
+ ...props,
84
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
85
+ ScrollAreaPrimitive.ScrollAreaThumb,
86
+ {
87
+ "data-slot": "scroll-area-thumb",
88
+ className: "bg-border relative flex-1 rounded-full"
89
+ }
90
+ )
91
+ }
92
+ );
93
+ }
94
+ // Annotate the CommonJS export names for ESM import in node:
95
+ 0 && (module.exports = {
96
+ ScrollArea,
97
+ ScrollBar
98
+ });
@@ -0,0 +1,8 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as React from 'react';
3
+ import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
4
+
5
+ declare function ScrollArea({ className, children, ...props }: React.ComponentProps<typeof ScrollAreaPrimitive.Root>): react_jsx_runtime.JSX.Element;
6
+ declare function ScrollBar({ className, orientation, ...props }: React.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>): react_jsx_runtime.JSX.Element;
7
+
8
+ export { ScrollArea, ScrollBar };
@@ -0,0 +1,8 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as React from 'react';
3
+ import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
4
+
5
+ declare function ScrollArea({ className, children, ...props }: React.ComponentProps<typeof ScrollAreaPrimitive.Root>): react_jsx_runtime.JSX.Element;
6
+ declare function ScrollBar({ className, orientation, ...props }: React.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>): react_jsx_runtime.JSX.Element;
7
+
8
+ export { ScrollArea, ScrollBar };
@@ -0,0 +1,9 @@
1
+ "use client";
2
+ import {
3
+ ScrollArea,
4
+ ScrollBar
5
+ } from "../../chunk-UQQKWW5Q.js";
6
+ export {
7
+ ScrollArea,
8
+ ScrollBar
9
+ };
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
+ export { ScrollArea, ScrollBar } from './components/scroll-area/index.cjs';
25
26
  export { cn } from '@foundrykit/utils';
26
27
  import '@radix-ui/react-avatar';
27
28
  import '@radix-ui/react-checkbox';
@@ -33,6 +34,7 @@ import '@radix-ui/react-separator';
33
34
  import '@radix-ui/react-switch';
34
35
  import '@radix-ui/react-tabs';
35
36
  import '@radix-ui/react-popover';
37
+ import '@radix-ui/react-scroll-area';
36
38
 
37
39
  declare const toggleVariants: (props?: ({
38
40
  variant?: "default" | "outline" | null | undefined;
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
+ export { ScrollArea, ScrollBar } from './components/scroll-area/index.js';
25
26
  export { cn } from '@foundrykit/utils';
26
27
  import '@radix-ui/react-avatar';
27
28
  import '@radix-ui/react-checkbox';
@@ -33,6 +34,7 @@ import '@radix-ui/react-separator';
33
34
  import '@radix-ui/react-switch';
34
35
  import '@radix-ui/react-tabs';
35
36
  import '@radix-ui/react-popover';
37
+ import '@radix-ui/react-scroll-area';
36
38
 
37
39
  declare const toggleVariants: (props?: ({
38
40
  variant?: "default" | "outline" | null | undefined;
package/dist/index.js CHANGED
@@ -1,3 +1,6 @@
1
+ import {
2
+ Switch
3
+ } from "./chunk-U2EIVYWP.js";
1
4
  import {
2
5
  Tabs,
3
6
  TabsContent,
@@ -23,6 +26,10 @@ import {
23
26
  RadioGroup,
24
27
  RadioGroupItem
25
28
  } from "./chunk-XQAJQKO7.js";
29
+ import {
30
+ ScrollArea,
31
+ ScrollBar
32
+ } from "./chunk-UQQKWW5Q.js";
26
33
  import {
27
34
  Select,
28
35
  SelectContent,
@@ -41,9 +48,6 @@ import {
41
48
  import {
42
49
  Skeleton
43
50
  } from "./chunk-SKR3J46C.js";
44
- import {
45
- Switch
46
- } from "./chunk-U2EIVYWP.js";
47
51
  import {
48
52
  Avatar,
49
53
  AvatarFallback,
@@ -484,6 +488,8 @@ export {
484
488
  PopoverTrigger,
485
489
  RadioGroup,
486
490
  RadioGroupItem,
491
+ ScrollArea,
492
+ ScrollBar,
487
493
  Select,
488
494
  SelectContent,
489
495
  SelectGroup,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@foundrykit/primitives",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
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: 'Scroll Area',
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';
package/tsup.config.ts CHANGED
@@ -20,6 +20,7 @@ export default defineConfig({
20
20
  'src/components/textarea/index.tsx',
21
21
  'src/components/skeleton/index.tsx',
22
22
  'src/components/popover/index.tsx',
23
+ 'src/components/scroll-area/index.tsx',
23
24
  ],
24
25
  format: ['esm'],
25
26
  dts: true,