2020-07-07 15:24:46 +01:00
|
|
|
/*
|
2024-09-09 14:57:16 +01:00
|
|
|
Copyright 2024 New Vector Ltd.
|
2020-07-07 15:24:46 +01:00
|
|
|
Copyright 2019 The Matrix.org Foundation C.I.C.
|
2024-09-09 14:57:16 +01:00
|
|
|
Copyright 2018 New Vector Ltd
|
|
|
|
|
Copyright 2015, 2016 OpenMarket Ltd
|
2020-07-07 15:24:46 +01:00
|
|
|
|
2025-01-06 11:18:54 +00:00
|
|
|
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
|
2024-09-09 14:57:16 +01:00
|
|
|
Please see LICENSE files in the repository root for full details.
|
2020-07-07 15:24:46 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import React from "react";
|
|
|
|
|
|
2021-12-17 11:08:56 -06:00
|
|
|
import { RovingAccessibleButton } from "../RovingTabIndex";
|
2020-07-07 15:24:46 +01:00
|
|
|
|
2021-12-17 11:08:56 -06:00
|
|
|
interface IProps extends React.ComponentProps<typeof RovingAccessibleButton> {
|
2020-07-07 15:24:46 +01:00
|
|
|
label?: string;
|
|
|
|
|
active: boolean;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Semantic component for representing a role=menuitemradio
|
2021-06-29 13:11:58 +01:00
|
|
|
export const MenuItemRadio: React.FC<IProps> = ({ children, label, active, disabled, ...props }) => {
|
2020-07-07 15:24:46 +01:00
|
|
|
return (
|
2021-12-17 11:08:56 -06:00
|
|
|
<RovingAccessibleButton
|
2020-07-07 15:24:46 +01:00
|
|
|
{...props}
|
|
|
|
|
role="menuitemradio"
|
|
|
|
|
aria-checked={active}
|
|
|
|
|
aria-disabled={disabled}
|
2020-07-07 15:32:20 +01:00
|
|
|
disabled={disabled}
|
2020-07-07 15:24:46 +01:00
|
|
|
aria-label={label}
|
|
|
|
|
>
|
|
|
|
|
{children}
|
2021-12-17 11:08:56 -06:00
|
|
|
</RovingAccessibleButton>
|
2020-07-07 15:24:46 +01:00
|
|
|
);
|
|
|
|
|
};
|