UNPKG

stone-kit

Version:
72 lines (71 loc) 2.05 kB
import { jsx as m, Fragment as h } from "react/jsx-runtime"; import { useState as y, useEffect as k } from "react"; import { c as S } from "../../../index-rKuIKazb.js"; import { NewIcon as R } from "../../NewIcon/ui/NewIcon.js"; import { sizeMap as n } from "./RoundButton.types.js"; const p = "_btnRound_g6d1n_1", F = "_whiteStroke_g6d1n_42", $ = "_blackFill_g6d1n_47", v = "_fullGray_g6d1n_52", e = { btnRound: p, "tiny-size": "_tiny-size_g6d1n_19", "small-size": "_small-size_g6d1n_25", "medium-size": "_medium-size_g6d1n_30", "large-size": "_large-size_g6d1n_36", whiteStroke: F, blackFill: $, fullGray: v, "tiny-size_m": "_tiny-size_m_g6d1n_61", "small-size_m": "_small-size_m_g6d1n_66", "medium-size_m": "_medium-size_m_g6d1n_70", "large-size_m": "_large-size_m_g6d1n_75", "tiny-size_l": "_tiny-size_l_g6d1n_96", "small-size_l": "_small-size_l_g6d1n_101", "medium-size_l": "_medium-size_l_g6d1n_105", "large-size_l": "_large-size_l_g6d1n_110" }, x = S.bind(e), j = ({ size: _ = "small", size_m: i, size_l: s, children: r = "", iconName: d = "", variant: a = "whiteStroke", additionalClass: z = "", additionalClassIcon: c = "", deg: g, ...o }) => { const [u, w] = y(n.small), { color: b = "#141416" } = o; return k(() => { const t = () => { const l = window.innerWidth, f = l > 1440 && s ? n[s] : l >= 1024 && l <= 1440 && i ? n[i] : n[_] || n.small; w(f); }; return window.addEventListener("resize", t), t(), () => { window.removeEventListener("resize", t); }; }, [_, i, s]), /* @__PURE__ */ m( "button", { className: x( e.btnRound, e[`${_}-size`], e[`${i}-size_m`], e[`${s}-size_l`], e[`${a}`], z ), ...o, children: /* @__PURE__ */ m(h, { children: d ? /* @__PURE__ */ m( R, { additionalClass: c, name: d, size: u, deg: g, color: b } ) : r }) } ); }; export { j as RoundButton };