// ../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/button/button-base.tsx
import { Fragment, jsx as jsx4, jsxs as jsxs2 } from "preact/jsx-runtime";
var InnerButton = ({ text, isIconButton = false, attributes, icon, loadingHtml }) => {
  let optionalHtml;
  if (!isIconButton && attributes["aria-label"]) {
    optionalHtml = /* @__PURE__ */ jsx4("span", { "aria-hidden": "true", children: text });
  } else if (!isIconButton) {
    optionalHtml = /* @__PURE__ */ jsx4("span", { children: text });
  }
  return /* @__PURE__ */ jsxs2(Fragment, { children: [
    optionalHtml,
    icon,
    loadingHtml
  ] });
};
var ToggleWrapper = ({
  selected = false,
  disabled = false,
  attributes,
  classes,
  onChild,
  offChild,
  loadingHtml
}) => {
  return /* @__PURE__ */ jsxs2("button", { type: "button", role: "switch", "aria-checked": selected, className: classes, ...attributes, disabled, children: [
    /* @__PURE__ */ jsx4("span", { className: "ds-btn__off", "aria-hidden": "true", children: onChild }),
    /* @__PURE__ */ jsx4("span", { className: "ds-btn__on", "aria-hidden": "true", children: offChild }),
    loadingHtml
  ] });
};
var ButtonBase = ({
  text,
  disabled = false,
  variant = "primary",
  size = "md",
  fullWidth = false,
  mobileFullWidth = false,
  iconPosition = "none",
  iconName,
  loading = false,
  type = "button",
  href,
  classNames,
  attributes = {},
  forcePx = false,
  isIconButton = false,
  selected = false,
  isToggle = false,
  selectedIconName,
  selectedText
}) => {
  if (isIconButton && text && !attributes["aria-label"]) {
    attributes["aria-label"] = text;
  } else if (isToggle && text && selectedText && !attributes["aria-label"]) {
    attributes["aria-label"] = selected ? selectedText : text;
  }
  let spinnerVariant = "secondary";
  if (variant === "staticWhite" || variant === "transparent") {
    spinnerVariant = "staticBlack";
  } else if (variant === "secondaryFilled" || variant === "secondaryOutline") {
    spinnerVariant = "primary";
  }
  const loadingHtml = /* @__PURE__ */ jsx4(Spinner, { ...{ size: "small", variant: spinnerVariant, forcePx, attributes: { "aria-hidden": "true" } } });
  let icon;
  if (iconName && (iconPosition != "none" || isIconButton == true)) {
    icon = /* @__PURE__ */ jsx4(IconUse, { ...{ iconName, attributes: { "aria-hidden": "true" } } });
  }
  const classNamePrefix = "ds-btn--";
  const classes = formatClassString([
    "ds-btn",
    `${classNamePrefix}${variant}`,
    `${classNamePrefix}${size}`,
    isToggle && selected && `${classNamePrefix}selected`,
    fullWidth && `${classNamePrefix}full-width`,
    mobileFullWidth && `${classNamePrefix}mobile-full-width`,
    icon && !isIconButton && `${classNamePrefix}icon-${iconPosition}`,
    isIconButton && `${classNamePrefix}icon-only`,
    isToggle && `${classNamePrefix}toggle`,
    loading && "ds-loading",
    forcePx && "ds-force-px",
    classNames
  ]);
  let buttonToRender;
  if (isToggle) {
    let onChild, offChild;
    if (isIconButton && iconName && selectedIconName) {
      onChild = /* @__PURE__ */ jsx4(IconUse, { iconName });
      offChild = /* @__PURE__ */ jsx4(IconUse, { iconName: selectedIconName });
    } else {
      onChild = /* @__PURE__ */ jsx4("span", { children: text });
      offChild = /* @__PURE__ */ jsxs2(Fragment, { children: [
        /* @__PURE__ */ jsx4(IconUse, { iconName: "check" }),
        /* @__PURE__ */ jsx4("span", { children: selectedText })
      ] });
    }
    buttonToRender = /* @__PURE__ */ jsx4(ToggleWrapper, { ...{ selected, classes, attributes, disabled, onChild, offChild, loadingHtml } });
  } else {
    const buttonParams = { isIconButton, text, icon, loadingHtml, attributes };
    if (href) {
      const params = { ...buttonParams, loadingHtml: null };
      buttonToRender = /* @__PURE__ */ jsx4("a", { href, className: classes, ...attributes, children: /* @__PURE__ */ jsx4(InnerButton, { ...params }) });
    } else {
      buttonToRender = /* @__PURE__ */ jsx4("button", { type, className: classes, ...attributes, disabled, children: /* @__PURE__ */ jsx4(InnerButton, { ...buttonParams }) });
    }
  }
  return /* @__PURE__ */ jsx4(Fragment, { children: buttonToRender });
};

// ../src/components/button/button.tsx
import { jsx as jsx5 } from "preact/jsx-runtime";
var Button = ({
  text,
  disabled = false,
  variant = "primary",
  size = "md",
  fullWidth = false,
  mobileFullWidth = false,
  iconPosition = "none",
  iconName,
  loading = false,
  type = "button",
  href,
  isIconButton = false,
  classNames,
  attributes,
  forcePx = false
}) => {
  return /* @__PURE__ */ jsx5(
    ButtonBase,
    {
      ...{
        text,
        disabled,
        variant,
        size,
        fullWidth,
        mobileFullWidth,
        iconPosition,
        iconName,
        loading,
        type,
        href,
        isIconButton,
        classNames,
        attributes,
        forcePx
      }
    }
  );
};
var button_default = Button;

// ../src/components/pictogram/pictogram.tsx
import { jsx as jsx6 } from "preact/jsx-runtime";
var Pictogram = ({
  variant = "brand",
  iconName,
  size = "small",
  classNames,
  attributes,
  forcePx
}) => {
  const componentClassName = "ds-pictogram";
  const classes = formatClassString([
    componentClassName,
    `${componentClassName}--${variant}`,
    `${componentClassName}--${size}`,
    forcePx && "ds-force-px",
    classNames
  ]);
  return /* @__PURE__ */ jsx6("div", { className: classes, ...attributes, "aria-hidden": "true", children: /* @__PURE__ */ jsx6(IconUse, { iconName }) });
};

// ../src/components/empty-state/empty-state.tsx
import { jsx as jsx7, jsxs as jsxs3 } from "preact/jsx-runtime";
var EmptyState = ({
  iconName,
  title,
  body,
  brandButton,
  primaryButton,
  classNames,
  attributes,
  forcePx
}) => {
  const componentClassName = "ds-empty-state";
  const classes = formatClassString([componentClassName, forcePx && "ds-force-px", classNames]);
  const hasButtons = brandButton || primaryButton;
  const hasText = title || body;
  const hasIcon = iconName;
  return /* @__PURE__ */ jsxs3("div", { className: classes, ...attributes, children: [
    hasIcon && /* @__PURE__ */ jsx7(
      Pictogram,
      {
        variant: "brand",
        size: "large",
        iconName,
        forcePx,
        attributes: { "aria-hidden": "true" }
      }
    ),
    hasText && /* @__PURE__ */ jsxs3("div", { className: `${componentClassName}__text`, children: [
      title && /* @__PURE__ */ jsx7("h2", { children: title }),
      body && /* @__PURE__ */ jsx7("span", { className: `${componentClassName}__body`, children: body })
    ] }),
    hasButtons && /* @__PURE__ */ jsxs3("div", { className: `${componentClassName}__button-wrapper`, children: [
      brandButton && /* @__PURE__ */ jsx7(
        button_default,
        {
          text: brandButton.text,
          size: "lg",
          variant: "primary",
          href: brandButton.href,
          classNames: brandButton.classNames,
          attributes: brandButton.attributes,
          forcePx,
          fullWidth: true
        }
      ),
      primaryButton && /* @__PURE__ */ jsx7(
        button_default,
        {
          text: primaryButton.text,
          size: "lg",
          variant: "secondaryOutline",
          href: primaryButton.href,
          classNames: primaryButton.classNames,
          attributes: primaryButton.attributes,
          forcePx,
          fullWidth: true
        }
      )
    ] })
  ] });
};
export {
  EmptyState
};
//# sourceMappingURL=empty-state.js.map
