Skip to content

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.

refactor: icon button component

Brad Barbinf10a28010d7a
diff --git a/apps/carbon/app/components/Form/Array.tsx b/apps/carbon/app/components/Form/Array.tsx
index 7af5f51549..eeb4a2944d 100644
--- a/apps/carbon/app/components/Form/Array.tsx
+++ b/apps/carbon/app/components/Form/Array.tsx
@@ -1,11 +1,10 @@
-import { Button, HStack, VStack } from "@carbon/react";
+import { Button, HStack, IconButton, VStack } from "@carbon/react";
import type { InputProps } from "@chakra-ui/react";
import {
Input as ChakraInput,
FormControl,
FormErrorMessage,
FormLabel,
- IconButton,
} from "@chakra-ui/react";
import { forwardRef } from "react";
import { IoMdAdd, IoMdClose } from "react-icons/io";
@@ -71,10 +70,10 @@ const ArrayInput = forwardRef<HTMLInputElement, ArrayInputProps>(
})}
/>
<IconButton
+ variant="ghost"
aria-label="Remove item"
icon={<IoMdClose />}
onClick={onRemove}
- variant="ghost"
/>
</HStack>
diff --git a/apps/carbon/app/components/Form/Color.tsx b/apps/carbon/app/components/Form/Color.tsx
index d3a452c94c..fe9156697d 100644
--- a/apps/carbon/app/components/Form/Color.tsx
+++ b/apps/carbon/app/components/Form/Color.tsx
@@ -1,7 +1,5 @@
-import { HStack, useColor } from "@carbon/react";
+import { HStack } from "@carbon/react";
import {
- Box,
- Button,
FormControl,
FormErrorMessage,
FormLabel,
@@ -29,29 +27,16 @@ const ColorPicker = ({ name, label }: ColorFieldProps) => {
handler: () => disclosure.onClose(),
});
- const borderColor = useColor("var(--chakra-colors-gray-200)");
-
return (
<FormControl>
<FormLabel>{label}</FormLabel>
<input type="hidden" name={name} value={value} />
<div className="relative" ref={containerRef}>
<HStack>
- <Box
- as={Button}
- bg={value}
- h={8}
- w={8}
- border="1px solid"
- borderColor={borderColor}
- borderRadius="md"
- boxShadow="md"
- cursor="pointer"
+ <button
+ className="inline-flex items-center justify-center whitespace-nowrap rounded-md font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 h-8 w-8 border border-border"
+ style={{ background: value }}
onClick={disclosure.onToggle}
- tabIndex={0}
- _hover={{
- bg: value,
- }}
/>
<HexColorInput
color={value}
diff --git a/apps/carbon/app/components/Form/Password.tsx b/apps/carbon/app/components/Form/Password.tsx
index b15cca78ad..10a67e0253 100644
--- a/apps/carbon/app/components/Form/Password.tsx
+++ b/apps/carbon/app/components/Form/Password.tsx
@@ -1,5 +1,5 @@
+import { IconButton } from "@carbon/react";
import type { InputProps } from "@chakra-ui/react";
-import { IconButton } from "@chakra-ui/react";
import {
FormControl,
FormErrorMessage,
@@ -39,9 +39,7 @@ const Password = forwardRef<HTMLInputElement, FormPasswordProps>(
<IconButton
aria-label={passwordVisible ? "Show password" : "Hide password"}
icon={passwordVisible ? <BiShowAlt /> : <BiHide />}
- h="1.75rem"
- size="sm"
- variant="outline"
+ variant="ghost"
tabIndex={-1}
onClick={() => setPasswordVisible(!passwordVisible)}
/>
diff --git a/apps/carbon/app/components/Layout/Sidebar/CollapsibleSidebar.tsx b/apps/carbon/app/components/Layout/Sidebar/CollapsibleSidebar.tsx
index 349ad52312..38585aef1b 100644
--- a/apps/carbon/app/components/Layout/Sidebar/CollapsibleSidebar.tsx
+++ b/apps/carbon/app/components/Layout/Sidebar/CollapsibleSidebar.tsx
@@ -1,11 +1,11 @@
import {
+ IconButton,
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger,
- useColor,
+ useDisclosure,
} from "@carbon/react";
-import { IconButton, useDisclosure } from "@chakra-ui/react";
import { motion } from "framer-motion";
import type { PropsWithChildren } from "react";
import { TbArrowBarLeft, TbArrowBarRight } from "react-icons/tb";
@@ -39,22 +39,7 @@ export const CollapsibleSidebar = ({ children }: PropsWithChildren<{}>) => {
onClick={sidebar.onToggle}
icon={sidebar.isOpen ? <TbArrowBarLeft /> : <TbArrowBarRight />}
aria-label="Toggle sidebar"
- display="inline-block"
- borderWidth="1px 1px 1px 0px"
- borderStyle="solid"
- borderColor={useColor("gray.200")}
- position="absolute"
- pl={2}
- top="calc(100vh - 135px)"
- color={useColor("gray.700")}
- right="-32px"
- left="auto"
- backgroundColor={useColor("white")}
- borderRadius="0px 4px 4px 0px"
- zIndex={3}
- _hover={{
- backgroundColor: useColor("white"),
- }}
+ className="inline-block border border-border border-l-0 absolute pl-2 top-[calc(100vh-135px)] text-muted-foreground right-[-32px] left-auto bg-background rounded-l-none z-[3] hover:bg-background p-0"
/>
</TooltipTrigger>
diff --git a/apps/carbon/app/components/Layout/Sidebar/GroupedContentSidebar.tsx b/apps/carbon/app/components/Layout/Sidebar/GroupedContentSidebar.tsx
index cd3085a2eb..eb780d6cf2 100644
--- a/apps/carbon/app/components/Layout/Sidebar/GroupedContentSidebar.tsx
+++ b/apps/carbon/app/components/Layout/Sidebar/GroupedContentSidebar.tsx
@@ -16,9 +16,9 @@ const GroupedContentSidebar = ({ groups }: { groups: RouteGroup[] }) => {
spacing={1}
className="border-b border-border p-2"
>
- <p className="text-xs text-muted-foreground font-bold pl-3 py-1 uppercase">
+ <h4 className="text-xs text-muted-foreground font-bold pl-3 py-1 uppercase">
{group.name}
- </p>
+ </h4>
{group.routes.map((route) => {
const isActive = matches.some((match) =>
match.pathname.includes(route.to)
diff --git a/apps/carbon/app/components/Layout/Sidebar/IconSidebar.tsx b/apps/carbon/app/components/Layout/Sidebar/IconSidebar.tsx
index 85bb34ac0e..3c04266715 100644
--- a/apps/carbon/app/components/Layout/Sidebar/IconSidebar.tsx
+++ b/apps/carbon/app/components/Layout/Sidebar/IconSidebar.tsx
@@ -1,11 +1,11 @@
import {
+ Button,
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger,
VStack,
} from "@carbon/react";
-import { IconButton } from "@chakra-ui/react";
import { Link, useMatches } from "@remix-run/react";
import { BsFillHexagonFill } from "react-icons/bs";
import { z } from "zod";
@@ -30,17 +30,11 @@ const IconSidebar = () => {
return (
<div className="h-full border-r border-border bg-background z-10">
- <IconButton
- aria-label="Home"
- as={Link}
- to="/"
- variant="ghost"
- size="lg"
- icon={<BsFillHexagonFill />}
- position="sticky"
- top={0}
- mb={4}
- />
+ <Button isIcon asChild variant="ghost" size="lg" className="rounded-none">
+ <Link to="/">
+ <BsFillHexagonFill />
+ </Link>
+ </Button>
<TooltipProvider>
<VStack spacing={0} className="top-[50px] sticky">
{links.map((link) => {
@@ -50,19 +44,18 @@ const IconSidebar = () => {
return (
<Tooltip key={link.to}>
<TooltipTrigger asChild>
- <IconButton
- as={Link}
- to={link.to}
- prefetch="intent"
- colorScheme={isActive ? link.color ?? "brand" : undefined}
- variant={isActive ? "solid" : "outline"}
- size="lg"
- borderRadius={0}
- borderWidth={1}
- borderColor={isActive ? "gray.200" : "transparent"}
+ <Button
+ asChild
+ isIcon
aria-label={link.name}
- icon={<link.icon />}
- />
+ variant={isActive ? "primary" : "ghost"}
+ size="lg"
+ className="rounded-none"
+ >
+ <Link to={link.to} prefetch="intent">
+ <link.icon />
+ </Link>
+ </Button>
</TooltipTrigger>
<TooltipContent side="right">{link.name}</TooltipContent>
</Tooltip>
diff --git a/apps/carbon/app/components/Layout/Topbar/Logo.tsx b/apps/carbon/app/components/Layout/Topbar/Logo.tsx
deleted file mode 100644
index 9735c57cad..0000000000
--- a/apps/carbon/app/components/Layout/Topbar/Logo.tsx
+++ /dev/null
@@ -1,29 +0,0 @@
-import { useColor } from "@carbon/react";
-import { Box, IconButton } from "@chakra-ui/react";
-import { Link } from "@remix-run/react";
-import { AiOutlineCodeSandbox } from "react-icons/ai";
-import { path } from "~/utils/path";
-
-const Logo = () => {
- return (
- <Box
- borderRight={1}
- borderRightColor={useColor("gray.200")}
- borderRightStyle="solid"
- >
- <IconButton
- as={Link}
- variant="outline"
- colorScheme="gray"
- size="lg"
- borderRadius={0}
- border="none"
- aria-label="Carbon"
- icon={<AiOutlineCodeSandbox />}
- to={path.to.authenticatedRoot}
- />
- </Box>
- );
-};
-
-export default Logo;
diff --git a/apps/carbon/app/components/Layout/Topbar/index.ts b/apps/carbon/app/components/Layout/Topbar/index.ts
index 3347515284..65efcbb275 100644
--- a/apps/carbon/app/components/Layout/Topbar/index.ts
+++ b/apps/carbon/app/components/Layout/Topbar/index.ts
@@ -1,6 +1,5 @@
import AvatarMenu from "./AvatarMenu";
-import Logo from "./Logo";
import Topbar from "./Topbar";
export default Topbar;
-export { AvatarMenu, Logo };
+export { AvatarMenu };
diff --git a/apps/carbon/app/components/Selectors/UserSelect/components/Input.tsx b/apps/carbon/app/components/Selectors/UserSelect/components/Input.tsx
index 3516d98a2b..d1b03dff4f 100644
--- a/apps/carbon/app/components/Selectors/UserSelect/components/Input.tsx
+++ b/apps/carbon/app/components/Selectors/UserSelect/components/Input.tsx
@@ -1,8 +1,7 @@
-import { HStack } from "@carbon/react";
+import { HStack, IconButton } from "@carbon/react";
import {
Avatar,
AvatarGroup,
- IconButton,
Input,
InputGroup,
InputLeftElement,
@@ -67,11 +66,6 @@ const SelectInput = () => {
aria-label="Clear search query"
icon={<MdOutlineClear />}
onClick={onClearInput}
- colorScheme="gray"
- h={8}
- w={8}
- borderRadius={4}
- size="sm"
variant="ghost"
/>
)}
diff --git a/apps/carbon/app/components/Selectors/UserSelect/components/SelectionList.tsx b/apps/carbon/app/components/Selectors/UserSelect/components/SelectionList.tsx
index 4e1f9462d6..141ae22531 100644
--- a/apps/carbon/app/components/Selectors/UserSelect/components/SelectionList.tsx
+++ b/apps/carbon/app/components/Selectors/UserSelect/components/SelectionList.tsx
@@ -1,11 +1,12 @@
import {
+ IconButton,
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger,
useColor,
} from "@carbon/react";
-import { Checkbox, IconButton, List, ListItem } from "@chakra-ui/react";
+import { Checkbox, List, ListItem } from "@chakra-ui/react";
import { useMemo } from "react";
import { MdOutlineClear, MdPlaylistAdd } from "react-icons/md";
import { Avatar } from "~/components";
@@ -96,9 +97,8 @@ const SelectionList = () => {
<IconButton
aria-label={`Expand ${item.label}`}
icon={<MdPlaylistAdd />}
- size="sm"
onClick={() => onExplode(item)}
- variant="outline"
+ variant="secondary"
/>
</TooltipTrigger>
<TooltipContent side="top">
@@ -113,9 +113,8 @@ const SelectionList = () => {
<IconButton
aria-label={`Remove ${item.label}`}
icon={<MdOutlineClear />}
- size="sm"
onClick={() => onDeselect(item)}
- variant="outline"
+ variant="secondary"
/>
</TooltipTrigger>
<TooltipContent side="top">
diff --git a/apps/carbon/app/components/Table/components/Actions/Actions.tsx b/apps/carbon/app/components/Table/components/Actions/Actions.tsx
index 6fc390cd2c..a80e835633 100644
--- a/apps/carbon/app/components/Table/components/Actions/Actions.tsx
+++ b/apps/carbon/app/components/Table/components/Actions/Actions.tsx
@@ -1,4 +1,5 @@
-import { Button, Menu, MenuButton, MenuItem, MenuList } from "@chakra-ui/react";
+import { Button } from "@carbon/react";
+import { Menu, MenuButton, MenuItem, MenuList } from "@chakra-ui/react";
import { IoMdCheckboxOutline } from "react-icons/io";
import type { TableAction } from "../../types";
@@ -17,7 +18,6 @@ const Actions = <T extends Object>({
<MenuButton
as={Button}
leftIcon={<IoMdCheckboxOutline />}
- colorScheme={disabled ? "gray" : "brand"}
variant="ghost"
>
Actions
diff --git a/apps/carbon/app/components/Table/components/Columns/Columns.tsx b/apps/carbon/app/components/Table/components/Columns/Columns.tsx
index 732987adc7..9252644fe2 100644
--- a/apps/carbon/app/components/Table/components/Columns/Columns.tsx
+++ b/apps/carbon/app/components/Table/components/Columns/Columns.tsx
@@ -1,6 +1,5 @@
-import { Button, HStack } from "@carbon/react";
+import { Button, HStack, IconButton } from "@carbon/react";
import {
- IconButton,
Popover,
PopoverArrow,
PopoverBody,
diff --git a/apps/carbon/app/components/Table/components/Filter/FilterRow.tsx b/apps/carbon/app/components/Table/components/Filter/FilterRow.tsx
index d2d68a116b..38a42f0bb1 100644
--- a/apps/carbon/app/components/Table/components/Filter/FilterRow.tsx
+++ b/apps/carbon/app/components/Table/components/Filter/FilterRow.tsx
@@ -1,5 +1,5 @@
-import { useDebounce } from "@carbon/react";
-import { Grid, IconButton, Input, Select } from "@chakra-ui/react";
+import { IconButton, useDebounce } from "@carbon/react";
+import { Grid, Input, Select } from "@chakra-ui/react";
import { useEffect, useState } from "react";
import { IoMdClose } from "react-icons/io";
import { filterOperatorLabels } from "~/utils/query";
diff --git a/apps/carbon/app/components/Table/components/Pagination/Pagination.tsx b/apps/carbon/app/components/Table/components/Pagination/Pagination.tsx
index 9702907482..d293afd25d 100644
--- a/apps/carbon/app/components/Table/components/Pagination/Pagination.tsx
+++ b/apps/carbon/app/components/Table/components/Pagination/Pagination.tsx
@@ -1,12 +1,6 @@
-import { Button, HStack } from "@carbon/react";
+import { Button, HStack, IconButton } from "@carbon/react";
import type { ThemeTypings } from "@chakra-ui/react";
-import {
- IconButton,
- Menu,
- MenuButton,
- MenuItem,
- MenuList,
-} from "@chakra-ui/react";
+import { Menu, MenuButton, MenuItem, MenuList } from "@chakra-ui/react";
import { BsChevronLeft, BsChevronRight } from "react-icons/bs";
export type PaginationProps = {
@@ -82,12 +76,14 @@ export const PaginationButtons = ({
icon={<BsChevronLeft />}
isDisabled={!canPreviousPage}
onClick={previousPage}
+ variant="secondary"
/>
<IconButton
aria-label="Next"
icon={<BsChevronRight />}
isDisabled={!canNextPage}
onClick={nextPage}
+ variant="secondary"
/>
</>
) : (
diff --git a/apps/carbon/app/components/Table/components/Sort/Sort.tsx b/apps/carbon/app/components/Table/components/Sort/Sort.tsx
index 5067c5a8b4..3bee9d3b6f 100644
--- a/apps/carbon/app/components/Table/components/Sort/Sort.tsx
+++ b/apps/carbon/app/components/Table/components/Sort/Sort.tsx
@@ -1,6 +1,5 @@
-import { Button, HStack } from "@carbon/react";
+import { Button, HStack, IconButton } from "@carbon/react";
import {
- IconButton,
Menu,
MenuButton,
MenuItem,
diff --git a/apps/carbon/app/modules/accounting/ui/AccountCategories/AccountCategoryDetail/AccountCategoryDetail.tsx b/apps/carbon/app/modules/accounting/ui/AccountCategories/AccountCategoryDetail/AccountCategoryDetail.tsx
index bd6a3bd6a1..aff92ff2f1 100644
--- a/apps/carbon/app/modules/accounting/ui/AccountCategories/AccountCategoryDetail/AccountCategoryDetail.tsx
+++ b/apps/carbon/app/modules/accounting/ui/AccountCategories/AccountCategoryDetail/AccountCategoryDetail.tsx
@@ -83,14 +83,17 @@ const AccountCategoryDetail = ({
return (
<HStack key={subcategory.id} className="w-full">
<p className="flex-grow">{subcategory.name}</p>
-
- <IconButton
- as={Link}
- to={subcategory.id}
+ <Button
+ asChild
+ isIcon
aria-label="Edit"
- icon={<BsPencilSquare />}
- variant="outline"
- />
+ variant="secondary"
+ >
+ <Link to={subcategory.id}>
+ <BsPencilSquare />
+ </Link>
+ </Button>
+
<IconButton
aria-label="Delete"
icon={<IoMdTrash />}
diff --git a/apps/carbon/app/modules/accounting/ui/ChartOfAccounts/ChartOfAccountsTable/ChartOfAccountsTable.tsx b/apps/carbon/app/modules/accounting/ui/ChartOfAccounts/ChartOfAccountsTable/ChartOfAccountsTable.tsx
index ed06d33be1..ba0d867472 100644
--- a/apps/carbon/app/modules/accounting/ui/ChartOfAccounts/ChartOfAccountsTable/ChartOfAccountsTable.tsx
+++ b/apps/carbon/app/modules/accounting/ui/ChartOfAccounts/ChartOfAccountsTable/ChartOfAccountsTable.tsx
@@ -1,5 +1,5 @@
-import { HStack } from "@carbon/react";
-import { Checkbox, IconButton, Link, Text } from "@chakra-ui/react";
+import { Button, HStack } from "@carbon/react";
+import { Checkbox, Link, Text } from "@chakra-ui/react";
import { Link as RemixLink, useNavigate } from "@remix-run/react";
import type { ColumnDef } from "@tanstack/react-table";
import { memo, useMemo } from "react";
@@ -31,18 +31,18 @@ const ChartOfAccountsTable = memo(({ data }: ChartOfAccountsTableProps) => {
</Link>
<div className="relative w-6 h-6">
- <IconButton
+ <Button
+ asChild
+ isIcon
+ variant="ghost"
+ className="absolute right-[-3px] top-[-3px] outline-none border-none active:outline-none focus-visible:outline-none"
aria-label="Edit account"
- as={RemixLink}
- icon={<MdMoreHoriz />}
- size="sm"
- position="absolute"
- right={-1}
- top={-1}
- to={`${row.original.id}`}
onClick={(e) => e.stopPropagation()}
- variant="ghost"
- />
+ >
+ <RemixLink to={`${row.original.id}`}>
+ <MdMoreHoriz />
+ </RemixLink>
+ </Button>
</div>
</HStack>
);
diff --git a/apps/carbon/app/modules/parts/ui/Part/PartSuppliers/PartSuppliers.tsx b/apps/carbon/app/modules/parts/ui/Part/PartSuppliers/PartSuppliers.tsx
index 25ee75717d..c46da401c2 100644
--- a/apps/carbon/app/modules/parts/ui/Part/PartSuppliers/PartSuppliers.tsx
+++ b/apps/carbon/app/modules/parts/ui/Part/PartSuppliers/PartSuppliers.tsx
@@ -7,11 +7,9 @@ import {
CardTitle,
HStack,
} from "@carbon/react";
-import { IconButton } from "@chakra-ui/react";
import { Link, Outlet, useNavigate } from "@remix-run/react";
import type { ColumnDef } from "@tanstack/react-table";
import { useMemo } from "react";
-import { MdMoreHoriz } from "react-icons/md";
import {
EditableList,
EditableNumber,
@@ -52,22 +50,22 @@ const PartSuppliers = ({ partSuppliers }: PartSuppliersProps) => {
<HStack className="justify-between">
{/* @ts-ignore */}
<span>{row.original.supplier.name}</span>
- {canEdit && (
+ {/* {canEdit && (
<div className="relative w-6 h-5">
- <IconButton
+ <Button
+ asChild
+ isIcon
+ variant="ghost"
+ className="absolute right-[-3px] top-[-3px] outline-none border-none active:outline-none focus-visible:outline-none"
aria-label="Edit part supplier"
- as={Link}
- icon={<MdMoreHoriz />}
- size="sm"
- position="absolute"
- right={-1}
- top={-1}
- to={`${row.original.id}`}
onClick={(e) => e.stopPropagation()}
- variant="ghost"
- />
+ >
+ <Link to={`${row.original.id}`}>
+ <MdMoreHoriz />
+ </Link>
+ </Button>
</div>
- )}
+ )} */}
</HStack>
),
},
@@ -92,7 +90,7 @@ const PartSuppliers = ({ partSuppliers }: PartSuppliersProps) => {
cell: (item) => item.getValue(),
},
];
- }, [canEdit]);
+ }, []);
const editableComponents = useMemo(
() => ({
diff --git a/apps/carbon/app/modules/parts/ui/Service/ServiceSuppliers/ServiceSuppliers.tsx b/apps/carbon/app/modules/parts/ui/Service/ServiceSuppliers/ServiceSuppliers.tsx
index 89f50b5c6f..fdafa6f924 100644
--- a/apps/carbon/app/modules/parts/ui/Service/ServiceSuppliers/ServiceSuppliers.tsx
+++ b/apps/carbon/app/modules/parts/ui/Service/ServiceSuppliers/ServiceSuppliers.tsx
@@ -7,11 +7,9 @@ import {
CardTitle,
HStack,
} from "@carbon/react";
-import { IconButton } from "@chakra-ui/react";
import { Link, Outlet, useNavigate } from "@remix-run/react";
import type { ColumnDef } from "@tanstack/react-table";
import { useMemo } from "react";
-import { MdMoreHoriz } from "react-icons/md";
import { EditableText } from "~/components/Editable";
import Grid from "~/components/Grid";
import type { ServiceSupplier } from "~/modules/parts";
@@ -34,22 +32,22 @@ const ServiceSuppliers = ({ serviceSuppliers }: ServiceSuppliersProps) => {
<HStack className="justify-between">
{/* @ts-ignore */}
<span>{row.original.supplier.name}</span>
- {canEdit && (
+ {/* {canEdit && (
<div className="relative w-6 h-5">
- <IconButton
+ <Button
+ asChild
+ isIcon
+ variant="ghost"
+ className="absolute right-[-3px] top-[-5px] outline-none border-none active:outline-none focus-visible:outline-none"
aria-label="Edit service supplier"
- as={Link}
- icon={<MdMoreHoriz />}
- size="sm"
- position="absolute"
- right={-1}
- top={-1}
- to={`${row.original.id}`}
onClick={(e) => e.stopPropagation()}
- variant="ghost"
- />
+ >
+ <Link to={`${row.original.id}`}>
+ <MdMoreHoriz />
+ </Link>
+ </Button>
</div>
- )}
+ )} */}
</HStack>
),
},
@@ -59,7 +57,7 @@ const ServiceSuppliers = ({ serviceSuppliers }: ServiceSuppliersProps) => {
cell: (item) => item.getValue(),
},
];
- }, [canEdit]);
+ }, []);
const editableComponents = useMemo(
() => ({
diff --git a/apps/carbon/app/modules/resources/ui/Attributes/AttributeCategoryDetail/AttributeCategoryDetail.tsx b/apps/carbon/app/modules/resources/ui/Attributes/AttributeCategoryDetail/AttributeCategoryDetail.tsx
index 02691d1521..e08c5bc5ab 100644
--- a/apps/carbon/app/modules/resources/ui/Attributes/AttributeCategoryDetail/AttributeCategoryDetail.tsx
+++ b/apps/carbon/app/modules/resources/ui/Attributes/AttributeCategoryDetail/AttributeCategoryDetail.tsx
@@ -1,4 +1,4 @@
-import { Button, HStack, useDisclosure } from "@carbon/react";
+import { Button, HStack, IconButton, useDisclosure } from "@carbon/react";
import {
Drawer,
DrawerBody,
@@ -7,7 +7,6 @@ import {
DrawerFooter,
DrawerHeader,
DrawerOverlay,
- IconButton,
Tag,
TagLabel,
} from "@chakra-ui/react";
@@ -129,7 +128,6 @@ const AttributeCategoryDetail = ({
return (
<Reorder.Item
key={sortId}
- as={Reorder.Item}
value={sortId}
className="rounded-lg"
>
@@ -160,18 +158,20 @@ const AttributeCategoryDetail = ({
}
</Button>
- <IconButton
- as={Link}
- // @ts-ignore
- to={sortId.toString()}
+ <Button
+ asChild
+ isIcon
aria-label="Edit"
- icon={<BsPencilSquare />}
- variant="outline"
- />
+ variant="ghost"
+ >
+ <Link to={sortId.toString()}>
+ <BsPencilSquare />
+ </Link>
+ </Button>
<IconButton
aria-label="Delete"
icon={<IoMdTrash />}
- variant="outline"
+ variant="ghost"
onClick={() =>
// @ts-ignore
onDelete(attributeMap[sortId])
diff --git a/apps/carbon/app/modules/resources/ui/Person/PersonJob/PersonJob.tsx b/apps/carbon/app/modules/resources/ui/Person/PersonJob/PersonJob.tsx
index f9b30e4f8e..0ac0664adc 100644
--- a/apps/carbon/app/modules/resources/ui/Person/PersonJob/PersonJob.tsx
+++ b/apps/carbon/app/modules/resources/ui/Person/PersonJob/PersonJob.tsx
@@ -43,6 +43,7 @@ const PersonJob = ({ job }: PersonJobProps) => {
return (
<div className="w-full">
+ <SectionTitle>Job</SectionTitle>
<ValidatedForm
validator={employeeJobValidator}
method="post"
@@ -53,7 +54,6 @@ const PersonJob = ({ job }: PersonJobProps) => {
shiftId: job.shiftId ?? undefined,
}}
>
- <SectionTitle>Job</SectionTitle>
<VStack spacing={4}>
<Input name="title" label="Title" />
<DatePicker name="startDate" label="Start Date" />
@@ -68,7 +68,7 @@ const PersonJob = ({ job }: PersonJobProps) => {
/>
<Employee name="managerId" label="Manager" />
<Hidden name="intent" value="job" />
- <Submit size="sm">Save</Submit>
+ <Submit>Save</Submit>
</VStack>
</ValidatedForm>
</div>
diff --git a/apps/carbon/app/modules/resources/ui/Person/PersonTabs/PersonTabs.tsx b/apps/carbon/app/modules/resources/ui/Person/PersonTabs/PersonTabs.tsx
index 56c7908222..d3da717e37 100644
--- a/apps/carbon/app/modules/resources/ui/Person/PersonTabs/PersonTabs.tsx
+++ b/apps/carbon/app/modules/resources/ui/Person/PersonTabs/PersonTabs.tsx
@@ -26,7 +26,7 @@ type PersonTabsProps = {
privateAttributes: PrivateAttributes[];
};
-const PersonsTabs = ({
+const PersonTabs = ({
user,
job,
notes,
@@ -97,4 +97,4 @@ const PersonsTabs = ({
);
};
-export default PersonsTabs;
+export default PersonTabs;
diff --git a/apps/carbon/app/modules/shared/ui/Realtime/RealtimeDataProvider.tsx b/apps/carbon/app/modules/shared/ui/Realtime/RealtimeDataProvider.tsx
index 4d73419825..231c42951d 100644
--- a/apps/carbon/app/modules/shared/ui/Realtime/RealtimeDataProvider.tsx
+++ b/apps/carbon/app/modules/shared/ui/Realtime/RealtimeDataProvider.tsx
@@ -1,4 +1,3 @@
-import { useColorModeValue } from "@chakra-ui/react";
import { useEffect, useState } from "react";
import { useSupabase } from "~/lib/supabase";
import { useCustomers, useParts, useSuppliers } from "~/stores";
@@ -206,12 +205,14 @@ function Loading() {
return (
<div className="flex flex-col h-screen w-screen items-center justify-center">
<img
- src={useColorModeValue(
- "/carbon-logo-dark.png",
- "/carbon-logo-light.png"
- )}
+ src="/carbon-logo-dark.png"
alt="Carbon Logo"
- className="max-w-[100px]"
+ className="block dark:hidden max-w-[100px]"
+ />
+ <img
+ src="/carbon-logo-light.png"
+ alt="Carbon Logo"
+ className="hidden dark:block max-w-[100px]"
/>
</div>
);
diff --git a/apps/carbon/app/routes/onboarding+/_layout.tsx b/apps/carbon/app/routes/onboarding+/_layout.tsx
index 6abebdb1cc..57b9c192f8 100644
--- a/apps/carbon/app/routes/onboarding+/_layout.tsx
+++ b/apps/carbon/app/routes/onboarding+/_layout.tsx
@@ -1,5 +1,5 @@
-import { HStack, useColor } from "@carbon/react";
-import { Avatar, Box, Grid, GridItem, IconButton } from "@chakra-ui/react";
+import { HStack, IconButton, useColor } from "@carbon/react";
+import { Avatar, Grid, GridItem } from "@chakra-ui/react";
import { redirect, type LoaderFunctionArgs } from "@remix-run/node";
import { Outlet } from "@remix-run/react";
import { BsFillHexagonFill } from "react-icons/bs";
@@ -85,23 +85,14 @@ function TopbarPlaceholder() {
function SidebarPlaceholder() {
return (
- <Box
- h="full"
- borderRight={1}
- borderRightColor={useColor("gray.200")}
- borderRightStyle="solid"
- background={useColor("white")}
- zIndex={1}
- >
+ <div className="h-full border-r border-border bg-background z-1">
<IconButton
aria-label="Home"
+ icon={<BsFillHexagonFill />}
variant="ghost"
size="lg"
- icon={<BsFillHexagonFill />}
- position="sticky"
- top={0}
- mb={4}
+ className="rounded-none"
/>
- </Box>
+ </div>
);
}
diff --git a/packages/react/src/Button.tsx b/packages/react/src/Button.tsx
index bedbe26ae2..1e65f20a86 100644
--- a/packages/react/src/Button.tsx
+++ b/packages/react/src/Button.tsx
@@ -6,63 +6,70 @@ import { cloneElement, forwardRef } from "react";
import { cn } from "~/utils/cn";
-const base = [
- "inline-flex items-center justify-center whitespace-nowrap",
- "rounded-md font-medium ring-offset-background transition-colors",
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
- "focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
-].join(" ");
-
-const buttonVariants = cva(base, {
- variants: {
- variant: {
- primary:
- "bg-primary text-primary-foreground hover:bg-primary/90 shadow-sm",
- secondary:
- "border border-input text-primary bg-background hover:bg-foreground/[0.05] shadow-sm",
- solid: "bg-accent text-accent-foreground hover:bg-accent/80",
- destructive:
- "bg-destructive text-destructive-foreground hover:bg-destructive/90 shadow-sm",
- ghost:
- "bg-transparent hover:bg-accent text-accent-foreground hover:text-accent-foreground/90",
- link: "text-primary hover:text-primary underline-offset-4 hover:underline",
- },
- size: {
- md: "h-8 px-4 rounded-md text-sm",
- lg: "h-11 px-6 rounded-lg text-base",
- },
- isDisabled: {
- true: "opacity-50 disabled:cursor-not-allowed",
- },
- isLoading: {
- true: "opacity-50 pointer-events-none",
- },
- isIcon: {
- false: "px-4",
- },
- isRound: {
- true: "rounded-full",
- false: "rounded-md",
+const buttonVariants = cva(
+ "inline-flex items-center justify-center whitespace-nowrap rounded-md font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
+ {
+ variants: {
+ variant: {
+ primary:
+ "bg-primary text-primary-foreground hover:bg-primary/90 shadow-sm",
+ secondary:
+ "border border-input text-primary bg-background hover:bg-foreground/[0.05] shadow-sm",
+ solid: "bg-accent text-accent-foreground hover:bg-accent/80",
+ destructive:
+ "bg-destructive text-destructive-foreground hover:bg-destructive/90 shadow-sm",
+ ghost:
+ "bg-transparent hover:bg-accent text-accent-foreground hover:text-accent-foreground/90",
+ link: "text-primary hover:text-primary underline-offset-4 hover:underline",
+ },
+ size: {
+ md: "h-8 rounded-md text-sm",
+ lg: "h-11 rounded-lg text-base",
+ },
+ isDisabled: {
+ true: "opacity-50 disabled:cursor-not-allowed",
+ },
+ isLoading: {
+ true: "opacity-50 pointer-events-none",
+ },
+ isIcon: {
+ true: "",
+ false: "",
+ },
+ isRound: {
+ true: "rounded-full",
+ false: "rounded-md",
+ },
},
- },
- compoundVariants: [
- {
+ compoundVariants: [
+ {
+ size: "md",
+ isIcon: true,
+ class: "w-8 p-2",
+ },
+ {
+ size: "lg",
+ isIcon: true,
+ class: "w-11 p-2",
+ },
+ {
+ size: "md",
+ isIcon: false,
+ class: "px-4",
+ },
+ {
+ size: "lg",
+ isIcon: false,
+ class: "px-6",
+ },
+ ],
+ defaultVariants: {
+ variant: "primary",
size: "md",
- isIcon: true,
- class: "w-8",
- },
- {
- size: "lg",
- isIcon: true,
- class: "w-11",
+ isRound: false,
},
- ],
- defaultVariants: {
- variant: "primary",
- size: "md",
- isRound: false,
- },
-});
+ }
+);
export interface ButtonProps
extends ButtonHTMLAttributes<HTMLButtonElement>,
diff --git a/packages/react/src/Card.tsx b/packages/react/src/Card.tsx
index f8ddd6b9a2..0e5236c774 100644
--- a/packages/react/src/Card.tsx
+++ b/packages/react/src/Card.tsx
@@ -45,7 +45,7 @@ const CardTitle = forwardRef<
<h3
ref={ref}
className={cn(
- "text-2xl font-semibold leading-none tracking-tight",
+ "text-2xl font-semibold leading-none tracking-tight text-foreground",
className
)}
{...props}
diff --git a/packages/react/src/Editor/Toolbar/ToolbarButton.tsx b/packages/react/src/Editor/Toolbar/ToolbarButton.tsx
index 52e4ea300f..c527b5088a 100644
--- a/packages/react/src/Editor/Toolbar/ToolbarButton.tsx
+++ b/packages/react/src/Editor/Toolbar/ToolbarButton.tsx
@@ -1,22 +1,18 @@
-import type { IconButtonProps } from "@chakra-ui/react";
-import { IconButton } from "@chakra-ui/react";
+import type { ReactElement } from "react";
+import type { ButtonProps } from "~/Button";
+import { IconButton } from "~/IconButton";
import { Tooltip, TooltipContent, TooltipTrigger } from "~/Tooltip";
-type ToolbarButtonProps = Omit<IconButtonProps, "aria-label"> & {
+type ToolbarButtonProps = Omit<ButtonProps, "aria-label"> & {
label: string;
+ icon: ReactElement;
};
const ToolbarButton = ({ label, ...rest }: ToolbarButtonProps) => {
return (
<Tooltip>
<TooltipTrigger asChild>
- <IconButton
- size="sm"
- variant="ghost"
- colorScheme="gray"
- aria-label={label}
- {...rest}
- />
+ <IconButton variant="ghost" aria-label={label} {...rest} />
</TooltipTrigger>
<TooltipContent>{label}</TooltipContent>
</Tooltip>
diff --git a/packages/react/src/IconButton.tsx b/packages/react/src/IconButton.tsx
new file mode 100644
index 0000000000..20cd005150
--- /dev/null
+++ b/packages/react/src/IconButton.tsx
@@ -0,0 +1,43 @@
+import type { ReactElement } from "react";
+import { cloneElement, forwardRef, isValidElement } from "react";
+
+import type { ButtonProps } from "~/Button";
+import { Button } from "~/Button";
+
+export interface IconButtonProps
+ extends Omit<ButtonProps, "leftIcon" | "rightIcon"> {
+ "aria-label": string;
+ icon: ReactElement;
+ isRound?: boolean;
+}
+
+const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(
+ ({ icon, "aria-label": ariaLabel, isRound, children, ...props }, ref) => {
+ /**
+ * Passing the icon as prop or children should work
+ */
+ const element = icon || children;
+ const _children = isValidElement(element)
+ ? cloneElement(element as any, {
+ "aria-hidden": true,
+ focusable: false,
+ className: "w-5 h-5",
+ })
+ : null;
+
+ return (
+ <Button
+ aria-label={ariaLabel}
+ ref={ref}
+ isIcon
+ isRound={isRound}
+ {...props}
+ >
+ {_children}
+ </Button>
+ );
+ }
+);
+IconButton.displayName = "IconButton";
+
+export { IconButton };
diff --git a/packages/react/src/Tooltip.tsx b/packages/react/src/Tooltip.tsx
index 35d0a93dbd..e4a5aaa705 100644
--- a/packages/react/src/Tooltip.tsx
+++ b/packages/react/src/Tooltip.tsx
@@ -24,7 +24,7 @@ const TooltipContent = forwardRef<
ref={ref}
sideOffset={sideOffset}
className={cn(
- "z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md 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",
+ "z-50 overflow-hidden rounded-md border border-border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md 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",
className
)}
{...props}
diff --git a/packages/react/src/index.tsx b/packages/react/src/index.tsx
index a4aff4c807..f7d8a4e7dc 100644
--- a/packages/react/src/index.tsx
+++ b/packages/react/src/index.tsx
@@ -26,6 +26,7 @@ import { File } from "./File";
import { HStack } from "./HStack";
import { HTML } from "./HTML";
import { Heading } from "./Heading";
+import { IconButton } from "./IconButton";
import { Loading } from "./Loading";
import { Menubar, MenubarItem, MenubarTrigger } from "./Menubar";
import type {
@@ -85,6 +86,7 @@ export {
HStack,
HTML,
Heading,
+ IconButton,
Loading,
Menubar,
MenubarItem,