@norges-domstoler/dds-components 22.10.0 → 22.11.0

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
@@ -3853,7 +3853,7 @@ var Typography = (props) => {
3853
3853
  externalLinkProp = as === "a" && externalLink ? externalLink : void 0;
3854
3854
  }
3855
3855
  return /* @__PURE__ */ jsxs70(
3856
- ElementAs,
3856
+ Box,
3857
3857
  {
3858
3858
  ...getBaseHTMLProps(
3859
3859
  id,
@@ -9071,13 +9071,21 @@ var fileUploaderReducer = (state, action) => {
9071
9071
  case "dragEnter":
9072
9072
  return {
9073
9073
  ...state,
9074
+ dragCounter: state.dragCounter + 1,
9074
9075
  isDragActive: true
9075
9076
  };
9076
- case "dragLeave":
9077
- return { ...state, isDragActive: false };
9077
+ case "dragLeave": {
9078
+ const newCounter = Math.max(0, state.dragCounter - 1);
9079
+ return {
9080
+ ...state,
9081
+ dragCounter: newCounter,
9082
+ isDragActive: newCounter > 0
9083
+ };
9084
+ }
9078
9085
  case "onSetFiles":
9079
9086
  return {
9080
9087
  ...state,
9088
+ dragCounter: 0,
9081
9089
  isDragActive: false,
9082
9090
  files: action.payload
9083
9091
  };
@@ -9184,6 +9192,7 @@ var useFileUploader = (props) => {
9184
9192
  isFocused: false,
9185
9193
  isFileDialogActive: false,
9186
9194
  isDragActive: false,
9195
+ dragCounter: 0,
9187
9196
  rootErrors: calcRootErrors(
9188
9197
  t(texts17.invalidFileAmount),
9189
9198
  initialFileUploaderFiles,
@@ -9232,16 +9241,13 @@ var useFileUploader = (props) => {
9232
9241
  );
9233
9242
  const onRootBlur = useCallback6(() => dispatch({ type: "blur" }), [dispatch]);
9234
9243
  const onRootDragEnter = useCallback6(
9235
- async (evt) => {
9244
+ (evt) => {
9236
9245
  preventDefaults(evt);
9237
9246
  if (isEventWithFiles(evt)) {
9238
- const files = await getFilesFromEvent(evt);
9239
- const fileCount = files.length;
9240
- if (fileCount === 0) return;
9241
9247
  dispatch({ type: "dragEnter" });
9242
9248
  }
9243
9249
  },
9244
- [dispatch, accept, maxFiles]
9250
+ [dispatch]
9245
9251
  );
9246
9252
  const onRootDragOver = useCallback6((evt) => {
9247
9253
  preventDefaults(evt);
@@ -9256,7 +9262,6 @@ var useFileUploader = (props) => {
9256
9262
  const onRootDragLeave = useCallback6(
9257
9263
  (evt) => {
9258
9264
  preventDefaults(evt);
9259
- if (evt.currentTarget.contains(evt.relatedTarget)) return;
9260
9265
  dispatch({ type: "dragLeave" });
9261
9266
  },
9262
9267
  [dispatch]