Skip to content

Commit 68a57d6

Browse files
committed
chore: format files
1 parent 098e7a4 commit 68a57d6

File tree

14 files changed

+70
-66
lines changed

14 files changed

+70
-66
lines changed

contributor-docs/adrs/adr-002-behavior-isolation.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,5 +108,7 @@ Some behaviors can be implemented as vanilla JavaScript without introducing addi
108108
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.
109109

110110
[^1]: https://codesandbox.io/s/demo-styling-custom-element-g973d?file=/src/index.tsx
111+
111112
[^2]: https://github.com/github/details-dialog-element/blob/main/src/index.ts#L195
113+
112114
[^3]: https://github.com/github/details-dialog-element#details-dialog-close

packages/react/src/ActionList/Group.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export const Group: React.FC<React.PropsWithChildren<ActionListGroupProps>> = ({
9797
// because the heading is hidden from the accessibility tree and only used for presentation role.
9898
// We will instead use aria-label to label the list. See a line below.
9999
aria-labelledby={listRole ? undefined : groupHeadingId}
100-
aria-label={listRole ? title ?? (slots.groupHeading?.props.children as string) : undefined}
100+
aria-label={listRole ? (title ?? (slots.groupHeading?.props.children as string)) : undefined}
101101
role={role || (listRole && 'group')}
102102
>
103103
{slots.groupHeading ? childrenWithoutSlots : props.children}

packages/react/src/ActionList/List.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export const List = React.forwardRef<HTMLUListElement, ActionListProps>(
3939
enableFocusZone: enableFocusZoneFromContainer,
4040
} = React.useContext(ActionListContainerContext)
4141

42-
const ariaLabelledBy = slots.heading ? slots.heading.props.id ?? headingId : listLabelledBy
42+
const ariaLabelledBy = slots.heading ? (slots.heading.props.id ?? headingId) : listLabelledBy
4343
const listRole = role || listRoleFromContainer
4444
const listRef = useProvidedRefOrCreate(forwardedRef as React.RefObject<HTMLUListElement>)
4545

packages/react/src/Button/ButtonBase.tsx

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -198,13 +198,13 @@ const ButtonBase = forwardRef(
198198
true,
199199
)
200200
: TrailingVisual
201-
? renderModuleVisual(
202-
TrailingVisual,
203-
Boolean(loading) && !LeadingVisual,
204-
'trailingVisual',
205-
false,
206-
)
207-
: null
201+
? renderModuleVisual(
202+
TrailingVisual,
203+
Boolean(loading) && !LeadingVisual,
204+
'trailingVisual',
205+
false,
206+
)
207+
: null
208208
}
209209
</Box>
210210
{
@@ -314,8 +314,13 @@ const ButtonBase = forwardRef(
314314
true,
315315
)
316316
: TrailingVisual
317-
? renderModuleVisual(TrailingVisual, Boolean(loading) && !LeadingVisual, 'trailingVisual', false)
318-
: null
317+
? renderModuleVisual(
318+
TrailingVisual,
319+
Boolean(loading) && !LeadingVisual,
320+
'trailingVisual',
321+
false,
322+
)
323+
: null
319324
}
320325
</span>
321326
{
@@ -420,8 +425,8 @@ const ButtonBase = forwardRef(
420425
'trailingVisual',
421426
)
422427
: TrailingVisual
423-
? renderVisual(TrailingVisual, Boolean(loading) && !LeadingVisual, 'trailingVisual')
424-
: null
428+
? renderVisual(TrailingVisual, Boolean(loading) && !LeadingVisual, 'trailingVisual')
429+
: null
425430
}
426431
</Box>
427432
{

packages/react/src/DataTable/DataTable.stories.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@ export const Playground = (args: DataTableProps<UniqueRow> & ColWidthArgTypes) =
189189
return args[`colWidth${colIndex}`] !== 'explicit width'
190190
? args[`colWidth${colIndex}`]
191191
: args[`explicitColWidth${colIndex}`]
192-
? args[`explicitColWidth${colIndex}`]
193-
: 'grow'
192+
? args[`explicitColWidth${colIndex}`]
193+
: 'grow'
194194
}
195195

196196
const align = args.align as CellAlignment

packages/react/src/DataTable/useTable.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ export function useTable<Data extends UniqueRow>({
135135
header.column.sortBy === true
136136
? strategies.basic
137137
: typeof header.column.sortBy === 'string'
138-
? strategies[header.column.sortBy]
139-
: header.column.sortBy
138+
? strategies[header.column.sortBy]
139+
: header.column.sortBy
140140

141141
setRowOrder(rowOrder => {
142142
return rowOrder.slice().sort((a, b) => {

packages/react/src/DataTable/utils.ts

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ type MaxLength = ArrayOfLength<10>[number]
1212
type ArrayIndex<A extends ReadonlyArray<any>, Keys extends number = never> = A extends readonly []
1313
? Keys
1414
: // eslint-disable-next-line @typescript-eslint/no-unused-vars
15-
A extends readonly [infer _, ...infer Tail]
16-
? ArrayIndex<Tail, Keys | Tail['length']>
17-
: Keys
15+
A extends readonly [infer _, ...infer Tail]
16+
? ArrayIndex<Tail, Keys | Tail['length']>
17+
: Keys
1818

1919
// Check if the given type is within the bounds set by `MaxLength`
2020
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -30,25 +30,25 @@ type ArrayWithinBounds<T> = T extends ReadonlyArray<any> & {length: infer Length
3030
export type ObjectPaths<T> = T extends readonly any[] & ArrayWithinBounds<T>
3131
? `${ArrayIndex<T>}` | PrefixPath<T, ArrayIndex<T>>
3232
: // eslint-disable-next-line @typescript-eslint/no-explicit-any
33-
T extends any[]
34-
? never & 'Unable to determine keys of potentially boundless array'
35-
: T extends Date
36-
? never
37-
: T extends object
38-
? Extract<keyof T, string | number> | PrefixPath<T, Extract<keyof T, string | number>>
39-
: never
33+
T extends any[]
34+
? never & 'Unable to determine keys of potentially boundless array'
35+
: T extends Date
36+
? never
37+
: T extends object
38+
? Extract<keyof T, string | number> | PrefixPath<T, Extract<keyof T, string | number>>
39+
: never
4040

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

4544
// Get the value of a given path within an object
46-
export type ObjectPathValue<ObjectType extends object, Path extends string | number> = ObjectType extends Record<
47-
string | number,
48-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
49-
any
50-
>
51-
? Path extends `${infer Key}.${infer NestedPath}`
52-
? ObjectPathValue<ObjectType[Key], NestedPath>
53-
: ObjectType[Path]
54-
: never
45+
export type ObjectPathValue<ObjectType extends object, Path extends string | number> =
46+
ObjectType extends Record<
47+
string | number,
48+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
49+
any
50+
>
51+
? Path extends `${infer Key}.${infer NestedPath}`
52+
? ObjectPathValue<ObjectType[Key], NestedPath>
53+
: ObjectType[Path]
54+
: never

packages/react/src/PageLayout/PageLayout.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -788,8 +788,8 @@ const Pane = React.forwardRef<HTMLDivElement, React.PropsWithChildren<PageLayout
788788
width: resizable
789789
? ['100%', null, 'clamp(var(--pane-min-width), var(--pane-width), var(--pane-max-width))']
790790
: isPaneWidth(width)
791-
? paneWidths[width]
792-
: width.default,
791+
? paneWidths[width]
792+
: width.default,
793793
padding: SPACING_MAP[padding],
794794
overflow: [null, null, 'auto'],
795795

packages/react/src/SelectPanel/SelectPanel.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,8 @@ export function SelectPanel({
213213
filterValue === ''
214214
? 'Showing all items'
215215
: items.length <= 0
216-
? 'No matching items'
217-
: `${items.length} matching ${items.length === 1 ? 'item' : 'items'}`
216+
? 'No matching items'
217+
: `${items.length} matching ${items.length === 1 ? 'item' : 'items'}`
218218
}
219219
/>
220220
)}

packages/react/src/hooks/useSlots.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ type SlotElements<Config extends SlotConfig> = {
2020
type SlotValue<Config, Property extends keyof Config> = Config[Property] extends React.ElementType // config option 1
2121
? React.ReactElement<React.ComponentPropsWithoutRef<Config[Property]>, Config[Property]>
2222
: Config[Property] extends readonly [
23-
infer ElementType extends React.ElementType, // config option 2, infer array[0] as component
24-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
25-
infer _testFn, // even though we don't use testFn, we need to infer it to support types for slots.*.props
26-
]
27-
? React.ReactElement<React.ComponentPropsWithoutRef<ElementType>, ElementType>
28-
: never // useful for narrowing types, third option is not possible
23+
infer ElementType extends React.ElementType, // config option 2, infer array[0] as component
24+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
25+
infer _testFn, // even though we don't use testFn, we need to infer it to support types for slots.*.props
26+
]
27+
? React.ReactElement<React.ComponentPropsWithoutRef<ElementType>, ElementType>
28+
: never // useful for narrowing types, third option is not possible
2929

3030
/**
3131
* Extract components from `children` so we can render them in different places,

0 commit comments

Comments
 (0)