Skip to content

Commit

Permalink
run format
Browse files Browse the repository at this point in the history
  • Loading branch information
siddharthkp committed Nov 6, 2024
1 parent e010a6e commit a2e3058
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 18 deletions.
2 changes: 0 additions & 2 deletions contributor-docs/adrs/adr-002-behavior-isolation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion packages/react/src/ActionList/Group.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export const Group: React.FC<React.PropsWithChildren<ActionListGroupProps>> = ({
// 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}
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/ActionList/List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const List = React.forwardRef<HTMLUListElement, ActionListProps>(
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<HTMLUListElement>)

Expand Down
24 changes: 12 additions & 12 deletions packages/react/src/DataTable/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,17 @@ export type ObjectPaths<T> = T extends readonly any[] & ArrayWithinBounds<T>
? Extract<keyof T, string | number> | PrefixPath<T, Extract<keyof T, string | number>>
: never

type PrefixPath<T, Prefix> =
Prefix extends Extract<keyof T, number | string> ? `${Prefix}.${ObjectPaths<T[Prefix]>}` : never
type PrefixPath<T, Prefix> = Prefix extends Extract<keyof T, number | string>
? `${Prefix}.${ObjectPaths<T[Prefix]>}`
: never

// Get the value of a given path within an object
export type ObjectPathValue<ObjectType extends object, Path extends string | number> =
ObjectType extends Record<
string | number,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
any
>
? Path extends `${infer Key}.${infer NestedPath}`
? ObjectPathValue<ObjectType[Key], NestedPath>
: ObjectType[Path]
: never
export type ObjectPathValue<ObjectType extends object, Path extends string | number> = ObjectType extends Record<
string | number,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
any
>
? Path extends `${infer Key}.${infer NestedPath}`
? ObjectPathValue<ObjectType[Key], NestedPath>
: ObjectType[Path]
: never
7 changes: 5 additions & 2 deletions packages/react/src/utils/types/ComponentProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@
*
* @example ComponentProps<typeof MyComponent>
*/
export type ComponentProps<T> =
T extends React.ComponentType<React.PropsWithChildren<infer Props>> ? (Props extends object ? Props : never) : never
export type ComponentProps<T> = T extends React.ComponentType<React.PropsWithChildren<infer Props>>
? Props extends object
? Props
: never
: never

0 comments on commit a2e3058

Please sign in to comment.