@norges-domstoler/dds-components 0.0.0-dev-20240223113502 → 0.0.0-dev-20240223144112

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.d.mts CHANGED
@@ -1973,6 +1973,8 @@ type FileUploaderProps = {
1973
1973
  onChange: (newFiles: FileList) => void;
1974
1974
  /**Bredde for filopplasteren. */
1975
1975
  width?: Property.Width<string>;
1976
+ /**Om drag-and-drop zone skal vises. */
1977
+ withDragAndDrop?: boolean;
1976
1978
  } & Partial<FileUploaderHookProps>;
1977
1979
  declare const FileUploader: {
1978
1980
  (props: FileUploaderProps): react_jsx_runtime.JSX.Element;
package/dist/index.d.ts CHANGED
@@ -1973,6 +1973,8 @@ type FileUploaderProps = {
1973
1973
  onChange: (newFiles: FileList) => void;
1974
1974
  /**Bredde for filopplasteren. */
1975
1975
  width?: Property.Width<string>;
1976
+ /**Om drag-and-drop zone skal vises. */
1977
+ withDragAndDrop?: boolean;
1976
1978
  } & Partial<FileUploaderHookProps>;
1977
1979
  declare const FileUploader: {
1978
1980
  (props: FileUploaderProps): react_jsx_runtime.JSX.Element;
package/dist/index.js CHANGED
@@ -8089,6 +8089,9 @@ var rootTokens = {
8089
8089
  backgroundColor: colors20.DdsColorInteractiveLightest
8090
8090
  }
8091
8091
  };
8092
+ var noZoneContainerTokens = {
8093
+ padding: [spacing20.SizesDdsSpacingX05, 0].join(" ")
8094
+ };
8092
8095
  var fileTokens = {
8093
8096
  marginTop: spacing20.SizesDdsSpacingX05,
8094
8097
  paddingLeftRight: spacing20.SizesDdsSpacingX05,
@@ -8493,6 +8496,9 @@ var Root = import_styled_components56.default.div`
8493
8496
  gap: ${rootTokens.gap};
8494
8497
  background-color: ${({ $isDragActive }) => $isDragActive ? rootTokens.dragActive.backgroundColor : rootTokens.backgroundColor};
8495
8498
  `;
8499
+ var NoZoneContainer = import_styled_components56.default.div`
8500
+ padding: ${noZoneContainerTokens.padding};
8501
+ `;
8496
8502
  var FileUploaderInput = import_styled_components56.default.input``;
8497
8503
  var FileListElement = import_styled_components56.default.ul`
8498
8504
  margin: 0;
@@ -8505,6 +8511,7 @@ var FileUploader = (props) => {
8505
8511
  label: label3,
8506
8512
  tip,
8507
8513
  required = false,
8514
+ withDragAndDrop = true,
8508
8515
  initialFiles,
8509
8516
  value,
8510
8517
  accept,
@@ -8552,10 +8559,30 @@ var FileUploader = (props) => {
8552
8559
  id: derivativeIdGenerator(uniqueId, `error-${index}`),
8553
8560
  message: e
8554
8561
  }));
8562
+ const button3 = /* @__PURE__ */ (0, import_jsx_runtime219.jsx)(
8563
+ Button,
8564
+ {
8565
+ ...getButtonProps(),
8566
+ id: uniqueId,
8567
+ size: "medium",
8568
+ type: "button",
8569
+ appearance: "filled",
8570
+ purpose: "secondary",
8571
+ icon: UploadIcon,
8572
+ htmlProps: {
8573
+ "aria-invalid": hasRootErrors ? true : void 0,
8574
+ "aria-describedby": spaceSeparatedIdListGenerator([
8575
+ hasTip ? tipId : void 0,
8576
+ ...rootErrorsList.map((e) => e.id)
8577
+ ])
8578
+ },
8579
+ children: "Velg fil"
8580
+ }
8581
+ );
8555
8582
  return /* @__PURE__ */ (0, import_jsx_runtime219.jsxs)(Wrapper3, { width, children: [
8556
8583
  hasLabel && /* @__PURE__ */ (0, import_jsx_runtime219.jsx)(Label, { showRequiredStyling: showRequiredMarker, htmlFor: uniqueId, children: label3 }),
8557
8584
  hasTip && /* @__PURE__ */ (0, import_jsx_runtime219.jsx)(InputMessage, { id: tipId, message: tip, messageType: "tip" }),
8558
- /* @__PURE__ */ (0, import_jsx_runtime219.jsxs)(
8585
+ withDragAndDrop ? /* @__PURE__ */ (0, import_jsx_runtime219.jsxs)(
8559
8586
  Root,
8560
8587
  {
8561
8588
  ...getRootProps(),
@@ -8566,29 +8593,13 @@ var FileUploader = (props) => {
8566
8593
  "Dra og slipp filer her eller",
8567
8594
  " ",
8568
8595
  /* @__PURE__ */ (0, import_jsx_runtime219.jsx)(VisuallyHidden, { as: "span", children: "velg fil med p\xE5f\xF8lgende knapp" }),
8569
- /* @__PURE__ */ (0, import_jsx_runtime219.jsx)(
8570
- Button,
8571
- {
8572
- ...getButtonProps(),
8573
- id: uniqueId,
8574
- size: "medium",
8575
- type: "button",
8576
- appearance: "filled",
8577
- purpose: "secondary",
8578
- icon: UploadIcon,
8579
- htmlProps: {
8580
- "aria-invalid": hasRootErrors ? true : void 0,
8581
- "aria-describedby": spaceSeparatedIdListGenerator([
8582
- hasTip ? tipId : void 0,
8583
- ...rootErrorsList.map((e) => e.id)
8584
- ])
8585
- },
8586
- children: "Velg fil"
8587
- }
8588
- )
8596
+ button3
8589
8597
  ]
8590
8598
  }
8591
- ),
8599
+ ) : /* @__PURE__ */ (0, import_jsx_runtime219.jsxs)(NoZoneContainer, { children: [
8600
+ /* @__PURE__ */ (0, import_jsx_runtime219.jsx)(FileUploaderInput, { ...getInputProps() }),
8601
+ button3
8602
+ ] }),
8592
8603
  /* @__PURE__ */ (0, import_jsx_runtime219.jsx)(ErrorList, { errors: rootErrorsList }),
8593
8604
  /* @__PURE__ */ (0, import_jsx_runtime219.jsx)(FileListElement, { children: fileListElements })
8594
8605
  ] });