@homebound/beam 3.33.1 → 3.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -21797,24 +21797,32 @@ function Tag(props) {
21797
21797
  type,
21798
21798
  xss,
21799
21799
  preventTooltip = false,
21800
+ iconOnly,
21801
+ icon,
21800
21802
  ...otherProps
21801
21803
  } = props;
21802
- const typeStyles2 = getStyles(type);
21804
+ const isIconOnly = !!iconOnly && !!icon;
21805
+ const {
21806
+ background,
21807
+ iconColor
21808
+ } = getStyles(type);
21803
21809
  const tid = useTestIds(otherProps);
21804
21810
  const [showTooltip, setShowTooltip] = (0, import_react116.useState)(false);
21805
21811
  const ref = (0, import_react116.useRef)(null);
21806
21812
  (0, import_utils129.useResizeObserver)({
21807
21813
  ref,
21808
21814
  onResize: () => {
21809
- if (ref.current) {
21815
+ if (!isIconOnly && ref.current) {
21810
21816
  setShowTooltip(ref.current.offsetHeight < ref.current.scrollHeight);
21811
21817
  }
21812
21818
  }
21813
21819
  });
21820
+ const tooltipTitle = !preventTooltip ? isIconOnly ? text : showTooltip ? text : void 0 : void 0;
21814
21821
  return maybeTooltip({
21815
- title: !preventTooltip && showTooltip ? text : void 0,
21822
+ title: tooltipTitle,
21816
21823
  children: /* @__PURE__ */ (0, import_jsx_runtime161.jsxs)("span", { ...tid, ...(0, import_runtime85.trussProps)({
21817
21824
  ...{
21825
+ position: "relative",
21818
21826
  display: "dif",
21819
21827
  fontWeight: "fw6",
21820
21828
  fontSize: "fz_10px",
@@ -21822,18 +21830,23 @@ function Tag(props) {
21822
21830
  textTransform: "ttu",
21823
21831
  alignItems: "aic",
21824
21832
  gap: "gap_4px",
21825
- paddingLeft: "pl_6px",
21826
- paddingRight: "pr_6px",
21827
21833
  paddingTop: "pt_2px",
21828
21834
  paddingBottom: "pb_2px",
21829
21835
  color: "gray900",
21830
21836
  borderRadius: "br4"
21831
21837
  },
21832
- ...typeStyles2,
21838
+ ...isIconOnly ? {
21839
+ paddingLeft: "pl_2px",
21840
+ paddingRight: "pr_2px"
21841
+ } : {
21842
+ paddingLeft: "pl_6px",
21843
+ paddingRight: "pr_6px"
21844
+ },
21845
+ ...background,
21833
21846
  ...xss
21834
21847
  }), children: [
21835
- otherProps.icon && /* @__PURE__ */ (0, import_jsx_runtime161.jsx)("span", { className: "fs0", children: /* @__PURE__ */ (0, import_jsx_runtime161.jsx)(Icon, { icon: otherProps.icon, inc: 1.5 }) }),
21836
- /* @__PURE__ */ (0, import_jsx_runtime161.jsx)("span", { ref, className: "oh d_negwebkit_box wbo_vertical to_ellipsis wlc_1 wbba", children: text })
21848
+ icon && /* @__PURE__ */ (0, import_jsx_runtime161.jsx)("span", { className: "fs0", children: /* @__PURE__ */ (0, import_jsx_runtime161.jsx)(Icon, { icon, inc: 1.75, color: iconColor }) }),
21849
+ isIconOnly ? /* @__PURE__ */ (0, import_jsx_runtime161.jsx)("span", { className: "absolute oh cli_inset_50 clp_none bd_0 h_1px m_neg1px w_1px p_0 wsnw o0", children: text }) : /* @__PURE__ */ (0, import_jsx_runtime161.jsx)("span", { ref, className: "oh d_negwebkit_box wbo_vertical to_ellipsis wlc_1 wbba", children: text })
21837
21850
  ] })
21838
21851
  });
21839
21852
  }
@@ -21841,23 +21854,38 @@ function getStyles(type) {
21841
21854
  switch (type) {
21842
21855
  case "info":
21843
21856
  return {
21844
- backgroundColor: "bgBlue100"
21857
+ background: {
21858
+ backgroundColor: "bgBlue100"
21859
+ },
21860
+ iconColor: "rgba(37, 99, 235, 1)" /* Blue600 */
21845
21861
  };
21846
21862
  case "caution":
21847
21863
  return {
21848
- backgroundColor: "bgYellow200"
21864
+ background: {
21865
+ backgroundColor: "bgYellow200"
21866
+ },
21867
+ iconColor: "rgba(161, 98, 7, 1)" /* Yellow700 */
21849
21868
  };
21850
21869
  case "warning":
21851
21870
  return {
21852
- backgroundColor: "bgRed200"
21871
+ background: {
21872
+ backgroundColor: "bgRed200"
21873
+ },
21874
+ iconColor: "rgba(194, 65, 12, 1)" /* Orange700 */
21853
21875
  };
21854
21876
  case "success":
21855
21877
  return {
21856
- backgroundColor: "bgGreen200"
21878
+ background: {
21879
+ backgroundColor: "bgGreen200"
21880
+ },
21881
+ iconColor: "rgba(5, 150, 105, 1)" /* Green600 */
21857
21882
  };
21858
21883
  default:
21859
21884
  return {
21860
- backgroundColor: "bgGray200"
21885
+ background: {
21886
+ backgroundColor: "bgGray200"
21887
+ },
21888
+ iconColor: "rgba(100, 100, 100, 1)" /* Gray700 */
21861
21889
  };
21862
21890
  }
21863
21891
  }