-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Root as slot implementation #19483
Root as slot implementation #19483
Changes from all commits
0c86106
762fb40
32b049b
d7a6c08
69e24a2
321e912
f3fd6e0
94b2021
4357718
c2a204f
ff5cee8
c9bbbbd
43aa214
2d76a00
c67a33b
2fa48e2
60365bd
96848b5
a39797a
1368fbb
464f5b5
cf4294d
eb90145
735ec80
c063fd7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"type": "prerelease", | ||
"comment": "Updates react-accordion to use root as slot", | ||
"packageName": "@fluentui/react-accordion", | ||
"email": "[email protected]", | ||
"dependentChangeType": "patch" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"type": "prerelease", | ||
"comment": "Updates react-aria to use root as slot", | ||
"packageName": "@fluentui/react-aria", | ||
"email": "[email protected]", | ||
"dependentChangeType": "patch" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"type": "prerelease", | ||
"comment": "Updates react-menu to use root as slot", | ||
"packageName": "@fluentui/react-menu", | ||
"email": "[email protected]", | ||
"dependentChangeType": "patch" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"type": "prerelease", | ||
"comment": "Update implementation to handle 'root' as a slot", | ||
"packageName": "@fluentui/react-utilities", | ||
"email": "[email protected]", | ||
"dependentChangeType": "patch" | ||
} |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
import * as React from 'react'; | ||
import type { ComponentProps, ComponentState } from '@fluentui/react-utilities'; | ||
import type { ComponentProps, ComponentState, ObjectShorthandProps } from '@fluentui/react-utilities'; | ||
import type { AccordionItemValue } from '../AccordionItem/AccordionItem.types'; | ||
|
||
export type AccordionIndex = number | number[]; | ||
|
||
export type AccordionToggleEvent<E = HTMLElement> = React.MouseEvent<E> | React.KeyboardEvent<E>; | ||
|
||
export type AccordionToggleEventHandler = (event: AccordionToggleEvent, data: AccordionToggleData) => void; | ||
|
@@ -22,9 +24,11 @@ export interface AccordionContextValues { | |
accordion: AccordionContextValue; | ||
} | ||
|
||
export type AccordionSlots = {}; | ||
export type AccordionSlots = { | ||
root: ObjectShorthandProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't |
||
}; | ||
|
||
export interface AccordionCommons extends React.HTMLAttributes<HTMLElement> { | ||
export interface AccordionCommons { | ||
/** | ||
* Indicates if keyboard navigation is available | ||
*/ | ||
|
@@ -55,9 +59,4 @@ export interface AccordionProps extends ComponentProps<AccordionSlots>, Partial< | |
onToggle?: AccordionToggleEventHandler; | ||
} | ||
|
||
export interface AccordionState extends ComponentState<AccordionSlots>, AccordionCommons, AccordionContextValue { | ||
/** | ||
* Ref to the root slot | ||
*/ | ||
ref: React.Ref<HTMLElement>; | ||
} | ||
export interface AccordionState extends ComponentState<AccordionSlots>, AccordionCommons, AccordionContextValue {} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,6 @@ exports[`AccordionHeader renders a default state 1`] = ` | |
<button | ||
className="" | ||
disabled={false} | ||
id="accordion-header-1" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it expected that we don't have There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. this is due to removal of |
||
onClick={[Function]} | ||
> | ||
<span | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please clarify why it is required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
as
prop test should be reformulated. it's testing inappropriate cases such as Function component, which is not supported anymore.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please create an issue to follow up?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please tag me in any follow-up issue for
as
prop tests too.