@norges-domstoler/dds-components 0.0.0-dev-20260506102015 → 0.0.0-dev-20260507105230

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
@@ -9398,13 +9398,21 @@ var fileUploaderReducer = (state, action) => {
9398
9398
  case "dragEnter":
9399
9399
  return {
9400
9400
  ...state,
9401
+ dragCounter: state.dragCounter + 1,
9401
9402
  isDragActive: true
9402
9403
  };
9403
- case "dragLeave":
9404
- return { ...state, isDragActive: false };
9404
+ case "dragLeave": {
9405
+ const newCounter = Math.max(0, state.dragCounter - 1);
9406
+ return {
9407
+ ...state,
9408
+ dragCounter: newCounter,
9409
+ isDragActive: newCounter > 0
9410
+ };
9411
+ }
9405
9412
  case "onSetFiles":
9406
9413
  return {
9407
9414
  ...state,
9415
+ dragCounter: 0,
9408
9416
  isDragActive: false,
9409
9417
  files: action.payload
9410
9418
  };
@@ -9511,6 +9519,7 @@ var useFileUploader = (props) => {
9511
9519
  isFocused: false,
9512
9520
  isFileDialogActive: false,
9513
9521
  isDragActive: false,
9522
+ dragCounter: 0,
9514
9523
  rootErrors: calcRootErrors(
9515
9524
  t(texts17.invalidFileAmount),
9516
9525
  initialFileUploaderFiles,
@@ -9559,16 +9568,13 @@ var useFileUploader = (props) => {
9559
9568
  );
9560
9569
  const onRootBlur = (0, import_react61.useCallback)(() => dispatch({ type: "blur" }), [dispatch]);
9561
9570
  const onRootDragEnter = (0, import_react61.useCallback)(
9562
- async (evt) => {
9571
+ (evt) => {
9563
9572
  preventDefaults(evt);
9564
9573
  if (isEventWithFiles(evt)) {
9565
- const files = await (0, import_file_selector.fromEvent)(evt);
9566
- const fileCount = files.length;
9567
- if (fileCount === 0) return;
9568
9574
  dispatch({ type: "dragEnter" });
9569
9575
  }
9570
9576
  },
9571
- [dispatch, accept, maxFiles]
9577
+ [dispatch]
9572
9578
  );
9573
9579
  const onRootDragOver = (0, import_react61.useCallback)((evt) => {
9574
9580
  preventDefaults(evt);
@@ -9583,7 +9589,6 @@ var useFileUploader = (props) => {
9583
9589
  const onRootDragLeave = (0, import_react61.useCallback)(
9584
9590
  (evt) => {
9585
9591
  preventDefaults(evt);
9586
- if (evt.currentTarget.contains(evt.relatedTarget)) return;
9587
9592
  dispatch({ type: "dragLeave" });
9588
9593
  },
9589
9594
  [dispatch]