add onOpenChange to all dropdown and selects (#31230)
* add onOpenChange to all dropdown and selects fixes: #31166 Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com> * fixed test Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com> --------- Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
This commit is contained in:
parent
5db3772d45
commit
b5597c6293
34 changed files with 38 additions and 2 deletions
|
@ -192,9 +192,11 @@ describe("Client Scopes test", () => {
|
||||||
.checkDropdownItemIsDisabled("Delete")
|
.checkDropdownItemIsDisabled("Delete")
|
||||||
.clickItemCheckbox(itemName)
|
.clickItemCheckbox(itemName)
|
||||||
.checkInSearchBarChangeTypeToButtonIsDisabled(false)
|
.checkInSearchBarChangeTypeToButtonIsDisabled(false)
|
||||||
|
.clickSearchBarActionButton()
|
||||||
.checkDropdownItemIsDisabled("Delete", false)
|
.checkDropdownItemIsDisabled("Delete", false)
|
||||||
.clickItemCheckbox(itemName)
|
.clickItemCheckbox(itemName)
|
||||||
.checkInSearchBarChangeTypeToButtonIsDisabled()
|
.checkInSearchBarChangeTypeToButtonIsDisabled()
|
||||||
|
.clickSearchBarActionButton()
|
||||||
.checkDropdownItemIsDisabled("Delete");
|
.checkDropdownItemIsDisabled("Delete");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,7 @@ export const AddFlowDropdown = ({
|
||||||
position: "right",
|
position: "right",
|
||||||
}}
|
}}
|
||||||
isOpen={open}
|
isOpen={open}
|
||||||
|
onOpenChange={(isOpen) => setOpen(isOpen)}
|
||||||
toggle={(ref) => (
|
toggle={(ref) => (
|
||||||
<MenuToggle
|
<MenuToggle
|
||||||
ref={ref}
|
ref={ref}
|
||||||
|
|
|
@ -38,6 +38,7 @@ export const ChangeTypeDropdown = ({
|
||||||
return (
|
return (
|
||||||
<Select
|
<Select
|
||||||
aria-label="change-type-to"
|
aria-label="change-type-to"
|
||||||
|
onOpenChange={(isOpen) => setOpen(isOpen)}
|
||||||
isOpen={open}
|
isOpen={open}
|
||||||
toggle={(ref) => (
|
toggle={(ref) => (
|
||||||
<MenuToggle
|
<MenuToggle
|
||||||
|
|
|
@ -257,6 +257,7 @@ export default function ClientScopesSection() {
|
||||||
<ToolbarItem>
|
<ToolbarItem>
|
||||||
<Dropdown
|
<Dropdown
|
||||||
shouldFocusToggleOnSelect
|
shouldFocusToggleOnSelect
|
||||||
|
onOpenChange={(isOpen) => setKebabOpen(isOpen)}
|
||||||
toggle={(ref) => (
|
toggle={(ref) => (
|
||||||
<MenuToggle
|
<MenuToggle
|
||||||
data-testid="kebab"
|
data-testid="kebab"
|
||||||
|
|
|
@ -114,6 +114,7 @@ export const MapperList = ({
|
||||||
toolbarItem={
|
toolbarItem={
|
||||||
<Dropdown
|
<Dropdown
|
||||||
onSelect={() => setMapperAction(false)}
|
onSelect={() => setMapperAction(false)}
|
||||||
|
onOpenChange={(isOpen) => setMapperAction(isOpen)}
|
||||||
toggle={(ref) => (
|
toggle={(ref) => (
|
||||||
<MenuToggle
|
<MenuToggle
|
||||||
ref={ref}
|
ref={ref}
|
||||||
|
|
|
@ -72,6 +72,7 @@ export const SearchDropdown = ({
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dropdown
|
<Dropdown
|
||||||
|
onOpenChange={(isOpen) => setSearchToggle(isOpen)}
|
||||||
toggle={(ref) => (
|
toggle={(ref) => (
|
||||||
<MenuToggle
|
<MenuToggle
|
||||||
data-testid="clientScopeSearch"
|
data-testid="clientScopeSearch"
|
||||||
|
|
|
@ -174,6 +174,7 @@ export const AdvancedSettings = ({
|
||||||
</MenuToggle>
|
</MenuToggle>
|
||||||
)}
|
)}
|
||||||
isOpen={open}
|
isOpen={open}
|
||||||
|
onOpenChange={(isOpen) => setOpen(isOpen)}
|
||||||
onSelect={(_, value) => {
|
onSelect={(_, value) => {
|
||||||
field.onChange(value);
|
field.onChange(value);
|
||||||
setOpen(false);
|
setOpen(false);
|
||||||
|
|
|
@ -71,6 +71,7 @@ export const TokenLifespan = ({
|
||||||
</MenuToggle>
|
</MenuToggle>
|
||||||
)}
|
)}
|
||||||
isOpen={open}
|
isOpen={open}
|
||||||
|
onOpenChange={(isOpen) => setOpen(isOpen)}
|
||||||
onSelect={(_, value) => {
|
onSelect={(_, value) => {
|
||||||
field.onChange(value);
|
field.onChange(value);
|
||||||
setOpen(false);
|
setOpen(false);
|
||||||
|
|
|
@ -208,6 +208,7 @@ export const AuthorizationPermissions = ({
|
||||||
</ToolbarItem>
|
</ToolbarItem>
|
||||||
<ToolbarItem>
|
<ToolbarItem>
|
||||||
<Dropdown
|
<Dropdown
|
||||||
|
onOpenChange={toggleCreate}
|
||||||
toggle={(ref) => (
|
toggle={(ref) => (
|
||||||
<MenuToggle
|
<MenuToggle
|
||||||
ref={ref}
|
ref={ref}
|
||||||
|
|
|
@ -55,6 +55,7 @@ export const SearchDropdown = ({
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dropdown
|
<Dropdown
|
||||||
|
onOpenChange={toggle}
|
||||||
toggle={(ref) => (
|
toggle={(ref) => (
|
||||||
<MenuToggle
|
<MenuToggle
|
||||||
data-testid="searchdropdown_dorpdown"
|
data-testid="searchdropdown_dorpdown"
|
||||||
|
|
|
@ -169,6 +169,7 @@ export const AddScopeDialog = ({
|
||||||
popperProps={{
|
popperProps={{
|
||||||
direction: "up",
|
direction: "up",
|
||||||
}}
|
}}
|
||||||
|
onOpenChange={(isOpen) => setAddToggle(isOpen)}
|
||||||
className="keycloak__client-scopes-add__add-dropdown"
|
className="keycloak__client-scopes-add__add-dropdown"
|
||||||
key="add-dropdown"
|
key="add-dropdown"
|
||||||
isOpen={addToggle}
|
isOpen={addToggle}
|
||||||
|
@ -215,6 +216,7 @@ export const AddScopeDialog = ({
|
||||||
onSelect={() => {
|
onSelect={() => {
|
||||||
onFilterTypeDropdownSelect(filterType);
|
onFilterTypeDropdownSelect(filterType);
|
||||||
}}
|
}}
|
||||||
|
onOpenChange={toggleIsFilterTypeDropdownOpen}
|
||||||
toggle={(ref) => (
|
toggle={(ref) => (
|
||||||
<MenuToggle
|
<MenuToggle
|
||||||
ref={ref}
|
ref={ref}
|
||||||
|
@ -246,6 +248,7 @@ export const AddScopeDialog = ({
|
||||||
onSelect={() => {
|
onSelect={() => {
|
||||||
onFilterTypeDropdownSelect(filterType);
|
onFilterTypeDropdownSelect(filterType);
|
||||||
}}
|
}}
|
||||||
|
onOpenChange={toggleIsFilterTypeDropdownOpen}
|
||||||
data-testid="filter-type-dropdown"
|
data-testid="filter-type-dropdown"
|
||||||
toggle={(ref) => (
|
toggle={(ref) => (
|
||||||
<MenuToggle
|
<MenuToggle
|
||||||
|
|
|
@ -298,6 +298,7 @@ export const ClientScopes = ({
|
||||||
</ToolbarItem>
|
</ToolbarItem>
|
||||||
<ToolbarItem>
|
<ToolbarItem>
|
||||||
<Dropdown
|
<Dropdown
|
||||||
|
onOpenChange={(isOpen) => setKebabOpen(isOpen)}
|
||||||
toggle={(ref) => (
|
toggle={(ref) => (
|
||||||
<MenuToggle
|
<MenuToggle
|
||||||
data-testid="kebab"
|
data-testid="kebab"
|
||||||
|
|
|
@ -86,6 +86,7 @@ export const CellDropdown = ({
|
||||||
</MenuToggle>
|
</MenuToggle>
|
||||||
)}
|
)}
|
||||||
isOpen={open}
|
isOpen={open}
|
||||||
|
onOpenChange={(isOpen) => setOpen(isOpen)}
|
||||||
selected={[type]}
|
selected={[type]}
|
||||||
onSelect={(_, value) => {
|
onSelect={(_, value) => {
|
||||||
onSelect(
|
onSelect(
|
||||||
|
|
|
@ -125,6 +125,7 @@ export const DownloadDialog = ({
|
||||||
>
|
>
|
||||||
<Select
|
<Select
|
||||||
isOpen={openType}
|
isOpen={openType}
|
||||||
|
onOpenChange={(isOpen) => setOpenType(isOpen)}
|
||||||
toggle={(ref) => (
|
toggle={(ref) => (
|
||||||
<MenuToggle
|
<MenuToggle
|
||||||
id="type"
|
id="type"
|
||||||
|
|
|
@ -62,6 +62,7 @@ export const HelpHeader = () => {
|
||||||
popperProps={{
|
popperProps={{
|
||||||
position: "right",
|
position: "right",
|
||||||
}}
|
}}
|
||||||
|
onOpenChange={(isOpen) => setOpen(isOpen)}
|
||||||
isOpen={open}
|
isOpen={open}
|
||||||
toggle={(ref) => (
|
toggle={(ref) => (
|
||||||
<MenuToggle
|
<MenuToggle
|
||||||
|
|
|
@ -50,6 +50,7 @@ export const KeycloakCard = ({
|
||||||
popperProps={{
|
popperProps={{
|
||||||
position: "right",
|
position: "right",
|
||||||
}}
|
}}
|
||||||
|
onOpenChange={onDropdownToggle}
|
||||||
toggle={(ref: React.Ref<MenuToggleElement>) => (
|
toggle={(ref: React.Ref<MenuToggleElement>) => (
|
||||||
<MenuToggle
|
<MenuToggle
|
||||||
ref={ref}
|
ref={ref}
|
||||||
|
|
|
@ -162,6 +162,7 @@ export const RealmSelector = () => {
|
||||||
id="realm-select"
|
id="realm-select"
|
||||||
className="keycloak__realm_selector__dropdown"
|
className="keycloak__realm_selector__dropdown"
|
||||||
isOpen={open}
|
isOpen={open}
|
||||||
|
onOpenChange={(isOpen) => setOpen(isOpen)}
|
||||||
toggle={(ref) => (
|
toggle={(ref) => (
|
||||||
<MenuToggle
|
<MenuToggle
|
||||||
ref={ref}
|
ref={ref}
|
||||||
|
|
|
@ -144,6 +144,7 @@ export const AddRoleMappingModal = ({
|
||||||
canViewRealmRoles && (
|
canViewRealmRoles && (
|
||||||
<ToolbarItem>
|
<ToolbarItem>
|
||||||
<Dropdown
|
<Dropdown
|
||||||
|
onOpenChange={(isOpen) => setSearchToggle(isOpen)}
|
||||||
onSelect={() => {
|
onSelect={() => {
|
||||||
setFilterType(filterType === "roles" ? "clients" : "roles");
|
setFilterType(filterType === "roles" ? "clients" : "roles");
|
||||||
setSearchToggle(false);
|
setSearchToggle(false);
|
||||||
|
|
|
@ -169,6 +169,7 @@ export function UserDataTableToolbarItems({
|
||||||
) : (
|
) : (
|
||||||
<ToolbarItem>
|
<ToolbarItem>
|
||||||
<Dropdown
|
<Dropdown
|
||||||
|
onOpenChange={(isOpen) => setKebabOpen(isOpen)}
|
||||||
toggle={(ref) => (
|
toggle={(ref) => (
|
||||||
<MenuToggle
|
<MenuToggle
|
||||||
ref={ref}
|
ref={ref}
|
||||||
|
|
|
@ -110,6 +110,7 @@ export const UserSelect = ({
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<Select
|
<Select
|
||||||
id={name!}
|
id={name!}
|
||||||
|
onOpenChange={toggleOpen}
|
||||||
toggle={(ref) => (
|
toggle={(ref) => (
|
||||||
<MenuToggle
|
<MenuToggle
|
||||||
data-testid={name!}
|
data-testid={name!}
|
||||||
|
|
|
@ -152,6 +152,7 @@ export const ViewHeader = ({
|
||||||
popperProps={{
|
popperProps={{
|
||||||
position: "right",
|
position: "right",
|
||||||
}}
|
}}
|
||||||
|
onOpenChange={onDropdownToggle}
|
||||||
toggle={(ref) => (
|
toggle={(ref) => (
|
||||||
<MenuToggle
|
<MenuToggle
|
||||||
ref={ref}
|
ref={ref}
|
||||||
|
@ -195,6 +196,7 @@ export const ViewHeader = ({
|
||||||
{lowerDropdownItems && (
|
{lowerDropdownItems && (
|
||||||
<Dropdown
|
<Dropdown
|
||||||
className="keycloak__user-federation__dropdown"
|
className="keycloak__user-federation__dropdown"
|
||||||
|
onOpenChange={onLowerDropdownToggle}
|
||||||
toggle={(ref) => (
|
toggle={(ref) => (
|
||||||
<MenuToggle
|
<MenuToggle
|
||||||
ref={ref}
|
ref={ref}
|
||||||
|
|
|
@ -213,6 +213,7 @@ export const Members = () => {
|
||||||
</ToolbarItem>
|
</ToolbarItem>
|
||||||
<ToolbarItem>
|
<ToolbarItem>
|
||||||
<Dropdown
|
<Dropdown
|
||||||
|
onOpenChange={(isOpen) => setIsKebabOpen(isOpen)}
|
||||||
toggle={(ref) => (
|
toggle={(ref) => (
|
||||||
<MenuToggle
|
<MenuToggle
|
||||||
ref={ref}
|
ref={ref}
|
||||||
|
|
|
@ -45,6 +45,7 @@ export const GroupToolbar = ({
|
||||||
</ToolbarItem>
|
</ToolbarItem>
|
||||||
<ToolbarItem>
|
<ToolbarItem>
|
||||||
<Dropdown
|
<Dropdown
|
||||||
|
onOpenChange={toggleKebab}
|
||||||
toggle={(ref) => (
|
toggle={(ref) => (
|
||||||
<MenuToggle
|
<MenuToggle
|
||||||
ref={ref}
|
ref={ref}
|
||||||
|
|
|
@ -107,6 +107,7 @@ const GroupTreeContextMenu = ({
|
||||||
popperProps={{
|
popperProps={{
|
||||||
position: "right",
|
position: "right",
|
||||||
}}
|
}}
|
||||||
|
onOpenChange={toggleOpen}
|
||||||
toggle={(ref) => (
|
toggle={(ref) => (
|
||||||
<MenuToggle
|
<MenuToggle
|
||||||
ref={ref}
|
ref={ref}
|
||||||
|
|
|
@ -251,6 +251,7 @@ export default function IdentityProvidersSection() {
|
||||||
<ToolbarItem>
|
<ToolbarItem>
|
||||||
<Dropdown
|
<Dropdown
|
||||||
data-testid="addProviderDropdown"
|
data-testid="addProviderDropdown"
|
||||||
|
onOpenChange={(isOpen) => setAddProviderOpen(isOpen)}
|
||||||
toggle={(ref) => (
|
toggle={(ref) => (
|
||||||
<MenuToggle
|
<MenuToggle
|
||||||
ref={ref}
|
ref={ref}
|
||||||
|
|
|
@ -120,6 +120,7 @@ export const IdentityProviderSelect = ({
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<Select
|
<Select
|
||||||
id={name!}
|
id={name!}
|
||||||
|
onOpenChange={toggleOpen}
|
||||||
toggle={(ref) => (
|
toggle={(ref) => (
|
||||||
<MenuToggle
|
<MenuToggle
|
||||||
data-testid={name!}
|
data-testid={name!}
|
||||||
|
|
|
@ -111,6 +111,7 @@ export const Members = () => {
|
||||||
<>
|
<>
|
||||||
<ToolbarItem>
|
<ToolbarItem>
|
||||||
<Dropdown
|
<Dropdown
|
||||||
|
onOpenChange={toggle}
|
||||||
toggle={(ref) => (
|
toggle={(ref) => (
|
||||||
<MenuToggle
|
<MenuToggle
|
||||||
ref={ref}
|
ref={ref}
|
||||||
|
|
|
@ -172,6 +172,7 @@ export const DefaultsGroupsTab = () => {
|
||||||
</ToolbarItem>
|
</ToolbarItem>
|
||||||
<ToolbarItem>
|
<ToolbarItem>
|
||||||
<Dropdown
|
<Dropdown
|
||||||
|
onOpenChange={toggleKebab}
|
||||||
toggle={(ref) => (
|
toggle={(ref) => (
|
||||||
<MenuToggle
|
<MenuToggle
|
||||||
ref={ref}
|
ref={ref}
|
||||||
|
|
|
@ -384,6 +384,7 @@ export const RealmOverrides = ({
|
||||||
</Button>
|
</Button>
|
||||||
<ToolbarItem>
|
<ToolbarItem>
|
||||||
<Dropdown
|
<Dropdown
|
||||||
|
onOpenChange={(isOpen) => setKebabOpen(isOpen)}
|
||||||
toggle={(ref) => (
|
toggle={(ref) => (
|
||||||
<MenuToggle
|
<MenuToggle
|
||||||
ref={ref}
|
ref={ref}
|
||||||
|
|
|
@ -43,6 +43,7 @@ export const SearchDropdown = ({
|
||||||
return (
|
return (
|
||||||
<Dropdown
|
<Dropdown
|
||||||
className="keycloak__users__searchtype"
|
className="keycloak__users__searchtype"
|
||||||
|
onOpenChange={(isOpen) => setSearchToggle(isOpen)}
|
||||||
toggle={(ref) => (
|
toggle={(ref) => (
|
||||||
<MenuToggle
|
<MenuToggle
|
||||||
ref={ref}
|
ref={ref}
|
||||||
|
|
|
@ -94,6 +94,7 @@ export const CredentialRow = ({
|
||||||
popperProps={{
|
popperProps={{
|
||||||
position: "right",
|
position: "right",
|
||||||
}}
|
}}
|
||||||
|
onOpenChange={toggleKebab}
|
||||||
toggle={(ref) => (
|
toggle={(ref) => (
|
||||||
<MenuToggle
|
<MenuToggle
|
||||||
ref={ref}
|
ref={ref}
|
||||||
|
|
|
@ -28,6 +28,7 @@ export const KeycloakDropdown = ({
|
||||||
popperProps={{
|
popperProps={{
|
||||||
position: "right",
|
position: "right",
|
||||||
}}
|
}}
|
||||||
|
onOpenChange={(isOpen) => setOpen(isOpen)}
|
||||||
toggle={(ref) => (
|
toggle={(ref) => (
|
||||||
<MenuToggle
|
<MenuToggle
|
||||||
data-testid={`${rest["data-testid"]}-toggle`}
|
data-testid={`${rest["data-testid"]}-toggle`}
|
||||||
|
|
|
@ -54,7 +54,7 @@ export const SingleSelect = ({
|
||||||
}}
|
}}
|
||||||
{...props}
|
{...props}
|
||||||
onClick={toggle}
|
onClick={toggle}
|
||||||
onOpenChange={() => setOpen(false)}
|
onOpenChange={(isOpen) => setOpen(isOpen)}
|
||||||
selected={selections}
|
selected={selections}
|
||||||
onSelect={(_, value) => {
|
onSelect={(_, value) => {
|
||||||
onSelect?.(value || "");
|
onSelect?.(value || "");
|
||||||
|
|
|
@ -113,7 +113,7 @@ export const TypeaheadSelect = ({
|
||||||
<Select
|
<Select
|
||||||
{...rest}
|
{...rest}
|
||||||
onClick={toggle}
|
onClick={toggle}
|
||||||
onOpenChange={() => onToggle?.(false)}
|
onOpenChange={(isOpen) => onToggle?.(isOpen)}
|
||||||
onSelect={(_, value) => onSelect?.(value || "")}
|
onSelect={(_, value) => onSelect?.(value || "")}
|
||||||
maxMenuHeight={propertyToString(maxHeight)}
|
maxMenuHeight={propertyToString(maxHeight)}
|
||||||
popperProps={{ direction, width: propertyToString(width) }}
|
popperProps={{ direction, width: propertyToString(width) }}
|
||||||
|
|
Loading…
Reference in a new issue