achery-ui 0.18.0 → 0.20.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
@@ -1680,9 +1680,10 @@ function Badge({
1680
1680
  }
1681
1681
  );
1682
1682
  }
1683
- var button = createRuntimeFn.createRuntimeFn({ defaultClassName: "Button_button__1torrqc2", variantClassNames: { variant: { primary: "Button_button_variant_primary__1torrqc3", secondary: "Button_button_variant_secondary__1torrqc4", accent: "Button_button_variant_accent__1torrqc5", ghost: "Button_button_variant_ghost__1torrqc6", danger: "Button_button_variant_danger__1torrqc7" }, size: { sm: "Button_button_size_sm__1torrqc8", md: "Button_button_size_md__1torrqc9" } }, defaultVariants: { variant: "secondary", size: "md" }, compoundVariants: [] });
1684
- var kbdHint = "Button_kbdHint__1torrqca";
1683
+ var button = createRuntimeFn.createRuntimeFn({ defaultClassName: "Button_button__1torrqc2", variantClassNames: { variant: { primary: "Button_button_variant_primary__1torrqc3", secondary: "Button_button_variant_secondary__1torrqc4", accent: "Button_button_variant_accent__1torrqc5", ghost: "Button_button_variant_ghost__1torrqc6", danger: "Button_button_variant_danger__1torrqc7" }, size: { sm: "Button_button_size_sm__1torrqc8", md: "Button_button_size_md__1torrqc9", lg: "Button_button_size_lg__1torrqca" } }, defaultVariants: { variant: "secondary", size: "md" }, compoundVariants: [] });
1684
+ var kbdHint = "Button_kbdHint__1torrqcb";
1685
1685
  var spinner = "Button_spinner__1torrqc1";
1686
+ var buttonClassName = ({ variant = "secondary", size = "md" } = {}) => button({ variant, size });
1686
1687
  function Button({
1687
1688
  variant = "secondary",
1688
1689
  size = "md",
@@ -1693,28 +1694,43 @@ function Button({
1693
1694
  loadingLabel = "Loading\u2026",
1694
1695
  children,
1695
1696
  className,
1696
- ...props
1697
+ ...elementProps
1697
1698
  }) {
1698
1699
  const glyphSize = size === "sm" ? 12 : 14;
1700
+ const classes = [buttonClassName({ variant, size }), className].filter(Boolean).join(" ");
1701
+ const content3 = loading ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1702
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: spinner, "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(Glyph, { name: "spinner", size: glyphSize }) }),
1703
+ loadingLabel
1704
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1705
+ glyph2 && glyphPosition === "start" && /* @__PURE__ */ jsxRuntime.jsx(Glyph, { name: glyph2, size: glyphSize, "aria-hidden": "true" }),
1706
+ children,
1707
+ glyph2 && glyphPosition === "end" && /* @__PURE__ */ jsxRuntime.jsx(Glyph, { name: glyph2, size: glyphSize, "aria-hidden": "true" }),
1708
+ kbd && /* @__PURE__ */ jsxRuntime.jsx("span", { className: kbdHint, children: kbd })
1709
+ ] });
1710
+ if (isLinkProps(elementProps)) {
1711
+ return /* @__PURE__ */ jsxRuntime.jsx(
1712
+ "a",
1713
+ {
1714
+ ...elementProps,
1715
+ className: classes,
1716
+ "aria-busy": loading || void 0,
1717
+ "aria-disabled": loading || elementProps["aria-disabled"] || void 0,
1718
+ children: content3
1719
+ }
1720
+ );
1721
+ }
1699
1722
  return /* @__PURE__ */ jsxRuntime.jsx(
1700
1723
  "button",
1701
1724
  {
1702
- className: [button({ variant, size }), className].filter(Boolean).join(" "),
1703
- disabled: loading || props.disabled,
1725
+ ...elementProps,
1726
+ className: classes,
1727
+ disabled: loading || elementProps.disabled,
1704
1728
  "aria-busy": loading || void 0,
1705
- ...props,
1706
- children: loading ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1707
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: spinner, "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(Glyph, { name: "spinner", size: glyphSize }) }),
1708
- loadingLabel
1709
- ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1710
- glyph2 && glyphPosition === "start" && /* @__PURE__ */ jsxRuntime.jsx(Glyph, { name: glyph2, size: glyphSize, "aria-hidden": "true" }),
1711
- children,
1712
- glyph2 && glyphPosition === "end" && /* @__PURE__ */ jsxRuntime.jsx(Glyph, { name: glyph2, size: glyphSize, "aria-hidden": "true" }),
1713
- kbd && /* @__PURE__ */ jsxRuntime.jsx("span", { className: kbdHint, children: kbd })
1714
- ] })
1729
+ children: content3
1715
1730
  }
1716
1731
  );
1717
1732
  }
1733
+ var isLinkProps = (props) => props.href !== void 0;
1718
1734
  var body2 = "Modal_body__1kcb5si8";
1719
1735
  var bodyScrollable = "Modal_bodyScrollable__1kcb5sie";
1720
1736
  var closeButton = "Modal_closeButton__1kcb5si7";
@@ -3621,6 +3637,7 @@ exports.ToastProvider = ToastProvider;
3621
3637
  exports.Toggle = Toggle;
3622
3638
  exports.Tooltip = Tooltip;
3623
3639
  exports.TypeTag = TypeTag;
3640
+ exports.buttonClassName = buttonClassName;
3624
3641
  exports.glyphCategory = glyphCategory;
3625
3642
  exports.glyphLabel = glyphLabel;
3626
3643
  exports.searchGlyphs = searchGlyphs;