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: remaining components

Brad Barbin25e98895341e
diff --git a/apps/carbon/app/components/MultiSelect.tsx b/apps/carbon/app/components/MultiSelect.tsx
index ff29a1dc30..ef7981c17b 100644
--- a/apps/carbon/app/components/MultiSelect.tsx
+++ b/apps/carbon/app/components/MultiSelect.tsx
@@ -1,5 +1,6 @@
import {
Badge,
+ BadgeCloseButton,
Button,
Command,
CommandEmpty,
@@ -14,7 +15,6 @@ import {
} from "@carbon/react";
import type { ComponentPropsWithoutRef } from "react";
import { forwardRef, useState } from "react";
-import { MdClose } from "react-icons/md";
import { RxCheck, RxMagnifyingGlass } from "react-icons/rx";
export type MultiSelectProps = Omit<
@@ -64,8 +64,7 @@ const MultiSelect = forwardRef<HTMLButtonElement, MultiSelectProps>(
onClick={() => handleUnselect(item)}
>
{options.find((option) => option.value === item)?.label}
- <button
- className="ml-1 ring-offset-background rounded-full outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2"
+ <BadgeCloseButton
onKeyDown={(e) => {
if (e.key === "Enter") {
handleUnselect(item);
@@ -76,9 +75,7 @@ const MultiSelect = forwardRef<HTMLButtonElement, MultiSelectProps>(
e.stopPropagation();
}}
onClick={() => handleUnselect(item)}
- >
- <MdClose className="h-3 w-3 text-muted-foreground hover:text-foreground" />
- </button>
+ />
</Badge>
))}
</div>
diff --git a/apps/carbon/app/components/Selectors/UserSelect/components/Input.tsx b/apps/carbon/app/components/Selectors/UserSelect/components/Input.tsx
index 1751cc0bbc..e44e54357d 100644
--- a/apps/carbon/app/components/Selectors/UserSelect/components/Input.tsx
+++ b/apps/carbon/app/components/Selectors/UserSelect/components/Input.tsx
@@ -7,8 +7,8 @@ import {
InputGroup,
InputLeftElement,
InputRightElement,
+ Spinner,
} from "@carbon/react";
-import { Spinner } from "@chakra-ui/react";
import { MdOutlineClear } from "react-icons/md";
import useUserSelectContext from "../provider";
@@ -57,7 +57,7 @@ const Input = () => {
{!readOnly && !disabled && (
<InputRightElement>
<HStack spacing={1}>
- {loading && <Spinner size="sm" />}
+ {loading && <Spinner />}
{!loading && !disabled && inputValue.length > 0 && (
<IconButton
aria-label="Clear search query"
diff --git a/apps/carbon/app/components/Selectors/UserSelect/components/TreeSelect.tsx b/apps/carbon/app/components/Selectors/UserSelect/components/TreeSelect.tsx
index 31b516a8de..0b884e72c1 100644
--- a/apps/carbon/app/components/Selectors/UserSelect/components/TreeSelect.tsx
+++ b/apps/carbon/app/components/Selectors/UserSelect/components/TreeSelect.tsx
@@ -1,10 +1,8 @@
-import { HStack, Loading, cn } from "@carbon/react";
-import { Box, Icon, List, ListItem } from "@chakra-ui/react";
+import { HStack, Spinner, cn } from "@carbon/react";
import { FaChevronRight } from "react-icons/fa";
import { RxCheck } from "react-icons/rx";
import useUserSelectContext from "../provider";
import type { IndividualOrGroup, OptionGroup } from "../types";
-import { useGroupStyles, useOptionStyles } from "./useUserSelectStyles";
const UserTreeSelect = () => {
const {
@@ -17,7 +15,7 @@ const UserTreeSelect = () => {
} = useUserSelectContext();
return (
- <List
+ <div
{...listBoxProps}
aria-multiselectable={isMulti}
ref={listBoxRef}
@@ -25,23 +23,23 @@ const UserTreeSelect = () => {
className="overflow-auto max-h-[300px] my-1 flex flex-col"
>
{loading ? (
- <Loading />
+ <Spinner />
) : groups.length > 0 ? (
groups.map((group) => <Group key={group.uid} group={group} />)
) : (
<p className="text-center">No options found</p>
)}
- </List>
+ </div>
);
};
const MoreIcon = ({ isExpanded }: { isExpanded: boolean }) => (
- <Icon
- as={FaChevronRight}
- w={4}
- h={4}
- transition="transform .25s ease"
- transform={isExpanded ? "rotate(-0.25turn)" : undefined}
+ <FaChevronRight
+ className="h-3 w-3"
+ style={{
+ transition: "transform .25s ease",
+ transform: isExpanded ? "rotate(0.25turn)" : undefined,
+ }}
/>
);
@@ -58,7 +56,6 @@ const Group = ({ group }: { group: OptionGroup }) => {
const isFocused = group.uid === focusedId;
const isExpanded = group.expanded && group.items.length > 0;
- const sx = useGroupStyles(isFocused, isExpanded);
return (
<div
@@ -67,17 +64,22 @@ const Group = ({ group }: { group: OptionGroup }) => {
className="rounded-md outline-none"
aria-expanded={isExpanded}
>
- <Box
+ <div
role="treeitem"
aria-selected={isExpanded ? "true" : "false"}
onClick={() =>
group.expanded ? onGroupCollapse(group.uid) : onGroupExpand(group.uid)
}
- sx={sx}
+ className={cn(
+ "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 w-full",
+ isFocused && "bg-accent text-accent-foreground"
+ )}
>
- <span className="line-clamp-1">{group.name}</span>
- <MoreIcon isExpanded={isExpanded} />
- </Box>
+ <HStack className="w-full justify-between items-center">
+ <span className="line-clamp-1">{group.name}</span>
+ <MoreIcon isExpanded={isExpanded} />
+ </HStack>
+ </div>
{isExpanded && (
<ul role="group" className="flex flex-col">
{group.items.map((item) => {
@@ -122,18 +124,21 @@ const Option = ({
isSelected: boolean;
onClick?: () => void;
}) => {
- const sx = useOptionStyles(isFocused, isSelected, isDisabled);
const name = item.label;
return (
- <ListItem
- as="li"
+ <li
id={id}
+ className={cn(
+ "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
+ (isSelected || isFocused) && "bg-accent text-accent-foreground",
+ isDisabled && "opacity-50 pointer-events-none"
+ )}
tabIndex={0}
aria-selected={isSelected}
+ aria-disabled={isDisabled}
role="treeitem"
onClick={onClick}
- sx={sx}
>
<HStack spacing={1} className="w-full items-center">
<RxCheck
@@ -144,7 +149,7 @@ const Option = ({
/>
<span className="line-clamp-1">{name}</span>
</HStack>
- </ListItem>
+ </li>
);
};
diff --git a/apps/carbon/app/components/Selectors/UserSelect/components/useUserSelectStyles.ts b/apps/carbon/app/components/Selectors/UserSelect/components/useUserSelectStyles.ts
deleted file mode 100644
index 5e3a6d3feb..0000000000
--- a/apps/carbon/app/components/Selectors/UserSelect/components/useUserSelectStyles.ts
+++ /dev/null
@@ -1,88 +0,0 @@
-import { useColor } from "@carbon/react";
-import type { SystemStyleObject } from "@chakra-ui/react";
-import { useMultiStyleConfig } from "@chakra-ui/react";
-
-export const useGroupStyles = (isFocused: boolean, isSticky: boolean) => {
- const menuItemStyles = useMultiStyleConfig("Menu").item;
- const selectedBg = useColor("gray.200");
- const selectedColor = useColor("black");
-
- const sx: SystemStyleObject = {
- ...menuItemStyles,
- transition: "none",
- cursor: "pointer",
- display: "flex",
- alignItems: "center",
- justifyContent: "space-between",
- width: "100%",
- textAlign: "start",
- padding: "8px 12px",
- marginBottom: "3px",
- bg: "transparent",
- borderRadius: "md",
-
- ...(isFocused && menuItemStyles._focus),
- ...(isFocused && {
- bg: selectedBg,
- color: selectedColor,
- _active: { bg: selectedBg },
- }),
- _hover: {
- bg: selectedBg,
- color: selectedColor,
- ...menuItemStyles._focus,
- },
- _focus: {
- boxShadow: "none",
- outlineWeight: "3px",
- },
- };
-
- return sx;
-};
-
-export const useOptionStyles = (
- isFocused: boolean,
- isSelected?: boolean,
- isDisabled?: boolean
-) => {
- const menuItemStyles = useMultiStyleConfig("Menu").item;
- const selectedBg = useColor("gray.700");
- const selectedColor = useColor("white");
-
- const sx: SystemStyleObject = {
- ...menuItemStyles,
- fontSize: "0.9em",
- transition: "none",
- cursor: "pointer",
- display: "flex",
- alignItems: "center",
- width: "100%",
- textAlign: "start",
- padding: "8px 12px",
- marginBottom: "3px",
- bg: "transparent",
- borderRadius: "md",
- outlineOffset: "3px",
- ...(isFocused && menuItemStyles._focus),
- ...(isSelected && {
- // bg: selectedBg,
- // color: selectedColor,
- // _active: { bg: selectedBg },
- ...menuItemStyles._focus,
- }),
- ...(isFocused && { bg: selectedBg, color: selectedColor }),
- ...(isDisabled && menuItemStyles._disabled),
- ...(isDisabled && { _active: {} }),
- _hover: {
- bg: selectedBg,
- color: selectedColor,
- },
- _focus: {
- boxShadow: "none",
- outline: "none",
- },
- };
-
- return sx;
-};
diff --git a/apps/carbon/app/components/Selectors/UserSelect/useUserSelect.ts b/apps/carbon/app/components/Selectors/UserSelect/useUserSelect.ts
index 203d1c45bb..e6612ff49c 100644
--- a/apps/carbon/app/components/Selectors/UserSelect/useUserSelect.ts
+++ b/apps/carbon/app/components/Selectors/UserSelect/useUserSelect.ts
@@ -148,7 +148,7 @@ export default function useUserSelect(props: UserSelectProps) {
return acc.concat({
uid,
expanded: false,
- items: makeGroupItems(group, uid),
+ items: makeGroupItems(group as Group, uid),
name: group.data.name || "",
});
}
diff --git a/apps/carbon/app/components/Table/components/Filter/Filter.tsx b/apps/carbon/app/components/Table/components/Filter/Filter.tsx
index d28494f8df..b82408589b 100644
--- a/apps/carbon/app/components/Table/components/Filter/Filter.tsx
+++ b/apps/carbon/app/components/Table/components/Filter/Filter.tsx
@@ -48,7 +48,7 @@ const Filter = ({ columnAccessors }: FilterProps) => {
{filters.length === 0 ? "Filter" : "Filtered"}
</Button>
</PopoverTrigger>
- <PopoverContent className="w-[480px]">
+ <PopoverContent className="w-[520px]">
{filters.length === 0 && (
<PopoverHeader>
<p className="text-sm">No filters applied to this view</p>
diff --git a/apps/carbon/app/components/Table/components/Filter/FilterRow.tsx b/apps/carbon/app/components/Table/components/Filter/FilterRow.tsx
index e6608ff1be..8d697c9b2b 100644
--- a/apps/carbon/app/components/Table/components/Filter/FilterRow.tsx
+++ b/apps/carbon/app/components/Table/components/Filter/FilterRow.tsx
@@ -1,7 +1,7 @@
import { IconButton, Input, useDebounce } from "@carbon/react";
-import { Select } from "@chakra-ui/react";
import { useEffect, useState } from "react";
import { IoMdClose } from "react-icons/io";
+import { Select } from "~/components";
import { filterOperatorLabels } from "~/utils/query";
type FilterRowProps = {
@@ -30,37 +30,45 @@ const FilterRow = ({
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [debouncedQuery]);
- const onColumnChange = (e: React.ChangeEvent<HTMLSelectElement>) => {
- const newFilter = `${e.target.value}:${operator}:${searchValue}`;
+ const onColumnChange = (value: string) => {
+ const newFilter = `${value}:${operator}:${searchValue}`;
onUpdate(newFilter);
};
- const onOperatorChange = (e: React.ChangeEvent<HTMLSelectElement>) => {
- const newFilter = `${column}:${e.target.value}:${searchValue}`;
+ const onOperatorChange = (value: string) => {
+ const newFilter = `${column}:${value}:${searchValue}`;
onUpdate(newFilter);
};
return (
<div className="grid gap-x-2 grid-cols-[1fr_1fr_1fr_auto]">
- <Select size="sm" defaultValue={column} onChange={onColumnChange}>
- {Object.entries(columnAccessors).map(([accessor, title]) => (
- <option key={accessor} value={accessor}>
- {title}
- </option>
- ))}
- </Select>
- <Select size="sm" defaultValue={operator} onChange={onOperatorChange}>
- {filterOperatorLabels.map(({ operator, label }) => (
- <option key={operator} value={operator}>
- {label}
- </option>
- ))}
- </Select>
+ <Select
+ size="sm"
+ defaultValue={column}
+ placeholder="Column"
+ onChange={onColumnChange}
+ options={Object.entries(columnAccessors).map(([accessor, title]) => ({
+ label: title,
+ value: accessor,
+ }))}
+ className="w-[100px]"
+ />
+ <Select
+ size="sm"
+ placeholder="Operator"
+ defaultValue={operator}
+ onChange={onOperatorChange}
+ options={filterOperatorLabels.map(({ operator, label }) => ({
+ label,
+ value: operator,
+ }))}
+ className="w-[100px]"
+ />
<Input
defaultValue={searchValue}
onChange={(e) => setValue(e.target.value)}
size="sm"
- placeholder="Enter a value"
+ placeholder="Value"
/>
<IconButton
aria-label="Remove filter"
diff --git a/apps/carbon/app/entry.client.tsx b/apps/carbon/app/entry.client.tsx
index b3284edbf8..0b42fdafdd 100644
--- a/apps/carbon/app/entry.client.tsx
+++ b/apps/carbon/app/entry.client.tsx
@@ -1,27 +1,13 @@
-import createEmotionCache from "@emotion/cache";
-import { CacheProvider } from "@emotion/react";
import { RemixBrowser } from "@remix-run/react";
-import { startTransition } from "react";
import { hydrateRoot } from "react-dom/client";
-const hydrate = () => {
- const emotionCache = createEmotionCache({ key: "css" });
-
- startTransition(() => {
- hydrateRoot(
- document,
-
- <CacheProvider value={emotionCache}>
- <RemixBrowser />
- </CacheProvider>
- );
- });
-};
-
-if (typeof requestIdleCallback === "function") {
- requestIdleCallback(hydrate);
-} else {
- // Safari doesn't support requestIdleCallback
- // https://caniuse.com/requestidlecallback
- setTimeout(hydrate, 1);
-}
+hydrateRoot(
+ document,
+ // <OperatingSystemContextProvider
+ // platform={window.navigator.userAgent.includes("Mac") ? "mac" : "windows"}
+ // >
+ // <LocaleContextProvider locales={window.navigator.languages as string[]}>
+ <RemixBrowser />
+ // </LocaleContextProvider>
+ // </OperatingSystemContextProvider>
+);
diff --git a/apps/carbon/app/entry.server.tsx b/apps/carbon/app/entry.server.tsx
index 987d2a2499..9bc1bb95a8 100644
--- a/apps/carbon/app/entry.server.tsx
+++ b/apps/carbon/app/entry.server.tsx
@@ -1,146 +1,172 @@
-import { PassThrough } from "stream";
-
-import createEmotionCache from "@emotion/cache";
-import { CacheProvider as EmotionCacheProvider } from "@emotion/react";
-import createEmotionServer from "@emotion/server/create-instance";
-import type {
- AppLoadContext,
- DataFunctionArgs,
- EntryContext,
-} from "@remix-run/node";
+import {
+ createReadableStreamFromReadable,
+ type DataFunctionArgs,
+ type EntryContext,
+} from "@remix-run/node"; // or cloudflare/deno
import { RemixServer } from "@remix-run/react";
+// import { parseAcceptLanguage } from "intl-parse-accept-language";
import isbot from "isbot";
import { renderToPipeableStream } from "react-dom/server";
+import { PassThrough } from "stream";
import logger from "~/lib/logger";
-const ABORT_DELAY = 5000;
+const ABORT_DELAY = 30000;
-const handleRequest = (
+export default function handleRequest(
request: Request,
responseStatusCode: number,
responseHeaders: Headers,
- remixContext: EntryContext,
- loadContext: AppLoadContext
-) =>
- isbot(request.headers.get("user-agent"))
- ? handleBotRequest(
- request,
- responseStatusCode,
- responseHeaders,
- remixContext
- )
- : handleBrowserRequest(
- request,
- responseStatusCode,
- responseHeaders,
- remixContext
- );
-export default handleRequest;
-
-const handleBotRequest = (
+ remixContext: EntryContext
+) {
+ // const acceptLanguage = request.headers.get("accept-language");
+ // const locales = parseAcceptLanguage(acceptLanguage, {
+ // validate: Intl.DateTimeFormat.supportedLocalesOf,
+ // });
+
+ //get whether it's a mac or pc from the headers
+ // const platform: OperatingSystemPlatform = request.headers.get("user-agent")?.includes("Mac")
+ // ? "mac"
+ // : "windows";
+
+ // If the request is from a bot, we want to wait for the full
+ // response to render before sending it to the client. This
+ // ensures that bots can see the full page content.
+ if (isbot(request.headers.get("user-agent"))) {
+ return handleBotRequest(
+ request,
+ responseStatusCode,
+ responseHeaders,
+ remixContext
+ // locales,
+ // platform
+ );
+ }
+
+ return handleBrowserRequest(
+ request,
+ responseStatusCode,
+ responseHeaders,
+ remixContext
+ // locales,
+ // platform
+ );
+}
+
+function handleBotRequest(
request: Request,
responseStatusCode: number,
responseHeaders: Headers,
remixContext: EntryContext
-) =>
- new Promise((resolve, reject) => {
- let didError = false;
- const emotionCache = createEmotionCache({ key: "css" });
-
+ // locales: string[],
+ // platform: OperatingSystemPlatform
+) {
+ return new Promise((resolve, reject) => {
+ let shellRendered = false;
const { pipe, abort } = renderToPipeableStream(
- <EmotionCacheProvider value={emotionCache}>
- <RemixServer context={remixContext} url={request.url} />
- </EmotionCacheProvider>,
+ // <OperatingSystemContextProvider platform={platform}>
+ // <LocaleContextProvider locales={locales}>
+ <RemixServer
+ context={remixContext}
+ url={request.url}
+ abortDelay={ABORT_DELAY}
+ />,
+ // </LocaleContextProvider>
+ // </OperatingSystemContextProvider>,
{
- onAllReady: () => {
- const reactBody = new PassThrough();
- const emotionServer = createEmotionServer(emotionCache);
-
- const bodyWithStyles = emotionServer.renderStylesToNodeStream();
- reactBody.pipe(bodyWithStyles);
+ onAllReady() {
+ shellRendered = true;
+ const body = new PassThrough();
+ const stream = createReadableStreamFromReadable(body);
responseHeaders.set("Content-Type", "text/html");
resolve(
- // @ts-expect-error
- new Response(bodyWithStyles, {
+ new Response(stream, {
headers: responseHeaders,
- status: didError ? 500 : responseStatusCode,
+ status: responseStatusCode,
})
);
- pipe(reactBody);
+ pipe(body);
},
- onShellError: (error: unknown) => {
+ onShellError(error: unknown) {
reject(error);
},
- onError: (error: unknown) => {
- didError = true;
-
- console.error(error);
+ onError(error: unknown) {
+ responseStatusCode = 500;
+ // Log streaming rendering errors from inside the shell. Don't log
+ // errors encountered during initial shell rendering since they'll
+ // reject and get logged in handleDocumentRequest.
+ if (shellRendered) {
+ console.error(error);
+ }
},
}
);
setTimeout(abort, ABORT_DELAY);
});
+}
-const handleBrowserRequest = (
+function handleBrowserRequest(
request: Request,
responseStatusCode: number,
responseHeaders: Headers,
remixContext: EntryContext
-) =>
- new Promise((resolve, reject) => {
- let didError = false;
- const emotionCache = createEmotionCache({ key: "css" });
-
+ // locales: string[],
+ // platform: OperatingSystemPlatform
+) {
+ return new Promise((resolve, reject) => {
+ let shellRendered = false;
const { pipe, abort } = renderToPipeableStream(
- <EmotionCacheProvider value={emotionCache}>
- <RemixServer context={remixContext} url={request.url} />
- </EmotionCacheProvider>,
+ // <OperatingSystemContextProvider platform={platform}>
+ // <LocaleContextProvider locales={locales}>
+ <RemixServer
+ context={remixContext}
+ url={request.url}
+ abortDelay={ABORT_DELAY}
+ />,
+ // </LocaleContextProvider>
+ // </OperatingSystemContextProvider>,
{
- onShellReady: () => {
- const reactBody = new PassThrough();
- const emotionServer = createEmotionServer(emotionCache);
-
- const bodyWithStyles = emotionServer.renderStylesToNodeStream();
- reactBody.pipe(bodyWithStyles);
+ onShellReady() {
+ shellRendered = true;
+ const body = new PassThrough();
+ const stream = createReadableStreamFromReadable(body);
responseHeaders.set("Content-Type", "text/html");
resolve(
- // @ts-expect-error
- new Response(bodyWithStyles, {
+ new Response(stream, {
headers: responseHeaders,
- status: didError ? 500 : responseStatusCode,
+ status: responseStatusCode,
})
);
- pipe(reactBody);
+ pipe(body);
},
- onShellError: (error: unknown) => {
+ onShellError(error: unknown) {
reject(error);
},
- onError: (error: unknown) => {
- didError = true;
-
- console.error(error);
+ onError(error: unknown) {
+ responseStatusCode = 500;
+ // Log streaming rendering errors from inside the shell. Don't log
+ // errors encountered during initial shell rendering since they'll
+ // reject and get logged in handleDocumentRequest.
+ if (shellRendered) {
+ console.error(error);
+ }
},
}
);
setTimeout(abort, ABORT_DELAY);
});
+}
export function handleError(
error: unknown,
{ request, params, context }: DataFunctionArgs
-): void {
- if (error instanceof Error) {
- logger.error(error);
- } else {
- let unknownError = new Error("Unknown Server Error");
- logger.error(unknownError);
- }
+) {
+ logger.error(error, request);
}
diff --git a/apps/carbon/app/modules/account/ui/Profile/ProfilePhotoForm/ProfilePhotoForm.tsx b/apps/carbon/app/modules/account/ui/Profile/ProfilePhotoForm/ProfilePhotoForm.tsx
index 424fc29229..74cb1536a8 100644
--- a/apps/carbon/app/modules/account/ui/Profile/ProfilePhotoForm/ProfilePhotoForm.tsx
+++ b/apps/carbon/app/modules/account/ui/Profile/ProfilePhotoForm/ProfilePhotoForm.tsx
@@ -1,4 +1,4 @@
-import { Button, File, VStack, useNotification } from "@carbon/react";
+import { Button, File, VStack, toast } from "@carbon/react";
import { useSubmit } from "@remix-run/react";
import type { ChangeEvent } from "react";
import { Avatar } from "~/components";
@@ -12,7 +12,6 @@ type ProfilePhotoFormProps = {
const ProfilePhotoForm = ({ user }: ProfilePhotoFormProps) => {
const { supabase } = useSupabase();
- const notification = useNotification();
const submit = useSubmit();
const uploadImage = async (e: ChangeEvent<HTMLInputElement>) => {
@@ -30,7 +29,7 @@ const ProfilePhotoForm = ({ user }: ProfilePhotoFormProps) => {
});
if (imageUpload.error) {
- notification.copyableError(imageUpload.error, "Failed to upload image");
+ toast.error("Failed to upload image");
}
if (imageUpload.data?.path) {
@@ -46,7 +45,7 @@ const ProfilePhotoForm = ({ user }: ProfilePhotoFormProps) => {
.remove([user.avatarUrl]);
if (imageDelete.error) {
- notification.copyableError(imageDelete.error, "Failed to remove image");
+ toast.error("Failed to remove image");
}
submitAvatarUrl(null);
diff --git a/apps/carbon/app/modules/account/ui/UserAttributes/UserAttributesForm.tsx b/apps/carbon/app/modules/account/ui/UserAttributes/UserAttributesForm.tsx
index 0feaacfd91..e21d24bc65 100644
--- a/apps/carbon/app/modules/account/ui/UserAttributes/UserAttributesForm.tsx
+++ b/apps/carbon/app/modules/account/ui/UserAttributes/UserAttributesForm.tsx
@@ -1,11 +1,4 @@
-import {
- Button,
- HStack,
- Switch,
- VStack,
- useColor,
- useDisclosure,
-} from "@carbon/react";
+import { Button, HStack, Switch, VStack, useDisclosure } from "@carbon/react";
import { parseDate } from "@internationalized/date";
import { useFetcher, useParams } from "@remix-run/react";
import { useState } from "react";
@@ -65,6 +58,7 @@ const UserAttributesForm = ({ attributeCategory }: UserAttributesFormProps) => {
<VStack spacing={4}>
{attributeCategory.userAttribute.map((attribute) => {
const genericProps = getGenericProps(
+ // @ts-ignore
attribute as PublicAttributes["userAttribute"],
optimisticUpdates[attribute.id]
);
@@ -130,7 +124,6 @@ const GenericAttributeRow = (props: GenericAttributeRowProps) => {
function renderTypedForm({
attribute,
- borderColor,
type,
value,
updateFetcher,
@@ -140,7 +133,6 @@ function renderTypedForm({
onSubmit,
onClose,
}: GenericAttributeRowProps & {
- borderColor: string;
userId: string;
onSubmit: (value: string | boolean | number) => void;
onClose: () => void;
@@ -367,14 +359,12 @@ function TypedForm(
onClose: () => void;
}
) {
- const borderColor = useColor("gray.100");
- return renderTypedForm({ ...props, borderColor });
+ return renderTypedForm({ ...props });
}
function renderTypedDisplay({
- borderColor,
...props
-}: GenericAttributeRowProps & { borderColor: string; onOpen: () => void }) {
+}: GenericAttributeRowProps & { onOpen: () => void }) {
const {
attribute,
displayValue,
@@ -469,8 +459,7 @@ function TypedDisplay(
onOpen: () => void;
}
) {
- const borderColor = useColor("gray.100");
- return renderTypedDisplay({ ...props, borderColor });
+ return renderTypedDisplay({ ...props });
}
function getGenericProps(
diff --git a/apps/carbon/app/modules/documents/ui/Documents/DocumentCreateForm/DocumentCreateForm.tsx b/apps/carbon/app/modules/documents/ui/Documents/DocumentCreateForm/DocumentCreateForm.tsx
index 86b23ac4e8..a6a7ded458 100644
--- a/apps/carbon/app/modules/documents/ui/Documents/DocumentCreateForm/DocumentCreateForm.tsx
+++ b/apps/carbon/app/modules/documents/ui/Documents/DocumentCreateForm/DocumentCreateForm.tsx
@@ -1,4 +1,4 @@
-import { File, useNotification } from "@carbon/react";
+import { File, toast } from "@carbon/react";
import { useSubmit } from "@remix-run/react";
import type { ChangeEvent } from "react";
import { IoMdAdd } from "react-icons/io";
@@ -7,7 +7,6 @@ import { useSupabase } from "~/lib/supabase";
import { path } from "~/utils/path";
const DocumentCreateForm = () => {
- const notification = useNotification();
const submit = useSubmit();
const { supabase } = useSupabase();
const user = useUser();
@@ -29,7 +28,7 @@ const DocumentCreateForm = () => {
});
if (fileUpload.error) {
- notification.copyableError(fileUpload.error, "Failed to upload file");
+ toast.error("Failed to upload file");
}
if (fileUpload.data?.path) {
diff --git a/apps/carbon/app/modules/documents/ui/Documents/DocumentsTable/DocumentsTable.tsx b/apps/carbon/app/modules/documents/ui/Documents/DocumentsTable/DocumentsTable.tsx
index 13c1e63523..c93a5f2c25 100644
--- a/apps/carbon/app/modules/documents/ui/Documents/DocumentsTable/DocumentsTable.tsx
+++ b/apps/carbon/app/modules/documents/ui/Documents/DocumentsTable/DocumentsTable.tsx
@@ -1,4 +1,10 @@
import {
+ Badge,
+ BadgeCloseButton,
+ Command,
+ CommandGroup,
+ CommandInput,
+ CommandItem,
HStack,
HoverCard,
HoverCardContent,
@@ -9,17 +15,18 @@ import {
Popover,
PopoverContent,
PopoverTrigger,
+ cn,
useDisclosure,
} from "@carbon/react";
import { convertKbToString } from "@carbon/utils";
-import { Tag, TagCloseButton, TagLabel } from "@chakra-ui/react";
import { useRevalidator } from "@remix-run/react";
import type { ColumnDef } from "@tanstack/react-table";
import { memo, useCallback, useEffect, useMemo, useState } from "react";
import { BsFillPenFill, BsStar, BsStarFill } from "react-icons/bs";
import { IoMdAdd, IoMdTrash } from "react-icons/io";
+import { RxCheck } from "react-icons/rx";
import { VscOpenPreview } from "react-icons/vsc";
-import { Avatar, CreatableCombobox, Table } from "~/components";
+import { Avatar, Table } from "~/components";
import { Confirm, ConfirmDelete } from "~/components/Modals";
import { useUrlParams } from "~/hooks";
import type { Document, DocumentLabel } from "~/modules/documents";
@@ -199,24 +206,28 @@ const DocumentsTable = memo(({ data, count, labels }: DocumentsTableProps) => {
cell: ({ row }) => (
<HStack spacing={1}>
{row.original.labels.map((label) => (
- <Tag key={label} cursor="pointer" onClick={() => setLabel(label)}>
- <TagLabel>{label}</TagLabel>
- <TagCloseButton
+ <Badge
+ key={label}
+ variant="secondary"
+ className="cursor-pointer"
+ onClick={() => setLabel(label)}
+ >
+ {label}
+ <BadgeCloseButton
onClick={(e) => onDeleteLabel(e, row.original, label)}
/>
- </Tag>
+ </Badge>
))}
<Popover>
- <PopoverTrigger asChild>
- <Tag cursor="pointer">
- <TagLabel>
- <IoMdAdd />
- </TagLabel>
- </Tag>
+ <PopoverTrigger>
+ <Badge variant="secondary" className="cursor-pointer px-1">
+ <IoMdAdd />
+ </Badge>
</PopoverTrigger>
<PopoverContent className="w-[300px] p-0">
{/* TODO: we should have a CreateableMultiSelect component for this */}
- <CreatableCombobox
+
+ <CreatableCommand
options={labelOptions}
selected={row.original.labels}
onChange={(newValue) =>
@@ -431,6 +442,71 @@ const DocumentsTable = memo(({ data, count, labels }: DocumentsTableProps) => {
);
});
+type CreatableCommandProps = {
+ options: {
+ label: string;
+ value: string;
+ }[];
+ selected: string[];
+ onChange: (selected: string) => void;
+ onCreateOption: (inputValue: string) => void;
+};
+
+const CreatableCommand = ({
+ options,
+ selected,
+ onChange,
+ onCreateOption,
+}: CreatableCommandProps) => {
+ const [search, setSearch] = useState("");
+ const isExactMatch = options.some(
+ (option) => option.value.toLowerCase() === search.toLowerCase()
+ );
+
+ return (
+ <Command>
+ <CommandInput
+ value={search}
+ onValueChange={setSearch}
+ placeholder="Search..."
+ className="h-9"
+ />
+ <CommandGroup>
+ {options.map((option) => {
+ const isSelected = !!selected?.includes(option.value);
+ return (
+ <CommandItem
+ value={option.label}
+ key={option.value}
+ onSelect={() => {
+ if (!isSelected) onChange(option.value);
+ }}
+ >
+ {option.label}
+ <RxCheck
+ className={cn(
+ "ml-auto h-4 w-4",
+ isSelected ? "opacity-100" : "opacity-0"
+ )}
+ />
+ </CommandItem>
+ );
+ })}
+ {!isExactMatch && !!search && (
+ <CommandItem
+ onSelect={() => {
+ onCreateOption(search);
+ }}
+ >
+ <span>Create</span>
+ <span className="ml-1 font-bold">{search}</span>
+ </CommandItem>
+ )}
+ </CommandGroup>
+ </Command>
+ );
+};
+
DocumentsTable.displayName = "DocumentsTable";
export default DocumentsTable;
diff --git a/apps/carbon/app/modules/documents/ui/Documents/useDocument.ts b/apps/carbon/app/modules/documents/ui/Documents/useDocument.ts
index 14e387d70a..acbfcc0e3d 100644
--- a/apps/carbon/app/modules/documents/ui/Documents/useDocument.ts
+++ b/apps/carbon/app/modules/documents/ui/Documents/useDocument.ts
@@ -1,4 +1,4 @@
-import { useNotification } from "@carbon/react";
+import { toast } from "@carbon/react";
import { useNavigate } from "@remix-run/react";
import { useCallback } from "react";
import { usePermissions, useUrlParams, useUser } from "~/hooks";
@@ -11,7 +11,6 @@ import { path } from "~/utils/path";
export const useDocument = () => {
const navigate = useNavigate();
- const notification = useNotification();
const permissions = usePermissions();
const { supabase } = useSupabase();
const [params, setParams] = useUrlParams();
@@ -66,7 +65,7 @@ export const useDocument = () => {
const result = await supabase?.storage.from("private").download(doc.path);
if (!result || result.error) {
- notification.error(result?.error?.message || "Error downloading file");
+ toast.error(result?.error?.message || "Error downloading file");
return;
}
@@ -84,7 +83,7 @@ export const useDocument = () => {
await insertTransaction(doc, "Download");
},
- [supabase, notification, insertTransaction]
+ [supabase, insertTransaction]
);
const edit = useCallback(
@@ -150,13 +149,13 @@ export const useDocument = () => {
const result = await supabase?.storage.from("private").download(doc.path);
if (!result || result.error) {
- notification.error(result?.error?.message || "Error previewing file");
+ toast.error(result?.error?.message || "Error previewing file");
return null;
}
return window.URL.createObjectURL(result.data);
},
- [notification, supabase]
+ [supabase]
);
const removeLabel = useCallback(
diff --git a/apps/carbon/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceHeader/PurchaseInvoiceHeader.tsx b/apps/carbon/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceHeader/PurchaseInvoiceHeader.tsx
index fa4300be53..df1bf9e95f 100644
--- a/apps/carbon/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceHeader/PurchaseInvoiceHeader.tsx
+++ b/apps/carbon/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceHeader/PurchaseInvoiceHeader.tsx
@@ -1,5 +1,9 @@
import {
Card,
+ CardAttribute,
+ CardAttributeLabel,
+ CardAttributeValue,
+ CardAttributes,
CardContent,
CardDescription,
CardHeader,
@@ -9,7 +13,6 @@ import {
VStack,
useDisclosure,
} from "@carbon/react";
-import { Stack } from "@chakra-ui/react";
import { useParams } from "@remix-run/react";
import { useMemo, useState } from "react";
import { usePermissions, useRouteData } from "~/hooks";
@@ -91,37 +94,25 @@ const PurchaseInvoiceHeader = () => {
</CardHeader>
<CardContent>
- <Stack direction={["column", "column", "row"]} spacing={8}>
- <Stack
- direction={["row", "row", "column"]}
- alignItems="start"
- justifyContent="space-between"
- >
- <span className="text-sm text-muted-foreground">Total</span>
- <span className="font-bold">
+ <CardAttributes>
+ <CardAttribute>
+ <CardAttributeLabel>Total</CardAttributeLabel>
+ <CardAttributeValue>
{formatter.format(purchaseInvoiceTotals?.total ?? 0)}
- </span>
- </Stack>
- <Stack
- direction={["row", "row", "column"]}
- alignItems="start"
- justifyContent="space-between"
- >
- <span className="text-sm text-muted-foreground">
- Date Issued
- </span>
- <span className="font-bold">{purchaseInvoice.dateIssued}</span>
- </Stack>
-
- <Stack
- direction={["row", "row", "column"]}
- alignItems="start"
- justifyContent="space-between"
- >
- <span className="text-sm text-muted-foreground">Status</span>
+ </CardAttributeValue>
+ </CardAttribute>
+ <CardAttribute>
+ <CardAttributeLabel>Date Issued</CardAttributeLabel>
+ <CardAttributeValue>
+ {purchaseInvoice.dateIssued}
+ </CardAttributeValue>
+ </CardAttribute>
+
+ <CardAttribute>
+ <CardAttributeLabel>Status</CardAttributeLabel>
<PurchaseInvoicingStatus status={purchaseInvoice.status} />
- </Stack>
- </Stack>
+ </CardAttribute>
+ </CardAttributes>
</CardContent>
</Card>
</VStack>
diff --git a/apps/carbon/app/modules/parts/ui/Part/PartPreview/PartPreview.tsx b/apps/carbon/app/modules/parts/ui/Part/PartPreview/PartPreview.tsx
index c3b9527646..dd0a7a1bd5 100644
--- a/apps/carbon/app/modules/parts/ui/Part/PartPreview/PartPreview.tsx
+++ b/apps/carbon/app/modules/parts/ui/Part/PartPreview/PartPreview.tsx
@@ -2,13 +2,17 @@ import {
Button,
Card,
CardAction,
+ CardAttribute,
+ CardAttributeLabel,
+ CardAttributeValue,
+ CardAttributes,
CardContent,
CardDescription,
CardHeader,
CardTitle,
HStack,
} from "@carbon/react";
-import { Stack } from "@chakra-ui/react";
+
import { useParams } from "@remix-run/react";
import { FaHistory } from "react-icons/fa";
import { useRouteData } from "~/hooks";
@@ -41,42 +45,26 @@ const PartPreview = () => {
</CardAction>
</HStack>
<CardContent>
- <Stack direction={["column", "column", "row"]} spacing={8}>
- <Stack
- direction={["row", "row", "column"]}
- alignItems="start"
- justifyContent="space-between"
- >
- <span className="text-sm text-muted-foreground">
- Replenishment System
- </span>
- <span className="font-bold">
+ <CardAttributes>
+ <CardAttribute>
+ <CardAttributeLabel>Replenishment System</CardAttributeLabel>
+ <CardAttributeValue>
{routeData?.partSummary?.replenishmentSystem}
- </span>
- </Stack>
- <Stack
- direction={["row", "row", "column"]}
- alignItems="start"
- justifyContent="space-between"
- >
- <span className="text-sm text-muted-foreground">Part Type</span>
- <span className="font-bold">
+ </CardAttributeValue>
+ </CardAttribute>
+ <CardAttribute>
+ <CardAttributeLabel>Part Type</CardAttributeLabel>
+ <CardAttributeValue>
{routeData?.partSummary?.partType}
- </span>
- </Stack>
- <Stack
- direction={["row", "row", "column"]}
- alignItems="start"
- justifyContent="space-between"
- >
- <span className="text-sm text-muted-foreground">
- Unit of Measure
- </span>
- <span className="font-bold">
+ </CardAttributeValue>
+ </CardAttribute>
+ <CardAttribute>
+ <CardAttributeLabel>Unit of Measure</CardAttributeLabel>
+ <CardAttributeValue>
{routeData?.partSummary?.unitOfMeasureCode}
- </span>
- </Stack>
- </Stack>
+ </CardAttributeValue>
+ </CardAttribute>
+ </CardAttributes>
</CardContent>
</Card>
);
diff --git a/apps/carbon/app/modules/parts/ui/Service/ServicePreview/ServicePreview.tsx b/apps/carbon/app/modules/parts/ui/Service/ServicePreview/ServicePreview.tsx
index 101c607da6..bb7138076c 100644
--- a/apps/carbon/app/modules/parts/ui/Service/ServicePreview/ServicePreview.tsx
+++ b/apps/carbon/app/modules/parts/ui/Service/ServicePreview/ServicePreview.tsx
@@ -2,13 +2,16 @@ import {
Button,
Card,
CardAction,
+ CardAttribute,
+ CardAttributeLabel,
+ CardAttributeValue,
+ CardAttributes,
CardContent,
CardDescription,
CardHeader,
CardTitle,
HStack,
} from "@carbon/react";
-import { Stack } from "@chakra-ui/react";
import { useParams } from "@remix-run/react";
import { FaHistory } from "react-icons/fa";
import { useRouteData } from "~/hooks";
@@ -41,24 +44,20 @@ const ServicePreview = () => {
</CardAction>
</HStack>
<CardContent>
- <Stack direction={["column", "column", "row"]} spacing={8}>
- <Stack
- direction={["row", "row", "column"]}
- alignItems="start"
- justifyContent="space-between"
- >
- <span className="text-sm text-muted-foreground">Type</span>
- <span className="font-bold">{routeData?.service?.serviceType}</span>
- </Stack>
- <Stack
- direction={["row", "row", "column"]}
- alignItems="start"
- justifyContent="space-between"
- >
- <span className="text-sm text-muted-foreground">Part Group</span>
- <span className="font-bold">{routeData?.service?.partGroup}</span>
- </Stack>
- </Stack>
+ <CardAttributes>
+ <CardAttribute>
+ <CardAttributeLabel>Type</CardAttributeLabel>
+ <CardAttributeValue>
+ {routeData?.service?.serviceType}
+ </CardAttributeValue>
+ </CardAttribute>
+ <CardAttribute>
+ <CardAttributeLabel>Part Group</CardAttributeLabel>
+ <CardAttributeValue>
+ {routeData?.service?.partGroup}
+ </CardAttributeValue>
+ </CardAttribute>
+ </CardAttributes>
</CardContent>
</Card>
);
diff --git a/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderDocumentForm/PurchaseOrderDocumentForm.tsx b/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderDocumentForm/PurchaseOrderDocumentForm.tsx
index e21fcc30f4..5df1ae802d 100644
--- a/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderDocumentForm/PurchaseOrderDocumentForm.tsx
+++ b/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderDocumentForm/PurchaseOrderDocumentForm.tsx
@@ -1,4 +1,4 @@
-import { File, useNotification } from "@carbon/react";
+import { File, toast } from "@carbon/react";
import { useFetcher } from "@remix-run/react";
import type { ChangeEvent } from "react";
import { IoMdAdd } from "react-icons/io";
@@ -14,7 +14,6 @@ const PurchaseOrderDocumentForm = ({
isExternal,
}: PurchaseOrderDocumentFormProps) => {
const fetcher = useFetcher();
- const notification = useNotification();
const { supabase } = useSupabase();
const uploadFile = async (e: ChangeEvent<HTMLInputElement>) => {
@@ -29,11 +28,11 @@ const PurchaseOrderDocumentForm = ({
});
if (fileUpload.error) {
- notification.copyableError(fileUpload.error, "Failed to upload file");
+ toast.error("Failed to upload file");
}
if (fileUpload.data?.path) {
- notification.success("File uploaded");
+ toast.success("File uploaded");
// refetch the loaders
fetcher.submit(null, { method: "post" });
}
diff --git a/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderHeader/PurchaseOrderHeader.tsx b/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderHeader/PurchaseOrderHeader.tsx
index a40af9e129..958ed0a1f2 100644
--- a/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderHeader/PurchaseOrderHeader.tsx
+++ b/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderHeader/PurchaseOrderHeader.tsx
@@ -2,6 +2,10 @@ import {
Button,
Card,
CardAction,
+ CardAttribute,
+ CardAttributeLabel,
+ CardAttributeValue,
+ CardAttributes,
CardContent,
CardDescription,
CardHeader,
@@ -11,7 +15,6 @@ import {
MenubarItem,
VStack,
} from "@carbon/react";
-import { Stack } from "@chakra-ui/react";
import { useParams } from "@remix-run/react";
import { useMemo } from "react";
import { FaHistory } from "react-icons/fa";
@@ -107,74 +110,38 @@ const PurchaseOrderHeader = () => {
</CardAction>
</HStack>
<CardContent>
- <Stack direction={["column", "column", "row"]} spacing={8}>
- <Stack
- direction={["row", "row", "column"]}
- alignItems="start"
- justifyContent="space-between"
- >
- <span className="text-sm text-muted-foreground">Total</span>
- <span className="font-bold">
+ <CardAttributes>
+ <CardAttribute>
+ <CardAttributeLabel>Total</CardAttributeLabel>
+ <CardAttributeValue>
{formatter.format(purchaseOrderTotals?.total ?? 0)}
- </span>
- </Stack>
- <Stack
- direction={["row", "row", "column"]}
- alignItems="start"
- justifyContent="space-between"
- >
- <span className="text-sm text-muted-foreground">Order Date</span>
- <span className="font-bold">
+ </CardAttributeValue>
+ </CardAttribute>
+ <CardAttribute>
+ <CardAttributeLabel>Order Date</CardAttributeLabel>
+ <CardAttributeValue>
{routeData?.purchaseOrder?.orderDate}
- </span>
- </Stack>
+ </CardAttributeValue>
+ </CardAttribute>
- <Stack
- direction={["row", "row", "column"]}
- alignItems="start"
- justifyContent="space-between"
- >
- <span className="text-sm text-muted-foreground">
- Promised Date
- </span>
- <span className="font-bold">
+ <CardAttribute>
+ <CardAttributeLabel>Promised Date</CardAttributeLabel>
+ <CardAttributeValue>
{routeData?.purchaseOrder?.receiptPromisedDate}
- </span>
- </Stack>
- <Stack
- direction={["row", "row", "column"]}
- alignItems="start"
- justifyContent="space-between"
- >
- <span className="text-sm text-muted-foreground">Type</span>
- <span className="font-bold">
+ </CardAttributeValue>
+ </CardAttribute>
+ <CardAttribute>
+ <CardAttributeLabel>Type</CardAttributeLabel>
+ <CardAttributeValue>
{routeData?.purchaseOrder?.type}
- </span>
- </Stack>
- {/*
- <Stack
- direction={["row", "row", "column"]}
- alignItems="start"
- justifyContent="space-between"
- >
- <span className="text-sm text-muted-foreground">Subtotal</span>
- <span className="font-bold">
- // TODO: this doesn't update when client-side lines are updated
- {currencyFormatter.format(
- routeData?.purchaseOrder?.subtotal ?? 0
- )}
- </span>
- </Stack>
- */}
- <Stack
- direction={["row", "row", "column"]}
- alignItems="start"
- justifyContent="space-between"
- >
- <span className="text-sm text-muted-foreground">Status</span>
+ </CardAttributeValue>
+ </CardAttribute>
+
+ <CardAttribute>
+ <CardAttributeLabel>Status</CardAttributeLabel>
<PurchasingStatus status={routeData?.purchaseOrder?.status} />
- </Stack>
- </Stack>
+ </CardAttribute>
+ </CardAttributes>
</CardContent>
</Card>
</VStack>
diff --git a/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderInternalDocuments/usePurchaseOrderDocuments.ts b/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderInternalDocuments/usePurchaseOrderDocuments.ts
index eb74ca3001..b9ec0134fa 100644
--- a/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderInternalDocuments/usePurchaseOrderDocuments.ts
+++ b/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderInternalDocuments/usePurchaseOrderDocuments.ts
@@ -1,4 +1,4 @@
-import { useNotification } from "@carbon/react";
+import { toast } from "@carbon/react";
import { useFetcher } from "@remix-run/react";
import { useCallback } from "react";
import { usePermissions } from "~/hooks";
@@ -16,7 +16,6 @@ export const usePurchaseOrderDocuments = ({
isExternal,
orderId,
}: Props) => {
- const notification = useNotification();
const fetcher = useFetcher();
const permissions = usePermissions();
const { supabase } = useSupabase();
@@ -35,14 +34,14 @@ export const usePurchaseOrderDocuments = ({
.remove([`${orderId}/${attachment.name}`]);
if (!result || result.error) {
- notification.error(result?.error?.message || "Error deleting file");
+ toast.error(result?.error?.message || "Error deleting file");
return;
}
- notification.success("File deleted successfully");
+ toast.success("File deleted successfully");
refresh();
},
- [supabase, notification, orderId, isExternal, refresh]
+ [supabase, orderId, isExternal, refresh]
);
const download = useCallback(
@@ -52,7 +51,7 @@ export const usePurchaseOrderDocuments = ({
.download(`${orderId}/${attachment.name}`);
if (!result || result.error) {
- notification.error(result?.error?.message || "Error downloading file");
+ toast.error(result?.error?.message || "Error downloading file");
return;
}
@@ -68,7 +67,7 @@ export const usePurchaseOrderDocuments = ({
document.body.removeChild(a);
}, 0);
},
- [supabase, notification, orderId, isExternal]
+ [supabase, orderId, isExternal]
);
// const getAvatarPath = useCallback(
@@ -96,13 +95,13 @@ export const usePurchaseOrderDocuments = ({
.download(`${orderId}/${attachment.name}`);
if (!result || result.error) {
- notification.error(result?.error?.message || "Error previewing file");
+ toast.error(result?.error?.message || "Error previewing file");
return null;
}
return window.URL.createObjectURL(result.data);
},
- [isExternal, notification, orderId, supabase?.storage]
+ [isExternal, orderId, supabase?.storage]
);
return {
diff --git a/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierContacts/SupplierContacts.tsx b/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierContacts/SupplierContacts.tsx
index 9d41b1f877..d88662c263 100644
--- a/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierContacts/SupplierContacts.tsx
+++ b/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierContacts/SupplierContacts.tsx
@@ -8,7 +8,6 @@ import {
HStack,
useDisclosure,
} from "@carbon/react";
-import { List, ListItem } from "@chakra-ui/react";
import { Link, Outlet, useNavigate, useParams } from "@remix-run/react";
import { useCallback, useState } from "react";
import { BsFillPenFill } from "react-icons/bs";
@@ -110,9 +109,9 @@ const SupplierContacts = ({ contacts }: SupplierContactsProps) => {
</p>
</div>
) : (
- <List w="full" spacing={4}>
+ <ul className="flex flex-col w-full gap-4">
{contacts?.map((contact) => (
- <ListItem key={contact.id}>
+ <li key={contact.id}>
{contact.contact &&
!Array.isArray(contact.contact) &&
!Array.isArray(contact.user) ? (
@@ -123,9 +122,9 @@ const SupplierContacts = ({ contacts }: SupplierContactsProps) => {
actions={getActions(contact)}
/>
) : null}
- </ListItem>
+ </li>
))}
- </List>
+ </ul>
)}
</CardContent>
</Card>
diff --git a/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierHeader/SupplierHeader.tsx b/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierHeader/SupplierHeader.tsx
index 91d380f657..cd9b1c1bf9 100644
--- a/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierHeader/SupplierHeader.tsx
+++ b/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierHeader/SupplierHeader.tsx
@@ -2,13 +2,16 @@ import {
Button,
Card,
CardAction,
+ CardAttribute,
+ CardAttributeLabel,
+ CardAttributeValue,
+ CardAttributes,
CardContent,
CardHeader,
CardTitle,
HStack,
VStack,
} from "@carbon/react";
-import { Stack } from "@chakra-ui/react";
import { useParams } from "@remix-run/react";
import { FaHistory } from "react-icons/fa";
import { useRouteData } from "~/hooks";
@@ -51,49 +54,35 @@ const SupplierHeader = () => {
</CardAction>
</HStack>
<CardContent>
- <Stack direction={["column", "column", "row"]} spacing={8}>
- <Stack
- direction={["row", "row", "column"]}
- alignItems="start"
- justifyContent="space-between"
- >
- <span className="text-sm text-muted-foreground">Type</span>
- <span className="font-bold">
+ <CardAttributes>
+ <CardAttribute>
+ <CardAttributeLabel>Type</CardAttributeLabel>
+ <CardAttributeValue>
{sharedSupplierData?.supplierTypes?.find(
(type) => type.id === routeData?.supplier?.supplierTypeId
)?.name ?? "--"}
- </span>
- </Stack>
- <Stack
- direction={["row", "row", "column"]}
- alignItems="start"
- justifyContent="space-between"
- >
- <span className="text-sm text-muted-foreground">Status</span>
- <span className="font-bold">
+ </CardAttributeValue>
+ </CardAttribute>
+ <CardAttribute>
+ <CardAttributeLabel>Status</CardAttributeLabel>
+ <CardAttributeValue>
{sharedSupplierData?.supplierStatuses?.find(
(status) =>
status.id === routeData?.supplier?.supplierStatusId
)?.name ?? "--"}
- </span>
- </Stack>
- <Stack
- direction={["row", "row", "column"]}
- alignItems="start"
- justifyContent="space-between"
- >
- <span className="text-sm text-muted-foreground">
- Payment Terms
- </span>
- <span className="font-bold">
+ </CardAttributeValue>
+ </CardAttribute>
+ <CardAttribute>
+ <CardAttributeLabel>Payment Terms</CardAttributeLabel>
+ <CardAttributeValue>
{/* // TODO: defaultPaymentTermId */}
{sharedSupplierData?.paymentTerms?.find(
(term) =>
term.id === routeData?.supplier?.defaultPaymentTermId
)?.name ?? "--"}
- </span>
- </Stack>
- </Stack>
+ </CardAttributeValue>
+ </CardAttribute>
+ </CardAttributes>
</CardContent>
</Card>
</VStack>
diff --git a/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierLocations/SupplierLocations.tsx b/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierLocations/SupplierLocations.tsx
index 855be32360..d956cf2d24 100644
--- a/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierLocations/SupplierLocations.tsx
+++ b/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierLocations/SupplierLocations.tsx
@@ -8,7 +8,6 @@ import {
HStack,
useDisclosure,
} from "@carbon/react";
-import { List, ListItem } from "@chakra-ui/react";
import { Link, Outlet, useNavigate, useParams } from "@remix-run/react";
import { useCallback, useState } from "react";
import { BsFillPenFill } from "react-icons/bs";
@@ -97,18 +96,18 @@ const SupplierLocations = ({ locations }: SupplierLocationsProps) => {
</p>
</div>
) : (
- <List w="full" spacing={4}>
+ <ul className="flex flex-col w-full gap-4">
{locations?.map((location) => (
- <ListItem key={location.id}>
+ <li key={location.id}>
{location.address && !Array.isArray(location.address) ? (
<Address
address={location.address}
actions={getActions(location)}
/>
) : null}
- </ListItem>
+ </li>
))}
- </List>
+ </ul>
)}
</CardContent>
</Card>
diff --git a/apps/carbon/app/modules/resources/ui/Abilities/AbilityEmployeesTable/AbilityEmployeesTable.tsx b/apps/carbon/app/modules/resources/ui/Abilities/AbilityEmployeesTable/AbilityEmployeesTable.tsx
index 03e1763c7f..bc87a04546 100644
--- a/apps/carbon/app/modules/resources/ui/Abilities/AbilityEmployeesTable/AbilityEmployeesTable.tsx
+++ b/apps/carbon/app/modules/resources/ui/Abilities/AbilityEmployeesTable/AbilityEmployeesTable.tsx
@@ -1,5 +1,10 @@
-import { Badge, DropdownMenuIcon, HStack, MenuItem } from "@carbon/react";
-import { Progress } from "@chakra-ui/react";
+import {
+ Badge,
+ DropdownMenuIcon,
+ HStack,
+ MenuItem,
+ Progress,
+} from "@carbon/react";
import { useNavigate, useParams } from "@remix-run/react";
import type { ColumnDef } from "@tanstack/react-table";
import { useCallback, useMemo } from "react";
diff --git a/apps/carbon/app/modules/resources/ui/Equipment/EquipmentTypesTable/EquipmentTypesTable.tsx b/apps/carbon/app/modules/resources/ui/Equipment/EquipmentTypesTable/EquipmentTypesTable.tsx
index fee6d0b544..27bf0484f2 100644
--- a/apps/carbon/app/modules/resources/ui/Equipment/EquipmentTypesTable/EquipmentTypesTable.tsx
+++ b/apps/carbon/app/modules/resources/ui/Equipment/EquipmentTypesTable/EquipmentTypesTable.tsx
@@ -6,7 +6,6 @@ import {
MenuItem,
useDisclosure,
} from "@carbon/react";
-import { Icon } from "@chakra-ui/react";
import { useNavigate } from "@remix-run/react";
import type { ColumnDef } from "@tanstack/react-table";
import { memo, useCallback, useMemo, useState } from "react";
@@ -55,9 +54,8 @@ const EquipmentTypesTable = memo(
{row.original.name}
</Hyperlink>
{row.original.requiredAbility && (
- <Icon
- as={BsFillCheckCircleFill}
- color="green.500"
+ <BsFillCheckCircleFill
+ className="text-green-500"
title="Requires ability"
/>
)}
diff --git a/apps/carbon/app/modules/resources/ui/Person/PersonAbilities/PersonAbilities.tsx b/apps/carbon/app/modules/resources/ui/Person/PersonAbilities/PersonAbilities.tsx
index f04961cab0..704bddfe86 100644
--- a/apps/carbon/app/modules/resources/ui/Person/PersonAbilities/PersonAbilities.tsx
+++ b/apps/carbon/app/modules/resources/ui/Person/PersonAbilities/PersonAbilities.tsx
@@ -1,6 +1,5 @@
import { Card, CardContent, CardHeader, CardTitle } from "@carbon/react";
import { formatDate } from "@carbon/utils";
-import { List, ListItem } from "@chakra-ui/react";
import { Link } from "@remix-run/react";
import clsx from "clsx";
import type { IconType } from "react-icons";
@@ -44,7 +43,7 @@ const PersonAbilities = ({ abilities }: PersonAbilitiesProps) => {
</CardHeader>
<CardContent>
{abilities?.length > 0 ? (
- <List spacing={4}>
+ <ul className="flex flex-col gap-4 w-full">
{abilities.map((employeeAbility) => {
const abilityStatus =
getTrainingStatus(employeeAbility) ??
@@ -62,7 +61,7 @@ const PersonAbilities = ({ abilities }: PersonAbilitiesProps) => {
let Icon = icon;
return (
- <ListItem key={employeeAbility.id}>
+ <li key={employeeAbility.id}>
<div className="grid-cols-[auto_1fr_auto] space-x-4">
<div
className={clsx(
@@ -102,10 +101,10 @@ const PersonAbilities = ({ abilities }: PersonAbilitiesProps) => {
</p>
</div>
</div>
- </ListItem>
+ </li>
);
})}
- </List>
+ </ul>
) : (
<div className="text-muted-foreground text-center p-4 w-full">
No abilities added
diff --git a/apps/carbon/app/modules/resources/ui/Person/PersonPreview/PersonPreview.tsx b/apps/carbon/app/modules/resources/ui/Person/PersonPreview/PersonPreview.tsx
index 09bca410ee..4de0f2c3a8 100644
--- a/apps/carbon/app/modules/resources/ui/Person/PersonPreview/PersonPreview.tsx
+++ b/apps/carbon/app/modules/resources/ui/Person/PersonPreview/PersonPreview.tsx
@@ -1,12 +1,15 @@
import {
Card,
+ CardAttribute,
+ CardAttributeLabel,
+ CardAttributeValue,
+ CardAttributes,
CardContent,
CardDescription,
CardHeader,
CardTitle,
HStack,
} from "@carbon/react";
-import { Stack } from "@chakra-ui/react";
import { useParams } from "@remix-run/react";
import { Avatar } from "~/components";
import { useRouteData } from "~/hooks";
@@ -35,48 +38,32 @@ const PartPreview = () => {
/>
</HStack>
<CardContent>
- <Stack direction={["column", "column", "row"]} spacing={8}>
- <Stack
- direction={["row", "row", "column"]}
- alignItems="start"
- justifyContent="space-between"
- >
- <span className="text-sm text-muted-foreground">Department</span>
- <span className="font-bold">
+ <CardAttributes>
+ <CardAttribute>
+ <CardAttributeLabel>Department</CardAttributeLabel>
+ <CardAttributeValue>
{routeData?.employeeSummary?.departmentName}
- </span>
- </Stack>
- <Stack
- direction={["row", "row", "column"]}
- alignItems="start"
- justifyContent="space-between"
- >
- <span className="text-sm text-muted-foreground">Location</span>
- <span className="font-bold">
+ </CardAttributeValue>
+ </CardAttribute>
+ <CardAttribute>
+ <CardAttributeLabel>Location</CardAttributeLabel>
+ <CardAttributeValue>
{routeData?.employeeSummary?.locationName}
- </span>
- </Stack>
- <Stack
- direction={["row", "row", "column"]}
- alignItems="start"
- justifyContent="space-between"
- >
- <span className="text-sm text-muted-foreground">Manager</span>
- <span className="font-bold">
+ </CardAttributeValue>
+ </CardAttribute>
+ <CardAttribute>
+ <CardAttributeLabel>Manager</CardAttributeLabel>
+ <CardAttributeValue>
{routeData?.employeeSummary?.managerName}
- </span>
- </Stack>
- <Stack
- direction={["row", "row", "column"]}
- alignItems="start"
- justifyContent="space-between"
- >
- <span className="text-sm text-muted-foreground">Start Date</span>
- <span className="font-bold">
+ </CardAttributeValue>
+ </CardAttribute>
+ <CardAttribute>
+ <CardAttributeLabel>Start Date</CardAttributeLabel>
+ <CardAttributeValue>
{routeData?.employeeSummary?.startDate}
- </span>
- </Stack>
- </Stack>
+ </CardAttributeValue>
+ </CardAttribute>
+ </CardAttributes>
</CardContent>
</Card>
);
diff --git a/apps/carbon/app/modules/sales/ui/Customer/CustomerContacts/CustomerContacts.tsx b/apps/carbon/app/modules/sales/ui/Customer/CustomerContacts/CustomerContacts.tsx
index f7dedd3e27..133716b347 100644
--- a/apps/carbon/app/modules/sales/ui/Customer/CustomerContacts/CustomerContacts.tsx
+++ b/apps/carbon/app/modules/sales/ui/Customer/CustomerContacts/CustomerContacts.tsx
@@ -1,12 +1,13 @@
import {
+ Button,
Card,
CardAction,
CardContent,
CardHeader,
CardTitle,
HStack,
+ useDisclosure,
} from "@carbon/react";
-import { Button, List, ListItem, useDisclosure } from "@chakra-ui/react";
import { Link, Outlet, useNavigate, useParams } from "@remix-run/react";
import { useCallback, useState } from "react";
import { BsFillPenFill } from "react-icons/bs";
@@ -83,8 +84,8 @@ const CustomerContacts = ({ contacts }: CustomerContactsProps) => {
</CardHeader>
<CardAction>
{canEdit && (
- <Button colorScheme="brand" as={Link} to="new">
- New
+ <Button asChild>
+ <Link to="new">New</Link>
</Button>
)}
</CardAction>
@@ -97,9 +98,9 @@ const CustomerContacts = ({ contacts }: CustomerContactsProps) => {
</p>
</div>
) : (
- <List w="full" spacing={4}>
+ <ul className="flex flex-col w-full gap-4">
{contacts?.map((contact) => (
- <ListItem key={contact.id}>
+ <li key={contact.id}>
{contact.contact &&
!Array.isArray(contact.contact) &&
!Array.isArray(contact.user) ? (
@@ -110,9 +111,9 @@ const CustomerContacts = ({ contacts }: CustomerContactsProps) => {
actions={getActions(contact)}
/>
) : null}
- </ListItem>
+ </li>
))}
- </List>
+ </ul>
)}
</CardContent>
</Card>
diff --git a/apps/carbon/app/modules/sales/ui/Customer/CustomerHeader/CustomerHeader.tsx b/apps/carbon/app/modules/sales/ui/Customer/CustomerHeader/CustomerHeader.tsx
index a15bee04ce..7862b3e201 100644
--- a/apps/carbon/app/modules/sales/ui/Customer/CustomerHeader/CustomerHeader.tsx
+++ b/apps/carbon/app/modules/sales/ui/Customer/CustomerHeader/CustomerHeader.tsx
@@ -1,13 +1,18 @@
import {
+ Button,
Card,
CardAction,
+ CardAttribute,
+ CardAttributeLabel,
+ CardAttributeValue,
+ CardAttributes,
CardContent,
CardHeader,
CardTitle,
HStack,
VStack,
} from "@carbon/react";
-import { Button, Stack } from "@chakra-ui/react";
+
import { useParams } from "@remix-run/react";
import { FaHistory } from "react-icons/fa";
import { useRouteData } from "~/hooks";
@@ -45,48 +50,34 @@ const CustomerHeader = () => {
</CardAction>
</HStack>
<CardContent>
- <Stack direction={["column", "column", "row"]} spacing={8}>
- <Stack
- direction={["row", "row", "column"]}
- alignItems="start"
- justifyContent="space-between"
- >
- <span className="text-sm text-muted-foreground">Type</span>
- <span className="font-bold">
+ <CardAttributes>
+ <CardAttribute>
+ <CardAttributeLabel>Type</CardAttributeLabel>
+ <CardAttributeValue>
{sharedCustomerData?.customerTypes?.find(
(type) => type.id === routeData?.customer?.customerTypeId
)?.name ?? "--"}
- </span>
- </Stack>
- <Stack
- direction={["row", "row", "column"]}
- alignItems="start"
- justifyContent="space-between"
- >
- <span className="text-sm text-muted-foreground">Status</span>
- <span className="font-bold">
+ </CardAttributeValue>
+ </CardAttribute>
+ <CardAttribute>
+ <CardAttributeLabel>Status</CardAttributeLabel>
+ <CardAttributeValue>
{sharedCustomerData?.customerStatuses?.find(
(status) =>
status.id === routeData?.customer?.customerStatusId
)?.name ?? "--"}
- </span>
- </Stack>
- <Stack
- direction={["row", "row", "column"]}
- alignItems="start"
- justifyContent="space-between"
- >
- <span className="text-sm text-muted-foreground">
- Payment Terms
- </span>
- <span className="font-bold">
+ </CardAttributeValue>
+ </CardAttribute>
+ <CardAttribute>
+ <CardAttributeLabel>Payment Terms</CardAttributeLabel>
+ <CardAttributeValue>
{sharedCustomerData?.paymentTerms?.find(
(term) =>
term.id === routeData?.customer?.defaultPaymentTermId
)?.name ?? "--"}
- </span>
- </Stack>
- </Stack>
+ </CardAttributeValue>
+ </CardAttribute>
+ </CardAttributes>
</CardContent>
</Card>
</VStack>
diff --git a/apps/carbon/app/modules/sales/ui/Customer/CustomerLocations/CustomerLocations.tsx b/apps/carbon/app/modules/sales/ui/Customer/CustomerLocations/CustomerLocations.tsx
index cd415d6440..2c8d184a01 100644
--- a/apps/carbon/app/modules/sales/ui/Customer/CustomerLocations/CustomerLocations.tsx
+++ b/apps/carbon/app/modules/sales/ui/Customer/CustomerLocations/CustomerLocations.tsx
@@ -1,4 +1,5 @@
import {
+ Button,
Card,
CardAction,
CardContent,
@@ -7,7 +8,6 @@ import {
HStack,
useDisclosure,
} from "@carbon/react";
-import { Button, List, ListItem } from "@chakra-ui/react";
import { Link, Outlet, useNavigate, useParams } from "@remix-run/react";
import { useCallback, useState } from "react";
import { BsFillPenFill } from "react-icons/bs";
@@ -70,8 +70,8 @@ const CustomerLocations = ({ locations }: CustomerLocationsProps) => {
</CardHeader>
<CardAction>
{canEdit && (
- <Button colorScheme="brand" as={Link} to="new">
- New
+ <Button asChild>
+ <Link to="new">New</Link>
</Button>
)}
</CardAction>
@@ -84,18 +84,18 @@ const CustomerLocations = ({ locations }: CustomerLocationsProps) => {
</p>
</div>
) : (
- <List w="full" spacing={4}>
+ <ul className="flex flex-col w-full gap-4">
{locations?.map((location) => (
- <ListItem key={location.id}>
+ <li key={location.id}>
{location.address && !Array.isArray(location.address) ? (
<Address
address={location.address}
actions={getActions(location)}
/>
) : null}
- </ListItem>
+ </li>
))}
- </List>
+ </ul>
)}
</CardContent>
</Card>
diff --git a/apps/carbon/app/modules/settings/ui/Company/CompanyLogoForm/CompanyLogoForm.tsx b/apps/carbon/app/modules/settings/ui/Company/CompanyLogoForm/CompanyLogoForm.tsx
index caa0c98ae4..94e6c7a486 100644
--- a/apps/carbon/app/modules/settings/ui/Company/CompanyLogoForm/CompanyLogoForm.tsx
+++ b/apps/carbon/app/modules/settings/ui/Company/CompanyLogoForm/CompanyLogoForm.tsx
@@ -1,4 +1,4 @@
-import { Avatar, Button, File, VStack, useNotification } from "@carbon/react";
+import { Avatar, Button, File, VStack, toast } from "@carbon/react";
import { useSubmit } from "@remix-run/react";
import type { ChangeEvent } from "react";
import { useSupabase } from "~/lib/supabase";
@@ -11,7 +11,6 @@ type CompanyLogoFormProps = {
const CompanyLogoForm = ({ company }: CompanyLogoFormProps) => {
const { supabase } = useSupabase();
- const notification = useNotification();
const submit = useSubmit();
const logoPath = company?.logo
@@ -31,7 +30,7 @@ const CompanyLogoForm = ({ company }: CompanyLogoFormProps) => {
});
if (imageUpload.error) {
- notification.copyableError(imageUpload.error, "Failed to upload logo");
+ toast.error("Failed to upload logo");
}
if (imageUpload.data?.path) {
@@ -47,7 +46,7 @@ const CompanyLogoForm = ({ company }: CompanyLogoFormProps) => {
.remove([logoPath]);
if (imageDelete.error) {
- notification.copyableError(imageDelete.error, "Failed to remove image");
+ toast.error("Failed to remove image");
}
submitLogoUrl(null);
diff --git a/apps/carbon/app/root.tsx b/apps/carbon/app/root.tsx
index dd70f15fa5..aba9224364 100644
--- a/apps/carbon/app/root.tsx
+++ b/apps/carbon/app/root.tsx
@@ -1,5 +1,5 @@
// root.tsx
-import { Heading, ThemeProvider } from "@carbon/react";
+import { Heading } from "@carbon/react";
import type { MetaFunction } from "@remix-run/node";
import { json } from "@remix-run/node";
import {
@@ -84,9 +84,7 @@ export default function App() {
return (
<Document>
- <ThemeProvider>
- <Outlet />
- </ThemeProvider>
+ <Outlet />
<script
dangerouslySetInnerHTML={{
__html: `window.env = ${JSON.stringify(env)}`,
@@ -107,14 +105,12 @@ export function ErrorBoundary() {
return (
<Document title="Error!">
- <ThemeProvider>
- <div className="dark">
- <div className="flex flex-col w-full h-screen bg-zinc-900 items-center justify-center space-y-4">
- <Heading size="display">Something went wrong</Heading>
- <p className="text-foreground">{message}</p>
- </div>
+ <div className="dark">
+ <div className="flex flex-col w-full h-screen bg-zinc-900 items-center justify-center space-y-4">
+ <Heading size="display">Something went wrong</Heading>
+ <p className="text-foreground">{message}</p>
</div>
- </ThemeProvider>
+ </div>
</Document>
);
}
diff --git a/apps/carbon/app/routes/_public+/forgot-password.tsx b/apps/carbon/app/routes/_public+/forgot-password.tsx
index d1e915f720..950283997a 100644
--- a/apps/carbon/app/routes/_public+/forgot-password.tsx
+++ b/apps/carbon/app/routes/_public+/forgot-password.tsx
@@ -1,19 +1,18 @@
-import { VStack } from "@carbon/react";
import {
Alert,
AlertDescription,
- AlertIcon,
AlertTitle,
- Image,
- useColorModeValue,
-} from "@chakra-ui/react";
+ Button,
+ VStack,
+} from "@carbon/react";
import type {
ActionFunctionArgs,
LoaderFunctionArgs,
MetaFunction,
} from "@remix-run/node";
import { json, redirect } from "@remix-run/node";
-import { useActionData } from "@remix-run/react";
+import { Link, useActionData } from "@remix-run/react";
+import { LuAlertCircle, LuCheckCircle } from "react-icons/lu";
import { ValidatedForm, validationError } from "remix-validated-form";
import { Input, Submit } from "~/components/Form";
@@ -70,31 +69,21 @@ export default function ForgotPasswordRoute() {
return (
<>
- <Image
- src={useColorModeValue(
- "/carbon-logo-dark.png",
- "/carbon-logo-light.png"
- )}
+ <img
+ src="/carbon-logo-dark.png"
alt="Carbon Logo"
- maxW={100}
- marginBottom={3}
+ className="block dark:hidden max-w-[100px] mb-3"
+ />
+ <img
+ src="/carbon-logo-light.png"
+ alt="Carbon Logo"
+ className="hidden dark:block max-w-[100px] mb-3"
/>
{actionData?.success ? (
- <Alert
- status="success"
- variant="subtle"
- flexDirection="column"
- alignItems="center"
- justifyContent="center"
- textAlign="center"
- height="240px"
- p={8}
- >
- <AlertIcon boxSize="40px" mr={0} />
- <AlertTitle mt={4} mb={1} fontSize="lg">
- Success
- </AlertTitle>
- <AlertDescription maxWidth="sm">
+ <Alert className="h-[240px] [&>svg]:left-8 [&>svg]:top-8 p-8">
+ <LuCheckCircle className="w-4 h-4" />
+ <AlertTitle>Success</AlertTitle>
+ <AlertDescription>
If you have an account, you should receive an email shortly with a
link to log in.
</AlertDescription>
@@ -105,15 +94,18 @@ export default function ForgotPasswordRoute() {
<VStack spacing={4}>
<p>Please enter your email address to search for your account.</p>
{actionData?.success === false && (
- <Alert status="error">
- <AlertIcon />
+ <Alert variant="destructive">
+ <LuAlertCircle className="w-4 h-4" />
<AlertTitle>{actionData?.message}</AlertTitle>
</Alert>
)}
<Input name="email" label="Email" />
<Submit size="lg" className="w-full">
- Search
+ Reset Password
</Submit>
+ <Button variant="link" asChild className="w-full">
+ <Link to={path.to.login}>Back to login</Link>
+ </Button>
</VStack>
</ValidatedForm>
</div>
diff --git a/apps/carbon/app/routes/_public+/login.tsx b/apps/carbon/app/routes/_public+/login.tsx
index 0cf2f1c3ee..8505ad0d8f 100644
--- a/apps/carbon/app/routes/_public+/login.tsx
+++ b/apps/carbon/app/routes/_public+/login.tsx
@@ -1,4 +1,4 @@
-import { Alert, AlertIcon, AlertTitle, VStack } from "@chakra-ui/react";
+import { Alert, AlertTitle, Button, VStack } from "@carbon/react";
import type {
ActionFunctionArgs,
LoaderFunctionArgs,
@@ -6,6 +6,7 @@ import type {
} from "@remix-run/node";
import { json, redirect } from "@remix-run/node";
import { Link, useActionData, useSearchParams } from "@remix-run/react";
+import { LuAlertCircle } from "react-icons/lu";
import { ValidatedForm, validationError } from "remix-validated-form";
import { Hidden, Input, Password, Submit } from "~/components/Form";
@@ -86,8 +87,8 @@ export default function LoginRoute() {
>
<VStack spacing={4}>
{result && result?.message && (
- <Alert status="error">
- <AlertIcon />
+ <Alert variant="destructive">
+ <LuAlertCircle className="w-4 h-4" />
<AlertTitle>{result?.message}</AlertTitle>
</Alert>
)}
@@ -96,11 +97,11 @@ export default function LoginRoute() {
<Password name="password" label="Password" type="password" />
<Hidden name="redirectTo" value={redirectTo} type="hidden" />
<Submit size="lg" className="w-full">
- Sign in
+ Sign In
</Submit>
- <Link to={path.to.forgotPassword} className="text-foreground">
- Forgot password?
- </Link>
+ <Button variant="link" asChild className="w-full">
+ <Link to={path.to.forgotPassword}>Forgot Password</Link>
+ </Button>
</VStack>
</ValidatedForm>
</div>
diff --git a/apps/carbon/app/routes/_public+/reset-password.tsx b/apps/carbon/app/routes/_public+/reset-password.tsx
index 7fd98e1c66..6e190809ca 100644
--- a/apps/carbon/app/routes/_public+/reset-password.tsx
+++ b/apps/carbon/app/routes/_public+/reset-password.tsx
@@ -1,5 +1,5 @@
-import { HStack, VStack } from "@carbon/react";
-import { Button, Image, Text, useColorModeValue } from "@chakra-ui/react";
+import { Button, HStack, VStack } from "@carbon/react";
+
import type { ActionFunctionArgs, LoaderFunctionArgs } from "@remix-run/node";
import { json, redirect } from "@remix-run/node";
import { useNavigate } from "@remix-run/react";
@@ -53,14 +53,15 @@ export default function ResetPasswordRoute() {
return (
<>
- <Image
- src={useColorModeValue(
- "/carbon-logo-dark.png",
- "/carbon-logo-light.png"
- )}
+ <img
+ src="/carbon-logo-dark.png"
+ alt="Carbon Logo"
+ className="block dark:hidden max-w-[100px] mb-3"
+ />
+ <img
+ src="/carbon-logo-light.png"
alt="Carbon Logo"
- maxW={100}
- marginBottom={3}
+ className="hidden dark:block max-w-[100px] mb-3"
/>
<div className="rounded-lg bg-background shadow-lg p-8 w-[380px]">
@@ -70,13 +71,13 @@ export default function ResetPasswordRoute() {
validator={resetPasswordValidator}
>
<VStack spacing={4}>
- <Text>Please select a new password.</Text>
+ <p>Please select a new password.</p>
<Password name="password" label="New Password" />
<HStack spacing={4}>
<Submit>Reset Password</Submit>
<Button
- variant="solid"
+ variant="secondary"
onClick={() => navigate(path.to.authenticatedRoot)}
>
Skip
diff --git a/apps/carbon/app/routes/x+/_layout.tsx b/apps/carbon/app/routes/x+/_layout.tsx
index 0220ac2ed5..8b6626969f 100644
--- a/apps/carbon/app/routes/x+/_layout.tsx
+++ b/apps/carbon/app/routes/x+/_layout.tsx
@@ -1,4 +1,4 @@
-import { VStack, useNotification } from "@carbon/react";
+import { Toaster, VStack, toast } from "@carbon/react";
import type { LoaderFunctionArgs } from "@remix-run/node";
import { json, redirect } from "@remix-run/node";
import { Outlet, useLoaderData, useNavigation } from "@remix-run/react";
@@ -71,17 +71,17 @@ export async function loader({ request }: LoaderFunctionArgs) {
export default function AuthenticatedRoute() {
const { session, result } = useLoaderData<typeof loader>();
- const notify = useNotification();
const transition = useNavigation();
/* Toast Messages */
useEffect(() => {
+ console.log("result", result);
if (result?.success === true) {
- notify.success(result.message);
+ toast.success(result.message);
} else if (result?.message) {
- notify.error(result.message);
+ toast.error(result.message);
}
- }, [result, notify]);
+ }, [result]);
/* NProgress */
useEffect(() => {
@@ -95,19 +95,22 @@ export default function AuthenticatedRoute() {
return (
<SupabaseProvider session={session}>
<RealtimeDataProvider>
- <div className="grid grid-cols-[auto_1fr] h-screen w-screen">
- <IconSidebar />
- <div className="w-full h-full">
- <div className="grid grid-rows-[auto_1fr] h-full w-full">
- <Topbar />
- <div className="flex w-full h-full">
- <VStack spacing={0} className="bg-muted">
- <Outlet />
- </VStack>
+ <>
+ <div className="grid grid-cols-[auto_1fr] h-screen w-screen">
+ <IconSidebar />
+ <div className="w-full h-full">
+ <div className="grid grid-rows-[auto_1fr] h-full w-full">
+ <Topbar />
+ <div className="flex w-full h-full">
+ <VStack spacing={0} className="bg-muted">
+ <Outlet />
+ </VStack>
+ </div>
</div>
</div>
</div>
- </div>
+ <Toaster />
+ </>
</RealtimeDataProvider>
</SupabaseProvider>
);
diff --git a/apps/carbon/app/routes/x+/index.tsx b/apps/carbon/app/routes/x+/index.tsx
index a32b1acf7c..b5509d1992 100644
--- a/apps/carbon/app/routes/x+/index.tsx
+++ b/apps/carbon/app/routes/x+/index.tsx
@@ -8,5 +8,5 @@ export async function loader({ request }: LoaderFunctionArgs) {
export default function AppIndexRoute() {
const editor = useEditor(`<h2>Hello, World</h2><p>Welcome to Carbon!</p>`);
- return <Editor editor={editor} h="calc(100vh - 98px)" />;
+ return <Editor editor={editor} className="h-[calc(100vh-98px)]" />;
}
diff --git a/apps/carbon/app/styles/nprogress.css b/apps/carbon/app/styles/nprogress.css
index 8b5a5ac8ec..7f31ea3f18 100644
--- a/apps/carbon/app/styles/nprogress.css
+++ b/apps/carbon/app/styles/nprogress.css
@@ -4,7 +4,7 @@
}
#nprogress .bar {
- background: var(--chakra-ui-focus-ring-color);
+ background: #002aff99;
position: fixed;
z-index: 1031;
diff --git a/apps/carbon/app/styles/tailwind.css b/apps/carbon/app/styles/tailwind.css
index 4c2e23b753..ced0db8ee3 100644
--- a/apps/carbon/app/styles/tailwind.css
+++ b/apps/carbon/app/styles/tailwind.css
@@ -1,3 +1,5 @@
+@import url("https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&family=Roboto+Mono:wght@300;400;500;600;700&display=swap&display=swap");
+
@tailwind base;
@tailwind components;
@tailwind utilities;
@@ -55,26 +57,8 @@
}
body {
@apply bg-background text-foreground;
- /* font-feature-settings: "rlig" 1, "calt" 1; */
+ font-feature-settings: "rlig" 1, "calt" 1;
font-synthesis-weight: none;
text-rendering: optimizeLegibility;
}
}
-
-@layer utilities {
- .step {
- counter-increment: step;
- }
-
- .step:before {
- @apply absolute w-9 h-9 bg-muted rounded-full font-mono font-medium text-center text-base inline-flex items-center justify-center -indent-px border-4 border-background;
- @apply ml-[-50px] mt-[-4px];
- content: counter(step);
- }
-}
-
-@media (max-width: 640px) {
- .container {
- @apply px-4;
- }
-}
diff --git a/package-lock.json b/package-lock.json
index 683b27fd46..74d66ea9ef 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -5044,6 +5044,30 @@
}
}
},
+ "node_modules/@radix-ui/react-progress": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/@radix-ui/react-progress/-/react-progress-1.0.3.tgz",
+ "integrity": "sha512-5G6Om/tYSxjSeEdrb1VfKkfZfn/1IlPWd731h2RfPuSbIfNUgfqAwbKfJCg/PP6nuUCTrYzalwHSpSinoWoCag==",
+ "dependencies": {
+ "@babel/runtime": "^7.13.10",
+ "@radix-ui/react-context": "1.0.1",
+ "@radix-ui/react-primitive": "1.0.3"
+ },
+ "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-radio-group": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/@radix-ui/react-radio-group/-/react-radio-group-1.1.3.tgz",
@@ -25574,6 +25598,15 @@
"node": ">=0.10.0"
}
},
+ "node_modules/sonner": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/sonner/-/sonner-1.3.1.tgz",
+ "integrity": "sha512-+rOAO56b2eI3q5BtgljERSn2umRk63KFIvgb2ohbZ5X+Eb5u+a/7/0ZgswYqgBMg8dyl7n6OXd9KasA8QF9ToA==",
+ "peerDependencies": {
+ "react": "^18.0.0",
+ "react-dom": "^18.0.0"
+ }
+ },
"node_modules/sort-keys": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/sort-keys/-/sort-keys-5.0.0.tgz",
@@ -29881,6 +29914,7 @@
"@radix-ui/react-dropdown-menu": "^2.0.5",
"@radix-ui/react-hover-card": "^1.0.6",
"@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-select": "^2.0.0",
"@radix-ui/react-separator": "^1.0.3",
@@ -29916,6 +29950,7 @@
"is-hotkey": "^0.2.0",
"react-aria-components": "1.0.1",
"react-colorful": "^5.6.1",
+ "sonner": "^1.3.1",
"tailwind-merge": "^2.2.0",
"tailwindcss-animate": "^1.0.7"
},
diff --git a/packages/react/package.json b/packages/react/package.json
index 968ac1e7ad..97b3881cb1 100644
--- a/packages/react/package.json
+++ b/packages/react/package.json
@@ -28,6 +28,7 @@
"@radix-ui/react-dropdown-menu": "^2.0.5",
"@radix-ui/react-hover-card": "^1.0.6",
"@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-select": "^2.0.0",
"@radix-ui/react-separator": "^1.0.3",
@@ -63,6 +64,7 @@
"is-hotkey": "^0.2.0",
"react-aria-components": "1.0.1",
"react-colorful": "^5.6.1",
+ "sonner": "^1.3.1",
"tailwind-merge": "^2.2.0",
"tailwindcss-animate": "^1.0.7"
},
@@ -84,9 +86,6 @@
"typescript": "^5.2.2"
},
"peerDependencies": {
- "@chakra-ui/react": "^2.8.0",
- "@emotion/react": "^11.11.1",
- "@emotion/styled": "^11.11.0",
"@internationalized/date": "^3.3.0",
"framer-motion": "^10.13.1",
"react": "^18.0.0 || ^17.0.0",
diff --git a/packages/react/src/Alert.tsx b/packages/react/src/Alert.tsx
new file mode 100644
index 0000000000..2d24d89901
--- /dev/null
+++ b/packages/react/src/Alert.tsx
@@ -0,0 +1,60 @@
+import { cva, type VariantProps } from "class-variance-authority";
+import type { HTMLAttributes } from "react";
+import { forwardRef } from "react";
+
+import { cn } from "~/utils/cn";
+
+const alertVariants = cva(
+ "relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",
+ {
+ variants: {
+ variant: {
+ default: "bg-background text-foreground",
+ destructive:
+ "border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",
+ },
+ },
+ defaultVariants: {
+ variant: "default",
+ },
+ }
+);
+
+const Alert = forwardRef<
+ HTMLDivElement,
+ HTMLAttributes<HTMLDivElement> & VariantProps<typeof alertVariants>
+>(({ className, variant, ...props }, ref) => (
+ <div
+ ref={ref}
+ role="alert"
+ className={cn(alertVariants({ variant }), className)}
+ {...props}
+ />
+));
+Alert.displayName = "Alert";
+
+const AlertTitle = forwardRef<
+ HTMLParagraphElement,
+ HTMLAttributes<HTMLHeadingElement>
+>(({ className, ...props }, ref) => (
+ <h5
+ ref={ref}
+ className={cn("mb-1 font-medium leading-none tracking-tight", className)}
+ {...props}
+ />
+));
+AlertTitle.displayName = "AlertTitle";
+
+const AlertDescription = forwardRef<
+ HTMLParagraphElement,
+ HTMLAttributes<HTMLParagraphElement>
+>(({ className, ...props }, ref) => (
+ <div
+ ref={ref}
+ className={cn("text-sm [&_p]:leading-relaxed", className)}
+ {...props}
+ />
+));
+AlertDescription.displayName = "AlertDescription";
+
+export { Alert, AlertDescription, AlertTitle };
diff --git a/packages/react/src/Badge.tsx b/packages/react/src/Badge.tsx
index 6d6f79c9bb..ccafbf9c8d 100644
--- a/packages/react/src/Badge.tsx
+++ b/packages/react/src/Badge.tsx
@@ -1,10 +1,16 @@
import { cva, type VariantProps } from "class-variance-authority";
-import type { HTMLAttributes } from "react";
+import type {
+ ComponentPropsWithoutRef,
+ ElementRef,
+ HTMLAttributes,
+} from "react";
+import { forwardRef } from "react";
+import { MdClose } from "react-icons/md";
import { cn } from "~/utils/cn";
const badgeVariants = cva(
- "inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
+ "inline-flex items-center rounded-md border px-2.5 py-0.5 h-6 text-sm font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
{
variants: {
variant: {
@@ -15,6 +21,12 @@ const badgeVariants = cva(
destructive:
"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",
outline: "text-foreground",
+ green: "border-transparent bg-green-100 text-green-800",
+ yellow: "border-transparent bg-yellow-100 text-yellow-800",
+ orange: "border-transparent bg-orange-100 text-orange-800",
+ red: "border-transparent bg-red-100 text-red-800",
+ blue: "border-transparent bg-blue-100 text-blue-800",
+ gray: "border-transparent bg-muted hover:bg-muted/80",
},
},
defaultVariants: {
@@ -33,4 +45,19 @@ function Badge({ className, variant, ...props }: BadgeProps) {
);
}
-export { Badge, badgeVariants };
+const BadgeCloseButton = forwardRef<
+ ElementRef<"button">,
+ ComponentPropsWithoutRef<"button">
+>(({ className, ...props }, ref) => (
+ <button
+ className={cn(
+ "ml-1 ring-offset-background rounded-full outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
+ className
+ )}
+ {...props}
+ >
+ <MdClose className="h-3 w-3 text-muted-foreground hover:text-foreground" />
+ </button>
+));
+BadgeCloseButton.displayName = "BadgeCloseButton";
+export { Badge, BadgeCloseButton, badgeVariants };
diff --git a/packages/react/src/Button.tsx b/packages/react/src/Button.tsx
index 089ec81ca5..e48a3dfc16 100644
--- a/packages/react/src/Button.tsx
+++ b/packages/react/src/Button.tsx
@@ -5,6 +5,7 @@ import type { ButtonHTMLAttributes, ReactElement } from "react";
import { cloneElement, forwardRef } from "react";
import { cn } from "~/utils/cn";
+import { Spinner } from "./Spinner";
const buttonVariants = cva(
"inline-flex items-center justify-center whitespace-nowrap rounded-md font-medium transition-colors ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
@@ -121,7 +122,7 @@ const Button = forwardRef<HTMLButtonElement, ButtonProps>(
role={asChild ? undefined : "button"}
ref={ref}
>
- {isLoading && <Loader />}
+ {isLoading && <Spinner className="mr-2" />}
{!isLoading &&
leftIcon &&
cloneElement(leftIcon, {
@@ -143,22 +144,3 @@ const Button = forwardRef<HTMLButtonElement, ButtonProps>(
Button.displayName = "Button";
export { Button };
-
-function Loader() {
- return (
- <svg
- xmlns="http://www.w3.org/2000/svg"
- width="24"
- height="24"
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- strokeWidth="2"
- strokeLinecap="round"
- strokeLinejoin="round"
- className="mr-2 h-4 w-4 animate-spin"
- >
- <path d="M21 12a9 9 0 1 1-6.219-8.56"></path>
- </svg>
- );
-}
diff --git a/packages/react/src/Card.tsx b/packages/react/src/Card.tsx
index 0e5236c774..b81677ddad 100644
--- a/packages/react/src/Card.tsx
+++ b/packages/react/src/Card.tsx
@@ -27,6 +27,57 @@ const CardAction = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(
);
CardAction.displayName = "CardAction";
+const CardAttribute = forwardRef<
+ HTMLDivElement,
+ HTMLAttributes<HTMLDivElement>
+>(({ className, ...props }, ref) => (
+ <div
+ ref={ref}
+ className={cn(
+ "flex flex-row md:flex-col items-start justify-between gap-2",
+ className
+ )}
+ {...props}
+ />
+));
+CardAttribute.displayName = "CardAttribute";
+
+const CardAttributes = forwardRef<
+ HTMLDivElement,
+ HTMLAttributes<HTMLDivElement>
+>(({ className, ...props }, ref) => (
+ <div
+ ref={ref}
+ className={cn("flex flex-col md:flex-row gap-8", className)}
+ {...props}
+ />
+));
+CardAttributes.displayName = "CardAttributes";
+
+const CardAttributeLabel = forwardRef<
+ HTMLDivElement,
+ HTMLAttributes<HTMLDivElement>
+>(({ className, ...props }, ref) => (
+ <div
+ ref={ref}
+ className={cn("text-sm text-muted-foreground", className)}
+ {...props}
+ />
+));
+CardAttributeLabel.displayName = "CardAttributeLabel";
+
+const CardAttributeValue = forwardRef<
+ HTMLDivElement,
+ HTMLAttributes<HTMLDivElement>
+>(({ className, ...props }, ref) => (
+ <div
+ ref={ref}
+ className={cn("font-bold text-foreground", className)}
+ {...props}
+ />
+));
+CardAttributeValue.displayName = "CardAttributeValue";
+
const CardHeader = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(
({ className, ...props }, ref) => (
<div
@@ -90,6 +141,10 @@ CardFooter.displayName = "CardFooter";
export {
Card,
CardAction,
+ CardAttribute,
+ CardAttributeLabel,
+ CardAttributeValue,
+ CardAttributes,
CardContent,
CardDescription,
CardFooter,
diff --git a/packages/react/src/DataTable/DataTable.tsx b/packages/react/src/DataTable/DataTable.tsx
index 178d53c632..bf116858ef 100644
--- a/packages/react/src/DataTable/DataTable.tsx
+++ b/packages/react/src/DataTable/DataTable.tsx
@@ -1,4 +1,3 @@
-import { Table, Tbody, Td, Th, Thead, Tr } from "@chakra-ui/react";
import type {
ColumnDef,
ColumnFiltersState,
@@ -16,6 +15,7 @@ import {
useReactTable,
} from "@tanstack/react-table";
import { useState } from "react";
+import { Table, Tbody, Td, Th, Thead, Tr } from "~/Table";
import { VStack } from "~/VStack";
import { DataTablePagination } from "./DataTablePagination";
@@ -76,9 +76,7 @@ const DataTable = <TData, TValue>({
<Th
key={header.id}
colSpan={header.colSpan}
- px={4}
- py={2}
- whiteSpace="nowrap"
+ className="px-4 py-2 whitespace-nowrap"
>
{header.isPlaceholder
? null
@@ -102,11 +100,7 @@ const DataTable = <TData, TValue>({
{row.getVisibleCells().map((cell) => (
<Td
key={cell.id}
- fontSize="sm"
- outline="none"
- px={4}
- py={2}
- whiteSpace="nowrap"
+ className="text-sm outline-none px-4 py-2 whitespace-nowrap"
>
{flexRender(
cell.column.columnDef.cell,
@@ -118,7 +112,7 @@ const DataTable = <TData, TValue>({
))
) : (
<Tr>
- <Td colSpan={columns.length} textAlign="center" h={24}>
+ <Td colSpan={columns.length} className="text-center h-24">
No results.
</Td>
</Tr>
diff --git a/packages/react/src/DataTable/DataTablePagination.tsx b/packages/react/src/DataTable/DataTablePagination.tsx
index 441b51857c..73b0e7b2ef 100644
--- a/packages/react/src/DataTable/DataTablePagination.tsx
+++ b/packages/react/src/DataTable/DataTablePagination.tsx
@@ -1,7 +1,12 @@
-import { Menu, MenuButton, MenuItem, MenuList } from "@chakra-ui/react";
import type { Table } from "@tanstack/react-table";
import { BsChevronLeft, BsChevronRight } from "react-icons/bs";
import { Button } from "~/Button";
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+} from "~/Dropdown";
import { HStack } from "~/HStack";
interface DataTablePaginationProps<TData> {
@@ -23,23 +28,25 @@ export function DataTablePagination<TData>({
className="text-center bg-background border-t border-border justify-between px-4 py-2 w-full z-[1]"
spacing={6}
>
- <Menu>
- <MenuButton as={Button} variant="ghost">
- {table.getState().pagination.pageSize} {pageSizeLabel}
- </MenuButton>
- <MenuList fontSize="sm" boxShadow="xl" minW={48}>
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <Button variant="ghost">
+ {table.getState().pagination.pageSize} {pageSizeLabel}
+ </Button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent className="w-48">
{pageSizes.map((size) => (
- <MenuItem
+ <DropdownMenuItem
key={`${size}`}
onClick={() => {
table.setPageSize(Number(size));
}}
>
{size} {pageSizeLabel}
- </MenuItem>
+ </DropdownMenuItem>
))}
- </MenuList>
- </Menu>
+ </DropdownMenuContent>
+ </DropdownMenu>
<HStack>
<div className="flex text-sm font-md h-8 items-center">
Page {table.getState().pagination.pageIndex + 1} of{" "}
diff --git a/packages/react/src/Date/components/Calendar.tsx b/packages/react/src/Date/components/Calendar.tsx
index 7dd2b957c6..4e34bfbe80 100644
--- a/packages/react/src/Date/components/Calendar.tsx
+++ b/packages/react/src/Date/components/Calendar.tsx
@@ -1,4 +1,3 @@
-import { Box } from "@chakra-ui/react";
import type { CalendarDate, DateValue } from "@internationalized/date";
import { createCalendar } from "@internationalized/date";
import type { CalendarProps } from "@react-aria/calendar";
@@ -34,7 +33,7 @@ export const Calendar = (props: CalendarProps<DateValue>) => {
return (
<div {...calendarProps} ref={ref}>
- <Box display="flex" alignItems="center" paddingBottom="4">
+ <div className="flex items-center pb-4">
<CalendarButton
{...prevButtonProps}
icon={<BiChevronLeft />}
@@ -49,7 +48,7 @@ export const Calendar = (props: CalendarProps<DateValue>) => {
icon={<BiChevronRight />}
aria-label="Next"
/>
- </Box>
+ </div>
<CalendarGrid state={state} />
</div>
);
diff --git a/packages/react/src/Date/components/Popover.tsx b/packages/react/src/Date/components/Popover.tsx
index a4f31aab99..936f731342 100644
--- a/packages/react/src/Date/components/Popover.tsx
+++ b/packages/react/src/Date/components/Popover.tsx
@@ -1,6 +1,5 @@
-import { useOutsideClick } from "@chakra-ui/react";
import { useRef } from "react";
-import { useEscape } from "../../hooks";
+import { useEscape, useOutsideClick } from "~/hooks";
export function Popover(props: any) {
const ref = useRef();
diff --git a/packages/react/src/Date/components/RangeCalendar.tsx b/packages/react/src/Date/components/RangeCalendar.tsx
index 63a8e747bc..e60d30aab4 100644
--- a/packages/react/src/Date/components/RangeCalendar.tsx
+++ b/packages/react/src/Date/components/RangeCalendar.tsx
@@ -1,4 +1,3 @@
-import { Box, Icon } from "@chakra-ui/react";
import type { DateValue } from "@internationalized/date";
import { createCalendar } from "@internationalized/date";
import type { RangeCalendarProps } from "@react-aria/calendar";
@@ -27,21 +26,28 @@ export function RangeCalendar(props: RangeCalendarProps<DateValue>) {
return (
<div {...calendarProps} ref={ref}>
- <Box display="flex" alignItems="center" paddingBottom="4">
- <CalendarButton {...prevButtonProps}>
- <Icon as={FaAngleLeft} w={6} h={6} />
- </CalendarButton>
+ <div className="flex items-center pb-4">
+ <CalendarButton
+ aria-label="Previous Month"
+ icon={<FaAngleLeft />}
+ {...prevButtonProps}
+ className="w-6 h-6"
+ />
+
<Heading as="h2" size="h3" className="flex-1 text-center">
{title}
</Heading>
- <CalendarButton {...nextButtonProps}>
- <Icon as={FaAngleRight} w={6} h={6} />
- </CalendarButton>
- </Box>
- <Box display="flex" gap="8">
+ <CalendarButton
+ aria-label="Next Month"
+ icon={<FaAngleRight />}
+ {...nextButtonProps}
+ className="w-6 h-6"
+ />
+ </div>
+ <div className="flex gap-8">
<CalendarGrid state={state} />
<CalendarGrid state={state} offset={{ months: 1 }} />
- </Box>
+ </div>
</div>
);
}
diff --git a/packages/react/src/Editor/Editor.tsx b/packages/react/src/Editor/Editor.tsx
index 3daaedbe33..dcd41428ae 100644
--- a/packages/react/src/Editor/Editor.tsx
+++ b/packages/react/src/Editor/Editor.tsx
@@ -1,11 +1,10 @@
-import type { BoxProps } from "@chakra-ui/react";
-import { Box } from "@chakra-ui/react";
import { Color } from "@tiptap/extension-color";
import ListItem from "@tiptap/extension-list-item";
import TextStyle from "@tiptap/extension-text-style";
import { EditorContent, useEditor as useEditorInternal } from "@tiptap/react";
import StarterKit from "@tiptap/starter-kit";
-import { reset } from "~/Theme";
+import type { ComponentProps } from "react";
+import { cn } from "src/utils/cn";
import { VStack } from "~/VStack";
import { Toolbar } from "./Toolbar";
@@ -31,11 +30,14 @@ export const useEditor = (content: string) => {
return editor;
};
-export type EditorProps = Omit<BoxProps, "onChange"> & {
+export type EditorProps = Omit<
+ ComponentProps<typeof EditorContent>,
+ "onChange"
+> & {
editor: ReturnType<typeof useEditor>;
};
-export const Editor = ({ editor, ...props }: EditorProps) => {
+export const Editor = ({ editor, className, ...props }: EditorProps) => {
if (!editor) {
return null;
}
@@ -43,24 +45,13 @@ export const Editor = ({ editor, ...props }: EditorProps) => {
return (
<VStack spacing={0}>
<Toolbar editor={editor} />
- <Box
- as={EditorContent}
+ <EditorContent
editor={editor}
- w="full"
- minH={300}
- bg="white"
+ className={cn(
+ "w-full min-h-[300px] bg-background [&h1]:text-2xl [&_h1]:font-bold [&_h1]:tracking-tight [&_h2]:text-xl [&_h2]:font-bold [&_h2]:tracking-tight [&_h3]:text-lg [&_h3]:font-bold [&_h3]:tracking-tight [&_ul]:list-disc [&_ol]:list-decimal [&_ul], [&_ol]:ml-4 [&_pre]:bg-gray-100 [&_pre]:p-4 [&_pre]:rounded-md [&_pre]:overflow-auto [&_blockquote]:border-l-4 [&_blockquote]:border-gray-200 [&_blockquote]:pl-4 [&_blockquote]:ml-4 [&_hr]:border-none [&_hr]:border-b-1 [&_hr]:border-gray-200 [&_hr]:my-4 [&_.ProseMirror]:p-4 [&_.ProseMirror]:h-full [&_.ProseMirror]:outline-none [&_.ProseMirror]:focus:outline-none [&_.ProseMirror]:focus-visible:outline-none [&_.ProseMirror]:focus-visible:ring-2 [&_.ProseMirror]:focus-visible:ring-ring [&_.ProseMirror]:focus-visible:ring-offset-2 [&_.ProseMirror]:focus-visible:ring-offset-background",
+ className
+ )}
{...props}
- __css={{
- "& .ProseMirror": {
- p: 4,
- h: "full",
- outline: "none",
- "&:focus": {
- outline: "none",
- },
- ...reset,
- },
- }}
/>
</VStack>
);
diff --git a/packages/react/src/Editor/Toolbar/Toolbar.tsx b/packages/react/src/Editor/Toolbar/Toolbar.tsx
index be0338535b..d127c8b023 100644
--- a/packages/react/src/Editor/Toolbar/Toolbar.tsx
+++ b/packages/react/src/Editor/Toolbar/Toolbar.tsx
@@ -1,4 +1,3 @@
-import { Divider, Wrap } from "@chakra-ui/react";
import { TooltipProvider } from "~/Tooltip";
import type { EditorComponent } from "../types";
import BlockQuote from "./BlockQuote";
@@ -17,19 +16,17 @@ const Toolbar: EditorComponent = ({ editor }) => {
return (
<TooltipProvider>
<div className="w-full border-b border-border p-2">
- <Wrap shouldWrapChildren>
+ <div className="flex flex-wrap gap-2">
<Paragraph editor={editor} />
<HeadingOne editor={editor} />
<HeadingTwo editor={editor} />
<HeadingThree editor={editor} />
- <Divider orientation="vertical" />
{/* Inline styles */}
<Bold editor={editor} />
<Italic editor={editor} />
<Strike editor={editor} />
<Code editor={editor} />
- <Divider orientation="vertical" />
{/* Block styles */}
<UnorderedList editor={editor} />
@@ -37,7 +34,7 @@ const Toolbar: EditorComponent = ({ editor }) => {
<CodeBlock editor={editor} />
<BlockQuote editor={editor} />
<HorizontalRule editor={editor} />
- </Wrap>
+ </div>
</div>
</TooltipProvider>
);
diff --git a/packages/react/src/File.tsx b/packages/react/src/File.tsx
index 9ff8ca7dfd..396b98032b 100644
--- a/packages/react/src/File.tsx
+++ b/packages/react/src/File.tsx
@@ -1,13 +1,20 @@
-import type { ChangeEvent, ComponentPropsWithoutRef } from "react";
+import type { ChangeEvent } from "react";
import { useRef } from "react";
+import type { ButtonProps } from "~/Button";
import { Button } from "~/Button";
-type FileProps = ComponentPropsWithoutRef<"div"> & {
+type FileProps = Omit<ButtonProps, "onChange"> & {
accept?: string;
onChange: (e: ChangeEvent<HTMLInputElement>) => Promise<void>;
};
-const File = ({ accept, className, children, onChange }: FileProps) => {
+const File = ({
+ accept,
+ className,
+ children,
+ onChange,
+ ...props
+}: FileProps) => {
const fileInputRef = useRef<HTMLInputElement>(null);
return (
@@ -21,6 +28,7 @@ const File = ({ accept, className, children, onChange }: FileProps) => {
/>
<Button
className={className}
+ {...props}
onClick={() => {
if (fileInputRef.current) fileInputRef.current.click();
}}
diff --git a/packages/react/src/HTML.tsx b/packages/react/src/HTML.tsx
index 588fb5d96d..03d33157f8 100644
--- a/packages/react/src/HTML.tsx
+++ b/packages/react/src/HTML.tsx
@@ -1,7 +1,5 @@
-import { Box } from "@chakra-ui/react";
import { sanitize } from "dompurify";
import { useMemo } from "react";
-import { reset } from "./Theme";
type HTMLProps = {
text: string;
@@ -13,15 +11,9 @@ const HTML = ({ text }: HTMLProps) => {
}, [text]);
return (
- <Box
- __css={{
- "&": {
- ...reset,
- },
- }}
- >
+ <div className="[&_h1]:text-2xl [&_h1]:font-bold [&_h1]:tracking-tight [&_h2]:text-xl [&_h2]:font-bold [&_h2]:tracking-tight [&_h3]:text-lg [&_h3]:font-bold [&_h3]:tracking-tight [&_ul]:list-disc [&_ol]:list-decimal [&_ul]:ml-4 [&_ol]:ml-4 [&_pre]:bg-gray-100 [&_pre]:p-4 [&_pre]:rounded-md [&_pre]:overflow-auto [&_blockquote]:border-l-4 [&_blockquote]:border-gray-200 [&_blockquote]:pl-4 [&_blockquote]:ml-4 [&_hr]:border-none [&_hr]:border-b-1 [&_hr]:border-gray-200 [&_hr]:my-4">
<span dangerouslySetInnerHTML={sanitizedHtml} />
- </Box>
+ </div>
);
};
diff --git a/packages/react/src/Loading.tsx b/packages/react/src/Loading.tsx
deleted file mode 100644
index c40a875e39..0000000000
--- a/packages/react/src/Loading.tsx
+++ /dev/null
@@ -1,22 +0,0 @@
-import { Center, Spinner, useColorMode } from "@chakra-ui/react";
-
-type LoadingProps = {
- size?: "sm" | "md" | "lg" | "xl";
-};
-
-export function Loading({ size = "lg" }: LoadingProps) {
- const { colorMode } = useColorMode();
- const emptyColor = colorMode !== "dark" ? "gray.200" : "whiteAlpha.300";
-
- return (
- <Center h="full" w="full">
- <Spinner
- thickness="4px"
- speed="1s"
- emptyColor={emptyColor}
- color="brand.500"
- size={size}
- />
- </Center>
- );
-}
diff --git a/packages/react/src/Menu.tsx b/packages/react/src/Menu.tsx
index 8cd4febb65..1399e604a6 100644
--- a/packages/react/src/Menu.tsx
+++ b/packages/react/src/Menu.tsx
@@ -1,3 +1,6 @@
+/*
+ Menu components are an abstraction over ContextMenu and DropdownMenu components.
+*/
import type {
ComponentPropsWithoutRef,
ElementRef,
diff --git a/packages/react/src/Menubar.tsx b/packages/react/src/Menubar.tsx
index 30528bcac4..cb39ec9084 100644
--- a/packages/react/src/Menubar.tsx
+++ b/packages/react/src/Menubar.tsx
@@ -1,8 +1,5 @@
-import type { MenuButtonProps } from "@chakra-ui/react";
-import { MenuButton } from "@chakra-ui/react";
import type { ComponentProps } from "react";
import { forwardRef } from "react";
-import { MdExpandMore } from "react-icons/md";
import type { ButtonProps } from "~/Button";
import { Button } from "~/Button";
@@ -20,23 +17,6 @@ const Menubar = forwardRef<HTMLDivElement, ComponentProps<"div">>(
);
Menubar.displayName = "Menubar";
-const MenubarTrigger = forwardRef<HTMLButtonElement, MenuButtonProps>(
- ({ children, ...props }, ref) => {
- return (
- <MenuButton
- ref={ref}
- as={Button}
- variant="ghost"
- rightIcon={<MdExpandMore />}
- {...props}
- >
- {children}
- </MenuButton>
- );
- }
-);
-MenubarTrigger.displayName = "MenubarTrigger";
-
const MenubarItem = forwardRef<HTMLButtonElement, ButtonProps>(
({ children, ...props }, ref) => {
return (
@@ -48,4 +28,4 @@ const MenubarItem = forwardRef<HTMLButtonElement, ButtonProps>(
);
MenubarItem.displayName = "MenubarItem";
-export { Menubar, MenubarItem, MenubarTrigger };
+export { Menubar, MenubarItem };
diff --git a/packages/react/src/Progress.tsx b/packages/react/src/Progress.tsx
new file mode 100644
index 0000000000..38e5a88a41
--- /dev/null
+++ b/packages/react/src/Progress.tsx
@@ -0,0 +1,29 @@
+"use client";
+
+import * as ProgressPrimitive from "@radix-ui/react-progress";
+import type { ComponentPropsWithoutRef, ElementRef } from "react";
+import { forwardRef } from "react";
+
+import { cn } from "~/utils/cn";
+
+const Progress = forwardRef<
+ ElementRef<typeof ProgressPrimitive.Root>,
+ ComponentPropsWithoutRef<typeof ProgressPrimitive.Root>
+>(({ className, value, ...props }, ref) => (
+ <ProgressPrimitive.Root
+ ref={ref}
+ className={cn(
+ "relative h-4 w-full overflow-hidden rounded-full bg-secondary",
+ className
+ )}
+ {...props}
+ >
+ <ProgressPrimitive.Indicator
+ className="h-full w-full flex-1 bg-green-500 transition-all"
+ style={{ transform: `translateX(-${100 - (value || 0)}%)` }}
+ />
+ </ProgressPrimitive.Root>
+));
+Progress.displayName = ProgressPrimitive.Root.displayName;
+
+export { Progress };
diff --git a/packages/react/src/Spinner.tsx b/packages/react/src/Spinner.tsx
new file mode 100644
index 0000000000..5881bd76bf
--- /dev/null
+++ b/packages/react/src/Spinner.tsx
@@ -0,0 +1,24 @@
+import type { ComponentProps } from "react";
+import { cn } from "~/utils/cn";
+
+const Spinner = ({ className, ...props }: ComponentProps<"svg">) => {
+ return (
+ <svg
+ xmlns="http://www.w3.org/2000/svg"
+ width="24"
+ height="24"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ strokeWidth="2"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ className={cn("h-4 w-4 animate-spin", className)}
+ {...props}
+ >
+ <path d="M21 12a9 9 0 1 1-6.219-8.56"></path>
+ </svg>
+ );
+};
+
+export { Spinner };
diff --git a/packages/react/src/Status.tsx b/packages/react/src/Status.tsx
index 0c5d13a0da..33946ee247 100644
--- a/packages/react/src/Status.tsx
+++ b/packages/react/src/Status.tsx
@@ -1,22 +1,24 @@
-import { Tag, TagLabel, TagLeftIcon } from "@chakra-ui/react";
import type { ComponentProps } from "react";
-import { forwardRef } from "react";
import { RxDotFilled } from "react-icons/rx";
+import { cn } from "~/utils/cn";
+import { Badge } from "./Badge";
-const Status = forwardRef<
- HTMLDivElement,
- ComponentProps<"div"> & {
- color?: "green" | "orange" | "red" | "yellow" | "blue" | "gray";
- }
->(({ color = "gray", children, className, ...props }, ref) => {
+type StatusProps = ComponentProps<"div"> & {
+ color?: "green" | "orange" | "red" | "yellow" | "blue" | "gray";
+};
+
+const Status = ({
+ color = "gray",
+ children,
+ className,
+ ...props
+}: StatusProps) => {
return (
- <Tag colorScheme={color} className={className} ref={ref}>
- <TagLeftIcon as={RxDotFilled} marginEnd={0} size="10px" />
- <TagLabel>{children}</TagLabel>
- </Tag>
+ <Badge variant={color} className={cn("pl-1.5", className)} {...props}>
+ <RxDotFilled className="w-5 h-5 mr-1" />
+ {children}
+ </Badge>
);
-});
-
-Status.displayName = "Status";
+};
export { Status };
diff --git a/packages/react/src/Textarea.tsx b/packages/react/src/Textarea.tsx
index dbea899a2c..08f9f7c015 100644
--- a/packages/react/src/Textarea.tsx
+++ b/packages/react/src/Textarea.tsx
@@ -10,7 +10,7 @@ const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(
return (
<textarea
className={cn(
- "flex min-h-[80px] w-full rounded-md border border-input bg-backgrond px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 read-only:bg-muted read-only:cursor-not-allowed",
+ "flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 read-only:bg-muted read-only:cursor-not-allowed",
className
)}
ref={ref}
diff --git a/packages/react/src/Theme/ThemeProvider.tsx b/packages/react/src/Theme/ThemeProvider.tsx
deleted file mode 100644
index 6e3164a934..0000000000
--- a/packages/react/src/Theme/ThemeProvider.tsx
+++ /dev/null
@@ -1,27 +0,0 @@
-import { ChakraProvider, extendTheme } from "@chakra-ui/react";
-import type { ReactNode } from "react";
-import { useMemo } from "react";
-import { theme as carbonTheme } from "./theme";
-
-export enum Mode {
- Dark = "dark",
- Light = "light",
-}
-
-type ThemeProviderProps = {
- brandColor?: string;
- children: ReactNode;
-};
-
-const ThemeProvider = ({ children }: ThemeProviderProps) => {
- const theme = useMemo(() => {
- return extendTheme({
- ...carbonTheme,
- });
- // eslint-disable-next-line react-hooks/exhaustive-deps
- }, []);
-
- return <ChakraProvider theme={theme}>{children}</ChakraProvider>;
-};
-
-export default ThemeProvider;
diff --git a/packages/react/src/Theme/focusRing.ts b/packages/react/src/Theme/focusRing.ts
deleted file mode 100644
index 095dabafca..0000000000
--- a/packages/react/src/Theme/focusRing.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-type ColorMode = "light" | "dark";
-export const focusRingOutlined = ({ colorMode }: { colorMode: ColorMode }) => ({
- field: {
- backgroundColor: colorMode == "light" ? "white" : "gray.800",
- _focus: {
- borderColor: "var(--chakra-ui-focus-ring-color)",
- boxShadow: "0 0 0 2px var(--chakra-ui-focus-ring-color)",
- },
- },
-});
-
-export const focusRingFilled = ({ colorMode }: { colorMode: ColorMode }) => ({
- field: {
- backgroundColor: colorMode == "light" ? "white" : "gray.800",
- _focus: {
- borderColor: "var(--chakra-ui-focus-ring-color)",
- boxShadow: "0 0 0 1px var(--chakra-ui-focus-ring-color)",
- },
- },
-});
-
-export const focusRingFlushed = ({ colorMode }: { colorMode: ColorMode }) => ({
- field: {
- backgroundColor: colorMode == "light" ? "white" : "gray.800",
- _focus: {
- borderColor: "var(--chakra-ui-focus-ring-color)",
- boxShadow: "0 1px 0 0 var(--chakra-ui-focus-ring-color)",
- },
- },
-});
diff --git a/packages/react/src/Theme/fonts.ts b/packages/react/src/Theme/fonts.ts
deleted file mode 100644
index d48c530d6c..0000000000
--- a/packages/react/src/Theme/fonts.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-export const fonts = {
- heading: `'Inter', Inter var,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,'Helvetica Neue',Arial,'Noto Sans',sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol','Noto Color Emoji'`,
- body: `'Inter',ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,'Helvetica Neue',Arial,'Noto Sans',sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol','Noto Color Emoji'`,
-};
diff --git a/packages/react/src/Theme/index.ts b/packages/react/src/Theme/index.ts
deleted file mode 100644
index 92336af591..0000000000
--- a/packages/react/src/Theme/index.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-import ThemeProvider from "./ThemeProvider";
-import { reset } from "./reset";
-import { theme } from "./theme";
-export default ThemeProvider;
-export { reset, theme };
diff --git a/packages/react/src/Theme/palette.ts b/packages/react/src/Theme/palette.ts
deleted file mode 100644
index e77c083cc3..0000000000
--- a/packages/react/src/Theme/palette.ts
+++ /dev/null
@@ -1,44 +0,0 @@
-export const colors = {
- lime: {
- 50: "#86fb8f",
- 100: "#70ff7b",
- 200: "#4bfb58",
- 300: "#32f941",
- 400: "#1eff2f",
- 500: "#00ff15",
- 600: "#00d912",
- 700: "#00b70f",
- 800: "#009f0d",
- 900: "#01770a",
- },
- gray: {
- 50: "#F8FAFB",
- 100: "#F2F4F7",
- 200: "#EAECF0",
- 300: "#D0D5DD",
- 400: "#98A2B3",
- 500: "#667085",
- 600: "#475467",
- 700: "#344054",
- 800: "#1D2939",
- 900: "#101828",
- },
- purple: {
- 50: "#faebff",
- 100: "#ddbbf8",
- 200: "#c88ff0",
- 300: "#b663e9",
- 400: "#9537e1",
- 500: "#711ec8",
- 600: "#4e169c",
- 700: "#310f71",
- 800: "#190845",
- 900: "#07011b",
- },
-};
-
-const palette = {
- ...colors,
-};
-
-export default palette;
diff --git a/packages/react/src/Theme/reset.ts b/packages/react/src/Theme/reset.ts
deleted file mode 100644
index 6ba9402a9a..0000000000
--- a/packages/react/src/Theme/reset.ts
+++ /dev/null
@@ -1,38 +0,0 @@
-export const reset = {
- "& h1": {
- fontSize: "2xl",
- fontWeight: "bold",
- letterSpacing: "tight",
- },
- "& h2": {
- fontSize: "xl",
- fontWeight: "bold",
- letterSpacing: "tight",
- },
- "& h3": {
- fontSize: "lg",
- fontWeight: "bold",
- letterSpacing: "tight",
- },
- "& ul, & ol": {
- ml: 4,
- },
- "& pre": {
- bg: "gray.100",
- p: 4,
- borderRadius: "md",
- overflow: "auto",
- },
- "& blockquote": {
- borderLeft: "4px solid",
- borderColor: "gray.200",
- pl: 4,
- ml: 4,
- },
- "& hr": {
- border: "none",
- borderBottom: "1px solid",
- borderColor: "gray.200",
- my: 4,
- },
-};
diff --git a/packages/react/src/Theme/theme.ts b/packages/react/src/Theme/theme.ts
deleted file mode 100644
index a14e13e3e5..0000000000
--- a/packages/react/src/Theme/theme.ts
+++ /dev/null
@@ -1,190 +0,0 @@
-import {
- focusRingFilled,
- focusRingFlushed,
- focusRingOutlined,
-} from "./focusRing";
-import { fonts } from "./fonts";
-import { colors } from "./palette";
-import { semanticTokens } from "./tokens";
-
-export const theme = {
- fonts,
- colors,
- styles: {
- global: {
- ":host,:root": {
- "--chakra-ui-focus-ring-color": "#002aff99",
- },
- },
- },
- components: {
- Button: {
- baseStyle: {
- transition: "transform 0.08s ease-out, background 0.3s, opacity 0.3s",
- _active: { transform: "scale(0.96)" },
- _disabled: {
- pointerEvents: "none",
- opacity: 0.5,
- },
- },
- sizes: {},
- variants: {
- solid: (props: { colorScheme: string }) => {
- const { colorScheme: c } = props;
-
- if (c !== "brand")
- return {
- borderColor: "gray.200",
- borderWidth: "1px",
- borderStyle: "solid",
- };
-
- return {
- bg: `black`,
- color: "white",
- _hover: {
- bg: "gray.900",
- color: "white",
- },
- _active: {
- bg: "gray.800",
- color: "white",
- },
- };
- },
- },
- defaultProps: {
- size: "sm",
- borderRadius: "md",
- },
- },
- Card: {
- baseStyle: {
- header: {
- borderColor: "gray.200",
- borderBottomWidth: "1px",
- borderBottomStyle: "solid",
- fontWeight: "bold",
- letterSpacing: "tight",
- },
- footer: {
- borderTopWidth: "1px",
- borderTopStyle: "solid",
- borderColor: "gray.200",
- display: "block",
- },
- },
- },
- Checkbox: {
- defaultProps: {
- colorScheme: "blackAlpha",
- },
- },
- Drawer: {
- baseStyle: {
- overlay: {
- backdropFilter: "blur(3px)",
- },
- header: {
- borderColor: "gray.200",
- borderBottomWidth: "1px",
- borderBottomStyle: "solid",
- fontWeight: "bold",
- letterSpacing: "tight",
- marginBottom: 4,
- },
- footer: {
- borderColor: "gray.200",
- borderTopWidth: "1px",
- borderTopStyle: "solid",
- },
- },
- defaultProps: {},
- },
- Heading: {
- baseStyle: {
- letterSpacing: "tight",
- },
- },
- Input: {
- defaultProps: {
- borderRadius: "md",
- },
- sizes: {
- sm: {
- field: {
- borderRadius: "md",
- },
- },
- },
- variants: {
- outline: focusRingOutlined,
- filled: focusRingFilled,
- flushed: focusRingFlushed,
- },
- },
- Modal: {
- baseStyle: {
- header: {
- fontWeight: "bold",
- letterSpacing: "tight",
- },
- overlay: {
- backdropFilter: "blur(3px)",
- },
- },
- },
- NumberInput: {
- variants: {
- outline: focusRingOutlined,
- filled: focusRingFilled,
- flushed: focusRingFlushed,
- },
- },
- Radio: {
- defaultProps: {
- colorScheme: "blackAlpha",
- },
- },
- Select: {
- defaultProps: {
- borderRadius: "md",
- },
- variants: {
- outline: focusRingOutlined,
- filled: focusRingFilled,
- flushed: focusRingFlushed,
- },
- },
- Switch: {
- defaultProps: {
- colorScheme: "green",
- },
- },
- Tabs: {
- variants: {
- line: {
- tab: {
- _selected: {
- color: "black",
- },
- },
- },
- },
- },
- Textarea: {
- variants: {
- outline: () => focusRingOutlined,
- filled: () => focusRingFilled,
- flushed: () => focusRingFlushed,
- },
- },
- },
- shadows: {
- outline: "0 0 0 3px var(--chakra-ui-focus-ring-color)",
- },
- defaultProps: {
- colorScheme: "gray",
- },
- semanticTokens,
-};
diff --git a/packages/react/src/Theme/tokens.ts b/packages/react/src/Theme/tokens.ts
deleted file mode 100644
index d27e3bfcf3..0000000000
--- a/packages/react/src/Theme/tokens.ts
+++ /dev/null
@@ -1,81 +0,0 @@
-export const semanticTokens = {
- colors: {
- "bg-body": {
- default: "white",
- _dark: "gray.900",
- },
- "bg-card": {
- default: "#f2f2f2",
- _dark: "#1C1C1C",
- },
- "bg-contrast-xs": {
- default: "rgba(0, 0, 0, 0.025)",
- _dark: "rgba(255, 255, 255, 0.0125)",
- },
- "bg-contrast-sm": {
- default: "rgba(0, 0, 0, 0.05)",
- _dark: "rgba(255, 255, 255, 0.025)",
- },
- "bg-contrast-md": {
- default: "rgba(0, 0, 0, 0.1)",
- _dark: "rgba(255, 255, 255, 0.05)",
- },
- "bg-contrast-lg": {
- default: "rgba(0, 0, 0, 0.15)",
- _dark: "rgba(255, 255, 255, 0.075)",
- },
- "bg-contrast-xl": {
- default: "rgba(0, 0, 0, 0.2)",
- _dark: "rgba(255, 255, 255, 0.1)",
- },
- "text-contrast-xs": {
- default: "blackAlpha.500",
- _dark: "whiteAlpha.500",
- },
- "text-contrast-sm": {
- default: "blackAlpha.600",
- _dark: "whiteAlpha.600",
- },
- "text-contrast-md": {
- default: "blackAlpha.700",
- _dark: "whiteAlpha.700",
- },
- "text-contrast-lg": {
- default: "blackAlpha.800",
- _dark: "whiteAlpha.800",
- },
- "text-contrast-xl": {
- default: "blackAlpha.900",
- _dark: "whiteAlpha.900",
- },
- "border-contrast-xs": {
- default: "rgba(0, 0, 0, 0.1)",
- _dark: "rgba(255, 255, 255, 0.05)",
- },
- "border-contrast-sm": {
- default: "rgba(0, 0, 0, 0.2)",
- _dark: "rgba(255, 255, 255, 0.1)",
- },
- "border-contrast-md": {
- default: "rgba(0, 0, 0, 0.3)",
- _dark: "rgba(255, 255, 255, 0.15)",
- },
- "border-contrast-lg": {
- default: "rgba(0, 0, 0, 0.4)",
- _dark: "rgba(255, 255, 255, 0.2)",
- },
- "border-contrast-xl": {
- default: "rgba(0, 0, 0, 0.5)",
- _dark: "rgba(255, 255, 255, 0.25)",
- },
- "focus-ring": {
- default: "purple.200",
- _dark: "purple.200",
- },
- },
- borders: {
- sm: `1px solid var(--chakra-colors-border-contrast-xs)`,
- md: `2px solid var(--chakra-colors-border-contrast-xs)`,
- lg: `3px solid var(--chakra-colors-border-contrast-xs)`,
- },
-};
diff --git a/packages/react/src/Toast.tsx b/packages/react/src/Toast.tsx
new file mode 100644
index 0000000000..373f8d0c1e
--- /dev/null
+++ b/packages/react/src/Toast.tsx
@@ -0,0 +1,27 @@
+"use client";
+
+import { Toaster as Sonner, toast } from "sonner";
+
+type ToasterProps = React.ComponentProps<typeof Sonner>;
+
+const Toaster = ({ ...props }: ToasterProps) => {
+ return (
+ <Sonner
+ className="toaster group"
+ toastOptions={{
+ classNames: {
+ toast:
+ "group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",
+ description: "group-[.toast]:text-muted-foreground",
+ actionButton:
+ "group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",
+ cancelButton:
+ "group-[.toast]:bg-muted group-[.toast]:text-muted-foreground",
+ },
+ }}
+ {...props}
+ />
+ );
+};
+
+export { Toaster, toast };
diff --git a/packages/react/src/hooks/index.ts b/packages/react/src/hooks/index.ts
index c3c5e84500..178f6c3a20 100644
--- a/packages/react/src/hooks/index.ts
+++ b/packages/react/src/hooks/index.ts
@@ -1,4 +1,3 @@
-import useColor from "./useColor";
import useDebounce from "./useDebounce";
import useDisclosure from "./useDisclosure";
import useEscape from "./useEscape";
@@ -7,11 +6,9 @@ import useInterval from "./useInterval";
import useKeyboardShortcuts from "./useKeyboardShortcuts";
import useLocalStorage from "./useLocalStorage";
import useMount from "./useMount";
-import useNotification from "./useNotification";
import useOutsideClick from "./useOutsideClick";
export {
- useColor,
useDebounce,
useDisclosure,
useEscape,
@@ -20,6 +17,5 @@ export {
useKeyboardShortcuts,
useLocalStorage,
useMount,
- useNotification,
useOutsideClick,
};
diff --git a/packages/react/src/hooks/useColor.tsx b/packages/react/src/hooks/useColor.tsx
deleted file mode 100644
index 3432b64f93..0000000000
--- a/packages/react/src/hooks/useColor.tsx
+++ /dev/null
@@ -1,30 +0,0 @@
-import { useColorModeValue } from "@chakra-ui/react";
-
-const darkModeColor = {
- white: "black",
- black: "white",
- "gray.50": "whiteAlpha.100",
- "gray.100": "gray.900",
- "gray.200": "gray.800",
- "gray.300": "gray.700",
- "gray.400": "whiteAlpha.400",
- "gray.500": "gray.500",
- "gray.600": "gray.400",
- "gray.700": "gray.300",
- "gray.800": "gray.200",
- "gray.900": "gray.100",
- "var(--chakra-colors-zinc-50)": "var(--chakra-colors-whiteAlpha-100)",
- "var(--chakra-colors-zinc-100)": "var(--chakra-colors-zinc-900)",
- "var(--chakra-colors-zinc-200)": "var(--chakra-colors-zinc-800)",
- "var(--chakra-colors-zinc-300)": "var(--chakra-colors-zinc-700)",
- "var(--chakra-colors-zinc-400)": "var(--chakra-colors-zinc-600)",
- "var(--chakra-colors-zinc-500)": "var(--chakra-colors-zinc-500)",
- "var(--chakra-colors-zinc-600)": "var(--chakra-colors-zinc-400)",
- "var(--chakra-colors-zinc-700)": "var(--chakra-colors-zinc-300)",
- "var(--chakra-colors-zinc-800)": "var(--chakra-colors-zinc-200)",
- "var(--chakra-colors-zinc-900)": "var(--chakra-colors-zinc-100)",
-};
-
-export default function useColor(color: keyof typeof darkModeColor) {
- return useColorModeValue(color, darkModeColor[color]);
-}
diff --git a/packages/react/src/hooks/useNotification.tsx b/packages/react/src/hooks/useNotification.tsx
deleted file mode 100644
index 3081fe4110..0000000000
--- a/packages/react/src/hooks/useNotification.tsx
+++ /dev/null
@@ -1,158 +0,0 @@
-import type { UseToastOptions } from "@chakra-ui/react";
-import {
- Alert,
- AlertDescription,
- AlertIcon,
- AlertTitle,
- chakra,
- useClipboard,
- useColorModeValue,
- useToast,
-} from "@chakra-ui/react";
-import { useMemo } from "react";
-import { ClientOnly } from "~/ClientOnly";
-
-const defaultOptions: UseToastOptions = {
- isClosable: true,
- position: "bottom-right",
-};
-
-export default function useNotification() {
- const toast = useToast();
- const variant = useColorModeValue("left-accent", "solid");
-
- const notify = useMemo(
- () => ({
- success: (message: string = "Success", options: UseToastOptions = {}) => {
- toast({
- ...defaultOptions,
- title: message,
- status: "success",
- variant,
- ...options,
- });
- },
-
- error: (message: string = "Error", options: UseToastOptions = {}) => {
- toast({
- ...defaultOptions,
- title: message,
- status: "error",
- variant,
- ...options,
- });
- },
-
- warning: (message: string = "Warning", options: UseToastOptions = {}) => {
- toast({
- ...defaultOptions,
- title: message,
- status: "warning",
- variant,
- ...options,
- });
- },
-
- info: (message: string = "Info", options: UseToastOptions = {}) => {
- toast({
- ...defaultOptions,
- title: message,
- status: "info",
- variant,
- ...options,
- });
- },
-
- copyableError: (
- error: any,
- message: string = "Error",
- context: Record<string, unknown> = {},
- options: UseToastOptions = {}
- ) => {
- toast({
- ...defaultOptions,
- render: (/*props: RenderProps*/) => {
- return (
- // do we need a ClientOnly component here?
- <ClientOnly
- fallback={<FakeCopyableErrorMessage message={message} />}
- >
- {() => (
- <CopyableErrorMessage
- message={message}
- errorMessage={JSON.stringify({ error, context })}
- />
- )}
- </ClientOnly>
- );
- },
- variant,
- ...options,
- });
- },
- }),
- [toast, variant]
- );
-
- return notify;
-}
-
-const FakeCopyableErrorMessage = ({ message }: { message: string }) => {
- return (
- <Alert
- addRole={false}
- status="error"
- variant={defaultOptions.variant}
- alignItems="start"
- borderRadius="md"
- boxShadow="lg"
- paddingEnd={8}
- textAlign="start"
- width="auto"
- >
- <AlertIcon />
- <chakra.div flex="1" maxWidth="100%">
- <AlertTitle>Error</AlertTitle>
- {message && (
- <AlertDescription display="block">{message}</AlertDescription>
- )}
- </chakra.div>
- </Alert>
- );
-};
-
-const CopyableErrorMessage = ({
- message,
- errorMessage,
-}: {
- message: string;
- errorMessage: string;
-}) => {
- const { hasCopied, onCopy } = useClipboard(errorMessage);
-
- return (
- <Alert
- addRole={false}
- onClick={onCopy}
- status="error"
- variant={defaultOptions.variant}
- alignItems="start"
- borderRadius="md"
- boxShadow="lg"
- cursor="pointer"
- paddingEnd={8}
- textAlign="start"
- width="auto"
- >
- <AlertIcon />
- <chakra.div flex="1" maxWidth="100%">
- <AlertTitle>Error</AlertTitle>
- {message && (
- <AlertDescription display="block">
- {hasCopied ? "Copied to Clipboard" : message}
- </AlertDescription>
- )}
- </chakra.div>
- </Alert>
- );
-};
diff --git a/packages/react/src/hooks/useOutsideClick.ts b/packages/react/src/hooks/useOutsideClick.ts
index b281fe2c63..2c730ba759 100644
--- a/packages/react/src/hooks/useOutsideClick.ts
+++ b/packages/react/src/hooks/useOutsideClick.ts
@@ -1,28 +1,17 @@
-// from @chakra-ui/react
import { useEffect, useRef } from "react";
import useCallbackRef from "./useCallbackRef";
-export interface UseOutsideClickProps {
- /**
- * Whether the hook is enabled
- */
+export interface Props {
enabled?: boolean;
- /**
- * The reference to a DOM element.
- */
ref: React.RefObject<HTMLElement>;
- /**
- * Function invoked when a click is triggered outside the referenced element.
- */
handler?: (e: Event) => void;
}
-/**
- * Example, used in components like Dialogs and Popovers, so they can close
- * when a user clicks outside them.
- */
-export default function useOutsideClick(props: UseOutsideClickProps) {
- const { ref, handler, enabled = true } = props;
+export default function useOutsideClick({
+ ref,
+ handler,
+ enabled = true,
+}: Props) {
const savedHandler = useCallbackRef(handler);
const stateRef = useRef({
diff --git a/packages/react/src/index.tsx b/packages/react/src/index.tsx
index c238bc02fb..16e95ab251 100644
--- a/packages/react/src/index.tsx
+++ b/packages/react/src/index.tsx
@@ -1,4 +1,5 @@
import { ActionMenu } from "./ActionMenu";
+import { Alert, AlertDescription, AlertTitle } from "./Alert";
import type { AvatarProps } from "./Avatar";
import {
Avatar,
@@ -6,12 +7,16 @@ import {
AvatarGroupList,
AvatarOverflowIndicator,
} from "./Avatar";
-import { Badge } from "./Badge";
+import { Badge, BadgeCloseButton } from "./Badge";
import type { ButtonProps } from "./Button";
import { Button } from "./Button";
import {
Card,
CardAction,
+ CardAttribute,
+ CardAttributeLabel,
+ CardAttributeValue,
+ CardAttributes,
CardContent,
CardDescription,
CardFooter,
@@ -111,7 +116,6 @@ import {
InputRightElement,
} from "./Input";
import { Kbd } from "./Kbd";
-import { Loading } from "./Loading";
import {
Menu,
MenuCheckboxItem,
@@ -126,7 +130,7 @@ import {
MenuSub,
MenuSubContent,
} from "./Menu";
-import { Menubar, MenubarItem, MenubarTrigger } from "./Menubar";
+import { Menubar, MenubarItem } from "./Menubar";
import {
Modal,
ModalBody,
@@ -156,6 +160,7 @@ import {
PopoverHeader,
PopoverTrigger,
} from "./Popover";
+import { Progress } from "./Progress";
import { RadioGroup, RadioGroupItem } from "./Radio";
import {
Select,
@@ -169,13 +174,14 @@ import {
SelectTrigger,
SelectValue,
} from "./Select";
+import { Spinner } from "./Spinner";
import { Status } from "./Status";
import { Switch } from "./Switch";
import { Table, TableCaption, Tbody, Td, Tfoot, Th, Thead, Tr } from "./Table";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "./Tabs";
import type { TextareaProps } from "./Textarea";
import { Textarea } from "./Textarea";
-import ThemeProvider, { theme } from "./Theme";
+import { Toaster, toast } from "./Toast";
import {
Tooltip,
TooltipContent,
@@ -184,7 +190,6 @@ import {
} from "./Tooltip";
import { VStack } from "./VStack";
import {
- useColor,
useDebounce,
useDisclosure,
useEscape,
@@ -192,7 +197,6 @@ import {
useInterval,
useKeyboardShortcuts,
useMount,
- useNotification,
useOutsideClick,
} from "./hooks";
import { cn } from "./utils/cn";
@@ -200,14 +204,22 @@ import { getValidChildren } from "./utils/react";
export {
ActionMenu,
+ Alert,
+ AlertDescription,
+ AlertTitle,
Avatar,
AvatarGroup,
AvatarGroupList,
AvatarOverflowIndicator,
Badge,
+ BadgeCloseButton,
Button,
Card,
CardAction,
+ CardAttribute,
+ CardAttributeLabel,
+ CardAttributeValue,
+ CardAttributes,
CardContent,
CardDescription,
CardFooter,
@@ -292,7 +304,6 @@ export {
InputRightAddon,
InputRightElement,
Kbd,
- Loading,
Menu,
MenuCheckboxItem,
MenuGroup,
@@ -307,7 +318,6 @@ export {
MenuSubContent,
Menubar,
MenubarItem,
- MenubarTrigger,
Modal,
ModalBody,
ModalClose,
@@ -330,6 +340,7 @@ export {
PopoverFooter,
PopoverHeader,
PopoverTrigger,
+ Progress,
RadioGroup,
RadioGroupItem,
Select,
@@ -342,6 +353,7 @@ export {
SelectSeparator,
SelectTrigger,
SelectValue,
+ Spinner,
Status,
Switch,
Table,
@@ -356,8 +368,8 @@ export {
Tfoot,
Th,
Thead,
- ThemeProvider,
TimePicker,
+ Toaster,
Tooltip,
TooltipContent,
TooltipProvider,
@@ -367,8 +379,7 @@ export {
cn,
getValidChildren,
multiSelectTriggerVariants,
- theme,
- useColor,
+ toast,
useDebounce,
useDisclosure,
useEditor,
@@ -377,7 +388,6 @@ export {
useInterval,
useKeyboardShortcuts,
useMount,
- useNotification,
useOutsideClick,
};
export type {
diff --git a/packages/tailwind/tailwind.config.js b/packages/tailwind/tailwind.config.js
index 1c523cb33b..1ce7b35d71 100644
--- a/packages/tailwind/tailwind.config.js
+++ b/packages/tailwind/tailwind.config.js
@@ -58,8 +58,8 @@ module.exports = {
sm: "calc(var(--radius) - 4px)",
},
fontFamily: {
- sans: ["var(--font-geist-sans)", ...fontFamily.sans],
- mono: ["var(--font-mono)", ...fontFamily.mono],
+ sans: ["Inter", ...fontFamily.sans],
+ mono: ["Roboto Mono", ...fontFamily.mono],
},
keyframes: {
"accordion-down": {