@norges-domstoler/dds-components 0.0.0-dev-20250425135658 → 0.0.0-dev-20250425141020

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.js CHANGED
@@ -6784,6 +6784,7 @@ var TextArea = ({
6784
6784
  }
6785
6785
  };
6786
6786
  const hasErrorMessage = !!errorMessage;
6787
+ const hasMessage = hasErrorMessage || !!tip;
6787
6788
  const hasLabel = !!label;
6788
6789
  const tipId = derivativeIdGenerator(uniqueId, "tip");
6789
6790
  const errorMessageId = derivativeIdGenerator(uniqueId, "errorMessage");
@@ -6792,6 +6793,7 @@ var TextArea = ({
6792
6793
  "characterCounter"
6793
6794
  );
6794
6795
  const showRequiredStyling = required || !!ariaRequired;
6796
+ const inputWidth = getInputWidth(width);
6795
6797
  return /* @__PURE__ */ (0, import_jsx_runtime241.jsxs)("div", { className: cn(className, Input_default.container), style: { ...style }, children: [
6796
6798
  hasLabel && /* @__PURE__ */ (0, import_jsx_runtime241.jsx)(
6797
6799
  Label,
@@ -6807,7 +6809,7 @@ var TextArea = ({
6807
6809
  Box,
6808
6810
  {
6809
6811
  as: "textarea",
6810
- width: getInputWidth(width),
6812
+ width: inputWidth,
6811
6813
  ref: multiRef,
6812
6814
  id: uniqueId,
6813
6815
  onChange: onChangeHandler,
@@ -6836,15 +6838,23 @@ var TextArea = ({
6836
6838
  ...rest
6837
6839
  }
6838
6840
  ),
6839
- /* @__PURE__ */ (0, import_jsx_runtime241.jsxs)(Box, { display: "flex", alignContent: "space-between", children: [
6840
- renderInputMessage(tip, tipId, errorMessage, errorMessageId),
6841
- renderCharCounter(
6842
- characterCounterId,
6843
- withCharacterCounter,
6844
- text.length,
6845
- maxLength
6846
- )
6847
- ] })
6841
+ /* @__PURE__ */ (0, import_jsx_runtime241.jsxs)(
6842
+ Box,
6843
+ {
6844
+ display: "flex",
6845
+ justifyContent: withCharacterCounter ? hasMessage ? "space-between" : "flex-end" : void 0,
6846
+ width: withCharacterCounter ? inputWidth : void 0,
6847
+ children: [
6848
+ renderInputMessage(tip, tipId, errorMessage, errorMessageId),
6849
+ renderCharCounter(
6850
+ characterCounterId,
6851
+ withCharacterCounter,
6852
+ text.length,
6853
+ maxLength
6854
+ )
6855
+ ]
6856
+ }
6857
+ )
6848
6858
  ] });
6849
6859
  };
6850
6860
  TextArea.displayName = "TextArea";
@@ -12387,7 +12397,8 @@ var TextInput = ({
12387
12397
  const hasErrorMessage = !!errorMessage;
12388
12398
  const hasTip = !!tip;
12389
12399
  const hasLabel = !!label;
12390
- const hasMessage = hasErrorMessage || hasTip || !!maxLength;
12400
+ const hasMessage = hasErrorMessage || hasTip;
12401
+ const hasBottomContainer = hasErrorMessage || hasTip || !!maxLength;
12391
12402
  const hasIcon = !!icon;
12392
12403
  const hasAffix = !!(prefix2 != null ? prefix2 : suffix);
12393
12404
  const characterCounterId = derivativeIdGenerator(
@@ -12526,15 +12537,24 @@ var TextInput = ({
12526
12537
  }
12527
12538
  ),
12528
12539
  extendedInput ? extendedInput : /* @__PURE__ */ (0, import_jsx_runtime313.jsx)(Box, { as: StatefulInput, width: inputWidth, ...generalInputProps }),
12529
- hasMessage && /* @__PURE__ */ (0, import_jsx_runtime313.jsxs)(Box, { display: "flex", justifyContent: "space-between", gap: "x0.5", children: [
12530
- renderInputMessage(tip, tipId, errorMessage, errorMessageId),
12531
- renderCharCounter(
12532
- characterCounterId,
12533
- withCharacterCounter,
12534
- text.length,
12535
- maxLength
12536
- )
12537
- ] })
12540
+ hasBottomContainer && /* @__PURE__ */ (0, import_jsx_runtime313.jsxs)(
12541
+ Box,
12542
+ {
12543
+ display: "flex",
12544
+ justifyContent: withCharacterCounter ? hasMessage ? "space-between" : "flex-end" : void 0,
12545
+ gap: "x0.5",
12546
+ width: withCharacterCounter ? inputWidth : void 0,
12547
+ children: [
12548
+ renderInputMessage(tip, tipId, errorMessage, errorMessageId),
12549
+ renderCharCounter(
12550
+ characterCounterId,
12551
+ withCharacterCounter,
12552
+ text.length,
12553
+ maxLength
12554
+ )
12555
+ ]
12556
+ }
12557
+ )
12538
12558
  ]
12539
12559
  }
12540
12560
  );