// ../src/helpers/formatClassString.ts
var formatClassString = (classesArray) => {
  return classesArray.filter((x) => !!x).join(" ");
};

// ../src/foundations/icons/sprite.svg
import { h } from "preact";
import { jsx, jsxs } from "preact/jsx-runtime";

// ../src/components/icon-sprite/icon-sprite.tsx
import { jsx as jsx2 } from "preact/jsx-runtime";
var IconUse = ({ iconName, classNames, attributes }) => {
  const componentClassName = "ds-icon";
  const classes = formatClassString([
    componentClassName,
    `${componentClassName}--sprite`,
    `${componentClassName}--${iconName}`,
    classNames
  ]);
  return /* @__PURE__ */ jsx2("i", { className: classes, ...attributes, children: /* @__PURE__ */ jsx2("svg", { children: /* @__PURE__ */ jsx2("use", { xlinkHref: `#ds-${iconName}` }) }) });
};

// ../src/components/spinner/spinner.tsx
import { jsx as jsx3 } from "preact/jsx-runtime";
var Spinner = ({ variant = "primary", size = "large", forcePx, classNames, attributes }) => {
  const componentClassName = "ds-spinner";
  const classes = formatClassString([
    `${componentClassName}`,
    `${componentClassName}--${variant}`,
    `${componentClassName}--${size}`,
    forcePx && "ds-force-px",
    classNames
  ]);
  return /* @__PURE__ */ jsx3("span", { className: classes, ...attributes, children: /* @__PURE__ */ jsx3("span", { className: `${componentClassName}__inner` }) });
};

// ../src/components/text-button-toggle/text-button-toggle.tsx
import { jsx as jsx4, jsxs as jsxs2 } from "preact/jsx-runtime";
var TextButtonToggle = ({
  selected = false,
  text,
  selectedText,
  iconName,
  selectedIconName,
  disabled = false,
  loading = false,
  type = "button",
  classNames,
  attributes = {},
  forcePx = false
}) => {
  const componentClassName = "ds-text-btn-toggle";
  const ariaLabel = String(attributes["aria-label"]) || text;
  const classes = formatClassString([
    componentClassName,
    forcePx && "force-px",
    loading && "ds-loading",
    selected && `${componentClassName}--selected`,
    classNames
  ]);
  return /* @__PURE__ */ jsxs2(
    "button",
    {
      type,
      role: "switch",
      "aria-label": ariaLabel,
      "aria-checked": selected,
      className: classes,
      disabled,
      "data-force-px": forcePx,
      ...attributes,
      children: [
        /* @__PURE__ */ jsxs2("span", { className: `${componentClassName}__off`, "aria-hidden": "true", children: [
          /* @__PURE__ */ jsx4(IconUse, { iconName }),
          /* @__PURE__ */ jsx4("span", { className: `${componentClassName}__text`, children: text })
        ] }),
        /* @__PURE__ */ jsxs2("span", { className: `${componentClassName}__on`, "aria-hidden": "true", children: [
          /* @__PURE__ */ jsx4(IconUse, { iconName: selectedIconName }),
          /* @__PURE__ */ jsx4("span", { className: `${componentClassName}__text`, children: selectedText })
        ] }),
        /* @__PURE__ */ jsx4(Spinner, { size: "small", variant: "primary", forcePx, "aria-hidden": "true" })
      ]
    }
  );
};
export {
  TextButtonToggle
};
//# sourceMappingURL=text-button-toggle.js.map
