UNPKG

@stratakit/react

Version:

A React component library for StrataKit

53 lines (52 loc) 1.29 kB
import { jsx } from "react/jsx-runtime"; import * as React from "react"; import { IconButton as SkIconButton } from "@stratakit/bricks"; import { Icon } from "@stratakit/foundations"; import { useCompatProps } from "./~utils.js"; const IconButton = React.forwardRef((props, forwardedRef) => { const { children, isActive, title, label = title, iconProps, styleType = "default", // PARTIALLY IMPLEMENTED htmlDisabled, // biome-ignore-start lint/correctness/noUnusedVariables: NOT IMPLEMENTED labelProps, size, // biome-ignore-end lint/correctness/noUnusedVariables: NOT IMPLEMENTED ...rest } = useCompatProps(props); const variant = React.useMemo(() => { if (styleType === "borderless") { return "ghost"; } return "solid"; }, [styleType]); const accessibleWhenDisabled = !htmlDisabled; return /* @__PURE__ */ jsx( SkIconButton, { ...rest, icon: /* @__PURE__ */ jsx( Icon, { ...iconProps, render: children } ), label, variant, isActive, accessibleWhenDisabled, disabled: props.disabled || htmlDisabled, ref: forwardedRef } ); }); DEV: IconButton.displayName = "IconButton"; export { IconButton };