@norges-domstoler/dds-components 0.0.0-dev-20260119083800 → 0.0.0-dev-20260120080949

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.mjs CHANGED
@@ -3982,12 +3982,11 @@ var useButtonGroupContext = () => useContext4(ButtonGroupContext);
3982
3982
  // src/components/Button/Button.tsx
3983
3983
  import { Fragment as Fragment2, jsx as jsx198, jsxs as jsxs27 } from "react/jsx-runtime";
3984
3984
  var Button = ({
3985
+ as: propAs,
3985
3986
  children,
3986
3987
  purpose = "primary",
3987
3988
  size: size2 = "medium",
3988
3989
  iconPosition = "left",
3989
- href,
3990
- target,
3991
3990
  loading,
3992
3991
  loadingTooltip,
3993
3992
  fullWidth = false,
@@ -4000,7 +3999,7 @@ var Button = ({
4000
3999
  ref,
4001
4000
  className,
4002
4001
  style,
4003
- htmlProps = {},
4002
+ htmlProps,
4004
4003
  ...props
4005
4004
  }) => {
4006
4005
  var _a;
@@ -4054,46 +4053,27 @@ var Button = ({
4054
4053
  ] });
4055
4054
  const rest = props;
4056
4055
  const { disabled: restDisabled, ...restFinal } = rest;
4057
- const htmlDisabled = htmlProps.disabled;
4056
+ const htmlDisabled = htmlProps == null ? void 0 : htmlProps.disabled;
4058
4057
  const isDisabled = ((_a = restDisabled != null ? restDisabled : htmlDisabled) != null ? _a : loading) === true;
4059
- if (!href)
4060
- return /* @__PURE__ */ jsx198(
4061
- "button",
4062
- {
4063
- ref,
4064
- ...getBaseHTMLProps(id, buttonCn, style, htmlProps, restFinal),
4065
- onClick,
4066
- onFocus,
4067
- onBlur,
4068
- disabled: isDisabled,
4069
- children: content
4070
- }
4071
- );
4072
- else if (href)
4073
- return /* @__PURE__ */ jsx198(
4074
- "a",
4075
- {
4076
- ref,
4077
- ...getBaseHTMLProps(
4078
- id,
4079
- buttonCn,
4080
- style,
4081
- //TODO: fikse types ordentlig
4082
- htmlProps,
4083
- props
4084
- ),
4085
- onClick: loading ? void 0 : (
4086
- //TODO: fikse types ordentlig
4087
- onClick
4088
- ),
4089
- onFocus,
4090
- onBlur,
4091
- href,
4092
- rel: "noreferrer noopener",
4093
- target,
4094
- children: content
4095
- }
4096
- );
4058
+ const as = propAs ? propAs : "button";
4059
+ const isAnchor = as === "a";
4060
+ const aProps = isAnchor ? {
4061
+ rel: "noopener noreferrer"
4062
+ } : {};
4063
+ return /* @__PURE__ */ jsx198(
4064
+ ElementAs,
4065
+ {
4066
+ as,
4067
+ ref,
4068
+ ...getBaseHTMLProps(id, buttonCn, style, htmlProps, restFinal),
4069
+ onClick,
4070
+ onFocus,
4071
+ onBlur,
4072
+ disabled: isDisabled,
4073
+ ...aProps,
4074
+ children: content
4075
+ }
4076
+ );
4097
4077
  };
4098
4078
  Button.displayName = "Button";
4099
4079
  var texts2 = createTexts({