// ../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/assets/form-field/form-field.tsx
import { jsx as jsx3, jsxs as jsxs2 } from "preact/jsx-runtime";
var FormField = ({
  error,
  errorMessage,
  wrapperClasses,
  helpHtml,
  helpText,
  type,
  children
}) => {
  const classes = formatClassString([
    "ds-form-field",
    wrapperClasses,
    error && `ds-form-field__error`,
    type === "hidden" && "hidden"
  ]);
  const showHelp = helpHtml || helpText;
  return /* @__PURE__ */ jsxs2("div", { className: classes, children: [
    children,
    errorMessage && /* @__PURE__ */ jsxs2("div", { className: "ds-form-field__error-message js-field-error", children: [
      /* @__PURE__ */ jsx3(IconUse, { iconName: "info-filled" }),
      /* @__PURE__ */ jsx3("span", { children: errorMessage })
    ] }),
    showHelp && /* @__PURE__ */ jsx3("p", { className: "ds-form-field__help-text", children: helpHtml ? helpHtml : helpText })
  ] });
};
var form_field_default = FormField;

// ../src/components/checkbox/checkbox.tsx
import { jsx as jsx4, jsxs as jsxs3 } from "preact/jsx-runtime";
var Checkbox = ({
  error,
  errorMessage,
  label,
  stripLabel,
  name = "ds-checkbox",
  validation,
  checked,
  required,
  disabled,
  forcePx,
  classNames,
  attributes
}) => {
  const componentClassName = "ds-checkbox";
  const wrapperClasses = formatClassString([componentClassName, forcePx && "ds-force-px", classNames]);
  return /* @__PURE__ */ jsxs3(form_field_default, { error, errorMessage: label && errorMessage, wrapperClasses, children: [
    /* @__PURE__ */ jsx4(
      "input",
      {
        type: "checkbox",
        id: name,
        name,
        className: `${componentClassName}__input js-field-error`,
        "data-validation": validation,
        ...attributes,
        defaultChecked: checked,
        disabled,
        required
      }
    ),
    stripLabel ? /* @__PURE__ */ jsx4("div", { className: `${componentClassName}__inner`, children: /* @__PURE__ */ jsx4(CheckboxIcons, { componentClassName }) }) : /* @__PURE__ */ jsxs3("label", { className: `${componentClassName}__inner`, htmlFor: name, children: [
      /* @__PURE__ */ jsx4(CheckboxIcons, { componentClassName }),
      label && /* @__PURE__ */ jsx4("span", { className: `${componentClassName}__text`, children: label })
    ] })
  ] });
};
var CheckboxIcons = ({ componentClassName }) => {
  return /* @__PURE__ */ jsxs3("span", { className: `${componentClassName}__icon`, children: [
    /* @__PURE__ */ jsx4(IconUse, { iconName: "check_box_outline_blank" }),
    /* @__PURE__ */ jsx4(IconUse, { iconName: "check_box-filled" })
  ] });
};
var checkbox_default = Checkbox;
export {
  Checkbox,
  checkbox_default as default
};
//# sourceMappingURL=checkbox.js.map
