@atlaskit/dropdown-menu
Version:
A dropdown menu displays a list of actions or options to a user.
90 lines (89 loc) • 2.73 kB
JavaScript
/* radio-icon.tsx generated by @compiled/babel-plugin v3.0.2 */
import "./radio-icon.compiled.css";
import { ax, ix } from "@compiled/react/runtime";
import React from 'react';
import { fg } from '@atlaskit/platform-feature-flags/fg';
const svgStyles = null;
const styles = {
svg: "_lcxvglyw"
};
function getFillColor(checked, disabled) {
if (disabled) {
if (checked) {
return "var(--ds-icon-disabled, #080F214A)";
} else {
return "var(--ds-background-input, #FFFFFF)";
}
}
if (checked) {
return "var(--ds-background-selected-bold, #1868DB)";
}
return "var(--ds-background-input, #FFFFFF)";
}
function getStrokeColor(checked, disabled) {
if (disabled) {
return "var(--ds-border-disabled, #0515240F)";
}
if (checked) {
return "var(--ds-border-selected, #1868DB)";
}
return "var(--ds-border-input, #8C8F97)";
}
/**
* __Radio icon__
*
* Used to visually represent the selected state in DropdownItemRadio
*
* @internal
*/
const RadioIcon = ({
checked,
disabled
}) => {
if (fg('platform-dst-new-menu')) {
return /*#__PURE__*/React.createElement("svg", {
width: "16",
height: "16",
viewBox: "0 0 16 16",
fill: "none",
className: ax([styles.svg])
}, /*#__PURE__*/React.createElement("path", {
d: "M15.5 8C15.5 12.1421 12.1421 15.5 8 15.5C3.85786 15.5 0.5 12.1421 0.5 8C0.5 3.85786 3.85786 0.5 8 0.5C12.1421 0.5 15.5 3.85786 15.5 8Z",
fill: getFillColor(checked, disabled),
stroke: getStrokeColor(checked, disabled)
}), /*#__PURE__*/React.createElement("circle", {
cx: "8",
cy: "8",
r: "3",
fill: checked ? "var(--ds-icon-inverse, #FFFFFF)" : 'transparent'
}));
}
return /*#__PURE__*/React.createElement("svg", {
width: 24,
height: 24,
viewBox: "0 0 24 24",
style: {
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
color: checked ? "var(--ds-background-selected-bold, #1868DB)" : "var(--ds-background-input, #FFFFFF)",
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
fill: checked ? "var(--ds-icon-inverse, #FFFFFF)" : 'transparent'
},
role: "presentation",
className: ax(["_1reo15vq _18m915vq _lswuvuon _lcxvglyw"])
}, /*#__PURE__*/React.createElement("g", {
fillRule: "evenodd"
}, /*#__PURE__*/React.createElement("circle", {
cx: "12",
cy: "12",
r: "7.5",
fill: "currentColor",
stroke: checked ? "var(--ds-border-selected, #1868DB)" : "var(--ds-border-input, #8C8F97)",
strokeWidth: "1"
}), /*#__PURE__*/React.createElement("circle", {
cx: "12",
cy: "12",
r: "3",
fill: "inherit"
})));
};
export default RadioIcon;