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(react): replace the compact: variant and useCompact/useIsMobile with max-md: and useViewport; drop the data-compact-ui gate

aashu5c51803534f2
diff --git a/apps/erp/app/components/ChangelogPanel.tsx b/apps/erp/app/components/ChangelogPanel.tsx
index 701c4f8c6b..7b2a4c6f0e 100644
--- a/apps/erp/app/components/ChangelogPanel.tsx
+++ b/apps/erp/app/components/ChangelogPanel.tsx
@@ -34,7 +34,7 @@ export default function ChangelogPanel({
animate={{ opacity: 1, y: 0, scale: 1, filter: "blur(0px)" }}
exit={{ opacity: 0, y: 10, scale: 0.95, filter: "blur(4px)" }}
transition={{ duration: 0.3, ease: "easeOut" }}
- className="fixed bottom-4 right-4 w-[calc(100vw-2rem)] max-w-[380px] rounded-lg border bg-background shadow-lg z-40 overflow-hidden compact:inset-0 compact:z-[60] compact:w-full compact:max-w-none compact:overflow-y-auto compact:rounded-none compact:border-0 compact:pt-safe compact:pb-safe"
+ className="fixed bottom-4 right-4 w-[calc(100vw-2rem)] max-w-[380px] rounded-lg border bg-background shadow-lg z-40 overflow-hidden max-md:inset-0 max-md:z-[60] max-md:w-full max-md:max-w-none max-md:overflow-y-auto max-md:rounded-none max-md:border-0 max-md:pt-safe max-md:pb-safe"
>
<div className="px-4 pt-4 pb-3 space-y-2">
<div className="flex items-center justify-between">
diff --git a/apps/erp/app/components/Contact.tsx b/apps/erp/app/components/Contact.tsx
index 6f464db831..acefcf5324 100644
--- a/apps/erp/app/components/Contact.tsx
+++ b/apps/erp/app/components/Contact.tsx
@@ -51,12 +51,12 @@ const Contact = ({ contact, url, user, actions }: ContactProps) => {
{url ? (
<Link
to={url}
- className="compact:relative compact:after:absolute compact:after:-inset-y-3 compact:after:inset-x-0"
+ className="max-md:relative max-md:after:absolute max-md:after:-inset-y-3 max-md:after:inset-x-0"
>
- <p className="text-sm font-bold compact:font-semibold">{name}</p>
+ <p className="text-sm font-bold max-md:font-semibold">{name}</p>
</Link>
) : (
- <p className="text-sm font-bold compact:font-semibold">{name}</p>
+ <p className="text-sm font-bold max-md:font-semibold">{name}</p>
)}
{userStatus === UserStatus.Active && (
diff --git a/apps/erp/app/components/DateSelect.tsx b/apps/erp/app/components/DateSelect.tsx
index 0101e584d2..8bd745783a 100644
--- a/apps/erp/app/components/DateSelect.tsx
+++ b/apps/erp/app/components/DateSelect.tsx
@@ -86,7 +86,7 @@ const DateSelect = forwardRef<HTMLDivElement, DateSelectProps>(
hideIcon
className={cn(
"md:hidden w-auto h-8 text-xs",
- "compact:relative compact:h-8 compact:rounded-full compact:space-x-1 compact:text-sm compact:after:absolute compact:after:-inset-[max(0px,calc((44px-100%)/2))]"
+ "max-md:relative max-md:h-8 max-md:rounded-full max-md:space-x-1 max-md:text-sm max-md:after:absolute max-md:after:-inset-[max(0px,calc((44px-100%)/2))]"
)}
>
<SelectValue />
diff --git a/apps/erp/app/components/DefaultAttachmentsPanel.tsx b/apps/erp/app/components/DefaultAttachmentsPanel.tsx
index 5569341f19..c72c077e88 100644
--- a/apps/erp/app/components/DefaultAttachmentsPanel.tsx
+++ b/apps/erp/app/components/DefaultAttachmentsPanel.tsx
@@ -150,7 +150,7 @@ export default function DefaultAttachmentsPanel({
</CardHeader>
<CardContent>
<Table className="w-full table-fixed">
- <Thead className={cn(files.length === 0 && "compact:hidden")}>
+ <Thead className={cn(files.length === 0 && "max-md:hidden")}>
<Tr>
<Th className="w-auto">
<Trans>Name</Trans>
diff --git a/apps/erp/app/components/DocumentHeader.tsx b/apps/erp/app/components/DocumentHeader.tsx
index 99d1fc1c6a..332f92f531 100644
--- a/apps/erp/app/components/DocumentHeader.tsx
+++ b/apps/erp/app/components/DocumentHeader.tsx
@@ -57,7 +57,7 @@ const DocumentHeader = ({
<RecordPhoneChrome menu={menuItems} copyValue={copyValue} />
<CardHeader
className={cn(
- "flex-row items-center justify-between compact:hidden",
+ "flex-row items-center justify-between max-md:hidden",
className
)}
>
diff --git a/apps/erp/app/components/DocumentLineEditor/DocumentLineRow.tsx b/apps/erp/app/components/DocumentLineEditor/DocumentLineRow.tsx
index 9d77f5c32a..9c47dd313a 100644
--- a/apps/erp/app/components/DocumentLineEditor/DocumentLineRow.tsx
+++ b/apps/erp/app/components/DocumentLineEditor/DocumentLineRow.tsx
@@ -137,7 +137,7 @@ const DocumentLineRow = ({
variant="ghost"
onClick={onDelete}
isDisabled={!canDelete}
- className="size-8 p-0 text-muted-foreground opacity-0 transition-opacity hover:text-destructive group-hover:opacity-100 disabled:opacity-0 compact:opacity-100"
+ className="size-8 p-0 text-muted-foreground opacity-0 transition-opacity hover:text-destructive group-hover:opacity-100 disabled:opacity-0 max-md:opacity-100"
/>
)}
</div>
diff --git a/apps/erp/app/components/DocumentTemplateEditor/BlockList.tsx b/apps/erp/app/components/DocumentTemplateEditor/BlockList.tsx
index 1912f3b28c..cf310ac58b 100644
--- a/apps/erp/app/components/DocumentTemplateEditor/BlockList.tsx
+++ b/apps/erp/app/components/DocumentTemplateEditor/BlockList.tsx
@@ -370,7 +370,7 @@ function BlockRow({ id }: { id: string }) {
>
{/* Type icon normally; grip on hover to signal draggability. */}
<span className="group-hover:opacity-0">{blockIcon(block.type)}</span>
- <span className="absolute inset-0 opacity-0 group-hover:opacity-100 compact:opacity-100">
+ <span className="absolute inset-0 opacity-0 group-hover:opacity-100 max-md:opacity-100">
<LuGripVertical className="size-4" />
</span>
</button>
@@ -398,7 +398,7 @@ function BlockRow({ id }: { id: string }) {
e.stopPropagation();
removeBlock(id);
}}
- className="rounded p-1 text-muted-foreground opacity-0 transition-[opacity,color] hover:text-destructive group-hover:opacity-100 compact:opacity-100"
+ className="rounded p-1 text-muted-foreground opacity-0 transition-[opacity,color] hover:text-destructive group-hover:opacity-100 max-md:opacity-100"
>
<LuTrash2 className="size-4" />
</button>
@@ -487,7 +487,7 @@ function NestedBlockRow({ id }: { id: string }) {
e.stopPropagation();
removeBlock(id);
}}
- className="rounded p-1 text-muted-foreground opacity-0 transition-[opacity,color] hover:text-destructive group-hover:opacity-100 compact:opacity-100"
+ className="rounded p-1 text-muted-foreground opacity-0 transition-[opacity,color] hover:text-destructive group-hover:opacity-100 max-md:opacity-100"
>
<LuTrash2 className="size-4" />
</button>
diff --git a/apps/erp/app/components/DocumentTemplateEditor/index.tsx b/apps/erp/app/components/DocumentTemplateEditor/index.tsx
index 73bf1f7b62..495011eb35 100644
--- a/apps/erp/app/components/DocumentTemplateEditor/index.tsx
+++ b/apps/erp/app/components/DocumentTemplateEditor/index.tsx
@@ -29,7 +29,7 @@ import {
TabsContent,
TabsList,
TabsTrigger,
- useCompact
+ useViewport
} from "@carbon/react";
import { labelSizes } from "@carbon/utils";
import { Trans, useLingui } from "@lingui/react/macro";
@@ -99,7 +99,7 @@ export function DocumentTemplateEditor({
hasWatermark={hasWatermark}
initialLabelSizeId={initialLabelSizeId}
>
- <div className="flex h-full w-full min-w-0 flex-col bg-background compact:h-[calc(100dvh-var(--topbar-height)-var(--content-inset,0px))]">
+ <div className="flex h-full w-full min-w-0 flex-col bg-background max-md:h-[calc(100dvh-var(--topbar-height)-var(--content-inset,0px))]">
<EditorToolbar
title={getDocumentLabel(documentType)}
canEdit={canEdit}
@@ -116,8 +116,8 @@ export function DocumentTemplateEditor({
* behind an underline tab row (the record-tabs pattern).
*/
function EditorPanes({ actionPath }: { actionPath: string }) {
- const isCompact = useCompact();
- if (isCompact) return <CompactEditorPanes actionPath={actionPath} />;
+ const { isPhone } = useViewport();
+ if (isPhone) return <CompactEditorPanes actionPath={actionPath} />;
return (
<ResizablePanelGroup
@@ -385,12 +385,12 @@ function EditorToolbar({
const refreshPreview = useEditorStore((s) => s.refreshPreview);
return (
- <div className="flex items-center justify-between gap-3 border-b bg-card px-4 py-3 compact:flex-wrap compact:gap-2">
+ <div className="flex items-center justify-between gap-3 border-b bg-card px-4 py-3 max-md:flex-wrap max-md:gap-2">
<div className="flex items-center gap-3">
<Link
to={path.to.documentTemplates}
aria-label="Back to documents"
- className="flex size-8 items-center justify-center rounded-md border text-muted-foreground transition-colors hover:bg-muted hover:text-foreground compact:hidden"
+ className="flex size-8 items-center justify-center rounded-md border text-muted-foreground transition-colors hover:bg-muted hover:text-foreground max-md:hidden"
>
<LuArrowLeft className="size-4" />
</Link>
@@ -400,7 +400,7 @@ function EditorToolbar({
</div>
</div>
{previewEntities.length > 0 && (
- <div className="flex min-w-0 max-w-[280px] flex-1 flex-col items-center gap-0.5 self-end compact:order-last compact:basis-full compact:max-w-none compact:items-stretch compact:self-auto">
+ <div className="flex min-w-0 max-w-[280px] flex-1 flex-col items-center gap-0.5 self-end max-md:order-last max-md:basis-full max-md:max-w-none max-md:items-stretch max-md:self-auto">
<Subheading variant="heavy">Preview data</Subheading>
<Select
value={previewId ?? SAMPLE_DATA_VALUE}
@@ -422,7 +422,7 @@ function EditorToolbar({
</Select>
</div>
)}
- <div className="flex items-end gap-2 compact:ml-auto">
+ <div className="flex items-end gap-2 max-md:ml-auto">
<LabelSizePicker />
{canEdit && (
<>
diff --git a/apps/erp/app/components/EditableNumberCell.tsx b/apps/erp/app/components/EditableNumberCell.tsx
index da5d9cdbb0..06d2c9894e 100644
--- a/apps/erp/app/components/EditableNumberCell.tsx
+++ b/apps/erp/app/components/EditableNumberCell.tsx
@@ -72,7 +72,7 @@ function EditableNumberCell({
className="group/edit flex w-full cursor-pointer items-center gap-1.5 text-left text-sm"
>
<span>{display}</span>
- <LuPencil className="size-3 shrink-0 text-muted-foreground opacity-0 transition-opacity group-hover/edit:opacity-100 compact:opacity-100" />
+ <LuPencil className="size-3 shrink-0 text-muted-foreground opacity-0 transition-opacity group-hover/edit:opacity-100 max-md:opacity-100" />
</button>
);
}
diff --git a/apps/erp/app/components/Empty.tsx b/apps/erp/app/components/Empty.tsx
index a1c48c6647..d89f698fe3 100644
--- a/apps/erp/app/components/Empty.tsx
+++ b/apps/erp/app/components/Empty.tsx
@@ -17,8 +17,8 @@ export default function Empty({
className={cn("w-full h-full justify-center items-center", className)}
{...props}
>
- <LuCircleDashed className="size-8 text-muted-foreground compact:size-[52px] compact:rounded-[14px] compact:bg-muted compact:p-3.5" />
- <h3 className="text-xs text-muted-foreground compact:mt-1 compact:text-[17px] compact:font-semibold compact:text-foreground">
+ <LuCircleDashed className="size-8 text-muted-foreground max-md:size-[52px] max-md:rounded-[14px] max-md:bg-muted max-md:p-3.5" />
+ <h3 className="text-xs text-muted-foreground max-md:mt-1 max-md:text-[17px] max-md:font-semibold max-md:text-foreground">
<Trans>Looks empty here</Trans>&nbsp;&nbsp;👀
</h3>
{children}
diff --git a/apps/erp/app/components/FileDropzone.tsx b/apps/erp/app/components/FileDropzone.tsx
index ed2f991b39..2d3152bedc 100644
--- a/apps/erp/app/components/FileDropzone.tsx
+++ b/apps/erp/app/components/FileDropzone.tsx
@@ -9,7 +9,7 @@ import {
isHeic,
MediaUploader
} from "@carbon/files/media";
-import { Button, cn, toast, useCompact } from "@carbon/react";
+import { Button, cn, toast, useViewport } from "@carbon/react";
import { Trans, useLingui } from "@lingui/react/macro";
import type React from "react";
import { useState } from "react";
@@ -35,7 +35,7 @@ const FileDropzone: React.FC<FileDropzoneProps> = ({
className = "mt-4"
}) => {
const { t } = useLingui();
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
const { carbon } = useCarbon();
const { company } = useUser();
const [isConverting, setIsConverting] = useState(false);
@@ -74,7 +74,7 @@ const FileDropzone: React.FC<FileDropzoneProps> = ({
});
// Phones cannot drag files in: one Upload button opens the same picker.
- if (isCompact) {
+ if (isPhone) {
return (
<div className={className}>
<input {...getInputProps()} />
diff --git a/apps/erp/app/components/Form/AddressAutocomplete.tsx b/apps/erp/app/components/Form/AddressAutocomplete.tsx
index d22713c464..5385c23489 100644
--- a/apps/erp/app/components/Form/AddressAutocomplete.tsx
+++ b/apps/erp/app/components/Form/AddressAutocomplete.tsx
@@ -176,7 +176,7 @@ const AddressAutocomplete = ({
className="bg-transparent"
/>
{open && suggestions.length > 0 && (
- <CommandList className="absolute w-full top-10 compact:top-11 z-[9999] rounded-md border bg-popover text-popover-foreground shadow-md p-0">
+ <CommandList className="absolute w-full top-10 max-md:top-11 z-[9999] rounded-md border bg-popover text-popover-foreground shadow-md p-0">
<CommandEmpty>
{loading ? t`Loading...` : t`No addresses found`}
</CommandEmpty>
diff --git a/apps/erp/app/components/Form/EmailRecipients.tsx b/apps/erp/app/components/Form/EmailRecipients.tsx
index 71d60103f0..bebc130503 100644
--- a/apps/erp/app/components/Form/EmailRecipients.tsx
+++ b/apps/erp/app/components/Form/EmailRecipients.tsx
@@ -252,7 +252,7 @@ export default function EmailRecipients({
<PopoverTrigger asChild>
<div
className={cn(
- "flex flex-wrap gap-1 min-h-10 w-full rounded-md border bg-transparent px-3 py-2 text-sm ring-offset-background focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2 cursor-text compact:min-h-11 compact:text-base",
+ "flex flex-wrap gap-1 min-h-10 w-full rounded-md border bg-transparent px-3 py-2 text-sm ring-offset-background focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2 cursor-text max-md:min-h-11 max-md:text-base",
inputError ? "border-destructive" : "border-input"
)}
onClick={(e) => {
@@ -300,7 +300,7 @@ export default function EmailRecipients({
placeholder={
emails.length === 0 ? "Search or enter email..." : ""
}
- className="flex-1 min-w-[120px] bg-transparent outline-none placeholder:text-muted-foreground compact:text-base"
+ className="flex-1 min-w-[120px] bg-transparent outline-none placeholder:text-muted-foreground max-md:text-base"
/>
</div>
</PopoverTrigger>
diff --git a/apps/erp/app/components/Form/SequenceOrCustomId.tsx b/apps/erp/app/components/Form/SequenceOrCustomId.tsx
index 613f236c95..bf477f88f4 100644
--- a/apps/erp/app/components/Form/SequenceOrCustomId.tsx
+++ b/apps/erp/app/components/Form/SequenceOrCustomId.tsx
@@ -79,7 +79,7 @@ const SequenceOrCustomId = forwardRef<
<Button
size="md"
variant="outline"
- className="flex-grow bg-transparent text-muted-foreground justify-start pr-4 h-10 w-full hover:scale-100 focus-visible:scale-100 compact:h-11 compact:text-base"
+ className="flex-grow bg-transparent text-muted-foreground justify-start pr-4 h-10 w-full hover:scale-100 focus-visible:scale-100 max-md:h-11 max-md:text-base"
>
{placeholder}
</Button>
@@ -89,7 +89,7 @@ const SequenceOrCustomId = forwardRef<
className={cn(
"bg-card absolute right-0 top-0",
"flex-shrink-0 h-10 w-10 px-3 rounded-l-none before:rounded-l-none border-none -ml-px shadow-button-base",
- "compact:h-11 compact:w-11"
+ "max-md:h-11 max-md:w-11"
)}
icon={isCustom ? <LuToggleLeft /> : <LuToggleRight />}
variant="secondary"
diff --git a/apps/erp/app/components/Gantt/Gantt.tsx b/apps/erp/app/components/Gantt/Gantt.tsx
index 4af1eb23b1..040ed2a645 100644
--- a/apps/erp/app/components/Gantt/Gantt.tsx
+++ b/apps/erp/app/components/Gantt/Gantt.tsx
@@ -25,9 +25,9 @@ import {
Tooltip,
TooltipContent,
TooltipTrigger,
- useCompact,
useDebounce,
- useShortcutKeys
+ useShortcutKeys,
+ useViewport
} from "@carbon/react";
import { formatDurationMilliseconds, lerp } from "@carbon/utils";
import { Trans, useLingui } from "@lingui/react/macro";
@@ -172,7 +172,7 @@ const Gantt = ({
axisTickMs
}: GanttProps) => {
const { t } = useLingui();
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
const [filterText, setFilterText] = useState("");
const [wipOnly, setWipOnly] = useState(false);
const [showDurations, setShowDurations] = useState(false);
@@ -304,8 +304,8 @@ const Gantt = ({
</div>
</div>
- <div className="flex w-full items-center justify-between gap-2 pl-1 compact:min-w-0">
- <div className="flex items-center gap-2 overflow-x-hidden compact:min-w-0">
+ <div className="flex w-full items-center justify-between gap-2 pl-1 max-md:min-w-0">
+ <div className="flex items-center gap-2 overflow-x-hidden max-md:min-w-0">
<GanttIcon
name={node.data.style?.icon}
className="size-4 min-h-4 min-w-4"
@@ -319,7 +319,7 @@ const Gantt = ({
</div>
<div className="flex items-center gap-1">
{renderNodeAside?.(node)}
- <span className="contents compact:hidden">
+ <span className="contents max-md:hidden">
<NodeStatusIcon node={node} />
</span>
</div>
@@ -363,10 +363,10 @@ const Gantt = ({
);
return (
- <div className="grid h-full grid-rows-[2.5rem_1fr_3.25rem] overflow-hidden compact:grid-cols-[minmax(0,1fr)]">
- <div className="flex items-center justify-between gap-2 border-b border-border compact:overflow-x-auto compact:scroll-fade-x">
+ <div className="grid h-full grid-rows-[2.5rem_1fr_3.25rem] overflow-hidden max-md:grid-cols-[minmax(0,1fr)]">
+ <div className="flex items-center justify-between gap-2 border-b border-border max-md:overflow-x-auto max-md:scroll-fade-x">
<SearchField onChange={setFilterText} />
- <div className="flex items-center gap-3 pr-2 compact:shrink-0">
+ <div className="flex items-center gap-3 pr-2 max-md:shrink-0">
{toolbarAccessory}
<Switch
variant="small"
@@ -375,7 +375,7 @@ const Gantt = ({
onCheckedChange={(e) => setWipOnly(e.valueOf())}
/>
{/* Phones have no hover, so their bars always show durations. */}
- {!isCompact && (
+ {!isPhone && (
<Switch
variant="small"
label={t`Show Durations`}
@@ -388,7 +388,7 @@ const Gantt = ({
<div ref={panelGroupRef} className="h-full w-full min-h-0">
{/* Phones: a fixed tree column beside the timeline, which keeps its
own sideways scroll. */}
- {isCompact && (
+ {isPhone && (
<div className="flex h-full w-full">
<div className="h-full w-[118px] shrink-0 overflow-hidden border-r border-border pl-3">
{treePanel}
@@ -396,7 +396,7 @@ const Gantt = ({
<div className="h-full min-w-0 flex-1">{timelinePanel}</div>
</div>
)}
- {!isCompact && treeDefaultSize !== undefined && (
+ {!isPhone && treeDefaultSize !== undefined && (
<ResizablePanelGroup
direction="horizontal"
onLayout={(layout) => {
@@ -435,7 +435,7 @@ const Gantt = ({
setShowDurations={setShowDurations}
/>
</div>
- <div className="@[42rem]:hidden compact:hidden">
+ <div className="@[42rem]:hidden max-md:hidden">
<Popover>
<PopoverTrigger className="text-sm">
<Trans>Shortcuts</Trans>
@@ -670,9 +670,9 @@ const GanttTimeline = ({
// Phones drop the edge labels: ticks are too close
// for them not to collide with their neighbours.
tickMs <= 0
- ? "ml-1 compact:hidden"
+ ? "ml-1 max-md:hidden"
: tickMs >= duration * 0.98
- ? "-ml-1 -translate-x-full compact:hidden"
+ ? "-ml-1 -translate-x-full max-md:hidden"
: "-translate-x-1/2"
)}
>
@@ -698,9 +698,9 @@ const GanttTimeline = ({
className={cn(
"whitespace-nowrap",
index === 0
- ? "ml-1 compact:hidden"
+ ? "ml-1 max-md:hidden"
: index === TICK_COUNT - 1
- ? "-ml-1 -translate-x-full compact:hidden"
+ ? "-ml-1 -translate-x-full max-md:hidden"
: "-translate-x-1/2"
)}
>
@@ -952,7 +952,7 @@ const GanttTimeline = ({
};
function NodeText({ node }: { node: GanttEvent }) {
- const className = "line-clamp-1 compact:min-w-0";
+ const className = "line-clamp-1 max-md:min-w-0";
return (
<Paragraph variant="small" className={cn(className)}>
<SpanTitle {...node.data} size="small" />
@@ -1202,7 +1202,7 @@ function SpanWithDuration({
<div
className={cn(
"sticky left-0 z-10 transition group-hover:opacity-100",
- !showDuration && "opacity-0 compact:opacity-100"
+ !showDuration && "opacity-0 max-md:opacity-100"
)}
>
<div className="rounded-sm bg-black/40 px-1 py-0.5 text-xxs font-medium text-white tabular-nums">
@@ -1387,7 +1387,7 @@ function SearchField({ onChange }: { onChange: (value: string) => void }) {
return (
<InputGroup
insetRing
- className="border-transparent rounded-none ring-0 compact:min-w-[140px] compact:w-[160px] compact:shrink-0"
+ className="border-transparent rounded-none ring-0 max-md:min-w-[140px] max-md:w-[160px] max-md:shrink-0"
>
<InputLeftElement>
<LuSearch className="h-4 w-4 text-muted-foreground" />
diff --git a/apps/erp/app/components/Gantt/components/SpanTitle.tsx b/apps/erp/app/components/Gantt/components/SpanTitle.tsx
index 51e586389e..c11fbf32f1 100644
--- a/apps/erp/app/components/Gantt/components/SpanTitle.tsx
+++ b/apps/erp/app/components/Gantt/components/SpanTitle.tsx
@@ -24,7 +24,7 @@ export function SpanTitle(event: SpanTitleProps) {
eventTextClassName(event)
)}
>
- <span className="truncate compact:max-w-full">{event.message}</span>{" "}
+ <span className="truncate max-md:max-w-full">{event.message}</span>{" "}
<SpanAccessory accessory={event.style.accessory} size={event.size} />
</span>
);
@@ -55,7 +55,7 @@ function SpanAccessory({
}
default: {
return (
- <div className={cn("flex gap-1", "compact:min-w-0 compact:truncate")}>
+ <div className={cn("flex gap-1", "max-md:min-w-0 max-md:truncate")}>
{accessory.items.map((item, index) => (
<span key={index} className={cn("inline-flex items-center gap-1")}>
{item.text}
diff --git a/apps/erp/app/components/Grid/Grid.tsx b/apps/erp/app/components/Grid/Grid.tsx
index aa33be6cb5..9a7843e6b4 100644
--- a/apps/erp/app/components/Grid/Grid.tsx
+++ b/apps/erp/app/components/Grid/Grid.tsx
@@ -346,7 +346,7 @@ const Grid = <T extends object>({
<VStack spacing={0} className="h-full w-full">
<div
className={cn(
- "w-full h-full overflow-x-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent compact:scroll-fade-x",
+ "w-full h-full overflow-x-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent max-md:scroll-fade-x",
contained ? "" : "relative"
)}
ref={tableContainerRef}
diff --git a/apps/erp/app/components/Hyperlink.tsx b/apps/erp/app/components/Hyperlink.tsx
index a4d74a2945..0f6ac2e23f 100644
--- a/apps/erp/app/components/Hyperlink.tsx
+++ b/apps/erp/app/components/Hyperlink.tsx
@@ -23,13 +23,13 @@ const Hyperlink = ({
<span className="contents">
<PrefetchLink
className={cn(
- "group/hyperlink text-foreground font-medium cursor-pointer flex flex-row items-center justify-start gap-3 compact:min-w-0",
+ "group/hyperlink text-foreground font-medium cursor-pointer flex flex-row items-center justify-start gap-3 max-md:min-w-0",
className
)}
{...props}
>
{/* Phones: a block so long names end in an ellipsis (flex boxes clip). */}
- <span className="flex flex-row items-center gap-1 compact:block compact:min-w-0 compact:truncate">
+ <span className="flex flex-row items-center gap-1 max-md:block max-md:min-w-0 max-md:truncate">
{children}
</span>
{props.to && props.to !== "#" && (
@@ -40,7 +40,7 @@ const Hyperlink = ({
// click navigates in-tab, a Cmd/Ctrl (or middle) click opens a new tab.
// A real <button> here would otherwise swallow the anchor's native
// modifier-click behavior and always open in the same tab.
- className="flex-shrink-0 opacity-0 transition-opacity duration-200 group-hover/hyperlink:opacity-100 no-underline pointer-events-none compact:hidden compact:opacity-100"
+ className="flex-shrink-0 opacity-0 transition-opacity duration-200 group-hover/hyperlink:opacity-100 no-underline pointer-events-none max-md:hidden max-md:opacity-100"
size="sm"
tabIndex={-1}
>
diff --git a/apps/erp/app/components/Icons.tsx b/apps/erp/app/components/Icons.tsx
index ddac69cc49..cec6be411e 100644
--- a/apps/erp/app/components/Icons.tsx
+++ b/apps/erp/app/components/Icons.tsx
@@ -179,7 +179,7 @@ export function MethodBadge({ type, text, to, className }: MethodBadgeProps) {
<MethodIcon type={type} className="w-3 h-3 mr-1 " />
{text}
</Badge>
- <span className="group-hover:opacity-100 opacity-0 transition-opacity duration-200 w-4 h-4 text-foreground compact:opacity-100">
+ <span className="group-hover:opacity-100 opacity-0 transition-opacity duration-200 w-4 h-4 text-foreground max-md:opacity-100">
<LuExternalLink />
</span>
</PrefetchLink>
diff --git a/apps/erp/app/components/Layout/Mobile/ChromeSlots.tsx b/apps/erp/app/components/Layout/Mobile/ChromeSlots.tsx
index e5244f53be..c9c5bdc4ba 100644
--- a/apps/erp/app/components/Layout/Mobile/ChromeSlots.tsx
+++ b/apps/erp/app/components/Layout/Mobile/ChromeSlots.tsx
@@ -2,7 +2,7 @@
// Carbon (github.com/crbnos/carbon). Modified or adapted versions of this file,
// including ports, remain AGPLv3; serving them over a network requires releasing their source.
-import { useCompact } from "@carbon/react";
+import { useViewport } from "@carbon/react";
import type { ReactNode } from "react";
import { Children, useEffect, useState } from "react";
import { createPortalSlot } from "./slots";
@@ -46,9 +46,9 @@ export function useCompactCssVar(
name: "--header-height" | "--hero-height" | "--content-inset",
element: HTMLElement | null
) {
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
useEffect(() => {
- if (!isCompact || !element) return;
+ if (!isPhone || !element) return;
const root = document.documentElement;
const write = () =>
root.style.setProperty(
@@ -62,7 +62,7 @@ export function useCompactCssVar(
observer.disconnect();
root.style.removeProperty(name);
};
- }, [isCompact, element, name]);
+ }, [isPhone, element, name]);
}
/**
diff --git a/apps/erp/app/components/Layout/Mobile/slots.tsx b/apps/erp/app/components/Layout/Mobile/slots.tsx
index 2e617e5126..e7f79d117a 100644
--- a/apps/erp/app/components/Layout/Mobile/slots.tsx
+++ b/apps/erp/app/components/Layout/Mobile/slots.tsx
@@ -2,7 +2,7 @@
// Carbon (github.com/crbnos/carbon). Modified or adapted versions of this file,
// including ports, remain AGPLv3; serving them over a network requires releasing their source.
-import { useCompact } from "@carbon/react";
+import { useViewport } from "@carbon/react";
import type { ReactNode } from "react";
import { useEffect, useId, useRef, useState } from "react";
import { createPortal } from "react-dom";
@@ -43,17 +43,17 @@ export function createPortalSlot() {
}
function Fill({ children }: { children: ReactNode }) {
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
// After hydration only: the server renders no portals.
const [mounted, setMounted] = useState(false);
useEffect(() => setMounted(true), []);
const add = useCount((s) => s.add);
useEffect(() => {
- if (!isCompact) return;
+ if (!isPhone) return;
add(1);
return () => add(-1);
- }, [isCompact, add]);
- return isCompact && mounted ? createPortal(children, getElement()) : null;
+ }, [isPhone, add]);
+ return isPhone && mounted ? createPortal(children, getElement()) : null;
}
const useFilled = () => useCount((s) => s.count > 0);
diff --git a/apps/erp/app/components/Layout/Navigation/CollapsibleSidebar.tsx b/apps/erp/app/components/Layout/Navigation/CollapsibleSidebar.tsx
index 50513d3dfe..407fbed452 100644
--- a/apps/erp/app/components/Layout/Navigation/CollapsibleSidebar.tsx
+++ b/apps/erp/app/components/Layout/Navigation/CollapsibleSidebar.tsx
@@ -2,7 +2,7 @@
// Carbon (github.com/crbnos/carbon). Modified or adapted versions of this file,
// including ports, remain AGPLv3; serving them over a network requires releasing their source.
-import { cn, IconButton, useCompact } from "@carbon/react";
+import { cn, IconButton, useViewport } from "@carbon/react";
import { motion, useReducedMotion } from "motion/react";
import type { ComponentProps, PropsWithChildren } from "react";
import {
@@ -42,7 +42,7 @@ function CollapsibleSidebarProvider({
hasSidebar,
children
}: PropsWithChildren<{ hasSidebar: boolean }>) {
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
const isSidebarOpen = useUIStore((state) => state.isSidebarOpen);
const setSidebarOpen = useUIStore((state) => state.setSidebarOpen);
const toggleSidebar = useUIStore((state) => state.toggleSidebar);
@@ -51,10 +51,10 @@ function CollapsibleSidebarProvider({
// user's collapse.
const wasCompact = useRef(false);
useEffect(() => {
- if (isCompact) setSidebarOpen(false);
+ if (isPhone) setSidebarOpen(false);
else if (wasCompact.current) setSidebarOpen(true);
- wasCompact.current = isCompact;
- }, [isCompact, setSidebarOpen]);
+ wasCompact.current = isPhone;
+ }, [isPhone, setSidebarOpen]);
return (
<CollapsibleSidebarContext.Provider
@@ -228,7 +228,7 @@ const CollapsibleSidebar = ({
}: PropsWithChildren<{ width?: number }>) => {
const { isOpen } = useCollapsibleSidebar();
const shouldReduceMotion = useReducedMotion();
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
const variants = useMemo(() => {
return {
@@ -245,7 +245,7 @@ const CollapsibleSidebar = ({
// Compact: the app bar title opens the section switcher sheet instead.
// Keep the zero-width occupant of the layout grid's first track.
- if (isCompact) return <div aria-hidden className="w-0" />;
+ if (isPhone) return <div aria-hidden className="w-0" />;
return (
<motion.div
diff --git a/apps/erp/app/components/Layout/Navigation/DetailSidebar.tsx b/apps/erp/app/components/Layout/Navigation/DetailSidebar.tsx
index e89c59bc25..864012d820 100644
--- a/apps/erp/app/components/Layout/Navigation/DetailSidebar.tsx
+++ b/apps/erp/app/components/Layout/Navigation/DetailSidebar.tsx
@@ -12,8 +12,8 @@ import {
Tooltip,
TooltipContent,
TooltipTrigger,
- useCompact,
useShortcutKeyMap,
+ useViewport,
VStack
} from "@carbon/react";
import type { ReactNode } from "react";
@@ -50,8 +50,8 @@ const DetailSidebar = ({ links }: DetailSidebarProps) => {
// Phones: the same links as a sticky, horizontally scrolling underline
// tab row, as DetailsTopbar renders outside a record.
- const isCompact = useCompact();
- if (isCompact) {
+ const { isPhone } = useViewport();
+ if (isPhone) {
return (
<CompactTabRow
className="sticky top-0 z-10 mb-3 w-full px-0"
diff --git a/apps/erp/app/components/Layout/Navigation/DetailsTopbar.tsx b/apps/erp/app/components/Layout/Navigation/DetailsTopbar.tsx
index b5044dbe96..ce4b57be87 100644
--- a/apps/erp/app/components/Layout/Navigation/DetailsTopbar.tsx
+++ b/apps/erp/app/components/Layout/Navigation/DetailsTopbar.tsx
@@ -12,8 +12,8 @@ import {
Tooltip,
TooltipContent,
TooltipTrigger,
- useCompact,
- useShortcutKeyMap
+ useShortcutKeyMap,
+ useViewport
} from "@carbon/react";
import { useMemo } from "react";
import type { IconType } from "react-icons";
@@ -69,7 +69,7 @@ const DetailTopbar = ({
// Phones: inside a record frame the links join its one tab row; elsewhere
// they render here as a scrolling underline row.
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
const paramString = params.toString();
// `links` is a new array on every render: keyed on what the tabs show.
const itemsKey = links
@@ -94,10 +94,10 @@ const DetailTopbar = ({
})),
[itemsKey, preserveParams, paramString]
);
- recordTabsSlot.useProvide(isCompact ? items : null);
+ recordTabsSlot.useProvide(isPhone ? items : null);
const inRecordFrame = recordFrameSlot.useValue() !== null;
- if (isCompact) {
+ if (isPhone) {
return inRecordFrame ? null : (
<CompactTabRow className="w-full min-w-0 shrink" items={items} />
);
diff --git a/apps/erp/app/components/Layout/Navigation/GroupedContentSidebar.tsx b/apps/erp/app/components/Layout/Navigation/GroupedContentSidebar.tsx
index 03913019cf..1d3df6d683 100644
--- a/apps/erp/app/components/Layout/Navigation/GroupedContentSidebar.tsx
+++ b/apps/erp/app/components/Layout/Navigation/GroupedContentSidebar.tsx
@@ -340,7 +340,7 @@ const ViewsReorderGroup = ({
icon={<LuGripVertical />}
variant="ghost"
size="sm"
- className="flex-shrink-0 opacity-0 group-hover/view:opacity-100 absolute left-1 compact:opacity-100"
+ className="flex-shrink-0 opacity-0 group-hover/view:opacity-100 absolute left-1 max-md:opacity-100"
/>
<DropdownMenu>
<DropdownMenuTrigger asChild>
@@ -349,7 +349,7 @@ const ViewsReorderGroup = ({
icon={<LuEllipsisVertical />}
variant="ghost"
size="sm"
- className="absolute right-1 flex-shrink-0 opacity-0 group-hover/view:opacity-100 data-[state=open]:opacity-100 text-foreground/70 hover:text-foreground compact:opacity-100"
+ className="absolute right-1 flex-shrink-0 opacity-0 group-hover/view:opacity-100 data-[state=open]:opacity-100 text-foreground/70 hover:text-foreground max-md:opacity-100"
/>
</DropdownMenuTrigger>
<DropdownMenuContent>
diff --git a/apps/erp/app/components/Layout/Navigation/HiddenModulesPopover.tsx b/apps/erp/app/components/Layout/Navigation/HiddenModulesPopover.tsx
index 383e58c4e1..fbebd4482f 100644
--- a/apps/erp/app/components/Layout/Navigation/HiddenModulesPopover.tsx
+++ b/apps/erp/app/components/Layout/Navigation/HiddenModulesPopover.tsx
@@ -38,7 +38,7 @@ export function HiddenModulesPopover({
className={cn(
"min-w-[128px] text-sm",
"absolute left-7 group-data-[state=expanded]:left-12",
- "opacity-0 group-data-[state=expanded]:opacity-100 compact:opacity-100"
+ "opacity-0 group-data-[state=expanded]:opacity-100 max-md:opacity-100"
)}
>
Add module
diff --git a/apps/erp/app/components/Layout/Navigation/NavigationEditBar.tsx b/apps/erp/app/components/Layout/Navigation/NavigationEditBar.tsx
index 0f69e9d870..791569a5ca 100644
--- a/apps/erp/app/components/Layout/Navigation/NavigationEditBar.tsx
+++ b/apps/erp/app/components/Layout/Navigation/NavigationEditBar.tsx
@@ -22,7 +22,7 @@ export function NavigationEditBar({
<div
className={cn(
"flex gap-1 px-2",
- "opacity-0 group-data-[state=expanded]:opacity-100 compact:opacity-100",
+ "opacity-0 group-data-[state=expanded]:opacity-100 max-md:opacity-100",
"transition-opacity"
)}
>
diff --git a/apps/erp/app/components/Layout/Navigation/SortableNavItem.tsx b/apps/erp/app/components/Layout/Navigation/SortableNavItem.tsx
index 67acfae694..8241be3184 100644
--- a/apps/erp/app/components/Layout/Navigation/SortableNavItem.tsx
+++ b/apps/erp/app/components/Layout/Navigation/SortableNavItem.tsx
@@ -46,7 +46,7 @@ export function SortableNavItem({
<div
className={cn(
"absolute left-0 top-0 h-full flex items-center pl-1",
- "opacity-0 group-data-[state=expanded]:opacity-100 compact:opacity-100",
+ "opacity-0 group-data-[state=expanded]:opacity-100 max-md:opacity-100",
"cursor-grab active:cursor-grabbing"
)}
{...attributes}
@@ -63,7 +63,7 @@ export function SortableNavItem({
className={cn(
"min-w-[128px] text-sm",
"absolute left-12 group-data-[state=expanded]:left-16",
- "opacity-0 group-data-[state=expanded]:opacity-100 compact:opacity-100"
+ "opacity-0 group-data-[state=expanded]:opacity-100 max-md:opacity-100"
)}
>
{module.name}
@@ -75,7 +75,7 @@ export function SortableNavItem({
onClick={() => onToggleHidden(module.key)}
className={cn(
"absolute right-2 top-2.5 p-0.5 rounded",
- "opacity-0 group-data-[state=expanded]:opacity-100 compact:opacity-100",
+ "opacity-0 group-data-[state=expanded]:opacity-100 max-md:opacity-100",
"text-muted-foreground hover:text-foreground",
"transition-opacity"
)}
diff --git a/apps/erp/app/components/Layout/Panels.tsx b/apps/erp/app/components/Layout/Panels.tsx
index 89ebd04973..cac57306c0 100644
--- a/apps/erp/app/components/Layout/Panels.tsx
+++ b/apps/erp/app/components/Layout/Panels.tsx
@@ -7,7 +7,7 @@ import {
ResizableHandle,
ResizablePanel,
ResizablePanelGroup,
- useCompact
+ useViewport
} from "@carbon/react";
import { useLingui } from "@lingui/react/macro";
import type { ReactNode } from "react";
@@ -63,7 +63,7 @@ interface PanelProviderProps {
}
export function PanelProvider({ children }: PanelProviderProps) {
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
// Seed both to `false` so the first client render matches the server (which
// has no `window`); collapsing based on viewport happens post-mount in the
@@ -82,13 +82,13 @@ export function PanelProvider({ children }: PanelProviderProps) {
};
useEffect(() => {
- if (isCompact) {
+ if (isPhone) {
setIsExplorerCollapsed(true);
setIsPropertiesCollapsed(true);
} else if (window.innerWidth < 1024) {
setIsPropertiesCollapsed(true);
}
- }, [isCompact]);
+ }, [isPhone]);
return (
<PanelContext.Provider value={value}>{children}</PanelContext.Provider>
@@ -204,7 +204,7 @@ export function ResizablePanels({
const { isExplorerCollapsed, isPropertiesCollapsed, setIsExplorerCollapsed } =
usePanels();
const panelRef = useRef<ImperativePanelHandle>(null);
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
useEffect(() => {
if (isExplorerCollapsed) {
@@ -214,7 +214,7 @@ export function ResizablePanels({
}
}, [isExplorerCollapsed]);
- if (isCompact) {
+ if (isPhone) {
return (
<CompactRecordTabs
explorer={explorer}
diff --git a/apps/erp/app/components/Layout/RecordHeader.tsx b/apps/erp/app/components/Layout/RecordHeader.tsx
index f0f97246b6..2370470e57 100644
--- a/apps/erp/app/components/Layout/RecordHeader.tsx
+++ b/apps/erp/app/components/Layout/RecordHeader.tsx
@@ -21,7 +21,7 @@ import {
HStack,
IconButton,
toast,
- useCompact
+ useViewport
} from "@carbon/react";
import { Trans, useLingui } from "@lingui/react/macro";
import type { ReactNode } from "react";
@@ -79,8 +79,8 @@ export function RecordAction({
slot: "primary" | "secondary" | "overflow";
children: ReactNode;
}) {
- const isCompact = useCompact();
- if (!isCompact) return <>{children}</>;
+ const { isPhone } = useViewport();
+ if (!isPhone) return <>{children}</>;
const { Fill } = slots[slot];
return (
<Fill>
@@ -109,11 +109,11 @@ export function RecordHero({
/** The page pads its content by 16pt: pull the hero out to the edges. */
bleed?: boolean;
}) {
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
const [element, setElement] = useState<HTMLElement | null>(null);
useCompactCssVar("--header-height", element);
useCompactCssVar("--hero-height", element);
- if (!isCompact) return null;
+ if (!isPhone) return null;
const hasHero = Boolean(title || subtitle || status);
return (
@@ -146,8 +146,8 @@ export function RecordHero({
/** Where a card form's hero shows on phones (see DocumentHeader). */
export function RecordHeroTarget({ bleed = false }: { bleed?: boolean }) {
- const isCompact = useCompact();
- if (!isCompact) return null;
+ const { isPhone } = useViewport();
+ if (!isPhone) return null;
return (
<recordHeroSlot.Target
className={cn("flex flex-col self-stretch", bleed && "-mx-4 -mt-4")}
@@ -171,12 +171,12 @@ export function RecordPhoneChrome({
copyValue?: string;
}) {
const { t } = useLingui();
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
const hasPrimary = primarySlot.useFilled();
const hasSecondary = secondarySlot.useFilled();
const hasOverflow = overflowSlot.useFilled();
const { open, setOpen } = useOverflowSheet();
- if (!isCompact) return null;
+ if (!isPhone) return null;
const onCopy = async () => {
if (copyValue && (await copyToClipboard(copyValue))) {
@@ -291,7 +291,7 @@ export function RecordHeader({
actions
}: RecordHeaderProps) {
const { t } = useLingui();
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
// An editable title is a control (a name input), not a heading.
const heading = titleInHero ? (
title
@@ -304,14 +304,14 @@ export function RecordHeader({
return (
<>
<RecordHero
- title={isCompact && titleInHero ? title : undefined}
+ title={isPhone && titleInHero ? title : undefined}
subtitle={subtitle}
status={status}
/>
<RecordPhoneChrome menu={menu} copyValue={copyValue} />
<div
className={cn(
- "flex flex-shrink-0 items-center justify-between gap-x-4 py-2 bg-card border-b border-border h-[var(--header-height)] overflow-x-auto scrollbar-hide compact:hidden",
+ "flex flex-shrink-0 items-center justify-between gap-x-4 py-2 bg-card border-b border-border h-[var(--header-height)] overflow-x-auto scrollbar-hide max-md:hidden",
onToggleExplorer ? "pl-2" : "pl-4",
onToggleProperties ? "pr-2" : "pr-4"
)}
@@ -325,7 +325,7 @@ export function RecordHeader({
variant="ghost"
/>
) : null}
- {isCompact && titleInHero ? null : titleTo ? (
+ {isPhone && titleInHero ? null : titleTo ? (
<Link to={titleTo}>{heading}</Link>
) : (
heading
diff --git a/apps/erp/app/components/Layout/Topbar/Notifications.tsx b/apps/erp/app/components/Layout/Topbar/Notifications.tsx
index a843af48c4..c890ab1153 100644
--- a/apps/erp/app/components/Layout/Topbar/Notifications.tsx
+++ b/apps/erp/app/components/Layout/Topbar/Notifications.tsx
@@ -90,7 +90,7 @@ function getNotificationBody(
function EmptyState({ description }: { description: string }) {
return (
- <div className="h-[460px] compact:h-auto compact:py-16 flex items-center justify-center flex-col gap-y-4">
+ <div className="h-[460px] max-md:h-auto max-md:py-16 flex items-center justify-center flex-col gap-y-4">
<div className="w-12 h-12 rounded-full bg-accent flex items-center justify-center">
<LuInbox size={18} />
</div>
@@ -735,7 +735,7 @@ export function NotificationsPanel({
)}
{unreadNotifications.length > 0 && (
- <ScrollArea className="pb-12 h-[485px] compact:h-auto">
+ <ScrollArea className="pb-12 h-[485px] max-md:h-auto">
<div className="divide-y">
{unreadNotifications.map((notification) => {
const event = notification.payload.event as NotificationEvent;
@@ -793,7 +793,7 @@ export function NotificationsPanel({
<TabsContent value="trainings" className="mt-0">
{isLoadingTrainings && (
- <div className="h-[460px] compact:h-auto compact:py-16 flex items-center justify-center">
+ <div className="h-[460px] max-md:h-auto max-md:py-16 flex items-center justify-center">
<Spinner />
</div>
)}
@@ -803,7 +803,7 @@ export function NotificationsPanel({
)}
{!isLoadingTrainings && outstandingTrainings.length > 0 && (
- <ScrollArea className="h-[490px] compact:h-auto">
+ <ScrollArea className="h-[490px] max-md:h-auto">
<div className="divide-y">
{outstandingTrainings.map((training) => (
<TrainingItem
@@ -823,7 +823,7 @@ export function NotificationsPanel({
)}
{archivedNotifications.length > 0 && (
- <ScrollArea className="h-[490px] compact:h-auto">
+ <ScrollArea className="h-[490px] max-md:h-auto">
<div className="divide-y">
{archivedNotifications.map((notification) => {
const event = notification.payload.event as NotificationEvent;
diff --git a/apps/erp/app/components/Layout/Topbar/Search.tsx b/apps/erp/app/components/Layout/Topbar/Search.tsx
index 8652f4cb56..7efbcde0f3 100644
--- a/apps/erp/app/components/Layout/Topbar/Search.tsx
+++ b/apps/erp/app/components/Layout/Topbar/Search.tsx
@@ -236,7 +236,7 @@ export const SearchModal = () => {
}}
>
<ModalContent
- className="rounded-lg p-0 h-[520px] max-w-2xl overflow-hidden dark:shadow-button compact:h-[calc(100dvh-env(safe-area-inset-top)-12px)] compact:max-h-none compact:max-w-none compact:pt-4"
+ className="rounded-lg p-0 h-[520px] max-w-2xl overflow-hidden dark:shadow-button max-md:h-[calc(100dvh-env(safe-area-inset-top)-12px)] max-md:max-h-none max-md:max-w-none max-md:pt-4"
withCloseButton={false}
// Sheets keep focus off their fields on phones; search is the
// exception, since typing is the only thing it is opened for.
@@ -250,7 +250,7 @@ export const SearchModal = () => {
{/* Phones: the sheet has no Esc key, so the input row carries a
close button. */}
- <div className="contents compact:flex compact:items-center compact:border-b compact:border-border compact:pr-1 compact:[&>[cmdk-input-wrapper]]:flex-1 compact:[&>[cmdk-input-wrapper]]:border-b-0">
+ <div className="contents max-md:flex max-md:items-center max-md:border-b max-md:border-border max-md:pr-1 max-md:[&>[cmdk-input-wrapper]]:flex-1 max-md:[&>[cmdk-input-wrapper]]:border-b-0">
<CommandInput
ref={inputRef}
placeholder={t`Search across your workspace...`}
@@ -260,7 +260,7 @@ export const SearchModal = () => {
/>
<ModalClose
aria-label={t`Close`}
- className="hidden compact:flex size-11 shrink-0 items-center justify-center rounded-full text-muted-foreground outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50"
+ className="hidden max-md:flex size-11 shrink-0 items-center justify-center rounded-full text-muted-foreground outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50"
>
<LuX className="size-5" />
</ModalClose>
@@ -340,7 +340,7 @@ export const SearchModal = () => {
<button
type="button"
onClick={(e) => removeRecentSearch(result.to, e)}
- className="flex-shrink-0 p-1 rounded hover:bg-muted opacity-0 group-hover:opacity-100 transition-opacity compact:opacity-100"
+ className="flex-shrink-0 p-1 rounded hover:bg-muted opacity-0 group-hover:opacity-100 transition-opacity max-md:opacity-100"
>
<LuX className="w-4 h-4 text-muted-foreground" />
</button>
@@ -394,7 +394,7 @@ export const SearchModal = () => {
{item.name}
</span>
</span>
- <LuCornerDownLeft className="w-4 h-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity compact:opacity-100" />
+ <LuCornerDownLeft className="w-4 h-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity max-md:opacity-100" />
</CommandItem>
))}
</CommandGroup>
@@ -447,7 +447,7 @@ export const SearchModal = () => {
</span>
)}
</VStack>
- <LuChevronRight className="w-4 h-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity compact:opacity-100" />
+ <LuChevronRight className="w-4 h-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity max-md:opacity-100" />
</CommandItem>
))}
</CommandGroup>
@@ -460,7 +460,7 @@ export const SearchModal = () => {
</CommandList>
{/* Footer */}
- <div className="border-t border-border px-4 py-2 flex items-center justify-between text-xs text-muted-foreground compact:hidden">
+ <div className="border-t border-border px-4 py-2 flex items-center justify-between text-xs text-muted-foreground max-md:hidden">
<div className="flex items-center gap-3">
<span className="flex items-center gap-1">
<kbd className="px-1.5 py-0.5 rounded bg-muted font-mono text-[10px]">
diff --git a/apps/erp/app/components/Layout/Topbar/Search/SearchResultItem.tsx b/apps/erp/app/components/Layout/Topbar/Search/SearchResultItem.tsx
index 5c214d2197..b88afc2de5 100644
--- a/apps/erp/app/components/Layout/Topbar/Search/SearchResultItem.tsx
+++ b/apps/erp/app/components/Layout/Topbar/Search/SearchResultItem.tsx
@@ -60,10 +60,10 @@ export function SearchResultItem({
{/* Entity type label + chevron */}
<div className="flex-shrink-0 flex items-center gap-2 text-muted-foreground">
- <span className="text-xs font-medium opacity-0 group-hover:opacity-100 transition-opacity compact:opacity-100">
+ <span className="text-xs font-medium opacity-0 group-hover:opacity-100 transition-opacity max-md:opacity-100">
{entityLabel}
</span>
- <LuChevronRight className="w-4 h-4 opacity-0 group-hover:opacity-100 transition-opacity compact:opacity-100" />
+ <LuChevronRight className="w-4 h-4 opacity-0 group-hover:opacity-100 transition-opacity max-md:opacity-100" />
</div>
</button>
);
diff --git a/apps/erp/app/components/Layout/Topbar/Topbar.tsx b/apps/erp/app/components/Layout/Topbar/Topbar.tsx
index 788c79d258..182c92fd64 100644
--- a/apps/erp/app/components/Layout/Topbar/Topbar.tsx
+++ b/apps/erp/app/components/Layout/Topbar/Topbar.tsx
@@ -2,7 +2,7 @@
// Carbon (github.com/crbnos/carbon). Modified or adapted versions of this file,
// including ports, remain AGPLv3; serving them over a network requires releasing their source.
-import { HStack, IconButton, useCompact } from "@carbon/react";
+import { HStack, IconButton, useViewport } from "@carbon/react";
import { useLingui } from "@lingui/react/macro";
import { LuSquarePen } from "react-icons/lu";
import { useUser } from "~/hooks";
@@ -19,8 +19,8 @@ const Topbar = () => {
const notificationsKey = `${user.id}:${user.company.id}`;
// Phones get the MobileAppBar and MobileTabBar instead; returning early
// also keeps the notifications subscription and menus from mounting there.
- const isCompact = useCompact();
- if (isCompact) return null;
+ const { isPhone } = useViewport();
+ if (isPhone) return null;
return (
<div className="h-[var(--topbar-height)] grid grid-cols-[1fr_auto] bg-card border-b border-border text-foreground px-4 top-0 sticky z-10 items-center">
diff --git a/apps/erp/app/components/Location.tsx b/apps/erp/app/components/Location.tsx
index 84e02e5994..81a9a0b6df 100644
--- a/apps/erp/app/components/Location.tsx
+++ b/apps/erp/app/components/Location.tsx
@@ -49,7 +49,7 @@ const Location = ({ location, actions }: LocationProps) => {
<div className="grid w-full gap-4 grid-cols-[auto_1fr_auto]">
<LuMapPin className="size-5 mt-2" />
<VStack spacing={0}>
- <p className="font-bold line-clamp-1 compact:font-semibold">
+ <p className="font-bold line-clamp-1 max-md:font-semibold">
{locationName}
</p>
<p className="text-sm text-muted-foreground line-clamp-1">
diff --git a/apps/erp/app/components/MetricCard.tsx b/apps/erp/app/components/MetricCard.tsx
index dbb8146d73..a8779989f0 100644
--- a/apps/erp/app/components/MetricCard.tsx
+++ b/apps/erp/app/components/MetricCard.tsx
@@ -9,7 +9,7 @@ import {
CardHeader,
CardTitle,
cn,
- useCompact
+ useViewport
} from "@carbon/react";
import { useLingui } from "@lingui/react/macro";
import type { ReactNode } from "react";
@@ -36,13 +36,13 @@ const MetricCard = ({
className
}: MetricCardProps) => {
const { t } = useLingui();
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
// Compact: the whole tile is the link, so no View button.
// The link is then the grid item, so it takes the caller's layout classes.
- const isLinkTile = isCompact && !!to;
+ const isLinkTile = isPhone && !!to;
const card = (
- <Card className={cn(!isLinkTile && className, "compact:h-full")}>
+ <Card className={cn(!isLinkTile && className, "max-md:h-full")}>
<CardHeader className="flex-row items-center gap-2">
{icon && (
<span className="flex-shrink-0 text-muted-foreground">{icon}</span>
@@ -52,7 +52,7 @@ const MetricCard = ({
"flex-1 min-w-0 line-clamp-none",
// Phones: two lines, so similar labels stay distinguishable; always two
// lines tall, so values line up across a row of tiles.
- isCompact ? "line-clamp-2 min-h-[2lh] text-[13px]" : "truncate"
+ isPhone ? "line-clamp-2 min-h-[2lh] text-[13px]" : "truncate"
)}
>
{title}
@@ -75,7 +75,7 @@ const MetricCard = ({
)}
</CardHeader>
<CardContent>
- <h3 className="text-4xl font-medium tracking-tighter tabular-nums truncate compact:text-[26px] compact:font-semibold compact:tracking-tight">
+ <h3 className="text-4xl font-medium tracking-tighter tabular-nums truncate max-md:text-[26px] max-md:font-semibold max-md:tracking-tight">
{value}
</h3>
{description && (
diff --git a/apps/erp/app/components/ModuleCard.tsx b/apps/erp/app/components/ModuleCard.tsx
index 6b7acda9cb..407f87d8c0 100644
--- a/apps/erp/app/components/ModuleCard.tsx
+++ b/apps/erp/app/components/ModuleCard.tsx
@@ -15,12 +15,12 @@ export const ModuleCard = ({ module }: { module: Authenticated<NavItem> }) => {
{...(module.external
? { target: "_blank", rel: "noopener noreferrer" }
: {})}
- className="flex items-center gap-4 p-4 rounded-lg border border-border group bg-muted/20 hover:border-foreground/20 cursor-pointer transition-colors duration-200 compact:min-h-[88px] compact:min-w-0 compact:flex-col compact:justify-center compact:gap-2 compact:p-3 compact:bg-card"
+ className="flex items-center gap-4 p-4 rounded-lg border border-border group bg-muted/20 hover:border-foreground/20 cursor-pointer transition-colors duration-200 max-md:min-h-[88px] max-md:min-w-0 max-md:flex-col max-md:justify-center max-md:gap-2 max-md:p-3 max-md:bg-card"
>
- <div className="shrink-0 p-2.5 rounded-lg border border-border group-hover:border-foreground/20 transition-colors compact:p-2">
+ <div className="shrink-0 p-2.5 rounded-lg border border-border group-hover:border-foreground/20 transition-colors max-md:p-2">
<module.icon className="text-xl" />
</div>
- <span className="text-sm py-1 px-4 border border-border rounded-full group-hover:bg-background font-medium tracking-tight transition-colors compact:max-w-full compact:truncate compact:border-0 compact:p-0 compact:text-[13px]">
+ <span className="text-sm py-1 px-4 border border-border rounded-full group-hover:bg-background font-medium tracking-tight transition-colors max-md:max-w-full max-md:truncate max-md:border-0 max-md:p-0 max-md:text-[13px]">
{module.name}
</span>
</Anchor>
diff --git a/apps/erp/app/components/MoveToSubmenu.tsx b/apps/erp/app/components/MoveToSubmenu.tsx
index 8105f86d05..ac8df13789 100644
--- a/apps/erp/app/components/MoveToSubmenu.tsx
+++ b/apps/erp/app/components/MoveToSubmenu.tsx
@@ -13,7 +13,7 @@ import {
DropdownMenuSubTrigger,
DropdownMenuTrigger,
IconButton,
- useCompact
+ useViewport
} from "@carbon/react";
import { Trans, useLingui } from "@lingui/react/macro";
import { LuEllipsisVertical, LuMoveRight } from "react-icons/lu";
@@ -34,8 +34,8 @@ type MoveToProps = {
* the drop's move reachable by tap. Renders nothing on desktop.
*/
export function MoveToSubmenu({ getTargets, onMove }: MoveToProps) {
- const isCompact = useCompact();
- if (!isCompact) return null;
+ const { isPhone } = useViewport();
+ if (!isPhone) return null;
const targets = getTargets();
if (targets.length === 0) return null;
@@ -62,8 +62,8 @@ export function MoveToSubmenu({ getTargets, onMove }: MoveToProps) {
*/
export function MoveToMenu({ getTargets, onMove }: MoveToProps) {
const { t } = useLingui();
- const isCompact = useCompact();
- if (!isCompact) return null;
+ const { isPhone } = useViewport();
+ if (!isPhone) return null;
const targets = getTargets();
if (targets.length === 0) return null;
diff --git a/apps/erp/app/components/New.tsx b/apps/erp/app/components/New.tsx
index c6fdfeaeb1..695172ad20 100644
--- a/apps/erp/app/components/New.tsx
+++ b/apps/erp/app/components/New.tsx
@@ -3,7 +3,7 @@
// including ports, remain AGPLv3; serving them over a network requires releasing their source.
import type { ButtonProps } from "@carbon/react";
-import { Button, IconButton, useCompact } from "@carbon/react";
+import { Button, IconButton, useViewport } from "@carbon/react";
import { useLingui } from "@lingui/react/macro";
import type { ReactNode } from "react";
import {
@@ -58,9 +58,9 @@ export function NewAction({
onClick,
children
}: NewActionProps) {
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
const placement = useContext(NewPlacementContext);
- if (!isCompact || placement !== "appBar") return <>{children}</>;
+ if (!isPhone || placement !== "appBar") return <>{children}</>;
const icon = <LuPlus className="size-6" />;
return (
diff --git a/apps/erp/app/components/NewRecordPage.tsx b/apps/erp/app/components/NewRecordPage.tsx
index 52593ef087..c3cef34f64 100644
--- a/apps/erp/app/components/NewRecordPage.tsx
+++ b/apps/erp/app/components/NewRecordPage.tsx
@@ -28,7 +28,7 @@ export function NewRecordPage({ className, ...props }: ComponentProps<"div">) {
<div
{...props}
className={cn(
- "max-w-4xl w-full p-2 sm:p-0 mx-auto mt-0 md:mt-8 compact:px-4 compact:pt-3",
+ "max-w-4xl w-full p-2 sm:p-0 mx-auto mt-0 md:mt-8 max-md:px-4 max-md:pt-3",
className
)}
/>
diff --git a/apps/erp/app/components/PermissionMatrix.tsx b/apps/erp/app/components/PermissionMatrix.tsx
index 885d486907..237437e0e6 100644
--- a/apps/erp/app/components/PermissionMatrix.tsx
+++ b/apps/erp/app/components/PermissionMatrix.tsx
@@ -12,7 +12,7 @@ import {
Th,
Thead,
Tr,
- useCompact
+ useViewport
} from "@carbon/react";
import { Trans, useLingui } from "@lingui/react/macro";
import type { UsePermissionMatrixReturn } from "~/hooks/usePermissionMatrix";
@@ -35,7 +35,7 @@ const PermissionMatrix = ({
isDisabled
}: PermissionMatrixProps) => {
const { t } = useLingui();
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
const resolvedLabel = label ?? t`Permissions`;
const {
modules,
@@ -59,11 +59,11 @@ const PermissionMatrix = ({
</label>
)}
{/* Compact: this div scrolls sideways and the module column stays pinned. */}
- <div className="rounded-md border overflow-hidden compact:overflow-x-auto compact:scroll-fade-x">
- <Table full={isCompact}>
+ <div className="rounded-md border overflow-hidden max-md:overflow-x-auto max-md:scroll-fade-x">
+ <Table full={isPhone}>
<Thead>
<Tr>
- <Th className="w-[140px] compact:sticky compact:left-0 compact:z-10 compact:bg-card">
+ <Th className="w-[140px] max-md:sticky max-md:left-0 max-md:z-10 max-md:bg-card">
<div className="flex items-center gap-2">
<Checkbox
isChecked={allChecked}
@@ -88,7 +88,7 @@ const PermissionMatrix = ({
<Tbody>
{modules.map(([mod]) => (
<Tr key={mod}>
- <Td className="compact:sticky compact:left-0 compact:z-10 compact:bg-card">
+ <Td className="max-md:sticky max-md:left-0 max-md:z-10 max-md:bg-card">
<div className="flex items-center gap-2">
<Checkbox
isChecked={isRowAllChecked(mod)}
diff --git a/apps/erp/app/components/RecordDocuments.tsx b/apps/erp/app/components/RecordDocuments.tsx
index 9e11576e95..d6f20801e2 100644
--- a/apps/erp/app/components/RecordDocuments.tsx
+++ b/apps/erp/app/components/RecordDocuments.tsx
@@ -126,7 +126,7 @@ const RecordDocuments = ({
</HStack>
<CardContent>
<Table>
- <Thead className={cn(filesToRender.length === 0 && "compact:hidden")}>
+ <Thead className={cn(filesToRender.length === 0 && "max-md:hidden")}>
<Tr>
<Th>
<Trans>Name</Trans>
diff --git a/apps/erp/app/components/SearchFilter.tsx b/apps/erp/app/components/SearchFilter.tsx
index 0e351f804f..259672b973 100644
--- a/apps/erp/app/components/SearchFilter.tsx
+++ b/apps/erp/app/components/SearchFilter.tsx
@@ -27,7 +27,7 @@ const SearchFilter = ({ param, size, ...props }: SearchFilterProps) => {
return (
<InputGroup size={size}>
<InputLeftElement>
- <LuSearch className="text-muted-foreground w-3.5 h-3.5 mt-[-2px] compact:size-4 compact:mt-0" />
+ <LuSearch className="text-muted-foreground w-3.5 h-3.5 mt-[-2px] max-md:size-4 max-md:mt-0" />
</InputLeftElement>
<Input
value={query}
@@ -35,7 +35,7 @@ const SearchFilter = ({ param, size, ...props }: SearchFilterProps) => {
setQuery(e.target.value);
debounceQuery(e.target.value);
}}
- className="w-[100px] sm:w-[200px] text-sm compact:w-full compact:text-base"
+ className="w-[100px] sm:w-[200px] text-sm max-md:w-full max-md:text-base"
{...props}
/>
</InputGroup>
diff --git a/apps/erp/app/components/Selectors/UserSelect/components/Popover.tsx b/apps/erp/app/components/Selectors/UserSelect/components/Popover.tsx
index 3f6ef2a3a0..fe97c3b234 100644
--- a/apps/erp/app/components/Selectors/UserSelect/components/Popover.tsx
+++ b/apps/erp/app/components/Selectors/UserSelect/components/Popover.tsx
@@ -2,13 +2,13 @@
// Carbon (github.com/crbnos/carbon). Modified or adapted versions of this file,
// including ports, remain AGPLv3; serving them over a network requires releasing their source.
-import { useCompact } from "@carbon/react";
+import { useViewport } from "@carbon/react";
import type { PropsWithChildren } from "react";
import { useEffect } from "react";
import useUserSelectContext from "../provider";
const Popover = ({ children }: PropsWithChildren) => {
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
const {
aria: { popoverProps },
dropdown,
@@ -67,7 +67,7 @@ const Popover = ({ children }: PropsWithChildren) => {
{/* Phones: the list is a bottom sheet over a dimmed screen. The scrim
sits inside the select's container, so the outside-click handler
never sees a tap on it; it closes the sheet itself. */}
- {isCompact && (
+ {isPhone && (
<div
aria-hidden
className="fixed inset-0 z-40 bg-black/40"
@@ -80,7 +80,7 @@ const Popover = ({ children }: PropsWithChildren) => {
<div
{...popoverProps}
ref={popoverRef}
- className="absolute w-full mt-1 px-2 bg-popover text-popover-foreground shadow-sm border border-border rounded-md min-w-[240px] z-50 compact:fixed compact:inset-x-0 compact:top-auto compact:bottom-0 compact:mt-0 compact:max-h-[88dvh] compact:min-w-0 compact:overflow-y-auto compact:rounded-none compact:rounded-t-[14px] compact:border-0 compact:px-2 compact:pt-2 compact:pb-safe-4"
+ className="absolute w-full mt-1 px-2 bg-popover text-popover-foreground shadow-sm border border-border rounded-md min-w-[240px] z-50 max-md:fixed max-md:inset-x-0 max-md:top-auto max-md:bottom-0 max-md:mt-0 max-md:max-h-[88dvh] max-md:min-w-0 max-md:overflow-y-auto max-md:rounded-none max-md:rounded-t-[14px] max-md:border-0 max-md:px-2 max-md:pt-2 max-md:pb-safe-4"
>
{children}
</div>
diff --git a/apps/erp/app/components/Selectors/UserSelect/components/TreeSelect.tsx b/apps/erp/app/components/Selectors/UserSelect/components/TreeSelect.tsx
index 9a5d497d13..5d24f4a011 100644
--- a/apps/erp/app/components/Selectors/UserSelect/components/TreeSelect.tsx
+++ b/apps/erp/app/components/Selectors/UserSelect/components/TreeSelect.tsx
@@ -182,7 +182,7 @@ const GroupRow = ({
if (!expanded) prefetchGroup(group.id);
}}
className={cn(
- "flex cursor-pointer select-none items-center gap-2 rounded-md px-2 py-2 hover:bg-muted/50 text-sm compact:min-h-11",
+ "flex cursor-pointer select-none items-center gap-2 rounded-md px-2 py-2 hover:bg-muted/50 text-sm max-md:min-h-11",
isFocused && "bg-muted/50",
isSelected && "bg-accent",
isDisabled && "opacity-50 pointer-events-none"
@@ -196,7 +196,7 @@ const GroupRow = ({
e.stopPropagation();
expanded ? onGroupCollapse(uid) : onGroupExpand(uid);
}}
- className="-m-1.5 flex items-center justify-center rounded-md p-1.5 hover:bg-muted pointer-events-auto compact:relative compact:mr-1 compact:after:absolute compact:after:content-[''] compact:after:-inset-2.5"
+ className="-m-1.5 flex items-center justify-center rounded-md p-1.5 hover:bg-muted pointer-events-auto max-md:relative max-md:mr-1 max-md:after:absolute max-md:after:content-[''] max-md:after:-inset-2.5"
>
<ExpandIcon isExpanded={expanded} />
</button>
diff --git a/apps/erp/app/components/SettingsPage.tsx b/apps/erp/app/components/SettingsPage.tsx
index 46f344c626..720fd4529a 100644
--- a/apps/erp/app/components/SettingsPage.tsx
+++ b/apps/erp/app/components/SettingsPage.tsx
@@ -17,7 +17,7 @@ export function SettingsPage({
className={cn(
"py-12 px-4 max-w-[60rem] h-full mx-auto",
className,
- "compact:py-3 compact:px-4 compact:gap-3 compact:space-y-0"
+ "max-md:py-3 max-md:px-4 max-md:gap-3 max-md:space-y-0"
)}
/>
);
@@ -29,6 +29,6 @@ export function SettingsPageHeading({
...props
}: Omit<ComponentProps<typeof Heading>, "size">) {
return (
- <Heading size="h3" {...props} className={cn("compact:hidden", className)} />
+ <Heading size="h3" {...props} className={cn("max-md:hidden", className)} />
);
}
diff --git a/apps/erp/app/components/SettingsSectionHeader.tsx b/apps/erp/app/components/SettingsSectionHeader.tsx
index 93fa95300d..7886245f58 100644
--- a/apps/erp/app/components/SettingsSectionHeader.tsx
+++ b/apps/erp/app/components/SettingsSectionHeader.tsx
@@ -23,7 +23,7 @@ export default function SettingsSectionHeader({ children, className }: Props) {
<Subheading
variant="light"
className={cn(
- "mt-4 compact:text-xs/[1.3] compact:font-medium compact:tracking-[0.04em]",
+ "mt-4 max-md:text-xs/[1.3] max-md:font-medium max-md:tracking-[0.04em]",
className
)}
>
diff --git a/apps/erp/app/components/SlidesEditor.tsx b/apps/erp/app/components/SlidesEditor.tsx
index 0c3f12d642..301ac661e1 100644
--- a/apps/erp/app/components/SlidesEditor.tsx
+++ b/apps/erp/app/components/SlidesEditor.tsx
@@ -201,7 +201,7 @@ export function SlidesEditor({
return (
<VStack
spacing={2}
- className="w-full col-span-2 compact:col-span-full border-t pt-4"
+ className="w-full col-span-2 max-md:col-span-full border-t pt-4"
>
<div className="flex w-full items-center justify-between">
<Label className="text-xs text-muted-foreground">Slides</Label>
diff --git a/apps/erp/app/components/SortableList.tsx b/apps/erp/app/components/SortableList.tsx
index d160d63fb5..feadf00824 100644
--- a/apps/erp/app/components/SortableList.tsx
+++ b/apps/erp/app/components/SortableList.tsx
@@ -140,7 +140,7 @@ function SortableListItem<T>({
>
<HStack
className={cn(
- "w-full justify-between pr-8 compact:flex-wrap compact:gap-y-1",
+ "w-full justify-between pr-8 max-md:flex-wrap max-md:gap-y-1",
!isReadOnly && "cursor-grab"
)}
>
@@ -176,7 +176,7 @@ function SortableListItem<T>({
)}
{item.details && (
- <div className="flex flex-shrink-0 compact:basis-full compact:flex-wrap compact:[&>*]:flex-wrap">
+ <div className="flex flex-shrink-0 max-md:basis-full max-md:flex-wrap max-md:[&>*]:flex-wrap">
{item.details}
</div>
)}
@@ -237,7 +237,7 @@ export function SortableListItemToggle({
type="button"
onClick={onToggle}
className={cn(
- "absolute right-3 top-3 z-10 compact:after:absolute compact:after:-inset-3",
+ "absolute right-3 top-3 z-10 max-md:after:absolute max-md:after:-inset-3",
className
)}
>
diff --git a/apps/erp/app/components/StepLinkEditor.tsx b/apps/erp/app/components/StepLinkEditor.tsx
index 74b4cb7bbb..fb49371b63 100644
--- a/apps/erp/app/components/StepLinkEditor.tsx
+++ b/apps/erp/app/components/StepLinkEditor.tsx
@@ -164,7 +164,7 @@ export function StepLinkEditor({
return (
<VStack
spacing={2}
- className="w-full col-span-2 compact:col-span-full border-t pt-4"
+ className="w-full col-span-2 max-md:col-span-full border-t pt-4"
>
<div className="flex w-full items-center justify-between">
<Label className="text-xs text-muted-foreground">{label}</Label>
diff --git a/apps/erp/app/components/Table/Table.tsx b/apps/erp/app/components/Table/Table.tsx
index 081f89eb26..60527f1613 100644
--- a/apps/erp/app/components/Table/Table.tsx
+++ b/apps/erp/app/components/Table/Table.tsx
@@ -22,10 +22,10 @@ import {
Th,
Thead,
Tr,
- useCompact,
useEscape,
useMount,
useOutsideClick,
+ useViewport,
VStack
} from "@carbon/react";
import { clamp } from "@carbon/utils";
@@ -1092,7 +1092,7 @@ const Table = <T extends object>({
params.getAll("sort").filter(Boolean).length === 0 &&
!params.get("search")?.trim();
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
// Phones export from the toolbar's ⋯ (list and grid alike); desktop keeps
// the toolbar's Download button.
const csvExport = withCsvExport
@@ -1106,7 +1106,7 @@ const Table = <T extends object>({
}
: undefined;
- if (isCompact && mobileLayout === "list") {
+ if (isPhone && mobileLayout === "list") {
return (
<CompactList
titleBadge={titleBadge}
@@ -1169,10 +1169,10 @@ const Table = <T extends object>({
"h-full bg-card",
!compact && "flex flex-col w-full px-0 md:px-4 lg:px-6",
// Phones (grid mode): the toolbar spans the full width.
- "compact:items-stretch"
+ "max-md:items-stretch"
)}
>
- {isCompact ? (
+ {isPhone ? (
<CompactToolbar
title={currentView?.name ?? title}
tableName={tableName}
@@ -1238,7 +1238,7 @@ const Table = <T extends object>({
// Phones, grids kept as grids: sideways scroll with an
// edge fade, 16pt inset, and a sticky first column of at most 150pt.
mobileLayout === "table" &&
- "compact:scroll-fade-x compact:px-4 compact:[&_tr>*:first-child]:sticky compact:[&_tr>*:first-child]:left-0 compact:[&_tr>*:first-child]:z-10 compact:[&_tr>*:first-child]:max-w-[150px] compact:[&_tr>*:first-child]:bg-card"
+ "max-md:scroll-fade-x max-md:px-4 max-md:[&_tr>*:first-child]:sticky max-md:[&_tr>*:first-child]:left-0 max-md:[&_tr>*:first-child]:z-10 max-md:[&_tr>*:first-child]:max-w-[150px] max-md:[&_tr>*:first-child]:bg-card"
)}
style={{ contain: "strict" }}
ref={tableContainerRef}
@@ -1391,7 +1391,7 @@ const Table = <T extends object>({
) : (
<LuArrowUpDown
aria-hidden="true"
- className="text-muted-foreground/50 opacity-0 transition-opacity group-hover:opacity-100 compact:opacity-100"
+ className="text-muted-foreground/50 opacity-0 transition-opacity group-hover:opacity-100 max-md:opacity-100"
/>
)}
</span>
diff --git a/apps/erp/app/components/Table/components/Cell.tsx b/apps/erp/app/components/Table/components/Cell.tsx
index 6e16c5261b..b1647bbeb7 100644
--- a/apps/erp/app/components/Table/components/Cell.tsx
+++ b/apps/erp/app/components/Table/components/Cell.tsx
@@ -81,7 +81,7 @@ const Cell = <T extends object>({
className={cn(
"group/cell relative py-2 whitespace-nowrap text-sm outline-none max-w-[30dvw] truncate",
// Phones: a grid's name column opts in to more width than the others.
- "compact:[&:has([data-key-cell])]:max-w-[45dvw]",
+ "max-md:[&:has([data-key-cell])]:max-w-[45dvw]",
cell.column.id === "Select" ? "px-2" : "px-4",
wasEdited && "bg-yellow-100 dark:bg-yellow-900",
isEditMode && !hasEditableTableCellComponent && "bg-muted/50",
diff --git a/apps/erp/app/components/TrainingPanel.tsx b/apps/erp/app/components/TrainingPanel.tsx
index c8b470cb47..29619d4120 100644
--- a/apps/erp/app/components/TrainingPanel.tsx
+++ b/apps/erp/app/components/TrainingPanel.tsx
@@ -34,7 +34,7 @@ export default function TrainingPanel({
animate={{ opacity: 1, y: 0, scale: 1, filter: "blur(0px)" }}
exit={{ opacity: 0, y: 10, scale: 0.95, filter: "blur(4px)" }}
transition={{ duration: 0.3, ease: "easeOut" }}
- className="fixed bottom-4 right-4 w-[380px] rounded-lg border bg-background shadow-lg z-40 overflow-hidden compact:inset-0 compact:z-[60] compact:w-full compact:overflow-y-auto compact:rounded-none compact:border-0 compact:pt-safe compact:pb-safe"
+ className="fixed bottom-4 right-4 w-[380px] rounded-lg border bg-background shadow-lg z-40 overflow-hidden max-md:inset-0 max-md:z-[60] max-md:w-full max-md:overflow-y-auto max-md:rounded-none max-md:border-0 max-md:pt-safe max-md:pb-safe"
>
<div className="relative aspect-video w-full bg-muted">
<iframe
diff --git a/apps/erp/app/modules/account/ui/Profile/ProfileForm.tsx b/apps/erp/app/modules/account/ui/Profile/ProfileForm.tsx
index a24a9d48a8..a7f9de4440 100644
--- a/apps/erp/app/modules/account/ui/Profile/ProfileForm.tsx
+++ b/apps/erp/app/modules/account/ui/Profile/ProfileForm.tsx
@@ -62,7 +62,7 @@ const ProfileForm = ({ user }: ProfileFormProps) => {
<Hidden name="intent" value="about" />
</VStack>
{/* Phones: the avatar heads the form as the identity header. */}
- <div className="contents compact:block compact:order-first compact:justify-self-center">
+ <div className="contents max-md:block max-md:order-first max-md:justify-self-center">
<ProfilePhotoForm user={user} />
</div>
</div>
diff --git a/apps/erp/app/modules/account/ui/UserAttributes/UserAttributesForm.tsx b/apps/erp/app/modules/account/ui/UserAttributes/UserAttributesForm.tsx
index 6a997109c9..6671075d90 100644
--- a/apps/erp/app/modules/account/ui/UserAttributes/UserAttributesForm.tsx
+++ b/apps/erp/app/modules/account/ui/UserAttributes/UserAttributesForm.tsx
@@ -179,7 +179,7 @@ function TypedForm(
fetcher={updateFetcher}
onSubmit={(data) => onSubmit(data.value)}
>
- <div className="grid grid-cols-[1fr_2fr_1fr] border-t border-border gap-x-2 pt-3 w-full items-center compact:grid-cols-1 compact:gap-2">
+ <div className="grid grid-cols-[1fr_2fr_1fr] border-t border-border gap-x-2 pt-3 w-full items-center max-md:grid-cols-1 max-md:gap-2">
<p className="text-muted-foreground self-center">
{attribute.name}
</p>
@@ -216,7 +216,7 @@ function TypedForm(
fetcher={updateFetcher}
onSubmit={(data) => onSubmit(data.value)}
>
- <div className="grid grid-cols-[1fr_2fr_1fr] border-t border-border gap-x-2 pt-3 w-full items-center compact:grid-cols-1 compact:gap-2">
+ <div className="grid grid-cols-[1fr_2fr_1fr] border-t border-border gap-x-2 pt-3 w-full items-center max-md:grid-cols-1 max-md:gap-2">
<p className="text-muted-foreground self-center">
{attribute.name}
</p>
@@ -249,7 +249,7 @@ function TypedForm(
fetcher={updateFetcher}
onSubmit={(data) => onSubmit(data.value)}
>
- <div className="grid grid-cols-[1fr_2fr_1fr] border-t border-border gap-x-2 pt-3 w-full items-center compact:grid-cols-1 compact:gap-2">
+ <div className="grid grid-cols-[1fr_2fr_1fr] border-t border-border gap-x-2 pt-3 w-full items-center max-md:grid-cols-1 max-md:gap-2">
<p className="text-muted-foreground self-center">
{attribute.name}
</p>
@@ -290,7 +290,7 @@ function TypedForm(
fetcher={updateFetcher}
onSubmit={(data) => onSubmit(data.value)}
>
- <div className="grid grid-cols-[1fr_2fr_1fr] border-t border-border gap-x-2 pt-3 w-full items-center compact:grid-cols-1 compact:gap-2">
+ <div className="grid grid-cols-[1fr_2fr_1fr] border-t border-border gap-x-2 pt-3 w-full items-center max-md:grid-cols-1 max-md:gap-2">
<p className="text-muted-foreground self-center">
{attribute.name}
</p>
@@ -323,7 +323,7 @@ function TypedForm(
fetcher={updateFetcher}
onSubmit={(data) => onSubmit(data.value)}
>
- <div className="grid grid-cols-[1fr_2fr_1fr] border-t border-border gap-x-2 pt-3 w-full items-center compact:grid-cols-1 compact:gap-2">
+ <div className="grid grid-cols-[1fr_2fr_1fr] border-t border-border gap-x-2 pt-3 w-full items-center max-md:grid-cols-1 max-md:gap-2">
<p className="text-muted-foreground self-center">
{attribute.name}
</p>
@@ -356,7 +356,7 @@ function TypedForm(
fetcher={updateFetcher}
onSubmit={(data) => onSubmit(data.value)}
>
- <div className="grid grid-cols-[1fr_2fr_1fr] border-t border-border gap-x-2 pt-3 w-full items-center compact:grid-cols-1 compact:gap-2">
+ <div className="grid grid-cols-[1fr_2fr_1fr] border-t border-border gap-x-2 pt-3 w-full items-center max-md:grid-cols-1 max-md:gap-2">
<p className="text-muted-foreground self-center">
{attribute.name}
</p>
@@ -389,7 +389,7 @@ function TypedForm(
fetcher={updateFetcher}
onSubmit={(data) => onSubmit(data.value)}
>
- <div className="grid grid-cols-[1fr_2fr_1fr] border-t border-border gap-x-2 pt-3 w-full items-center compact:grid-cols-1 compact:gap-2">
+ <div className="grid grid-cols-[1fr_2fr_1fr] border-t border-border gap-x-2 pt-3 w-full items-center max-md:grid-cols-1 max-md:gap-2">
<p className="text-muted-foreground self-center">
{attribute.name}
</p>
@@ -422,7 +422,7 @@ function TypedForm(
fetcher={updateFetcher}
onSubmit={(data) => onSubmit(data.value)}
>
- <div className="grid grid-cols-[1fr_2fr_1fr] border-t border-border gap-x-2 pt-3 w-full items-center compact:grid-cols-1 compact:gap-2">
+ <div className="grid grid-cols-[1fr_2fr_1fr] border-t border-border gap-x-2 pt-3 w-full items-center max-md:grid-cols-1 max-md:gap-2">
<p className="text-muted-foreground self-center">
{attribute.name}
</p>
@@ -483,7 +483,7 @@ function TypedDisplay(
switch (type) {
case DataType.Boolean:
return (
- <div className="grid grid-cols-[1fr_2fr_1fr] border-t border-border gap-x-2 pt-3 w-full items-center compact:grid-cols-1 compact:gap-2">
+ <div className="grid grid-cols-[1fr_2fr_1fr] border-t border-border gap-x-2 pt-3 w-full items-center max-md:grid-cols-1 max-md:gap-2">
<p className="text-muted-foreground items-center">{attribute.name}</p>
{displayValue === "N/A" ? (
<p className="self-center">{displayValue}</p>
@@ -507,7 +507,7 @@ function TypedDisplay(
case DataType.List:
case DataType.Text:
return (
- <div className="grid grid-cols-[1fr_2fr_1fr] border-t border-border gap-x-2 pt-3 w-full items-center compact:grid-cols-1 compact:gap-2">
+ <div className="grid grid-cols-[1fr_2fr_1fr] border-t border-border gap-x-2 pt-3 w-full items-center max-md:grid-cols-1 max-md:gap-2">
<p className="text-muted-foreground self-center">{attribute.name}</p>
<p className="self-center">
{type === DataType.Date &&
@@ -533,7 +533,7 @@ function TypedDisplay(
);
case DataType.Numeric:
return (
- <div className="grid grid-cols-[1fr_2fr_1fr] border-t border-border gap-x-2 pt-3 w-full items-center compact:grid-cols-1 compact:gap-2">
+ <div className="grid grid-cols-[1fr_2fr_1fr] border-t border-border gap-x-2 pt-3 w-full items-center max-md:grid-cols-1 max-md:gap-2">
<p className="text-muted-foreground self-center">{attribute.name}</p>
<p className="self-center">{displayValue.toLocaleString(locale)}</p>
<UpdateRemoveButtons
@@ -548,7 +548,7 @@ function TypedDisplay(
);
case DataType.User:
return (
- <div className="grid grid-cols-[1fr_2fr_1fr] border-t border-border gap-x-2 pt-3 w-full items-center compact:grid-cols-1 compact:gap-2">
+ <div className="grid grid-cols-[1fr_2fr_1fr] border-t border-border gap-x-2 pt-3 w-full items-center max-md:grid-cols-1 max-md:gap-2">
<p className="text-muted-foreground self-center">{attribute.name}</p>
{value ? (
<UserSelect disabled value={value.toString()} />
@@ -568,7 +568,7 @@ function TypedDisplay(
);
case DataType.Customer:
return (
- <div className="grid grid-cols-[1fr_2fr_1fr] border-t border-border gap-x-2 pt-3 w-full items-center compact:grid-cols-1 compact:gap-2">
+ <div className="grid grid-cols-[1fr_2fr_1fr] border-t border-border gap-x-2 pt-3 w-full items-center max-md:grid-cols-1 max-md:gap-2">
<p className="text-muted-foreground self-center">{attribute.name}</p>
{value ? (
<CustomerAvatar customerId={value.toString()} />
@@ -588,7 +588,7 @@ function TypedDisplay(
);
case DataType.Supplier:
return (
- <div className="grid grid-cols-[1fr_2fr_1fr] border-t border-border gap-x-2 pt-3 w-full items-center compact:grid-cols-1 compact:gap-2">
+ <div className="grid grid-cols-[1fr_2fr_1fr] border-t border-border gap-x-2 pt-3 w-full items-center max-md:grid-cols-1 max-md:gap-2">
<p className="text-muted-foreground self-center">{attribute.name}</p>
{value ? (
<SupplierAvatar supplierId={value.toString()} />
@@ -608,7 +608,7 @@ function TypedDisplay(
);
case DataType.File:
return (
- <div className="grid grid-cols-[1fr_2fr_1fr] border-t border-border gap-x-2 pt-3 w-full items-center compact:grid-cols-1 compact:gap-2">
+ <div className="grid grid-cols-[1fr_2fr_1fr] border-t border-border gap-x-2 pt-3 w-full items-center max-md:grid-cols-1 max-md:gap-2">
<p className="text-muted-foreground self-center">{attribute.name}</p>
{value ? (
<a
@@ -803,7 +803,7 @@ function FileAttributeForm({
if (filePath) onSubmit(filePath);
}}
>
- <div className="grid grid-cols-[1fr_2fr_1fr] border-t border-border gap-x-2 pt-3 w-full items-center compact:grid-cols-1 compact:gap-2">
+ <div className="grid grid-cols-[1fr_2fr_1fr] border-t border-border gap-x-2 pt-3 w-full items-center max-md:grid-cols-1 max-md:gap-2">
<p className="text-muted-foreground self-center">{attribute.name}</p>
<div>
<Hidden name="type" value="file" />
diff --git a/apps/erp/app/modules/accounting/ui/AccountDefaults/AccountDefaultsForm.tsx b/apps/erp/app/modules/accounting/ui/AccountDefaults/AccountDefaultsForm.tsx
index d6e48efc3b..83c1d3ab99 100644
--- a/apps/erp/app/modules/accounting/ui/AccountDefaults/AccountDefaultsForm.tsx
+++ b/apps/erp/app/modules/accounting/ui/AccountDefaults/AccountDefaultsForm.tsx
@@ -592,7 +592,7 @@ const AccountDefaultsForm = ({
>
<Hidden name="intent" value="all" />
<div className="rounded-lg border border-border bg-card">
- <div className="flex items-center justify-between border-b border-border p-6 compact:flex-col compact:items-start compact:gap-3 compact:p-4">
+ <div className="flex items-center justify-between border-b border-border p-6 max-md:flex-col max-md:items-start max-md:gap-3 max-md:p-4">
<div>
<Heading as="h1" size="h3">
<Trans>Default Accounts</Trans>
@@ -621,13 +621,13 @@ const AccountDefaultsForm = ({
</Button>
</HStack>
</div>
- <div className="flex flex-col gap-8 p-6 compact:gap-6 compact:p-4">
+ <div className="flex flex-col gap-8 p-6 max-md:gap-6 max-md:p-4">
{categoryGroups.map((group) => (
<div
key={group.id}
- className="border border-border rounded-lg compact:border-0"
+ className="border border-border rounded-lg max-md:border-0"
>
- <div className="py-6 px-4 border-b border-border compact:px-0 compact:pt-0 compact:pb-3">
+ <div className="py-6 px-4 border-b border-border max-md:px-0 max-md:pt-0 max-md:pb-3">
<h2 className="text-base font-semibold text-foreground">
{group.title}
</h2>
@@ -635,13 +635,13 @@ const AccountDefaultsForm = ({
{group.description}
</p>
</div>
- <div className="flex flex-col gap-3 p-4 compact:gap-5 compact:px-0">
+ <div className="flex flex-col gap-3 p-4 max-md:gap-5 max-md:px-0">
{group.fields.map((field) => (
<div
key={field.name}
- className="group rounded-lg border border-border p-4 transition-colors hover:border-muted-foreground/30 compact:border-0 compact:p-0"
+ className="group rounded-lg border border-border p-4 transition-colors hover:border-muted-foreground/30 max-md:border-0 max-md:p-0"
>
- <div className="flex items-start justify-between gap-4 compact:flex-col compact:items-stretch compact:gap-2">
+ <div className="flex items-start justify-between gap-4 max-md:flex-col max-md:items-stretch max-md:gap-2">
<div className="flex-1 min-w-0">
<div className="flex items-center gap-2 mb-1">
<h3 className="text-sm font-medium text-foreground">
@@ -664,7 +664,7 @@ const AccountDefaultsForm = ({
{field.description}
</p>
</div>
- <div className="flex-shrink-0 w-64 compact:w-full">
+ <div className="flex-shrink-0 w-64 max-md:w-full">
<Combobox
name={field.name}
options={
diff --git a/apps/erp/app/modules/accounting/ui/ChartOfAccounts/ChartOfAccountsTableFilters.tsx b/apps/erp/app/modules/accounting/ui/ChartOfAccounts/ChartOfAccountsTableFilters.tsx
index 1d6f7641fa..2755d03f3c 100644
--- a/apps/erp/app/modules/accounting/ui/ChartOfAccounts/ChartOfAccountsTableFilters.tsx
+++ b/apps/erp/app/modules/accounting/ui/ChartOfAccounts/ChartOfAccountsTableFilters.tsx
@@ -13,7 +13,7 @@ import {
Input,
InputGroup,
InputLeftElement,
- useCompact
+ useViewport
} from "@carbon/react";
import { Trans, useLingui } from "@lingui/react/macro";
import { LuCheckCheck, LuPlus, LuSearch, LuWallet, LuX } from "react-icons/lu";
@@ -48,14 +48,14 @@ const ChartOfAccountsTableFilters = ({
const { t } = useLingui();
const [params, setParams] = useUrlParams();
const permissions = usePermissions();
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
const newGroupTo = `new-group?${params.toString()}`;
const newAccountTo = `new?${params.toString()}`;
return (
- <div className="flex px-4 py-3 items-center space-x-4 justify-between bg-card border-b border-border w-full compact:flex-wrap compact:gap-y-1 compact:space-x-0 compact:px-0 compact:py-1.5">
- <HStack className="compact:w-full compact:flex-nowrap compact:overflow-x-auto compact:scrollbar-hide compact:scroll-fade-x compact:whitespace-nowrap compact:px-4 compact:py-1.5 compact:[&>*]:shrink-0">
- <InputGroup size="sm" className="w-64 compact:w-48">
+ <div className="flex px-4 py-3 items-center space-x-4 justify-between bg-card border-b border-border w-full max-md:flex-wrap max-md:gap-y-1 max-md:space-x-0 max-md:px-0 max-md:py-1.5">
+ <HStack className="max-md:w-full max-md:flex-nowrap max-md:overflow-x-auto max-md:scrollbar-hide max-md:scroll-fade-x max-md:whitespace-nowrap max-md:px-4 max-md:py-1.5 max-md:[&>*]:shrink-0">
+ <InputGroup size="sm" className="w-64 max-md:w-48">
<InputLeftElement>
<LuSearch className="h-4 w-4 text-muted-foreground" />
</InputLeftElement>
@@ -81,7 +81,7 @@ const ChartOfAccountsTableFilters = ({
</Button>
)}
</HStack>
- <HStack className="compact:ml-auto compact:mr-4">
+ <HStack className="max-md:ml-auto max-md:mr-4">
{openingBalanceMode ? (
// Entering opening balances: Add Group / Add Account are hidden; only
// Cancel + Post remain.
@@ -101,7 +101,7 @@ const ChartOfAccountsTableFilters = ({
) : (
<>
{permissions.can("create", "accounting") &&
- (isCompact ? (
+ (isPhone ? (
// Phones: one app bar "+" opens both Add actions, instead of
// two identical "+" icons.
<AppBarActions>
diff --git a/apps/erp/app/modules/accounting/ui/ChartOfAccounts/ChartOfAccountsTree.tsx b/apps/erp/app/modules/accounting/ui/ChartOfAccounts/ChartOfAccountsTree.tsx
index b2ea5277ef..7b4b853303 100644
--- a/apps/erp/app/modules/accounting/ui/ChartOfAccounts/ChartOfAccountsTree.tsx
+++ b/apps/erp/app/modules/accounting/ui/ChartOfAccounts/ChartOfAccountsTree.tsx
@@ -188,7 +188,7 @@ const ChartOfAccountsTree = memo(
</span>
) : (
accountingEnabled && (
- <span className="w-32 text-right px-4 compact:w-24 compact:pl-0">
+ <span className="w-32 text-right px-4 max-md:w-24 max-md:pl-0">
{params.get("startDate") ? t`Net Change` : t`Balance`}
</span>
)
@@ -214,7 +214,7 @@ const ChartOfAccountsTree = memo(
return (
<div
className={cn(
- "flex h-8 cursor-pointer items-center overflow-hidden pr-4 text-sm group/row compact:h-11",
+ "flex h-8 cursor-pointer items-center overflow-hidden pr-4 text-sm group/row max-md:h-11",
state.selected
? "bg-muted hover:bg-accent"
: "bg-transparent hover:bg-accent",
@@ -318,13 +318,13 @@ const ChartOfAccountsTree = memo(
) : (
accountingEnabled &&
(isGroup ? (
- <span className="w-32 text-right tabular-nums shrink-0 text-muted-foreground compact:w-24">
+ <span className="w-32 text-right tabular-nums shrink-0 text-muted-foreground max-md:w-24">
{formatCurrency(balance)}
</span>
) : (
<button
type="button"
- className="w-32 compact:w-24 text-right tabular-nums shrink-0 text-muted-foreground hover:text-foreground hover:underline underline-offset-2 decoration-border"
+ className="w-32 max-md:w-24 text-right tabular-nums shrink-0 text-muted-foreground hover:text-foreground hover:underline underline-offset-2 decoration-border"
onClick={(e) => {
e.stopPropagation();
openLedger(account.id as string);
@@ -340,10 +340,10 @@ const ChartOfAccountsTree = memo(
<DropdownMenu>
<DropdownMenuTrigger asChild>
<button
- className="ml-1 shrink-0 rounded-md p-1 opacity-0 transition-opacity hover:bg-accent group-hover/row:opacity-100 compact:-mr-3 compact:flex compact:size-11 compact:items-center compact:justify-center compact:opacity-100"
+ className="ml-1 shrink-0 rounded-md p-1 opacity-0 transition-opacity hover:bg-accent group-hover/row:opacity-100 max-md:-mr-3 max-md:flex max-md:size-11 max-md:items-center max-md:justify-center max-md:opacity-100"
onClick={(e) => e.stopPropagation()}
>
- <LuEllipsisVertical className="h-3.5 w-3.5 text-muted-foreground compact:size-5" />
+ <LuEllipsisVertical className="h-3.5 w-3.5 text-muted-foreground max-md:size-5" />
</button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
diff --git a/apps/erp/app/modules/accounting/ui/CostCenters/CostCenterNode.tsx b/apps/erp/app/modules/accounting/ui/CostCenters/CostCenterNode.tsx
index ad277ef7be..1262292fc5 100644
--- a/apps/erp/app/modules/accounting/ui/CostCenters/CostCenterNode.tsx
+++ b/apps/erp/app/modules/accounting/ui/CostCenters/CostCenterNode.tsx
@@ -64,7 +64,7 @@ function CostCenterNodeComponent({
<DropdownMenu>
<DropdownMenuTrigger asChild>
<button
- className="ml-auto shrink-0 rounded-md p-1 opacity-0 transition-opacity hover:bg-accent group-hover:opacity-100 focus:opacity-100 compact:opacity-100 compact:hit-area"
+ className="ml-auto shrink-0 rounded-md p-1 opacity-0 transition-opacity hover:bg-accent group-hover:opacity-100 focus:opacity-100 max-md:opacity-100 max-md:hit-area"
aria-label={t`Actions`}
>
<LuEllipsisVertical className="size-3.5 text-muted-foreground" />
diff --git a/apps/erp/app/modules/accounting/ui/CostCenters/CostCentersTreeView.tsx b/apps/erp/app/modules/accounting/ui/CostCenters/CostCentersTreeView.tsx
index e53d90fe69..539f905516 100644
--- a/apps/erp/app/modules/accounting/ui/CostCenters/CostCentersTreeView.tsx
+++ b/apps/erp/app/modules/accounting/ui/CostCenters/CostCentersTreeView.tsx
@@ -2,7 +2,7 @@
// Carbon (github.com/crbnos/carbon). Modified or adapted versions of this file,
// including ports, remain AGPLv3; serving them over a network requires releasing their source.
-import { useCompact } from "@carbon/react";
+import { useViewport } from "@carbon/react";
import {
Background,
BackgroundVariant,
@@ -71,7 +71,7 @@ export function CostCentersTreeView({
return { initialNodes: layoutedNodes, initialEdges: layoutedEdges };
}, [costCenters, onEdit, onDelete, onAddChild]);
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
const [nodes, setNodes, onNodesChange] = useNodesState(initialNodes);
const [edges, setEdges, onEdgesChange] = useEdgesState(initialEdges);
@@ -81,7 +81,7 @@ export function CostCentersTreeView({
}, [initialNodes, initialEdges, setNodes, setEdges]);
return (
- <div className="h-[calc(100dvh-(var(--header-height))-61px)] w-full overflow-hidden compact:h-[calc(100dvh-var(--topbar-height)-var(--content-inset,0px)-61px)] bg-card">
+ <div className="h-[calc(100dvh-(var(--header-height))-61px)] w-full overflow-hidden max-md:h-[calc(100dvh-var(--topbar-height)-var(--content-inset,0px)-61px)] bg-card">
<ReactFlow
nodes={nodes}
edges={edges}
@@ -94,7 +94,7 @@ export function CostCentersTreeView({
padding: 0.3,
maxZoom: 1.2,
// Phones: never fit below a readable size; the user pans instead.
- minZoom: isCompact ? 0.75 : 0.3
+ minZoom: isPhone ? 0.75 : 0.3
}}
nodesDraggable={false}
nodesConnectable={false}
@@ -107,7 +107,7 @@ export function CostCentersTreeView({
>
<Controls
showInteractive={false}
- className="!bg-card !border-border !shadow-sm compact:!left-auto compact:!right-0 compact:[&>button]:!size-11 [&>button]:!bg-card [&>button]:!border-border [&>button]:!text-foreground [&>button:hover]:!bg-accent"
+ className="!bg-card !border-border !shadow-sm max-md:!left-auto max-md:!right-0 max-md:[&>button]:!size-11 [&>button]:!bg-card [&>button]:!border-border [&>button]:!text-foreground [&>button:hover]:!bg-accent"
/>
<Background
variant={BackgroundVariant.Dots}
diff --git a/apps/erp/app/modules/accounting/ui/FiscalYear/FiscalYearSettingsForm.tsx b/apps/erp/app/modules/accounting/ui/FiscalYear/FiscalYearSettingsForm.tsx
index 0677491cd5..c4002f7415 100644
--- a/apps/erp/app/modules/accounting/ui/FiscalYear/FiscalYearSettingsForm.tsx
+++ b/apps/erp/app/modules/accounting/ui/FiscalYear/FiscalYearSettingsForm.tsx
@@ -74,7 +74,7 @@ const FiscalYearSettingsForm = ({
className="w-full"
>
<div className="rounded-lg border border-border bg-card">
- <div className="flex items-center justify-between border-b border-border p-6 compact:flex-col compact:items-start compact:gap-3 compact:p-4">
+ <div className="flex items-center justify-between border-b border-border p-6 max-md:flex-col max-md:items-start max-md:gap-3 max-md:p-4">
<div>
<Heading as="h1" size="h3">
<Trans>Fiscal Year Settings</Trans>
@@ -94,13 +94,13 @@ const FiscalYearSettingsForm = ({
</Button>
</HStack>
</div>
- <div className="flex flex-col gap-3 p-6 compact:gap-5 compact:p-4">
+ <div className="flex flex-col gap-3 p-6 max-md:gap-5 max-md:p-4">
{fields.map((field) => (
<div
key={field.name}
- className="group rounded-lg border border-border p-4 transition-colors hover:border-muted-foreground/30 compact:border-0 compact:p-0"
+ className="group rounded-lg border border-border p-4 transition-colors hover:border-muted-foreground/30 max-md:border-0 max-md:p-0"
>
- <div className="flex items-start justify-between gap-4 compact:flex-col compact:items-stretch compact:gap-2">
+ <div className="flex items-start justify-between gap-4 max-md:flex-col max-md:items-stretch max-md:gap-2">
<div className="flex-1 min-w-0">
<h3 className="text-sm font-medium text-foreground mb-1">
<LabelWithHelp variant="inline" termId={field.termId}>
@@ -119,7 +119,7 @@ const FiscalYearSettingsForm = ({
</p>
)}
</div>
- <div className="flex-shrink-0 w-64 compact:w-full">
+ <div className="flex-shrink-0 w-64 max-md:w-full">
<Select
name={field.name}
options={months.map((month) => ({
diff --git a/apps/erp/app/modules/accounting/ui/JournalEntries/JournalEntriesTable.tsx b/apps/erp/app/modules/accounting/ui/JournalEntries/JournalEntriesTable.tsx
index 86ef9240e6..6c07acd0a9 100644
--- a/apps/erp/app/modules/accounting/ui/JournalEntries/JournalEntriesTable.tsx
+++ b/apps/erp/app/modules/accounting/ui/JournalEntries/JournalEntriesTable.tsx
@@ -7,8 +7,8 @@ import {
MENU_ITEM_SHORTCUTS,
MenuIcon,
MenuItem,
- useCompact,
- useDisclosure
+ useDisclosure,
+ useViewport
} from "@carbon/react";
import { Trans, useLingui } from "@lingui/react/macro";
import type { ColumnDef } from "@tanstack/react-table";
@@ -68,7 +68,7 @@ const JournalEntriesTable = memo(
const [selectedEntry, setSelectedEntry] =
useState<JournalEntryListItem | null>(null);
const deleteModal = useDisclosure();
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
const columns = useMemo<ColumnDef<JournalEntryListItem>[]>(() => {
const defaultColumns: ColumnDef<JournalEntryListItem>[] = [
@@ -102,7 +102,7 @@ const JournalEntriesTable = memo(
header: t`Description`,
cell: ({ row }) =>
// Phones: plain text on the row's context line (P3).
- isCompact ? (
+ isPhone ? (
row.original.description || "—"
) : (
<HStack className="py-1" spacing={2}>
@@ -240,7 +240,7 @@ const JournalEntriesTable = memo(
}
];
return defaultColumns;
- }, [currencyFormatter, isCompact, people, t]);
+ }, [currencyFormatter, isPhone, people, t]);
const renderContextMenu = useCallback(
(row: JournalEntryListItem) => {
diff --git a/apps/erp/app/modules/accounting/ui/JournalEntries/JournalEntryForm.tsx b/apps/erp/app/modules/accounting/ui/JournalEntries/JournalEntryForm.tsx
index 9ffad1e0de..4a48283897 100644
--- a/apps/erp/app/modules/accounting/ui/JournalEntries/JournalEntryForm.tsx
+++ b/apps/erp/app/modules/accounting/ui/JournalEntries/JournalEntryForm.tsx
@@ -207,7 +207,7 @@ const JournalEntryForm = ({
return (
<>
<RecordHeroTarget bleed />
- <Card className="compact:mt-4">
+ <Card className="max-md:mt-4">
<ValidatedForm
id={formId}
method="post"
@@ -285,7 +285,7 @@ const JournalEntryForm = ({
<VStack spacing={4} className="w-full">
{/* Entry Details */}
<div className="grid gap-4 grid-cols-1 md:grid-cols-2 lg:grid-cols-3 w-full">
- <div className="col-span-3 compact:col-span-1">
+ <div className="col-span-3 max-md:col-span-1">
<Input autoFocus name="description" label={t`Description`} />
</div>
<Input
@@ -313,12 +313,12 @@ const JournalEntryForm = ({
{/* Journal Lines + Totals */}
<div className="rounded-lg border border-border overflow-hidden w-full">
{/* Column Headers */}
- <div className="grid grid-cols-[auto_1fr_140px_140px_40px] items-center gap-3 px-4 py-2.5 text-sm text-muted-foreground font-medium bg-muted/50 border-b border-border compact:grid-cols-[24px_minmax(0,1fr)_minmax(0,1fr)_40px]">
+ <div className="grid grid-cols-[auto_1fr_140px_140px_40px] items-center gap-3 px-4 py-2.5 text-sm text-muted-foreground font-medium bg-muted/50 border-b border-border max-md:grid-cols-[24px_minmax(0,1fr)_minmax(0,1fr)_40px]">
<div className="w-6" />
- <div className="pl-3 compact:col-span-3">
+ <div className="pl-3 max-md:col-span-3">
<Trans>Account & Details</Trans>
</div>
- <div className="text-right pr-3 compact:col-start-2">
+ <div className="text-right pr-3 max-md:col-start-2">
<LabelWithHelp
variant="inline"
termId="journal-line-debit"
@@ -372,9 +372,9 @@ const JournalEntryForm = ({
)}
{/* Totals */}
- <div className="grid grid-cols-[auto_1fr_140px_140px_40px] items-center gap-3 px-4 py-3 bg-muted/50 border-t border-border compact:grid-cols-[24px_minmax(0,1fr)_minmax(0,1fr)_40px]">
+ <div className="grid grid-cols-[auto_1fr_140px_140px_40px] items-center gap-3 px-4 py-3 bg-muted/50 border-t border-border max-md:grid-cols-[24px_minmax(0,1fr)_minmax(0,1fr)_40px]">
<div className="w-6" />
- <div className="flex items-center gap-2 text-sm font-medium compact:col-span-3 compact:flex-wrap">
+ <div className="flex items-center gap-2 text-sm font-medium max-md:col-span-3 max-md:flex-wrap">
Totals
{isBalanced && totalDebits > 0 ? (
<Status color="green">Balanced</Status>
@@ -394,7 +394,7 @@ const JournalEntryForm = ({
</Status>
)}
</div>
- <div className="text-right font-mono text-sm tabular-nums compact:col-start-2">
+ <div className="text-right font-mono text-sm tabular-nums max-md:col-start-2">
{currencyFormatter.format(totalDebits)}
</div>
<div className="text-right font-mono text-sm tabular-nums">
diff --git a/apps/erp/app/modules/accounting/ui/JournalEntries/JournalLineRow.tsx b/apps/erp/app/modules/accounting/ui/JournalEntries/JournalLineRow.tsx
index ecda377260..462698783d 100644
--- a/apps/erp/app/modules/accounting/ui/JournalEntries/JournalLineRow.tsx
+++ b/apps/erp/app/modules/accounting/ui/JournalEntries/JournalLineRow.tsx
@@ -70,14 +70,14 @@ const JournalLineRow = ({
return (
<div className="group">
- <div className="grid grid-cols-[auto_1fr_140px_140px_40px] items-start gap-3 py-4 px-4 transition-colors hover:bg-muted/30 compact:grid-cols-[24px_minmax(0,1fr)_minmax(0,1fr)_40px]">
+ <div className="grid grid-cols-[auto_1fr_140px_140px_40px] items-start gap-3 py-4 px-4 transition-colors hover:bg-muted/30 max-md:grid-cols-[24px_minmax(0,1fr)_minmax(0,1fr)_40px]">
{/* Row number */}
<div className="flex h-9 w-6 items-center justify-center text-xs font-medium text-muted-foreground tabular-nums">
{index + 1}
</div>
{/* Account and Description */}
- <div className="space-y-2 compact:col-span-3 compact:min-w-0">
+ <div className="space-y-2 max-md:col-span-3 max-md:min-w-0">
<AccountControlled
value={line.accountId}
onChange={handleAccountChange}
@@ -106,7 +106,7 @@ const JournalLineRow = ({
{/* Debit */}
<NumberField
- className="compact:col-start-2"
+ className="max-md:col-start-2"
value={line.debit ?? 0}
onChange={handleDebitChange}
formatOptions={INPUT_FORMAT.rate(currencyCode, currencyDecimals)}
@@ -115,7 +115,7 @@ const JournalLineRow = ({
isReadOnly={isDisabled}
>
<NumberInput
- className="text-right font-mono tabular-nums compact:px-3"
+ className="text-right font-mono tabular-nums max-md:px-3"
isReadOnly={isDisabled}
/>
</NumberField>
@@ -130,7 +130,7 @@ const JournalLineRow = ({
isReadOnly={isDisabled}
>
<NumberInput
- className="text-right font-mono tabular-nums compact:px-3"
+ className="text-right font-mono tabular-nums max-md:px-3"
isReadOnly={isDisabled}
/>
</NumberField>
@@ -144,7 +144,7 @@ const JournalLineRow = ({
variant="ghost"
onClick={onDelete}
isDisabled={!canDelete}
- className="size-8 p-0 text-muted-foreground opacity-0 transition-opacity hover:text-destructive group-hover:opacity-100 disabled:opacity-0 compact:opacity-100"
+ className="size-8 p-0 text-muted-foreground opacity-0 transition-opacity hover:text-destructive group-hover:opacity-100 disabled:opacity-0 max-md:opacity-100"
/>
)}
</div>
diff --git a/apps/erp/app/modules/accounting/ui/Reports/AccountLedgerDrawer.tsx b/apps/erp/app/modules/accounting/ui/Reports/AccountLedgerDrawer.tsx
index d34dc55b16..222cca0bcf 100644
--- a/apps/erp/app/modules/accounting/ui/Reports/AccountLedgerDrawer.tsx
+++ b/apps/erp/app/modules/accounting/ui/Reports/AccountLedgerDrawer.tsx
@@ -116,7 +116,7 @@ const AccountLedgerDrawer = ({
<span>{periodLabel}</span>
</div>
</DrawerHeader>
- <DrawerBody className="p-0 compact:p-0">
+ <DrawerBody className="p-0 max-md:p-0">
<div className="grid w-full grid-cols-3 divide-x divide-border border-b border-border">
<div className="px-4 py-3">
<p className="text-xs text-muted-foreground">
diff --git a/apps/erp/app/modules/accounting/ui/Reports/ExecutivePnlSummary.tsx b/apps/erp/app/modules/accounting/ui/Reports/ExecutivePnlSummary.tsx
index 468c0cba41..d5430f9833 100644
--- a/apps/erp/app/modules/accounting/ui/Reports/ExecutivePnlSummary.tsx
+++ b/apps/erp/app/modules/accounting/ui/Reports/ExecutivePnlSummary.tsx
@@ -2,7 +2,7 @@
// Carbon (github.com/crbnos/carbon). Modified or adapted versions of this file,
// including ports, remain AGPLv3; serving them over a network requires releasing their source.
-import { cn, useCompact } from "@carbon/react";
+import { cn, useViewport } from "@carbon/react";
import type {
ReportColumnGranularity,
ReportPeriodBucket
@@ -46,8 +46,8 @@ const ExecutivePnlSummary = memo(
parentCurrency
}: ExecutivePnlSummaryProps) => {
const { t } = useLingui();
- const isCompact = useCompact();
- const accountColumnWidth = isCompact
+ const { isPhone } = useViewport();
+ const accountColumnWidth = isPhone
? COMPACT_ACCOUNT_COLUMN_WIDTH
: ACCOUNT_COLUMN_WIDTH;
const { locale } = useLocale();
@@ -137,7 +137,7 @@ const ExecutivePnlSummary = memo(
<div
ref={scrollRef}
- className="flex-1 overflow-auto compact:scroll-fade-x"
+ className="flex-1 overflow-auto max-md:scroll-fade-x"
>
<div style={{ minWidth: rowWidth }}>
{rows.map((row) => (
diff --git a/apps/erp/app/modules/accounting/ui/Reports/MultiPeriodStatementTree.tsx b/apps/erp/app/modules/accounting/ui/Reports/MultiPeriodStatementTree.tsx
index b19a0f192c..0e49fab3ef 100644
--- a/apps/erp/app/modules/accounting/ui/Reports/MultiPeriodStatementTree.tsx
+++ b/apps/erp/app/modules/accounting/ui/Reports/MultiPeriodStatementTree.tsx
@@ -2,7 +2,7 @@
// Carbon (github.com/crbnos/carbon). Modified or adapted versions of this file,
// including ports, remain AGPLv3; serving them over a network requires releasing their source.
-import { cn, useCompact } from "@carbon/react";
+import { cn, useViewport } from "@carbon/react";
import type {
ReportColumnGranularity,
ReportPeriodBucket
@@ -88,8 +88,8 @@ const MultiPeriodStatementTree = memo(
ledgerPath
}: MultiPeriodStatementTreeProps) => {
const { t } = useLingui();
- const isCompact = useCompact();
- const accountColumnWidth = isCompact
+ const { isPhone } = useViewport();
+ const accountColumnWidth = isPhone
? COMPACT_ACCOUNT_COLUMN_WIDTH
: ACCOUNT_COLUMN_WIDTH;
const { locale } = useLocale();
@@ -185,7 +185,7 @@ const MultiPeriodStatementTree = memo(
virtualizer={virtualizer}
parentRef={parentRef}
scrollRef={scrollRef}
- parentClassName="flex-1 overflow-x-auto compact:scroll-fade-x"
+ parentClassName="flex-1 overflow-x-auto max-md:scroll-fade-x"
contentMinWidth={rowWidth}
renderNode={({ node, state }) => {
const account = node.data;
@@ -255,7 +255,7 @@ const MultiPeriodStatementTree = memo(
<div
className={cn(
"w-5 h-5 flex items-center justify-center mr-2 shrink-0",
- !isGroup && "compact:hidden"
+ !isGroup && "max-md:hidden"
)}
>
{isGroup &&
diff --git a/apps/erp/app/modules/accounting/ui/Reports/PivotControlBar.tsx b/apps/erp/app/modules/accounting/ui/Reports/PivotControlBar.tsx
index 022788a8a7..eb37016234 100644
--- a/apps/erp/app/modules/accounting/ui/Reports/PivotControlBar.tsx
+++ b/apps/erp/app/modules/accounting/ui/Reports/PivotControlBar.tsx
@@ -229,10 +229,10 @@ const PivotControlBar = ({
};
return (
- <div className="flex flex-wrap px-4 py-3 items-center gap-2 justify-between bg-card border-b border-border w-full compact:gap-1 compact:px-0 compact:py-1.5">
+ <div className="flex flex-wrap px-4 py-3 items-center gap-2 justify-between bg-card border-b border-border w-full max-md:gap-1 max-md:px-0 max-md:py-1.5">
{/* Phones: the scope controls form one sideways-scrolling
chip row; Download and the views menu sit on the line below. */}
- <HStack className="flex-wrap gap-y-2 compact:w-full compact:flex-nowrap compact:overflow-x-auto compact:scrollbar-hide compact:scroll-fade-x compact:whitespace-nowrap compact:px-4 compact:py-1.5 compact:[&>*]:shrink-0">
+ <HStack className="flex-wrap gap-y-2 max-md:w-full max-md:flex-nowrap max-md:overflow-x-auto max-md:scrollbar-hide max-md:scroll-fade-x max-md:whitespace-nowrap max-md:px-4 max-md:py-1.5 max-md:[&>*]:shrink-0">
<PeriodSelector variant="range" />
<DropdownMenu>
<DropdownMenuTrigger asChild>
@@ -445,7 +445,7 @@ const PivotControlBar = ({
</Button>
)}
</HStack>
- <HStack className="gap-2 compact:ml-auto compact:px-4">
+ <HStack className="gap-2 max-md:ml-auto max-md:px-4">
<Button
variant="secondary"
leftIcon={<LuDownload />}
diff --git a/apps/erp/app/modules/accounting/ui/Reports/PivotLinesDrawer.tsx b/apps/erp/app/modules/accounting/ui/Reports/PivotLinesDrawer.tsx
index 614f56e759..e7b841c6f3 100644
--- a/apps/erp/app/modules/accounting/ui/Reports/PivotLinesDrawer.tsx
+++ b/apps/erp/app/modules/accounting/ui/Reports/PivotLinesDrawer.tsx
@@ -86,7 +86,7 @@ const PivotLinesDrawer = ({
<DrawerHeader>
<DrawerTitle>{title}</DrawerTitle>
</DrawerHeader>
- <DrawerBody className="p-0 compact:p-0">
+ <DrawerBody className="p-0 max-md:p-0">
{isLoading ? (
<div className="flex w-full items-center justify-center py-16">
<Spinner size={24} />
diff --git a/apps/erp/app/modules/accounting/ui/Reports/PivotTree.tsx b/apps/erp/app/modules/accounting/ui/Reports/PivotTree.tsx
index 7d511e2152..6557d73a00 100644
--- a/apps/erp/app/modules/accounting/ui/Reports/PivotTree.tsx
+++ b/apps/erp/app/modules/accounting/ui/Reports/PivotTree.tsx
@@ -2,7 +2,7 @@
// Carbon (github.com/crbnos/carbon). Modified or adapted versions of this file,
// including ports, remain AGPLv3; serving them over a network requires releasing their source.
-import { cn, useCompact } from "@carbon/react";
+import { cn, useViewport } from "@carbon/react";
import { Trans, useLingui } from "@lingui/react/macro";
import { useLocale } from "@react-aria/i18n";
import { useVirtualizer } from "@tanstack/react-virtual";
@@ -84,8 +84,8 @@ function formatMeasureValue(value: number, measure: PivotMeasure): string {
const PivotTree = memo(
({ pivot, state, columnLabels, onCellClick }: PivotTreeProps) => {
const { t } = useLingui();
- const isCompact = useCompact();
- const rowColumnWidth = isCompact
+ const { isPhone } = useViewport();
+ const rowColumnWidth = isPhone
? COMPACT_ROW_COLUMN_WIDTH
: ROW_COLUMN_WIDTH;
const { locale } = useLocale();
@@ -330,7 +330,7 @@ const PivotTree = memo(
virtualizer={virtualizer}
parentRef={parentRef}
scrollRef={scrollRef}
- parentClassName="flex-1 overflow-x-auto compact:scroll-fade-x"
+ parentClassName="flex-1 overflow-x-auto max-md:scroll-fade-x"
contentMinWidth={rowWidth}
renderNode={({ node, state: nodeState }) => {
const row = node.data;
diff --git a/apps/erp/app/modules/accounting/ui/Reports/PurchaseLinesDrawer.tsx b/apps/erp/app/modules/accounting/ui/Reports/PurchaseLinesDrawer.tsx
index 297342d1a1..2d2607e3f7 100644
--- a/apps/erp/app/modules/accounting/ui/Reports/PurchaseLinesDrawer.tsx
+++ b/apps/erp/app/modules/accounting/ui/Reports/PurchaseLinesDrawer.tsx
@@ -84,7 +84,7 @@ const PurchaseLinesDrawer = ({
<DrawerHeader>
<DrawerTitle>{title}</DrawerTitle>
</DrawerHeader>
- <DrawerBody className="p-0 compact:p-0">
+ <DrawerBody className="p-0 max-md:p-0">
{isLoading ? (
<div className="flex w-full items-center justify-center py-16">
<Spinner size={24} />
diff --git a/apps/erp/app/modules/accounting/ui/Reports/PurchasesControlBar.tsx b/apps/erp/app/modules/accounting/ui/Reports/PurchasesControlBar.tsx
index c1a63eecee..ab86a8438c 100644
--- a/apps/erp/app/modules/accounting/ui/Reports/PurchasesControlBar.tsx
+++ b/apps/erp/app/modules/accounting/ui/Reports/PurchasesControlBar.tsx
@@ -154,10 +154,10 @@ const PurchasesControlBar = ({
};
return (
- <div className="flex flex-wrap px-4 py-3 items-center gap-2 justify-between bg-card border-b border-border w-full compact:gap-1 compact:px-0 compact:py-1.5">
+ <div className="flex flex-wrap px-4 py-3 items-center gap-2 justify-between bg-card border-b border-border w-full max-md:gap-1 max-md:px-0 max-md:py-1.5">
{/* Phones: the scope controls form one sideways-scrolling chip
row; Download sits on the line below. */}
- <HStack className="flex-wrap gap-y-2 compact:w-full compact:flex-nowrap compact:overflow-x-auto compact:scrollbar-hide compact:scroll-fade-x compact:whitespace-nowrap compact:px-4 compact:py-1.5 compact:[&>*]:shrink-0">
+ <HStack className="flex-wrap gap-y-2 max-md:w-full max-md:flex-nowrap max-md:overflow-x-auto max-md:scrollbar-hide max-md:scroll-fade-x max-md:whitespace-nowrap max-md:px-4 max-md:py-1.5 max-md:[&>*]:shrink-0">
<PeriodSelector variant="range" />
<DropdownMenu>
<DropdownMenuTrigger asChild>
@@ -326,7 +326,7 @@ const PurchasesControlBar = ({
variant="secondary"
leftIcon={<LuDownload />}
onClick={onDownload}
- className="compact:ml-auto compact:mr-4"
+ className="max-md:ml-auto max-md:mr-4"
>
{t`Download`}
</Button>
diff --git a/apps/erp/app/modules/accounting/ui/Reports/ReportFilters.tsx b/apps/erp/app/modules/accounting/ui/Reports/ReportFilters.tsx
index 6bf56d8f20..6492495238 100644
--- a/apps/erp/app/modules/accounting/ui/Reports/ReportFilters.tsx
+++ b/apps/erp/app/modules/accounting/ui/Reports/ReportFilters.tsx
@@ -87,12 +87,12 @@ const ReportFilters = ({
};
return (
- <div className="flex px-4 py-3 items-center space-x-4 justify-between bg-card border-b border-border w-full compact:flex-wrap compact:gap-y-1 compact:space-x-0 compact:px-0 compact:py-1.5">
+ <div className="flex px-4 py-3 items-center space-x-4 justify-between bg-card border-b border-border w-full max-md:flex-wrap max-md:gap-y-1 max-md:space-x-0 max-md:px-0 max-md:py-1.5">
{/* Phones: search, company, period and columns form one
sideways-scrolling chip row; Download sits on the line below. */}
- <HStack className="compact:w-full compact:flex-nowrap compact:overflow-x-auto compact:scrollbar-hide compact:scroll-fade-x compact:whitespace-nowrap compact:px-4 compact:py-1.5 compact:[&>*]:shrink-0">
+ <HStack className="max-md:w-full max-md:flex-nowrap max-md:overflow-x-auto max-md:scrollbar-hide max-md:scroll-fade-x max-md:whitespace-nowrap max-md:px-4 max-md:py-1.5 max-md:[&>*]:shrink-0">
{showSearch && (
- <InputGroup size="sm" className="w-64 compact:w-48">
+ <InputGroup size="sm" className="w-64 max-md:w-48">
<InputLeftElement>
<LuSearch className="h-4 w-4 text-muted-foreground" />
</InputLeftElement>
@@ -178,7 +178,7 @@ const ReportFilters = ({
variant="secondary"
leftIcon={<LuDownload />}
onClick={onDownload}
- className="compact:ml-auto compact:mr-4"
+ className="max-md:ml-auto max-md:mr-4"
>
{t`Download`}
</Button>
diff --git a/apps/erp/app/modules/accounting/ui/Reports/TrialBalanceTree.tsx b/apps/erp/app/modules/accounting/ui/Reports/TrialBalanceTree.tsx
index 3283771246..e5a82cc705 100644
--- a/apps/erp/app/modules/accounting/ui/Reports/TrialBalanceTree.tsx
+++ b/apps/erp/app/modules/accounting/ui/Reports/TrialBalanceTree.tsx
@@ -2,7 +2,7 @@
// Carbon (github.com/crbnos/carbon). Modified or adapted versions of this file,
// including ports, remain AGPLv3; serving them over a network requires releasing their source.
-import { cn, ScrollArea, useCompact } from "@carbon/react";
+import { cn, ScrollArea, useViewport } from "@carbon/react";
import { Trans, useLingui } from "@lingui/react/macro";
import { memo, useMemo, useRef } from "react";
import {
@@ -60,7 +60,7 @@ const TrialBalanceTree = memo(
ledgerPath
}: TrialBalanceTreeProps) => {
const { t } = useLingui();
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
useRealtime("journal");
const navigate = useNavigate();
const [params] = useUrlParams();
@@ -109,11 +109,11 @@ const TrialBalanceTree = memo(
"h-[calc(100dvh-var(--header-height)-61px)] w-full",
// Phones: the viewport also scrolls sideways, with an
// edge fade, behind a sticky 150pt account column.
- "compact:[&>[data-radix-scroll-area-viewport]]:!overflow-x-auto compact:[&>[data-radix-scroll-area-viewport]]:scroll-fade-x"
+ "max-md:[&>[data-radix-scroll-area-viewport]]:!overflow-x-auto max-md:[&>[data-radix-scroll-area-viewport]]:scroll-fade-x"
)}
>
- <div className="sticky top-0 z-10 flex h-11 items-center pr-4 text-sm font-medium text-foreground/80 border-b border-border bg-card compact:w-max compact:min-w-full">
- <div className="flex-1 px-4 compact:sticky compact:left-0 compact:z-[2] compact:w-[150px] compact:flex-none compact:truncate compact:bg-card">
+ <div className="sticky top-0 z-10 flex h-11 items-center pr-4 text-sm font-medium text-foreground/80 border-b border-border bg-card max-md:w-max max-md:min-w-full">
+ <div className="flex-1 px-4 max-md:sticky max-md:left-0 max-md:z-[2] max-md:w-[150px] max-md:flex-none max-md:truncate max-md:bg-card">
<Trans>Account</Trans>
</div>
<span className="w-28 text-right px-2">
@@ -147,8 +147,8 @@ const TrialBalanceTree = memo(
parentClassName={cn(
"h-full",
// The viewport is the sideways scroller, so sticky cells pin to it.
- "compact:overflow-visible",
- showTranslated ? "compact:min-w-[806px]" : "compact:min-w-[694px]"
+ "max-md:overflow-visible",
+ showTranslated ? "max-md:min-w-[806px]" : "max-md:min-w-[694px]"
)}
renderNode={({ node, state }) => {
const account = node.data;
@@ -206,7 +206,7 @@ const TrialBalanceTree = memo(
<div
className={cn(
"w-5 h-5 flex items-center justify-center mr-2 shrink-0",
- !isGroup && "compact:hidden"
+ !isGroup && "max-md:hidden"
)}
>
{isGroup &&
@@ -232,7 +232,7 @@ const TrialBalanceTree = memo(
return (
<div
className={cn(
- "flex h-8 cursor-pointer items-center overflow-hidden pr-4 text-sm group/row compact:overflow-visible",
+ "flex h-8 cursor-pointer items-center overflow-hidden pr-4 text-sm group/row max-md:overflow-visible",
state.selected
? "bg-muted hover:bg-accent"
: "bg-transparent hover:bg-accent",
@@ -249,7 +249,7 @@ const TrialBalanceTree = memo(
>
{/* Compact: one sticky cell, so the name stays beside the
amounts while they scroll sideways. */}
- {isCompact ? (
+ {isPhone ? (
<div
className={cn(
"sticky left-0 z-[1] flex h-full w-[150px] shrink-0 items-center overflow-hidden",
diff --git a/apps/erp/app/modules/agent/ui/AgentPanel.tsx b/apps/erp/app/modules/agent/ui/AgentPanel.tsx
index fd294619e4..3de3661fe2 100644
--- a/apps/erp/app/modules/agent/ui/AgentPanel.tsx
+++ b/apps/erp/app/modules/agent/ui/AgentPanel.tsx
@@ -72,7 +72,7 @@ export function AgentPanel() {
<div
className={`fixed right-4 z-40 flex flex-col w-100 max-w-[calc(100vw-2rem)] rounded-lg border bg-background shadow-lg overflow-hidden animate-in slide-in-from-top-4 fade-in duration-200 ${
expanded ? "top-14 bottom-4" : "top-14 h-[45vh]"
- } compact:inset-0 compact:z-[60] compact:h-auto compact:w-full compact:max-w-none compact:rounded-none compact:border-0 compact:pt-safe compact:pb-safe`}
+ } max-md:inset-0 max-md:z-[60] max-md:h-auto max-md:w-full max-md:max-w-none max-md:rounded-none max-md:border-0 max-md:pt-safe max-md:pb-safe`}
>
<div className="flex items-center justify-between px-3 h-11 border-b shrink-0">
<div className="flex items-center gap-2">
diff --git a/apps/erp/app/modules/agent/ui/AgentThreadList.tsx b/apps/erp/app/modules/agent/ui/AgentThreadList.tsx
index 27c4db7517..c23a52cd6a 100644
--- a/apps/erp/app/modules/agent/ui/AgentThreadList.tsx
+++ b/apps/erp/app/modules/agent/ui/AgentThreadList.tsx
@@ -82,7 +82,7 @@ export function AgentThreadList({
<button
type="button"
aria-label="Delete chat"
- className="absolute right-1.5 top-1/2 -translate-y-1/2 rounded p-1 text-muted-foreground opacity-0 group-hover:opacity-100 focus-visible:opacity-100 hover:text-destructive hover:bg-muted transition-opacity compact:opacity-100"
+ className="absolute right-1.5 top-1/2 -translate-y-1/2 rounded p-1 text-muted-foreground opacity-0 group-hover:opacity-100 focus-visible:opacity-100 hover:text-destructive hover:bg-muted transition-opacity max-md:opacity-100"
onClick={(e) => {
e.stopPropagation();
handleDelete(t.id);
diff --git a/apps/erp/app/modules/documents/ui/Documents/DocumentCreateForm.tsx b/apps/erp/app/modules/documents/ui/Documents/DocumentCreateForm.tsx
index 527aa5b4b5..212a5acc73 100644
--- a/apps/erp/app/modules/documents/ui/Documents/DocumentCreateForm.tsx
+++ b/apps/erp/app/modules/documents/ui/Documents/DocumentCreateForm.tsx
@@ -6,7 +6,7 @@ import { useCarbon } from "@carbon/auth";
import { getCompanyPrivateBucket, storage } from "@carbon/files";
import { convertHeicToJpeg, isHeic } from "@carbon/files/media";
import { getLogger } from "@carbon/logger";
-import { File, toast, useCompact } from "@carbon/react";
+import { File, toast, useViewport } from "@carbon/react";
import { Trans, useLingui } from "@lingui/react/macro";
import { nanoid } from "nanoid";
import type { ChangeEvent } from "react";
@@ -19,7 +19,7 @@ const logger = getLogger("erp", "documentcreateform");
const DocumentCreateForm = () => {
const { t } = useLingui();
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
const submit = useSubmit();
const { carbon } = useCarbon();
const {
@@ -94,7 +94,7 @@ const DocumentCreateForm = () => {
leftIcon={<LuUpload />}
onChange={uploadFile}
// Phones: Upload is the list's one primary action.
- variant={isCompact ? "primary" : undefined}
+ variant={isPhone ? "primary" : undefined}
>
<Trans>Upload</Trans>
</File>
diff --git a/apps/erp/app/modules/documents/ui/Documents/DocumentView.tsx b/apps/erp/app/modules/documents/ui/Documents/DocumentView.tsx
index a91ab1b8a3..fec0338fc6 100644
--- a/apps/erp/app/modules/documents/ui/Documents/DocumentView.tsx
+++ b/apps/erp/app/modules/documents/ui/Documents/DocumentView.tsx
@@ -89,14 +89,14 @@ const DocumentView = ({ bucket, document }: DocumentPreviewProps) => {
defaultSize={50}
maxSize={70}
minSize={25}
- className="bg-background compact:overflow-y-auto"
+ className="bg-background max-md:overflow-y-auto"
compactFocus
>
<div className="flex items-center justify-between p-0.5">
<Button isIcon variant={"ghost"} onClick={onClose}>
<LuX className="w-4 h-4" />
</Button>
- <span className="text-sm compact:min-w-0 compact:truncate">
+ <span className="text-sm max-md:min-w-0 max-md:truncate">
{document.name}
</span>
<Button variant={"ghost"} onClick={() => download(document)}>
diff --git a/apps/erp/app/modules/documents/ui/Documents/DocumentsTable.tsx b/apps/erp/app/modules/documents/ui/Documents/DocumentsTable.tsx
index 3e2b7b4e8a..5b8fe2e3e0 100644
--- a/apps/erp/app/modules/documents/ui/Documents/DocumentsTable.tsx
+++ b/apps/erp/app/modules/documents/ui/Documents/DocumentsTable.tsx
@@ -20,8 +20,8 @@ import {
PopoverContent,
PopoverTrigger,
PrefetchLink,
- useCompact,
- useDisclosure
+ useDisclosure,
+ useViewport
} from "@carbon/react";
import { filterEmpty } from "@carbon/utils";
import { Trans, useLingui } from "@lingui/react/macro";
@@ -67,7 +67,7 @@ type DocumentsTableProps = {
const DocumentsTable = memo(
({ data, count, labels, extensions }: DocumentsTableProps) => {
const { t } = useLingui();
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
const permissions = usePermissions();
const revalidator = useRevalidator();
const [params] = useUrlParams();
@@ -228,7 +228,7 @@ const DocumentsTable = memo(
className="group flex items-center gap-1"
>
<Enumerable value={row.original.sourceDocument} />{" "}
- <span className="group-hover:opacity-100 opacity-0 transition-opacity duration-200 w-4 h-4 text-foreground compact:opacity-100">
+ <span className="group-hover:opacity-100 opacity-0 transition-opacity duration-200 w-4 h-4 text-foreground max-md:opacity-100">
<LuExternalLink />
</span>
</PrefetchLink>
@@ -513,7 +513,7 @@ const DocumentsTable = memo(
primaryAction={
permissions.can("create", "documents") &&
// Phones: uploading neither pins a file nor fills the trash.
- !(isCompact && (filter === "starred" || filter === "trash")) && (
+ !(isPhone && (filter === "starred" || filter === "trash")) && (
<DocumentCreateForm />
)
}
diff --git a/apps/erp/app/modules/inventory/ui/Inventory/InventoryItemHeader.tsx b/apps/erp/app/modules/inventory/ui/Inventory/InventoryItemHeader.tsx
index bebe0b1583..d84f9e2cb4 100644
--- a/apps/erp/app/modules/inventory/ui/Inventory/InventoryItemHeader.tsx
+++ b/apps/erp/app/modules/inventory/ui/Inventory/InventoryItemHeader.tsx
@@ -35,7 +35,7 @@ const InventoryItemHeader = ({
<Button
isIcon
variant="ghost"
- className="compact:hidden"
+ className="max-md:hidden"
onClick={() =>
navigate(`${path.to.inventory}?${params.toString()}`)
}
@@ -43,10 +43,10 @@ const InventoryItemHeader = ({
<LuX className="w-4 h-4" />
</Button>
<span className="flex items-center font-semibold text-center">
- <span className="compact:hidden">{itemReadableId}</span>{" "}
+ <span className="max-md:hidden">{itemReadableId}</span>{" "}
<Link
to={getLinkToItemDetails(itemType, itemId)}
- className="ml-2 compact:-mx-1.5 compact:-my-3.5 compact:p-3.5"
+ className="ml-2 max-md:-mx-1.5 max-md:-my-3.5 max-md:p-3.5"
>
<LuExternalLink />
</Link>
diff --git a/apps/erp/app/modules/inventory/ui/InventoryCount/InventoryCount.tsx b/apps/erp/app/modules/inventory/ui/InventoryCount/InventoryCount.tsx
index d25dbea9f8..fe01e65ef2 100644
--- a/apps/erp/app/modules/inventory/ui/InventoryCount/InventoryCount.tsx
+++ b/apps/erp/app/modules/inventory/ui/InventoryCount/InventoryCount.tsx
@@ -113,7 +113,7 @@ const InventoryCountDetails = ({
// Actions live in the table header (the `primaryAction` slot) instead of a
// dedicated detail header. Notes are surfaced via an info icon → modal.
const actions = (
- <HStack spacing={2} className="items-center compact:hidden">
+ <HStack spacing={2} className="items-center max-md:hidden">
{inventoryCount.notes && (
<RecordAction slot="overflow">
<IconButton
diff --git a/apps/erp/app/modules/inventory/ui/Kanbans/KanbansTable.tsx b/apps/erp/app/modules/inventory/ui/Kanbans/KanbansTable.tsx
index c4728a3a7a..54d4347753 100644
--- a/apps/erp/app/modules/inventory/ui/Kanbans/KanbansTable.tsx
+++ b/apps/erp/app/modules/inventory/ui/Kanbans/KanbansTable.tsx
@@ -24,7 +24,7 @@ import {
TooltipContent,
TooltipTrigger,
toast,
- useCompact,
+ useViewport,
VStack
} from "@carbon/react";
import { Trans, useLingui } from "@lingui/react/macro";
@@ -95,7 +95,7 @@ const KanbansTable = memo(
const [items] = useItems();
const [suppliers] = useSuppliers();
const locations = useLocations();
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
const columns = useMemo<ColumnDef<Kanban>[]>(
() => [
@@ -579,7 +579,7 @@ const KanbansTable = memo(
</MenuItem>
)}
{/* Phone rows drop the label links column; keep them reachable here */}
- {isCompact && kanbanOutput === "label" && (
+ {isPhone && kanbanOutput === "label" && (
<>
<MenuItem asChild>
<a
@@ -659,7 +659,7 @@ const KanbansTable = memo(
</>
);
},
- [params, permissions, items.find, isCompact, kanbanOutput]
+ [params, permissions, items.find, isPhone, kanbanOutput]
);
const renderActions = useCallback((selectedRows: typeof data) => {
diff --git a/apps/erp/app/modules/inventory/ui/PickingLists/PickingKanban.tsx b/apps/erp/app/modules/inventory/ui/PickingLists/PickingKanban.tsx
index c28b1b0d2e..76c14f0d92 100644
--- a/apps/erp/app/modules/inventory/ui/PickingLists/PickingKanban.tsx
+++ b/apps/erp/app/modules/inventory/ui/PickingLists/PickingKanban.tsx
@@ -59,11 +59,11 @@ const PickingKanban = memo(
return (
<div className="flex flex-col flex-1 min-h-0">
<ScrollArea className="flex-1">
- <div className="flex gap-0 items-start flex-row justify-start compact:px-4">
+ <div className="flex gap-0 items-start flex-row justify-start max-md:px-4">
{columns.map((column) => (
<div
key={column.id}
- className="w-[350px] max-w-full flex flex-col flex-shrink-0 bg-card/30 border-r border-border h-[calc(100dvh-var(--header-height)*2)] compact:w-[300px]"
+ className="w-[350px] max-w-full flex flex-col flex-shrink-0 bg-card/30 border-r border-border h-[calc(100dvh-var(--header-height)*2)] max-md:w-[300px]"
>
<div className="p-4 w-full font-semibold text-left flex flex-row items-center gap-2 sticky top-0 z-1 border-b border-border bg-card">
<PulsingDot inactive className="mt-1" />
diff --git a/apps/erp/app/modules/inventory/ui/PickingLists/PickingListLines.tsx b/apps/erp/app/modules/inventory/ui/PickingLists/PickingListLines.tsx
index 4b10169c75..5073876594 100644
--- a/apps/erp/app/modules/inventory/ui/PickingLists/PickingListLines.tsx
+++ b/apps/erp/app/modules/inventory/ui/PickingLists/PickingListLines.tsx
@@ -366,7 +366,7 @@ function PickingListLineItem({
return (
<div
className={cn(
- "group flex items-center justify-between gap-6 p-4 border-b compact:flex-col compact:items-stretch compact:gap-3",
+ "group flex items-center justify-between gap-6 p-4 border-b max-md:flex-col max-md:items-stretch max-md:gap-3",
isLast && "border-none"
)}
>
@@ -412,7 +412,7 @@ function PickingListLineItem({
<HStack
spacing={6}
- className="shrink-0 compact:flex-wrap compact:gap-3 compact:space-x-0"
+ className="shrink-0 max-md:flex-wrap max-md:gap-3 max-md:space-x-0"
>
{source ? (
<div className="text-base font-medium whitespace-nowrap">
diff --git a/apps/erp/app/modules/inventory/ui/PickingLists/PickingListsHeader.tsx b/apps/erp/app/modules/inventory/ui/PickingLists/PickingListsHeader.tsx
index 1f9a818d96..24889170dd 100644
--- a/apps/erp/app/modules/inventory/ui/PickingLists/PickingListsHeader.tsx
+++ b/apps/erp/app/modules/inventory/ui/PickingLists/PickingListsHeader.tsx
@@ -57,7 +57,7 @@ export function PickingListsHeader({
const locations = useLocations();
return (
- <HStack className="px-4 py-2 justify-between bg-card border-b border-border w-full compact:[&_:is(button,a)]:h-11 compact:[&_:is(button,a)]:min-w-11">
+ <HStack className="px-4 py-2 justify-between bg-card border-b border-border w-full max-md:[&_:is(button,a)]:h-11 max-md:[&_:is(button,a)]:min-w-11">
<HStack>
<Button variant="secondary" leftIcon={<LuClipboardList />} asChild>
<Link to={path.to.pickingListsTable}>
diff --git a/apps/erp/app/modules/inventory/ui/Receipts/ReceiptLines.tsx b/apps/erp/app/modules/inventory/ui/Receipts/ReceiptLines.tsx
index f1c7ee4c2a..60beb4ddcb 100644
--- a/apps/erp/app/modules/inventory/ui/Receipts/ReceiptLines.tsx
+++ b/apps/erp/app/modules/inventory/ui/Receipts/ReceiptLines.tsx
@@ -364,7 +364,7 @@ function ReceiptFixedAssetLineItem({
return (
<div
className={cn(
- "flex items-center gap-4 p-6 compact:flex-wrap compact:p-4",
+ "flex items-center gap-4 p-6 max-md:flex-wrap max-md:p-4",
className
)}
>
@@ -389,7 +389,7 @@ function ReceiptFixedAssetLineItem({
placeholder="Serial Number"
value={serialNumber}
isDisabled={isReadOnly}
- className="w-48 compact:w-full"
+ className="w-48 max-md:w-full"
onChange={(e) => setSerialNumber(e.target.value)}
onBlur={() => {
if (serialNumber !== (line.serialNumber ?? "")) {
@@ -466,11 +466,11 @@ function ReceiptLineItem({
return (
<div
className={cn(
- "flex flex-col border-b p-6 gap-6 relative compact:p-4 compact:gap-4",
+ "flex flex-col border-b p-6 gap-6 relative max-md:p-4 max-md:gap-4",
className
)}
>
- <div className="absolute top-3 right-6 compact:right-4">
+ <div className="absolute top-3 right-6 max-md:right-4">
<DropdownMenu>
<DropdownMenuTrigger asChild>
<IconButton
@@ -500,11 +500,11 @@ function ReceiptLineItem({
</DropdownMenuContent>
</DropdownMenu>
</div>
- <div className="flex flex-1 justify-between items-center w-full compact:flex-col compact:items-stretch compact:gap-4">
- <HStack spacing={4} className="w-1/2 compact:w-full">
+ <div className="flex flex-1 justify-between items-center w-full max-md:flex-col max-md:items-stretch max-md:gap-4">
+ <HStack spacing={4} className="w-1/2 max-md:w-full">
<HStack
spacing={4}
- className="flex-1 compact:flex-wrap compact:gap-4 compact:space-x-0"
+ className="flex-1 max-md:flex-wrap max-md:gap-4 max-md:space-x-0"
>
<ItemThumbnail
size="md"
@@ -513,7 +513,7 @@ function ReceiptLineItem({
/>
<VStack
spacing={0}
- className="compact:min-w-0 compact:flex-1 compact:pr-12"
+ className="max-md:min-w-0 max-md:flex-1 max-md:pr-12"
>
<span className="text-sm font-medium">{item?.name}</span>
<span className="text-xs text-muted-foreground line-clamp-2">
@@ -528,7 +528,7 @@ function ReceiptLineItem({
/>
</div>
</VStack>
- <VStack spacing={1} className="compact:w-full">
+ <VStack spacing={1} className="max-md:w-full">
<label className="text-xs text-muted-foreground">Received</label>
<NumberField
@@ -559,7 +559,7 @@ function ReceiptLineItem({
}}
>
<NumberInput
- className="disabled:bg-transparent disabled:opacity-100 min-w-[100px] compact:w-full"
+ className="disabled:bg-transparent disabled:opacity-100 min-w-[100px] max-md:w-full"
isDisabled={isReadOnly}
size="sm"
min={0}
@@ -568,7 +568,7 @@ function ReceiptLineItem({
</VStack>
</HStack>
</HStack>
- <div className="flex flex-grow items-center justify-between gap-2 pl-4 compact:flex-wrap compact:gap-4 compact:pl-0">
+ <div className="flex flex-grow items-center justify-between gap-2 pl-4 max-md:flex-wrap max-md:gap-4 max-md:pl-0">
<HStack spacing={4}>
<VStack spacing={1} className="text-center items-center">
<label className="text-xs text-muted-foreground">Ordered</label>
@@ -600,7 +600,7 @@ function ReceiptLineItem({
</VStack>
</HStack>
- <div className="flex flex-col items-start gap-1 min-w-[140px] text-sm compact:w-full">
+ <div className="flex flex-col items-start gap-1 min-w-[140px] text-sm max-md:w-full">
<label className="text-xs text-muted-foreground">
Storage Unit
</label>
@@ -885,7 +885,7 @@ function BatchForm({
const propertiesDisclosure = useDisclosure();
return (
- <div className="flex flex-col gap-6 w-full p-6 border rounded-lg compact:gap-4 compact:p-4">
+ <div className="flex flex-col gap-6 w-full p-6 border rounded-lg max-md:gap-4 max-md:p-4">
<div className="flex justify-between items-center gap-4">
<Heading size="h4">Batch Properties</Heading>
<div className="flex items-center gap-2">
@@ -1124,7 +1124,7 @@ function SerialForm({
const propertiesDisclosure = useDisclosure();
return (
- <div className="flex flex-col gap-6 p-6 border rounded-lg compact:gap-4 compact:p-4">
+ <div className="flex flex-col gap-6 p-6 border rounded-lg max-md:gap-4 max-md:p-4">
<div className="flex justify-between items-center gap-6">
<Heading size="h4">Serial Numbers</Heading>
<div className="flex items-center gap-2">
@@ -1150,7 +1150,7 @@ function SerialForm({
</div>
{showExpiryField && (
- <div className="flex flex-col gap-2 max-w-xs compact:max-w-none">
+ <div className="flex flex-col gap-2 max-w-xs max-md:max-w-none">
<label className="text-xs text-muted-foreground flex items-center gap-2">
<LuCalendar />{" "}
<Trans>Expiration Date (applies to all serials on this line)</Trans>
diff --git a/apps/erp/app/modules/inventory/ui/Shipments/ShipmentLines.tsx b/apps/erp/app/modules/inventory/ui/Shipments/ShipmentLines.tsx
index eeb044d000..cb7b2835d8 100644
--- a/apps/erp/app/modules/inventory/ui/Shipments/ShipmentLines.tsx
+++ b/apps/erp/app/modules/inventory/ui/Shipments/ShipmentLines.tsx
@@ -362,7 +362,7 @@ function ShipmentFixedAssetLineItem({
return (
<div
className={cn(
- "flex items-center gap-4 p-6 compact:flex-wrap compact:p-4",
+ "flex items-center gap-4 p-6 max-md:flex-wrap max-md:p-4",
className
)}
>
@@ -387,7 +387,7 @@ function ShipmentFixedAssetLineItem({
placeholder="Serial Number"
value={serialNumber}
isDisabled={isReadOnly}
- className="w-48 compact:w-full"
+ className="w-48 max-md:w-full"
onChange={(e) => setSerialNumber(e.target.value)}
onBlur={() => {
if (serialNumber !== (line.serialNumber ?? "")) {
@@ -451,11 +451,11 @@ function ShipmentLineItem({
return (
<div
className={cn(
- "flex flex-col border-b p-6 gap-6 relative compact:p-4 compact:gap-4",
+ "flex flex-col border-b p-6 gap-6 relative max-md:p-4 max-md:gap-4",
className
)}
>
- <div className="absolute top-3 right-6 compact:right-4">
+ <div className="absolute top-3 right-6 max-md:right-4">
{line.fulfillment?.type === "Job" ? (
<div className="flex flex-col items-end gap-0">
<span>Job</span>
@@ -494,9 +494,9 @@ function ShipmentLineItem({
</DropdownMenu>
)}
</div>
- <div className="flex flex-1 justify-between items-center w-full compact:flex-col compact:items-stretch compact:gap-4">
- <HStack spacing={4} className="w-1/2 compact:w-full">
- <HStack spacing={4} className="compact:w-full">
+ <div className="flex flex-1 justify-between items-center w-full max-md:flex-col max-md:items-stretch max-md:gap-4">
+ <HStack spacing={4} className="w-1/2 max-md:w-full">
+ <HStack spacing={4} className="max-md:w-full">
<ItemThumbnail
size="md"
thumbnailPath={line.thumbnailPath}
@@ -505,7 +505,7 @@ function ShipmentLineItem({
<VStack
spacing={0}
- className="max-w-[380px] w-full compact:min-w-0 compact:flex-1 compact:pr-20"
+ className="max-w-[380px] w-full max-md:min-w-0 max-md:flex-1 max-md:pr-20"
>
<div className="w-full overflow-hidden">
<span className="text-sm font-medium truncate block w-full">
@@ -526,12 +526,12 @@ function ShipmentLineItem({
</VStack>
</HStack>
</HStack>
- <div className="flex flex-grow items-center justify-between gap-2 pl-4 w-1/2 compact:w-full compact:flex-wrap compact:gap-4 compact:pl-0">
+ <div className="flex flex-grow items-center justify-between gap-2 pl-4 w-1/2 max-md:w-full max-md:flex-wrap max-md:gap-4 max-md:pl-0">
<HStack
spacing={4}
- className="compact:w-full compact:flex-wrap compact:gap-4 compact:space-x-0"
+ className="max-md:w-full max-md:flex-wrap max-md:gap-4 max-md:space-x-0"
>
- <VStack spacing={1} className="compact:w-full">
+ <VStack spacing={1} className="max-md:w-full">
<div className="flex items-center justify-between gap-1 w-full">
<label className="text-xs text-muted-foreground">Shipped</label>
{isJobOverShipped && (
@@ -574,7 +574,7 @@ function ShipmentLineItem({
>
<NumberInput
className={cn(
- "disabled:bg-transparent disabled:opacity-100 min-w-[100px] compact:w-full",
+ "disabled:bg-transparent disabled:opacity-100 min-w-[100px] max-md:w-full",
isJobOverShipped && "border-red-500 border-2"
)}
isDisabled={
@@ -909,7 +909,7 @@ function BatchForm({
);
return (
- <div className="flex flex-col gap-6 w-full p-6 border rounded-lg compact:gap-4 compact:p-4">
+ <div className="flex flex-col gap-6 w-full p-6 border rounded-lg max-md:gap-4 max-md:p-4">
<div className="flex justify-between items-center gap-4">
<Heading size="h4">Tracking Number</Heading>
{hasTrackingLabel && (
@@ -1221,7 +1221,7 @@ function SerialForm({
);
return (
- <div className="flex flex-col gap-6 p-6 border rounded-lg compact:gap-4 compact:p-4">
+ <div className="flex flex-col gap-6 p-6 border rounded-lg max-md:gap-4 max-md:p-4">
<div className="flex justify-between items-center gap-4">
<Heading size="h4">Tracking Numbers</Heading>
{hasTrackingLabel && (
diff --git a/apps/erp/app/modules/inventory/ui/StockTransfers/StockTransferLines.tsx b/apps/erp/app/modules/inventory/ui/StockTransfers/StockTransferLines.tsx
index 43c4f8ceb5..502f4ab5ad 100644
--- a/apps/erp/app/modules/inventory/ui/StockTransfers/StockTransferLines.tsx
+++ b/apps/erp/app/modules/inventory/ui/StockTransfers/StockTransferLines.tsx
@@ -99,14 +99,14 @@ function StockTransferLineComponent({
return (
<div
className={cn(
- "flex flex-col border-b p-6 gap-6 compact:p-4 compact:gap-4",
+ "flex flex-col border-b p-6 gap-6 max-md:p-4 max-md:gap-4",
index === totalLines - 1 && "border-none",
isPicked && "opacity-50 hover:opacity-100"
)}
>
- <div className="flex justify-between items-center w-full compact:flex-col compact:items-stretch compact:gap-4">
- <HStack spacing={4} className="w-1/2 justify-between compact:w-full">
- <HStack spacing={4} className="compact:min-w-0">
+ <div className="flex justify-between items-center w-full max-md:flex-col max-md:items-stretch max-md:gap-4">
+ <HStack spacing={4} className="w-1/2 justify-between max-md:w-full">
+ <HStack spacing={4} className="max-md:min-w-0">
<ItemThumbnail
size="md"
thumbnailPath={line.thumbnailPath}
@@ -144,24 +144,21 @@ function StockTransferLineComponent({
)}
/>
</HStack>
- <div className="flex flex-grow items-center justify-between gap-4 pl-4 w-1/2 compact:w-full compact:flex-wrap compact:gap-3 compact:pl-0">
- <HStack
- spacing={4}
- className="text-left items-center compact:min-w-0"
- >
+ <div className="flex flex-grow items-center justify-between gap-4 pl-4 w-1/2 max-md:w-full max-md:flex-wrap max-md:gap-3 max-md:pl-0">
+ <HStack spacing={4} className="text-left items-center max-md:min-w-0">
{"fromStorageUnitId" in line && (
- <span className="text-base font-medium whitespace-nowrap compact:min-w-0 compact:truncate">
+ <span className="text-base font-medium whitespace-nowrap max-md:min-w-0 max-md:truncate">
{line.fromStorageUnitName ?? ""}
</span>
)}
<LuArrowRight className="size-4" />
{"toStorageUnitId" in line && (
- <span className="text-base font-medium whitespace-nowrap compact:min-w-0 compact:truncate">
+ <span className="text-base font-medium whitespace-nowrap max-md:min-w-0 max-md:truncate">
{line.toStorageUnitName ?? ""}
</span>
)}
</HStack>
- <HStack spacing={1} className="compact:ml-auto">
+ <HStack spacing={1} className="max-md:ml-auto">
{line.trackedEntityId && (
<PrintButton
sourceDocument="Entity"
diff --git a/apps/erp/app/modules/inventory/ui/StockTransfers/StockTransferWizard.tsx b/apps/erp/app/modules/inventory/ui/StockTransfers/StockTransferWizard.tsx
index 202c8dad3c..16f4279075 100644
--- a/apps/erp/app/modules/inventory/ui/StockTransfers/StockTransferWizard.tsx
+++ b/apps/erp/app/modules/inventory/ui/StockTransfers/StockTransferWizard.tsx
@@ -282,7 +282,7 @@ function TransferGrid({ locationId }: { locationId: string }) {
return (
<>
- <DrawerBody className="w-full p-0 compact:p-0 min-h-0 overflow-y-hidden">
+ <DrawerBody className="w-full p-0 max-md:p-0 min-h-0 overflow-y-hidden">
<ResizablePanelGroup
direction="horizontal"
className="h-full w-full min-h-0"
diff --git a/apps/erp/app/modules/inventory/ui/StorageRules/MessageWithTokens.tsx b/apps/erp/app/modules/inventory/ui/StorageRules/MessageWithTokens.tsx
index 905cbba3df..45a8b42ec5 100644
--- a/apps/erp/app/modules/inventory/ui/StorageRules/MessageWithTokens.tsx
+++ b/apps/erp/app/modules/inventory/ui/StorageRules/MessageWithTokens.tsx
@@ -337,7 +337,7 @@ export default function MessageWithTokens({
// Identical typography between the overlay and the textarea — any drift
// here desyncs the highlighted rectangles from the rendered glyphs.
const sharedTypography =
- "px-3 py-2 text-sm leading-[1.25rem] font-sans whitespace-pre-wrap break-words compact:text-base compact:leading-6";
+ "px-3 py-2 text-sm leading-[1.25rem] font-sans whitespace-pre-wrap break-words max-md:text-base max-md:leading-6";
const inputProps = getInputProps<TextareaHTMLAttributes<HTMLTextAreaElement>>(
{
diff --git a/apps/erp/app/modules/inventory/ui/StorageRules/StorageRulesGroups.tsx b/apps/erp/app/modules/inventory/ui/StorageRules/StorageRulesGroups.tsx
index a2b48caa57..b1a28fcb59 100644
--- a/apps/erp/app/modules/inventory/ui/StorageRules/StorageRulesGroups.tsx
+++ b/apps/erp/app/modules/inventory/ui/StorageRules/StorageRulesGroups.tsx
@@ -170,12 +170,12 @@ const StorageRulesGroups = memo(({ rules }: StorageRulesGroupsProps) => {
<ScrollArea className="w-full h-[calc(100dvh-var(--topbar-height)-var(--content-inset))] bg-card">
<VStack
spacing={4}
- className="py-12 px-4 max-w-[60rem] h-full mx-auto gap-4 compact:py-4"
+ className="py-12 px-4 max-w-[60rem] h-full mx-auto gap-4 max-md:py-4"
>
<div className="flex flex-col gap-1 w-full">
<Heading
size="h3"
- className="tracking-tight text-balance compact:hidden"
+ className="tracking-tight text-balance max-md:hidden"
>
Storage Rules
</Heading>
@@ -222,16 +222,16 @@ const StorageRuleCard = memo(({ rule }: { rule: RuleListItem }) => {
<Accordion type="multiple" className="w-full">
<AccordionItem value={rule.id} className="border-none">
<div className="relative">
- <AccordionTrigger className="px-6 py-6 hover:no-underline w-full compact:px-4 compact:py-3 compact:text-left">
+ <AccordionTrigger className="px-6 py-6 hover:no-underline w-full max-md:px-4 max-md:py-3 max-md:text-left">
<HStack
spacing={4}
- className="flex-1 justify-between pr-12 compact:flex-wrap compact:items-start compact:gap-y-2 compact:pr-0"
+ className="flex-1 justify-between pr-12 max-md:flex-wrap max-md:items-start max-md:gap-y-2 max-md:pr-0"
>
- <div className="flex items-center gap-3 min-w-0 compact:flex-wrap compact:gap-y-1">
+ <div className="flex items-center gap-3 min-w-0 max-md:flex-wrap max-md:gap-y-1">
<Heading
size="h4"
as="h3"
- className="truncate compact:basis-full compact:pr-12"
+ className="truncate max-md:basis-full max-md:pr-12"
>
{rule.name}
</Heading>
@@ -255,7 +255,7 @@ const StorageRuleCard = memo(({ rule }: { rule: RuleListItem }) => {
</Status>
</HStack>
</AccordionTrigger>
- <div className="absolute right-12 top-1/2 -translate-y-1/2 z-10 compact:top-3 compact:translate-y-0">
+ <div className="absolute right-12 top-1/2 -translate-y-1/2 z-10 max-md:top-3 max-md:translate-y-0">
<DropdownMenu>
<DropdownMenuTrigger asChild>
<IconButton
diff --git a/apps/erp/app/modules/inventory/ui/StorageUnits/StorageUnitParentSelect.tsx b/apps/erp/app/modules/inventory/ui/StorageUnits/StorageUnitParentSelect.tsx
index f5afbfe5ee..11946ad116 100644
--- a/apps/erp/app/modules/inventory/ui/StorageUnits/StorageUnitParentSelect.tsx
+++ b/apps/erp/app/modules/inventory/ui/StorageUnits/StorageUnitParentSelect.tsx
@@ -183,7 +183,7 @@ function DrillSelect({
disabled={isReadOnly}
className={cn(
"flex h-9 w-full items-center justify-between gap-2 rounded-md border border-input bg-transparent px-3 text-sm text-left shadow-xs transition-[color,box-shadow]",
- "compact:h-11 compact:text-base",
+ "max-md:h-11 max-md:text-base",
"outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50",
isReadOnly && "opacity-60 cursor-not-allowed",
!triggerLabel && "text-muted-foreground"
@@ -202,7 +202,7 @@ function DrillSelect({
e.stopPropagation();
onChange("");
}}
- className="flex h-4 w-4 items-center justify-center rounded opacity-60 hover:bg-muted hover:opacity-100 compact:hit-area"
+ className="flex h-4 w-4 items-center justify-center rounded opacity-60 hover:bg-muted hover:opacity-100 max-md:hit-area"
>
<LuX className="h-3 w-3" />
</span>
diff --git a/apps/erp/app/modules/inventory/ui/StorageUnits/StorageUnitsTable.tsx b/apps/erp/app/modules/inventory/ui/StorageUnits/StorageUnitsTable.tsx
index 43eb440914..7e4e8bf14b 100644
--- a/apps/erp/app/modules/inventory/ui/StorageUnits/StorageUnitsTable.tsx
+++ b/apps/erp/app/modules/inventory/ui/StorageUnits/StorageUnitsTable.tsx
@@ -20,8 +20,8 @@ import {
ModalTitle,
Spinner,
toast,
- useCompact,
- useDisclosure
+ useDisclosure,
+ useViewport
} from "@carbon/react";
import { Trans, useLingui } from "@lingui/react/macro";
import type { ColumnDef } from "@tanstack/react-table";
@@ -80,7 +80,7 @@ const StorageUnitsTable = memo(
}: StorageUnitsTableProps) => {
const [params] = useUrlParams();
const { t } = useLingui();
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
const navigate = useNavigate();
const permissions = usePermissions();
@@ -321,10 +321,10 @@ const StorageUnitsTable = memo(
<div
key={i}
aria-hidden
- className="w-5 shrink-0 border-l border-border -my-2 compact:border-l-0"
+ className="w-5 shrink-0 border-l border-border -my-2 max-md:border-l-0"
/>
))}
- <div className="w-5 shrink-0 flex items-center justify-center self-center compact:self-start compact:h-[1lh]">
+ <div className="w-5 shrink-0 flex items-center justify-center self-center max-md:self-start max-md:h-[1lh]">
{hasChildren ? (
isLoading ? (
<Spinner className="size-3" />
@@ -334,7 +334,7 @@ const StorageUnitsTable = memo(
aria-label={
isExpanded ? t`Collapse subtree` : t`Expand subtree`
}
- className="text-muted-foreground hover:text-foreground shrink-0 compact:hit-area"
+ className="text-muted-foreground hover:text-foreground shrink-0 max-md:hit-area"
onClick={(e) => {
e.stopPropagation();
e.preventDefault();
@@ -350,7 +350,7 @@ const StorageUnitsTable = memo(
)
) : null}
</div>
- <div className="flex items-center py-1 compact:flex-col compact:items-start compact:gap-1 compact:py-0">
+ <div className="flex items-center py-1 max-md:flex-col max-md:items-start max-md:gap-1 max-md:py-0">
<Hyperlink
to={`${path.to.storageUnit(row.original.id)}?${params}`}
>
@@ -364,7 +364,7 @@ const StorageUnitsTable = memo(
</Hyperlink>
{/* Phones: the context line sits under the name, so it
shares the tree indent instead of starting at the gutter. */}
- {isCompact &&
+ {isPhone &&
table.getColumn("storageTypeIds")?.getIsVisible() &&
row.original.storageTypeIds?.length ? (
<div className="text-[13px] font-normal text-muted-foreground">
@@ -437,7 +437,7 @@ const StorageUnitsTable = memo(
}
];
}, [
- isCompact,
+ isPhone,
locations,
params,
storageTypes,
diff --git a/apps/erp/app/modules/inventory/ui/Traceability/GraphToolbar.tsx b/apps/erp/app/modules/inventory/ui/Traceability/GraphToolbar.tsx
index f455fd8c2a..2d226bed32 100644
--- a/apps/erp/app/modules/inventory/ui/Traceability/GraphToolbar.tsx
+++ b/apps/erp/app/modules/inventory/ui/Traceability/GraphToolbar.tsx
@@ -12,7 +12,7 @@ import {
PopoverContent,
PopoverTrigger,
Subheading,
- useCompact,
+ useViewport,
VStack
} from "@carbon/react";
import { useReactFlow } from "@xyflow/react";
@@ -101,7 +101,7 @@ function ViewModeChip({
className={cn(
"absolute top-3 left-3 z-30 p-1",
PANEL,
- "compact:[&_button]:relative compact:[&_button]:after:absolute compact:[&_button]:after:inset-x-0 compact:[&_button]:after:-inset-y-2.5"
+ "max-md:[&_button]:relative max-md:[&_button]:after:absolute max-md:[&_button]:after:inset-x-0 max-md:[&_button]:after:-inset-y-2.5"
)}
>
<SegmentButton
@@ -152,7 +152,7 @@ function GraphControlsChip({
showGraphOnly: boolean;
}) {
const { fitView } = useReactFlow();
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
return (
<HStack
@@ -163,7 +163,7 @@ function GraphControlsChip({
// Phones: drops under the view chip and scrolls sideways.
// A hit area overflowing the buttons would make it scroll vertically
// too, so the buttons themselves are 44pt tall.
- "compact:top-14 compact:left-3 compact:right-auto compact:max-w-[calc(100%-24px)] compact:overflow-x-auto compact:overflow-y-hidden compact:scroll-fade-x compact:[&>*]:shrink-0 compact:[&_button]:h-11"
+ "max-md:top-14 max-md:left-3 max-md:right-auto max-md:max-w-[calc(100%-24px)] max-md:overflow-x-auto max-md:overflow-y-hidden max-md:scroll-fade-x max-md:[&>*]:shrink-0 max-md:[&_button]:h-11"
)}
>
{onOpenSearch && (
@@ -181,7 +181,7 @@ function GraphControlsChip({
aria-label="Search nodes"
>
<LuSearch className="w-3.5 h-3.5" />
- <kbd className="text-[10px] text-muted-foreground bg-muted/50 px-1 rounded compact:hidden">
+ <kbd className="text-[10px] text-muted-foreground bg-muted/50 px-1 rounded max-md:hidden">
/
</kbd>
</button>
@@ -339,7 +339,7 @@ function GraphControlsChip({
onClick={() =>
fitView({
duration: 300,
- padding: isCompact ? COMPACT_FIT_PADDING : 0.2
+ padding: isPhone ? COMPACT_FIT_PADDING : 0.2
})
}
className={cn(
diff --git a/apps/erp/app/modules/inventory/ui/Traceability/TraceabilityGraph.tsx b/apps/erp/app/modules/inventory/ui/Traceability/TraceabilityGraph.tsx
index 15fc45a89b..de03f9f494 100644
--- a/apps/erp/app/modules/inventory/ui/Traceability/TraceabilityGraph.tsx
+++ b/apps/erp/app/modules/inventory/ui/Traceability/TraceabilityGraph.tsx
@@ -2,7 +2,7 @@
// Carbon (github.com/crbnos/carbon). Modified or adapted versions of this file,
// including ports, remain AGPLv3; serving them over a network requires releasing their source.
-import { cn, useCompact } from "@carbon/react";
+import { cn, useViewport } from "@carbon/react";
import {
Background,
BackgroundVariant,
@@ -105,7 +105,7 @@ function TraceabilityGraphInner({
const [searchParams] = useSearchParams();
const navigate = useNavigate();
const { fitView } = useReactFlow();
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
const nodesInitialized = useNodesInitialized();
const lastFitSignatureRef = useRef<string>("");
@@ -542,7 +542,7 @@ function TraceabilityGraphInner({
lastFitSignatureRef.current = sig;
const raf = requestAnimationFrame(() => {
fitView({
- padding: isCompact ? COMPACT_FIT_PADDING : 0.2,
+ padding: isPhone ? COMPACT_FIT_PADDING : 0.2,
duration: isFirstFit ? 0 : 250,
maxZoom: 1
});
@@ -559,7 +559,7 @@ function TraceabilityGraphInner({
width,
height,
fitView,
- isCompact
+ isPhone
]);
const handleDepthChange = useCallback(
@@ -663,7 +663,7 @@ function TraceabilityGraphInner({
<MiniMap
pannable
zoomable
- className="!bg-card !border-border compact:!hidden"
+ className="!bg-card !border-border max-md:!hidden"
nodeColor={(n) => {
const data = (n as any).data;
if (data?.kind === "entity") {
@@ -746,7 +746,7 @@ function TraceabilityGraphInner({
</button>
</>
) : (
- <span className="px-1 flex items-center gap-1.5 text-muted-foreground compact:hidden">
+ <span className="px-1 flex items-center gap-1.5 text-muted-foreground max-md:hidden">
<kbd className="rounded border border-border bg-muted px-1 py-px font-mono text-[10px] leading-none text-foreground">
Shift
</kbd>
diff --git a/apps/erp/app/modules/inventory/ui/Traceability/TraceabilitySidebar.tsx b/apps/erp/app/modules/inventory/ui/Traceability/TraceabilitySidebar.tsx
index aa8a74db8e..b8e9e3ce5b 100644
--- a/apps/erp/app/modules/inventory/ui/Traceability/TraceabilitySidebar.tsx
+++ b/apps/erp/app/modules/inventory/ui/Traceability/TraceabilitySidebar.tsx
@@ -300,7 +300,7 @@ export function TraceabilitySidebar({
const hasMultiSelect = selectedIds && selectedIds.length > 1;
return (
- <aside className="w-[426px] flex-shrink-0 bg-card h-full overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent border-l border-border text-sm compact:w-full compact:h-[45%] compact:border-l-0 compact:border-t">
+ <aside className="w-[426px] flex-shrink-0 bg-card h-full overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent border-l border-border text-sm max-md:w-full max-md:h-[45%] max-md:border-l-0 max-md:border-t">
{hasMultiSelect && (
<div className="flex items-center justify-between gap-2 bg-muted/40 mx-3 mt-3 rounded-md px-2 py-1">
<div className="flex items-center gap-2 min-w-0">
diff --git a/apps/erp/app/modules/inventory/ui/Valuation/InventoryValuationWorkbench.tsx b/apps/erp/app/modules/inventory/ui/Valuation/InventoryValuationWorkbench.tsx
index e452afac17..d50ddee002 100644
--- a/apps/erp/app/modules/inventory/ui/Valuation/InventoryValuationWorkbench.tsx
+++ b/apps/erp/app/modules/inventory/ui/Valuation/InventoryValuationWorkbench.tsx
@@ -243,7 +243,7 @@ export function InventoryValuationWorkbench({
<button
type="button"
aria-label={isExpanded ? t`Collapse` : t`Expand`}
- className="text-muted-foreground hover:text-foreground compact:hit-area"
+ className="text-muted-foreground hover:text-foreground max-md:hit-area"
onClick={(e) => {
e.stopPropagation();
toggleExpand(r.id);
@@ -277,7 +277,7 @@ export function InventoryValuationWorkbench({
</Hyperlink>
</HStack>
) : (
- <span className="font-semibold compact:min-w-0 compact:truncate">
+ <span className="font-semibold max-md:min-w-0 max-md:truncate">
{r.label}
</span>
)}
diff --git a/apps/erp/app/modules/inventory/ui/WarehouseTransfers/WarehouseTransferLines.tsx b/apps/erp/app/modules/inventory/ui/WarehouseTransfers/WarehouseTransferLines.tsx
index 610aa3bf77..6799f99aa7 100644
--- a/apps/erp/app/modules/inventory/ui/WarehouseTransfers/WarehouseTransferLines.tsx
+++ b/apps/erp/app/modules/inventory/ui/WarehouseTransfers/WarehouseTransferLines.tsx
@@ -144,14 +144,14 @@ function WarehouseTransferLineListItem({
const date = line.updatedAt ?? line.createdAt;
return (
- <div className={cn("border-b p-6 compact:p-4", className)}>
- <div className="flex flex-1 justify-between items-center w-full compact:flex-col compact:items-stretch compact:gap-3">
- <HStack spacing={4} className="w-1/2 compact:w-full">
+ <div className={cn("border-b p-6 max-md:p-4", className)}>
+ <div className="flex flex-1 justify-between items-center w-full max-md:flex-col max-md:items-stretch max-md:gap-3">
+ <HStack spacing={4} className="w-1/2 max-md:w-full">
<HStack
spacing={4}
- className="flex-1 compact:min-w-0 compact:flex-col compact:items-start compact:gap-3 compact:space-x-0"
+ className="flex-1 max-md:min-w-0 max-md:flex-col max-md:items-start max-md:gap-3 max-md:space-x-0"
>
- <div className="flex items-center space-x-3 compact:min-w-0">
+ <div className="flex items-center space-x-3 max-md:min-w-0">
<ItemThumbnail
size="sm"
thumbnailPath={line.item?.thumbnailPath}
@@ -166,7 +166,7 @@ function WarehouseTransferLineListItem({
</span>
</VStack>
</div>
- <div className="flex items-center gap-2 compact:flex-wrap">
+ <div className="flex items-center gap-2 max-md:flex-wrap">
<Badge variant="secondary">
{Number(line.quantity).toLocaleString()}
</Badge>
@@ -180,7 +180,7 @@ function WarehouseTransferLineListItem({
</div>
</HStack>
</HStack>
- <div className="flex items-center justify-end gap-2 compact:justify-between">
+ <div className="flex items-center justify-end gap-2 max-md:justify-between">
<HStack spacing={2}>
<span className="text-xs text-muted-foreground">
{isUpdated ? t`Updated` : t`Created`}{" "}
diff --git a/apps/erp/app/modules/invoicing/ui/Dashboard/InvoicingDashboard.tsx b/apps/erp/app/modules/invoicing/ui/Dashboard/InvoicingDashboard.tsx
index e4598c8e9e..9687fea0af 100644
--- a/apps/erp/app/modules/invoicing/ui/Dashboard/InvoicingDashboard.tsx
+++ b/apps/erp/app/modules/invoicing/ui/Dashboard/InvoicingDashboard.tsx
@@ -105,7 +105,7 @@ const AgingCard = ({
<span className="text-muted-foreground">{icon}</span>
<CardTitle>{title}</CardTitle>
</CardHeader>
- <CardContent className="compact:px-0 compact:py-2 compact:[&_td]:px-4 compact:[&_th]:px-4">
+ <CardContent className="max-md:px-0 max-md:py-2 max-md:[&_td]:px-4 max-md:[&_th]:px-4">
<Table>
<Thead>
<Tr>
@@ -211,7 +211,7 @@ const InvoicingDashboard = ({
return (
<div className="flex flex-col gap-4 w-full p-4 h-[calc(100dvh-var(--header-height))] overflow-y-auto scrollbar-thin scrollbar-thumb-rounded-full scrollbar-thumb-muted-foreground">
{/* KPI Cards */}
- <div className="grid w-full gap-4 grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 compact:grid-cols-2 compact:gap-3 compact:[&>:last-child:nth-child(odd)]:col-span-2">
+ <div className="grid w-full gap-4 grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 max-md:grid-cols-2 max-md:gap-3 max-md:[&>:last-child:nth-child(odd)]:col-span-2">
<MetricCard
icon={<LuHandCoins />}
title={<Trans>AR Outstanding</Trans>}
diff --git a/apps/erp/app/modules/invoicing/ui/Memo/MemoForm.tsx b/apps/erp/app/modules/invoicing/ui/Memo/MemoForm.tsx
index 1f152e7b4a..7df4d67acd 100644
--- a/apps/erp/app/modules/invoicing/ui/Memo/MemoForm.tsx
+++ b/apps/erp/app/modules/invoicing/ui/Memo/MemoForm.tsx
@@ -134,7 +134,7 @@ const MemoForm = ({ initialValues, type }: MemoFormProps) => {
className="w-full"
>
{isEditing && <RecordHeroTarget bleed />}
- <Card className={isEditing ? "compact:mt-4" : undefined}>
+ <Card className={isEditing ? "max-md:mt-4" : undefined}>
{isEditing ? (
<DocumentHeader
title={initialValues.memoId ?? ""}
diff --git a/apps/erp/app/modules/invoicing/ui/Payment/PaymentForm.tsx b/apps/erp/app/modules/invoicing/ui/Payment/PaymentForm.tsx
index 2f4e49c610..70c1f067bf 100644
--- a/apps/erp/app/modules/invoicing/ui/Payment/PaymentForm.tsx
+++ b/apps/erp/app/modules/invoicing/ui/Payment/PaymentForm.tsx
@@ -170,7 +170,7 @@ const PaymentForm = ({ initialValues, seedInvoiceIds }: PaymentFormProps) => {
className="w-full"
>
{isEditing && <RecordHeroTarget bleed />}
- <Card className={isEditing ? "compact:mt-4" : undefined}>
+ <Card className={isEditing ? "max-md:mt-4" : undefined}>
{isEditing ? (
<DocumentHeader
title={initialValues.paymentId ?? ""}
diff --git a/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceExplorer.tsx b/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceExplorer.tsx
index 7c36cb45b0..614bf9c4e3 100644
--- a/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceExplorer.tsx
+++ b/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceExplorer.tsx
@@ -367,7 +367,7 @@ function PurchaseInvoiceLineItem({
<DropdownMenuTrigger asChild>
<IconButton
aria-label={t`More`}
- className="opacity-0 group-hover:opacity-100 group-active:opacity-100 data-[state=open]:opacity-100 compact:opacity-100"
+ className="opacity-0 group-hover:opacity-100 group-active:opacity-100 data-[state=open]:opacity-100 max-md:opacity-100"
icon={<LuEllipsisVertical />}
variant="solid"
onClick={(e) => e.stopPropagation()}
diff --git a/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceLineForm.tsx b/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceLineForm.tsx
index 471aa26b97..d9f85a8a89 100644
--- a/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceLineForm.tsx
+++ b/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceLineForm.tsx
@@ -467,7 +467,7 @@ const PurchaseInvoiceLineForm = ({
>
<HStack
className={cn(
- "w-full justify-between items-start compact:flex-col compact:items-stretch compact:space-x-0",
+ "w-full justify-between items-start max-md:flex-col max-md:items-stretch max-md:space-x-0",
type === "modal" && "pr-16"
)}
>
@@ -527,7 +527,7 @@ const PurchaseInvoiceLineForm = ({
)}
</ModalCardDescription>
</ModalCardHeader>
- <div className="flex-shrink-0 compact:min-w-0 compact:overflow-x-auto compact:scroll-fade-x compact:px-4 compact:pb-2 compact:empty:hidden">
+ <div className="flex-shrink-0 max-md:min-w-0 max-md:overflow-x-auto max-md:scroll-fade-x max-md:px-4 max-md:pb-2 max-md:empty:hidden">
{!isEditing && (
<TabsList>
<TabsTrigger value="item">
@@ -582,7 +582,7 @@ const PurchaseInvoiceLineForm = ({
onTypeChange={onTypeChange}
/>
- <FormControl className="col-span-2 compact:col-span-full">
+ <FormControl className="col-span-2 max-md:col-span-full">
<FormLabel isOptional>
<Trans>Description</Trans>
</FormLabel>
@@ -829,7 +829,7 @@ const PurchaseInvoiceLineForm = ({
className={
activeTab === "asset"
? "col-span-1"
- : "col-span-3 compact:col-span-full"
+ : "col-span-3 max-md:col-span-full"
}
label={t`Description`}
name="description"
diff --git a/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceSummary.tsx b/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceSummary.tsx
index 1c283fafd0..1194209a57 100644
--- a/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceSummary.tsx
+++ b/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceSummary.tsx
@@ -114,12 +114,12 @@ const LineItems = ({
{line.thumbnailPath ? (
<img
alt={itemReadableId ?? ""}
- className="w-24 h-24 shrink-0 bg-gradient-to-bl from-muted to-muted/40 rounded-lg compact:size-16"
+ className="w-24 h-24 shrink-0 bg-gradient-to-bl from-muted to-muted/40 rounded-lg max-md:size-16"
src={getPrivateUrl(line.thumbnailPath)}
/>
) : (
- <div className="w-24 h-24 shrink-0 bg-gradient-to-bl from-muted to-muted/40 rounded-lg p-4 compact:size-16">
- <LuImage className="w-16 h-16 text-muted-foreground compact:size-8" />
+ <div className="w-24 h-24 shrink-0 bg-gradient-to-bl from-muted to-muted/40 rounded-lg p-4 max-md:size-16">
+ <LuImage className="w-16 h-16 text-muted-foreground max-md:size-8" />
</div>
)}
@@ -133,10 +133,10 @@ const LineItems = ({
children need w-full because VStack is items-start, which
sizes each child to its own content and leaves truncate
inert no matter how narrow the column gets. */}
- <div className="flex items-center justify-between w-full compact:flex-col compact:items-start compact:gap-2">
+ <div className="flex items-center justify-between w-full max-md:flex-col max-md:items-start max-md:gap-2">
<VStack
spacing={0}
- className="flex-1 min-w-0 compact:w-full"
+ className="flex-1 min-w-0 max-md:w-full"
>
<HStack spacing={2} className="flex min-w-0 w-full">
<Heading className="truncate">{itemReadableId}</Heading>
@@ -165,7 +165,7 @@ const LineItems = ({
</VStack>
<VStack
spacing={2}
- className="flex-shrink-0 items-end w-auto compact:items-start compact:w-full"
+ className="flex-shrink-0 items-end w-auto max-md:items-start max-md:w-full"
>
<HStack spacing={4}>
<VStack spacing={0}>
diff --git a/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceExplorer.tsx b/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceExplorer.tsx
index 9010d69702..c9bf08a9ce 100644
--- a/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceExplorer.tsx
+++ b/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceExplorer.tsx
@@ -315,7 +315,7 @@ function SalesInvoiceLineItem({
<DropdownMenuTrigger asChild>
<IconButton
aria-label={t`More`}
- className="opacity-0 group-hover:opacity-100 group-active:opacity-100 data-[state=open]:opacity-100 compact:opacity-100"
+ className="opacity-0 group-hover:opacity-100 group-active:opacity-100 data-[state=open]:opacity-100 max-md:opacity-100"
icon={<LuEllipsisVertical />}
variant="solid"
onClick={(e) => e.stopPropagation()}
diff --git a/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceLineForm.tsx b/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceLineForm.tsx
index 3a48c88a67..53775fa616 100644
--- a/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceLineForm.tsx
+++ b/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceLineForm.tsx
@@ -429,7 +429,7 @@ const SalesInvoiceLineForm = ({
>
<HStack
className={cn(
- "w-full justify-between items-start compact:flex-col compact:items-stretch compact:space-x-0",
+ "w-full justify-between items-start max-md:flex-col max-md:items-stretch max-md:space-x-0",
type === "modal" && "pr-16"
)}
>
@@ -491,7 +491,7 @@ const SalesInvoiceLineForm = ({
)}
</ModalCardDescription>
</ModalCardHeader>
- <div className="flex-shrink-0 compact:min-w-0 compact:overflow-x-auto compact:scroll-fade-x compact:px-4 compact:pb-2 compact:empty:hidden">
+ <div className="flex-shrink-0 max-md:min-w-0 max-md:overflow-x-auto max-md:scroll-fade-x max-md:px-4 max-md:pb-2 max-md:empty:hidden">
{!isEditing && (
<TabsList>
<TabsTrigger value="item">
@@ -551,7 +551,7 @@ const SalesInvoiceLineForm = ({
onTypeChange={onTypeChange}
/>
- <FormControl className="col-span-2 compact:col-span-full">
+ <FormControl className="col-span-2 max-md:col-span-full">
<FormLabel isOptional>
<Trans>Description</Trans>
</FormLabel>
diff --git a/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceSummary.tsx b/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceSummary.tsx
index df036a301d..b5fd883cae 100644
--- a/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceSummary.tsx
+++ b/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceSummary.tsx
@@ -116,12 +116,12 @@ const LineItems = ({
{line.thumbnailPath ? (
<img
alt={itemReadableId ?? ""}
- className="w-24 h-24 shrink-0 bg-gradient-to-bl from-muted to-muted/40 rounded-lg compact:size-16"
+ className="w-24 h-24 shrink-0 bg-gradient-to-bl from-muted to-muted/40 rounded-lg max-md:size-16"
src={getPrivateUrl(line.thumbnailPath)}
/>
) : (
- <div className="w-24 h-24 shrink-0 bg-gradient-to-bl from-muted to-muted/40 rounded-lg p-4 compact:size-16">
- <LuImage className="w-16 h-16 text-muted-foreground compact:size-8" />
+ <div className="w-24 h-24 shrink-0 bg-gradient-to-bl from-muted to-muted/40 rounded-lg p-4 max-md:size-16">
+ <LuImage className="w-16 h-16 text-muted-foreground max-md:size-8" />
</div>
)}
@@ -135,10 +135,10 @@ const LineItems = ({
children need w-full because VStack is items-start, which
sizes each child to its own content and leaves truncate
inert no matter how narrow the column gets. */}
- <div className="flex items-center justify-between w-full compact:flex-col compact:items-start compact:gap-2">
+ <div className="flex items-center justify-between w-full max-md:flex-col max-md:items-start max-md:gap-2">
<VStack
spacing={0}
- className="flex-1 min-w-0 compact:w-full"
+ className="flex-1 min-w-0 max-md:w-full"
>
<HStack spacing={2} className="flex min-w-0 w-full">
<Heading className="truncate">{itemReadableId}</Heading>
@@ -164,7 +164,7 @@ const LineItems = ({
</VStack>
<VStack
spacing={2}
- className="flex-shrink-0 items-end w-auto compact:items-start compact:w-full"
+ className="flex-shrink-0 items-end w-auto max-md:items-start max-md:w-full"
>
<HStack spacing={4}>
<VStack spacing={0}>
diff --git a/apps/erp/app/modules/invoicing/ui/Workbench/ARAPWorkbench.tsx b/apps/erp/app/modules/invoicing/ui/Workbench/ARAPWorkbench.tsx
index 18a7fb9bba..d74c0cf302 100644
--- a/apps/erp/app/modules/invoicing/ui/Workbench/ARAPWorkbench.tsx
+++ b/apps/erp/app/modules/invoicing/ui/Workbench/ARAPWorkbench.tsx
@@ -278,14 +278,14 @@ export function ARAPWorkbench({
return (
<div
data-key-cell=""
- className="flex items-center compact:w-[calc(45dvw-32px)] compact:pl-3"
+ className="flex items-center max-md:w-[calc(45dvw-32px)] max-md:pl-3"
>
<div className="w-5 shrink-0 flex items-center justify-center self-center">
{kids.length > 0 ? (
<button
type="button"
aria-label={isExpanded ? t`Collapse` : t`Expand`}
- className="text-muted-foreground hover:text-foreground compact:hit-area"
+ className="text-muted-foreground hover:text-foreground max-md:hit-area"
onClick={(e) => {
e.stopPropagation();
toggleExpand(r.partyId);
@@ -302,12 +302,12 @@ export function ARAPWorkbench({
{r.customerId ? (
<CustomerAvatar
customerId={r.customerId}
- className="compact:min-w-0 compact:truncate"
+ className="max-md:min-w-0 max-md:truncate"
/>
) : r.supplierId ? (
<SupplierAvatar
supplierId={r.supplierId}
- className="compact:min-w-0 compact:truncate"
+ className="max-md:min-w-0 max-md:truncate"
/>
) : null}
</div>
@@ -322,7 +322,7 @@ export function ARAPWorkbench({
return (
<div
data-key-cell=""
- className="flex items-center compact:w-[calc(45dvw-32px)]"
+ className="flex items-center max-md:w-[calc(45dvw-32px)]"
>
<div
aria-hidden
diff --git a/apps/erp/app/modules/items/ui/ChangeNotice/ChangeNoticeExplorer.tsx b/apps/erp/app/modules/items/ui/ChangeNotice/ChangeNoticeExplorer.tsx
index 2add305268..dddede56ae 100644
--- a/apps/erp/app/modules/items/ui/ChangeNotice/ChangeNoticeExplorer.tsx
+++ b/apps/erp/app/modules/items/ui/ChangeNotice/ChangeNoticeExplorer.tsx
@@ -182,7 +182,7 @@ function AffectedItemRow({
<DropdownMenuTrigger asChild>
<IconButton
aria-label={t`More`}
- className="opacity-0 group-hover:opacity-100 group-active:opacity-100 data-[state=open]:opacity-100 compact:opacity-100"
+ className="opacity-0 group-hover:opacity-100 group-active:opacity-100 data-[state=open]:opacity-100 max-md:opacity-100"
icon={<LuEllipsisVertical />}
variant="solid"
onClick={(e) => e.stopPropagation()}
diff --git a/apps/erp/app/modules/items/ui/Consumables/ConsumablesTable.tsx b/apps/erp/app/modules/items/ui/Consumables/ConsumablesTable.tsx
index 362c8a2284..4ac815d46c 100644
--- a/apps/erp/app/modules/items/ui/Consumables/ConsumablesTable.tsx
+++ b/apps/erp/app/modules/items/ui/Consumables/ConsumablesTable.tsx
@@ -612,7 +612,7 @@ const ConsumablesTable = memo(
<Button
variant="secondary"
leftIcon={<LuGroup />}
- className="compact:hidden"
+ className="max-md:hidden"
asChild
>
<Link to={path.to.itemPostingGroups}>
diff --git a/apps/erp/app/modules/items/ui/Item/BillOfMaterial.tsx b/apps/erp/app/modules/items/ui/Item/BillOfMaterial.tsx
index b477656176..bb865e882a 100644
--- a/apps/erp/app/modules/items/ui/Item/BillOfMaterial.tsx
+++ b/apps/erp/app/modules/items/ui/Item/BillOfMaterial.tsx
@@ -1268,9 +1268,9 @@ function makeItem(
<Link
to={getLinkToItemDetails(material.itemType, material.itemId)}
onClick={(e) => e.stopPropagation()}
- className="compact:hit-area"
+ className="max-md:hit-area"
>
- <LuExternalLink className="h-4 w-4 opacity-0 group-hover:opacity-100 compact:opacity-100" />
+ <LuExternalLink className="h-4 w-4 opacity-0 group-hover:opacity-100 max-md:opacity-100" />
</Link>
)}
</div>
@@ -1288,7 +1288,7 @@ function makeItem(
material.item?.itemTrackingType ?? ""
) && (
<Tooltip>
- <TooltipTrigger className="compact:hit-area">
+ <TooltipTrigger className="max-md:hit-area">
<Badge variant="secondary">
<TrackingTypeIcon
type={material.item?.itemTrackingType ?? ""}
@@ -1310,7 +1310,7 @@ function makeItem(
)}
<Tooltip>
- <TooltipTrigger className="compact:hit-area">
+ <TooltipTrigger className="max-md:hit-area">
<Badge variant="secondary">
<MethodIcon type={material.methodType} isKit={material.kit} />
</Badge>
@@ -1328,7 +1328,7 @@ function makeItem(
{replenishmentSystem === "Buy and Make" && (
<Tooltip>
- <TooltipTrigger className="compact:hit-area">
+ <TooltipTrigger className="max-md:hit-area">
<Badge variant="secondary">
<SourcingTypeIcon type={material.sourcingType} />
</Badge>
@@ -1340,7 +1340,7 @@ function makeItem(
<Badge variant="secondary">{material.quantity}</Badge>
<Tooltip>
- <TooltipTrigger className="compact:hit-area">
+ <TooltipTrigger className="max-md:hit-area">
<Badge variant="secondary">
<MethodItemTypeIcon type={material.itemType} />
</Badge>
diff --git a/apps/erp/app/modules/items/ui/Item/BillOfProcess.tsx b/apps/erp/app/modules/items/ui/Item/BillOfProcess.tsx
index 823e30d84a..c0f91df766 100644
--- a/apps/erp/app/modules/items/ui/Item/BillOfProcess.tsx
+++ b/apps/erp/app/modules/items/ui/Item/BillOfProcess.tsx
@@ -816,11 +816,11 @@ const BillOfProcess = ({
return (
<Card>
<HStack className="justify-between">
- <CardHeader className="compact:min-w-0">
- <CardTitle className="flex flex-row items-center gap-2 compact:flex compact:flex-wrap compact:gap-y-1">
+ <CardHeader className="max-md:min-w-0">
+ <CardTitle className="flex flex-row items-center gap-2 max-md:flex max-md:flex-wrap max-md:gap-y-1">
<Trans>Bill of Process</Trans>
{itemName && (
- <span className="text-xs text-muted-foreground font-normal compact:order-last compact:min-w-0 compact:basis-full compact:truncate">
+ <span className="text-xs text-muted-foreground font-normal max-md:order-last max-md:min-w-0 max-md:basis-full max-md:truncate">
{itemName}
</span>
)}
@@ -1256,7 +1256,7 @@ function OperationForm({
onChange={(newValue) => {
setProcessData((d) => ({ ...d, description: newValue }));
}}
- className="col-span-2 compact:col-span-full"
+ className="col-span-2 max-md:col-span-full"
isConfigured={rulesByField.has(key("description"))}
onConfigure={
configurable && !temporaryItems[item.id]
@@ -2251,7 +2251,7 @@ function AttributesForm({
<VStack
spacing={2}
- className="w-full col-span-2 compact:col-span-full"
+ className="w-full col-span-2 max-md:col-span-full"
>
<Label>Description</Label>
<Editor
@@ -2612,7 +2612,7 @@ function AttributesListItem({
<VStack
spacing={2}
- className="w-full col-span-2 compact:col-span-full"
+ className="w-full col-span-2 max-md:col-span-full"
>
<Label>Description</Label>
<Editor
diff --git a/apps/erp/app/modules/items/ui/Item/FileBadge.tsx b/apps/erp/app/modules/items/ui/Item/FileBadge.tsx
index 0a6817bc9a..27eadaf73e 100644
--- a/apps/erp/app/modules/items/ui/Item/FileBadge.tsx
+++ b/apps/erp/app/modules/items/ui/Item/FileBadge.tsx
@@ -49,7 +49,7 @@ export function FileBadge({
<LuDownload
onClick={() => download(file)}
- className="cursor-pointer group-hover:opacity-100 opacity-0 transition-opacity duration-200 w-4 h-4 text-foreground compact:opacity-100"
+ className="cursor-pointer group-hover:opacity-100 opacity-0 transition-opacity duration-200 w-4 h-4 text-foreground max-md:opacity-100"
/>
</HStack>
);
diff --git a/apps/erp/app/modules/items/ui/Item/ItemManufacturingForm.tsx b/apps/erp/app/modules/items/ui/Item/ItemManufacturingForm.tsx
index c3ba3d3baa..163a7f1993 100644
--- a/apps/erp/app/modules/items/ui/Item/ItemManufacturingForm.tsx
+++ b/apps/erp/app/modules/items/ui/Item/ItemManufacturingForm.tsx
@@ -87,7 +87,7 @@ const ItemManufacturingForm = ({
termId="item-configured"
bordered
description={t`Part is configured for manufacturing`}
- className="col-span-3 compact:col-span-1"
+ className="col-span-3 max-md:col-span-1"
/>
)}
<CustomFormFields table="partReplenishment" />
diff --git a/apps/erp/app/modules/items/ui/Item/ItemPlanningForm.tsx b/apps/erp/app/modules/items/ui/Item/ItemPlanningForm.tsx
index e5f717a446..0e5d582e1a 100644
--- a/apps/erp/app/modules/items/ui/Item/ItemPlanningForm.tsx
+++ b/apps/erp/app/modules/items/ui/Item/ItemPlanningForm.tsx
@@ -60,7 +60,7 @@ const ItemPlanningForm = ({
validator={itemPlanningValidator}
defaultValues={initialValues}
>
- <HStack className="w-full justify-between items-start compact:items-center">
+ <HStack className="w-full justify-between items-start max-md:items-center">
<CardHeader>
<CardTitle>
<Trans>Planning</Trans>
diff --git a/apps/erp/app/modules/items/ui/Item/PickMethodForm.tsx b/apps/erp/app/modules/items/ui/Item/PickMethodForm.tsx
index 70324c6411..5e9a0ab4b5 100644
--- a/apps/erp/app/modules/items/ui/Item/PickMethodForm.tsx
+++ b/apps/erp/app/modules/items/ui/Item/PickMethodForm.tsx
@@ -141,7 +141,7 @@ const PickMethodForm = ({
validator={pickMethodWithShelfLifeValidator}
defaultValues={initialValues}
>
- <HStack className="w-full justify-between items-start compact:flex-wrap compact:gap-y-0 compact:items-center">
+ <HStack className="w-full justify-between items-start max-md:flex-wrap max-md:gap-y-0 max-md:items-center">
<CardHeader>
<CardTitle>
<Trans>Inventory</Trans>
diff --git a/apps/erp/app/modules/items/ui/Item/UsedIn.tsx b/apps/erp/app/modules/items/ui/Item/UsedIn.tsx
index 98d51c72cc..f96eca5d78 100644
--- a/apps/erp/app/modules/items/ui/Item/UsedIn.tsx
+++ b/apps/erp/app/modules/items/ui/Item/UsedIn.tsx
@@ -403,7 +403,7 @@ export function RevisionsItem({
variant="secondary"
icon={<LuEllipsisVertical />}
aria-label={t`Edit`}
- className="absolute right-2 top-1 flex-shrink-0 opacity-0 group-hover/used-in:opacity-100 data-[state=open]:opacity-100 compact:opacity-100"
+ className="absolute right-2 top-1 flex-shrink-0 opacity-0 group-hover/used-in:opacity-100 data-[state=open]:opacity-100 max-md:opacity-100"
/>
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
diff --git a/apps/erp/app/modules/items/ui/Materials/MaterialsTable.tsx b/apps/erp/app/modules/items/ui/Materials/MaterialsTable.tsx
index 25665c3b58..435de15f19 100644
--- a/apps/erp/app/modules/items/ui/Materials/MaterialsTable.tsx
+++ b/apps/erp/app/modules/items/ui/Materials/MaterialsTable.tsx
@@ -764,7 +764,7 @@ const MaterialsTable = memo(({ data, tags, count }: MaterialsTableProps) => {
<Button
variant="secondary"
leftIcon={<LuGroup />}
- className="compact:hidden"
+ className="max-md:hidden"
asChild
>
<Link to={path.to.itemPostingGroups}>
diff --git a/apps/erp/app/modules/items/ui/Parts/PartProperties.tsx b/apps/erp/app/modules/items/ui/Parts/PartProperties.tsx
index 3b9007cf78..d140ea885f 100644
--- a/apps/erp/app/modules/items/ui/Parts/PartProperties.tsx
+++ b/apps/erp/app/modules/items/ui/Parts/PartProperties.tsx
@@ -295,7 +295,7 @@ const PartProperties = ({
<LuMove3D className="w-3 h-3 mr-1 text-emerald-500" />
<Trans>3D Model</Trans>
</Badge>
- <span className="group-hover:opacity-100 opacity-0 transition-opacity duration-200 w-4 h-4 text-foreground compact:opacity-100">
+ <span className="group-hover:opacity-100 opacity-0 transition-opacity duration-200 w-4 h-4 text-foreground max-md:opacity-100">
<LuExternalLink />
</span>
</Link>
diff --git a/apps/erp/app/modules/items/ui/Parts/PartsTable.tsx b/apps/erp/app/modules/items/ui/Parts/PartsTable.tsx
index 13d7cc5d1a..909c4f4e16 100644
--- a/apps/erp/app/modules/items/ui/Parts/PartsTable.tsx
+++ b/apps/erp/app/modules/items/ui/Parts/PartsTable.tsx
@@ -732,7 +732,7 @@ const PartsTable = memo(({ data, tags, count }: PartsTableProps) => {
<Button
variant="secondary"
leftIcon={<LuGroup />}
- className="compact:hidden"
+ className="max-md:hidden"
asChild
>
<Link to={path.to.itemPostingGroups}>
diff --git a/apps/erp/app/modules/items/ui/Services/ServicesTable.tsx b/apps/erp/app/modules/items/ui/Services/ServicesTable.tsx
index 25a92558ac..149e22291a 100644
--- a/apps/erp/app/modules/items/ui/Services/ServicesTable.tsx
+++ b/apps/erp/app/modules/items/ui/Services/ServicesTable.tsx
@@ -572,7 +572,7 @@ const ServicesTable = memo(({ data, tags, count }: ServicesTableProps) => {
<Button
variant="secondary"
leftIcon={<LuGroup />}
- className="compact:hidden"
+ className="max-md:hidden"
asChild
>
<Link to={path.to.itemPostingGroups}>
diff --git a/apps/erp/app/modules/items/ui/Tools/ToolsTable.tsx b/apps/erp/app/modules/items/ui/Tools/ToolsTable.tsx
index 135476c61e..b544850038 100644
--- a/apps/erp/app/modules/items/ui/Tools/ToolsTable.tsx
+++ b/apps/erp/app/modules/items/ui/Tools/ToolsTable.tsx
@@ -690,7 +690,7 @@ const ToolsTable = memo(({ data, tags, count }: ToolsTableProps) => {
<Button
variant="secondary"
leftIcon={<LuGroup />}
- className="compact:hidden"
+ className="max-md:hidden"
asChild
>
<Link to={path.to.itemPostingGroups}>
diff --git a/apps/erp/app/modules/people/ui/Attributes/AttributeCategoriesTable.tsx b/apps/erp/app/modules/people/ui/Attributes/AttributeCategoriesTable.tsx
index 43b9f3f63a..bc00e842f7 100644
--- a/apps/erp/app/modules/people/ui/Attributes/AttributeCategoriesTable.tsx
+++ b/apps/erp/app/modules/people/ui/Attributes/AttributeCategoriesTable.tsx
@@ -84,7 +84,7 @@ const AttributeCategoriesTable = memo(
<Button
variant="secondary"
size="sm"
- className="compact:hidden"
+ className="max-md:hidden"
onClick={() => {
navigate(
`${path.to.attributeCategoryList(
diff --git a/apps/erp/app/modules/people/ui/Departments/DepartmentNode.tsx b/apps/erp/app/modules/people/ui/Departments/DepartmentNode.tsx
index 40d5dbbace..0a5588036e 100644
--- a/apps/erp/app/modules/people/ui/Departments/DepartmentNode.tsx
+++ b/apps/erp/app/modules/people/ui/Departments/DepartmentNode.tsx
@@ -8,7 +8,7 @@ import {
DropdownMenuItem,
DropdownMenuTrigger,
MENU_ITEM_SHORTCUTS,
- useCompact
+ useViewport
} from "@carbon/react";
import { Handle, type NodeProps, Position } from "@xyflow/react";
import { memo } from "react";
@@ -33,13 +33,13 @@ function DepartmentNodeComponent({
}: NodeProps & { data: DepartmentNodeData }) {
const { department, onEdit, onDelete, onAddChild } = data;
// Phones lay the tree out left-to-right, so edges attach at the sides.
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
return (
<div className="group relative">
<Handle
type="target"
- position={isCompact ? Position.Left : Position.Top}
+ position={isPhone ? Position.Left : Position.Top}
className="!bg-transparent !border-0 !w-px !h-px !min-w-0 !min-h-0"
/>
@@ -60,7 +60,7 @@ function DepartmentNodeComponent({
<DropdownMenu>
<DropdownMenuTrigger asChild>
<button
- className="ml-auto shrink-0 rounded-md p-1 opacity-0 transition-opacity hover:bg-accent group-hover:opacity-100 focus:opacity-100 compact:opacity-100 compact:hit-area"
+ className="ml-auto shrink-0 rounded-md p-1 opacity-0 transition-opacity hover:bg-accent group-hover:opacity-100 focus:opacity-100 max-md:opacity-100 max-md:hit-area"
aria-label="Actions"
>
<LuEllipsisVertical className="size-3.5 text-muted-foreground" />
@@ -92,7 +92,7 @@ function DepartmentNodeComponent({
<Handle
type="source"
- position={isCompact ? Position.Right : Position.Bottom}
+ position={isPhone ? Position.Right : Position.Bottom}
className="!bg-transparent !border-0 !w-px !h-px !min-w-0 !min-h-0"
/>
</div>
diff --git a/apps/erp/app/modules/people/ui/Departments/DepartmentsTreeView.tsx b/apps/erp/app/modules/people/ui/Departments/DepartmentsTreeView.tsx
index cadf60c7bb..704d2f2b65 100644
--- a/apps/erp/app/modules/people/ui/Departments/DepartmentsTreeView.tsx
+++ b/apps/erp/app/modules/people/ui/Departments/DepartmentsTreeView.tsx
@@ -2,7 +2,7 @@
// Carbon (github.com/crbnos/carbon). Modified or adapted versions of this file,
// including ports, remain AGPLv3; serving them over a network requires releasing their source.
-import { useCompact } from "@carbon/react";
+import { useViewport } from "@carbon/react";
import {
Background,
BackgroundVariant,
@@ -38,7 +38,7 @@ export function DepartmentsTreeView({
onDelete,
onAddChild
}: DepartmentsTreeViewProps) {
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
const { initialNodes, initialEdges } = useMemo(() => {
const nodes: Node[] = departments.map((department) => ({
id: department.id!,
@@ -68,11 +68,11 @@ export function DepartmentsTreeView({
edges,
// Phones: sibling departments stack vertically and children branch
// sideways, so every root fits the narrow canvas.
- isCompact ? "LR" : "TB"
+ isPhone ? "LR" : "TB"
);
return { initialNodes: layoutedNodes, initialEdges: layoutedEdges };
- }, [departments, onEdit, onDelete, onAddChild, isCompact]);
+ }, [departments, onEdit, onDelete, onAddChild, isPhone]);
const [nodes, setNodes, onNodesChange] = useNodesState(initialNodes);
const [edges, setEdges, onEdgesChange] = useEdgesState(initialEdges);
@@ -83,7 +83,7 @@ export function DepartmentsTreeView({
}, [initialNodes, initialEdges, setNodes, setEdges]);
return (
- <div className="h-[calc(100dvh-(var(--header-height))-61px)] w-full overflow-hidden compact:h-[calc(100dvh-var(--topbar-height)-var(--content-inset,0px)-61px)] bg-card">
+ <div className="h-[calc(100dvh-(var(--header-height))-61px)] w-full overflow-hidden max-md:h-[calc(100dvh-var(--topbar-height)-var(--content-inset,0px)-61px)] bg-card">
<ReactFlow
nodes={nodes}
edges={edges}
@@ -96,7 +96,7 @@ export function DepartmentsTreeView({
padding: 0.3,
maxZoom: 1.2,
// Phones: never fit below a readable size; the user pans instead.
- minZoom: isCompact ? 0.75 : 0.3
+ minZoom: isPhone ? 0.75 : 0.3
}}
nodesDraggable={false}
nodesConnectable={false}
@@ -109,7 +109,7 @@ export function DepartmentsTreeView({
>
<Controls
showInteractive={false}
- className="!bg-card !border-border !shadow-sm compact:!left-auto compact:!right-0 compact:[&>button]:!size-11 [&>button]:!bg-card [&>button]:!border-border [&>button]:!text-foreground [&>button:hover]:!bg-accent"
+ className="!bg-card !border-border !shadow-sm max-md:!left-auto max-md:!right-0 max-md:[&>button]:!size-11 [&>button]:!bg-card [&>button]:!border-border [&>button]:!text-foreground [&>button:hover]:!bg-accent"
/>
<Background
variant={BackgroundVariant.Dots}
diff --git a/apps/erp/app/modules/people/ui/Person/PersonAbilities.tsx b/apps/erp/app/modules/people/ui/Person/PersonAbilities.tsx
index 3fd74ce8ea..7b0fd8c161 100644
--- a/apps/erp/app/modules/people/ui/Person/PersonAbilities.tsx
+++ b/apps/erp/app/modules/people/ui/Person/PersonAbilities.tsx
@@ -71,9 +71,9 @@ const PersonAbilities = ({ personId, abilities }: PersonAbilitiesProps) => {
return (
<li key={employeeAbility.id}>
<HStack className="w-full justify-between">
- <HStack spacing={2} className="compact:min-w-0">
+ <HStack spacing={2} className="max-md:min-w-0">
<Link
- className="font-medium compact:block compact:min-w-0 compact:truncate compact:leading-[2.75rem]"
+ className="font-medium max-md:block max-md:min-w-0 max-md:truncate max-md:leading-[2.75rem]"
to={editPath}
>
{process?.name}
@@ -82,7 +82,7 @@ const PersonAbilities = ({ personId, abilities }: PersonAbilitiesProps) => {
employeeAbility={employeeAbility}
/>
</HStack>
- <HStack spacing={2} className="compact:shrink-0">
+ <HStack spacing={2} className="max-md:shrink-0">
<p className="text-sm text-muted-foreground">
<DateTime
value={employeeAbility.lastTrainingDate}
diff --git a/apps/erp/app/modules/people/ui/Person/PersonPreview.tsx b/apps/erp/app/modules/people/ui/Person/PersonPreview.tsx
index d4bf871f6d..fa5f010423 100644
--- a/apps/erp/app/modules/people/ui/Person/PersonPreview.tsx
+++ b/apps/erp/app/modules/people/ui/Person/PersonPreview.tsx
@@ -13,8 +13,8 @@ import {
CardHeader,
CardTitle,
HStack,
- useCompact,
- useDisclosure
+ useDisclosure,
+ useViewport
} from "@carbon/react";
import { Trans } from "@lingui/react/macro";
// import { LuHistory } from "react-icons/lu";
@@ -32,7 +32,7 @@ const PersonHeader = () => {
const { company } = useUser();
const auditDrawer = useDisclosure();
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
const routeData = useRouteData<{ employeeSummary: EmployeeSummary }>(
path.to.person(personId)
);
@@ -81,7 +81,7 @@ const PersonHeader = () => {
</CardAttributeLabel>
<CardAttributeValue>
{routeData?.employeeSummary?.managerName ||
- (isCompact ? "—" : null)}
+ (isPhone ? "—" : null)}
</CardAttributeValue>
</CardAttribute>
<CardAttribute>
diff --git a/apps/erp/app/modules/people/ui/Shifts/ShiftForm.tsx b/apps/erp/app/modules/people/ui/Shifts/ShiftForm.tsx
index 742844aa8b..7445c6d443 100644
--- a/apps/erp/app/modules/people/ui/Shifts/ShiftForm.tsx
+++ b/apps/erp/app/modules/people/ui/Shifts/ShiftForm.tsx
@@ -82,7 +82,7 @@ const ShiftForm = ({ initialValues }: ShiftFormProps) => {
<Trans>Days</Trans>
</FormLabel>
{/* Phones: the day names read as row labels, not helper text. */}
- <VStack className="compact:[&_p]:text-sm compact:[&_p]:text-foreground">
+ <VStack className="max-md:[&_p]:text-sm max-md:[&_p]:text-foreground">
<Boolean name="monday" description={t`Monday`} bordered />
<Boolean name="tuesday" description={t`Tuesday`} bordered />
<Boolean
diff --git a/apps/erp/app/modules/people/ui/Shifts/ShiftsTable.tsx b/apps/erp/app/modules/people/ui/Shifts/ShiftsTable.tsx
index 7ce64cb464..768a318c9b 100644
--- a/apps/erp/app/modules/people/ui/Shifts/ShiftsTable.tsx
+++ b/apps/erp/app/modules/people/ui/Shifts/ShiftsTable.tsx
@@ -7,7 +7,7 @@ import {
MENU_ITEM_SHORTCUTS,
MenuIcon,
MenuItem,
- useCompact
+ useViewport
} from "@carbon/react";
import { formatTimeOfDay } from "@carbon/utils";
import {
@@ -46,7 +46,7 @@ type ShiftsTableProps = {
const ShiftsTable = memo(({ data, count, locations }: ShiftsTableProps) => {
const { t } = useLingui();
const { locale } = useLocale();
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
const navigate = useNavigate();
const permissions = usePermissions();
const [params] = useUrlParams();
@@ -126,7 +126,7 @@ const ShiftsTable = memo(({ data, count, locations }: ShiftsTableProps) => {
header: t`Start Time`,
cell: ({ row }) =>
// Phones: line 2 shows the whole span, start – end.
- isCompact && row.original.endTime ? (
+ isPhone && row.original.endTime ? (
<>
{renderShiftTime(row.original.startTime, row.original.locationId)}
{" – "}
@@ -191,7 +191,7 @@ const ShiftsTable = memo(({ data, count, locations }: ShiftsTableProps) => {
];
return [...defaultColumns, ...customColumns];
- }, [locations, renderDays, renderShiftTime, customColumns, isCompact, t]);
+ }, [locations, renderDays, renderShiftTime, customColumns, isPhone, t]);
const renderContextMenu = useCallback(
(row: Shift) => {
diff --git a/apps/erp/app/modules/people/ui/Timecards/TimecardsTable.tsx b/apps/erp/app/modules/people/ui/Timecards/TimecardsTable.tsx
index e36016f517..18b8431a14 100644
--- a/apps/erp/app/modules/people/ui/Timecards/TimecardsTable.tsx
+++ b/apps/erp/app/modules/people/ui/Timecards/TimecardsTable.tsx
@@ -9,8 +9,8 @@ import {
MENU_ITEM_SHORTCUTS,
MenuIcon,
MenuItem,
- useCompact,
- useInterval
+ useInterval,
+ useViewport
} from "@carbon/react";
import { Trans, useLingui } from "@lingui/react/macro";
import { useLocale } from "@react-aria/i18n";
@@ -69,7 +69,7 @@ function formatDuration(clockInStr: string, clockOutStr: string | null) {
const TimecardsTable = memo(({ data, count }: TimecardsTableProps) => {
const { t } = useLingui();
const { locale } = useLocale();
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
const navigate = useNavigate();
const permissions = usePermissions();
const [params] = useUrlParams();
@@ -122,7 +122,7 @@ const TimecardsTable = memo(({ data, count }: TimecardsTableProps) => {
dateOptions={{ dateStyle: "medium" }}
/>
{/* Phones: line 2 also carries the clock-in – clock-out span. */}
- {isCompact ? (
+ {isPhone ? (
<>
{" · "}
<DateTime value={row.original.clockIn} variant="time" />
@@ -224,7 +224,7 @@ const TimecardsTable = memo(({ data, count }: TimecardsTableProps) => {
}
}
];
- }, [locations, t, locale, isCompact]);
+ }, [locations, t, locale, isPhone]);
const renderContextMenu = useCallback(
(row: TimeCardEntry) => {
diff --git a/apps/erp/app/modules/production/ui/Assemblies/AssemblyBomTree.tsx b/apps/erp/app/modules/production/ui/Assemblies/AssemblyBomTree.tsx
index 1cb806ec1c..0df9f3b810 100644
--- a/apps/erp/app/modules/production/ui/Assemblies/AssemblyBomTree.tsx
+++ b/apps/erp/app/modules/production/ui/Assemblies/AssemblyBomTree.tsx
@@ -1161,7 +1161,7 @@ function UnitListRow({
icon={<LuPencil />}
variant="ghost"
size="sm"
- className="opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 focus:opacity-100 compact:opacity-100"
+ className="opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 focus:opacity-100 max-md:opacity-100"
onClick={(event) => {
event.stopPropagation();
onEdit();
@@ -1174,7 +1174,7 @@ function UnitListRow({
icon={<LuTrash />}
variant="ghost"
size="sm"
- className="opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 focus:opacity-100 compact:opacity-100"
+ className="opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 focus:opacity-100 max-md:opacity-100"
onClick={(event) => {
event.stopPropagation();
deleteFetcher.submit(new FormData(), {
@@ -1664,7 +1664,7 @@ function ComponentRow({
icon={<LuSettings />}
variant="ghost"
size="sm"
- className="opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 focus:opacity-100 data-[state=open]:opacity-100 compact:opacity-100"
+ className="opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 focus:opacity-100 data-[state=open]:opacity-100 max-md:opacity-100"
onClick={(event) => event.stopPropagation()}
/>
</PopoverTrigger>
@@ -1751,7 +1751,7 @@ function HideToggle({
"focus:opacity-100",
isMarked
? "opacity-100 text-muted-foreground"
- : "opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 compact:opacity-100"
+ : "opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 max-md:opacity-100"
)}
onClick={(event) => {
event.stopPropagation();
@@ -1768,7 +1768,7 @@ function HideToggle({
className={cn(
"inline-flex",
!isMarked &&
- "opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 compact:opacity-100"
+ "opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 max-md:opacity-100"
)}
>
{button}
diff --git a/apps/erp/app/modules/production/ui/Assemblies/AssemblyInstructionProperties.tsx b/apps/erp/app/modules/production/ui/Assemblies/AssemblyInstructionProperties.tsx
index 829fcf193f..11e28085ec 100644
--- a/apps/erp/app/modules/production/ui/Assemblies/AssemblyInstructionProperties.tsx
+++ b/apps/erp/app/modules/production/ui/Assemblies/AssemblyInstructionProperties.tsx
@@ -952,7 +952,7 @@ function StepComponentsEditor({
icon={<LuX />}
variant="ghost"
size="sm"
- className="opacity-0 group-hover:opacity-100 focus:opacity-100 compact:opacity-100"
+ className="opacity-0 group-hover:opacity-100 focus:opacity-100 max-md:opacity-100"
onClick={() => setUsedIn(used.headerId, "")}
/>
)}
@@ -1004,7 +1004,7 @@ function StepComponentsEditor({
icon={<LuX />}
variant="ghost"
size="sm"
- className="opacity-0 group-hover:opacity-100 focus:opacity-100 compact:opacity-100"
+ className="opacity-0 group-hover:opacity-100 focus:opacity-100 max-md:opacity-100"
onClick={(event) => {
event.stopPropagation();
onRemoveComponents(group.nodeIds);
diff --git a/apps/erp/app/modules/production/ui/Assemblies/AssemblyStepList.tsx b/apps/erp/app/modules/production/ui/Assemblies/AssemblyStepList.tsx
index 5e66bf1da1..13b0d70b34 100644
--- a/apps/erp/app/modules/production/ui/Assemblies/AssemblyStepList.tsx
+++ b/apps/erp/app/modules/production/ui/Assemblies/AssemblyStepList.tsx
@@ -930,7 +930,7 @@ function SubAssemblyRow({
aria-label={t`More options`}
size="sm"
variant="ghost"
- className="size-6 shrink-0 opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 data-[state=open]:opacity-100 compact:opacity-100"
+ className="size-6 shrink-0 opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 data-[state=open]:opacity-100 max-md:opacity-100"
icon={<LuEllipsisVertical />}
onClick={(e) => e.stopPropagation()}
/>
@@ -1093,7 +1093,7 @@ function StepRow({
aria-label={t`More options`}
size="sm"
variant="ghost"
- className="size-6 shrink-0 opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 data-[state=open]:opacity-100 compact:opacity-100"
+ className="size-6 shrink-0 opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 data-[state=open]:opacity-100 max-md:opacity-100"
icon={<LuEllipsisVertical />}
onClick={(e) => e.stopPropagation()}
/>
diff --git a/apps/erp/app/modules/production/ui/Batches/BatchBuilder.tsx b/apps/erp/app/modules/production/ui/Batches/BatchBuilder.tsx
index f6e2a7ab88..25e0d211e5 100644
--- a/apps/erp/app/modules/production/ui/Batches/BatchBuilder.tsx
+++ b/apps/erp/app/modules/production/ui/Batches/BatchBuilder.tsx
@@ -35,8 +35,8 @@ import {
ResizablePanelGroup,
Spinner,
toast,
- useCompact,
useLocalStorage,
+ useViewport,
VStack
} from "@carbon/react";
import {
@@ -1147,8 +1147,8 @@ function DrawerBodyGrid({
left: React.ReactNode;
right: React.ReactNode;
}) {
- const isCompact = useCompact();
- if (isCompact) {
+ const { isPhone } = useViewport();
+ if (isPhone) {
return (
<div className="flex flex-col min-h-0 flex-1 overflow-y-auto">
<div className="flex-shrink-0 border-b px-4 py-3 bg-card">{scope}</div>
@@ -1266,7 +1266,7 @@ function ScopeBar({
<Trans>Scope</Trans>
</span>
</HStack>
- <div className="w-[220px] compact:w-full compact:!mx-0">
+ <div className="w-[220px] max-md:w-full max-md:!mx-0">
<Combobox
size="md"
value={locationId}
@@ -1275,7 +1275,7 @@ function ScopeBar({
placeholder={t`Location`}
/>
</div>
- <div className="w-[220px] compact:w-full compact:!mx-0">
+ <div className="w-[220px] max-md:w-full max-md:!mx-0">
<Combobox
size="md"
value={processId ?? ""}
diff --git a/apps/erp/app/modules/production/ui/Batches/BatchDetailDrawer.tsx b/apps/erp/app/modules/production/ui/Batches/BatchDetailDrawer.tsx
index dcc9feb2e2..1b4bf2f13e 100644
--- a/apps/erp/app/modules/production/ui/Batches/BatchDetailDrawer.tsx
+++ b/apps/erp/app/modules/production/ui/Batches/BatchDetailDrawer.tsx
@@ -369,7 +369,7 @@ export function BatchDetailDrawer({
{/* One surface (DrawerBody), two panes divided by a rule — the members
list grows to fill the page and scrolls internally, so the drawer
never leaves a dead lower half. No nested cards. */}
- <DrawerBody className="w-full flex-1 min-h-0 overflow-hidden p-0 compact:p-0">
+ <DrawerBody className="w-full flex-1 min-h-0 overflow-hidden p-0 max-md:p-0">
<div className="grid h-full min-h-0 w-full grid-cols-1 lg:grid-cols-3">
{/* Operations — the batch's contents */}
<section className="flex min-h-0 flex-col lg:col-span-2">
diff --git a/apps/erp/app/modules/production/ui/DemandProjection/DemandProjectionTable.tsx b/apps/erp/app/modules/production/ui/DemandProjection/DemandProjectionTable.tsx
index 7b90187ff4..a4937e33e3 100644
--- a/apps/erp/app/modules/production/ui/DemandProjection/DemandProjectionTable.tsx
+++ b/apps/erp/app/modules/production/ui/DemandProjection/DemandProjectionTable.tsx
@@ -12,8 +12,8 @@ import {
HStack,
IconButton,
MENU_ITEM_SHORTCUTS,
- useCompact,
useUrlParams,
+ useViewport,
VStack
} from "@carbon/react";
import { getLocalTimeZone, parseDate } from "@internationalized/date";
@@ -57,7 +57,7 @@ const DemandProjectionsTable = memo(
});
const [params] = useUrlParams();
const { t } = useLingui();
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
const permissions = usePermissions();
const locations = useLocations();
const [selectedItem, setSelectedItem] = useState<DemandProjection | null>(
@@ -117,7 +117,7 @@ const DemandProjectionsTable = memo(
<Hyperlink
to={path.to.demandProjection(row.original.id!, locationId)}
>
- <HStack className="py-1 cursor-pointer compact:min-w-0">
+ <HStack className="py-1 cursor-pointer max-md:min-w-0">
<ItemThumbnail
size="sm"
thumbnailPath={row.original.thumbnailPath}
@@ -125,8 +125,8 @@ const DemandProjectionsTable = memo(
type={row.original.type}
/>
- <VStack spacing={0} className="font-medium compact:min-w-0">
- <span className="compact:block compact:w-full compact:truncate">
+ <VStack spacing={0} className="font-medium max-md:min-w-0">
+ <span className="max-md:block max-md:w-full max-md:truncate">
{row.original.readableIdWithRevision}
</span>
<div className="w-full truncate text-muted-foreground text-xs">
@@ -207,7 +207,7 @@ const DemandProjectionsTable = memo(
title={t`Demand Forecasts`}
table="production-planning"
withSavedView
- withSelectableRows={!isCompact}
+ withSelectableRows={!isPhone}
withSimpleSorting
primaryAction={
<div className="flex items-center gap-2">
diff --git a/apps/erp/app/modules/production/ui/Jobs/JobBillOfMaterial.tsx b/apps/erp/app/modules/production/ui/Jobs/JobBillOfMaterial.tsx
index 72e886f968..8e1951861d 100644
--- a/apps/erp/app/modules/production/ui/Jobs/JobBillOfMaterial.tsx
+++ b/apps/erp/app/modules/production/ui/Jobs/JobBillOfMaterial.tsx
@@ -170,9 +170,9 @@ function makeItem(
<Link
to={getLinkToItemDetails(material.itemType, material.itemId)}
onClick={(e) => e.stopPropagation()}
- className="compact:hit-area"
+ className="max-md:hit-area"
>
- <LuExternalLink className="h-4 w-4 opacity-0 group-hover:opacity-100 compact:opacity-100" />
+ <LuExternalLink className="h-4 w-4 opacity-0 group-hover:opacity-100 max-md:opacity-100" />
</Link>
)}
</div>
@@ -188,7 +188,7 @@ function makeItem(
<HStack spacing={2}>
{material.requiresBatchTracking ? (
<Tooltip>
- <TooltipTrigger className="compact:hit-area">
+ <TooltipTrigger className="max-md:hit-area">
<Badge variant="secondary">
<TrackingTypeIcon type="Batch" />
</Badge>
@@ -199,7 +199,7 @@ function makeItem(
</Tooltip>
) : material.requiresSerialTracking ? (
<Tooltip>
- <TooltipTrigger className="compact:hit-area">
+ <TooltipTrigger className="max-md:hit-area">
<Badge variant="secondary">
<TrackingTypeIcon type="Serial" />
</Badge>
@@ -211,7 +211,7 @@ function makeItem(
) : null}
<Tooltip>
- <TooltipTrigger className="compact:hit-area">
+ <TooltipTrigger className="max-md:hit-area">
<Badge variant="secondary">
<MethodIcon type={material.methodType} isKit={material.kit} />
</Badge>
@@ -229,7 +229,7 @@ function makeItem(
<Badge variant="secondary">{material.quantity}</Badge>
<Tooltip>
- <TooltipTrigger className="compact:hit-area">
+ <TooltipTrigger className="max-md:hit-area">
<Badge variant="secondary">
<MethodItemTypeIcon type={material.itemType} />
</Badge>
@@ -838,7 +838,7 @@ function MaterialForm({
onChange={(newValue) => {
setItemData((d) => ({ ...d, description: newValue }));
}}
- className="col-span-2 compact:col-span-full"
+ className="col-span-2 max-md:col-span-full"
/>
{itemData.methodType !== "Make to Order" && (
<NumberControlled
diff --git a/apps/erp/app/modules/production/ui/Jobs/JobBillOfProcess.tsx b/apps/erp/app/modules/production/ui/Jobs/JobBillOfProcess.tsx
index 2d5d1189f0..d658ba360d 100644
--- a/apps/erp/app/modules/production/ui/Jobs/JobBillOfProcess.tsx
+++ b/apps/erp/app/modules/production/ui/Jobs/JobBillOfProcess.tsx
@@ -1506,7 +1506,7 @@ function StepsForm({
<VStack
spacing={2}
- className="w-full col-span-2 compact:col-span-full"
+ className="w-full col-span-2 max-md:col-span-full"
>
<Label>
<Trans>Description</Trans>
@@ -2159,7 +2159,7 @@ function StepsListItem({
<VStack
spacing={2}
- className="w-full col-span-2 compact:col-span-full"
+ className="w-full col-span-2 max-md:col-span-full"
>
<Label>
<Trans>Description</Trans>
@@ -3114,7 +3114,7 @@ function OperationForm({
onChange={(newValue) => {
setProcessData((d) => ({ ...d, description: newValue }));
}}
- className="col-span-2 compact:col-span-full"
+ className="col-span-2 max-md:col-span-full"
/>
<Select
diff --git a/apps/erp/app/modules/production/ui/Jobs/JobDag.tsx b/apps/erp/app/modules/production/ui/Jobs/JobDag.tsx
index a74a0fa063..6c26ebc339 100644
--- a/apps/erp/app/modules/production/ui/Jobs/JobDag.tsx
+++ b/apps/erp/app/modules/production/ui/Jobs/JobDag.tsx
@@ -166,7 +166,7 @@ function JobDagInner({ operations, dependencies }: Props) {
className={cn(
"h-7 px-2 rounded-md text-xs font-medium flex items-center gap-1.5",
"border border-border bg-background hover:bg-accent/60 transition-colors",
- "compact:hit-area compact:h-8 compact:text-sm"
+ "max-md:hit-area max-md:h-8 max-md:text-sm"
)}
>
{direction === "LR" ? (
@@ -182,7 +182,7 @@ function JobDagInner({ operations, dependencies }: Props) {
className={cn(
"h-7 px-2 rounded-md text-xs font-medium flex items-center gap-1.5",
"border border-border bg-background hover:bg-accent/60 transition-colors",
- "compact:hit-area compact:h-8 compact:text-sm"
+ "max-md:hit-area max-md:h-8 max-md:text-sm"
)}
>
<LuMaximize className="w-3.5 h-3.5" />
@@ -212,7 +212,7 @@ function JobDagInner({ operations, dependencies }: Props) {
nodeStrokeWidth={3}
pannable
zoomable
- className="!bg-card !border-border compact:!hidden"
+ className="!bg-card !border-border max-md:!hidden"
/>
</ReactFlow>
<DagLegend />
@@ -248,7 +248,7 @@ function DagLegend() {
type="button"
aria-label="Show legend"
className={cn(
- "h-8 w-8 rounded-md flex items-center justify-center transition-colors compact:size-11",
+ "h-8 w-8 rounded-md flex items-center justify-center transition-colors max-md:size-11",
"border border-border bg-card/90 backdrop-blur shadow-sm",
"text-muted-foreground hover:text-foreground hover:bg-accent/60",
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
diff --git a/apps/erp/app/modules/production/ui/Jobs/JobForm.tsx b/apps/erp/app/modules/production/ui/Jobs/JobForm.tsx
index 924add980b..1d3c2951bb 100644
--- a/apps/erp/app/modules/production/ui/Jobs/JobForm.tsx
+++ b/apps/erp/app/modules/production/ui/Jobs/JobForm.tsx
@@ -230,7 +230,7 @@ const JobForm = ({ initialValues }: JobFormProps) => {
<Tabs defaultValue="job">
<VStack className="w-full items-center relative">
{!isEditing && (
- <TabsList className="absolute top-6 right-4 z-50 compact:static compact:self-start compact:mb-3">
+ <TabsList className="absolute top-6 right-4 z-50 max-md:static max-md:self-start max-md:mb-3">
<TabsTrigger value="job">
<LuDiamond className="mr-1" />
Single Job
diff --git a/apps/erp/app/modules/production/ui/Jobs/JobProperties.tsx b/apps/erp/app/modules/production/ui/Jobs/JobProperties.tsx
index 9c7f035a81..5e02c61f4f 100644
--- a/apps/erp/app/modules/production/ui/Jobs/JobProperties.tsx
+++ b/apps/erp/app/modules/production/ui/Jobs/JobProperties.tsx
@@ -328,7 +328,7 @@ const JobProperties = () => {
</Badge>
</Hyperlink>
<Button
- className="group-hover:opacity-100 opacity-0 transition-opacity duration-200 compact:opacity-100"
+ className="group-hover:opacity-100 opacity-0 transition-opacity duration-200 max-md:opacity-100"
variant="ghost"
size="sm"
leftIcon={<LuUnlink2 className="w-3 h-3" />}
diff --git a/apps/erp/app/modules/production/ui/Jobs/JobsTable.tsx b/apps/erp/app/modules/production/ui/Jobs/JobsTable.tsx
index 9d0bf153ac..eeb4a4aa2e 100644
--- a/apps/erp/app/modules/production/ui/Jobs/JobsTable.tsx
+++ b/apps/erp/app/modules/production/ui/Jobs/JobsTable.tsx
@@ -17,8 +17,8 @@ import {
MenuIcon,
MenuItem,
toast,
- useCompact,
useDisclosure,
+ useViewport,
VStack
} from "@carbon/react";
import {
@@ -155,7 +155,7 @@ const JobsTable = memo((props: JobsTableProps) => {
const { data, count, tags, batchesByJobId = {} } = props;
const navigate = useNavigate();
const { t } = useLingui();
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
const [params] = useUrlParams();
const parts = useParts();
const tools = useTools();
@@ -358,7 +358,7 @@ const JobsTable = memo((props: JobsTableProps) => {
);
}
// Phones: no column header, so the number carries its unit.
- if (isCompact && row.original.unitOfMeasureCode) {
+ if (isPhone && row.original.unitOfMeasureCode) {
return (
<>
{quantity}
@@ -672,7 +672,7 @@ const JobsTable = memo((props: JobsTableProps) => {
}
];
return [...defaultColumns, ...customColumns];
- }, [params, customColumns, trackedEntities, batchesByJobId, isCompact]);
+ }, [params, customColumns, trackedEntities, batchesByJobId, isPhone]);
const fetcher = useAction<typeof action>({
onError: (data) => {
diff --git a/apps/erp/app/modules/production/ui/Procedures/ProcedureExplorer.tsx b/apps/erp/app/modules/production/ui/Procedures/ProcedureExplorer.tsx
index e02c0155eb..006e639121 100644
--- a/apps/erp/app/modules/production/ui/Procedures/ProcedureExplorer.tsx
+++ b/apps/erp/app/modules/production/ui/Procedures/ProcedureExplorer.tsx
@@ -571,7 +571,7 @@ function ProcedureStepItem({
<DropdownMenuTrigger asChild>
<IconButton
aria-label={t`More`}
- className="opacity-0 group-hover:opacity-100 group-active:opacity-100 data-[state=open]:opacity-100 compact:opacity-100"
+ className="opacity-0 group-hover:opacity-100 group-active:opacity-100 data-[state=open]:opacity-100 max-md:opacity-100"
icon={<LuEllipsisVertical />}
variant="solid"
onClick={(e) => e.stopPropagation()}
@@ -663,7 +663,7 @@ function ProcedureParameterItem({
<DropdownMenuTrigger asChild>
<IconButton
aria-label={t`More`}
- className="opacity-0 group-hover:opacity-100 group-active:opacity-100 data-[state=open]:opacity-100 compact:opacity-100"
+ className="opacity-0 group-hover:opacity-100 group-active:opacity-100 data-[state=open]:opacity-100 max-md:opacity-100"
icon={<LuEllipsisVertical />}
variant="solid"
onClick={(e) => e.stopPropagation()}
diff --git a/apps/erp/app/modules/production/ui/Schedule/ForecastHeader.tsx b/apps/erp/app/modules/production/ui/Schedule/ForecastHeader.tsx
index 501eda1329..6d5ce20041 100644
--- a/apps/erp/app/modules/production/ui/Schedule/ForecastHeader.tsx
+++ b/apps/erp/app/modules/production/ui/Schedule/ForecastHeader.tsx
@@ -213,7 +213,7 @@ export function ForecastHeader({
}, [weekStart, locale]);
return (
- <HStack className="pl-2 pr-4 py-2 flex flex-wrap gap-y-2 justify-between bg-card border-b border-border compact:pl-4">
+ <HStack className="pl-2 pr-4 py-2 flex flex-wrap gap-y-2 justify-between bg-card border-b border-border max-md:pl-4">
<HStack className="flex-wrap gap-y-2">
<HStack spacing={2} className="flex-wrap gap-y-2">
<Combobox
diff --git a/apps/erp/app/modules/production/ui/Schedule/Kanban/components/BatchItemCard.tsx b/apps/erp/app/modules/production/ui/Schedule/Kanban/components/BatchItemCard.tsx
index ef8d00b61e..da206b44e0 100644
--- a/apps/erp/app/modules/production/ui/Schedule/Kanban/components/BatchItemCard.tsx
+++ b/apps/erp/app/modules/production/ui/Schedule/Kanban/components/BatchItemCard.tsx
@@ -341,7 +341,7 @@ export function BatchItemCard({
icon={<LuX />}
variant="ghost"
size="sm"
- className="opacity-0 group-hover:opacity-100 text-muted-foreground hover:text-destructive compact:opacity-100"
+ className="opacity-0 group-hover:opacity-100 text-muted-foreground hover:text-destructive max-md:opacity-100"
onClick={() => setRemoving(m)}
/>
)}
diff --git a/apps/erp/app/modules/production/ui/Schedule/Kanban/components/ColumnCard.tsx b/apps/erp/app/modules/production/ui/Schedule/Kanban/components/ColumnCard.tsx
index aa2864089e..555b924891 100644
--- a/apps/erp/app/modules/production/ui/Schedule/Kanban/components/ColumnCard.tsx
+++ b/apps/erp/app/modules/production/ui/Schedule/Kanban/components/ColumnCard.tsx
@@ -108,7 +108,7 @@ export function ColumnCard<T extends Item = Item>({
dragging: isOverlay ? "overlay" : isDragging ? "over" : undefined
})} flex flex-col p-[1px] pt-0`,
// Phones: one column with a peek of the next.
- "compact:w-[300px]",
+ "max-md:w-[300px]",
currentFilters.length > 0
? `h-[calc(100dvh-var(--header-height)*2-var(--filters-height))]`
: `h-[calc(100dvh-var(--header-height)*2)]`
@@ -214,7 +214,7 @@ export function BoardContainer({ children }: { children: React.ReactNode }) {
>
{/* min-w-max: the row must span the full scroll width so a sticky
column keeps sticking past the first viewport-width of scrolling */}
- <div className="flex min-w-max gap-0 items-start flex-row justify-start p-0 compact:px-4">
+ <div className="flex min-w-max gap-0 items-start flex-row justify-start p-0 max-md:px-4">
{children}
</div>
<ScrollBar orientation="horizontal" forceMount className="h-5" />
diff --git a/apps/erp/app/modules/production/ui/Schedule/OutboundTable.tsx b/apps/erp/app/modules/production/ui/Schedule/OutboundTable.tsx
index 18039a1e7d..23d11fda40 100644
--- a/apps/erp/app/modules/production/ui/Schedule/OutboundTable.tsx
+++ b/apps/erp/app/modules/production/ui/Schedule/OutboundTable.tsx
@@ -267,7 +267,7 @@ const OutboundTable = memo(
// No attachments here, so the portal-only customerId is never read.
// Phones: the strip scrolls sideways so segment labels stay whole.
cell: ({ row }) => (
- <div className="contents compact:block compact:max-w-full compact:overflow-x-auto compact:scroll-fade-x compact:[&>div>*]:shrink-0">
+ <div className="contents max-md:block max-md:max-w-full max-md:overflow-x-auto max-md:scroll-fade-x max-md:[&>div>*]:shrink-0">
<JobOperationProgress
customerId=""
jobOperations={row.original.operations}
diff --git a/apps/erp/app/modules/production/ui/Schedule/People/PeopleColumn.tsx b/apps/erp/app/modules/production/ui/Schedule/People/PeopleColumn.tsx
index c94d313177..c68d49b582 100644
--- a/apps/erp/app/modules/production/ui/Schedule/People/PeopleColumn.tsx
+++ b/apps/erp/app/modules/production/ui/Schedule/People/PeopleColumn.tsx
@@ -72,7 +72,7 @@ export function PeopleColumn({
sticky && isScrolled && "shadow-[6px_0_12px_-6px_rgba(0,0,0,0.15)]",
// Phones: a pinned 300px column would leave no room for the rest, so
// Unassigned scrolls with the board like any other column.
- sticky && "compact:static compact:shadow-none"
+ sticky && "max-md:static max-md:shadow-none"
)}
>
<div className="p-4 w-full font-semibold text-left flex flex-row items-center gap-2 sticky top-0 z-1 border-b bg-card">
diff --git a/apps/erp/app/modules/production/ui/Schedule/People/PeopleHeader.tsx b/apps/erp/app/modules/production/ui/Schedule/People/PeopleHeader.tsx
index f26d6bd68c..d2f0f66691 100644
--- a/apps/erp/app/modules/production/ui/Schedule/People/PeopleHeader.tsx
+++ b/apps/erp/app/modules/production/ui/Schedule/People/PeopleHeader.tsx
@@ -190,7 +190,7 @@ export function PeopleHeader({
};
return (
- <HStack className="pl-2 pr-4 py-2 flex flex-wrap gap-y-2 justify-between bg-card border-b border-border compact:pl-4">
+ <HStack className="pl-2 pr-4 py-2 flex flex-wrap gap-y-2 justify-between bg-card border-b border-border max-md:pl-4">
<HStack className="flex-wrap gap-y-2">
<HStack spacing={2} className="flex-wrap gap-y-2">
<Combobox
diff --git a/apps/erp/app/modules/production/ui/Schedule/People/PeopleWeekBoard.tsx b/apps/erp/app/modules/production/ui/Schedule/People/PeopleWeekBoard.tsx
index efb7119b44..f34c31167f 100644
--- a/apps/erp/app/modules/production/ui/Schedule/People/PeopleWeekBoard.tsx
+++ b/apps/erp/app/modules/production/ui/Schedule/People/PeopleWeekBoard.tsx
@@ -149,7 +149,7 @@ function WeekCard({
<button
type="button"
aria-label="Remove"
- className="rounded-md p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-red-600 dark:hover:text-red-400 compact:hit-area"
+ className="rounded-md p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-red-600 dark:hover:text-red-400 max-md:hit-area"
onPointerDown={(e) => e.stopPropagation()}
onClick={() => onRemove(item)}
>
@@ -235,7 +235,7 @@ function WeekColumn({
sticky && isScrolled && "shadow-[6px_0_12px_-6px_rgba(0,0,0,0.15)]",
// Phones: a pinned 300px column would leave no room for the rest, so
// Unassigned scrolls with the board like any other column.
- sticky && "compact:static compact:shadow-none"
+ sticky && "max-md:static max-md:shadow-none"
)}
>
<div className="p-4 w-full font-semibold text-left flex flex-row items-center sticky top-0 z-1 border-b bg-card">
diff --git a/apps/erp/app/modules/production/ui/Schedule/WorkCenterAvailabilityPopover.tsx b/apps/erp/app/modules/production/ui/Schedule/WorkCenterAvailabilityPopover.tsx
index c683bf101b..f6fb57eca4 100644
--- a/apps/erp/app/modules/production/ui/Schedule/WorkCenterAvailabilityPopover.tsx
+++ b/apps/erp/app/modules/production/ui/Schedule/WorkCenterAvailabilityPopover.tsx
@@ -92,7 +92,7 @@ export function WorkCenterAvailabilityPopover({
aria-label={t`How are these hours calculated?`}
// Stop the row's onClick (which selects the node) from firing.
onClick={(e) => e.stopPropagation()}
- className="flex size-5 shrink-0 items-center justify-center rounded-sm text-muted-foreground/70 opacity-0 transition hover:bg-muted hover:text-foreground focus-visible:opacity-100 group-hover:opacity-100 data-[state=open]:opacity-100 compact:opacity-100"
+ className="flex size-5 shrink-0 items-center justify-center rounded-sm text-muted-foreground/70 opacity-0 transition hover:bg-muted hover:text-foreground focus-visible:opacity-100 group-hover:opacity-100 data-[state=open]:opacity-100 max-md:opacity-100"
>
<LuInfo className="size-3.5" />
</button>
diff --git a/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderDeliveryForm.tsx b/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderDeliveryForm.tsx
index 22ac474a8b..a02749307c 100644
--- a/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderDeliveryForm.tsx
+++ b/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderDeliveryForm.tsx
@@ -166,7 +166,7 @@ const PurchaseOrderDeliveryForm = forwardRef<
/>
<Input name="trackingNumber" label={t`Tracking Number`} />
- <div className="col-span-3 compact:col-span-full">
+ <div className="col-span-3 max-md:col-span-full">
<Boolean
name="dropShipment"
label={t`Drop Shipment`}
diff --git a/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderExplorer.tsx b/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderExplorer.tsx
index 2392260a92..98a51d375f 100644
--- a/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderExplorer.tsx
+++ b/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderExplorer.tsx
@@ -375,7 +375,7 @@ function PurchaseOrderLineItem({
<DropdownMenuTrigger asChild>
<IconButton
aria-label={t`More`}
- className="opacity-0 group-hover:opacity-100 group-active:opacity-100 data-[state=open]:opacity-100 compact:opacity-100"
+ className="opacity-0 group-hover:opacity-100 group-active:opacity-100 data-[state=open]:opacity-100 max-md:opacity-100"
icon={<LuEllipsisVertical />}
variant="solid"
onClick={(e) => e.stopPropagation()}
diff --git a/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderLineForm.tsx b/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderLineForm.tsx
index fa3460ef51..9d13436dbd 100644
--- a/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderLineForm.tsx
+++ b/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderLineForm.tsx
@@ -502,7 +502,7 @@ const PurchaseOrderLineForm = ({
>
<HStack
className={cn(
- "w-full justify-between items-start compact:flex-col compact:items-stretch compact:space-x-0",
+ "w-full justify-between items-start max-md:flex-col max-md:items-stretch max-md:space-x-0",
type === "modal" && "pr-16"
)}
>
@@ -574,7 +574,7 @@ const PurchaseOrderLineForm = ({
)}
</ModalCardDescription>
</ModalCardHeader>
- <div className="flex-shrink-0 compact:min-w-0 compact:overflow-x-auto compact:scroll-fade-x compact:px-4 compact:pb-2 compact:empty:hidden">
+ <div className="flex-shrink-0 max-md:min-w-0 max-md:overflow-x-auto max-md:scroll-fade-x max-md:px-4 max-md:pb-2 max-md:empty:hidden">
{!isEditing && (
<TabsList>
<TabsTrigger value="item">
@@ -923,7 +923,7 @@ const PurchaseOrderLineForm = ({
className={
activeTab === "asset"
? "col-span-1"
- : "col-span-3 compact:col-span-full"
+ : "col-span-3 max-md:col-span-full"
}
>
<FormLabel>
diff --git a/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderSummary.tsx b/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderSummary.tsx
index 5a718692e9..0b33a4bfc4 100644
--- a/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderSummary.tsx
+++ b/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderSummary.tsx
@@ -124,12 +124,12 @@ const LineItems = ({
{line.thumbnailPath ? (
<img
alt={itemReadableId!}
- className="w-24 h-24 shrink-0 bg-gradient-to-bl from-muted to-muted/40 rounded-lg compact:size-14"
+ className="w-24 h-24 shrink-0 bg-gradient-to-bl from-muted to-muted/40 rounded-lg max-md:size-14"
src={getPrivateUrl(line.thumbnailPath)}
/>
) : (
- <div className="w-24 h-24 shrink-0 bg-gradient-to-bl from-muted to-muted/40 rounded-lg p-4 compact:size-14 compact:p-3">
- <LuImage className="w-16 h-16 text-muted-foreground compact:size-8" />
+ <div className="w-24 h-24 shrink-0 bg-gradient-to-bl from-muted to-muted/40 rounded-lg p-4 max-md:size-14 max-md:p-3">
+ <LuImage className="w-16 h-16 text-muted-foreground max-md:size-8" />
</div>
)}
@@ -143,10 +143,10 @@ const LineItems = ({
children need w-full because VStack is items-start, which
sizes each child to its own content and leaves truncate
inert no matter how narrow the column gets. */}
- <div className="flex items-center justify-between w-full compact:flex-wrap compact:gap-y-2">
+ <div className="flex items-center justify-between w-full max-md:flex-wrap max-md:gap-y-2">
<VStack
spacing={0}
- className="flex-1 min-w-0 compact:basis-full"
+ className="flex-1 min-w-0 max-md:basis-full"
>
<HStack spacing={2} className="flex min-w-0 w-full">
<Heading className="truncate">{itemReadableId}</Heading>
@@ -172,7 +172,7 @@ const LineItems = ({
</VStack>
<VStack
spacing={2}
- className="flex-shrink-0 items-end w-auto compact:basis-full compact:items-start"
+ className="flex-shrink-0 items-end w-auto max-md:basis-full max-md:items-start"
>
<HStack spacing={4}>
<VStack spacing={0}>
diff --git a/apps/erp/app/modules/purchasing/ui/PurchaseReturnOrders/PurchaseReturnOrderExplorer.tsx b/apps/erp/app/modules/purchasing/ui/PurchaseReturnOrders/PurchaseReturnOrderExplorer.tsx
index f07b80f00b..8aa58fa676 100644
--- a/apps/erp/app/modules/purchasing/ui/PurchaseReturnOrders/PurchaseReturnOrderExplorer.tsx
+++ b/apps/erp/app/modules/purchasing/ui/PurchaseReturnOrders/PurchaseReturnOrderExplorer.tsx
@@ -323,7 +323,7 @@ function PurchaseReturnOrderLineItem({
<IconButton
aria-label={disclosure.isOpen ? t`Hide` : t`Show`}
className={cn(
- "animate opacity-0 group-hover:opacity-100 group-active:opacity-100 data-[state=open]:opacity-100 compact:opacity-100",
+ "animate opacity-0 group-hover:opacity-100 group-active:opacity-100 data-[state=open]:opacity-100 max-md:opacity-100",
disclosure.isOpen && "-rotate-180"
)}
icon={<LuChevronDown />}
@@ -338,7 +338,7 @@ function PurchaseReturnOrderLineItem({
<DropdownMenuTrigger asChild>
<IconButton
aria-label="More"
- className="opacity-0 group-hover:opacity-100 group-active:opacity-100 data-[state=open]:opacity-100 compact:opacity-100"
+ className="opacity-0 group-hover:opacity-100 group-active:opacity-100 data-[state=open]:opacity-100 max-md:opacity-100"
icon={<LuEllipsisVertical />}
size="md"
variant="solid"
diff --git a/apps/erp/app/modules/purchasing/ui/PurchasingRfq/PurchasingRFQExplorer.tsx b/apps/erp/app/modules/purchasing/ui/PurchasingRfq/PurchasingRFQExplorer.tsx
index d62fb73b5e..b1f6ba5a4d 100644
--- a/apps/erp/app/modules/purchasing/ui/PurchasingRfq/PurchasingRFQExplorer.tsx
+++ b/apps/erp/app/modules/purchasing/ui/PurchasingRfq/PurchasingRFQExplorer.tsx
@@ -298,7 +298,7 @@ function PurchasingRFQLineItem({
<DropdownMenuTrigger asChild>
<IconButton
aria-label={t`More`}
- className="opacity-0 group-hover:opacity-100 group-active:opacity-100 data-[state=open]:opacity-100 compact:opacity-100"
+ className="opacity-0 group-hover:opacity-100 group-active:opacity-100 data-[state=open]:opacity-100 max-md:opacity-100"
icon={<LuEllipsisVertical />}
variant="solid"
onClick={(e) => e.stopPropagation()}
diff --git a/apps/erp/app/modules/purchasing/ui/PurchasingRfq/PurchasingRFQLineForm.tsx b/apps/erp/app/modules/purchasing/ui/PurchasingRfq/PurchasingRFQLineForm.tsx
index 4fe59d7e94..1c3d2d4402 100644
--- a/apps/erp/app/modules/purchasing/ui/PurchasingRfq/PurchasingRFQLineForm.tsx
+++ b/apps/erp/app/modules/purchasing/ui/PurchasingRfq/PurchasingRFQLineForm.tsx
@@ -240,7 +240,7 @@ const PurchasingRFQLineForm = ({
/>
<VStack>
<div className="grid w-full gap-x-8 gap-y-4 grid-cols-1 lg:grid-cols-3">
- <div className="col-span-2 compact:col-span-full grid w-full gap-x-8 gap-y-4 grid-cols-1 lg:grid-cols-2 auto-rows-min">
+ <div className="col-span-2 max-md:col-span-full grid w-full gap-x-8 gap-y-4 grid-cols-1 lg:grid-cols-2 auto-rows-min">
<Item
autoFocus
name="itemId"
diff --git a/apps/erp/app/modules/purchasing/ui/Supplier/SupplierHeader.tsx b/apps/erp/app/modules/purchasing/ui/Supplier/SupplierHeader.tsx
index 8bad464a7e..088e916a15 100644
--- a/apps/erp/app/modules/purchasing/ui/Supplier/SupplierHeader.tsx
+++ b/apps/erp/app/modules/purchasing/ui/Supplier/SupplierHeader.tsx
@@ -179,7 +179,7 @@ const SupplierHeader = () => {
<RecordPhoneChrome menu={menuItems} copyValue={supplierId} />
<VStack>
<Card>
- <HStack className="justify-between items-start compact:hidden">
+ <HStack className="justify-between items-start max-md:hidden">
<CardHeader>
<CardTitle className="flex items-center gap-2">
<span>{routeData?.supplier?.name}</span>
diff --git a/apps/erp/app/modules/purchasing/ui/Supplier/SupplierPaymentForm.tsx b/apps/erp/app/modules/purchasing/ui/Supplier/SupplierPaymentForm.tsx
index c52caef202..b5fa6efdb4 100644
--- a/apps/erp/app/modules/purchasing/ui/Supplier/SupplierPaymentForm.tsx
+++ b/apps/erp/app/modules/purchasing/ui/Supplier/SupplierPaymentForm.tsx
@@ -79,7 +79,7 @@ const SupplierPaymentForm = ({ initialValues }: SupplierPaymentFormProps) => {
<CustomFormFields table="supplierPayment" />
</div>
</CardContent>
- <CardFooter className="compact:[&>*]:flex-1 compact:[&>div>*]:flex-1 compact:[&_button]:h-11">
+ <CardFooter className="max-md:[&>*]:flex-1 max-md:[&>div>*]:flex-1 max-md:[&_button]:h-11">
<HStack>
<Submit isDisabled={isDisabled}>
<Trans>Save</Trans>
diff --git a/apps/erp/app/modules/purchasing/ui/Supplier/SupplierShippingForm.tsx b/apps/erp/app/modules/purchasing/ui/Supplier/SupplierShippingForm.tsx
index 6123e4bf64..04fe2829b7 100644
--- a/apps/erp/app/modules/purchasing/ui/Supplier/SupplierShippingForm.tsx
+++ b/apps/erp/app/modules/purchasing/ui/Supplier/SupplierShippingForm.tsx
@@ -106,7 +106,7 @@ const SupplierShippingForm = ({ initialValues }: SupplierShippingFormProps) => {
<CustomFormFields table="supplierShipping" />
</div>
</CardContent>
- <CardFooter className="compact:[&>*]:flex-1 compact:[&>div>*]:flex-1 compact:[&_button]:h-11">
+ <CardFooter className="max-md:[&>*]:flex-1 max-md:[&>div>*]:flex-1 max-md:[&_button]:h-11">
<HStack>
<Submit isDisabled={isDisabled}>
<Trans>Save</Trans>
diff --git a/apps/erp/app/modules/purchasing/ui/Supplier/SupplierTaxForm.tsx b/apps/erp/app/modules/purchasing/ui/Supplier/SupplierTaxForm.tsx
index 3c62acc53f..451e8af660 100644
--- a/apps/erp/app/modules/purchasing/ui/Supplier/SupplierTaxForm.tsx
+++ b/apps/erp/app/modules/purchasing/ui/Supplier/SupplierTaxForm.tsx
@@ -101,7 +101,7 @@ const SupplierTaxForm = ({ initialValues }: SupplierTaxFormProps) => {
<div />
)}
- <div className="col-span-3 compact:col-span-full">
+ <div className="col-span-3 max-md:col-span-full">
<Boolean
name="taxExempt"
label={t`Tax Exempt`}
@@ -159,7 +159,7 @@ const SupplierTaxForm = ({ initialValues }: SupplierTaxFormProps) => {
</div>
)}
</CardContent>
- <CardFooter className="compact:[&>*]:flex-1 compact:[&>div>*]:flex-1 compact:[&_button]:h-11">
+ <CardFooter className="max-md:[&>*]:flex-1 max-md:[&>div>*]:flex-1 max-md:[&_button]:h-11">
<HStack>
<Submit isDisabled={isDisabled}>
<Trans>Save</Trans>
diff --git a/apps/erp/app/modules/purchasing/ui/Supplier/SuppliersTable.tsx b/apps/erp/app/modules/purchasing/ui/Supplier/SuppliersTable.tsx
index a47c75a5fe..5a4cec86c9 100644
--- a/apps/erp/app/modules/purchasing/ui/Supplier/SuppliersTable.tsx
+++ b/apps/erp/app/modules/purchasing/ui/Supplier/SuppliersTable.tsx
@@ -488,7 +488,7 @@ const SuppliersTable = memo(function SuppliersTable({
permissions.can("create", "purchasing") && (
<div className="flex items-center gap-2">
<Button
- className="compact:hidden"
+ className="max-md:hidden"
variant="secondary"
leftIcon={<LuShapes />}
asChild
diff --git a/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteExplorer.tsx b/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteExplorer.tsx
index 215f185a01..9735b23cc7 100644
--- a/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteExplorer.tsx
+++ b/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteExplorer.tsx
@@ -323,7 +323,7 @@ function SupplierQuoteLineItem({
<DropdownMenuTrigger asChild>
<IconButton
aria-label={t`More`}
- className="opacity-0 group-hover:opacity-100 group-active:opacity-100 data-[state=open]:opacity-100 compact:opacity-100"
+ className="opacity-0 group-hover:opacity-100 group-active:opacity-100 data-[state=open]:opacity-100 max-md:opacity-100"
icon={<LuEllipsisVertical />}
variant="solid"
onClick={(e) => e.stopPropagation()}
diff --git a/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteLineForm.tsx b/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteLineForm.tsx
index 95a625ee0a..4a525fe726 100644
--- a/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteLineForm.tsx
+++ b/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteLineForm.tsx
@@ -301,7 +301,7 @@ const SupplierQuoteLineForm = ({
/>
<VStack>
<div className="grid w-full gap-x-8 gap-y-4 grid-cols-1 lg:grid-cols-3">
- <div className="col-span-2 compact:col-span-full grid w-full gap-x-8 gap-y-4 grid-cols-1 lg:grid-cols-2 auto-rows-min">
+ <div className="col-span-2 max-md:col-span-full grid w-full gap-x-8 gap-y-4 grid-cols-1 lg:grid-cols-2 auto-rows-min">
<Item
autoFocus
name="itemId"
@@ -392,7 +392,7 @@ const SupplierQuoteLineForm = ({
<Hidden name="supplierQuoteLineType" value="G/L Account" />
<VStack>
<div className="grid w-full gap-x-8 gap-y-4 grid-cols-1 lg:grid-cols-3">
- <div className="col-span-2 compact:col-span-full grid w-full gap-x-8 gap-y-4 grid-cols-1 lg:grid-cols-2 auto-rows-min">
+ <div className="col-span-2 max-md:col-span-full grid w-full gap-x-8 gap-y-4 grid-cols-1 lg:grid-cols-2 auto-rows-min">
<Account
name="accountId"
label={t`GL Account`}
diff --git a/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteSummary.tsx b/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteSummary.tsx
index d38232915e..40190a2401 100644
--- a/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteSummary.tsx
+++ b/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteSummary.tsx
@@ -120,12 +120,12 @@ const LineItems = ({
{line.thumbnailPath ? (
<img
alt={itemReadableId!}
- className="w-24 h-24 shrink-0 bg-gradient-to-bl from-muted to-muted/40 rounded-lg compact:size-14"
+ className="w-24 h-24 shrink-0 bg-gradient-to-bl from-muted to-muted/40 rounded-lg max-md:size-14"
src={getPrivateUrl(line.thumbnailPath)}
/>
) : (
- <div className="w-24 h-24 shrink-0 bg-gradient-to-bl from-muted to-muted/40 rounded-lg p-4 compact:size-14 compact:p-3">
- <LuImage className="w-16 h-16 text-muted-foreground compact:size-8" />
+ <div className="w-24 h-24 shrink-0 bg-gradient-to-bl from-muted to-muted/40 rounded-lg p-4 max-md:size-14 max-md:p-3">
+ <LuImage className="w-16 h-16 text-muted-foreground max-md:size-8" />
</div>
)}
diff --git a/apps/erp/app/modules/quality/ui/Documents/QualityDocumentEditor.tsx b/apps/erp/app/modules/quality/ui/Documents/QualityDocumentEditor.tsx
index 7f19d6f750..656f8fb9ed 100644
--- a/apps/erp/app/modules/quality/ui/Documents/QualityDocumentEditor.tsx
+++ b/apps/erp/app/modules/quality/ui/Documents/QualityDocumentEditor.tsx
@@ -106,7 +106,7 @@ export default function QualityDocumentEditor() {
}}
/>
) : (
- <div className="flex flex-col gap-6 w-full h-full p-8 compact:p-4">
+ <div className="flex flex-col gap-6 w-full h-full p-8 max-md:p-4">
<h1 className="md:text-3xl text-2xl font-semibold leading-tight tracking-tight text-foreground">
{documentName}
</h1>
diff --git a/apps/erp/app/modules/quality/ui/Inspections/InspectionMeasurementGrid.tsx b/apps/erp/app/modules/quality/ui/Inspections/InspectionMeasurementGrid.tsx
index acd90a549b..26ed2483d9 100644
--- a/apps/erp/app/modules/quality/ui/Inspections/InspectionMeasurementGrid.tsx
+++ b/apps/erp/app/modules/quality/ui/Inspections/InspectionMeasurementGrid.tsx
@@ -646,7 +646,7 @@ const InspectionMeasurementGrid = ({
header: t`Characteristic`,
cell: ({ row }) => (
<span
- className="line-clamp-2 max-w-[180px] text-xs compact:whitespace-normal"
+ className="line-clamp-2 max-w-[180px] text-xs max-md:whitespace-normal"
title={row.original.description ?? undefined}
>
{row.original.description ?? "—"}
diff --git a/apps/erp/app/modules/quality/ui/Inspections/InspectionView.tsx b/apps/erp/app/modules/quality/ui/Inspections/InspectionView.tsx
index 7b68533d0c..751327b5e4 100644
--- a/apps/erp/app/modules/quality/ui/Inspections/InspectionView.tsx
+++ b/apps/erp/app/modules/quality/ui/Inspections/InspectionView.tsx
@@ -506,7 +506,7 @@ const InspectionView = ({
<RecordHero subtitle={metaLine} status={statusBadge} />
<RecordPhoneChrome />
{/* Header bar — mirrors InspectionDocumentEditor's header */}
- <div className="flex min-h-[var(--header-height)] flex-shrink-0 flex-wrap items-center justify-between gap-x-3 gap-y-2 overflow-x-auto border-b border-border bg-card px-4 py-2 scrollbar-hide compact:hidden">
+ <div className="flex min-h-[var(--header-height)] flex-shrink-0 flex-wrap items-center justify-between gap-x-3 gap-y-2 overflow-x-auto border-b border-border bg-card px-4 py-2 scrollbar-hide max-md:hidden">
<div className="min-w-0 flex-1 pr-2">
<HStack spacing={2} className="items-center">
<h1 className="truncate text-base font-semibold">
@@ -604,7 +604,7 @@ const InspectionView = ({
<div
className={`flex min-h-0 min-w-full flex-col overflow-hidden rounded-lg border bg-muted ${
gridExpanded
- ? "shrink-0 compact:!h-[40dvh]"
+ ? "shrink-0 max-md:!h-[40dvh]"
: "min-h-[220px] flex-1"
}`}
style={{
@@ -644,7 +644,7 @@ const InspectionView = ({
aria-orientation="horizontal"
aria-label={t`Drag to resize drawing and characteristics`}
aria-valuenow={Math.round(pdfPaneHeightPx)}
- className={`group flex h-2 shrink-0 cursor-row-resize touch-none items-center justify-center rounded-md px-2 hover:bg-muted/80 compact:hidden ${
+ className={`group flex h-2 shrink-0 cursor-row-resize touch-none items-center justify-center rounded-md px-2 hover:bg-muted/80 max-md:hidden ${
isResizingSplit ? "bg-muted" : ""
}`}
onMouseDown={onSplitResizeMouseDown}
@@ -657,7 +657,7 @@ const InspectionView = ({
<div
className={
gridExpanded
- ? "flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden rounded-lg bg-card compact:mt-2 compact:!min-h-0"
+ ? "flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden rounded-lg bg-card max-md:mt-2 max-md:!min-h-0"
: "flex max-h-[14rem] min-w-0 shrink-0 flex-col overflow-hidden rounded-lg bg-card"
}
style={
@@ -719,7 +719,7 @@ const InspectionView = ({
// No drawing: the grid takes the full body. Feature-driven lots still
// render their features; lots without a document collapse to the
// single "Overall result" row inside the same grid.
- <div className="flex min-h-0 flex-1 flex-col overflow-hidden px-4 pb-4 pt-2 compact:px-0">
+ <div className="flex min-h-0 flex-1 flex-col overflow-hidden px-4 pb-4 pt-2 max-md:px-0">
<div className="flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden rounded-lg bg-card">
<div className="min-h-0 flex-1 overflow-auto">
<InspectionMeasurementGrid
diff --git a/apps/erp/app/modules/quality/ui/Inspections/InspectionsTable.tsx b/apps/erp/app/modules/quality/ui/Inspections/InspectionsTable.tsx
index 17f9cb4c95..67ccbe1bb8 100644
--- a/apps/erp/app/modules/quality/ui/Inspections/InspectionsTable.tsx
+++ b/apps/erp/app/modules/quality/ui/Inspections/InspectionsTable.tsx
@@ -76,7 +76,7 @@ const InspectionsTable = memo(({ data, count }: InspectionsTableProps) => {
header: t`Item`,
cell: ({ row }) => (
<div className="flex flex-col gap-0">
- <span className="text-sm font-medium compact:text-[13px] compact:font-normal">
+ <span className="text-sm font-medium max-md:text-[13px] max-md:font-normal">
{getItemReadableId(items, (row.original as any).itemId) ??
(row.original as any).itemReadableId ??
""}
diff --git a/apps/erp/app/modules/quality/ui/Issue/AssociatedItemsList.tsx b/apps/erp/app/modules/quality/ui/Issue/AssociatedItemsList.tsx
index d415bc1c20..626a86292e 100644
--- a/apps/erp/app/modules/quality/ui/Issue/AssociatedItemsList.tsx
+++ b/apps/erp/app/modules/quality/ui/Issue/AssociatedItemsList.tsx
@@ -403,8 +403,8 @@ export function AssociatedItemsList({
}
}}
>
- <div className="flex items-start w-full gap-4 compact:flex-wrap compact:gap-y-2">
- <div className="flex flex-col min-w-0 flex-1 compact:basis-full">
+ <div className="flex items-start w-full gap-4 max-md:flex-wrap max-md:gap-y-2">
+ <div className="flex flex-col min-w-0 flex-1 max-md:basis-full">
<h3 className="font-semibold truncate">
{item.readableIdWithRevision}
</h3>
diff --git a/apps/erp/app/modules/quality/ui/Issue/IssueAssociations.tsx b/apps/erp/app/modules/quality/ui/Issue/IssueAssociations.tsx
index 0d2e771366..445a7899a5 100644
--- a/apps/erp/app/modules/quality/ui/Issue/IssueAssociations.tsx
+++ b/apps/erp/app/modules/quality/ui/Issue/IssueAssociations.tsx
@@ -279,7 +279,7 @@ export function IssueAssociationItem({
icon={<LuEllipsisVertical />}
variant="ghost"
size="sm"
- className="absolute right-1 top-1 flex-shrink-0 opacity-0 group-hover/association:opacity-100 data-[state=open]:opacity-100 text-foreground/70 hover:text-foreground compact:opacity-100"
+ className="absolute right-1 top-1 flex-shrink-0 opacity-0 group-hover/association:opacity-100 data-[state=open]:opacity-100 text-foreground/70 hover:text-foreground max-md:opacity-100"
/>
</DropdownMenuTrigger>
<DropdownMenuContent>
diff --git a/apps/erp/app/modules/quality/ui/IssueWorkflows/IssueWorkflowForm.tsx b/apps/erp/app/modules/quality/ui/IssueWorkflows/IssueWorkflowForm.tsx
index 4533763326..91a2c5045d 100644
--- a/apps/erp/app/modules/quality/ui/IssueWorkflows/IssueWorkflowForm.tsx
+++ b/apps/erp/app/modules/quality/ui/IssueWorkflows/IssueWorkflowForm.tsx
@@ -148,7 +148,7 @@ const IssueWorkflowForm = ({
/>
<VStack
spacing={4}
- className="py-12 px-4 max-w-[50rem] h-full mx-auto gap-2 compact:pt-4"
+ className="py-12 px-4 max-w-[50rem] h-full mx-auto gap-2 max-md:pt-4"
>
<HStack className="w-full justify-between">
<VStack spacing={0}>
@@ -272,7 +272,7 @@ const IssueWorkflowForm = ({
key={action.id}
type="button"
onClick={() => handleAddAction(action.id)}
- className="flex items-center gap-2 px-3 py-2 border border-dashed rounded-lg hover:bg-accent hover:text-accent-foreground transition-colors text-left text-sm compact:min-h-11"
+ className="flex items-center gap-2 px-3 py-2 border border-dashed rounded-lg hover:bg-accent hover:text-accent-foreground transition-colors text-left text-sm max-md:min-h-11"
>
<Checkbox
onClick={(e) => e.preventDefault()}
diff --git a/apps/erp/app/modules/quality/ui/RiskRegister/RiskRegisterCard.tsx b/apps/erp/app/modules/quality/ui/RiskRegister/RiskRegisterCard.tsx
index 0cee2c00b4..14ea2631df 100644
--- a/apps/erp/app/modules/quality/ui/RiskRegister/RiskRegisterCard.tsx
+++ b/apps/erp/app/modules/quality/ui/RiskRegister/RiskRegisterCard.tsx
@@ -235,7 +235,7 @@ function RiskRegisterCardItem({
</p>
)}
</div>
- <div className="flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity compact:opacity-100">
+ <div className="flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity max-md:opacity-100">
<IconButton
aria-label={t`Edit`}
icon={<LuSettings2 className="h-4 w-4" />}
diff --git a/apps/erp/app/modules/quality/ui/RiskRegister/RiskRegistersTable.tsx b/apps/erp/app/modules/quality/ui/RiskRegister/RiskRegistersTable.tsx
index 6b98673d54..bd3ead75b3 100644
--- a/apps/erp/app/modules/quality/ui/RiskRegister/RiskRegistersTable.tsx
+++ b/apps/erp/app/modules/quality/ui/RiskRegister/RiskRegistersTable.tsx
@@ -6,8 +6,8 @@ import {
MENU_ITEM_SHORTCUTS,
MenuIcon,
MenuItem,
- useCompact,
- useDisclosure
+ useDisclosure,
+ useViewport
} from "@carbon/react";
import { getItemById, getItemReadableId } from "@carbon/utils";
import { useLingui } from "@lingui/react/macro";
@@ -69,7 +69,7 @@ const RiskRegistersTable = memo(({ data, count }: RiskRegistersTableProps) => {
const [people] = usePeople();
const { t } = useLingui();
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
const permissions = usePermissions();
const deleteModal = useDisclosure();
const [selectedRisk, setSelectedRisk] = useState<Risk | null>(null);
@@ -153,7 +153,7 @@ const RiskRegistersTable = memo(({ data, count }: RiskRegistersTableProps) => {
header: t`Source`,
// Phones: line 2 is muted context, not a second row of pills.
cell: (item) =>
- isCompact ? (
+ isPhone ? (
<span className="text-muted-foreground">
{item.getValue<string>()}
</span>
@@ -256,7 +256,7 @@ const RiskRegistersTable = memo(({ data, count }: RiskRegistersTableProps) => {
}
];
return defaultColumns;
- }, [people, items, workCenters.options.map, t, isCompact]);
+ }, [people, items, workCenters.options.map, t, isPhone]);
const renderContextMenu = useCallback<(row: Risk) => JSX.Element>(
(row) => (
diff --git a/apps/erp/app/modules/resources/ui/Locations/LocationsTable.tsx b/apps/erp/app/modules/resources/ui/Locations/LocationsTable.tsx
index 6bb1c7a5e6..fa130041ce 100644
--- a/apps/erp/app/modules/resources/ui/Locations/LocationsTable.tsx
+++ b/apps/erp/app/modules/resources/ui/Locations/LocationsTable.tsx
@@ -6,7 +6,7 @@ import {
MENU_ITEM_SHORTCUTS,
MenuIcon,
MenuItem,
- useCompact
+ useViewport
} from "@carbon/react";
import { Trans, useLingui } from "@lingui/react/macro";
import type { ColumnDef } from "@tanstack/react-table";
@@ -38,7 +38,7 @@ type LocationsTableProps = {
const LocationsTable = memo(({ data, count }: LocationsTableProps) => {
const { t } = useLingui();
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
const navigate = useNavigate();
const permissions = usePermissions();
const [params] = useUrlParams();
@@ -69,7 +69,7 @@ const LocationsTable = memo(({ data, count }: LocationsTableProps) => {
header: t`Address`,
cell: (item) =>
// Phones: line 2 is the joined address (street, city, state).
- isCompact
+ isPhone
? [
item.row.original.addressLine1,
item.row.original.city,
@@ -148,7 +148,7 @@ const LocationsTable = memo(({ data, count }: LocationsTableProps) => {
}
];
return [...defaultColumns, ...customColumns];
- }, [people, customColumns, isCompact, t]);
+ }, [people, customColumns, isPhone, t]);
const renderContextMenu = useCallback(
(row: (typeof data)[number]) => {
diff --git a/apps/erp/app/modules/resources/ui/Maintenance/MaintenanceDispatchExplorer.tsx b/apps/erp/app/modules/resources/ui/Maintenance/MaintenanceDispatchExplorer.tsx
index 6426a1ebc7..28c9c3dd30 100644
--- a/apps/erp/app/modules/resources/ui/Maintenance/MaintenanceDispatchExplorer.tsx
+++ b/apps/erp/app/modules/resources/ui/Maintenance/MaintenanceDispatchExplorer.tsx
@@ -382,7 +382,7 @@ function MaintenanceExplorerChildItem({
icon={<LuEllipsisVertical />}
variant="ghost"
size="sm"
- className="absolute right-1 top-1 flex-shrink-0 opacity-0 group-hover/child:opacity-100 data-[state=open]:opacity-100 text-foreground/70 hover:text-foreground compact:opacity-100"
+ className="absolute right-1 top-1 flex-shrink-0 opacity-0 group-hover/child:opacity-100 data-[state=open]:opacity-100 text-foreground/70 hover:text-foreground max-md:opacity-100"
/>
</DropdownMenuTrigger>
<DropdownMenuContent>
diff --git a/apps/erp/app/modules/resources/ui/Maintenance/MaintenanceDispatchForm.tsx b/apps/erp/app/modules/resources/ui/Maintenance/MaintenanceDispatchForm.tsx
index 8a8ebd2b3b..d0e05bb2c2 100644
--- a/apps/erp/app/modules/resources/ui/Maintenance/MaintenanceDispatchForm.tsx
+++ b/apps/erp/app/modules/resources/ui/Maintenance/MaintenanceDispatchForm.tsx
@@ -205,7 +205,7 @@ const MaintenanceDispatchForm = ({
<Boolean
bordered
- className="col-span-2 compact:col-span-1"
+ className="col-span-2 max-md:col-span-1"
name="takesWorkCenterOffline"
label={t`Takes work center offline`}
description={t`While this dispatch is open, the work center is unavailable to the schedule (until the planned end time, or until the dispatch is completed).`}
diff --git a/apps/erp/app/modules/resources/ui/Maintenance/MaintenanceDispatchNotes.tsx b/apps/erp/app/modules/resources/ui/Maintenance/MaintenanceDispatchNotes.tsx
index 844ae3e445..b2b51552ac 100644
--- a/apps/erp/app/modules/resources/ui/Maintenance/MaintenanceDispatchNotes.tsx
+++ b/apps/erp/app/modules/resources/ui/Maintenance/MaintenanceDispatchNotes.tsx
@@ -33,8 +33,8 @@ import {
Thead,
Tr,
toast,
- useCompact,
- useDebounce
+ useDebounce,
+ useViewport
} from "@carbon/react";
import { Editor } from "@carbon/react/Editor";
import { Trans, useLingui } from "@lingui/react/macro";
@@ -188,7 +188,7 @@ function MaintenanceFilesContent({
isReadOnly: boolean;
}) {
const { t } = useLingui();
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
const { carbon } = useCarbon();
const { company } = useUser();
const revalidator = useRevalidator();
@@ -373,7 +373,7 @@ function MaintenanceFilesContent({
</Tbody>
</Table>
{/* Phones: the header Upload already opens the same picker. */}
- {!isReadOnly && !isCompact && <FileDropzone onDrop={onDrop} />}
+ {!isReadOnly && !isPhone && <FileDropzone onDrop={onDrop} />}
</>
);
}
diff --git a/apps/erp/app/modules/resources/ui/Training/TrainingExplorer.tsx b/apps/erp/app/modules/resources/ui/Training/TrainingExplorer.tsx
index 0c1a16efbc..14be380790 100644
--- a/apps/erp/app/modules/resources/ui/Training/TrainingExplorer.tsx
+++ b/apps/erp/app/modules/resources/ui/Training/TrainingExplorer.tsx
@@ -421,7 +421,7 @@ function TrainingQuestionItem({
<DropdownMenuTrigger asChild>
<IconButton
aria-label={t`More`}
- className="opacity-0 group-hover:opacity-100 group-active:opacity-100 data-[state=open]:opacity-100 compact:opacity-100"
+ className="opacity-0 group-hover:opacity-100 group-active:opacity-100 data-[state=open]:opacity-100 max-md:opacity-100"
icon={<LuEllipsisVertical />}
variant="solid"
onClick={(e) => e.stopPropagation()}
diff --git a/apps/erp/app/modules/sales/ui/Customer/CustomerHeader.tsx b/apps/erp/app/modules/sales/ui/Customer/CustomerHeader.tsx
index 79b148374f..837d2ee0d4 100644
--- a/apps/erp/app/modules/sales/ui/Customer/CustomerHeader.tsx
+++ b/apps/erp/app/modules/sales/ui/Customer/CustomerHeader.tsx
@@ -123,7 +123,7 @@ const CustomerHeader = () => {
<RecordPhoneChrome menu={menuItems} copyValue={customerId} />
<VStack>
<Card>
- <HStack className="justify-between items-start compact:hidden">
+ <HStack className="justify-between items-start max-md:hidden">
<CardHeader>
<CardTitle className="flex items-center gap-2">
<span>{routeData?.customer?.name}</span>
diff --git a/apps/erp/app/modules/sales/ui/Customer/CustomerPaymentForm.tsx b/apps/erp/app/modules/sales/ui/Customer/CustomerPaymentForm.tsx
index 88f7b630fe..6fb933e95b 100644
--- a/apps/erp/app/modules/sales/ui/Customer/CustomerPaymentForm.tsx
+++ b/apps/erp/app/modules/sales/ui/Customer/CustomerPaymentForm.tsx
@@ -79,7 +79,7 @@ const CustomerPaymentForm = ({ initialValues }: CustomerPaymentFormProps) => {
<CustomFormFields table="customerPayment" />
</div>
</CardContent>
- <CardFooter className="compact:[&>*]:flex-1 compact:[&>div>*]:flex-1 compact:[&_button]:h-11">
+ <CardFooter className="max-md:[&>*]:flex-1 max-md:[&>div>*]:flex-1 max-md:[&_button]:h-11">
<HStack>
<Submit isDisabled={isDisabled}>
<Trans>Save</Trans>
diff --git a/apps/erp/app/modules/sales/ui/Customer/CustomerShippingForm.tsx b/apps/erp/app/modules/sales/ui/Customer/CustomerShippingForm.tsx
index 9bf7a4e59c..ba59b1fe6a 100644
--- a/apps/erp/app/modules/sales/ui/Customer/CustomerShippingForm.tsx
+++ b/apps/erp/app/modules/sales/ui/Customer/CustomerShippingForm.tsx
@@ -106,7 +106,7 @@ const CustomerShippingForm = ({ initialValues }: CustomerShippingFormProps) => {
<CustomFormFields table="customerShipping" />
</div>
</CardContent>
- <CardFooter className="compact:[&>*]:flex-1 compact:[&>div>*]:flex-1 compact:[&_button]:h-11">
+ <CardFooter className="max-md:[&>*]:flex-1 max-md:[&>div>*]:flex-1 max-md:[&_button]:h-11">
<HStack>
<Submit isDisabled={isDisabled}>
<Trans>Save</Trans>
diff --git a/apps/erp/app/modules/sales/ui/Customer/CustomerTaxForm.tsx b/apps/erp/app/modules/sales/ui/Customer/CustomerTaxForm.tsx
index b4e0f8759b..f1b118cd2c 100644
--- a/apps/erp/app/modules/sales/ui/Customer/CustomerTaxForm.tsx
+++ b/apps/erp/app/modules/sales/ui/Customer/CustomerTaxForm.tsx
@@ -100,7 +100,7 @@ const CustomerTaxForm = ({ initialValues }: CustomerTaxFormProps) => {
) : (
<div />
)}
- <div className="col-span-3 compact:col-span-full">
+ <div className="col-span-3 max-md:col-span-full">
<Boolean
name="taxExempt"
label={t`Tax Exempt`}
@@ -159,7 +159,7 @@ const CustomerTaxForm = ({ initialValues }: CustomerTaxFormProps) => {
</div>
)}
</CardContent>
- <CardFooter className="compact:[&>*]:flex-1 compact:[&>div>*]:flex-1 compact:[&_button]:h-11">
+ <CardFooter className="max-md:[&>*]:flex-1 max-md:[&>div>*]:flex-1 max-md:[&_button]:h-11">
<HStack>
<Submit isDisabled={isDisabled}>
<Trans>Save</Trans>
diff --git a/apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx b/apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx
index 2137cc50dc..3a3afb761f 100644
--- a/apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx
+++ b/apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx
@@ -26,7 +26,7 @@ export function PriceListScopeEmpty({
heading={t`Price Lists`}
description={t`Pick a customer or customer type to view their pricing.`}
>
- <div className="flex justify-center [&>[role=combobox]]:!min-w-[400px] compact:[&>[role=combobox]]:!min-w-0 compact:[&>[role=combobox]]:w-full compact:[&>[role=combobox]]:h-11 compact:[&>[role=combobox]]:rounded-md compact:[&>[role=combobox]]:text-base">
+ <div className="flex justify-center [&>[role=combobox]]:!min-w-[400px] max-md:[&>[role=combobox]]:!min-w-0 max-md:[&>[role=combobox]]:w-full max-md:[&>[role=combobox]]:h-11 max-md:[&>[role=combobox]]:rounded-md max-md:[&>[role=combobox]]:text-base">
<ScopePicker
size="md"
value={value}
diff --git a/apps/erp/app/modules/sales/ui/Pricing/PriceOverrideForm.tsx b/apps/erp/app/modules/sales/ui/Pricing/PriceOverrideForm.tsx
index f5f56f1505..36b3fafee5 100644
--- a/apps/erp/app/modules/sales/ui/Pricing/PriceOverrideForm.tsx
+++ b/apps/erp/app/modules/sales/ui/Pricing/PriceOverrideForm.tsx
@@ -213,7 +213,7 @@ const PriceOverrideForm = ({
companyId={company?.id}
/>
- <div className="grid grid-cols-2 gap-3 w-full compact:grid-cols-1">
+ <div className="grid grid-cols-2 gap-3 w-full max-md:grid-cols-1">
<BooleanField
name="active"
label={t`Active`}
@@ -227,7 +227,7 @@ const PriceOverrideForm = ({
/>
</div>
- <div className="grid grid-cols-2 gap-3 w-full compact:grid-cols-1">
+ <div className="grid grid-cols-2 gap-3 w-full max-md:grid-cols-1">
<DatePicker name="validFrom" label={t`Valid From`} />
<DatePicker
name="validTo"
diff --git a/apps/erp/app/modules/sales/ui/Quotes/QuoteBillOfMaterial.tsx b/apps/erp/app/modules/sales/ui/Quotes/QuoteBillOfMaterial.tsx
index 8140247e0d..a59cfc56e6 100644
--- a/apps/erp/app/modules/sales/ui/Quotes/QuoteBillOfMaterial.tsx
+++ b/apps/erp/app/modules/sales/ui/Quotes/QuoteBillOfMaterial.tsx
@@ -154,7 +154,7 @@ function makeItem(
to={getLinkToItemDetails(material.itemType, material.itemId)}
onClick={(e) => e.stopPropagation()}
>
- <LuExternalLink className="h-4 w-4 opacity-0 group-hover:opacity-100 compact:opacity-100" />
+ <LuExternalLink className="h-4 w-4 opacity-0 group-hover:opacity-100 max-md:opacity-100" />
</Link>
)}
</div>
@@ -841,7 +841,7 @@ function MaterialForm({
onChange={(newValue) => {
setItemData((d) => ({ ...d, description: newValue }));
}}
- className="col-span-2 compact:col-span-full"
+ className="col-span-2 max-md:col-span-full"
/>
{itemData.methodType !== "Make to Order" && (
<NumberControlled
diff --git a/apps/erp/app/modules/sales/ui/Quotes/QuoteBillOfProcess.tsx b/apps/erp/app/modules/sales/ui/Quotes/QuoteBillOfProcess.tsx
index 53c311fc9c..0b2f13cd90 100644
--- a/apps/erp/app/modules/sales/ui/Quotes/QuoteBillOfProcess.tsx
+++ b/apps/erp/app/modules/sales/ui/Quotes/QuoteBillOfProcess.tsx
@@ -978,7 +978,7 @@ function AttributesForm({
<VStack
spacing={2}
- className="w-full col-span-2 compact:col-span-full"
+ className="w-full col-span-2 max-md:col-span-full"
>
<Label>Description</Label>
<Editor
@@ -1227,7 +1227,7 @@ function AttributesListItem({
<VStack
spacing={2}
- className="w-full col-span-2 compact:col-span-full"
+ className="w-full col-span-2 max-md:col-span-full"
>
<Label>Description</Label>
<Editor
@@ -2021,7 +2021,7 @@ function OperationForm({
onChange={(newValue) => {
setProcessData((d) => ({ ...d, description: newValue }));
}}
- className="col-span-2 compact:col-span-full"
+ className="col-span-2 max-md:col-span-full"
/>
<Select
diff --git a/apps/erp/app/modules/sales/ui/Quotes/QuoteExplorer.tsx b/apps/erp/app/modules/sales/ui/Quotes/QuoteExplorer.tsx
index 95d1ee4e64..0b4b5b1b22 100644
--- a/apps/erp/app/modules/sales/ui/Quotes/QuoteExplorer.tsx
+++ b/apps/erp/app/modules/sales/ui/Quotes/QuoteExplorer.tsx
@@ -518,7 +518,7 @@ function QuoteLineItem({
<IconButton
aria-label={disclosure.isOpen ? "Hide" : "Show"}
className={cn(
- "animate opacity-0 group-hover:opacity-100 group-active:opacity-100 data-[state=open]:opacity-100 compact:opacity-100",
+ "animate opacity-0 group-hover:opacity-100 group-active:opacity-100 data-[state=open]:opacity-100 max-md:opacity-100",
disclosure.isOpen && "-rotate-180"
)}
icon={<LuChevronDown />}
@@ -534,7 +534,7 @@ function QuoteLineItem({
<DropdownMenuTrigger asChild>
<IconButton
aria-label="More"
- className="opacity-0 group-hover:opacity-100 group-active:opacity-100 data-[state=open]:opacity-100 compact:opacity-100"
+ className="opacity-0 group-hover:opacity-100 group-active:opacity-100 data-[state=open]:opacity-100 max-md:opacity-100"
icon={<LuEllipsisVertical />}
size="md"
variant="solid"
diff --git a/apps/erp/app/modules/sales/ui/Quotes/QuoteLineForm.tsx b/apps/erp/app/modules/sales/ui/Quotes/QuoteLineForm.tsx
index 1bc1e678d8..418360ffd9 100644
--- a/apps/erp/app/modules/sales/ui/Quotes/QuoteLineForm.tsx
+++ b/apps/erp/app/modules/sales/ui/Quotes/QuoteLineForm.tsx
@@ -427,7 +427,7 @@ const QuoteLineForm = ({
)}
<VStack>
<div className="grid w-full gap-x-8 gap-y-4 grid-cols-1 lg:grid-cols-3">
- <div className="col-span-2 compact:col-span-full grid w-full gap-x-8 gap-y-4 grid-cols-1 lg:grid-cols-2 auto-rows-min">
+ <div className="col-span-2 max-md:col-span-full grid w-full gap-x-8 gap-y-4 grid-cols-1 lg:grid-cols-2 auto-rows-min">
<Item
autoFocus
name="itemId"
diff --git a/apps/erp/app/modules/sales/ui/Quotes/QuoteSummary.tsx b/apps/erp/app/modules/sales/ui/Quotes/QuoteSummary.tsx
index 21546a3dfd..25013d49e0 100644
--- a/apps/erp/app/modules/sales/ui/Quotes/QuoteSummary.tsx
+++ b/apps/erp/app/modules/sales/ui/Quotes/QuoteSummary.tsx
@@ -178,12 +178,12 @@ const LineItems = ({
{line.thumbnailPath ? (
<img
alt={line.itemReadableId!}
- className="w-24 h-24 shrink-0 bg-gradient-to-bl from-muted to-muted/40 rounded-lg compact:size-14"
+ className="w-24 h-24 shrink-0 bg-gradient-to-bl from-muted to-muted/40 rounded-lg max-md:size-14"
src={getPrivateUrl(line.thumbnailPath)}
/>
) : (
- <div className="w-24 h-24 shrink-0 bg-gradient-to-bl from-muted to-muted/40 rounded-lg p-4 compact:size-14 compact:p-3">
- <LuImage className="w-16 h-16 text-muted-foreground compact:size-8" />
+ <div className="w-24 h-24 shrink-0 bg-gradient-to-bl from-muted to-muted/40 rounded-lg p-4 max-md:size-14 max-md:p-3">
+ <LuImage className="w-16 h-16 text-muted-foreground max-md:size-8" />
</div>
)}
@@ -192,7 +192,7 @@ const LineItems = ({
className="flex flex-col cursor-pointer w-full"
onClick={() => toggleOpen(line.id!)}
>
- <div className="flex items-center gap-x-4 justify-between flex-grow compact:flex-wrap compact:gap-y-2">
+ <div className="flex items-center gap-x-4 justify-between flex-grow max-md:flex-wrap max-md:gap-y-2">
<HStack spacing={2} className="min-w-0 flex-shrink">
<Heading className="truncate">
{line.itemReadableId}
diff --git a/apps/erp/app/modules/sales/ui/Quotes/QuotesTable.tsx b/apps/erp/app/modules/sales/ui/Quotes/QuotesTable.tsx
index 05eb28c51f..19cb748f9e 100644
--- a/apps/erp/app/modules/sales/ui/Quotes/QuotesTable.tsx
+++ b/apps/erp/app/modules/sales/ui/Quotes/QuotesTable.tsx
@@ -123,7 +123,7 @@ const QuotesTable = memo(({ data, count }: QuotesTableProps) => {
const completedLines = row.original.completedLines ?? 0;
return status === "Draft" ? (
<BarProgress
- className="compact:w-24"
+ className="max-md:w-24"
gradient
progress={lines === 0 ? 0 : (completedLines / lines) * 100}
/>
diff --git a/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderExplorer.tsx b/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderExplorer.tsx
index 40e219c2ef..979e44784f 100644
--- a/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderExplorer.tsx
+++ b/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderExplorer.tsx
@@ -409,7 +409,7 @@ function SalesOrderLineItem({
<IconButton
aria-label={disclosure.isOpen ? "Hide" : "Show"}
className={cn(
- "animate opacity-0 group-hover:opacity-100 group-active:opacity-100 data-[state=open]:opacity-100 compact:opacity-100",
+ "animate opacity-0 group-hover:opacity-100 group-active:opacity-100 data-[state=open]:opacity-100 max-md:opacity-100",
disclosure.isOpen && "-rotate-180"
)}
icon={<LuChevronDown />}
@@ -424,7 +424,7 @@ function SalesOrderLineItem({
<DropdownMenuTrigger asChild>
<IconButton
aria-label="More"
- className="opacity-0 group-hover:opacity-100 group-active:opacity-100 data-[state=open]:opacity-100 compact:opacity-100"
+ className="opacity-0 group-hover:opacity-100 group-active:opacity-100 data-[state=open]:opacity-100 max-md:opacity-100"
icon={<LuEllipsisVertical />}
size="md"
variant="solid"
diff --git a/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderLineForm.tsx b/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderLineForm.tsx
index 60520a45bf..b6dc134178 100644
--- a/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderLineForm.tsx
+++ b/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderLineForm.tsx
@@ -503,7 +503,7 @@ const SalesOrderLineForm = ({
>
<HStack
className={cn(
- "w-full justify-between items-start compact:flex-col compact:items-stretch compact:space-x-0",
+ "w-full justify-between items-start max-md:flex-col max-md:items-stretch max-md:space-x-0",
type === "modal" && "pr-16"
)}
>
@@ -577,7 +577,7 @@ const SalesOrderLineForm = ({
)}
</ModalCardDescription>
</ModalCardHeader>
- <div className="flex-shrink-0 flex items-center gap-2 compact:min-w-0 compact:overflow-x-auto compact:scroll-fade-x compact:px-4 compact:pb-2 compact:empty:hidden">
+ <div className="flex-shrink-0 flex items-center gap-2 max-md:min-w-0 max-md:overflow-x-auto max-md:scroll-fade-x max-md:px-4 max-md:pb-2 max-md:empty:hidden">
{!isEditing && (
<TabsList>
<TabsTrigger value="item">
diff --git a/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderShipmentForm.tsx b/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderShipmentForm.tsx
index 0af3859299..a6e9d06ea9 100644
--- a/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderShipmentForm.tsx
+++ b/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderShipmentForm.tsx
@@ -173,7 +173,7 @@ const SalesOrderShipmentForm = forwardRef<
/>
<Input name="trackingNumber" label={t`Tracking Number`} />
- <div className="col-span-3 compact:col-span-full">
+ <div className="col-span-3 max-md:col-span-full">
<Boolean
name="dropShipment"
label={t`Drop Shipment`}
diff --git a/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderSummary.tsx b/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderSummary.tsx
index 1176bc5daa..fab933b9ea 100644
--- a/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderSummary.tsx
+++ b/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderSummary.tsx
@@ -396,12 +396,12 @@ function LineItems({
{line.thumbnailPath ? (
<img
alt={line.itemReadableId!}
- className="w-24 h-24 shrink-0 bg-gradient-to-bl from-muted to-muted/40 rounded-lg compact:size-14"
+ className="w-24 h-24 shrink-0 bg-gradient-to-bl from-muted to-muted/40 rounded-lg max-md:size-14"
src={getPrivateUrl(line.thumbnailPath)}
/>
) : (
- <div className="w-24 h-24 shrink-0 bg-gradient-to-bl from-muted to-muted/40 rounded-lg p-4 compact:size-14 compact:p-3">
- <LuImage className="w-16 h-16 text-muted-foreground compact:size-8" />
+ <div className="w-24 h-24 shrink-0 bg-gradient-to-bl from-muted to-muted/40 rounded-lg p-4 max-md:size-14 max-md:p-3">
+ <LuImage className="w-16 h-16 text-muted-foreground max-md:size-8" />
</div>
)}
@@ -415,10 +415,10 @@ function LineItems({
children need w-full because VStack is items-start, which
sizes each child to its own content and leaves truncate
inert no matter how narrow the column gets. */}
- <div className="flex items-center justify-between w-full compact:flex-wrap compact:gap-y-2">
+ <div className="flex items-center justify-between w-full max-md:flex-wrap max-md:gap-y-2">
<VStack
spacing={0}
- className="flex-1 min-w-0 compact:basis-full"
+ className="flex-1 min-w-0 max-md:basis-full"
>
<HStack spacing={2} className="flex min-w-0 w-full">
<Heading className="truncate">
@@ -446,7 +446,7 @@ function LineItems({
</VStack>
<VStack
spacing={2}
- className="flex-shrink-0 items-end w-auto compact:basis-full compact:items-start"
+ className="flex-shrink-0 items-end w-auto max-md:basis-full max-md:items-start"
>
<HStack spacing={4}>
<MotionMoney
@@ -500,7 +500,7 @@ function LineItems({
<Badge variant={jobVariant}>{jobLabel}</Badge>
{jobs.length > 0 && (
<Tooltip>
- <TooltipTrigger className="compact:hit-area">
+ <TooltipTrigger className="max-md:hit-area">
<Badge variant="secondary">
{jobs.length} <Trans>Jobs</Trans>
<LuEllipsisVertical className="w-3 h-3 ml-2" />
diff --git a/apps/erp/app/modules/sales/ui/SalesRFQ/SalesRFQExplorer.tsx b/apps/erp/app/modules/sales/ui/SalesRFQ/SalesRFQExplorer.tsx
index aacf07f998..c188b00823 100644
--- a/apps/erp/app/modules/sales/ui/SalesRFQ/SalesRFQExplorer.tsx
+++ b/apps/erp/app/modules/sales/ui/SalesRFQ/SalesRFQExplorer.tsx
@@ -444,7 +444,7 @@ function SalesRFQLineItem({
<DropdownMenuTrigger asChild>
<IconButton
aria-label="More"
- className="opacity-0 group-hover:opacity-100 group-active:opacity-100 data-[state=open]:opacity-100 compact:opacity-100"
+ className="opacity-0 group-hover:opacity-100 group-active:opacity-100 data-[state=open]:opacity-100 max-md:opacity-100"
icon={<LuEllipsisVertical />}
variant="solid"
onClick={(e) => e.stopPropagation()}
diff --git a/apps/erp/app/modules/sales/ui/SalesRFQ/SalesRFQLineForm.tsx b/apps/erp/app/modules/sales/ui/SalesRFQ/SalesRFQLineForm.tsx
index f62fb51fac..e0be3fddb3 100644
--- a/apps/erp/app/modules/sales/ui/SalesRFQ/SalesRFQLineForm.tsx
+++ b/apps/erp/app/modules/sales/ui/SalesRFQ/SalesRFQLineForm.tsx
@@ -266,7 +266,7 @@ const SalesRFQLineForm = ({
/>
<VStack>
<div className="grid w-full gap-x-8 gap-y-4 grid-cols-1 lg:grid-cols-3">
- <div className="col-span-2 compact:col-span-full grid w-full gap-x-8 gap-y-4 grid-cols-1 lg:grid-cols-2 auto-rows-min">
+ <div className="col-span-2 max-md:col-span-full grid w-full gap-x-8 gap-y-4 grid-cols-1 lg:grid-cols-2 auto-rows-min">
<InputControlled
name="customerPartId"
label={t`Customer Part Number`}
diff --git a/apps/erp/app/modules/sales/ui/SalesReturnOrders/SalesReturnOrderExplorer.tsx b/apps/erp/app/modules/sales/ui/SalesReturnOrders/SalesReturnOrderExplorer.tsx
index 2e4ba068f0..9aa724fac0 100644
--- a/apps/erp/app/modules/sales/ui/SalesReturnOrders/SalesReturnOrderExplorer.tsx
+++ b/apps/erp/app/modules/sales/ui/SalesReturnOrders/SalesReturnOrderExplorer.tsx
@@ -320,7 +320,7 @@ function SalesReturnOrderLineItem({
<IconButton
aria-label={disclosure.isOpen ? t`Hide` : t`Show`}
className={cn(
- "animate opacity-0 group-hover:opacity-100 group-active:opacity-100 data-[state=open]:opacity-100 compact:opacity-100",
+ "animate opacity-0 group-hover:opacity-100 group-active:opacity-100 data-[state=open]:opacity-100 max-md:opacity-100",
disclosure.isOpen && "-rotate-180"
)}
icon={<LuChevronDown />}
@@ -335,7 +335,7 @@ function SalesReturnOrderLineItem({
<DropdownMenuTrigger asChild>
<IconButton
aria-label="More"
- className="opacity-0 group-hover:opacity-100 group-active:opacity-100 data-[state=open]:opacity-100 compact:opacity-100"
+ className="opacity-0 group-hover:opacity-100 group-active:opacity-100 data-[state=open]:opacity-100 max-md:opacity-100"
icon={<LuEllipsisVertical />}
size="md"
variant="solid"
diff --git a/apps/erp/app/modules/sales/ui/SalesRules/SalesRulesGroups.tsx b/apps/erp/app/modules/sales/ui/SalesRules/SalesRulesGroups.tsx
index 06e354a328..c7d5dd7d03 100644
--- a/apps/erp/app/modules/sales/ui/SalesRules/SalesRulesGroups.tsx
+++ b/apps/erp/app/modules/sales/ui/SalesRules/SalesRulesGroups.tsx
@@ -96,12 +96,12 @@ const SalesRulesGroups = memo(({ rules }: SalesRulesGroupsProps) => {
<ScrollArea className="w-full h-[calc(100dvh-var(--topbar-height)-var(--content-inset))] bg-card">
<VStack
spacing={4}
- className="py-12 px-4 max-w-[60rem] h-full mx-auto gap-4 compact:py-4"
+ className="py-12 px-4 max-w-[60rem] h-full mx-auto gap-4 max-md:py-4"
>
<div className="flex flex-col gap-1 w-full">
<Heading
size="h3"
- className="tracking-tight text-balance compact:sr-only"
+ className="tracking-tight text-balance max-md:sr-only"
>
<Trans>Sales Rules</Trans>
</Heading>
@@ -182,26 +182,26 @@ const SalesRuleCard = memo(({ rule }: { rule: SalesRuleListItem }) => {
<Accordion type="multiple" className="w-full">
<AccordionItem value={rule.id} className="border-none">
<div className="relative">
- <AccordionTrigger className="px-6 py-6 hover:no-underline w-full compact:px-4 compact:py-4 compact:min-w-0">
+ <AccordionTrigger className="px-6 py-6 hover:no-underline w-full max-md:px-4 max-md:py-4 max-md:min-w-0">
<HStack
spacing={4}
- className="flex-1 justify-between pr-12 compact:min-w-0 compact:flex-wrap compact:space-x-0 compact:gap-2 compact:pr-14"
+ className="flex-1 justify-between pr-12 max-md:min-w-0 max-md:flex-wrap max-md:space-x-0 max-md:gap-2 max-md:pr-14"
>
- <div className="flex items-center gap-3 min-w-0 compact:basis-full">
+ <div className="flex items-center gap-3 min-w-0 max-md:basis-full">
<Heading size="h4" as="h3" className="truncate">
{rule.name}
</Heading>
{rule.severity === "error" ? (
- <Badge variant="red" className="compact:shrink-0">
+ <Badge variant="red" className="max-md:shrink-0">
<Trans>Error</Trans>
</Badge>
) : (
- <Badge variant="yellow" className="compact:shrink-0">
+ <Badge variant="yellow" className="max-md:shrink-0">
<Trans>Warn</Trans>
</Badge>
)}
{broadcastLabel && (
- <Badge variant="outline" className="compact:shrink-0">
+ <Badge variant="outline" className="max-md:shrink-0">
{broadcastLabel}
</Badge>
)}
diff --git a/apps/erp/app/modules/settings/ui/Approvals/ApprovalRuleCard.ee.tsx b/apps/erp/app/modules/settings/ui/Approvals/ApprovalRuleCard.ee.tsx
index 7e155e7f2a..93abdfc080 100644
--- a/apps/erp/app/modules/settings/ui/Approvals/ApprovalRuleCard.ee.tsx
+++ b/apps/erp/app/modules/settings/ui/Approvals/ApprovalRuleCard.ee.tsx
@@ -74,12 +74,12 @@ const ApprovalRuleCard = memo(
<Accordion type="multiple" className="w-full">
<AccordionItem value={rule.id} className="border-none">
<div className="relative">
- <AccordionTrigger className="px-6 py-8 hover:no-underline w-full compact:px-4 compact:py-4">
+ <AccordionTrigger className="px-6 py-8 hover:no-underline w-full max-md:px-4 max-md:py-4">
<HStack spacing={4} className="flex-1 justify-between pr-12">
<Heading
size="h4"
as="h3"
- className="compact:text-left compact:min-w-0"
+ className="max-md:text-left max-md:min-w-0"
>
{approvalDocumentTypeLabel[documentType]}
{approvalDocumentTypesWithAmounts.includes(
@@ -91,7 +91,7 @@ const ApprovalRuleCard = memo(
</Heading>
<Status
color={rule.enabled ? "green" : "gray"}
- className="text-xs font-medium compact:shrink-0"
+ className="text-xs font-medium max-md:shrink-0"
>
{rule.enabled ? (
<Trans>Enabled</Trans>
diff --git a/apps/erp/app/modules/settings/ui/Approvals/ApprovalRules.ee.tsx b/apps/erp/app/modules/settings/ui/Approvals/ApprovalRules.ee.tsx
index 32546c7150..80c1181d90 100644
--- a/apps/erp/app/modules/settings/ui/Approvals/ApprovalRules.ee.tsx
+++ b/apps/erp/app/modules/settings/ui/Approvals/ApprovalRules.ee.tsx
@@ -48,8 +48,8 @@ const ApprovalRules = memo(
return (
<ScrollArea className="h-full w-full">
- <div className="py-12 px-4 max-w-[60rem] mx-auto compact:py-3">
- <div className="mb-8 compact:hidden">
+ <div className="py-12 px-4 max-w-[60rem] mx-auto max-md:py-3">
+ <div className="mb-8 max-md:hidden">
<Heading size="h2">
<Trans>Approval Rules</Trans>
</Heading>
@@ -58,7 +58,7 @@ const ApprovalRules = memo(
<VStack spacing={4}>
<Card>
<CardHeader>
- <div className="flex items-center justify-between compact:flex-col compact:items-start compact:gap-3">
+ <div className="flex items-center justify-between max-md:flex-col max-md:items-start max-md:gap-3">
<div>
<CardTitle className="text-lg">
<Trans>Purchase Orders</Trans>
@@ -101,7 +101,7 @@ const ApprovalRules = memo(
<Card>
<CardHeader>
- <div className="flex items-center justify-between compact:flex-col compact:items-start compact:gap-3">
+ <div className="flex items-center justify-between max-md:flex-col max-md:items-start max-md:gap-3">
<div>
<CardTitle className="text-lg">
<Trans>Quality Documents</Trans>
@@ -146,7 +146,7 @@ const ApprovalRules = memo(
<Card>
<CardHeader>
- <div className="flex items-center justify-between compact:flex-col compact:items-start compact:gap-3">
+ <div className="flex items-center justify-between max-md:flex-col max-md:items-start max-md:gap-3">
<div>
<CardTitle className="text-lg">
<Trans>Suppliers</Trans>
diff --git a/apps/erp/app/modules/settings/ui/Backups/BackupContentsInfo.tsx b/apps/erp/app/modules/settings/ui/Backups/BackupContentsInfo.tsx
index 54cce3f82e..8b2436117f 100644
--- a/apps/erp/app/modules/settings/ui/Backups/BackupContentsInfo.tsx
+++ b/apps/erp/app/modules/settings/ui/Backups/BackupContentsInfo.tsx
@@ -41,7 +41,7 @@ export function BackupContentsInfo() {
<button
type="button"
aria-label={t`What a backup contains`}
- className="text-muted-foreground hover:text-foreground compact:hit-area"
+ className="text-muted-foreground hover:text-foreground max-md:hit-area"
>
<LuInfo className="h-3.5 w-3.5" />
</button>
diff --git a/apps/erp/app/modules/settings/ui/Backups/BackupSourcePicker.tsx b/apps/erp/app/modules/settings/ui/Backups/BackupSourcePicker.tsx
index 724bfe248b..e540aea214 100644
--- a/apps/erp/app/modules/settings/ui/Backups/BackupSourcePicker.tsx
+++ b/apps/erp/app/modules/settings/ui/Backups/BackupSourcePicker.tsx
@@ -37,7 +37,7 @@ type UploadState =
| { phase: "unpacking" };
const triggerClass =
- "bg-transparent text-foreground flex h-10 w-full items-center justify-between gap-2 whitespace-nowrap rounded-md border border-input px-3 py-2 text-sm shadow-xs outline-none focus:border-ring focus:ring-[3px] focus:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 compact:h-11 compact:text-base";
+ "bg-transparent text-foreground flex h-10 w-full items-center justify-between gap-2 whitespace-nowrap rounded-md border border-input px-3 py-2 text-sm shadow-xs outline-none focus:border-ring focus:ring-[3px] focus:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 max-md:h-11 max-md:text-base";
// One control combining your backups + upload new. Selecting one sets the
// hidden `source` field the restore form submits.
diff --git a/apps/erp/app/modules/settings/ui/Companies/CompaniesTreeView.tsx b/apps/erp/app/modules/settings/ui/Companies/CompaniesTreeView.tsx
index f0d37f45d0..a616f8c473 100644
--- a/apps/erp/app/modules/settings/ui/Companies/CompaniesTreeView.tsx
+++ b/apps/erp/app/modules/settings/ui/Companies/CompaniesTreeView.tsx
@@ -88,7 +88,7 @@ function CompaniesFlow({
>
<Controls
showInteractive={false}
- className="!bg-card !border-border !shadow-sm compact:!left-auto compact:!right-0 compact:[&>button]:!size-11 [&>button]:!bg-card [&>button]:!border-border [&>button]:!text-foreground [&>button:hover]:!bg-accent"
+ className="!bg-card !border-border !shadow-sm max-md:!left-auto max-md:!right-0 max-md:[&>button]:!size-11 [&>button]:!bg-card [&>button]:!border-border [&>button]:!text-foreground [&>button:hover]:!bg-accent"
/>
<Background
variant={BackgroundVariant.Dots}
@@ -149,7 +149,7 @@ export function CompaniesTreeView({
}, [initialNodes, initialEdges, setNodes, setEdges]);
return (
- <div className="h-[calc(100dvh-(var(--header-height))-61px)] w-full overflow-hidden compact:h-[calc(100dvh-var(--topbar-height)-var(--content-inset,0px)-61px)]">
+ <div className="h-[calc(100dvh-(var(--header-height))-61px)] w-full overflow-hidden max-md:h-[calc(100dvh-var(--topbar-height)-var(--content-inset,0px)-61px)]">
<ReactFlowProvider>
<CompaniesFlow
nodes={nodes}
diff --git a/apps/erp/app/modules/settings/ui/Companies/CompanyNode.tsx b/apps/erp/app/modules/settings/ui/Companies/CompanyNode.tsx
index 8170ebe424..1af8e6defe 100644
--- a/apps/erp/app/modules/settings/ui/Companies/CompanyNode.tsx
+++ b/apps/erp/app/modules/settings/ui/Companies/CompanyNode.tsx
@@ -80,7 +80,7 @@ function CompanyNodeComponent({ data }: NodeProps & { data: CompanyNodeData }) {
<DropdownMenu>
<DropdownMenuTrigger asChild>
<button
- className="ml-auto shrink-0 rounded-md p-1 opacity-0 transition-opacity hover:bg-accent group-hover:opacity-100 focus:opacity-100 compact:opacity-100 compact:hit-area"
+ className="ml-auto shrink-0 rounded-md p-1 opacity-0 transition-opacity hover:bg-accent group-hover:opacity-100 focus:opacity-100 max-md:opacity-100 max-md:hit-area"
aria-label="Actions"
>
<LuEllipsisVertical className="size-3.5 text-muted-foreground" />
diff --git a/apps/erp/app/modules/settings/ui/Integrations/AccountMapping.tsx b/apps/erp/app/modules/settings/ui/Integrations/AccountMapping.tsx
index c0bfb6b061..ae0f81f289 100644
--- a/apps/erp/app/modules/settings/ui/Integrations/AccountMapping.tsx
+++ b/apps/erp/app/modules/settings/ui/Integrations/AccountMapping.tsx
@@ -346,14 +346,14 @@ export function AccountMapping({
</div>
{grouped.length === 0 ? (
- <div className="flex w-full items-center justify-center rounded-lg border border-border py-8 text-sm text-muted-foreground compact:border-0 compact:rounded-none">
+ <div className="flex w-full items-center justify-center rounded-lg border border-border py-8 text-sm text-muted-foreground max-md:border-0 max-md:rounded-none">
<Trans>No accounts match your search</Trans>
</div>
) : (
grouped.map((group) => (
<div key={group.class} className="flex w-full flex-col gap-1">
<Subheading variant="heavy">{group.class}</Subheading>
- <div className="w-full rounded-lg border border-border compact:border-0 compact:p-0 compact:rounded-none">
+ <div className="w-full rounded-lg border border-border max-md:border-0 max-md:p-0 max-md:rounded-none">
<div className="flex w-full flex-col divide-y divide-border">
{group.accounts.map((account) => {
const mapping = mappedById.get(account.id);
@@ -624,7 +624,7 @@ function MatchByCodeDrawer({
<Trans>No unmapped accounts match a provider code</Trans>
</div>
) : (
- <div className="w-full rounded-lg border border-border compact:border-0 compact:p-0 compact:rounded-none">
+ <div className="w-full rounded-lg border border-border max-md:border-0 max-md:p-0 max-md:rounded-none">
<Table>
<Thead>
<Tr>
@@ -800,7 +800,7 @@ function AiSuggestModal({
<Trans>AI couldn't confidently match any accounts</Trans>
</div>
) : (
- <div className="w-full rounded-lg border border-border compact:border-0 compact:p-0 compact:rounded-none">
+ <div className="w-full rounded-lg border border-border max-md:border-0 max-md:p-0 max-md:rounded-none">
<Table>
<Thead>
<Tr>
diff --git a/apps/erp/app/modules/settings/ui/Integrations/AccountingSyncControl.tsx b/apps/erp/app/modules/settings/ui/Integrations/AccountingSyncControl.tsx
index 1538a38b3e..1131619032 100644
--- a/apps/erp/app/modules/settings/ui/Integrations/AccountingSyncControl.tsx
+++ b/apps/erp/app/modules/settings/ui/Integrations/AccountingSyncControl.tsx
@@ -35,7 +35,7 @@ export function AccountingSyncControl({
const isBlocked = !checked && unmappedRequiredCount > 0;
return (
- <div className="flex items-start justify-between gap-4 rounded-md border border-border bg-muted/40 px-3 py-2 compact:border-0 compact:p-0 compact:rounded-none compact:bg-transparent">
+ <div className="flex items-start justify-between gap-4 rounded-md border border-border bg-muted/40 px-3 py-2 max-md:border-0 max-md:p-0 max-md:rounded-none max-md:bg-transparent">
<div className="flex min-w-0 flex-col gap-1">
<div className="flex items-center gap-2">
<span className="text-sm font-medium">
diff --git a/apps/erp/app/modules/settings/ui/Integrations/DimensionMapping.tsx b/apps/erp/app/modules/settings/ui/Integrations/DimensionMapping.tsx
index b6ea620959..4d33ddf204 100644
--- a/apps/erp/app/modules/settings/ui/Integrations/DimensionMapping.tsx
+++ b/apps/erp/app/modules/settings/ui/Integrations/DimensionMapping.tsx
@@ -286,7 +286,7 @@ export function DimensionMapping({
)}
</p>
)}
- <div className="w-full rounded-lg border border-border compact:border-0 compact:p-0 compact:rounded-none">
+ <div className="w-full rounded-lg border border-border max-md:border-0 max-md:p-0 max-md:rounded-none">
{rows.length === 0 ? (
<div className="flex w-full items-center justify-center py-8 text-sm text-muted-foreground">
<Trans>No dimension slots configured</Trans>
@@ -571,7 +571,7 @@ function MappingSection({
</div>
<p className="text-xs text-muted-foreground">{description}</p>
</div>
- <div className="w-full rounded-lg border border-border compact:border-0 compact:p-0 compact:rounded-none">
+ <div className="w-full rounded-lg border border-border max-md:border-0 max-md:p-0 max-md:rounded-none">
{count === 0 ? (
<div className="flex w-full items-center justify-center py-8 text-sm text-muted-foreground">
{emptyMessage}
@@ -770,7 +770,7 @@ function MatchByNameDrawer({
<Trans>No unmapped values match a provider option name</Trans>
</div>
) : (
- <div className="w-full rounded-lg border border-border compact:border-0 compact:p-0 compact:rounded-none">
+ <div className="w-full rounded-lg border border-border max-md:border-0 max-md:p-0 max-md:rounded-none">
<Table>
<Thead>
<Tr>
diff --git a/apps/erp/app/modules/settings/ui/Integrations/IntegrationForm.tsx b/apps/erp/app/modules/settings/ui/Integrations/IntegrationForm.tsx
index ce388c66d8..420cae3a60 100644
--- a/apps/erp/app/modules/settings/ui/Integrations/IntegrationForm.tsx
+++ b/apps/erp/app/modules/settings/ui/Integrations/IntegrationForm.tsx
@@ -911,7 +911,7 @@ export function IntegrationForm({
</div>
)}
{installed && installMode && (
- <div className="flex flex-col gap-1 rounded-md border border-border bg-muted/40 px-3 py-2 compact:border-0 compact:p-0 compact:rounded-none compact:bg-transparent">
+ <div className="flex flex-col gap-1 rounded-md border border-border bg-muted/40 px-3 py-2 max-md:border-0 max-md:p-0 max-md:rounded-none max-md:bg-transparent">
<div className="flex items-center gap-2">
<Badge variant="secondary">{installMode.label}</Badge>
{installMode.detail && (
diff --git a/apps/erp/app/modules/settings/ui/Printing/AssignmentsCard.tsx b/apps/erp/app/modules/settings/ui/Printing/AssignmentsCard.tsx
index 5486b7b2d3..0e1917363d 100644
--- a/apps/erp/app/modules/settings/ui/Printing/AssignmentsCard.tsx
+++ b/apps/erp/app/modules/settings/ui/Printing/AssignmentsCard.tsx
@@ -304,12 +304,12 @@ function AssignmentRow({
return (
<div
className={cn(
- "flex items-center justify-between py-2.5 compact:flex-col compact:items-stretch compact:gap-2",
+ "flex items-center justify-between py-2.5 max-md:flex-col max-md:items-stretch max-md:gap-2",
isIndented && "pl-7",
!isBold && "border-t border-border/50"
)}
>
- <div className="flex items-center gap-2 compact:min-w-0">
+ <div className="flex items-center gap-2 max-md:min-w-0">
<div className="size-7 bg-muted rounded-lg flex items-center justify-center shrink-0">
<span className="size-4 text-muted-foreground">{icon}</span>
</div>
@@ -320,8 +320,8 @@ function AssignmentRow({
</span>
</div>
- <div className="flex items-center gap-4 compact:w-full compact:justify-between">
- <div className="w-[320px] compact:w-auto compact:flex-1 compact:min-w-0">
+ <div className="flex items-center gap-4 max-md:w-full max-md:justify-between">
+ <div className="w-[320px] max-md:w-auto max-md:flex-1 max-md:min-w-0">
<Combobox
size="sm"
value={printerRouteId ?? ""}
@@ -332,7 +332,7 @@ function AssignmentRow({
/>
</div>
- <div className="flex items-center gap-1.5 compact:shrink-0">
+ <div className="flex items-center gap-1.5 max-md:shrink-0">
<Switch
variant="small"
checked={autoPrint}
diff --git a/apps/erp/app/modules/settings/ui/Printing/PrintersCard.tsx b/apps/erp/app/modules/settings/ui/Printing/PrintersCard.tsx
index e9b6cf93a3..d0a5460830 100644
--- a/apps/erp/app/modules/settings/ui/Printing/PrintersCard.tsx
+++ b/apps/erp/app/modules/settings/ui/Printing/PrintersCard.tsx
@@ -88,7 +88,7 @@ export function PrintersCard({
return (
<>
<Card>
- <HStack className="w-full justify-between items-start compact:flex-col compact:items-stretch compact:gap-0">
+ <HStack className="w-full justify-between items-start max-md:flex-col max-md:items-stretch max-md:gap-0">
<CardHeader>
<CardTitle>
<Trans>Printers</Trans>
@@ -97,7 +97,7 @@ export function PrintersCard({
<Trans>Physical printers available for assignment.</Trans>
</CardDescription>
</CardHeader>
- <CardAction className="py-6 compact:pt-0 compact:pb-4 compact:px-4">
+ <CardAction className="py-6 max-md:pt-0 max-md:pb-4 max-md:px-4">
<Button
leftIcon={<LuPlus />}
onClick={() => {
diff --git a/apps/erp/app/modules/workflows/ui/Builder/BuilderControls.tsx b/apps/erp/app/modules/workflows/ui/Builder/BuilderControls.tsx
index 0d0fec9704..b0c830ddd3 100644
--- a/apps/erp/app/modules/workflows/ui/Builder/BuilderControls.tsx
+++ b/apps/erp/app/modules/workflows/ui/Builder/BuilderControls.tsx
@@ -121,7 +121,7 @@ export function BuilderControls({ panOnScroll, onTogglePanOnScroll }: Props) {
<MiniMap
pannable
zoomable
- className="!static !m-0 rounded-lg border shadow-sm compact:!hidden"
+ className="!static !m-0 rounded-lg border shadow-sm max-md:!hidden"
style={{ width: 180, height: 120 }}
/>
</Panel>
diff --git a/apps/erp/app/modules/workflows/ui/Builder/BuilderHeader.tsx b/apps/erp/app/modules/workflows/ui/Builder/BuilderHeader.tsx
index 205abb8500..edf8d648e3 100644
--- a/apps/erp/app/modules/workflows/ui/Builder/BuilderHeader.tsx
+++ b/apps/erp/app/modules/workflows/ui/Builder/BuilderHeader.tsx
@@ -15,8 +15,8 @@ import {
Tooltip,
TooltipContent,
TooltipTrigger,
- useCompact,
- useDisclosure
+ useDisclosure,
+ useViewport
} from "@carbon/react";
import { Trans, useLingui } from "@lingui/react/macro";
import { useEffect, useRef, useState } from "react";
@@ -148,7 +148,7 @@ function WorkflowTitle({
}}
>
<Heading className={headingClassName}>{name}</Heading>
- <LuPencil className="size-3 shrink-0 text-muted-foreground opacity-0 transition-opacity group-hover/title:opacity-100 compact:size-4 compact:opacity-100" />
+ <LuPencil className="size-3 shrink-0 text-muted-foreground opacity-0 transition-opacity group-hover/title:opacity-100 max-md:size-4 max-md:opacity-100" />
</button>
);
}
@@ -167,7 +167,7 @@ export function BuilderHeader({
const isVersionLocked = useBuilderStore((state) => state.isVersionLocked);
const canEdit = useBuilderStore((state) => state.canEdit);
const isReadOnly = isVersionLocked || !canEdit;
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
const publishFetcher = useFetcher<{
ok?: boolean;
@@ -231,9 +231,9 @@ export function BuilderHeader({
}
/>
<RecordPhoneChrome />
- <header className="flex h-[var(--topbar-height)] shrink-0 items-center gap-3 border-b px-4 compact:hidden">
+ <header className="flex h-[var(--topbar-height)] shrink-0 items-center gap-3 border-b px-4 max-md:hidden">
{/* One title on phones: its rename input lives in the hero there. */}
- {!isCompact && <WorkflowTitle workflow={workflow} />}
+ {!isPhone && <WorkflowTitle workflow={workflow} />}
{isReadOnly && lockIndicator}
diff --git a/apps/erp/app/modules/workflows/ui/Builder/NodeCard.tsx b/apps/erp/app/modules/workflows/ui/Builder/NodeCard.tsx
index 15d79a6d27..44177a53e4 100644
--- a/apps/erp/app/modules/workflows/ui/Builder/NodeCard.tsx
+++ b/apps/erp/app/modules/workflows/ui/Builder/NodeCard.tsx
@@ -125,7 +125,7 @@ export function NodeCard({
className={cn(
"relative rounded-lg border bg-card shadow-sm transition-[box-shadow,opacity]",
// Phones: a card is at most the screen wide, whatever its inline width.
- "compact:max-w-[calc(100vw-32px)]",
+ "max-md:max-w-[calc(100vw-32px)]",
isSelected && "border-primary ring-2 ring-primary/20",
connectionState === "compatible" &&
"border-primary ring-2 ring-primary/40",
diff --git a/apps/erp/app/modules/workflows/ui/Builder/NodePalette.tsx b/apps/erp/app/modules/workflows/ui/Builder/NodePalette.tsx
index e2ca4e19fe..9e549be32d 100644
--- a/apps/erp/app/modules/workflows/ui/Builder/NodePalette.tsx
+++ b/apps/erp/app/modules/workflows/ui/Builder/NodePalette.tsx
@@ -15,7 +15,7 @@ export function NodePalette({ onAdd }: NodePaletteProps = {}) {
const addNode = useBuilderStore((state) => state.addNode);
return (
- <aside className="flex h-full flex-col gap-1 overflow-y-auto border-r bg-card p-2 compact:border-r-0 compact:bg-transparent compact:p-0">
+ <aside className="flex h-full flex-col gap-1 overflow-y-auto border-r bg-card p-2 max-md:border-r-0 max-md:bg-transparent max-md:p-0">
{NODE_KIND_ORDER.map((type) => {
const meta = NODE_KIND_META[type];
@@ -32,17 +32,17 @@ export function NodePalette({ onAdd }: NodePaletteProps = {}) {
addNode(type);
onAdd?.();
}}
- className="flex w-full items-start gap-2 rounded-md px-2 py-1.5 text-left transition-colors hover:bg-accent active:scale-[0.96] compact:min-h-11 compact:items-center compact:gap-3 compact:py-2"
+ className="flex w-full items-start gap-2 rounded-md px-2 py-1.5 text-left transition-colors hover:bg-accent active:scale-[0.96] max-md:min-h-11 max-md:items-center max-md:gap-3 max-md:py-2"
>
<div className="flex size-7 shrink-0 items-center justify-center rounded-md bg-primary text-primary-foreground">
<meta.Icon className="size-3.5" />
</div>
- <div className="min-w-0 flex-1 pt-0.5 compact:pt-0">
- <div className="text-xs font-medium leading-none compact:text-[15px] compact:leading-tight">
+ <div className="min-w-0 flex-1 pt-0.5 max-md:pt-0">
+ <div className="text-xs font-medium leading-none max-md:text-[15px] max-md:leading-tight">
{meta.name}
</div>
{meta.description && (
- <div className="mt-0.5 truncate text-[10px] leading-snug text-muted-foreground compact:text-[13px]">
+ <div className="mt-0.5 truncate text-[10px] leading-snug text-muted-foreground max-md:text-[13px]">
{meta.description}
</div>
)}
diff --git a/apps/erp/app/modules/workflows/ui/Builder/TestRun/TestRunPanel.tsx b/apps/erp/app/modules/workflows/ui/Builder/TestRun/TestRunPanel.tsx
index 7a10e65b8f..154f1175db 100644
--- a/apps/erp/app/modules/workflows/ui/Builder/TestRun/TestRunPanel.tsx
+++ b/apps/erp/app/modules/workflows/ui/Builder/TestRun/TestRunPanel.tsx
@@ -51,16 +51,16 @@ export function TestRunPanel() {
result !== null && result.error !== null && !result.steps.length;
return (
- <div className="flex h-full flex-col border-l border-border compact:border-l-0">
+ <div className="flex h-full flex-col border-l border-border max-md:border-l-0">
{/* Phones show this panel in a full-screen sheet, whose own × closes it. */}
- <div className="flex items-center gap-2 border-b border-border p-3 compact:min-h-11 compact:pr-14">
+ <div className="flex items-center gap-2 border-b border-border p-3 max-md:min-h-11 max-md:pr-14">
<span className="text-sm font-semibold">
<Trans>Test run</Trans>
</span>
{result && <RunStatus status={result.status} />}
<IconButton
aria-label={t`Close`}
- className="ml-auto compact:hidden"
+ className="ml-auto max-md:hidden"
icon={<LuX />}
size="sm"
variant="ghost"
diff --git a/apps/erp/app/modules/workflows/ui/Builder/WorkflowBuilder.tsx b/apps/erp/app/modules/workflows/ui/Builder/WorkflowBuilder.tsx
index aca941340d..4250db2118 100644
--- a/apps/erp/app/modules/workflows/ui/Builder/WorkflowBuilder.tsx
+++ b/apps/erp/app/modules/workflows/ui/Builder/WorkflowBuilder.tsx
@@ -13,7 +13,7 @@ import {
ResizableHandle,
ResizablePanel,
ResizablePanelGroup,
- useCompact
+ useViewport
} from "@carbon/react";
import { Trans, useLingui } from "@lingui/react/macro";
import type { IsValidConnection } from "@xyflow/react";
@@ -59,7 +59,7 @@ export function WorkflowBuilder({
canPersistCanvasState
}: Props) {
const { t } = useLingui();
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
const [paletteOpen, setPaletteOpen] = useState(false);
const store = useBuilderStoreApi();
const { screenToFlowPosition } = useReactFlow();
@@ -182,7 +182,7 @@ export function WorkflowBuilder({
// Phones: the canvas fills the page. The palette opens from the app bar +,
// and a test run's result opens as a full-screen sheet; closing it discards
// the result, as the desktop panel's close does.
- if (isCompact) {
+ if (isPhone) {
return (
<div className="flex-1 overflow-hidden">
{canvas}
diff --git a/apps/erp/app/modules/workflows/ui/Builder/config/InlineNodeName.tsx b/apps/erp/app/modules/workflows/ui/Builder/config/InlineNodeName.tsx
index 1e7328b5e8..6454391bf3 100644
--- a/apps/erp/app/modules/workflows/ui/Builder/config/InlineNodeName.tsx
+++ b/apps/erp/app/modules/workflows/ui/Builder/config/InlineNodeName.tsx
@@ -100,7 +100,7 @@ export function InlineNodeName({ name, isReadOnly, isTaken, onCommit }: Props) {
<span className="truncate text-xs font-semibold">
{nodeNameLabel(name)}
</span>
- <LuPencil className="size-2.5 shrink-0 text-muted-foreground opacity-0 transition-opacity group-hover/name:opacity-100 compact:opacity-100" />
+ <LuPencil className="size-2.5 shrink-0 text-muted-foreground opacity-0 transition-opacity group-hover/name:opacity-100 max-md:opacity-100" />
</button>
</div>
);
diff --git a/apps/erp/app/modules/workflows/ui/Runs/WorkflowRunDetail.tsx b/apps/erp/app/modules/workflows/ui/Runs/WorkflowRunDetail.tsx
index 9455b5cb24..2a3807a4ec 100644
--- a/apps/erp/app/modules/workflows/ui/Runs/WorkflowRunDetail.tsx
+++ b/apps/erp/app/modules/workflows/ui/Runs/WorkflowRunDetail.tsx
@@ -57,7 +57,7 @@ function RunIdentifiers({ run }: { run: WorkflowRunDetailType }) {
<div className="space-y-1">
<button
type="button"
- className="text-xs text-muted-foreground underline underline-offset-2 compact:hit-area"
+ className="text-xs text-muted-foreground underline underline-offset-2 max-md:hit-area"
onClick={() => setRaw((p) => !p)}
>
{raw ? t`Hide raw` : t`Show raw`}
diff --git a/apps/erp/app/modules/workflows/ui/Runs/WorkflowRunSteps.tsx b/apps/erp/app/modules/workflows/ui/Runs/WorkflowRunSteps.tsx
index d1c212b525..ad2c27e8e3 100644
--- a/apps/erp/app/modules/workflows/ui/Runs/WorkflowRunSteps.tsx
+++ b/apps/erp/app/modules/workflows/ui/Runs/WorkflowRunSteps.tsx
@@ -176,7 +176,7 @@ function StepRow({
<div className="border-b border-border/50">
<button
type="button"
- className="w-full flex items-center gap-3 py-3 px-3 hover:bg-muted/50 transition-colors text-left compact:flex-wrap compact:gap-y-1"
+ className="w-full flex items-center gap-3 py-3 px-3 hover:bg-muted/50 transition-colors text-left max-md:flex-wrap max-md:gap-y-1"
onClick={() => hasDetail && setExpanded((p) => !p)}
disabled={!hasDetail}
>
@@ -215,7 +215,7 @@ function StepRow({
<p className="text-xs text-muted-foreground">{step.statusReason}</p>
)}
</div>
- <div className="ml-auto flex items-center gap-2 shrink-0 compact:ml-0 compact:basis-full compact:pl-[52px]">
+ <div className="ml-auto flex items-center gap-2 shrink-0 max-md:ml-0 max-md:basis-full max-md:pl-[52px]">
<span className="text-xs text-muted-foreground tabular-nums">
{durationLabel(step.durationMs)}
</span>
@@ -227,7 +227,7 @@ function StepRow({
<div className="px-10 pb-3 space-y-3">
<button
type="button"
- className="text-xs text-muted-foreground underline underline-offset-2 compact:hit-area"
+ className="text-xs text-muted-foreground underline underline-offset-2 max-md:hit-area"
onClick={() => setRaw((p) => !p)}
>
{raw ? t`Show summary` : t`Show raw`}
diff --git a/apps/erp/app/root.tsx b/apps/erp/app/root.tsx
index d565c7f7de..bea5e7cc0f 100644
--- a/apps/erp/app/root.tsx
+++ b/apps/erp/app/root.tsx
@@ -18,18 +18,18 @@ import { requestMiddleware } from "@carbon/logger/middleware.server";
import { timedMiddleware } from "@carbon/logger/tracing.server";
import { createInvalidationMiddleware } from "@carbon/query/cache";
import {
- CompactProvider,
OperatingSystemContextProvider,
Toaster,
TooltipProvider,
- useMode
+ useMode,
+ ViewportProvider
} from "@carbon/react";
import { RootErrorBoundary } from "@carbon/react/ErrorBoundary";
import type { Theme } from "@carbon/utils";
import {
colorSchemeHintScript,
- getCompactHint,
getPreferenceHeaders,
+ getViewportHint,
isSearchParamOnlyNavigation,
modeValidator,
prefetchCacheMiddleware,
@@ -170,7 +170,7 @@ export async function loader({ request, context }: LoaderFunctionArgs) {
XERO_CLIENT_ID
},
...getMode(request),
- compact: getCompactHint(request),
+ viewport: getViewportHint(request),
preferences: getPreferenceHeaders(request),
result: context.get(flashResultContext),
theme: getTheme(request)
@@ -255,9 +255,6 @@ export function Document({
lang={lang}
className={`${mode} h-full overflow-x-hidden`}
style={themeStyle}
- // Opts the ERP into the `compact:` (phone) variant; MES does not set it.
- // CompactProvider below is the JS half of the same opt-in.
- data-compact-ui=""
>
<head>
<meta charSet="utf-8" />
@@ -336,7 +333,7 @@ export default function App() {
return (
<QueryClientProvider client={queryClient}>
<OperatingSystemContextProvider platform={prefs.platform}>
- <CompactProvider initialCompact={loaderData?.compact ?? false}>
+ <ViewportProvider initialViewport={loaderData?.viewport ?? "desktop"}>
<LocaleProvider locale={appLanguage} catalog={catalog}>
<I18nProvider locale={prefs.locale}>
<TooltipProvider>
@@ -355,7 +352,7 @@ export default function App() {
</TooltipProvider>
</I18nProvider>
</LocaleProvider>
- </CompactProvider>
+ </ViewportProvider>
</OperatingSystemContextProvider>
</QueryClientProvider>
);
diff --git a/apps/erp/app/routes/x+/_index.tsx b/apps/erp/app/routes/x+/_index.tsx
index 5957ee99c3..81d6b23b1c 100644
--- a/apps/erp/app/routes/x+/_index.tsx
+++ b/apps/erp/app/routes/x+/_index.tsx
@@ -158,7 +158,7 @@ export default function AppIndexRoute() {
return (
<div className="relative w-full h-full overflow-hidden">
<div className="relative z-10 w-full h-full overflow-y-auto">
- <div className="max-w-7xl mx-auto p-8 compact:p-4">
+ <div className="max-w-7xl mx-auto p-8 max-md:p-4">
<div className="mb-8">
{!CONTROLLED_ENVIRONMENT && (
<OnboardAgentWidget dismissed={agentDismissed} />
@@ -166,12 +166,12 @@ export default function AppIndexRoute() {
<Greeting
hour={greeting.hour}
pick={greeting.pick}
- className="mt-6 mx-auto max-w-[30ch] text-center font-medium compact:mt-0"
+ className="mt-6 mx-auto max-w-[30ch] text-center font-medium max-md:mt-0"
/>
<div className="mt-8 flex items-center gap-3">
<SearchBar />
{/* Phones create from the Create tab. */}
- <div className="contents compact:hidden">
+ <div className="contents max-md:hidden">
<CreateMenu
trigger={
<Button
@@ -238,7 +238,7 @@ export default function AppIndexRoute() {
<SectionLabel>
<Trans>Modules</Trans>
</SectionLabel>
- <div className="grid grid-cols-1 sm:grid-cols-2 gap-4 compact:grid-cols-3 compact:gap-3">
+ <div className="grid grid-cols-1 sm:grid-cols-2 gap-4 max-md:grid-cols-3 max-md:gap-3">
{modules
.filter((mod) => mod.key !== "settings")
.map((module) => (
@@ -272,7 +272,7 @@ function SearchBar() {
>
<RxMagnifyingGlass className="w-4 h-4 shrink-0" />
<span className="text-base truncate">{t`Search`}</span>
- <div className="ml-auto flex items-center gap-1 compact:hidden">
+ <div className="ml-auto flex items-center gap-1 max-md:hidden">
<KeyCap>{modifierKey}</KeyCap>
<KeyCap>K</KeyCap>
</div>
@@ -342,13 +342,13 @@ function OnboardAgentWidget({ dismissed: initial }: { dismissed: boolean }) {
// No gap: the pill stays perfectly centered because the ✕ slot collapses to
// zero width when idle. On hover (or keyboard focus) the slot animates open,
// sliding the pill left to make room — the movement IS the reveal.
- <div className="group flex items-center justify-center compact:mb-6">
+ <div className="group flex items-center justify-center max-md:mb-6">
<Tooltip>
<TooltipTrigger asChild>
<button
type="button"
onClick={handleCopy}
- className="flex items-center gap-3 h-9 compact:h-11 pl-4 pr-4 max-w-full rounded-full border border-border bg-muted/30 text-sm font-medium text-foreground hover:bg-muted/50 transition-colors active:scale-[0.98]"
+ className="flex items-center gap-3 h-9 max-md:h-11 pl-4 pr-4 max-w-full rounded-full border border-border bg-muted/30 text-sm font-medium text-foreground hover:bg-muted/50 transition-colors active:scale-[0.98]"
>
{/* min-w-0 + overflow-hidden lets the label clip instead of
wrapping to a second line on narrow screens — the icons keep
@@ -367,7 +367,7 @@ function OnboardAgentWidget({ dismissed: initial }: { dismissed: boolean }) {
<Trans>Copies a setup prompt for your AI coding tool</Trans>
</TooltipContent>
</Tooltip>
- <div className="w-0 overflow-hidden transition-[width] duration-200 ease-out group-hover:w-8 group-focus-within:w-8 compact:w-8">
+ <div className="w-0 overflow-hidden transition-[width] duration-200 ease-out group-hover:w-8 group-focus-within:w-8 max-md:w-8">
<Tooltip>
<TooltipTrigger asChild>
<IconButton
@@ -377,7 +377,7 @@ function OnboardAgentWidget({ dismissed: initial }: { dismissed: boolean }) {
size="sm"
isRound
onClick={dismiss}
- className="ml-2 text-muted-foreground rounded-full opacity-0 transition-opacity duration-200 group-hover:opacity-100 group-focus-within:opacity-100 compact:opacity-100"
+ className="ml-2 text-muted-foreground rounded-full opacity-0 transition-opacity duration-200 group-hover:opacity-100 group-focus-within:opacity-100 max-md:opacity-100"
/>
</TooltipTrigger>
<TooltipContent>
@@ -495,7 +495,7 @@ const RecentDocumentRow = ({
variant="ghost"
size="sm"
onClick={onRemove}
- className="absolute right-2 top-1/2 -translate-y-1/2 opacity-0 group-hover:opacity-100 transition-opacity compact:opacity-100"
+ className="absolute right-2 top-1/2 -translate-y-1/2 opacity-0 group-hover:opacity-100 transition-opacity max-md:opacity-100"
/>
</div>
);
diff --git a/apps/erp/app/routes/x+/_layout.tsx b/apps/erp/app/routes/x+/_layout.tsx
index 6c40524d6f..6b7e60c9d4 100644
--- a/apps/erp/app/routes/x+/_layout.tsx
+++ b/apps/erp/app/routes/x+/_layout.tsx
@@ -35,9 +35,9 @@ import {
ItarUserCertification,
SidebarProvider,
TooltipProvider,
- useCompact,
useKeyboardWedge,
- useNProgress
+ useNProgress,
+ useViewport
} from "@carbon/react";
import { getStripeCustomerByCompanyId } from "@carbon/stripe/stripe.server";
import {
@@ -370,7 +370,7 @@ export async function loader({ request }: LoaderFunctionArgs) {
export default function AuthenticatedRoute() {
const loaderData = useLoaderData<typeof loader>();
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
const {
company,
session,
@@ -537,7 +537,7 @@ export default function AuthenticatedRoute() {
bar below <main>, in flow. Mounted only on phones so
their hooks (notifications, sheets) never run on
desktop. */}
- {isCompact && <MobileAppBar />}
+ {isPhone && <MobileAppBar />}
<Topbar />
<main className="flex-1 overflow-y-auto scrollbar-hide relative">
<ModuleSidebarLayout>
@@ -547,7 +547,7 @@ export default function AuthenticatedRoute() {
<Outlet key={companyId} />
</ModuleSidebarLayout>
</main>
- {isCompact && (
+ {isPhone && (
<MobileBottomChrome>
<MobileTabBar />
</MobileBottomChrome>
diff --git a/apps/erp/app/routes/x+/account+/security.tsx b/apps/erp/app/routes/x+/account+/security.tsx
index 20c197a69a..460c3fcbb1 100644
--- a/apps/erp/app/routes/x+/account+/security.tsx
+++ b/apps/erp/app/routes/x+/account+/security.tsx
@@ -294,7 +294,7 @@ export default function AccountSecurity() {
{passkeysEnabled && (
<Card>
<CardHeader>
- <HStack className="justify-between compact:flex-col compact:items-stretch compact:gap-3">
+ <HStack className="justify-between max-md:flex-col max-md:items-stretch max-md:gap-3">
<div>
<CardTitle>
<Trans>Passkeys</Trans>
@@ -329,7 +329,7 @@ export default function AccountSecurity() {
<HStack
key={pk.id}
spacing={4}
- className="w-full justify-between p-3 rounded-lg border border-border cursor-pointer transition-colors hover:bg-muted/40 compact:border-0 compact:p-0 compact:rounded-none"
+ className="w-full justify-between p-3 rounded-lg border border-border cursor-pointer transition-colors hover:bg-muted/40 max-md:border-0 max-md:p-0 max-md:rounded-none"
onClick={() => openPasskeyDrawer(pk)}
>
<HStack spacing={3} className="min-w-0">
@@ -381,7 +381,7 @@ export default function AccountSecurity() {
<Card>
<CardHeader>
- <HStack className="justify-between compact:flex-col compact:items-stretch compact:gap-3">
+ <HStack className="justify-between max-md:flex-col max-md:items-stretch max-md:gap-3">
<div>
<CardTitle>
<Trans>Two-factor authentication</Trans>
@@ -422,7 +422,7 @@ export default function AccountSecurity() {
<HStack
key={factor.id}
spacing={4}
- className="w-full justify-between p-3 rounded-lg border border-border compact:border-0 compact:p-0 compact:rounded-none"
+ className="w-full justify-between p-3 rounded-lg border border-border max-md:border-0 max-md:p-0 max-md:rounded-none"
>
<HStack spacing={3} className="min-w-0">
<span className="flex items-center justify-center size-9 rounded-lg bg-muted shrink-0">
diff --git a/apps/erp/app/routes/x+/accounting+/asset-classes.tsx b/apps/erp/app/routes/x+/accounting+/asset-classes.tsx
index 57a564dc82..f8e0a3bfc6 100644
--- a/apps/erp/app/routes/x+/accounting+/asset-classes.tsx
+++ b/apps/erp/app/routes/x+/accounting+/asset-classes.tsx
@@ -3,7 +3,7 @@
// including ports, remain AGPLv3; serving them over a network requires releasing their source.
import { requirePermissions } from "@carbon/auth/auth.server";
-import { Button, useCompact, VStack } from "@carbon/react";
+import { Button, useViewport, VStack } from "@carbon/react";
import { isUnaffectedByNavigation } from "@carbon/utils";
import { msg } from "@lingui/core/macro";
import { Trans, useLingui } from "@lingui/react/macro";
@@ -69,7 +69,7 @@ export default function AssetClassesRoute() {
const { t } = useLingui();
const permissions = usePermissions();
const navigate = useNavigate();
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
return (
<VStack spacing={0} className="h-full">
@@ -80,7 +80,7 @@ export default function AssetClassesRoute() {
primaryAction={
permissions.can("create", "accounting") &&
// Phones: Add becomes the app bar "+" like the other lists.
- (isCompact ? (
+ (isPhone ? (
<New label={t`Asset Class`} to={path.to.newAssetClass} />
) : (
<Button
diff --git a/apps/erp/app/routes/x+/accounting+/fixed-assets.tsx b/apps/erp/app/routes/x+/accounting+/fixed-assets.tsx
index 07b96167fd..9a5ece1abc 100644
--- a/apps/erp/app/routes/x+/accounting+/fixed-assets.tsx
+++ b/apps/erp/app/routes/x+/accounting+/fixed-assets.tsx
@@ -3,7 +3,7 @@
// including ports, remain AGPLv3; serving them over a network requires releasing their source.
import { requirePermissions } from "@carbon/auth/auth.server";
-import { Button, useCompact, VStack } from "@carbon/react";
+import { Button, useViewport, VStack } from "@carbon/react";
import { isUnaffectedByNavigation } from "@carbon/utils";
import { msg } from "@lingui/core/macro";
import { useLingui } from "@lingui/react/macro";
@@ -73,7 +73,7 @@ export default function FixedAssetsRoute() {
const { t } = useLingui();
const permissions = usePermissions();
const navigate = useNavigate();
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
return (
<VStack spacing={0} className="h-full">
@@ -84,7 +84,7 @@ export default function FixedAssetsRoute() {
primaryAction={
permissions.can("create", "accounting") &&
// Phones: Add becomes the app bar "+" like the other lists.
- (isCompact ? (
+ (isPhone ? (
<New label={t`Fixed Asset`} to={path.to.newFixedAsset} />
) : (
<Button
diff --git a/apps/erp/app/routes/x+/accounting+/reports.tsx b/apps/erp/app/routes/x+/accounting+/reports.tsx
index 92426f567b..fd27398b41 100644
--- a/apps/erp/app/routes/x+/accounting+/reports.tsx
+++ b/apps/erp/app/routes/x+/accounting+/reports.tsx
@@ -326,13 +326,13 @@ export default function ReportsIndexRoute() {
return (
<div className="h-[calc(100dvh-var(--header-height))] w-full overflow-y-auto bg-card">
- <div className="mx-auto flex w-full max-w-6xl flex-col gap-8 p-8 compact:gap-6 compact:p-4">
+ <div className="mx-auto flex w-full max-w-6xl flex-col gap-8 p-8 max-md:gap-6 max-md:p-4">
{/* Phones: the app bar already titles the page. */}
- <div className="flex items-center justify-between gap-4 compact:[&>h1]:hidden">
+ <div className="flex items-center justify-between gap-4 max-md:[&>h1]:hidden">
<Heading as="h1" size="h1">
<Trans>Reporting</Trans>
</Heading>
- <InputGroup size="sm" className="w-64 compact:w-full">
+ <InputGroup size="sm" className="w-64 max-md:w-full">
<InputLeftElement>
<LuSearch className="h-4 w-4 text-muted-foreground" />
</InputLeftElement>
@@ -400,7 +400,7 @@ export default function ReportsIndexRoute() {
}
>
<report.icon className="h-4 w-4 shrink-0 text-muted-foreground" />
- <span className="text-sm font-medium compact:shrink-0 compact:whitespace-nowrap">
+ <span className="text-sm font-medium max-md:shrink-0 max-md:whitespace-nowrap">
{report.name}
</span>
<span className="truncate text-sm text-muted-foreground">
diff --git a/apps/erp/app/routes/x+/customer+/$customerId.tsx b/apps/erp/app/routes/x+/customer+/$customerId.tsx
index 923f42c6ba..3bb31595a5 100644
--- a/apps/erp/app/routes/x+/customer+/$customerId.tsx
+++ b/apps/erp/app/routes/x+/customer+/$customerId.tsx
@@ -81,7 +81,7 @@ export default function CustomerRoute() {
<CustomerHeader />
<div
className={cn(
- "grid grid-cols-1 h-full w-full gap-4 compact:h-auto compact:gap-0",
+ "grid grid-cols-1 h-full w-full gap-4 max-md:h-auto max-md:gap-0",
{
"md:grid-cols-[1fr_4fr]": isEmployee
}
diff --git a/apps/erp/app/routes/x+/customer+/new.tsx b/apps/erp/app/routes/x+/customer+/new.tsx
index 9845d069e2..abb46deca0 100644
--- a/apps/erp/app/routes/x+/customer+/new.tsx
+++ b/apps/erp/app/routes/x+/customer+/new.tsx
@@ -84,7 +84,7 @@ export default function CustomersNewRoute() {
};
return (
- <NewRecordPage className="compact:p-0">
+ <NewRecordPage className="max-md:p-0">
<CustomerForm initialValues={initialValues} />
</NewRecordPage>
);
diff --git a/apps/erp/app/routes/x+/inventory+/quantities+/$itemId.activity.tsx b/apps/erp/app/routes/x+/inventory+/quantities+/$itemId.activity.tsx
index 5e98d63213..d4f2f6f67e 100644
--- a/apps/erp/app/routes/x+/inventory+/quantities+/$itemId.activity.tsx
+++ b/apps/erp/app/routes/x+/inventory+/quantities+/$itemId.activity.tsx
@@ -281,7 +281,7 @@ export default function ItemInventoryActivityRoute() {
}, [carbon, itemId, companyId, locationId]);
return (
- <div className="w-full space-y-4 pt-6 px-4 compact:p-0">
+ <div className="w-full space-y-4 pt-6 px-4 max-md:p-0">
<Heading size="h2" className="mb-4">
<Trans>Activity</Trans>
</Heading>
diff --git a/apps/erp/app/routes/x+/inventory+/quantities+/$itemId.tsx b/apps/erp/app/routes/x+/inventory+/quantities+/$itemId.tsx
index 6caf8e2c0f..953b082989 100644
--- a/apps/erp/app/routes/x+/inventory+/quantities+/$itemId.tsx
+++ b/apps/erp/app/routes/x+/inventory+/quantities+/$itemId.tsx
@@ -9,7 +9,7 @@ import {
ResizableHandle,
ResizablePanel,
ScrollArea,
- useCompact,
+ useViewport,
VStack
} from "@carbon/react";
import { isUnaffectedByNavigation, redirect } from "@carbon/utils";
@@ -96,7 +96,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
export default function ItemInventoryRoute() {
const { item } = useLoaderData<typeof loader>();
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
const [params] = useUrlParams();
const itemReadableId = item.readableIdWithRevision ?? item.readableId;
const backTo = `${path.to.inventory}?${params.toString()}`;
@@ -105,14 +105,14 @@ export default function ItemInventoryRoute() {
// title and Back returns to the list (the panel's ✕ and ID are hidden).
const appBarOverride = useMemo(
() =>
- isCompact
+ isPhone
? {
kind: "pushed" as const,
title: itemReadableId,
backTo
}
: null,
- [isCompact, itemReadableId, backTo]
+ [isPhone, itemReadableId, backTo]
);
useSetAppBarOverride(appBarOverride);
@@ -132,7 +132,7 @@ export default function ItemInventoryRoute() {
// @ts-expect-error
itemType={item.type}
/>
- <VStack className="p-2 compact:p-4">
+ <VStack className="p-2 max-md:p-4">
<Outlet />
</VStack>
</ScrollArea>
diff --git a/apps/erp/app/routes/x+/issue-workflow+/new.tsx b/apps/erp/app/routes/x+/issue-workflow+/new.tsx
index e3f8a77c32..f5d892aed3 100644
--- a/apps/erp/app/routes/x+/issue-workflow+/new.tsx
+++ b/apps/erp/app/routes/x+/issue-workflow+/new.tsx
@@ -6,7 +6,7 @@ import { assertIsPost, error, success } from "@carbon/auth";
import { requirePermissions } from "@carbon/auth/auth.server";
import { flash } from "@carbon/auth/session.server";
import { validationError, validator } from "@carbon/form";
-import { ScrollArea, useCloseRoute, useCompact } from "@carbon/react";
+import { ScrollArea, useCloseRoute, useViewport } from "@carbon/react";
import { redirect } from "@carbon/utils";
import { useLingui } from "@lingui/react/macro";
import { useMemo } from "react";
@@ -73,21 +73,21 @@ export async function action({ request }: ActionFunctionArgs) {
export default function NewIssueWorkflowRoute() {
const { requiredActions } = useLoaderData<typeof loader>();
const closeRoute = useCloseRoute();
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
const { t } = useLingui();
// Phones show this create screen as a pushed screen: Back returns to the
// workflow list (the route has no breadcrumb of its own).
const appBarOverride = useMemo(
() =>
- isCompact
+ isPhone
? {
kind: "pushed" as const,
title: t`Issue Workflows`,
backTo: path.to.issueWorkflows
}
: null,
- [isCompact, t]
+ [isPhone, t]
);
useSetAppBarOverride(appBarOverride);
diff --git a/apps/erp/app/routes/x+/payments+/$paymentId.tsx b/apps/erp/app/routes/x+/payments+/$paymentId.tsx
index e1e899c715..94389124b6 100644
--- a/apps/erp/app/routes/x+/payments+/$paymentId.tsx
+++ b/apps/erp/app/routes/x+/payments+/$paymentId.tsx
@@ -325,7 +325,7 @@ export default function PaymentDetailRoute() {
};
return (
- <VStack spacing={4} className="p-6 max-w-6xl w-full mx-auto compact:p-4">
+ <VStack spacing={4} className="p-6 max-w-6xl w-full mx-auto max-md:p-4">
<PaymentForm key={payment.id} initialValues={initialValues} />
<PaymentApplications
applications={applications}
diff --git a/apps/erp/app/routes/x+/people+/departments.tsx b/apps/erp/app/routes/x+/people+/departments.tsx
index 4ae66807d1..9bf30fc42a 100644
--- a/apps/erp/app/routes/x+/people+/departments.tsx
+++ b/apps/erp/app/routes/x+/people+/departments.tsx
@@ -20,7 +20,7 @@ import {
TabsContent,
TabsList,
TabsTrigger,
- useCompact
+ useViewport
} from "@carbon/react";
import { isUnaffectedByNavigation, redirect } from "@carbon/utils";
import { msg } from "@lingui/core/macro";
@@ -80,7 +80,7 @@ export default function Route() {
const { departments } = useLoaderData<typeof loader>();
const navigate = useNavigate();
const { t } = useLingui();
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
const handleEdit = useCallback(
(id: string) => {
@@ -131,17 +131,17 @@ export default function Route() {
// Phones: List/Tree is a display-mode toggle, so it stays a segmented
// control instead of the compact underline tab row.
const segmentedTrigger =
- "compact:hit-area compact:min-h-9 compact:rounded-md compact:border-b-0 compact:px-3 compact:data-[state=active]:bg-card compact:data-[state=active]:shadow-button-base";
+ "max-md:hit-area max-md:min-h-9 max-md:rounded-md max-md:border-b-0 max-md:px-3 max-md:data-[state=active]:bg-card max-md:data-[state=active]:shadow-button-base";
return (
<Tabs defaultValue="tree" className="w-full">
<div className="flex px-4 py-3 items-center space-x-4 justify-between bg-card border-b border-border w-full">
{/* The app bar already names the section on phones. */}
- <Heading size="h3" className="compact:hidden">
+ <Heading size="h3" className="max-md:hidden">
<Trans>Departments</Trans>
</Heading>
<HStack>
- <TabsList className="compact:w-auto compact:gap-0 compact:rounded-lg compact:border compact:bg-muted compact:p-1">
+ <TabsList className="max-md:w-auto max-md:gap-0 max-md:rounded-lg max-md:border max-md:bg-muted max-md:p-1">
<TabsTrigger value="tree" className={segmentedTrigger}>
<Trans>Tree View</Trans>
</TabsTrigger>
@@ -154,7 +154,7 @@ export default function Route() {
to={path.to.newDepartment}
variant="primary"
/>
- {isCompact ? (
+ {isPhone ? (
// Phones: the content ⋮ moves to the app bar ⋯.
<AppBarActions>
<DropdownMenu>
diff --git a/apps/erp/app/routes/x+/person+/$personId.timecard.tsx b/apps/erp/app/routes/x+/person+/$personId.timecard.tsx
index a6511461f9..6592c2438e 100644
--- a/apps/erp/app/routes/x+/person+/$personId.timecard.tsx
+++ b/apps/erp/app/routes/x+/person+/$personId.timecard.tsx
@@ -504,7 +504,7 @@ export default function PersonTimecardRoute() {
</Button>
</HStack>
- <TableBase className="table-fixed w-full compact:table-auto compact:min-w-[36rem]">
+ <TableBase className="table-fixed w-full max-md:table-auto max-md:min-w-[36rem]">
<colgroup>
<col className="w-[16%]" />
<col className="w-[28%]" />
@@ -517,13 +517,13 @@ export default function PersonTimecardRoute() {
<Th className="whitespace-nowrap">
<Trans>Date</Trans>
</Th>
- <Th className="compact:whitespace-nowrap">
+ <Th className="max-md:whitespace-nowrap">
<Trans>Clock In</Trans>
</Th>
- <Th className="compact:whitespace-nowrap">
+ <Th className="max-md:whitespace-nowrap">
<Trans>Clock Out</Trans>
</Th>
- <Th className="text-center compact:whitespace-nowrap">
+ <Th className="text-center max-md:whitespace-nowrap">
<Trans>Duration</Trans>
</Th>
<Th />
@@ -619,7 +619,7 @@ export default function PersonTimecardRoute() {
<Tr>
<Td
colSpan={5}
- className="text-center text-muted-foreground py-8 compact:text-left"
+ className="text-center text-muted-foreground py-8 max-md:text-left"
>
<Trans>No time entries for this week</Trans>
</Td>
diff --git a/apps/erp/app/routes/x+/person+/$personId.tsx b/apps/erp/app/routes/x+/person+/$personId.tsx
index 62e35c32a3..c716499d3d 100644
--- a/apps/erp/app/routes/x+/person+/$personId.tsx
+++ b/apps/erp/app/routes/x+/person+/$personId.tsx
@@ -117,7 +117,7 @@ export default function PersonRoute() {
return (
<>
<PersonPreview />
- <div className="grid grid-cols-1 md:grid-cols-[1fr_4fr] h-full w-full gap-4 compact:h-auto compact:gap-0">
+ <div className="grid grid-cols-1 md:grid-cols-[1fr_4fr] h-full w-full gap-4 max-md:h-auto max-md:gap-0">
<PersonSidebar
attributeCategories={attributeCategories}
timeCardEnabled={timeCardEnabled}
diff --git a/apps/erp/app/routes/x+/priority+/dates.tsx b/apps/erp/app/routes/x+/priority+/dates.tsx
index 8d990321b3..95b1cefe3b 100644
--- a/apps/erp/app/routes/x+/priority+/dates.tsx
+++ b/apps/erp/app/routes/x+/priority+/dates.tsx
@@ -23,8 +23,8 @@ import {
Separator,
Spinner,
Switch,
- useCompact,
useLocalStorage,
+ useViewport,
VStack
} from "@carbon/react";
import { isUnaffectedByNavigation, redirect } from "@carbon/utils";
@@ -580,10 +580,10 @@ function DateKanbanSchedule() {
const [items, setItems] = useState<JobItem[]>(initialItems);
// Phones keep their own settings and start without the product image, so
// more than one card fits on a screen; the Thumbnail toggle still applies.
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
const [displaySettings, setDisplaySettings] = useLocalStorage(
- isCompact ? `${DISPLAY_SETTINGS_KEY}-compact` : DISPLAY_SETTINGS_KEY,
- isCompact
+ isPhone ? `${DISPLAY_SETTINGS_KEY}-compact` : DISPLAY_SETTINGS_KEY,
+ isPhone
? { ...defaultDisplaySettings, showThumbnail: false }
: defaultDisplaySettings
);
@@ -758,17 +758,17 @@ function DateKanbanSchedule() {
return (
<div className="flex flex-col h-full max-h-full overflow-auto relative">
- <HStack className="px-4 py-2 flex justify-between bg-card border-b border-border compact:flex-wrap compact:gap-y-2 compact:[&_button]:h-11 compact:[&_button]:min-w-11">
- <HStack className="compact:w-full">
+ <HStack className="px-4 py-2 flex justify-between bg-card border-b border-border max-md:flex-wrap max-md:gap-y-2 max-md:[&_button]:h-11 max-md:[&_button]:min-w-11">
+ <HStack className="max-md:w-full">
<ScheduleNavigation />
- <div className="contents compact:block compact:min-w-0 compact:flex-1">
+ <div className="contents max-md:block max-md:min-w-0 max-md:flex-1">
<SearchFilter param="search" size="sm" placeholder="Search" />
</div>
<Filter filters={filters} />
</HStack>
- <HStack className="compact:w-full">
- <HStack className="compact:min-w-0 compact:flex-1">
+ <HStack className="max-md:w-full">
+ <HStack className="max-md:min-w-0 max-md:flex-1">
<Button variant="secondary" onClick={goToToday}>
<Trans>Today</Trans>
</Button>
@@ -782,7 +782,7 @@ function DateKanbanSchedule() {
<DropdownMenuTrigger asChild>
<Button
variant="secondary"
- className="min-w-[140px] compact:min-w-0 compact:flex-1"
+ className="min-w-[140px] max-md:min-w-0 max-md:flex-1"
>
{currentDateSpanLabel}
</Button>
diff --git a/apps/erp/app/routes/x+/priority+/operations.tsx b/apps/erp/app/routes/x+/priority+/operations.tsx
index 19819fe732..f1aff6484e 100644
--- a/apps/erp/app/routes/x+/priority+/operations.tsx
+++ b/apps/erp/app/routes/x+/priority+/operations.tsx
@@ -21,10 +21,10 @@ import {
TooltipContent,
TooltipTrigger,
toast,
- useCompact,
useInterval,
useLocalStorage,
useMount,
+ useViewport,
VStack
} from "@carbon/react";
import { isUnaffectedByNavigation } from "@carbon/utils";
@@ -589,10 +589,10 @@ function KanbanSchedule() {
const [items, setItems] = useState<Item[]>(initialItems);
// Phones keep their own settings and start without the product image, so
// more than one card fits on a screen; the Thumbnail toggle still applies.
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
const [displaySettings, setDisplaySettings] = useLocalStorage(
- isCompact ? `${DISPLAY_SETTINGS_KEY}-compact` : DISPLAY_SETTINGS_KEY,
- isCompact
+ isPhone ? `${DISPLAY_SETTINGS_KEY}-compact` : DISPLAY_SETTINGS_KEY,
+ isPhone
? { ...defaultDisplaySettings, showThumbnail: false }
: defaultDisplaySettings
);
@@ -734,11 +734,11 @@ function KanbanSchedule() {
return (
<div className="flex flex-col h-full max-h-full overflow-auto relative">
- <HStack className="px-4 py-2 justify-between bg-card border-b border-border compact:flex-wrap compact:gap-y-2 compact:[&_button]:h-11 compact:[&_button]:min-w-11">
+ <HStack className="px-4 py-2 justify-between bg-card border-b border-border max-md:flex-wrap max-md:gap-y-2 max-md:[&_button]:h-11 max-md:[&_button]:min-w-11">
{/* Phones: search takes its own full-width row under the controls. */}
- <HStack className="compact:min-w-0 compact:flex-1 compact:flex-wrap compact:gap-y-2">
+ <HStack className="max-md:min-w-0 max-md:flex-1 max-md:flex-wrap max-md:gap-y-2">
<ScheduleNavigation />
- <div className="contents compact:order-last compact:block compact:min-w-0 compact:basis-full compact:!mx-0">
+ <div className="contents max-md:order-last max-md:block max-md:min-w-0 max-md:basis-full max-md:!mx-0">
<SearchFilter param="search" size="sm" placeholder="Search" />
</div>
<Filter filters={filters} />
@@ -755,7 +755,7 @@ function KanbanSchedule() {
</Tooltip>
</HStack>
- <div className="flex items-center gap-2 compact:self-start">
+ <div className="flex items-center gap-2 max-md:self-start">
<Popover>
<PopoverTrigger asChild>
<IconButton
diff --git a/apps/erp/app/routes/x+/procedure+/$id.tsx b/apps/erp/app/routes/x+/procedure+/$id.tsx
index 4b52fa0177..40259d9047 100644
--- a/apps/erp/app/routes/x+/procedure+/$id.tsx
+++ b/apps/erp/app/routes/x+/procedure+/$id.tsx
@@ -225,7 +225,7 @@ function ProcedureEditor() {
}}
/>
) : (
- <div className="flex flex-col gap-6 w-full h-full p-8 compact:p-4">
+ <div className="flex flex-col gap-6 w-full h-full p-8 max-md:p-4">
<h1 className="md:text-3xl text-2xl font-semibold leading-tight tracking-tight text-foreground">
{procedureName}
</h1>
diff --git a/apps/erp/app/routes/x+/production+/_index.tsx b/apps/erp/app/routes/x+/production+/_index.tsx
index 0ddacab763..8114821746 100644
--- a/apps/erp/app/routes/x+/production+/_index.tsx
+++ b/apps/erp/app/routes/x+/production+/_index.tsx
@@ -31,7 +31,7 @@ import {
Tooltip,
TooltipContent,
TooltipTrigger,
- useCompact,
+ useViewport,
VStack
} from "@carbon/react";
import type { ChartConfig } from "@carbon/react/Chart";
@@ -142,7 +142,7 @@ export async function loader({ request }: LoaderFunctionArgs) {
export default function ProductionDashboard() {
const { t } = useLingui();
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
const { activeJobs, assignedJobs, unbatchedOperations, events, workCenters } =
useLoaderData<typeof loader>();
@@ -323,7 +323,7 @@ export default function ProductionDashboard() {
return (
<div className="flex flex-col gap-4 w-full p-4 h-[calc(100dvh-var(--header-height))] overflow-y-auto scrollbar-thin scrollbar-thumb-rounded-full scrollbar-thumb-muted-foreground bg-card">
- <div className="grid w-full gap-y-4 lg:gap-x-4 grid-cols-1 lg:grid-cols-6 compact:grid-cols-2 compact:gap-3">
+ <div className="grid w-full gap-y-4 lg:gap-x-4 grid-cols-1 lg:grid-cols-6 max-md:grid-cols-2 max-md:gap-3">
<MetricCard
className="col-span-1 lg:col-span-2"
icon={<LuCirclePlay />}
@@ -343,7 +343,7 @@ export default function ProductionDashboard() {
/>
<MetricCard
- className="col-span-1 lg:col-span-2 compact:col-span-2"
+ className="col-span-1 lg:col-span-2 max-md:col-span-2"
icon={<LuLayers />}
title={<Trans>Unbatched Operations</Trans>}
value={unbatchedOperations}
@@ -351,7 +351,7 @@ export default function ProductionDashboard() {
linkLabel={t`Create Batch`}
/>
- <Card className="col-span-1 lg:col-span-6 compact:col-span-2">
+ <Card className="col-span-1 lg:col-span-6 max-md:col-span-2">
<HStack className="flex-col items-start gap-2 sm:flex-row sm:justify-between sm:items-center">
<CardHeader>
<div className="flex w-full justify-start items-center gap-2">
@@ -458,7 +458,7 @@ export default function ProductionDashboard() {
layout="vertical"
margin={{
// Phones: room for the top bar's value label.
- right: isCompact ? 48 : 30
+ right: isPhone ? 48 : 30
}}
>
<YAxis
@@ -784,7 +784,7 @@ function WorkCenterCards({
});
return (
- <div className="w-full grid grid-cols-6 gap-4 compact:gap-3">
+ <div className="w-full grid grid-cols-6 gap-4 max-md:gap-3">
{workCenters.map((workCenter) => {
const {
hasEvents,
@@ -812,7 +812,7 @@ function WorkCenterCards({
return (
<Card
key={workCenter.id}
- className="p-0 h-[300px] col-span-6 compact:col-span-full lg:col-span-3 xl:col-span-2"
+ className="p-0 h-[300px] col-span-6 max-md:col-span-full lg:col-span-3 xl:col-span-2"
>
<HStack
className={cn(
diff --git a/apps/erp/app/routes/x+/purchasing+/_index.tsx b/apps/erp/app/routes/x+/purchasing+/_index.tsx
index b89b719952..8e7eadf377 100644
--- a/apps/erp/app/routes/x+/purchasing+/_index.tsx
+++ b/apps/erp/app/routes/x+/purchasing+/_index.tsx
@@ -394,7 +394,7 @@ export default function PurchaseDashboard() {
return (
<div className="flex flex-col gap-4 w-full p-4 h-[calc(100dvh-var(--header-height))] overflow-y-auto scrollbar-thin scrollbar-thumb-rounded-full scrollbar-thumb-muted-foreground bg-card">
- <div className="grid w-full gap-4 grid-cols-1 lg:grid-cols-3 compact:grid-cols-2 compact:gap-3 compact:[&>:last-child:nth-child(odd)]:col-span-2">
+ <div className="grid w-full gap-4 grid-cols-1 lg:grid-cols-3 max-md:grid-cols-2 max-md:gap-3 max-md:[&>:last-child:nth-child(odd)]:col-span-2">
<MetricCard
icon={<LuPackageSearch />}
title={<Trans>Active Supplier Quotes</Trans>}
@@ -427,9 +427,9 @@ export default function PurchaseDashboard() {
</div>
<Card>
- <HStack className="justify-between items-center compact:flex-col compact:items-stretch">
+ <HStack className="justify-between items-center max-md:flex-col max-md:items-stretch">
<CardHeader>
- <div className="flex w-full justify-start items-center gap-2 compact:flex-wrap">
+ <div className="flex w-full justify-start items-center gap-2 max-md:flex-wrap">
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button
@@ -460,11 +460,11 @@ export default function PurchaseDashboard() {
onChange={setSupplierId}
options={supplierOptions}
size="sm"
- className="font-medium text-sm min-w-[160px] gap-4 compact:min-w-0"
+ className="font-medium text-sm min-w-[160px] gap-4 max-md:min-w-0"
/>
</div>
</CardHeader>
- <CardAction className="flex-row items-center gap-2 compact:pt-0">
+ <CardAction className="flex-row items-center gap-2 max-md:pt-0">
<DateSelect
value={interval}
onValueChange={onIntervalChange}
@@ -516,11 +516,11 @@ export default function PurchaseDashboard() {
</VStack>
<Loading
isLoading={isFetching}
- className="h-[30dvw] md:h-[23dvw] w-full compact:h-[150px]"
+ className="h-[30dvw] md:h-[23dvw] w-full max-md:h-[150px]"
>
<ChartContainer
config={chartConfig}
- className="aspect-auto h-[30dvw] md:h-[23dvw] w-full compact:h-[150px]"
+ className="aspect-auto h-[30dvw] md:h-[23dvw] w-full max-md:h-[150px]"
>
<BarChart accessibilityLayer data={kpiFetcher.data?.data ?? []}>
<CartesianGrid vertical={false} />
@@ -799,7 +799,7 @@ function SupplierQuoteRow({ doc }: { doc: SupplierQuote }) {
<Tr>
<Td>
<Hyperlink
- className="compact:min-h-11"
+ className="max-md:min-h-11"
to={path.to.supplierQuote(doc.id!)}
>
<HStack spacing={1}>
@@ -823,7 +823,7 @@ function PurchaseOrderDocumentRow({ doc }: { doc: PurchaseOrder }) {
<Tr>
<Td>
<Hyperlink
- className="compact:min-h-11"
+ className="max-md:min-h-11"
to={path.to.purchaseOrder(doc.id!)}
>
<HStack spacing={1}>
@@ -846,7 +846,7 @@ function PurchaseInvoiceRow({ doc }: { doc: PurchaseInvoice }) {
return (
<Tr>
<Td>
- <Hyperlink className="compact:min-h-11" to={path.to.salesRfq(doc.id!)}>
+ <Hyperlink className="max-md:min-h-11" to={path.to.salesRfq(doc.id!)}>
<HStack spacing={1}>
<LuCreditCard className="size-4" />
<span>{doc.invoiceId}</span>
@@ -872,7 +872,7 @@ function SupplierApprovalRow({
return (
<Tr>
<Td>
- <Hyperlink className="compact:min-h-11" to={path.to.supplier(doc.id)}>
+ <Hyperlink className="max-md:min-h-11" to={path.to.supplier(doc.id)}>
<SupplierAvatar supplierId={doc.id} />
</Hyperlink>
</Td>
diff --git a/apps/erp/app/routes/x+/quality+/_index.tsx b/apps/erp/app/routes/x+/quality+/_index.tsx
index 244ffeef70..b538d49366 100644
--- a/apps/erp/app/routes/x+/quality+/_index.tsx
+++ b/apps/erp/app/routes/x+/quality+/_index.tsx
@@ -28,7 +28,7 @@ import {
Th,
Thead,
Tr,
- useCompact
+ useViewport
} from "@carbon/react";
import type { ChartConfig } from "@carbon/react/Chart";
import {
@@ -251,7 +251,7 @@ export default function QualityDashboard() {
const { t } = useLingui();
const { locale } = useLocale();
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
const localizedChartConfig = useMemo(
() =>
@@ -387,7 +387,7 @@ export default function QualityDashboard() {
return (
<div className="flex flex-col gap-4 w-full p-4 h-[calc(100dvh-var(--header-height))] overflow-y-auto scrollbar-thin scrollbar-thumb-rounded-full scrollbar-thumb-muted-foreground bg-card">
{/* KPI Cards */}
- <div className="grid w-full gap-4 grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 compact:grid-cols-2 compact:gap-3 compact:[&>:last-child:nth-child(odd)]:col-span-2">
+ <div className="grid w-full gap-4 grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 max-md:grid-cols-2 max-md:gap-3 max-md:[&>:last-child:nth-child(odd)]:col-span-2">
<MetricCard
icon={<LuCircleAlert />}
title={<Trans>Open Issues</Trans>}
@@ -422,9 +422,9 @@ export default function QualityDashboard() {
{/* Unified Chart Card */}
<Card>
- <HStack className="justify-between items-center compact:flex-col compact:items-start compact:gap-2">
+ <HStack className="justify-between items-center max-md:flex-col max-md:items-start max-md:gap-2">
<CardHeader>
- <div className="flex w-full justify-start items-center gap-2 compact:flex-wrap">
+ <div className="flex w-full justify-start items-center gap-2 max-md:flex-wrap">
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button
@@ -454,7 +454,7 @@ export default function QualityDashboard() {
onChange={setIssueTypeId}
options={typeOptions}
size="sm"
- className="font-medium text-sm min-w-[160px] compact:text-sm"
+ className="font-medium text-sm min-w-[160px] max-md:text-sm"
/>
</div>
</CardHeader>
@@ -489,7 +489,7 @@ export default function QualityDashboard() {
</CardAction>
</HStack>
<CardContent className="flex-col gap-4">
- <div className="h-[30dvw] md:h-[23dvw] min-h-[300px] compact:h-[200px] compact:min-h-0">
+ <div className="h-[30dvw] md:h-[23dvw] min-h-[300px] max-md:h-[200px] max-md:min-h-0">
{selectedChart === "weeklyTracking" && (
<ChartContainer
config={localizedChartConfig}
@@ -508,7 +508,7 @@ export default function QualityDashboard() {
tickLine={false}
axisLine={false}
// Phones: the 200pt chart would drop a tick; keep all five like desktop.
- {...(isCompact ? { interval: 0 } : {})}
+ {...(isPhone ? { interval: 0 } : {})}
/>
<ChartTooltip
content={
diff --git a/apps/erp/app/routes/x+/reimbursements+/$reimbursementId._index.tsx b/apps/erp/app/routes/x+/reimbursements+/$reimbursementId._index.tsx
index ed82b15f90..31dc7e9b71 100644
--- a/apps/erp/app/routes/x+/reimbursements+/$reimbursementId._index.tsx
+++ b/apps/erp/app/routes/x+/reimbursements+/$reimbursementId._index.tsx
@@ -189,7 +189,7 @@ export default function ReimbursementDetailRoute() {
{/* No hero; it still zeroes --header-height on phones. */}
<RecordHero />
<RecordPhoneChrome />
- <HStack className="w-full justify-end compact:hidden">
+ <HStack className="w-full justify-end max-md:hidden">
{canPay && (
<RecordAction slot="primary">
<Button variant="primary" onClick={payModal.onOpen}>
diff --git a/apps/erp/app/routes/x+/resources+/_index.tsx b/apps/erp/app/routes/x+/resources+/_index.tsx
index aca72598f0..505f905915 100644
--- a/apps/erp/app/routes/x+/resources+/_index.tsx
+++ b/apps/erp/app/routes/x+/resources+/_index.tsx
@@ -31,7 +31,7 @@ import {
Th,
Thead,
Tr,
- useCompact,
+ useViewport,
VStack
} from "@carbon/react";
import type { ChartConfig } from "@carbon/react/Chart";
@@ -138,7 +138,7 @@ export async function loader({ request }: LoaderFunctionArgs) {
export default function MaintenanceDashboard() {
const { t } = useLingui();
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
const {
openDispatches,
openScheduled,
@@ -356,7 +356,7 @@ export default function MaintenanceDashboard() {
return (
<div className="flex flex-col gap-4 w-full p-4 h-[calc(100dvh-var(--header-height))] overflow-y-auto scrollbar-thin scrollbar-thumb-rounded-full scrollbar-thumb-muted-foreground bg-card">
- <div className="grid w-full gap-4 grid-cols-1 lg:grid-cols-3 compact:grid-cols-2 compact:gap-3 compact:[&>:last-child:nth-child(odd)]:col-span-2">
+ <div className="grid w-full gap-4 grid-cols-1 lg:grid-cols-3 max-md:grid-cols-2 max-md:gap-3 max-md:[&>:last-child:nth-child(odd)]:col-span-2">
<MetricCard
icon={<LuWrench />}
title={<Trans>Open Dispatches</Trans>}
@@ -389,9 +389,9 @@ export default function MaintenanceDashboard() {
</div>
<Card>
- <HStack className="justify-between items-center compact:flex-col compact:items-stretch compact:space-x-0">
+ <HStack className="justify-between items-center max-md:flex-col max-md:items-stretch max-md:space-x-0">
<CardHeader>
- <div className="flex w-full justify-start items-center gap-2 compact:flex-wrap">
+ <div className="flex w-full justify-start items-center gap-2 max-md:flex-wrap">
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button
@@ -400,7 +400,7 @@ export default function MaintenanceDashboard() {
className={cn(
"hover:bg-background/80",
// Phones: the KPI picker reads as the section title.
- "compact:px-0 compact:bg-transparent compact:shadow-none compact:dark:bg-transparent compact:text-[17px] compact:font-semibold compact:text-foreground"
+ "max-md:px-0 max-md:bg-transparent max-md:shadow-none max-md:dark:bg-transparent max-md:text-[17px] max-md:font-semibold max-md:text-foreground"
)}
>
<span>{kpiLabels[selectedKpiData.key]}</span>
@@ -426,7 +426,7 @@ export default function MaintenanceDashboard() {
onChange={setWorkCenterId}
options={workCenterOptions}
size="sm"
- className="min-w-[160px] gap-4 compact:min-w-0"
+ className="min-w-[160px] gap-4 max-md:min-w-0"
/>
</div>
</CardHeader>
@@ -443,7 +443,7 @@ export default function MaintenanceDashboard() {
variant="secondary"
icon={<LuEllipsisVertical />}
aria-label={t`More`}
- className="compact:rounded-full"
+ className="max-md:rounded-full"
/>
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
@@ -489,12 +489,12 @@ export default function MaintenanceDashboard() {
</VStack>
<Loading
isLoading={isFetching}
- className="h-[30dvw] md:h-[23dvw] w-full compact:h-[150px]"
+ className="h-[30dvw] md:h-[23dvw] w-full max-md:h-[150px]"
>
{selectedKpi === "worstPerformingMachines" ? (
<ChartContainer
config={chartConfig}
- className="aspect-auto h-[30dvw] md:h-[23dvw] w-full compact:h-[150px]"
+ className="aspect-auto h-[30dvw] md:h-[23dvw] w-full max-md:h-[150px]"
>
<BarChart
accessibilityLayer
@@ -526,7 +526,7 @@ export default function MaintenanceDashboard() {
) : (
<ChartContainer
config={chartConfig}
- className="aspect-auto h-[30dvw] md:h-[23dvw] w-full compact:h-[150px]"
+ className="aspect-auto h-[30dvw] md:h-[23dvw] w-full max-md:h-[150px]"
>
<BarChart accessibilityLayer data={kpiFetcher.data?.data ?? []}>
<CartesianGrid vertical={false} />
@@ -534,7 +534,7 @@ export default function MaintenanceDashboard() {
dataKey="value"
tickLine={false}
axisLine={false}
- {...(isCompact ? { width: 64 } : {})}
+ {...(isPhone ? { width: 64 } : {})}
tickFormatter={(value) => {
if (["mttr", "mtbf"].includes(selectedKpiData.key)) {
const duration = formatDurationMilliseconds(
@@ -542,7 +542,7 @@ export default function MaintenanceDashboard() {
{ style: "short" }
);
// Recharts wraps ticks on spaces; keep "3h, 20m" on one line.
- return isCompact
+ return isPhone
? duration.replace(/ /g, "\u00a0")
: duration;
}
@@ -670,7 +670,7 @@ type DispatchRow = {
function DispatchTable({ data }: { data: DispatchRow[] }) {
const workCenters = useWorkCenters();
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
const getWorkCenterName = (workCenterId: string | null) => {
if (!workCenterId) return "-";
@@ -679,7 +679,7 @@ function DispatchTable({ data }: { data: DispatchRow[] }) {
};
// Phone: the 4-column table becomes a stacked list; each row opens the dispatch.
- if (isCompact) {
+ if (isPhone) {
return (
<ul className="flex w-full flex-col divide-y divide-border">
{data.map((dispatch) => (
diff --git a/apps/erp/app/routes/x+/resources+/assignments.$trainingId.tsx b/apps/erp/app/routes/x+/resources+/assignments.$trainingId.tsx
index 04d5d59eb5..5f8f1c24a8 100644
--- a/apps/erp/app/routes/x+/resources+/assignments.$trainingId.tsx
+++ b/apps/erp/app/routes/x+/resources+/assignments.$trainingId.tsx
@@ -262,7 +262,7 @@ export default function TrainingAssignmentDetailRoute() {
</HStack>
</HStack>
</DrawerHeader>
- <DrawerBody className="p-0 compact:p-0">
+ <DrawerBody className="p-0 max-md:p-0">
<VStack spacing={0} className="h-full w-full">
<div className="p-4 border-b flex flex-col gap-4 w-full">
<div className="relative">
diff --git a/apps/erp/app/routes/x+/sales+/_index.tsx b/apps/erp/app/routes/x+/sales+/_index.tsx
index 60000eda95..3ea58faec9 100644
--- a/apps/erp/app/routes/x+/sales+/_index.tsx
+++ b/apps/erp/app/routes/x+/sales+/_index.tsx
@@ -381,7 +381,7 @@ export default function SalesDashboard() {
return (
<div className="flex flex-col gap-4 w-full p-4 h-[calc(100dvh-var(--header-height))] overflow-y-auto scrollbar-thin scrollbar-thumb-rounded-full scrollbar-thumb-muted-foreground bg-card">
- <div className="grid w-full gap-4 grid-cols-1 lg:grid-cols-3 compact:grid-cols-2 compact:gap-3 compact:[&>:last-child:nth-child(odd)]:col-span-2">
+ <div className="grid w-full gap-4 grid-cols-1 lg:grid-cols-3 max-md:grid-cols-2 max-md:gap-3 max-md:[&>:last-child:nth-child(odd)]:col-span-2">
<MetricCard
icon={<RiProgress2Line />}
title={<Trans>Open RFQs</Trans>}
@@ -414,9 +414,9 @@ export default function SalesDashboard() {
</div>
<Card>
- <HStack className="justify-between items-center compact:flex-col compact:items-stretch">
+ <HStack className="justify-between items-center max-md:flex-col max-md:items-stretch">
<CardHeader>
- <div className="flex w-full justify-start items-center gap-2 compact:flex-wrap">
+ <div className="flex w-full justify-start items-center gap-2 max-md:flex-wrap">
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button
@@ -447,11 +447,11 @@ export default function SalesDashboard() {
onChange={setCustomerId}
options={customerOptions}
size="sm"
- className="min-w-[160px] gap-4 compact:min-w-0"
+ className="min-w-[160px] gap-4 max-md:min-w-0"
/>
</div>
</CardHeader>
- <CardAction className="flex-row items-center gap-2 compact:pt-0">
+ <CardAction className="flex-row items-center gap-2 max-md:pt-0">
<DateSelect
value={interval}
onValueChange={onIntervalChange}
@@ -503,7 +503,7 @@ export default function SalesDashboard() {
</VStack>
<Loading
isLoading={isFetching}
- className="h-[30dvw] md:h-[23dvw] w-full compact:h-[150px]"
+ className="h-[30dvw] md:h-[23dvw] w-full max-md:h-[150px]"
>
{selectedKpi === "salesFunnel" ? (
<FunnelChart
@@ -514,7 +514,7 @@ export default function SalesDashboard() {
) : (
<ChartContainer
config={chartConfig}
- className="aspect-auto h-[30dvw] md:h-[23dvw] w-full compact:h-[150px]"
+ className="aspect-auto h-[30dvw] md:h-[23dvw] w-full max-md:h-[150px]"
>
<BarChart accessibilityLayer data={kpiFetcher.data?.data ?? []}>
<CartesianGrid vertical={false} />
@@ -719,10 +719,7 @@ function SalesOrderDocumentRow({ doc }: { doc: SalesOrder }) {
return (
<Tr>
<Td>
- <Hyperlink
- className="compact:min-h-11"
- to={path.to.salesOrder(doc.id!)}
- >
+ <Hyperlink className="max-md:min-h-11" to={path.to.salesOrder(doc.id!)}>
<HStack spacing={1}>
<RiProgress8Line className="size-4" />
<span>{doc.salesOrderId}</span>
@@ -743,7 +740,7 @@ function QuoteDocumentRow({ doc }: { doc: Quotation }) {
return (
<Tr>
<Td>
- <Hyperlink className="compact:min-h-11" to={path.to.quote(doc.id!)}>
+ <Hyperlink className="max-md:min-h-11" to={path.to.quote(doc.id!)}>
<HStack spacing={1}>
<RiProgress4Line className="size-4" />
<span>{doc.quoteId}</span>
@@ -764,7 +761,7 @@ function RfqDocumentRow({ doc }: { doc: SalesRFQ }) {
return (
<Tr>
<Td>
- <Hyperlink className="compact:min-h-11" to={path.to.salesRfq(doc.id!)}>
+ <Hyperlink className="max-md:min-h-11" to={path.to.salesRfq(doc.id!)}>
<HStack spacing={1}>
<RiProgress2Line className="size-4" />
<span>{doc.rfqId}</span>
diff --git a/apps/erp/app/routes/x+/settings+/audit-logs.details.tsx b/apps/erp/app/routes/x+/settings+/audit-logs.details.tsx
index 626f7958ae..16b9c722b6 100644
--- a/apps/erp/app/routes/x+/settings+/audit-logs.details.tsx
+++ b/apps/erp/app/routes/x+/settings+/audit-logs.details.tsx
@@ -69,7 +69,7 @@ export default function AuditLogDetailsRoute() {
<Trans>All Audit Logs</Trans>
</DrawerTitle>
</DrawerHeader>
- <DrawerBody className="p-0 compact:p-0">
+ <DrawerBody className="p-0 max-md:p-0">
<AuditLogTable entries={entries} count={count} />
</DrawerBody>
</DrawerContent>
diff --git a/apps/erp/app/routes/x+/settings+/audit-logs.tsx b/apps/erp/app/routes/x+/settings+/audit-logs.tsx
index 2938761335..6de1e78f90 100644
--- a/apps/erp/app/routes/x+/settings+/audit-logs.tsx
+++ b/apps/erp/app/routes/x+/settings+/audit-logs.tsx
@@ -215,7 +215,7 @@ export default function AuditLogRoute() {
return (
<ScrollArea className="w-full h-[calc(100dvh-var(--topbar-height)-var(--content-inset))]">
<SettingsPage className="gap-4">
- <div className="flex items-center justify-between w-full compact:justify-end">
+ <div className="flex items-center justify-between w-full max-md:justify-end">
<SettingsPageHeading>
<Trans>Audit Logs</Trans>
</SettingsPageHeading>
diff --git a/apps/erp/app/routes/x+/settings+/backups.tsx b/apps/erp/app/routes/x+/settings+/backups.tsx
index 521b8e5a89..8e1d3d0f34 100644
--- a/apps/erp/app/routes/x+/settings+/backups.tsx
+++ b/apps/erp/app/routes/x+/settings+/backups.tsx
@@ -601,7 +601,7 @@ export default function BackupsRoute() {
return (
<ScrollArea className="w-full h-[calc(100dvh-var(--topbar-height)-var(--content-inset))]">
- <div className="py-12 px-4 max-w-[72rem] mx-auto flex flex-col gap-4 compact:py-3">
+ <div className="py-12 px-4 max-w-[72rem] mx-auto flex flex-col gap-4 max-md:py-3">
<SettingsPageHeading>
<Trans>Backups</Trans>
</SettingsPageHeading>
@@ -866,7 +866,7 @@ export default function BackupsRoute() {
<button
type="button"
onClick={openExportProgress}
- className="flex w-full items-center justify-between rounded-lg border p-3 text-left transition-colors hover:bg-muted/50 compact:border-0 compact:p-0 compact:rounded-none"
+ className="flex w-full items-center justify-between rounded-lg border p-3 text-left transition-colors hover:bg-muted/50 max-md:border-0 max-md:p-0 max-md:rounded-none"
>
<VStack spacing={0}>
<span className="text-sm font-medium">
@@ -921,7 +921,7 @@ function BackupRow({ file }: { file: CompanyBackupSummary }) {
return (
<HStack
- className={`w-full justify-between border rounded-lg p-3 compact:border-0 compact:p-0 compact:rounded-none ${
+ className={`w-full justify-between border rounded-lg p-3 max-md:border-0 max-md:p-0 max-md:rounded-none ${
file.status === "pending" || isDeleting ? "opacity-70" : ""
}`}
>
diff --git a/apps/erp/app/routes/x+/settings+/companies.tsx b/apps/erp/app/routes/x+/settings+/companies.tsx
index 66106358d1..d58c834218 100644
--- a/apps/erp/app/routes/x+/settings+/companies.tsx
+++ b/apps/erp/app/routes/x+/settings+/companies.tsx
@@ -92,11 +92,11 @@ export default function SubsidiariesRoute() {
return (
<Tabs defaultValue="tree" className="w-full">
- <div className="flex px-4 py-3 items-center space-x-4 justify-between bg-card border-b border-border w-full compact:justify-start compact:p-0 compact:border-b-0">
+ <div className="flex px-4 py-3 items-center space-x-4 justify-between bg-card border-b border-border w-full max-md:justify-start max-md:p-0 max-md:border-b-0">
<SettingsPageHeading>
<Trans>Companies</Trans>
</SettingsPageHeading>
- <HStack className="compact:w-full">
+ <HStack className="max-md:w-full">
<TabsList>
<TabsTrigger value="tree">Tree View</TabsTrigger>
<TabsTrigger value="list">List View</TabsTrigger>
diff --git a/apps/erp/app/routes/x+/settings+/company.tsx b/apps/erp/app/routes/x+/settings+/company.tsx
index 621773b11d..0a72e41034 100644
--- a/apps/erp/app/routes/x+/settings+/company.tsx
+++ b/apps/erp/app/routes/x+/settings+/company.tsx
@@ -142,7 +142,7 @@ export default function Company() {
return (
<ScrollArea className="w-full h-[calc(100dvh-var(--topbar-height)-var(--content-inset))]">
<SettingsPage className="gap-4">
- <HStack spacing={1} className="items-center compact:hidden">
+ <HStack spacing={1} className="items-center max-md:hidden">
<Heading size="h3">
<Trans>Company</Trans>
</Heading>
diff --git a/apps/erp/app/routes/x+/settings+/demo-data.tsx b/apps/erp/app/routes/x+/settings+/demo-data.tsx
index b15462c6f1..1b3c68e7b9 100644
--- a/apps/erp/app/routes/x+/settings+/demo-data.tsx
+++ b/apps/erp/app/routes/x+/settings+/demo-data.tsx
@@ -301,7 +301,7 @@ export default function DemoDataRoute() {
);
return (
- <VStack spacing={4} className="p-8 w-full max-w-4xl mx-auto compact:p-4">
+ <VStack spacing={4} className="p-8 w-full max-w-4xl mx-auto max-md:p-4">
<VStack spacing={1}>
<SettingsPageHeading>
<Trans>Demo Data</Trans>
diff --git a/apps/erp/app/routes/x+/settings+/logos.tsx b/apps/erp/app/routes/x+/settings+/logos.tsx
index d39da7542a..b6967c860b 100644
--- a/apps/erp/app/routes/x+/settings+/logos.tsx
+++ b/apps/erp/app/routes/x+/settings+/logos.tsx
@@ -81,14 +81,14 @@ export default function LogosRoute() {
return (
<ScrollArea className="w-full h-[calc(100dvh-var(--topbar-height)-var(--content-inset))]">
<SettingsPage>
- <div className="flex w-full justify-between items-center gap-1 compact:justify-end">
+ <div className="flex w-full justify-between items-center gap-1 max-md:justify-end">
<SettingsPageHeading>
<Trans>Logos</Trans>
</SettingsPageHeading>
<Badge variant="outline">{maxSizeMB}MB limit</Badge>
</div>
- <div className="grid grid-cols-2 gap-4 w-full compact:grid-cols-1">
+ <div className="grid grid-cols-2 gap-4 w-full max-md:grid-cols-1">
<Card>
<CardHeader>
<CardTitle className="flex items-center gap-2">
diff --git a/apps/erp/app/routes/x+/settings+/people.tsx b/apps/erp/app/routes/x+/settings+/people.tsx
index 6bb579e76d..d159901572 100644
--- a/apps/erp/app/routes/x+/settings+/people.tsx
+++ b/apps/erp/app/routes/x+/settings+/people.tsx
@@ -195,7 +195,7 @@ export default function PeopleSettingsRoute() {
<CardContent>
<HStack className="justify-between items-center">
<VStack className="items-start" spacing={1}>
- <HStack className="items-center gap-2 compact:flex-wrap">
+ <HStack className="items-center gap-2 max-md:flex-wrap">
<span className="font-medium">
{(companySettings as any).consoleEnabled ? (
<Trans>Console mode is enabled</Trans>
@@ -203,7 +203,7 @@ export default function PeopleSettingsRoute() {
<Trans>Console mode is disabled</Trans>
)}
</span>
- <Badge variant="yellow" className="compact:shrink-0">
+ <Badge variant="yellow" className="max-md:shrink-0">
<Trans>Beta</Trans>
</Badge>
</HStack>
@@ -246,7 +246,7 @@ export default function PeopleSettingsRoute() {
<CardContent>
<HStack className="justify-between items-center">
<VStack className="items-start" spacing={1}>
- <HStack className="items-center gap-2 compact:flex-wrap">
+ <HStack className="items-center gap-2 max-md:flex-wrap">
<span className="font-medium">
{companySettings.timeCardEnabled ? (
<Trans>Timecards are enabled</Trans>
@@ -254,7 +254,7 @@ export default function PeopleSettingsRoute() {
<Trans>Timecards are disabled</Trans>
)}
</span>
- <Badge variant="yellow" className="compact:shrink-0">
+ <Badge variant="yellow" className="max-md:shrink-0">
<Trans>Beta</Trans>
</Badge>
</HStack>
diff --git a/apps/erp/app/routes/x+/settings+/printing.jobs.tsx b/apps/erp/app/routes/x+/settings+/printing.jobs.tsx
index ce542d6dcf..472a4c662e 100644
--- a/apps/erp/app/routes/x+/settings+/printing.jobs.tsx
+++ b/apps/erp/app/routes/x+/settings+/printing.jobs.tsx
@@ -219,7 +219,7 @@ export default function PrintJobsRoute() {
<Trans>Print Jobs</Trans>
</DrawerTitle>
</DrawerHeader>
- <DrawerBody className="p-0 compact:p-0">
+ <DrawerBody className="p-0 max-md:p-0">
<PrintJobsTable jobs={jobs} count={count} />
</DrawerBody>
</DrawerContent>
diff --git a/apps/erp/app/routes/x+/settings+/printing.tsx b/apps/erp/app/routes/x+/settings+/printing.tsx
index 5774000c35..6068a59a88 100644
--- a/apps/erp/app/routes/x+/settings+/printing.tsx
+++ b/apps/erp/app/routes/x+/settings+/printing.tsx
@@ -246,7 +246,7 @@ export default function PrintingSettingsRoute() {
return (
<ScrollArea className="w-full h-[calc(100dvh-var(--topbar-height)-var(--content-inset))]">
<SettingsPage className="gap-4">
- <div className="flex items-center justify-between w-full compact:justify-end">
+ <div className="flex items-center justify-between w-full max-md:justify-end">
<SettingsPageHeading>
<Trans>Printing</Trans>
</SettingsPageHeading>
diff --git a/apps/erp/app/routes/x+/settings+/security.tsx b/apps/erp/app/routes/x+/settings+/security.tsx
index 6ded5cd78e..36959d6db6 100644
--- a/apps/erp/app/routes/x+/settings+/security.tsx
+++ b/apps/erp/app/routes/x+/settings+/security.tsx
@@ -281,7 +281,7 @@ function SsoDomainRow({
const submitting = fetcher.formData?.get("intent");
return (
- <div className="w-full rounded-md border border-border p-4 compact:border-0 compact:p-0 compact:rounded-none">
+ <div className="w-full rounded-md border border-border p-4 max-md:border-0 max-md:p-0 max-md:rounded-none">
<HStack className="w-full justify-between items-center">
<HStack spacing={2}>
<span className="text-sm font-medium font-mono">{domain.domain}</span>
diff --git a/apps/erp/app/routes/x+/supplier+/$supplierId.tsx b/apps/erp/app/routes/x+/supplier+/$supplierId.tsx
index 6b8ef8fc22..af5bd2182d 100644
--- a/apps/erp/app/routes/x+/supplier+/$supplierId.tsx
+++ b/apps/erp/app/routes/x+/supplier+/$supplierId.tsx
@@ -94,7 +94,7 @@ export default function SupplierRoute() {
return (
<>
<SupplierHeader />
- <div className="grid grid-cols-1 md:grid-cols-[1fr_4fr] h-full w-full gap-4 compact:h-auto compact:gap-0">
+ <div className="grid grid-cols-1 md:grid-cols-[1fr_4fr] h-full w-full gap-4 max-md:h-auto max-md:gap-0">
<SupplierSidebar />
<Outlet />
</div>
diff --git a/apps/erp/app/routes/x+/supplier+/new.tsx b/apps/erp/app/routes/x+/supplier+/new.tsx
index 0f6ce31187..7d82ef4e7c 100644
--- a/apps/erp/app/routes/x+/supplier+/new.tsx
+++ b/apps/erp/app/routes/x+/supplier+/new.tsx
@@ -86,7 +86,7 @@ export default function SuppliersNewRoute() {
website: ""
};
return (
- <NewRecordPage className="compact:p-0">
+ <NewRecordPage className="max-md:p-0">
<SupplierForm initialValues={initialValues} />
</NewRecordPage>
);
diff --git a/apps/erp/app/routes/x+/templates+/_index.tsx b/apps/erp/app/routes/x+/templates+/_index.tsx
index ab893fd42c..6f992a0046 100644
--- a/apps/erp/app/routes/x+/templates+/_index.tsx
+++ b/apps/erp/app/routes/x+/templates+/_index.tsx
@@ -51,9 +51,9 @@ export default function DocumentTemplatesIndexRoute() {
<ScrollArea className="h-full w-full">
<VStack
spacing={4}
- className="mx-auto h-full max-w-[60rem] gap-6 px-4 py-12 compact:py-3"
+ className="mx-auto h-full max-w-[60rem] gap-6 px-4 py-12 max-md:py-3"
>
- <div className="flex w-full items-start justify-between gap-4 compact:flex-col compact:gap-3">
+ <div className="flex w-full items-start justify-between gap-4 max-md:flex-col max-md:gap-3">
<div className="flex flex-col gap-1">
<SettingsPageHeading>
<Trans>Document Templates</Trans>
diff --git a/apps/erp/app/routes/x+/templates+/shared.tsx b/apps/erp/app/routes/x+/templates+/shared.tsx
index d0d39e00ab..e6c22650b5 100644
--- a/apps/erp/app/routes/x+/templates+/shared.tsx
+++ b/apps/erp/app/routes/x+/templates+/shared.tsx
@@ -141,14 +141,14 @@ export default function SharedSectionsRoute() {
<ScrollArea className="h-full w-full">
<VStack
spacing={4}
- className="mx-auto h-full max-w-[60rem] gap-6 px-4 py-12 compact:py-3"
+ className="mx-auto h-full max-w-[60rem] gap-6 px-4 py-12 max-md:py-3"
>
- <div className="flex w-full items-start justify-between compact:flex-col compact:items-stretch compact:gap-3">
+ <div className="flex w-full items-start justify-between max-md:flex-col max-md:items-stretch max-md:gap-3">
<div className="flex items-center gap-3">
<Link
to={path.to.documentTemplates}
aria-label="Back to templates"
- className="flex size-8 items-center justify-center rounded-md border text-muted-foreground transition-colors hover:bg-muted hover:text-foreground compact:shrink-0 compact:hit-area"
+ className="flex size-8 items-center justify-center rounded-md border text-muted-foreground transition-colors hover:bg-muted hover:text-foreground max-md:shrink-0 max-md:hit-area"
>
<LuArrowLeft className="size-4" />
</Link>
diff --git a/apps/erp/app/routes/x+/traceability+/graph.tsx b/apps/erp/app/routes/x+/traceability+/graph.tsx
index 7aeed27020..0b6cb2b74e 100644
--- a/apps/erp/app/routes/x+/traceability+/graph.tsx
+++ b/apps/erp/app/routes/x+/traceability+/graph.tsx
@@ -398,7 +398,7 @@ function TraceabilityRouteInner() {
null);
return (
- <div className="flex bg-card h-[calc(100dvh-var(--topbar-height)-var(--content-inset))] w-full overflow-hidden scrollbar-hide compact:flex-col">
+ <div className="flex bg-card h-[calc(100dvh-var(--topbar-height)-var(--content-inset))] w-full overflow-hidden scrollbar-hide max-md:flex-col">
<VStack className="flex-1 min-w-0 h-full" spacing={0}>
<div className="flex flex-1 w-full h-full overflow-hidden">
<div className="w-full h-full">
diff --git a/apps/erp/app/routes/x+/workflows+/runs.$runId.tsx b/apps/erp/app/routes/x+/workflows+/runs.$runId.tsx
index 7a157b8a45..25c3016c0b 100644
--- a/apps/erp/app/routes/x+/workflows+/runs.$runId.tsx
+++ b/apps/erp/app/routes/x+/workflows+/runs.$runId.tsx
@@ -10,7 +10,7 @@ import {
DrawerContent,
DrawerHeader,
DrawerTitle,
- useCompact
+ useViewport
} from "@carbon/react";
import { Trans } from "@lingui/react/macro";
import type { LoaderFunctionArgs } from "react-router";
@@ -80,7 +80,7 @@ export default function WorkflowRunDetailRoute() {
const { run, steps, chain, recordNames, truncated } =
useLoaderData<typeof loader>();
const navigate = useNavigate();
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
return (
<Drawer
open
@@ -92,7 +92,7 @@ export default function WorkflowRunDetailRoute() {
size="xl"
// Phones: no focus ring on the first link when the sheet opens.
onOpenAutoFocus={(e) => {
- if (isCompact) e.preventDefault();
+ if (isPhone) e.preventDefault();
}}
>
<DrawerHeader>
@@ -100,7 +100,7 @@ export default function WorkflowRunDetailRoute() {
<Trans>Run Details</Trans>
</DrawerTitle>
</DrawerHeader>
- <DrawerBody className="p-0 compact:p-0">
+ <DrawerBody className="p-0 max-md:p-0">
<WorkflowRunDetail
run={run}
steps={steps}
diff --git a/apps/erp/app/styles/tailwind.css b/apps/erp/app/styles/tailwind.css
index d783304c33..741793209d 100644
--- a/apps/erp/app/styles/tailwind.css
+++ b/apps/erp/app/styles/tailwind.css
@@ -226,3 +226,19 @@ p.is-editor-empty:first-child:before {
.animate-spinner {
animation: spinner-fade 1.2s linear infinite;
}
+
+/*
+ * ERP phone chrome (< 768px).
+ * - The app bar is 52px, so frames sized from --topbar-height still fit.
+ * - Toasts sit above the bottom chrome at every phone width; Sonner's own
+ * mobileOffset only applies up to 600px.
+ */
+@media (width < 48rem) {
+ :root {
+ --topbar-height: calc(52px + env(safe-area-inset-top));
+ }
+
+ [data-sonner-toaster][data-y-position="bottom"] {
+ bottom: calc(var(--content-inset, 0px) + 16px);
+ }
+}
diff --git a/apps/mes/app/routes/x+/active.tsx b/apps/mes/app/routes/x+/active.tsx
index 7ad0549007..b3d6fd7e7c 100644
--- a/apps/mes/app/routes/x+/active.tsx
+++ b/apps/mes/app/routes/x+/active.tsx
@@ -8,7 +8,7 @@ import {
Heading,
Input,
SidebarTrigger,
- useIsMobile
+ useViewport
} from "@carbon/react";
import { Trans, useLingui } from "@lingui/react/macro";
import { useEffect, useMemo, useRef, useState } from "react";
@@ -46,7 +46,7 @@ export default function ActiveRoute() {
const [searchTerm, setSearchTerm] = useState("");
const panelRef = useRef<ImperativePanelHandle>(null);
- const isMobile = useIsMobile();
+ const { isPhone: isMobile } = useViewport();
const { operationId } = useParams();
useEffect(() => {
diff --git a/apps/mes/app/routes/x+/recent.tsx b/apps/mes/app/routes/x+/recent.tsx
index c2ce12f61b..3366de3e7f 100644
--- a/apps/mes/app/routes/x+/recent.tsx
+++ b/apps/mes/app/routes/x+/recent.tsx
@@ -8,7 +8,7 @@ import {
Heading,
Input,
SidebarTrigger,
- useIsMobile
+ useViewport
} from "@carbon/react";
import { Trans, useLingui } from "@lingui/react/macro";
import { useEffect, useMemo, useRef, useState } from "react";
@@ -46,7 +46,7 @@ export default function ActiveRoute() {
const [searchTerm, setSearchTerm] = useState("");
const panelRef = useRef<ImperativePanelHandle>(null);
- const isMobile = useIsMobile();
+ const { isPhone: isMobile } = useViewport();
const { operationId } = useParams();
useEffect(() => {
diff --git a/apps/starter/app/components/Breadcrumbs.tsx b/apps/starter/app/components/Breadcrumbs.tsx
index 504242f041..0acc9d208d 100644
--- a/apps/starter/app/components/Breadcrumbs.tsx
+++ b/apps/starter/app/components/Breadcrumbs.tsx
@@ -19,8 +19,8 @@ import {
HStack,
PrefetchLink,
ScrollArea,
- useIsMobile,
- useMode
+ useMode,
+ useViewport
} from "@carbon/react";
import type { ComponentProps } from "react";
import { cloneElement, forwardRef, useMemo } from "react";
@@ -130,7 +130,7 @@ const Breadcrumbs = () => {
})
.filter(Boolean);
- const isMobile = useIsMobile();
+ const { isPhone: isMobile } = useViewport();
return (
<HStack className="items-center h-full -ml-2" spacing={0}>
diff --git a/packages/config/tailwind/theme.css b/packages/config/tailwind/theme.css
index 05ea91cf60..41d90f5542 100644
--- a/packages/config/tailwind/theme.css
+++ b/packages/config/tailwind/theme.css
@@ -7,9 +7,8 @@
@custom-variant dark (&:is(.dark *));
@custom-variant tall (@media (min-height: 769px));
-/* Hover applies where a pointer can hover, at >=768px (byte-identical to the
- old plain `&:hover` on desktop), and in apps without the phone layout (MES,
- starter), so only the ERP's phone layout drops sticky tap highlights. */
+/* Hover applies where a pointer can hover and at >=768px (byte-identical to
+ the old plain `&:hover` on desktop), so phones drop sticky tap highlights. */
@custom-variant hover {
@media (hover: hover) {
&:hover {
@@ -21,24 +20,10 @@
@slot;
}
}
- :where(html:not([data-compact-ui])) &:hover {
- @slot;
- }
-}
-
-/* Phone layout: below 768px AND inside an app that opted in with
- `data-compact-ui` on <html> (the ERP). MES and starter never match, so
- shared primitives stay unchanged there. `rg "compact:"` lists the mobile surface. */
-@custom-variant compact {
- @media (width < 48rem) {
- :where([data-compact-ui]) & {
- @slot;
- }
- }
}
/* A 44x44 tap target around a smaller control, drawn by ::after (use as
- `compact:hit-area`). Sets position: relative, so not for absolutely
+ `max-md:hit-area`). Sets position: relative, so not for absolutely
positioned elements, and needs the element's ::after to be free. */
@utility hit-area {
position: relative;
@@ -435,29 +420,18 @@
}
/*
- * Compact (phone) presentation, ERP only (html[data-compact-ui], < 768px).
+ * Phone presentation (< 768px), every app.
* - Muted text gets a darker token in light mode to pass 4.5:1 on grey.
- * - The app bar is 52px, so frames sized from --topbar-height still fit.
* - `.truncate` always ends in an ellipsis, whatever text-wrap utility is set.
- * - Toasts sit above the bottom chrome at every compact width; Sonner's own
- * mobileOffset only applies up to 600px.
*/
@media (width < 48rem) {
- html[data-compact-ui] {
- --topbar-height: calc(52px + env(safe-area-inset-top));
- }
-
- html[data-compact-ui]:not(.dark) {
+ html:not(.dark) {
--muted-foreground: 220 3.8% 42% !important;
}
/* `text-pretty` / `text-balance` (CardTitle, Heading) reset the wrap mode
that `truncate` sets, so a truncated title wrapped instead of ending in "…". */
- html[data-compact-ui] .truncate {
+ .truncate {
white-space: nowrap;
}
-
- html[data-compact-ui] [data-sonner-toaster][data-y-position="bottom"] {
- bottom: calc(var(--content-inset, 0px) + 16px);
- }
}
diff --git a/packages/form/src/components/Boolean.tsx b/packages/form/src/components/Boolean.tsx
index 3c50c66cca..99d780adc0 100644
--- a/packages/form/src/components/Boolean.tsx
+++ b/packages/form/src/components/Boolean.tsx
@@ -118,7 +118,7 @@ const Boolean = forwardRef<HTMLInputElement, FormBooleanProps>(
<LabelWithHelp termId={termId}>{label}</LabelWithHelp>
</FormLabel>
)}
- <HStack className="compact:-ml-1">
+ <HStack className="max-md:-ml-1">
<Switch
variant={variant}
{...getInputProps()}
diff --git a/packages/form/src/components/Hidden.tsx b/packages/form/src/components/Hidden.tsx
index e1a9f91d1f..1c50b3e986 100644
--- a/packages/form/src/components/Hidden.tsx
+++ b/packages/form/src/components/Hidden.tsx
@@ -28,7 +28,7 @@ const Hidden = forwardRef<HTMLInputElement, HiddenProps>(
// Phones: an empty hidden field must not take a row in the form.
<FormControl
isInvalid={!!error}
- className={error ? undefined : "compact:hidden"}
+ className={error ? undefined : "max-md:hidden"}
>
<InputBase
ref={ref}
diff --git a/packages/form/src/components/Select.tsx b/packages/form/src/components/Select.tsx
index 84562c2709..07349f31d2 100644
--- a/packages/form/src/components/Select.tsx
+++ b/packages/form/src/components/Select.tsx
@@ -183,7 +183,7 @@ export const SelectBase = forwardRef<HTMLButtonElement, SelectBaseProps>(
return (
// Phones: Radix's hidden native <select> follows the trigger, so a
// space-x margin would end the trigger 4px short; use a gap instead.
- <HStack spacing={1} className="compact:space-x-0 compact:gap-1">
+ <HStack spacing={1} className="max-md:space-x-0 max-md:gap-1">
{isInlinePreview && value && (
<span className="flex flex-grow line-clamp-1 items-center">
{inline(value, options)}
@@ -202,7 +202,7 @@ export const SelectBase = forwardRef<HTMLButtonElement, SelectBaseProps>(
className={cn(
!isInlinePreview && "min-w-[160px] relative",
isInlinePreview &&
- "compact:relative compact:after:absolute compact:after:-inset-2.5"
+ "max-md:relative max-md:after:absolute max-md:after:-inset-2.5"
)}
inline={isInlinePreview}
disabled={isNonInteractive}
diff --git a/packages/react/src/BottomSheet.tsx b/packages/react/src/BottomSheet.tsx
index 730da4ec08..fa9c111307 100644
--- a/packages/react/src/BottomSheet.tsx
+++ b/packages/react/src/BottomSheet.tsx
@@ -16,16 +16,15 @@ import { LuChevronLeft, LuX } from "react-icons/lu";
import { ActionPresentationBoundary } from "./ActionPresentation";
import { ClientOnly } from "./ClientOnly";
-import { useCompact } from "./Compact";
import { DialogRoot, useDialogDismissable } from "./Modal";
import { cn } from "./utils/cn";
+import { useViewport } from "./Viewport";
/**
* A sheet that slides up from the bottom. Every compact (phone) sheet shares
* this anatomy: grabber, header with optional Back and a close ×, a scrolling
- * body and a sticky footer above the safe area. The compact
- * parts only apply inside an app that opted into the `compact:` variant, so
- * other callers (MES) render as before.
+ * body and a sticky footer above the safe area. The compact parts apply below
+ * `md` (`max-md:`); wider viewports render the desktop dialog.
*/
const BottomSheet = DialogRoot;
@@ -60,7 +59,7 @@ const BottomSheetContent = forwardRef<
BottomSheetContentProps
>(({ className, children, size = "auto", ...props }, ref) => {
const { t } = useLingui();
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
const dismissable = useDialogDismissable();
return (
<ClientOnly fallback={null}>
@@ -72,9 +71,9 @@ const BottomSheetContent = forwardRef<
className={cn(
"fixed inset-x-0 bottom-0 z-[70] flex flex-col rounded-t-2xl bg-background shadow-lg duration-300",
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",
- "compact:max-h-[88dvh] compact:rounded-t-[14px] compact:bg-popover compact:pb-safe",
+ "max-md:max-h-[88dvh] max-md:rounded-t-[14px] max-md:bg-popover max-md:pb-safe",
size === "full" &&
- "compact:h-[calc(100dvh-env(safe-area-inset-top)-12px)] compact:max-h-none",
+ "max-md:h-[calc(100dvh-env(safe-area-inset-top)-12px)] max-md:max-h-none",
className
)}
{...props}
@@ -82,11 +81,11 @@ const BottomSheetContent = forwardRef<
<div
className={cn(
"mx-auto mt-3 mb-2 h-1.5 w-12 shrink-0 rounded-full bg-muted-foreground/20",
- "compact:mt-2 compact:mb-1 compact:h-[5px] compact:w-9"
+ "max-md:mt-2 max-md:mb-1 max-md:h-[5px] max-md:w-9"
)}
/>
<ActionPresentationBoundary>{children}</ActionPresentationBoundary>
- {isCompact && dismissable && (
+ {isPhone && dismissable && (
<DialogPrimitive.Close
aria-label={t`Close`}
className="absolute top-3 right-1 flex size-11 items-center justify-center rounded-full text-muted-foreground outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50"
@@ -109,7 +108,7 @@ const BottomSheetHeader = ({
<div
className={cn(
"px-6 pb-2 text-center",
- "compact:relative compact:flex compact:min-h-11 compact:shrink-0 compact:items-center compact:justify-center compact:px-14 compact:pb-2",
+ "max-md:relative max-md:flex max-md:min-h-11 max-md:shrink-0 max-md:items-center max-md:justify-center max-md:px-14 max-md:pb-2",
className
)}
{...props}
@@ -149,7 +148,7 @@ const BottomSheetBody = ({
<div
className={cn(
"px-6 pb-6",
- "compact:min-h-0 compact:flex-1 compact:overflow-y-auto compact:px-4 compact:pb-4",
+ "max-md:min-h-0 max-md:flex-1 max-md:overflow-y-auto max-md:px-4 max-md:pb-4",
className
)}
{...props}
@@ -180,7 +179,7 @@ const BottomSheetTitle = forwardRef<
ref={ref}
className={cn(
"text-sm font-medium text-muted-foreground",
- "compact:truncate compact:text-[17px] compact:font-semibold compact:text-foreground",
+ "max-md:truncate max-md:text-[17px] max-md:font-semibold max-md:text-foreground",
className
)}
{...props}
diff --git a/packages/react/src/Button.tsx b/packages/react/src/Button.tsx
index 632baedf06..40eb724484 100644
--- a/packages/react/src/Button.tsx
+++ b/packages/react/src/Button.tsx
@@ -8,7 +8,6 @@ import { cva } from "class-variance-authority";
import type { ButtonHTMLAttributes, MouseEvent, ReactElement } from "react";
import { cloneElement, forwardRef, useCallback, useRef } from "react";
import { useActionPresentation } from "./ActionPresentation";
-import { HitArea } from "./Compact";
import type { ShortcutInput } from "./hooks/useShortcutKeys";
import { useShortcutKeys } from "./hooks/useShortcutKeys";
import { ShortcutKey } from "./ShortcutKey";
@@ -16,6 +15,7 @@ import { Spinner } from "./Spinner";
import { cn } from "./utils/cn";
import { hasOpenDialog, isInsideTopmostDialog } from "./utils/dialog";
import { mergeRefs } from "./utils/react";
+import { HitArea } from "./Viewport";
export const buttonVariants = cva(
[
diff --git a/packages/react/src/Card.tsx b/packages/react/src/Card.tsx
index 8243d6239a..614a90dfcd 100644
--- a/packages/react/src/Card.tsx
+++ b/packages/react/src/Card.tsx
@@ -111,7 +111,7 @@ const CardAttribute = forwardRef<
<div
ref={ref}
className={cn(
- "flex flex-row md:flex-col items-start justify-start gap-2 compact:min-h-12 compact:items-center compact:justify-between",
+ "flex flex-row md:flex-col items-start justify-start gap-2 max-md:min-h-12 max-md:items-center max-md:justify-between",
className
)}
{...props}
@@ -125,7 +125,7 @@ const CardAttributes = forwardRef<
>(({ className, ...props }, ref) => (
<div
ref={ref}
- className={cn("flex flex-col md:flex-row gap-8 compact:gap-0", className)}
+ className={cn("flex flex-col md:flex-row gap-8 max-md:gap-0", className)}
{...props}
/>
));
@@ -168,7 +168,7 @@ const CardHeader = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(
<div
ref={ref}
className={cn(
- "flex flex-col gap-1 px-6 py-4 text-muted-foreground compact:px-4 compact:py-3",
+ "flex flex-col gap-1 px-6 py-4 text-muted-foreground max-md:px-4 max-md:py-3",
context?.isCollapsed && "cursor-pointer",
className
)}
@@ -219,7 +219,7 @@ const CardContent = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(
<div
ref={ref}
className={cn(
- "flex flex-col flex-1 p-6 rounded-xl border border-border bg-card dark:bg-muted/40 compact:p-4 compact:rounded-t-none compact:border-x-0 compact:border-b-0 compact:[&:is([class~='compact:hidden']+*)]:rounded-t-xl compact:[&:is([class~='compact:hidden']+*)]:border-t-0",
+ "flex flex-col flex-1 p-6 rounded-xl border border-border bg-card dark:bg-muted/40 max-md:p-4 max-md:rounded-t-none max-md:border-x-0 max-md:border-b-0 max-md:[&:is([class~='max-md:hidden']+*)]:rounded-t-xl max-md:[&:is([class~='max-md:hidden']+*)]:border-t-0",
className
)}
{...props}
@@ -244,11 +244,11 @@ const CardFooter = forwardRef<HTMLDivElement, CardFooterProps>(
<div
ref={ref}
className={cn(
- "flex items-center py-4 px-6 gap-2 compact:px-4",
+ "flex items-center py-4 px-6 gap-2 max-md:px-4",
// Phones: the same full-width 44pt actions as a sheet footer.
sticky && compactFooterClassName,
sticky &&
- "compact:z-10 compact:border-t compact:border-border compact:bg-card compact:pb-safe-4",
+ "max-md:z-10 max-md:border-t max-md:border-border max-md:bg-card max-md:pb-safe-4",
className
)}
{...props}
diff --git a/packages/react/src/Checkbox.tsx b/packages/react/src/Checkbox.tsx
index 7ab8a1ae9e..d4d23341f3 100644
--- a/packages/react/src/Checkbox.tsx
+++ b/packages/react/src/Checkbox.tsx
@@ -26,7 +26,7 @@ const Checkbox = forwardRef<
"peer size-4 shrink-0 rounded-[4px] border border-muted-foreground/50 shadow-xs transition-shadow outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:bg-input/30 dark:aria-invalid:ring-destructive/40 dark:data-[state=checked]:bg-primary",
isIndeterminate && "bg-primary text-primary-foreground",
// Phones: a 44x44 hit area around the visual box.
- "compact:hit-area",
+ "max-md:hit-area",
className
)}
{...props}
diff --git a/packages/react/src/ChoiceSelect.tsx b/packages/react/src/ChoiceSelect.tsx
index 22ff307b7d..65df83306e 100644
--- a/packages/react/src/ChoiceSelect.tsx
+++ b/packages/react/src/ChoiceSelect.tsx
@@ -210,7 +210,7 @@ function ChoiceSelectMulti<V extends string>({
"hover:bg-accent/40",
"outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50",
"disabled:cursor-not-allowed disabled:opacity-50",
- "compact:h-11 compact:text-base",
+ "max-md:h-11 max-md:text-base",
selected.length === 0 && "text-muted-foreground",
className
)}
diff --git a/packages/react/src/CodeBlockHighlighted.tsx b/packages/react/src/CodeBlockHighlighted.tsx
index 1f7eeaee87..7fa270b833 100644
--- a/packages/react/src/CodeBlockHighlighted.tsx
+++ b/packages/react/src/CodeBlockHighlighted.tsx
@@ -73,7 +73,7 @@ const CodeBlockHighlighted = ({
</ShikiHighlighter>
{showCopy && (
- <div className="invisible absolute right-0 top-0 opacity-0 transition-opacity group-hover:visible group-hover:opacity-100 compact:opacity-100">
+ <div className="invisible absolute right-0 top-0 opacity-0 transition-opacity group-hover:visible group-hover:opacity-100 max-md:opacity-100">
<Button size="sm" onClick={handleCopyCode}>
{showCopied ? "Copied" : "Copy"}
</Button>
diff --git a/packages/react/src/Command.tsx b/packages/react/src/Command.tsx
index 3da27375dd..3b44a07cee 100644
--- a/packages/react/src/Command.tsx
+++ b/packages/react/src/Command.tsx
@@ -16,10 +16,9 @@ import type {
import { forwardRef } from "react";
import { LuChevronDown } from "react-icons/lu";
import { RxMagnifyingGlass } from "react-icons/rx";
-
-import { HitArea, useCompact } from "./Compact";
import { Modal, ModalContent, ModalTitle } from "./Modal";
import { cn } from "./utils/cn";
+import { HitArea, useViewport } from "./Viewport";
const Command = forwardRef<
ElementRef<typeof CommandPrimitive>,
@@ -108,9 +107,9 @@ const commandInputTextFieldVariants = cva(
variants: {
size: {
lg: "h-12 rounded-lg px-4 text-base",
- md: "h-10 rounded-md px-4 text-sm compact:h-11 compact:text-base",
- sm: "h-8 rounded-md px-3 text-sm compact:h-11 compact:text-base",
- xs: "h-6 rounded px-2 text-sm compact:h-11 compact:text-base"
+ md: "h-10 rounded-md px-4 text-sm max-md:h-11 max-md:text-base",
+ sm: "h-8 rounded-md px-3 text-sm max-md:h-11 max-md:text-base",
+ xs: "h-6 rounded px-2 text-sm max-md:h-11 max-md:text-base"
},
isInvalid: {
true: "border-destructive ring-destructive focus-visible:ring-destructive",
@@ -285,19 +284,19 @@ const commandTriggerVariants = cva(
variants: {
size: {
lg: "h-12 px-4 py-3 rounded-lg text-base space-x-4",
- md: "h-10 px-3 py-2 rounded-md text-sm space-x-3 compact:h-11 compact:text-base",
- sm: "h-8 px-3 py-2 rounded-md text-sm space-x-2 compact:h-11 compact:text-base"
+ md: "h-10 px-3 py-2 rounded-md text-sm space-x-3 max-md:h-11 max-md:text-base",
+ sm: "h-8 px-3 py-2 rounded-md text-sm space-x-2 max-md:h-11 max-md:text-base"
},
asButton: {
false:
"text-foreground flex w-full whitespace-nowrap rounded-md border border-input shadow-xs data-[placeholder]:text-muted-foreground outline-none focus:border-ring focus:ring-[3px] focus:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1 overflow-hidden",
- true: "text-foreground relative font-medium shrink-0 group inline-flex select-none transform-gpu initial:border-none disabled:opacity-50 focus:!outline-none focus:!ring-0 active:!outline-none active:!ring-0 after:pointer-events-none after:absolute after:-inset-[3px] after:rounded-lg after:border after:border-blue-500 after:opacity-0 after:ring-2 after:ring-blue-500/20 after:transition-opacity focus-visible:after:opacity-100 active:after:opacity-0 before:pointer-events-none before:bg-gradient-to-b before:transition-opacity before:from-white/[0.12] before:absolute before:inset-0 before:z-[1] before:rounded before:opacity-0 bg-background hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 shadow-button-base hover:scale-100 focus-visible:scale-100 transition-[background-color,color,transform,box-shadow] duration-150 ease-in-out compact:rounded-full compact:overflow-visible"
+ true: "text-foreground relative font-medium shrink-0 group inline-flex select-none transform-gpu initial:border-none disabled:opacity-50 focus:!outline-none focus:!ring-0 active:!outline-none active:!ring-0 after:pointer-events-none after:absolute after:-inset-[3px] after:rounded-lg after:border after:border-blue-500 after:opacity-0 after:ring-2 after:ring-blue-500/20 after:transition-opacity focus-visible:after:opacity-100 active:after:opacity-0 before:pointer-events-none before:bg-gradient-to-b before:transition-opacity before:from-white/[0.12] before:absolute before:inset-0 before:z-[1] before:rounded before:opacity-0 bg-background hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 shadow-button-base hover:scale-100 focus-visible:scale-100 transition-[background-color,color,transform,box-shadow] duration-150 ease-in-out max-md:rounded-full max-md:overflow-visible"
}
},
compoundVariants: [
- { size: "lg", asButton: true, class: "compact:h-8 compact:text-sm" },
- { size: "md", asButton: true, class: "compact:h-8 compact:text-sm" },
- { size: "sm", asButton: true, class: "compact:h-8 compact:text-sm" }
+ { size: "lg", asButton: true, class: "max-md:h-8 max-md:text-sm" },
+ { size: "md", asButton: true, class: "max-md:h-8 max-md:text-sm" },
+ { size: "sm", asButton: true, class: "max-md:h-8 max-md:text-sm" }
],
defaultVariants: {
size: "md",
@@ -312,8 +311,8 @@ export const multiSelectTriggerVariants = cva(
variants: {
size: {
lg: "text-base",
- md: "text-sm compact:text-base",
- sm: "text-xs compact:text-base"
+ md: "text-sm max-md:text-base",
+ sm: "text-xs max-md:text-base"
},
hasSelections: {
true: "h-full",
@@ -339,7 +338,7 @@ export const multiSelectTriggerVariants = cva(
{
size: "md",
hasSelections: false,
- class: "h-10 compact:h-11"
+ class: "h-10 max-md:h-11"
},
{
size: "sm",
@@ -349,7 +348,7 @@ export const multiSelectTriggerVariants = cva(
{
size: "sm",
hasSelections: false,
- class: "h-8 compact:h-11"
+ class: "h-8 max-md:h-11"
}
],
defaultVariants: {
@@ -370,7 +369,7 @@ const CommandTrigger = forwardRef<ElementRef<"button">, CommandTriggerProps>(
({ asButton = false, size, className, children, icon, ...props }, ref) => {
// Only mounted on phones: the trigger's `[&>span]:line-clamp-1` would
// otherwise un-hide the hit-area span on desktop.
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
return (
<button
ref={ref}
@@ -384,7 +383,7 @@ const CommandTrigger = forwardRef<ElementRef<"button">, CommandTriggerProps>(
)}
{...props}
>
- {asButton && isCompact && <HitArea />}
+ {asButton && isPhone && <HitArea />}
{children}
{icon ? (
icon
@@ -392,8 +391,8 @@ const CommandTrigger = forwardRef<ElementRef<"button">, CommandTriggerProps>(
<>
{/* Phones: a picker's trailing indicator is ⌄. It comes first so
the desktop magnifier stays the last child (space-x). */}
- <LuChevronDown className="hidden size-4 flex-shrink-0 opacity-50 compact:block" />
- <RxMagnifyingGlass className="size-4 flex-shrink-0 opacity-50 compact:hidden" />
+ <LuChevronDown className="hidden size-4 flex-shrink-0 opacity-50 max-md:block" />
+ <RxMagnifyingGlass className="size-4 flex-shrink-0 opacity-50 max-md:hidden" />
</>
)}
</button>
diff --git a/packages/react/src/Context.tsx b/packages/react/src/Context.tsx
index 26bdd98474..51ca2a2c1f 100644
--- a/packages/react/src/Context.tsx
+++ b/packages/react/src/Context.tsx
@@ -14,7 +14,6 @@ import { forwardRef } from "react";
import { LuChevronRight, LuCircle } from "react-icons/lu";
import { RxCheck } from "react-icons/rx";
import { ActionPresentationBoundary } from "./ActionPresentation";
-import { useCompact } from "./Compact";
import {
compactPart,
MenuSheetCheckboxItem,
@@ -36,6 +35,7 @@ import { ShortcutKey } from "./ShortcutKey";
import type { MenuItemShortcut } from "./shortcuts";
import { cn } from "./utils/cn";
import { withMenuShortcuts } from "./utils/menuShortcut";
+import { useViewport } from "./Viewport";
const DesktopContextMenuSubTrigger = forwardRef<
ElementRef<typeof ContextMenuPrimitive.SubTrigger>,
@@ -249,7 +249,7 @@ ContextMenuShortcut.displayName = "ContextMenuShortcut";
const ContextMenu = (
props: ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Root>
) =>
- useCompact() ? (
+ useViewport().isPhone ? (
<MenuSheetRoot {...props} />
) : (
<ContextMenuPrimitive.Root {...props} />
@@ -267,7 +267,7 @@ const ContextMenuGroup = compactPart(
const ContextMenuPortal = (
props: ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Portal>
) =>
- useCompact() ? (
+ useViewport().isPhone ? (
<MenuSheetPortal {...props} />
) : (
<ContextMenuPrimitive.Portal {...props} />
@@ -275,7 +275,7 @@ const ContextMenuPortal = (
const ContextMenuSub = (
props: ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Sub>
) =>
- useCompact() ? (
+ useViewport().isPhone ? (
<MenuSheetSub {...props} />
) : (
<ContextMenuPrimitive.Sub {...props} />
diff --git a/packages/react/src/Date/components/Button.tsx b/packages/react/src/Date/components/Button.tsx
index f019809054..c979438b77 100644
--- a/packages/react/src/Date/components/Button.tsx
+++ b/packages/react/src/Date/components/Button.tsx
@@ -34,8 +34,8 @@ export const FieldButton = ({ size = "md", ...props }: FieldButtonProps) => {
const { buttonProps } = useButton(props, ref);
const sizeClasses = {
- sm: "h-8 w-8 px-2 compact:h-11 compact:w-11",
- md: "h-10 w-10 px-3 compact:h-11 compact:w-11",
+ sm: "h-8 w-8 px-2 max-md:h-11 max-md:w-11",
+ md: "h-10 w-10 px-3 max-md:h-11 max-md:w-11",
lg: "h-12 w-12 px-4"
};
diff --git a/packages/react/src/Date/components/DateSegment.tsx b/packages/react/src/Date/components/DateSegment.tsx
index 2537e03b48..b14dd14b9c 100644
--- a/packages/react/src/Date/components/DateSegment.tsx
+++ b/packages/react/src/Date/components/DateSegment.tsx
@@ -11,8 +11,8 @@ import clsx from "clsx";
import { useId, useRef } from "react";
const segmentSizeVariants = {
- sm: "text-sm compact:text-base",
- md: "text-sm compact:text-base",
+ sm: "text-sm max-md:text-base",
+ md: "text-sm max-md:text-base",
lg: "text-base"
} as const;
diff --git a/packages/react/src/DateTime.tsx b/packages/react/src/DateTime.tsx
index 71cd79213a..831c18b95d 100644
--- a/packages/react/src/DateTime.tsx
+++ b/packages/react/src/DateTime.tsx
@@ -193,7 +193,7 @@ const DateTime = ({
className={cn(
"cursor-pointer whitespace-nowrap underline decoration-muted-foreground/50 decoration-dotted underline-offset-[3px] transition-colors hover:decoration-foreground/70",
// Phones: the hover tooltip is off, so nothing hints it is interactive.
- "compact:no-underline compact:cursor-auto",
+ "max-md:no-underline max-md:cursor-auto",
className
)}
>
diff --git a/packages/react/src/Drawer.tsx b/packages/react/src/Drawer.tsx
index b2654b9051..1b4b483fb1 100644
--- a/packages/react/src/Drawer.tsx
+++ b/packages/react/src/Drawer.tsx
@@ -17,13 +17,13 @@ import { forwardRef } from "react";
import { LuX } from "react-icons/lu";
import { ActionPresentationBoundary } from "./ActionPresentation";
import { ClientOnly } from "./ClientOnly";
-import { useCompact } from "./Compact";
import {
compactFooterClassName,
DialogRoot,
useDialogDismissable
} from "./Modal";
import { cn } from "./utils/cn";
+import { useViewport } from "./Viewport";
const Drawer = DialogRoot;
@@ -32,7 +32,7 @@ const DrawerTrigger = DialogPrimitive.Trigger;
const DrawerCloseButton = DialogPrimitive.Close;
const portalVariants = cva(
- "fixed inset-0 z-50 flex p-3 compact:p-0 compact:items-end",
+ "fixed inset-0 z-50 flex p-3 max-md:p-0 max-md:items-end",
{
variants: {
position: {
@@ -63,7 +63,7 @@ const DrawerOverlay = forwardRef<
>(({ className, children, ...props }, ref) => (
<DialogPrimitive.Overlay
className={cn(
- "fixed inset-0 z-50 bg-black/20 compact:bg-black/40 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
+ "fixed inset-0 z-50 bg-black/20 max-md:bg-black/40 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
className
)}
{...props}
@@ -79,8 +79,8 @@ const DrawerBody = ({
<div
className={cn(
"flex flex-col flex-1 items-start justify-start overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent w-full p-6 bg-card dark:bg-muted/40 rounded-xl border border-border",
- // A caller that wants the body flush on phones passes `compact:p-0`.
- "compact:min-h-0 compact:rounded-none compact:border-x-0 compact:p-4",
+ // A caller that wants the body flush on phones passes `max-md:p-0`.
+ "max-md:min-h-0 max-md:rounded-none max-md:border-x-0 max-md:p-4",
className
)}
{...props}
@@ -89,7 +89,7 @@ const DrawerBody = ({
DrawerBody.displayName = "DrawerBody";
const sheetVariants = cva(
- "flex flex-col z-50 scale-100 bg-accent dark:bg-card opacity-100 shadow-button-base dark:shadow-[inset_0_0.5px_0_rgb(255_255_255_/_0.08),_inset_0_0_1px_rgb(255_255_255_/_0.24),_0_0_0_0.5px_rgb(0,0,0,1),0px_0px_4px_rgba(0,_0,_0,_0.08)] border border-border transition-[background-color,box-shadow,border-color] duration-100 focus-visible:outline-none focus-visible:ring-0 rounded-xl compact:max-h-[calc(100dvh-env(safe-area-inset-top)-12px)] compact:w-full compact:max-w-none compact:overflow-hidden compact:rounded-t-[14px] compact:rounded-b-none compact:border-0 compact:bg-card compact:h-auto compact:[&>form]:min-h-0",
+ "flex flex-col z-50 scale-100 bg-accent dark:bg-card opacity-100 shadow-button-base dark:shadow-[inset_0_0.5px_0_rgb(255_255_255_/_0.08),_inset_0_0_1px_rgb(255_255_255_/_0.24),_0_0_0_0.5px_rgb(0,0,0,1),0px_0px_4px_rgba(0,_0,_0,_0.08)] border border-border transition-[background-color,box-shadow,border-color] duration-100 focus-visible:outline-none focus-visible:ring-0 rounded-xl max-md:max-h-[calc(100dvh-env(safe-area-inset-top)-12px)] max-md:w-full max-md:max-w-none max-md:overflow-hidden max-md:rounded-t-[14px] max-md:rounded-b-none max-md:border-0 max-md:bg-card max-md:h-auto max-md:[&>form]:min-h-0",
{
variants: {
position: {
@@ -108,7 +108,7 @@ const sheetVariants = cva(
xl: "",
// Phones: sheets fit their content (the form shrinks under the max
// height so its body scrolls); `full` keeps the whole height.
- full: "compact:h-[calc(100dvh-env(safe-area-inset-top)-12px)]"
+ full: "max-md:h-[calc(100dvh-env(safe-area-inset-top)-12px)]"
}
},
compoundVariants: [
@@ -204,7 +204,7 @@ const DrawerContent = forwardRef<
ref
) => {
const dismissable = useDialogDismissable();
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
return (
<ClientOnly fallback={null}>
{() => (
@@ -218,11 +218,11 @@ const DrawerContent = forwardRef<
// Phones: focusing the first field pops the keyboard (or a
// picker that opens on focus) over the form; keep focus on
// the sheet itself.
- if (isCompact) event.preventDefault();
+ if (isPhone) event.preventDefault();
props.onOpenAutoFocus?.(event);
}}
>
- {isCompact && (
+ {isPhone && (
<div className="mx-auto mt-1.5 h-[5px] w-9 shrink-0 rounded-full bg-muted-foreground/20" />
)}
<ActionPresentationBoundary>
@@ -231,7 +231,7 @@ const DrawerContent = forwardRef<
{dismissable && (
<DialogPrimitive.Close
type="button"
- className="absolute right-4 top-3 rounded-full p-2 opacity-70 transition-opacity hover:opacity-100 outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none data-[state=open]:bg-secondary compact:right-1 compact:top-[15px] compact:flex compact:size-11 compact:items-center compact:justify-center compact:p-0"
+ className="absolute right-4 top-3 rounded-full p-2 opacity-70 transition-opacity hover:opacity-100 outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none data-[state=open]:bg-secondary max-md:right-1 max-md:top-[15px] max-md:flex max-md:size-11 max-md:items-center max-md:justify-center max-md:p-0"
>
<LuX className="h-5 w-5" />
<span className="sr-only">Close</span>
@@ -253,7 +253,7 @@ const DrawerHeader = ({
<div
className={cn(
"flex flex-col flex-0 gap-1 text-left px-6 py-4 text-muted-foreground",
- "compact:min-h-[52px] compact:justify-center compact:px-4 compact:py-2 compact:pr-14",
+ "max-md:min-h-[52px] max-md:justify-center max-md:px-4 max-md:py-2 max-md:pr-14",
className
)}
{...props}
@@ -270,7 +270,7 @@ const DrawerFooter = ({
"flex flex-0 sm:flex-row flex-col-reverse px-6 py-4 sm:justify-end sm:space-x-2",
compactFooterClassName,
// Phones: above the safe area.
- "compact:gap-2 compact:space-x-0 compact:pt-3 compact:pb-safe-4",
+ "max-md:gap-2 max-md:space-x-0 max-md:pt-3 max-md:pb-safe-4",
className
)}
{...props}
diff --git a/packages/react/src/Dropdown.tsx b/packages/react/src/Dropdown.tsx
index 6ded6e5831..6a45178971 100644
--- a/packages/react/src/Dropdown.tsx
+++ b/packages/react/src/Dropdown.tsx
@@ -15,7 +15,6 @@ import { cloneElement, forwardRef } from "react";
import { LuCheck, LuChevronRight } from "react-icons/lu";
import { ActionPresentationBoundary } from "./ActionPresentation";
import { BottomSheetTrigger } from "./BottomSheet";
-import { useCompact } from "./Compact";
import {
compactPart,
MenuSheetCheckboxItem,
@@ -36,6 +35,7 @@ import { ShortcutKey } from "./ShortcutKey";
import type { MenuItemShortcut } from "./shortcuts";
import { cn } from "./utils/cn";
import { withMenuShortcuts } from "./utils/menuShortcut";
+import { useViewport } from "./Viewport";
const DesktopDropdownMenuSubTrigger = forwardRef<
ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,
@@ -111,7 +111,7 @@ export interface DropdownMenuIconProps extends ComponentPropsWithoutRef<"svg"> {
const DropdownMenuIcon = forwardRef<ElementRef<"span">, DropdownMenuIconProps>(
({ className, icon, children, ...props }, ref) => {
return cloneElement(icon, {
- className: cn("mr-2 h-4 w-4 compact:mr-0 compact:size-5", className),
+ className: cn("mr-2 h-4 w-4 max-md:mr-0 max-md:size-5", className),
...props
});
}
@@ -264,7 +264,7 @@ DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
const DropdownMenu = (
props: ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Root>
) =>
- useCompact() ? (
+ useViewport().isPhone ? (
<MenuSheetRoot {...props} />
) : (
<DropdownMenuPrimitive.Root {...props} />
@@ -282,7 +282,7 @@ const DropdownMenuGroup = compactPart(
const DropdownMenuPortal = (
props: ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Portal>
) =>
- useCompact() ? (
+ useViewport().isPhone ? (
<MenuSheetPortal {...props} />
) : (
<DropdownMenuPrimitive.Portal {...props} />
@@ -290,7 +290,7 @@ const DropdownMenuPortal = (
const DropdownMenuSub = (
props: ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Sub>
) =>
- useCompact() ? (
+ useViewport().isPhone ? (
<MenuSheetSub {...props} />
) : (
<DropdownMenuPrimitive.Sub {...props} />
diff --git a/packages/react/src/Editor/Editor.tsx b/packages/react/src/Editor/Editor.tsx
index 6946ba2266..a25732de39 100644
--- a/packages/react/src/Editor/Editor.tsx
+++ b/packages/react/src/Editor/Editor.tsx
@@ -28,9 +28,9 @@ import { useLingui } from "@lingui/react/macro";
import TextStyle from "@tiptap/extension-text-style";
import { lazy, Suspense, useEffect, useMemo, useRef, useState } from "react";
import { toast } from "sonner";
-import { useCompact } from "../Compact";
import { Separator } from "../Separator";
import { cn } from "../utils/cn";
+import { useViewport } from "../Viewport";
import { ColorSelector } from "./components/ColorSelector";
import { LinkSelector } from "./components/LinkSelector";
import { Toolbar } from "./components/Toolbar";
@@ -121,7 +121,7 @@ const Editor = ({
title
}: EditorProp) => {
const { t } = useLingui();
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
const titleMode = !!title;
const titlePlaceholder = title?.placeholder ?? "Untitled";
// The editor reads its extensions only once on mount, so the placeholder
@@ -133,7 +133,7 @@ const Editor = ({
const level = node.attrs.level;
return t`Heading ${level}`;
}
- return isCompact ? t`Write a note…` : t`Press '/' for commands`;
+ return isPhone ? t`Write a note…` : t`Press '/' for commands`;
};
const [openNode, setOpenNode] = useState(false);
const [openColor, setOpenColor] = useState(false);
@@ -301,7 +301,7 @@ const Editor = ({
"prose dark:prose-invert focus:outline-none max-w-full",
// Flush toolbar: pad the content, not the toolbar, and leave a
// gap below the sticky toolbar.
- titleMode && "px-8 pt-6 pb-24 compact:px-4"
+ titleMode && "px-8 pt-6 pb-24 max-md:px-4"
)
}
}}
diff --git a/packages/react/src/Editor/components/Toolbar.tsx b/packages/react/src/Editor/components/Toolbar.tsx
index b9206de55a..5259b58680 100644
--- a/packages/react/src/Editor/components/Toolbar.tsx
+++ b/packages/react/src/Editor/components/Toolbar.tsx
@@ -34,7 +34,7 @@ export const Toolbar = ({ className }: { className?: string }) => {
className={cn(
"sticky top-0 z-10 flex w-full flex-wrap items-center gap-1 border-b border-border bg-card p-2",
// Phones: one scrolling row instead of wrapping onto several.
- "compact:flex-nowrap compact:overflow-x-auto compact:scrollbar-hide compact:scroll-fade-x compact:[&>*]:shrink-0",
+ "max-md:flex-nowrap max-md:overflow-x-auto max-md:scrollbar-hide max-md:scroll-fade-x max-md:[&>*]:shrink-0",
className
)}
>
diff --git a/packages/react/src/Form/FormLabel.tsx b/packages/react/src/Form/FormLabel.tsx
index efc74b776d..2a76a070e2 100644
--- a/packages/react/src/Form/FormLabel.tsx
+++ b/packages/react/src/Form/FormLabel.tsx
@@ -33,7 +33,7 @@ export const FormLabel = forwardRef<
<label
{...labelProps}
ref={ref}
- className="flex items-center justify-between compact:gap-2"
+ className="flex items-center justify-between max-md:gap-2"
// {...props}
>
<span
@@ -42,9 +42,9 @@ export const FormLabel = forwardRef<
{children}
</span>
{(isOptional || onConfigure) && (
- <div className="flex items-center gap-1 compact:gap-2">
+ <div className="flex items-center gap-1 max-md:gap-2">
{isOptional && (
- <span className="text-muted-foreground text-xxs compact:text-xs">
+ <span className="text-muted-foreground text-xxs max-md:text-xs">
<Trans>Optional</Trans>
</span>
)}
diff --git a/packages/react/src/FunnelChart.tsx b/packages/react/src/FunnelChart.tsx
index 2b72f71132..e349d3b686 100644
--- a/packages/react/src/FunnelChart.tsx
+++ b/packages/react/src/FunnelChart.tsx
@@ -9,8 +9,8 @@ import { Area } from "@visx/shape";
import { Text } from "@visx/text";
import { motion } from "motion/react";
import { Fragment, useMemo, useRef, useState } from "react";
-import { useIsMobile } from "./hooks";
import { cn } from "./utils/cn";
+import { useViewport } from "./Viewport";
interface FunnelStep {
id: string;
@@ -77,7 +77,7 @@ function FunnelChartContent({
numberFormatter,
defaultTooltipStepId
}: FunnelChartContentProps) {
- const isMobile = useIsMobile();
+ const { isPhone: isMobile } = useViewport();
const [activeTooltip, setActiveTooltip] = useState<string | null>(
defaultTooltipStepId ?? null
diff --git a/packages/react/src/HoverCard.tsx b/packages/react/src/HoverCard.tsx
index 4cd57e6c5e..9a40223dc5 100644
--- a/packages/react/src/HoverCard.tsx
+++ b/packages/react/src/HoverCard.tsx
@@ -10,9 +10,9 @@ import type { ComponentPropsWithoutRef, ElementRef } from "react";
import { forwardRef } from "react";
import { ActionPresentationBoundary } from "./ActionPresentation";
import { BottomSheet, BottomSheetTrigger } from "./BottomSheet";
-import { useCompact } from "./Compact";
import { PopupSheetContent } from "./PopupSheet";
import { cn } from "./utils/cn";
+import { useViewport } from "./Viewport";
/*
* Phones cannot hover: there a hover card is a real bottom sheet (a Radix
@@ -25,8 +25,8 @@ const HoverCard = ({
children,
...props
}: ComponentPropsWithoutRef<typeof HoverCardPrimitive.Root>) => {
- const isCompact = useCompact();
- return isCompact ? (
+ const { isPhone } = useViewport();
+ return isPhone ? (
<BottomSheet
open={open}
defaultOpen={defaultOpen}
@@ -50,8 +50,8 @@ const HoverCardTrigger = forwardRef<
ElementRef<typeof HoverCardPrimitive.Trigger>,
ComponentPropsWithoutRef<typeof HoverCardPrimitive.Trigger>
>(({ asChild, ...props }, ref) => {
- const isCompact = useCompact();
- if (!isCompact) {
+ const { isPhone } = useViewport();
+ if (!isPhone) {
return (
<HoverCardPrimitive.Trigger ref={ref} asChild={asChild} {...props} />
);
@@ -81,8 +81,8 @@ const HoverCardContent = forwardRef<
{ className, align = "center", sideOffset = 4, children, ...props },
ref
) => {
- const isCompact = useCompact();
- if (isCompact) {
+ const { isPhone } = useViewport();
+ if (isPhone) {
return (
<PopupSheetContent
ref={ref}
diff --git a/packages/react/src/Input.tsx b/packages/react/src/Input.tsx
index fad9e7e722..9123a6cfea 100644
--- a/packages/react/src/Input.tsx
+++ b/packages/react/src/Input.tsx
@@ -19,9 +19,9 @@ const inputGroupVariants = cva(
variants: {
size: {
lg: "h-12 rounded-lg",
- md: "h-10 rounded-md compact:h-11",
- sm: "h-8 rounded-md compact:h-11",
- xs: "h-6 rounded compact:h-11"
+ md: "h-10 rounded-md max-md:h-11",
+ sm: "h-8 rounded-md max-md:h-11",
+ xs: "h-6 rounded max-md:h-11"
},
isDisabled: {
true: "opacity-50 disabled:cursor-not-allowed",
@@ -115,9 +115,9 @@ export const inputVariants = cva(
variants: {
size: {
lg: "h-12 rounded-lg px-4 text-base",
- md: "h-10 rounded-md px-4 text-sm compact:h-11 compact:text-base",
- sm: "h-8 rounded-md px-3 text-sm compact:h-11 compact:text-base",
- xs: "h-6 rounded px-2 text-sm compact:h-11 compact:text-base"
+ md: "h-10 rounded-md px-4 text-sm max-md:h-11 max-md:text-base",
+ sm: "h-8 rounded-md px-3 text-sm max-md:h-11 max-md:text-base",
+ xs: "h-6 rounded px-2 text-sm max-md:h-11 max-md:text-base"
},
isInputGroup: {
true: "h-auto outline-none focus-within:outline-none",
@@ -244,9 +244,9 @@ const inputAddonVariants = cva(
},
size: {
lg: "h-12 px-3",
- md: "h-10 px-3 compact:h-11",
- sm: "h-8 px-2 compact:h-11",
- xs: "h-6 px-1 compact:h-11"
+ md: "h-10 px-3 max-md:h-11",
+ sm: "h-8 px-2 max-md:h-11",
+ xs: "h-6 px-1 max-md:h-11"
},
isDisabled: {
true: "opacity-50 cursor-not-allowed bg-muted text-muted-foreground",
@@ -354,9 +354,9 @@ const inputElementVariants = cva(
variants: {
size: {
lg: "h-12",
- md: "h-10 compact:h-11",
- sm: "h-8 compact:h-11",
- xs: "h-6 compact:h-11"
+ md: "h-10 max-md:h-11",
+ sm: "h-8 max-md:h-11",
+ xs: "h-6 max-md:h-11"
},
placement: {
left: "pl-2",
diff --git a/packages/react/src/LabelWithHelp.tsx b/packages/react/src/LabelWithHelp.tsx
index 7727ecc90f..37902f4f6c 100644
--- a/packages/react/src/LabelWithHelp.tsx
+++ b/packages/react/src/LabelWithHelp.tsx
@@ -65,7 +65,7 @@ export function LabelWithHelp({
// the hover ring overhangs harmlessly and the icon stays in line.
isInline ? "h-4 w-4" : "h-5 w-5 -my-0.5",
// Tap target on phones: an invisible 44px hit area around the icon.
- "compact:hit-area"
+ "max-md:hit-area"
)}
>
<LuInfo
diff --git a/packages/react/src/MenuSheet.tsx b/packages/react/src/MenuSheet.tsx
index e33bba5d5e..df1ce8a887 100644
--- a/packages/react/src/MenuSheet.tsx
+++ b/packages/react/src/MenuSheet.tsx
@@ -30,9 +30,9 @@ import {
BottomSheetHeader,
BottomSheetTitle
} from "./BottomSheet";
-import { useCompact } from "./Compact";
import type { PopperPositionProps } from "./PopupSheet";
import { cn } from "./utils/cn";
+import { useViewport } from "./Viewport";
/*
* Phones: a dropdown or context menu shown as a real bottom sheet (a Radix
@@ -444,7 +444,7 @@ export function compactPart<T extends ElementType>(
) {
const Part = forwardRef<ElementRef<T>, ComponentPropsWithoutRef<T>>(
(props, ref) => {
- const Comp: ElementType = useCompact() ? Phone : Desktop;
+ const Comp: ElementType = useViewport().isPhone ? Phone : Desktop;
return <Comp ref={ref} {...props} />;
}
);
diff --git a/packages/react/src/Menubar.tsx b/packages/react/src/Menubar.tsx
index 75eacfbd93..85d08ae195 100644
--- a/packages/react/src/Menubar.tsx
+++ b/packages/react/src/Menubar.tsx
@@ -16,7 +16,7 @@ const Menubar = forwardRef<HTMLDivElement, ComponentProps<"div">>(
className={cn(
"min-h-[2.5rem] flex items-center bg-card border border-border rounded-lg justify-start p-1 w-full space-x-1 scrollbar-hide dark:border-none dark:shadow-[inset_0_0.5px_0_rgb(255_255_255_/_0.08),_inset_0_0_1px_rgb(255_255_255_/_0.24),_0_0_0_0.5px_rgb(0,0,0,1),0px_0px_4px_rgba(0,_0,_0,_0.08)]",
// Phones: the bar scrolls sideways (with a fade) instead of clipping.
- "compact:overflow-x-auto compact:scroll-fade-x compact:[&>*]:shrink-0",
+ "max-md:overflow-x-auto max-md:scroll-fade-x max-md:[&>*]:shrink-0",
className
)}
>
diff --git a/packages/react/src/Modal.tsx b/packages/react/src/Modal.tsx
index 23235c6286..1b4a2c7ec8 100644
--- a/packages/react/src/Modal.tsx
+++ b/packages/react/src/Modal.tsx
@@ -18,8 +18,8 @@ import { createContext, forwardRef, useContext } from "react";
import { LuX } from "react-icons/lu";
import { ActionPresentationBoundary } from "./ActionPresentation";
import { ClientOnly } from "./ClientOnly";
-import { useCompact } from "./Compact";
import { cn } from "./utils/cn";
+import { useViewport } from "./Viewport";
// A dialog held open with no `onOpenChange` cannot be closed by the X, Escape
// or a click outside, so it does not offer the X. Leave `onOpenChange` off to
@@ -59,7 +59,7 @@ const ModalOverlay = forwardRef<
"bg-alternative/90",
"z-50 fixed inset-0 grid place-items-center overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=closed]:animate-out data-[state=closed]:fade-out-0",
// Phones: a bottom sheet over a dimmed screen.
- "compact:place-items-end compact:overflow-hidden compact:bg-black/40",
+ "max-md:place-items-end max-md:overflow-hidden max-md:bg-black/40",
className
)}
@@ -116,7 +116,7 @@ const ModalContentVariants = cva(
"data-[state=open]:slide-in-from-left-[0%] data-[state=open]:slide-in-from-top-[0%]",
"sm:rounded-2xl md:w-full",
"bg-card focus-visible:outline-none focus-visible:ring-0",
- "compact:max-h-[88dvh] compact:max-w-none compact:rounded-t-[14px] compact:rounded-b-none compact:border-0 compact:pt-5 compact:pb-safe compact:data-[state=open]:slide-in-from-bottom-4",
+ "max-md:max-h-[88dvh] max-md:max-w-none max-md:rounded-t-[14px] max-md:rounded-b-none max-md:border-0 max-md:pt-5 max-md:pb-safe max-md:data-[state=open]:slide-in-from-bottom-4",
"dark:shadow-[inset_0_0.5px_0_rgb(255_255_255_/_0.08),_inset_0_0_1px_rgb(255_255_255_/_0.24),_0_0_0_0.5px_rgb(0,0,0,1),0px_0px_4px_rgba(0,_0,_0,_0.08)]"
),
{
@@ -156,7 +156,7 @@ const ModalContent = forwardRef<
ref
) => {
const dismissable = useDialogDismissable();
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
return (
<ClientOnly fallback={null}>
{() => (
@@ -168,14 +168,14 @@ const ModalContent = forwardRef<
onOpenAutoFocus={(event) => {
// Phones: focusing the first field pops the keyboard over
// the sheet before the user has done anything.
- if (isCompact) event.preventDefault();
+ if (isPhone) event.preventDefault();
onOpenAutoFocus?.(event);
if (!event.defaultPrevented) focusPrimaryAction(event);
}}
{...props}
>
{/* Phones: the same grabber as a drawer sheet. */}
- {isCompact && (
+ {isPhone && (
<div
aria-hidden
className="absolute left-1/2 top-1.5 h-[5px] w-9 -translate-x-1/2 rounded-full bg-muted-foreground/20"
@@ -187,7 +187,7 @@ const ModalContent = forwardRef<
{withCloseButton && dismissable && (
<DialogPrimitive.Close
type="button"
- className="absolute right-4 top-4 rounded-full opacity-70 transition-opacity hover:opacity-100 outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-foreground-muted p-3 hover:bg-accent/80 compact:right-1 compact:top-1 compact:flex compact:size-11 compact:items-center compact:justify-center compact:p-0"
+ className="absolute right-4 top-4 rounded-full opacity-70 transition-opacity hover:opacity-100 outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-foreground-muted p-3 hover:bg-accent/80 max-md:right-1 max-md:top-1 max-md:flex max-md:size-11 max-md:items-center max-md:justify-center max-md:p-0"
>
<LuX className="h-4 w-4" />
<span className="sr-only">Close</span>
@@ -210,7 +210,7 @@ const ModalHeader = ({
<div
className={cn(
"flex flex-col shrink-0 space-y-1.5 text-center sm:text-left mb-4 px-6",
- "compact:mb-3 compact:px-4 compact:pr-14 compact:text-left",
+ "max-md:mb-3 max-md:px-4 max-md:pr-14 max-md:text-left",
className
)}
{...props}
@@ -224,7 +224,7 @@ const ModalBody = ({ className, ...props }: HTMLAttributes<HTMLDivElement>) => (
// py-1 keeps the 3px focus ring of the first/last field inside the
// scroll clip; -mt-1/mb-3 cancel it so the layout is unchanged.
"relative w-full min-h-0 overflow-y-auto -mt-1 py-1 px-6 mb-3",
- "compact:px-4",
+ "max-md:px-4",
"scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent",
className
)}
@@ -241,7 +241,7 @@ ModalBody.displayName = "ModalBody";
* Shared by ModalFooter and DrawerFooter.
*/
export const compactFooterClassName =
- "compact:sticky compact:bottom-0 compact:flex-row compact:px-4 compact:[&>*]:flex-1 compact:[&>div]:flex compact:[&>div]:w-full compact:[&>div]:gap-2 compact:[&>div>*]:flex-1 compact:[&>div>*]:mx-0 compact:[&_button]:h-11 compact:[&_[type=submit]]:order-last";
+ "max-md:sticky max-md:bottom-0 max-md:flex-row max-md:px-4 max-md:[&>*]:flex-1 max-md:[&>div]:flex max-md:[&>div]:w-full max-md:[&>div]:gap-2 max-md:[&>div>*]:flex-1 max-md:[&>div>*]:mx-0 max-md:[&_button]:h-11 max-md:[&_[type=submit]]:order-last";
const ModalFooter = ({
className,
@@ -257,7 +257,7 @@ const ModalFooter = ({
className={cn(
"flex flex-col-reverse shrink-0 sm:flex-row sm:justify-end gap-2 px-6 py-3 border-t border-border bg-muted/40 sm:rounded-b-2xl",
compactFooterClassName,
- "compact:rounded-none compact:bg-card compact:pb-3",
+ "max-md:rounded-none max-md:bg-card max-md:pb-3",
className
)}
{...props}
diff --git a/packages/react/src/NavRail.tsx b/packages/react/src/NavRail.tsx
index bd46249244..bf24c7f40e 100644
--- a/packages/react/src/NavRail.tsx
+++ b/packages/react/src/NavRail.tsx
@@ -345,7 +345,7 @@ export const NavRailItem = forwardRef<HTMLButtonElement, NavRailItemProps>(
className={cn(
"absolute left-7 right-3 min-w-32 group-data-[state=expanded]:left-12",
"flex items-center gap-2",
- "opacity-0 group-data-[state=expanded]:opacity-100 compact:opacity-100"
+ "opacity-0 group-data-[state=expanded]:opacity-100 max-md:opacity-100"
)}
>
<span
@@ -434,7 +434,7 @@ export function NavRailBrand({
</span>
<span
aria-hidden
- className="min-w-0 flex-1 truncate opacity-0 transition-opacity duration-200 group-data-[state=expanded]:opacity-100 compact:opacity-100"
+ className="min-w-0 flex-1 truncate opacity-0 transition-opacity duration-200 group-data-[state=expanded]:opacity-100 max-md:opacity-100"
>
{label}
</span>
@@ -457,7 +457,7 @@ export function NavRailGroup({
aria-hidden
className="absolute inset-x-0 top-1/2 mx-auto h-px w-6 bg-border opacity-100 transition-opacity duration-200 group-data-[state=expanded]:opacity-0"
/>
- <span className="absolute inset-0 flex items-center px-2 text-[11px] font-medium uppercase tracking-wider text-foreground/50 whitespace-nowrap opacity-0 transition-opacity duration-200 group-data-[state=expanded]:opacity-100 compact:opacity-100">
+ <span className="absolute inset-0 flex items-center px-2 text-[11px] font-medium uppercase tracking-wider text-foreground/50 whitespace-nowrap opacity-0 transition-opacity duration-200 group-data-[state=expanded]:opacity-100 max-md:opacity-100">
{label}
</span>
</div>
diff --git a/packages/react/src/Number.tsx b/packages/react/src/Number.tsx
index 1b726f84c1..5a17a95f2e 100644
--- a/packages/react/src/Number.tsx
+++ b/packages/react/src/Number.tsx
@@ -83,7 +83,7 @@ const NumberInputStepper = ({
className={cn(
"absolute right-0 top-0 z-10 m-px flex h-[calc(100%-2px)] w-6 flex-col",
// Phones: − and + side by side, each a 44pt target.
- "compact:w-[88px] compact:flex-row-reverse",
+ "max-md:w-[88px] max-md:flex-row-reverse",
className
)}
{...props}
@@ -99,7 +99,7 @@ const NumberInput = forwardRef<HTMLInputElement, InputProps>(
isReadOnly={isDisabled || isReadOnly}
isDisabled={isDisabled}
className={cn(
- "pr-6 compact:[&:has(~[data-number-stepper])]:pr-[92px]",
+ "pr-6 max-md:[&:has(~[data-number-stepper])]:pr-[92px]",
className
)}
onFocus={(e) => {
@@ -123,7 +123,7 @@ const NumberIncrementStepper = ({
slot="increment"
className={cn(
[
- "flex flex-1 select-none items-center justify-center rounded-tr-md border-l border-border leading-none text-foreground transition-colors duration-100 compact:rounded-none compact:rounded-r-md compact:hit-area",
+ "flex flex-1 select-none items-center justify-center rounded-tr-md border-l border-border leading-none text-foreground transition-colors duration-100 max-md:rounded-none max-md:rounded-r-md max-md:hit-area",
// Pressed
"pressed:bg-slate-100 dark:pressed:bg-slate-700",
// Disabled
@@ -145,7 +145,7 @@ const NumberDecrementStepper = ({
slot="decrement"
className={cn(
[
- "flex flex-1 select-none items-center justify-center rounded-br-md border-l border-t border-border leading-none text-foreground transition-colors duration-100 compact:rounded-none compact:border-t-0 compact:hit-area",
+ "flex flex-1 select-none items-center justify-center rounded-br-md border-l border-t border-border leading-none text-foreground transition-colors duration-100 max-md:rounded-none max-md:border-t-0 max-md:hit-area",
// Pressed
"pressed:bg-slate-100 dark:pressed:bg-slate-700",
// Disabled
diff --git a/packages/react/src/PickerList.tsx b/packages/react/src/PickerList.tsx
index be3ec21edf..deec4580da 100644
--- a/packages/react/src/PickerList.tsx
+++ b/packages/react/src/PickerList.tsx
@@ -16,10 +16,10 @@ import {
CommandInput,
CommandItem
} from "./Command";
-import { useCompact } from "./Compact";
import { TruncatedTooltipText } from "./TruncatedTooltipText";
import { cn } from "./utils/cn";
import { reactNodeToString } from "./utils/react";
+import { useViewport } from "./Viewport";
export type PickerListOption = {
label: string | JSX.Element;
@@ -97,8 +97,8 @@ const preventAutoFocus = (event: Event) => event.preventDefault();
export function usePickerOpenAutoFocus(
optionCount: number
): ((event: Event) => void) | undefined {
- const isCompact = useCompact();
- return isCompact && optionCount <= SEARCH_AUTOFOCUS_MIN_OPTIONS
+ const { isPhone } = useViewport();
+ return isPhone && optionCount <= SEARCH_AUTOFOCUS_MIN_OPTIONS
? preventAutoFocus
: undefined;
}
@@ -131,8 +131,8 @@ function PickerList({
showCreateOptionOnEmpty = false
}: PickerListProps) {
const { t } = useLingui();
- const isCompact = useCompact();
- const itemHeight = isCompact ? COMPACT_ITEM_HEIGHT : itemHeightProp;
+ const { isPhone } = useViewport();
+ const itemHeight = isPhone ? COMPACT_ITEM_HEIGHT : itemHeightProp;
const [ownSearch, setOwnSearch] = useState("");
const search = searchProp ?? ownSearch;
const setSearch = onSearchChange ?? setOwnSearch;
@@ -175,13 +175,11 @@ function PickerList({
isCreatableSingle
? "overflow-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent"
: "overflow-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent pt-1",
- "compact:max-h-[calc(88dvh-120px)]"
+ "max-md:max-h-[calc(88dvh-120px)]"
);
const scrollerStyle = {
height: `${
- (
- isCompact ? filteredOptions.length : Math.min(filteredOptions.length, 6)
- ) *
+ (isPhone ? filteredOptions.length : Math.min(filteredOptions.length, 6)) *
itemHeight +
4
}px`
@@ -203,7 +201,7 @@ function PickerList({
.join(" - ");
const checked =
isChecked(item, itemValue) ||
- (isCompact &&
+ (isPhone &&
selectionMode === "single" &&
value !== undefined &&
item.value === value);
@@ -245,7 +243,7 @@ function PickerList({
<TruncatedTooltipText
className="block w-full truncate"
tooltip={itemHoverText}
- enabled={!isCompact}
+ enabled={!isPhone}
>
{item.label}
</TruncatedTooltipText>
@@ -253,7 +251,7 @@ function PickerList({
<TruncatedTooltipText
className="truncate flex-1"
tooltip={itemHoverText}
- enabled={!isCompact}
+ enabled={!isPhone}
>
{item.helper}
</TruncatedTooltipText>
@@ -266,7 +264,7 @@ function PickerList({
<TruncatedTooltipText
className="truncate flex-1"
tooltip={itemHoverText}
- enabled={!isCompact}
+ enabled={!isPhone}
>
{item.label}
</TruncatedTooltipText>
@@ -300,14 +298,14 @@ function PickerList({
<TruncatedTooltipText
className="block w-full truncate"
tooltip={itemHoverText}
- enabled={!isCompact}
+ enabled={!isPhone}
>
{item.label}
</TruncatedTooltipText>
<TruncatedTooltipText
className="text-xs text-muted-foreground truncate"
tooltip={itemHoverText}
- enabled={!isCompact}
+ enabled={!isPhone}
>
{item.helper}
</TruncatedTooltipText>
@@ -316,7 +314,7 @@ function PickerList({
<TruncatedTooltipText
className="truncate flex-1"
tooltip={itemHoverText}
- enabled={!isCompact}
+ enabled={!isPhone}
>
{item.label}
</TruncatedTooltipText>
@@ -357,7 +355,7 @@ function PickerList({
value={search}
onValueChange={setSearch}
placeholder={t`Search...`}
- className="h-9 compact:h-11 compact:text-base"
+ className="h-9 max-md:h-11 max-md:text-base"
/>
{isCreatableSingle ? (
<CommandGroup>
diff --git a/packages/react/src/Popover.tsx b/packages/react/src/Popover.tsx
index af231677e7..564a57611e 100644
--- a/packages/react/src/Popover.tsx
+++ b/packages/react/src/Popover.tsx
@@ -14,9 +14,9 @@ import {
BottomSheetClose,
BottomSheetTrigger
} from "./BottomSheet";
-import { useCompact } from "./Compact";
import { PopupSheetContent } from "./PopupSheet";
import { cn } from "./utils/cn";
+import { useViewport } from "./Viewport";
/*
* Phones show a popover as a real bottom sheet (a Radix Dialog): each part
@@ -29,8 +29,8 @@ const Popover = ({
modal,
children
}: ComponentPropsWithoutRef<typeof PopoverPrimitive.Root>) => {
- const isCompact = useCompact();
- return isCompact ? (
+ const { isPhone } = useViewport();
+ return isPhone ? (
<BottomSheet
open={open}
defaultOpen={defaultOpen}
@@ -54,8 +54,8 @@ const PopoverTrigger = forwardRef<
ElementRef<typeof PopoverPrimitive.Trigger>,
ComponentPropsWithoutRef<typeof PopoverPrimitive.Trigger>
>((props, ref) => {
- const isCompact = useCompact();
- return isCompact ? (
+ const { isPhone } = useViewport();
+ return isPhone ? (
<BottomSheetTrigger ref={ref} {...props} />
) : (
<PopoverPrimitive.Trigger ref={ref} {...props} />
@@ -68,8 +68,8 @@ const PopoverAnchor = forwardRef<
ElementRef<typeof PopoverPrimitive.Anchor>,
ComponentPropsWithoutRef<typeof PopoverPrimitive.Anchor>
>(({ asChild, ...props }, ref) => {
- const isCompact = useCompact();
- if (!isCompact) {
+ const { isPhone } = useViewport();
+ if (!isPhone) {
return <PopoverPrimitive.Anchor ref={ref} asChild={asChild} {...props} />;
}
const Comp = asChild ? Slot : "div";
@@ -85,8 +85,8 @@ const PopoverContent = forwardRef<
{ className, align = "center", sideOffset = 4, children, ...props },
ref
) => {
- const isCompact = useCompact();
- if (isCompact) {
+ const { isPhone } = useViewport();
+ if (isPhone) {
return (
<PopupSheetContent
ref={ref}
@@ -152,8 +152,8 @@ const PopoverClose = forwardRef<
ElementRef<typeof PopoverPrimitive.Close>,
ComponentPropsWithoutRef<typeof PopoverPrimitive.Close>
>((props, ref) => {
- const isCompact = useCompact();
- return isCompact ? (
+ const { isPhone } = useViewport();
+ return isPhone ? (
<BottomSheetClose ref={ref} {...props} />
) : (
<PopoverPrimitive.Close ref={ref} {...props} />
diff --git a/packages/react/src/Radio.tsx b/packages/react/src/Radio.tsx
index f8f09d46c8..4b79d1a222 100644
--- a/packages/react/src/Radio.tsx
+++ b/packages/react/src/Radio.tsx
@@ -36,7 +36,7 @@ const RadioGroupItem = forwardRef<
className={cn(
"aspect-square size-4 shrink-0 rounded-full border-2 border-muted-foreground/50 shadow-xs transition-[color,box-shadow,border-color] outline-none hover:border-primary focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=checked]:border-primary data-[state=checked]:text-primary dark:bg-input/30 dark:aria-invalid:ring-destructive/40 dark:data-[state=checked]:bg-primary dark:data-[state=checked]:text-primary-foreground",
// Phones: a 44x44 hit area around the visual dot.
- "compact:hit-area",
+ "max-md:hit-area",
className
)}
{...props}
diff --git a/packages/react/src/Resizable.tsx b/packages/react/src/Resizable.tsx
index 30d114b432..abbee38219 100644
--- a/packages/react/src/Resizable.tsx
+++ b/packages/react/src/Resizable.tsx
@@ -9,8 +9,8 @@ import { LuGripVertical } from "react-icons/lu";
import type { ImperativePanelHandle } from "react-resizable-panels";
import * as ResizablePrimitive from "react-resizable-panels";
import { ClientOnly } from "./ClientOnly";
-import { useCompact } from "./Compact";
import { cn } from "./utils/cn";
+import { useViewport } from "./Viewport";
/** True inside a group that `stackOnCompact` turned into plain blocks. */
const StackedContext = createContext(false);
@@ -27,9 +27,9 @@ const ResizablePanelGroup = ({
*/
stackOnCompact?: boolean;
}) => {
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
- if (stackOnCompact && isCompact) {
+ if (stackOnCompact && isPhone) {
return (
<StackedContext.Provider value={true}>
<div
diff --git a/packages/react/src/RichText/Toolbar/Toolbar.tsx b/packages/react/src/RichText/Toolbar/Toolbar.tsx
index 95fe97c1e0..63d47caa85 100644
--- a/packages/react/src/RichText/Toolbar/Toolbar.tsx
+++ b/packages/react/src/RichText/Toolbar/Toolbar.tsx
@@ -20,7 +20,7 @@ const Toolbar: EditorComponent = ({ editor }) => {
return (
<TooltipProvider>
<div className="w-full border-b border-border p-2">
- <div className="flex flex-wrap gap-2 compact:flex-nowrap compact:overflow-x-auto compact:scrollbar-hide compact:scroll-fade-x compact:[&>*]:shrink-0">
+ <div className="flex flex-wrap gap-2 max-md:flex-nowrap max-md:overflow-x-auto max-md:scrollbar-hide max-md:scroll-fade-x max-md:[&>*]:shrink-0">
<Paragraph editor={editor} />
<HeadingOne editor={editor} />
<HeadingTwo editor={editor} />
diff --git a/packages/react/src/Select.tsx b/packages/react/src/Select.tsx
index 71efec347d..87cc6cef23 100644
--- a/packages/react/src/Select.tsx
+++ b/packages/react/src/Select.tsx
@@ -15,8 +15,6 @@ import {
LuChevronsUpDown,
LuChevronUp
} from "react-icons/lu";
-
-import { useCompact } from "./Compact";
import { compactPart } from "./MenuSheet";
import {
SelectSheetContent,
@@ -29,6 +27,7 @@ import {
SelectSheetValue
} from "./SelectSheet";
import { cn } from "./utils/cn";
+import { useViewport } from "./Viewport";
/*
* Phones render each part from SelectSheet (a bottom sheet) instead of Radix's
@@ -37,7 +36,7 @@ import { cn } from "./utils/cn";
const Select = (
props: ComponentPropsWithoutRef<typeof SelectPrimitive.Root>
) =>
- useCompact() ? (
+ useViewport().isPhone ? (
<SelectSheetRoot {...props} />
) : (
<SelectPrimitive.Root {...props} />
@@ -61,8 +60,8 @@ const selectTriggerVariants = cva(
variants: {
size: {
lg: "h-12 px-4 py-3 rounded-lg text-base space-x-4",
- md: "h-10 px-3 py-2 rounded-md text-sm space-x-3 compact:h-11 compact:text-base",
- sm: "h-8 px-3 py-2 rounded text-xs space-x-2 compact:h-11 compact:text-base"
+ md: "h-10 px-3 py-2 rounded-md text-sm space-x-3 max-md:h-11 max-md:text-base",
+ sm: "h-8 px-3 py-2 rounded text-xs space-x-2 max-md:h-11 max-md:text-base"
}
},
defaultVariants: {
@@ -82,8 +81,8 @@ const SelectTrigger = forwardRef<
ElementRef<typeof SelectPrimitive.Trigger>,
SelectTriggerProps
>(({ size, className, children, hideIcon, inline, ...props }, ref) => {
- const isCompact = useCompact();
- const Trigger = isCompact ? SelectSheetTrigger : SelectPrimitive.Trigger;
+ const { isPhone } = useViewport();
+ const Trigger = isPhone ? SelectSheetTrigger : SelectPrimitive.Trigger;
const icon = (
<LuChevronsUpDown className="h-4 w-4 flex-shrink-0 opacity-50" />
);
@@ -95,7 +94,7 @@ const SelectTrigger = forwardRef<
>
{children}
{!hideIcon && !inline ? (
- isCompact ? (
+ isPhone ? (
icon
) : (
<SelectPrimitive.Icon asChild>{icon}</SelectPrimitive.Icon>
diff --git a/packages/react/src/ShortcutKey.tsx b/packages/react/src/ShortcutKey.tsx
index e58331b8f4..77b996a11f 100644
--- a/packages/react/src/ShortcutKey.tsx
+++ b/packages/react/src/ShortcutKey.tsx
@@ -76,7 +76,7 @@ export const ShortcutKey = ({
className={cn(
shortcutKeyVariants[variant],
// Phones have no keyboard shortcuts to hint at.
- "compact:hidden",
+ "max-md:hidden",
className
)}
>
diff --git a/packages/react/src/Sidebar.tsx b/packages/react/src/Sidebar.tsx
index 283ecd073b..6aadc776cd 100644
--- a/packages/react/src/Sidebar.tsx
+++ b/packages/react/src/Sidebar.tsx
@@ -11,7 +11,6 @@ import * as React from "react";
import { LuPanelLeft } from "react-icons/lu";
import type { Button } from "./Button";
import { Drawer, DrawerContent } from "./Drawer";
-import { useIsMobile } from "./hooks";
import { useShortcutKeys } from "./hooks/useShortcutKeys";
import { IconButton } from "./IconButton";
import { Input } from "./Input";
@@ -25,6 +24,7 @@ import {
TooltipTrigger
} from "./Tooltip";
import { cn } from "./utils/cn";
+import { useViewport } from "./Viewport";
const SIDEBAR_COOKIE_NAME = "sidebar:state";
const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
@@ -81,7 +81,7 @@ const SidebarProvider = React.forwardRef<
},
ref
) => {
- const isMobile = useIsMobile();
+ const { isPhone: isMobile } = useViewport();
const [openMobile, setOpenMobile] = React.useState(false);
// This is the internal state of the sidebar.
diff --git a/packages/react/src/Switch.tsx b/packages/react/src/Switch.tsx
index 53971d9d87..c35e2140c2 100644
--- a/packages/react/src/Switch.tsx
+++ b/packages/react/src/Switch.tsx
@@ -43,7 +43,7 @@ const Switch = forwardRef<
className={cn(
"group flex items-center transition-colors focus-visible:outline-none",
// Phones: a 44x44 hit area around the visual switch.
- "compact:hit-area",
+ "max-md:hit-area",
container,
className
)}
diff --git a/packages/react/src/Table.tsx b/packages/react/src/Table.tsx
index 56609ae946..54982b283a 100644
--- a/packages/react/src/Table.tsx
+++ b/packages/react/src/Table.tsx
@@ -21,7 +21,7 @@ const Table = forwardRef<
</div>
) : (
<div className="rounded-md w-full overflow-hidden">
- <div className="relative w-full overflow-auto compact:scroll-fade-x">
+ <div className="relative w-full overflow-auto max-md:scroll-fade-x">
<table
ref={ref}
className={cn("w-full caption-bottom text-sm", className)}
diff --git a/packages/react/src/Tabs.tsx b/packages/react/src/Tabs.tsx
index ba4b9e75f1..17586f7218 100644
--- a/packages/react/src/Tabs.tsx
+++ b/packages/react/src/Tabs.tsx
@@ -24,7 +24,7 @@ const TabsList = forwardRef<
// them, and a border-b read as an extra pixel of bottom padding)
"inline-flex items-center justify-center rounded-[0.5rem] bg-muted p-1 text-muted-foreground border border-border",
// Phones: an underline tab row that scrolls sideways, inset 16pt.
- "compact:flex compact:w-full compact:justify-start compact:gap-5 compact:overflow-x-auto compact:scrollbar-hide compact:rounded-none compact:border-0 compact:border-b compact:bg-transparent compact:p-0 compact:px-4",
+ "max-md:flex max-md:w-full max-md:justify-start max-md:gap-5 max-md:overflow-x-auto max-md:scrollbar-hide max-md:rounded-none max-md:border-0 max-md:border-b max-md:bg-transparent max-md:p-0 max-md:px-4",
className
)}
{...props}
@@ -43,7 +43,7 @@ const TabsTrigger = forwardRef<
className={cn(
"inline-flex items-center justify-center whitespace-nowrap rounded-[6px] border border-transparent px-3 py-1 text-sm font-medium transition-[background-color,color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50",
"data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-button-base",
- "compact:min-h-11 compact:min-w-11 compact:shrink-0 compact:rounded-none compact:border-0 compact:border-b-2 compact:border-transparent compact:px-0 compact:text-[15px] compact:data-[state=active]:border-foreground compact:data-[state=active]:bg-transparent compact:data-[state=active]:shadow-none",
+ "max-md:min-h-11 max-md:min-w-11 max-md:shrink-0 max-md:rounded-none max-md:border-0 max-md:border-b-2 max-md:border-transparent max-md:px-0 max-md:text-[15px] max-md:data-[state=active]:border-foreground max-md:data-[state=active]:bg-transparent max-md:data-[state=active]:shadow-none",
className
)}
diff --git a/packages/react/src/Textarea.tsx b/packages/react/src/Textarea.tsx
index 71d6e4bdc9..ed0b6c1d02 100644
--- a/packages/react/src/Textarea.tsx
+++ b/packages/react/src/Textarea.tsx
@@ -13,8 +13,8 @@ const textareaVariants = cva(
{
variants: {
size: {
- sm: "rounded-md px-3 py-1 text-sm compact:text-base",
- md: "rounded-md px-3 py-2 text-sm compact:text-base",
+ sm: "rounded-md px-3 py-1 text-sm max-md:text-base",
+ md: "rounded-md px-3 py-2 text-sm max-md:text-base",
lg: "rounded-lg px-4 py-3 text-base"
}
},
diff --git a/packages/react/src/Tooltip.tsx b/packages/react/src/Tooltip.tsx
index 76c41b6964..3cdf946020 100644
--- a/packages/react/src/Tooltip.tsx
+++ b/packages/react/src/Tooltip.tsx
@@ -15,9 +15,8 @@ import {
useId,
useState
} from "react";
-
-import { useCompact } from "./Compact";
import { cn } from "./utils/cn";
+import { useViewport } from "./Viewport";
/**
* Base UI Tooltip wrapped to preserve the Radix-compatible API the codebase
@@ -100,8 +99,8 @@ const TapToggleRoot = ({
};
const TooltipRoot = (props: TooltipPrimitive.Root.Props) => {
- const isCompact = useCompact();
- return isCompact && props.open === undefined ? (
+ const { isPhone } = useViewport();
+ return isPhone && props.open === undefined ? (
<TapToggleRoot {...props} />
) : (
<TooltipPrimitive.Root {...props} />
@@ -214,9 +213,9 @@ const TooltipContent = forwardRef<HTMLDivElement, ContentProps>(
) => {
// Phones have no hover: a tooltip shows only when tapped open (see
// TapToggleRoot); controlled tooltips stay hidden.
- const isCompact = useCompact();
+ const { isPhone } = useViewport();
const tap = useContext(TapToggleContext);
- if (isCompact && !tap) return null;
+ if (isPhone && !tap) return null;
return (
<TooltipPrimitive.Portal
container={
@@ -240,7 +239,7 @@ const TooltipContent = forwardRef<HTMLDivElement, ContentProps>(
"origin-[var(--transform-origin)] transition-[transform,opacity] duration-150",
"data-[starting-style]:scale-95 data-[starting-style]:opacity-0",
"data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
- "compact:max-w-[calc(100vw-32px)] compact:text-[15px]",
+ "max-md:max-w-[calc(100vw-32px)] max-md:text-[15px]",
className
)}
{...props}
diff --git a/packages/react/src/Viewport.tsx b/packages/react/src/Viewport.tsx
index 95eea1843e..b2c4a48493 100644
--- a/packages/react/src/Viewport.tsx
+++ b/packages/react/src/Viewport.tsx
@@ -2,74 +2,85 @@
// Carbon (github.com/crbnos/carbon). Modified or adapted versions of this file,
// including ports, remain AGPLv3; serving them over a network requires releasing their source.
-import { COMPACT_QUERY, compactHintCookie } from "@carbon/utils";
+import type { Viewport } from "@carbon/utils";
+import { PHONE_QUERY, TABLET_QUERY, viewportHintCookie } from "@carbon/utils";
import type { ReactNode } from "react";
import {
createContext,
useContext,
useEffect,
+ useMemo,
useSyncExternalStore
} from "react";
-type CompactProviderProps = {
- /** Server hint (cookie or user agent), used until the media query is read. */
- initialCompact: boolean;
+type ViewportProviderProps = {
+ /** Server hint (cookie or user agent), used until the media queries are read. */
+ initialViewport: Viewport;
children: ReactNode;
};
+const Context = createContext<{ initialViewport: Viewport } | null>(null);
+
+const readViewport = (): Viewport => {
+ if (window.matchMedia(PHONE_QUERY).matches) return "phone";
+ if (window.matchMedia(TABLET_QUERY).matches) return "tablet";
+ return "desktop";
+};
+
+const subscribe = (onChange: () => void) => {
+ const queries = [PHONE_QUERY, TABLET_QUERY].map((q) => window.matchMedia(q));
+ for (const mql of queries) mql.addEventListener("change", onChange);
+ return () => {
+ for (const mql of queries) mql.removeEventListener("change", onChange);
+ };
+};
+
/**
- * Opts the app into the compact (phone) layout. The CSS half of the opt-in is
- * `data-compact-ui` on <html>; set both.
+ * Seeds `useViewport` with the server's hint so the first render matches the
+ * device, and records every size change in the hint cookie for the next request.
*/
-const Context = createContext<{ initialCompact: boolean } | null>(null);
-
-export const CompactProvider = ({
- initialCompact,
+export const ViewportProvider = ({
+ initialViewport,
children
-}: CompactProviderProps) => {
- // Record the viewport (and every breakpoint crossing) in the hint cookie, so
- // the next request renders the right layout on the server.
+}: ViewportProviderProps) => {
useEffect(() => {
- const mql = window.matchMedia(COMPACT_QUERY);
const write = () => {
- document.cookie = compactHintCookie(mql.matches);
+ document.cookie = viewportHintCookie(readViewport());
};
write();
- mql.addEventListener("change", write);
- return () => mql.removeEventListener("change", write);
+ return subscribe(write);
}, []);
return (
- <Context.Provider value={{ initialCompact }}>{children}</Context.Provider>
+ <Context.Provider value={{ initialViewport }}>{children}</Context.Provider>
);
};
-const subscribe = (onChange: () => void) => {
- const mql = window.matchMedia(COMPACT_QUERY);
- mql.addEventListener("change", onChange);
- return () => mql.removeEventListener("change", onChange);
-};
-
-const getSnapshot = () => window.matchMedia(COMPACT_QUERY).matches;
-
-/** Viewport below md, regardless of the compact opt-in. */
-export function useIsMobile(): boolean {
+/**
+ * The viewport size as three booleans, exactly one of them true. Use it only
+ * where the component tree must change; style-only changes use `max-md:`
+ * (phone) or `md:max-lg:` (tablet). Without a provider the server render is
+ * desktop.
+ */
+export function useViewport(): {
+ isPhone: boolean;
+ isTablet: boolean;
+ isDesktop: boolean;
+} {
const context = useContext(Context);
- return useSyncExternalStore(
+ const viewport = useSyncExternalStore(
subscribe,
- getSnapshot,
- () => context?.initialCompact ?? false
+ readViewport,
+ () => context?.initialViewport ?? "desktop"
+ );
+ return useMemo(
+ () => ({
+ isPhone: viewport === "phone",
+ isTablet: viewport === "tablet",
+ isDesktop: viewport === "desktop"
+ }),
+ [viewport]
);
-}
-
-/**
- * True when the app opted into the compact layout and the viewport is below
- * md. Use it only where the component tree must change; style-only changes
- * use the `compact:` variant. False without a provider.
- */
-export function useCompact(): boolean {
- const isMobile = useIsMobile();
- return useContext(Context) !== null && isMobile;
}
/**
@@ -80,6 +91,6 @@ export function useCompact(): boolean {
export const HitArea = () => (
<span
aria-hidden
- className="hidden compact:absolute compact:m-0 compact:block compact:-inset-[max(0px,calc((44px-100%)/2))]"
+ className="hidden max-md:absolute max-md:m-0 max-md:block max-md:-inset-[max(0px,calc((44px-100%)/2))]"
/>
);
diff --git a/packages/react/src/hooks/index.ts b/packages/react/src/hooks/index.ts
index a0ffffb8ff..2b70cbe594 100644
--- a/packages/react/src/hooks/index.ts
+++ b/packages/react/src/hooks/index.ts
@@ -11,7 +11,6 @@ import useHydrated from "./useHydrated";
import { useIdle } from "./useIdle";
import useInitialDimensions from "./useInitialDimenions";
import { useInterval } from "./useInterval";
-import useIsMobile from "./useIsMobile";
import { useIsomorphicLayoutEffect } from "./useIsomorphicLayoutEffect";
import { useKeyboardWedge } from "./useKeyboardWedge";
import useLocalStorage from "./useLocalStorage";
@@ -42,7 +41,6 @@ export {
useHydrated,
useInitialDimensions,
useInterval,
- useIsMobile,
useIsomorphicLayoutEffect,
useKeyboardWedge,
useLocalStorage,
diff --git a/packages/react/src/index.tsx b/packages/react/src/index.tsx
index c0a80709ec..ef315122c8 100644
--- a/packages/react/src/index.tsx
+++ b/packages/react/src/index.tsx
@@ -91,7 +91,6 @@ import {
CommandTrigger,
multiSelectTriggerVariants
} from "./Command";
-import { CompactProvider, useCompact } from "./Compact";
import {
ContextMenu,
ContextMenuCheckboxItem,
@@ -381,6 +380,7 @@ import { hasOpenDialog, isInsideTopmostDialog } from "./utils/dialog";
import { copyToClipboard } from "./utils/dom";
import { isEditableTarget } from "./utils/keyboard";
import { getValidChildren, reactNodeToString } from "./utils/react";
+import { useViewport, ViewportProvider } from "./Viewport";
import { VStack } from "./VStack";
export * from "./Acknowledge";
@@ -440,7 +440,7 @@ export {
CollapsibleContent,
CollapsibleTrigger,
Combobox,
- CompactProvider,
+ ViewportProvider,
filterComboboxOptions,
Command,
CommandDialog,
@@ -700,7 +700,7 @@ export {
shortcutKeyVariants,
toast,
useBotProtection,
- useCompact,
+ useViewport,
useModalCardType,
useModalDrawerType,
useOperatingSystem,
diff --git a/packages/utils/src/viewport.test.ts b/packages/utils/src/viewport.test.ts
index f55c8b7be6..7d01dd1a3f 100644
--- a/packages/utils/src/viewport.test.ts
+++ b/packages/utils/src/viewport.test.ts
@@ -3,10 +3,11 @@
// including ports, remain AGPLv3; serving them over a network requires releasing their source.
import { describe, expect, it } from "vitest";
+import type { Viewport } from "./viewport";
import {
- COMPACT_HINT_COOKIE,
- compactHintCookie,
- getCompactHint
+ getViewportHint,
+ VIEWPORT_HINT_COOKIE,
+ viewportHintCookie
} from "./viewport";
const IPHONE_UA =
@@ -18,47 +19,51 @@ function request(headers: Record<string, string>) {
return new Request("https://erp.example.com/x", { headers });
}
-describe("getCompactHint", () => {
- it("is compact when the cookie says 1", () => {
+describe("getViewportHint", () => {
+ it("trusts the cookie over the user agent", () => {
expect(
- getCompactHint(
+ getViewportHint(
request({
- cookie: `${COMPACT_HINT_COOKIE}=1`,
- "user-agent": MAC_CHROME_UA
+ cookie: `${VIEWPORT_HINT_COOKIE}=tablet`,
+ "user-agent": IPHONE_UA
})
)
- ).toBe(true);
+ ).toBe("tablet");
});
- it("is not compact when the cookie says 0", () => {
+ it("ignores an unknown cookie value", () => {
expect(
- getCompactHint(
- request({ cookie: `${COMPACT_HINT_COOKIE}=0`, "user-agent": IPHONE_UA })
+ getViewportHint(
+ request({
+ cookie: `${VIEWPORT_HINT_COOKIE}=1`,
+ "user-agent": IPHONE_UA
+ })
)
- ).toBe(false);
+ ).toBe("phone");
});
it("falls back to the Mobi token for a phone without the cookie", () => {
- expect(getCompactHint(request({ "user-agent": IPHONE_UA }))).toBe(true);
+ expect(getViewportHint(request({ "user-agent": IPHONE_UA }))).toBe("phone");
});
it("falls back to desktop for a desktop browser without the cookie", () => {
- expect(getCompactHint(request({ "user-agent": MAC_CHROME_UA }))).toBe(
- false
+ expect(getViewportHint(request({ "user-agent": MAC_CHROME_UA }))).toBe(
+ "desktop"
);
});
});
-describe("compactHintCookie", () => {
- it("writes the value getCompactHint reads back", () => {
- for (const isCompact of [true, false]) {
- const [cookie = ""] = compactHintCookie(isCompact).split(";");
- expect(getCompactHint(request({ cookie }))).toBe(isCompact);
+describe("viewportHintCookie", () => {
+ it("writes the value getViewportHint reads back", () => {
+ const viewports: Viewport[] = ["phone", "tablet", "desktop"];
+ for (const viewport of viewports) {
+ const [cookie = ""] = viewportHintCookie(viewport).split(";");
+ expect(getViewportHint(request({ cookie }))).toBe(viewport);
}
});
it("lasts a year on every path", () => {
- expect(compactHintCookie(true)).toContain("Max-Age=31536000");
- expect(compactHintCookie(true)).toContain("Path=/");
+ expect(viewportHintCookie("phone")).toContain("Max-Age=31536000");
+ expect(viewportHintCookie("phone")).toContain("Path=/");
});
});
diff --git a/packages/utils/src/viewport.ts b/packages/utils/src/viewport.ts
index f83efd6e01..06e07d7959 100644
--- a/packages/utils/src/viewport.ts
+++ b/packages/utils/src/viewport.ts
@@ -4,35 +4,48 @@
import * as cookie from "cookie";
+/** The three layout sizes, split at Tailwind `md` (48rem) and `lg` (64rem). */
+export type Viewport = "phone" | "tablet" | "desktop";
+
+const VIEWPORTS: readonly Viewport[] = ["phone", "tablet", "desktop"];
+
/**
- * Whether the browser's viewport was compact (below the `md` breakpoint) when
- * it last reported. Written by `CompactProvider` so the server renders the
- * phone layout on the first paint instead of swapping after hydration.
+ * The browser's viewport size when it last reported. Written by
+ * `ViewportProvider` so the server renders the right layout on the first paint
+ * instead of swapping after hydration.
*/
-export const COMPACT_HINT_COOKIE = "compact";
+export const VIEWPORT_HINT_COOKIE = "viewport";
+
+/** Phone: below Tailwind `md`, the same query as `max-md:`. */
+export const PHONE_QUERY = "(width < 48rem)";
-/** Compact means below Tailwind `md` (48rem), the same query theme.css uses. */
-export const COMPACT_QUERY = "(width < 48rem)";
+/** Tablet: from Tailwind `md` up to `lg`, the same query as `md:max-lg:`. */
+export const TABLET_QUERY = "(48rem <= width < 64rem)";
-const COMPACT_HINT_MAX_AGE = 31536000;
+const VIEWPORT_HINT_MAX_AGE = 31536000;
+
+function isViewport(value: string | undefined): value is Viewport {
+ return VIEWPORTS.includes(value as Viewport);
+}
-/** Server: the compact hint from the cookie, else the UA "Mobi" token. */
-export function getCompactHint(request: Request): boolean {
+/** Server: the viewport from the cookie, else the UA "Mobi" token, else desktop. */
+export function getViewportHint(request: Request): Viewport {
const cookieHeader = request.headers.get("cookie");
const cookies = cookieHeader ? cookie.parse(cookieHeader) : {};
- const hint = cookies[COMPACT_HINT_COOKIE];
- if (hint === "1") return true;
- if (hint === "0") return false;
- return /Mobi/i.test(request.headers.get("user-agent") ?? "");
+ const hint = cookies[VIEWPORT_HINT_COOKIE];
+ if (isViewport(hint)) return hint;
+ return /Mobi/i.test(request.headers.get("user-agent") ?? "")
+ ? "phone"
+ : "desktop";
}
/**
- * Client: the `document.cookie` string that records whether the viewport is
- * compact, read by `getCompactHint` on the next request.
+ * Client: the `document.cookie` string that records the viewport, read by
+ * `getViewportHint` on the next request.
*/
-export function compactHintCookie(isCompact: boolean): string {
- return cookie.serialize(COMPACT_HINT_COOKIE, isCompact ? "1" : "0", {
- maxAge: COMPACT_HINT_MAX_AGE,
+export function viewportHintCookie(viewport: Viewport): string {
+ return cookie.serialize(VIEWPORT_HINT_COOKIE, viewport, {
+ maxAge: VIEWPORT_HINT_MAX_AGE,
sameSite: "lax",
path: "/"
});