Skip to content

Commit 6ff32bd

Browse files
authored
Merge branch 'main' into cf/petrinaut-setup-updates-june
2 parents cd5107f + acf5df0 commit 6ff32bd

54 files changed

Lines changed: 839 additions & 363 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.changeset/heavy-months-post.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@hashintel/ds-components": patch
3+
---
4+
5+
New icons: trend arrows, file lines, grid, print, puzzle piece, truck

.config/mise/config.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ protoc = "32.1"
3131
"cargo:cargo-nextest" = "0.9.137"
3232
just = "1.51.0"
3333
markdownlint-cli2 = "0.22.1"
34-
"npm:@napi-rs/cli" = "3.6.2"
34+
"npm:@napi-rs/cli" = "3.7.0"
3535
"npm:@redocly/cli" = "2.31.5"
3636
"npm:renovate" = "43.202.1"
3737
oxfmt = "0.50.0"

apps/hash-frontend/eslint.config.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,14 @@ export default [
101101
},
102102
},
103103
{
104-
ignores: ["buildstamp.js", "next.config.js", "next-env.d.ts"],
104+
ignores: [
105+
"buildstamp.js",
106+
"next.config.js",
107+
"next-env.d.ts",
108+
// Outside the tsconfig project: imports `@hashintel/ds-components/preset`,
109+
// an `exports` subpath the legacy `moduleResolution: "node"` cannot resolve
110+
"panda.config.ts",
111+
],
105112
},
106113
]),
107114
];

apps/hash-frontend/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"scripts": {
99
"build": "next build",
1010
"build:docker": "docker buildx build --tag hash-frontend --file docker/Dockerfile ../../ --load --build-arg FRONTEND_URL=\"$FRONTEND_URL\" --build-arg API_ORIGIN=\"$API_ORIGIN\"",
11-
"codegen": "rimraf './src/**/*.gen.*'; graphql-codegen --config codegen.config.ts",
11+
"codegen": "rimraf './src/**/*.gen.*'; graphql-codegen --config codegen.config.ts && panda cssgen --outfile ./src/pages/ds-components-styles.gen.css",
1212
"dev": "next dev",
1313
"fix:eslint": "eslint --fix .",
1414
"lint:eslint": "eslint --report-unused-disable-directives .",
@@ -143,6 +143,7 @@
143143
"@local/eslint": "workspace:*",
144144
"@local/tsconfig": "workspace:*",
145145
"@next/bundle-analyzer": "15.5.9",
146+
"@pandacss/dev": "1.11.1",
146147
"@types/dotenv-flow": "3.3.3",
147148
"@types/gapi": "0.0.47",
148149
"@types/google.accounts": "0.0.18",

apps/hash-frontend/panda.config.ts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { createRequire } from "node:module";
2+
3+
import { defineConfig } from "@pandacss/dev";
4+
5+
import { scopedThemeConfig } from "@hashintel/ds-components/preset";
6+
7+
/** Panda evaluates this config through CJS, so `__filename` is available here. */
8+
const require = createRequire(__filename);
9+
10+
/**
11+
* Generates the stylesheet backing `@hashintel/ds-components` usage in this
12+
* app: `panda cssgen` (part of the `codegen` script) writes
13+
* `src/pages/ds-components-styles.gen.css`, which is imported in
14+
* `_app.page.tsx`.
15+
*
16+
* Atomic utility classes are global, while the design system's preflight,
17+
* token variables and global styles are scoped to `.hash-ds-root` so they
18+
* cannot interfere with the MUI-styled rest of the app. Wrap any subtree that
19+
* uses themed ds-components in an element with that class.
20+
*/
21+
export default defineConfig({
22+
...scopedThemeConfig(".hash-ds-root"),
23+
24+
/**
25+
* Only styles used inside ds-components itself — this app does not author
26+
* Panda styles. Add `./src` globs here if `css()` calls are introduced.
27+
*/
28+
include: [require.resolve("@hashintel/ds-components/panda.buildinfo.json")],
29+
30+
exclude: [],
31+
32+
// Polyfill CSS @layer, as this app's unlayered global resets would
33+
// otherwise override layered utilities.
34+
polyfill: true,
35+
36+
importMap: "@hashintel/ds-helpers",
37+
});

apps/hash-frontend/src/pages/_app.page.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ require("setimmediate");
77

88
import "./globals.scss";
99
import "./prism.css";
10+
import "./ds-components-styles.gen.css";
1011
import { ApolloProvider } from "@apollo/client/react";
1112
import { CacheProvider } from "@emotion/react";
1213
import { CssBaseline, GlobalStyles, ThemeProvider } from "@mui/material";

apps/hash-frontend/src/pages/shared/entity-type-page/entity-type-plural.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,10 @@ import { AltTitleGroup } from "./shared/alt-title-group";
77
import type { EntityTypeEditorFormData } from "@hashintel/type-editor";
88

99
interface EntityTypePluralProps {
10-
isLinkType: boolean;
1110
readonly?: boolean;
1211
}
1312

14-
export const EntityTypePlural = ({
15-
isLinkType,
16-
readonly,
17-
}: EntityTypePluralProps) => {
13+
export const EntityTypePlural = ({ readonly }: EntityTypePluralProps) => {
1814
const { control } = useFormContext<EntityTypeEditorFormData>();
1915

2016
const pluralController = useController({
@@ -29,7 +25,7 @@ export const EntityTypePlural = ({
2925
}
3026

3127
return (
32-
<AltTitleGroup direction={isLinkType ? "column" : "row"} label="plural">
28+
<AltTitleGroup direction="column" label="plural">
3329
<EditableField
3430
{...props}
3531
inputRef={ref}

apps/hash-frontend/src/pages/shared/entity-type-page/shared/entity-type-header.tsx

Lines changed: 36 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
EntityTypeIcon,
1515
LinkTypeIcon,
1616
} from "@hashintel/design-system";
17+
import { TextMark } from "@hashintel/ds-components";
1718
import { useEntityTypeFormContext } from "@hashintel/type-editor";
1819

1920
import { EditEmojiIconButton } from "../../../../shared/edit-emoji-icon-button";
@@ -105,9 +106,10 @@ export const EntityTypeHeader = ({
105106
direction="row"
106107
alignItems="center"
107108
justifyContent="space-between"
109+
mb={3}
108110
>
109-
<Stack direction="row" alignItems="center" gap={5}>
110-
<Stack direction="row" alignItems="flex-start" mt={1} mb={3}>
111+
<Stack direction="row" alignItems="center" gap={5} minWidth={0}>
112+
<Stack direction="row" alignItems="flex-start" mt={1} minWidth={0}>
111113
{entityTypeNameSize !== null && (
112114
<Controller
113115
control={control}
@@ -158,14 +160,14 @@ export const EntityTypeHeader = ({
158160
}
159161
sx={{
160162
position: "relative",
161-
top: entityTypeNameSize.lineHeight / 2 - 22,
163+
top: entityTypeNameSize.lineHeight / 2 - 25,
162164
}}
163165
/>
164166
);
165167
}}
166168
/>
167169
)}
168-
<Box sx={{ position: "relative", ml: 2.5 }}>
170+
<Box sx={{ ml: 2.5, minWidth: 0 }}>
169171
<Tooltip
170172
placement="top-start"
171173
componentsProps={{
@@ -195,39 +197,37 @@ export const EntityTypeHeader = ({
195197
variant="h1"
196198
fontWeight="bold"
197199
ref={entityTypeNameTextRef}
198-
sx={{
199-
lineHeight: 1.2,
200-
}}
200+
sx={{ overflow: "hidden", textOverflow: "ellipsis" }}
201201
>
202202
{entityTypeSchema.title}
203+
{isInSlide && (
204+
<TextMark>
205+
<Link
206+
href={
207+
generateLinkParameters(entityTypeSchema.$id).href
208+
}
209+
sx={{ ml: 2.5 }}
210+
target="_blank"
211+
>
212+
<ArrowUpRightFromSquareRegularIcon
213+
sx={{
214+
fill: ({ palette }) => palette.blue[50],
215+
fontSize: 24,
216+
verticalAlign: "middle",
217+
// Nudge the icon up slightly relative to the
218+
// text, without affecting line-box layout
219+
position: "relative",
220+
top: -8,
221+
"&:hover": {
222+
fill: ({ palette }) => palette.blue[60],
223+
},
224+
}}
225+
/>
226+
</Link>
227+
</TextMark>
228+
)}
203229
</Typography>
204230
</Tooltip>
205-
{isInSlide && entityTypeNameSize !== null && (
206-
<Link
207-
href={generateLinkParameters(entityTypeSchema.$id).href}
208-
sx={{
209-
position: "absolute",
210-
left: entityTypeNameSize.lastLineWidth + 20,
211-
/**
212-
* The vertical center of the text plus offset half the icon size
213-
*/
214-
top:
215-
entityTypeNameSize.lastLineTop +
216-
(entityTypeNameSize.lineHeight / 2 - 12),
217-
}}
218-
target="_blank"
219-
>
220-
<ArrowUpRightFromSquareRegularIcon
221-
sx={{
222-
fill: ({ palette }) => palette.blue[50],
223-
fontSize: 24,
224-
"&:hover": {
225-
fill: ({ palette }) => palette.blue[70],
226-
},
227-
}}
228-
/>
229-
</Link>
230-
)}
231231
</Box>
232232
</Stack>
233233
<Stack
@@ -236,7 +236,7 @@ export const EntityTypeHeader = ({
236236
gap={1.5}
237237
sx={{ position: "relative", top: 5 }}
238238
>
239-
<EntityTypePlural isLinkType={isLink} readonly={isReadonly} />
239+
<EntityTypePlural readonly={isReadonly} />
240240
{isLink && <EntityTypeInverse readonly={isReadonly} />}
241241
</Stack>
242242
</Stack>
@@ -245,6 +245,8 @@ export const EntityTypeHeader = ({
245245
onClick={() => setShowExtendTypeModal(true)}
246246
variant="secondary"
247247
size="small"
248+
// Don't let the button get squeezed by long header content
249+
sx={{ flexShrink: 0, ml: 2 }}
248250
>
249251
Extend <ArrowUpRightIcon sx={{ fontSize: 16, ml: 1.5 }} />
250252
</Button>

apps/hash-frontend/src/pages/shared/entity-type.tsx

Lines changed: 40 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -426,29 +426,33 @@ export const EntityType = ({
426426
})}
427427
>
428428
<TopContextBar
429-
actionMenuItems={[
430-
...(!isReadonly && remoteEntityType && !isArchived
431-
? [
432-
<ArchiveMenuItem
433-
key={entityType.schema.$id}
434-
item={remoteEntityType}
435-
onItemChange={() => {
436-
onEntityTypeUpdated?.(entityType);
437-
}}
438-
/>,
429+
actionMenuItems={
430+
isInSlide
431+
? []
432+
: [
433+
...(!isReadonly && remoteEntityType && !isArchived
434+
? [
435+
<ArchiveMenuItem
436+
key={entityType.schema.$id}
437+
item={remoteEntityType}
438+
onItemChange={() => {
439+
onEntityTypeUpdated?.(entityType);
440+
}}
441+
/>,
442+
]
443+
: []),
444+
...(!isReadonly && !isDraft && !isLink
445+
? [
446+
<ConvertTypeMenuItem
447+
key={entityType.schema.$id}
448+
convertToLinkType={convertToLinkType}
449+
disabled={isDirty}
450+
typeTitle={entityType.schema.title}
451+
/>,
452+
]
453+
: []),
439454
]
440-
: []),
441-
...(!isReadonly && !isDraft && !isLink
442-
? [
443-
<ConvertTypeMenuItem
444-
key={entityType.schema.$id}
445-
convertToLinkType={convertToLinkType}
446-
disabled={isDirty}
447-
typeTitle={entityType.schema.title}
448-
/>,
449-
]
450-
: []),
451-
]}
455+
}
452456
defaultCrumbIcon={null}
453457
item={remoteEntityType ?? undefined}
454458
crumbs={[
@@ -458,7 +462,7 @@ export const EntityType = ({
458462
id: "types",
459463
},
460464
{
461-
href: "/types/entity-type",
465+
href: `/types/${isLink ? "link" : "entity"}-type`,
462466
title: `${isLink ? "Link" : "Entity"} Types`,
463467
id: "entity-types",
464468
},
@@ -480,7 +484,19 @@ export const EntityType = ({
480484
void refetch();
481485
}}
482486
scrollToTop={() => {}}
483-
sx={{ bgcolor: "white" }}
487+
sx={[
488+
{ bgcolor: "white" },
489+
/**
490+
* In a slide, the slide stack renders absolutely-positioned
491+
* back/forward/close buttons over the top-right corner – push
492+
* the bar's content down so the breadcrumbs and actions menu
493+
* sit below those buttons rather than behind them, and align
494+
* the breadcrumbs with the slide's 32px content padding
495+
* instead of the sidebar-state based padding used on regular
496+
* pages.
497+
*/
498+
isInSlide ? { mt: -0.6 } : {},
499+
]}
484500
/>
485501

486502
{!isReadonly && (

apps/hash-frontend/src/pages/shared/slide-stack/slide-back-forward-close-bar.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ export const SlideBackForwardCloseBar = ({
2929
pointerEvents: "auto",
3030
pt: 1.5,
3131
pr: 3,
32-
zIndex: 2,
3332
}}
3433
>
3534
<Box display="flex" justifyContent="space-between" gap={1}>

0 commit comments

Comments
 (0)