Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
Scrollarea in combobox (#107)
Neil Kanakia0ae758e78c3d
diff --git a/apps/carbon/app/components/Combobox.tsx b/apps/carbon/app/components/Combobox.tsxindex 6058dc57a4..2306956963 100644--- a/apps/carbon/app/components/Combobox.tsx+++ b/apps/carbon/app/components/Combobox.tsx@@ -10,6 +10,7 @@ import {Popover,PopoverContent,PopoverTrigger,+ ScrollArea,cn,} from "@carbon/react";import type { ComponentPropsWithoutRef } from "react";@@ -73,40 +74,42 @@ const Combobox = forwardRef<HTMLButtonElement, ComboboxProps>(<PopoverContent className="min-w-[200px] w-[--radix-popover-trigger-width] p-0"><Command><CommandInput placeholder="Search..." className="h-9" />- <CommandEmpty>No option found.</CommandEmpty>- <CommandGroup>- {options.map((option) => (- <CommandItem- value={- typeof option.label === "string"- ? option.label + option.helper- : undefined- }- key={option.value}- onSelect={() => {- onChange?.(option.value);- setOpen(false);- }}- >- {option.helper ? (- <div className="flex flex-col">- <p>{option.label}</p>- <p className="text-xs text-muted-foreground">- {option.helper}- </p>- </div>- ) : (- option.label- )}- <RxCheck- className={cn(- "ml-auto h-4 w-4",- option.value === value ? "opacity-100" : "opacity-0"+ <ScrollArea className="overflow-auto max-h-96">+ <CommandEmpty>No option found.</CommandEmpty>+ <CommandGroup>+ {options.map((option) => (+ <CommandItem+ value={+ typeof option.label === "string"+ ? option.label + option.helper+ : undefined+ }+ key={option.value}+ onSelect={() => {+ onChange?.(option.value);+ setOpen(false);+ }}+ >+ {option.helper ? (+ <div className="flex flex-col">+ <p>{option.label}</p>+ <p className="text-xs text-muted-foreground">+ {option.helper}+ </p>+ </div>+ ) : (+ option.label)}- />- </CommandItem>- ))}- </CommandGroup>+ <RxCheck+ className={cn(+ "ml-auto h-4 w-4",+ option.value === value ? "opacity-100" : "opacity-0"+ )}+ />+ </CommandItem>+ ))}+ </CommandGroup>+ </ScrollArea></Command></PopoverContent></Popover>diff --git a/package-lock.json b/package-lock.jsonindex bd62d1f10f..aa5cdb4bca 100644--- a/package-lock.json+++ b/package-lock.json@@ -3773,6 +3773,37 @@}}},+ "node_modules/@radix-ui/react-scroll-area": {+ "version": "1.0.5",+ "resolved": "https://registry.npmjs.org/@radix-ui/react-scroll-area/-/react-scroll-area-1.0.5.tgz",+ "integrity": "sha512-b6PAgH4GQf9QEn8zbT2XUHpW5z8BzqEc7Kl11TwDrvuTrxlkcjTD5qa/bxgKr+nmuXKu4L/W5UZ4mlP/VG/5Gw==",+ "dependencies": {+ "@babel/runtime": "^7.13.10",+ "@radix-ui/number": "1.0.1",+ "@radix-ui/primitive": "1.0.1",+ "@radix-ui/react-compose-refs": "1.0.1",+ "@radix-ui/react-context": "1.0.1",+ "@radix-ui/react-direction": "1.0.1",+ "@radix-ui/react-presence": "1.0.1",+ "@radix-ui/react-primitive": "1.0.3",+ "@radix-ui/react-use-callback-ref": "1.0.1",+ "@radix-ui/react-use-layout-effect": "1.0.1"+ },+ "peerDependencies": {+ "@types/react": "*",+ "@types/react-dom": "*",+ "react": "^16.8 || ^17.0 || ^18.0",+ "react-dom": "^16.8 || ^17.0 || ^18.0"+ },+ "peerDependenciesMeta": {+ "@types/react": {+ "optional": true+ },+ "@types/react-dom": {+ "optional": true+ }+ }+ },"node_modules/@radix-ui/react-select": {"version": "2.0.0","resolved": "https://registry.npmjs.org/@radix-ui/react-select/-/react-select-2.0.0.tgz",@@ -32186,6 +32217,7 @@"@radix-ui/react-popover": "^1.0.6","@radix-ui/react-progress": "^1.0.3","@radix-ui/react-radio-group": "^1.1.3",+ "@radix-ui/react-scroll-area": "^1.0.5","@radix-ui/react-select": "^2.0.0","@radix-ui/react-separator": "^1.0.3","@radix-ui/react-slot": "^1.0.2",diff --git a/packages/react/package.json b/packages/react/package.jsonindex 78d1b64f62..48be8c5487 100644--- a/packages/react/package.json+++ b/packages/react/package.json@@ -10,6 +10,7 @@"@radix-ui/react-popover": "^1.0.6","@radix-ui/react-progress": "^1.0.3","@radix-ui/react-radio-group": "^1.1.3",+ "@radix-ui/react-scroll-area": "^1.0.5","@radix-ui/react-select": "^2.0.0","@radix-ui/react-separator": "^1.0.3","@radix-ui/react-slot": "^1.0.2",diff --git a/packages/react/src/ScrollArea.tsx b/packages/react/src/ScrollArea.tsxnew file mode 100644index 0000000000..1687a26694--- /dev/null+++ b/packages/react/src/ScrollArea.tsx@@ -0,0 +1,46 @@+import * as React from "react";+import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";++import { cn } from "~/utils/cn";++const ScrollArea = React.forwardRef<+ React.ElementRef<typeof ScrollAreaPrimitive.Root>,+ React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root>+>(({ className, children, ...props }, ref) => (+ <ScrollAreaPrimitive.Root+ ref={ref}+ className={cn("relative overflow-hidden", className)}+ {...props}+ >+ <ScrollAreaPrimitive.Viewport className="h-full w-full rounded-[inherit]">+ {children}+ </ScrollAreaPrimitive.Viewport>+ <ScrollBar />+ <ScrollAreaPrimitive.Corner />+ </ScrollAreaPrimitive.Root>+));+ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;++const ScrollBar = React.forwardRef<+ React.ElementRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>,+ React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>+>(({ className, orientation = "vertical", ...props }, ref) => (+ <ScrollAreaPrimitive.ScrollAreaScrollbar+ ref={ref}+ orientation={orientation}+ className={cn(+ "flex touch-none select-none transition-colors",+ orientation === "vertical" &&+ "h-full w-2.5 border-l border-l-transparent p-[1px]",+ orientation === "horizontal" &&+ "h-2.5 flex-col border-t border-t-transparent p-[1px]",+ className+ )}+ {...props}+ >+ <ScrollAreaPrimitive.ScrollAreaThumb className="relative flex-1 rounded-full bg-border" />+ </ScrollAreaPrimitive.ScrollAreaScrollbar>+));+ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;++export { ScrollArea, ScrollBar };diff --git a/packages/react/src/index.tsx b/packages/react/src/index.tsxindex e0756c770e..2710ecd5f7 100644--- a/packages/react/src/index.tsx+++ b/packages/react/src/index.tsx@@ -190,6 +190,7 @@ import {} from "./Popover";import { Progress } from "./Progress";import { RadioGroup, RadioGroupItem } from "./Radio";+import { ScrollArea, ScrollBar } from "./ScrollArea";import {Select,SelectContent,@@ -392,6 +393,8 @@ export {Progress,RadioGroup,RadioGroupItem,+ ScrollArea,+ ScrollBar,Select,SelectContent,SelectGroup,