mirror of
https://github.com/hanzoai/o11y-icons.git
synced 2026-11-02 14:02:40 +00:00
76 lines
2.6 KiB
TypeScript
76 lines
2.6 KiB
TypeScript
import type React from 'react';
|
|
import { cloneElement } from 'react';
|
|
import type { IconSize } from '../icon-config.js';
|
|
import { ICON_SIZE_MAP, STROKE_WIDTH_MAP } from '../icon-config.js';
|
|
export interface IconProps extends React.SVGProps<SVGSVGElement> {
|
|
size?: IconSize | number;
|
|
strokeWidth?: number;
|
|
className?: string;
|
|
}
|
|
const SvgLassoSelect = ({
|
|
color = 'currentColor',
|
|
size,
|
|
strokeWidth,
|
|
className,
|
|
...props
|
|
}: IconProps): React.ReactElement => {
|
|
const element = (
|
|
<svg width={16} height={16} fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>
|
|
<g clipPath="url(#lasso-select_svg__a)">
|
|
<path
|
|
d="M4.666 14.667A3.333 3.333 0 0 1 3.333 12m0 0a1.334 1.334 0 1 0 0-2.667 1.334 1.334 0 0 0 0 2.667Zm1.333-.713c.64.286 1.307.493 1.994.606m-4.434-2.56a4.533 4.533 0 0 1-.893-2.666C1.333 3.72 4.32 1.333 8 1.333c3.68 0 6.666 2.387 6.666 5.334A4.79 4.79 0 0 1 14.446 8m-4.893 6.667h-.06a.233.233 0 0 1-.16-.214V7.787a.227.227 0 0 1 .22-.227c.053 0 .1.02.14.053l4.893 4a.22.22 0 0 1-.01.355.221.221 0 0 1-.13.039h-2.993L9.74 14.573a.233.233 0 0 1-.187.094Z"
|
|
stroke="#2A2E37"
|
|
strokeWidth={1.33}
|
|
strokeLinecap="round"
|
|
strokeLinejoin="round"
|
|
/>
|
|
</g>
|
|
<defs>
|
|
<clipPath id="lasso-select_svg__a">
|
|
<path fill="#fff" d="M0 0h16v16H0z" />
|
|
</clipPath>
|
|
</defs>
|
|
</svg>
|
|
);
|
|
const hasViewBox = element.props.viewBox != null;
|
|
const isCustomIcon = element.props['data-custom-icon'] === 'true';
|
|
const defaultSize = isCustomIcon ? element.props.width : ICON_SIZE_MAP.xs;
|
|
const resolvedSize =
|
|
size != null ? (typeof size === 'number' ? size : ICON_SIZE_MAP[size]) : defaultSize;
|
|
const resolvedStrokeWidth =
|
|
strokeWidth != null
|
|
? strokeWidth
|
|
: typeof size === 'string' && size in STROKE_WIDTH_MAP
|
|
? STROKE_WIDTH_MAP[size]
|
|
: size == null
|
|
? STROKE_WIDTH_MAP.xs
|
|
: 2;
|
|
const w = element.props.width != null ? Number(element.props.width) : 24;
|
|
const h = element.props.height != null ? Number(element.props.height) : 24;
|
|
const viewBoxWhenMissing = `0 0 ${w} ${h}`;
|
|
const elementProps = {
|
|
...props,
|
|
className: className ? `signoz-icon ${className}` : 'signoz-icon',
|
|
...(!isCustomIcon && {
|
|
stroke: color,
|
|
strokeWidth: resolvedStrokeWidth,
|
|
}),
|
|
...(!isCustomIcon &&
|
|
!hasViewBox && {
|
|
viewBox: viewBoxWhenMissing,
|
|
}),
|
|
...(isCustomIcon && {
|
|
style: {
|
|
color,
|
|
...props.style,
|
|
},
|
|
viewBox: viewBoxWhenMissing,
|
|
}),
|
|
width: resolvedSize,
|
|
height: resolvedSize,
|
|
};
|
|
return cloneElement(element, elementProps);
|
|
};
|
|
SvgLassoSelect.displayName = 'SvgLassoSelect';
|
|
export default SvgLassoSelect;
|