diff --git a/contributor-docs/adrs/adr-002-behavior-isolation.md b/contributor-docs/adrs/adr-002-behavior-isolation.md index 575468dadc1..072099e985c 100644 --- a/contributor-docs/adrs/adr-002-behavior-isolation.md +++ b/contributor-docs/adrs/adr-002-behavior-isolation.md @@ -108,7 +108,5 @@ Some behaviors can be implemented as vanilla JavaScript without introducing addi In general, _portions of behaviors_ that affect or rely on **user interactions and events**, **shared state**, or **CSS styles** should be kept in React Hooks. Parts of the behavior that can be implemented in isolation of these concepts should be built with no dependency on React or other libraries. [^1]: https://codesandbox.io/s/demo-styling-custom-element-g973d?file=/src/index.tsx - [^2]: https://github.com/github/details-dialog-element/blob/main/src/index.ts#L195 - [^3]: https://github.com/github/details-dialog-element#details-dialog-close diff --git a/package-lock.json b/package-lock.json index 373dd208b41..b7298645033 100644 --- a/package-lock.json +++ b/package-lock.json @@ -44,7 +44,7 @@ "jest-watch-typeahead": "2.2.2", "markdownlint-cli2": "^0.11.0", "markdownlint-cli2-formatter-pretty": "0.0.3", - "prettier": "3.3.3", + "prettier": "3.1.0", "rimraf": "5.0.5", "size-limit": "11.1.5", "stylelint": "16.9.0", @@ -62,7 +62,7 @@ "name": "example-app-router", "version": "0.0.0", "dependencies": { - "@primer/react": "37.1.0", + "@primer/react": "37.2.0", "next": "^14.2.10", "react": "^18.3.1", "react-dom": "^18.3.1", @@ -81,7 +81,7 @@ "react-dom": "^18.3.1" }, "devDependencies": { - "@primer/react": "37.1.0", + "@primer/react": "37.2.0", "@types/react": "^18.3.11", "@types/react-dom": "^18.3.0", "@typescript-eslint/eslint-plugin": "^7.11.0", @@ -99,7 +99,7 @@ "name": "example-consumer-test", "version": "0.0.0", "dependencies": { - "@primer/react": "37.1.0", + "@primer/react": "37.2.0", "@types/react": "^18.3.11", "@types/react-dom": "^18.2.19", "@types/styled-components": "^5.1.11", @@ -125,7 +125,7 @@ "version": "0.0.0", "dependencies": { "@primer/octicons-react": "^19.9.0", - "@primer/react": "37.1.0", + "@primer/react": "37.2.0", "clsx": "^1.2.1", "next": "^14.2.10", "react": "^18.3.1", @@ -5995,6 +5995,21 @@ "prettier": "3.3" } }, + "node_modules/@primer/stylelint-config/node_modules/prettier": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz", + "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", + "dev": true, + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, "node_modules/@primer/view-components": { "version": "0.27.0", "dev": true, @@ -7111,6 +7126,21 @@ "node": ">=4.0" } }, + "node_modules/@storybook/addon-storysource/node_modules/prettier": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz", + "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", + "dev": true, + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, "node_modules/@storybook/addon-toolbars": { "version": "8.3.0", "dev": true, @@ -7824,6 +7854,21 @@ "node": ">=4.0" } }, + "node_modules/@storybook/source-loader/node_modules/prettier": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz", + "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", + "dev": true, + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, "node_modules/@storybook/test": { "version": "8.3.0", "dev": true, @@ -23947,9 +23992,9 @@ } }, "node_modules/prettier": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz", - "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.1.0.tgz", + "integrity": "sha512-TQLvXjq5IAibjh8EpBIkNKxO749UEWABoiIZehEPiY4GNpVdhaFKqSTu+QrlU6D2dPAfubRmtJTi4K4YkQ5eXw==", "dev": true, "bin": { "prettier": "bin/prettier.cjs" @@ -30069,7 +30114,7 @@ }, "packages/react": { "name": "@primer/react", - "version": "37.1.0", + "version": "37.2.0", "license": "MIT", "dependencies": { "@github/relative-time-element": "^4.4.3", @@ -30429,6 +30474,20 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "packages/react/node_modules/prettier": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz", + "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, "packages/react/node_modules/rollup-plugin-visualizer": { "version": "5.9.2", "dev": true, diff --git a/package.json b/package.json index 9ac53a5ba2e..0f7674a0345 100644 --- a/package.json +++ b/package.json @@ -72,7 +72,7 @@ "jest-watch-typeahead": "2.2.2", "markdownlint-cli2": "^0.11.0", "markdownlint-cli2-formatter-pretty": "0.0.3", - "prettier": "3.3.3", + "prettier": "3.1.0", "rimraf": "5.0.5", "size-limit": "11.1.5", "stylelint": "16.9.0", diff --git a/packages/react/src/ActionList/Group.tsx b/packages/react/src/ActionList/Group.tsx index d0db9a77ff2..1e29f5be58d 100644 --- a/packages/react/src/ActionList/Group.tsx +++ b/packages/react/src/ActionList/Group.tsx @@ -97,7 +97,7 @@ export const Group: React.FC> = ({ // because the heading is hidden from the accessibility tree and only used for presentation role. // We will instead use aria-label to label the list. See a line below. aria-labelledby={listRole ? undefined : groupHeadingId} - aria-label={listRole ? (title ?? (slots.groupHeading?.props.children as string)) : undefined} + aria-label={listRole ? title ?? (slots.groupHeading?.props.children as string) : undefined} role={role || (listRole && 'group')} > {slots.groupHeading ? childrenWithoutSlots : props.children} diff --git a/packages/react/src/ActionList/List.tsx b/packages/react/src/ActionList/List.tsx index 874ce8195ef..7786f392682 100644 --- a/packages/react/src/ActionList/List.tsx +++ b/packages/react/src/ActionList/List.tsx @@ -39,7 +39,7 @@ export const List = React.forwardRef( enableFocusZone: enableFocusZoneFromContainer, } = React.useContext(ActionListContainerContext) - const ariaLabelledBy = slots.heading ? (slots.heading.props.id ?? headingId) : listLabelledBy + const ariaLabelledBy = slots.heading ? slots.heading.props.id ?? headingId : listLabelledBy const listRole = role || listRoleFromContainer const listRef = useProvidedRefOrCreate(forwardedRef as React.RefObject) diff --git a/packages/react/src/DataTable/utils.ts b/packages/react/src/DataTable/utils.ts index 779a4598468..6d660a53cff 100644 --- a/packages/react/src/DataTable/utils.ts +++ b/packages/react/src/DataTable/utils.ts @@ -38,17 +38,17 @@ export type ObjectPaths = T extends readonly any[] & ArrayWithinBounds ? Extract | PrefixPath> : never -type PrefixPath = - Prefix extends Extract ? `${Prefix}.${ObjectPaths}` : never +type PrefixPath = Prefix extends Extract + ? `${Prefix}.${ObjectPaths}` + : never // Get the value of a given path within an object -export type ObjectPathValue = - ObjectType extends Record< - string | number, - // eslint-disable-next-line @typescript-eslint/no-explicit-any - any - > - ? Path extends `${infer Key}.${infer NestedPath}` - ? ObjectPathValue - : ObjectType[Path] - : never +export type ObjectPathValue = ObjectType extends Record< + string | number, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + any +> + ? Path extends `${infer Key}.${infer NestedPath}` + ? ObjectPathValue + : ObjectType[Path] + : never diff --git a/packages/react/src/utils/types/ComponentProps.ts b/packages/react/src/utils/types/ComponentProps.ts index 4ddc3c7cf95..83256126a04 100644 --- a/packages/react/src/utils/types/ComponentProps.ts +++ b/packages/react/src/utils/types/ComponentProps.ts @@ -5,5 +5,8 @@ * * @example ComponentProps */ -export type ComponentProps = - T extends React.ComponentType> ? (Props extends object ? Props : never) : never +export type ComponentProps = T extends React.ComponentType> + ? Props extends object + ? Props + : never + : never