@norges-domstoler/dds-components 0.0.0-dev-20260720114143 → 0.0.0-dev-20260720134425

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.cjs CHANGED
@@ -5039,7 +5039,7 @@ const CardExpandableHeader = ({ children, className, style, htmlProps, padding,
5039
5039
  style: containerStyleVariables,
5040
5040
  className: cn(CardExpandable_module_default["header-container"], typographyStyles_module_default[typographyType], bold && typographyStyles_module_default.bold),
5041
5041
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5042
- className: (AccordionBase_module_default.header__content, CardExpandable_module_default.header__content),
5042
+ className: cn(AccordionBase_module_default.header__content, CardExpandable_module_default.header__content),
5043
5043
  children: [children, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, {
5044
5044
  icon: AnimatedChevronUpDownIcon,
5045
5045
  className: CardExpandable_module_default["header-container__chevron"],
@@ -7748,9 +7748,8 @@ const useFileUploader = (props) => {
7748
7748
  });
7749
7749
  const { files: stateFiles } = state;
7750
7750
  (0, react.useEffect)(() => {
7751
- if (isControlled) dispatch({
7752
- type: "onSetFiles",
7753
- payload: value.map((file) => {
7751
+ if (isControlled) {
7752
+ const files = value.map((file) => {
7754
7753
  if (file instanceof File) {
7755
7754
  const accepted = isFileAccepted(file, accept);
7756
7755
  return {
@@ -7764,8 +7763,12 @@ const useFileUploader = (props) => {
7764
7763
  name: file.name,
7765
7764
  errors: []
7766
7765
  };
7767
- })
7768
- });
7766
+ });
7767
+ dispatch({
7768
+ type: "onSetFiles",
7769
+ payload: files
7770
+ });
7771
+ }
7769
7772
  }, [
7770
7773
  value,
7771
7774
  isControlled,
@@ -7808,10 +7811,11 @@ const useFileUploader = (props) => {
7808
7811
  name: file.name,
7809
7812
  errors: isFileAccepted(file, accept) ? [] : [t(texts$13.invalidFileType)]
7810
7813
  })).concat(stateFiles);
7811
- onChange([...stateFiles.filter((f) => f.url).map((f) => ({
7814
+ const mergedFiles = [...stateFiles.filter((f) => f.url).map((f) => ({
7812
7815
  name: f.name,
7813
7816
  url: f.url
7814
- })), ...newFiles.filter((f) => f.file).map((f) => f.file)]);
7817
+ })), ...newFiles.filter((f) => f.file).map((f) => f.file)];
7818
+ onChange(mergedFiles);
7815
7819
  if (!isControlled) dispatch({
7816
7820
  type: "onSetFiles",
7817
7821
  payload: newFiles
@@ -7835,10 +7839,11 @@ const useFileUploader = (props) => {
7835
7839
  const removeFile = (0, react.useCallback)((file) => {
7836
7840
  const newFiles = [...stateFiles];
7837
7841
  newFiles.splice(stateFiles.indexOf(file), 1);
7838
- onChange([...newFiles.filter((f) => f.url).map((f) => ({
7842
+ const mergedFiles = [...newFiles.filter((f) => f.url).map((f) => ({
7839
7843
  name: f.name,
7840
7844
  url: f.url
7841
- })), ...newFiles.filter((f) => f.file).map((f) => f.file)]);
7845
+ })), ...newFiles.filter((f) => f.file).map((f) => f.file)];
7846
+ onChange(mergedFiles);
7842
7847
  if (!isControlled) dispatch({
7843
7848
  type: "onRemoveFile",
7844
7849
  payload: newFiles
@@ -9549,7 +9554,8 @@ const NativeSelect = ({ ref, id, children, componentSize = "medium", label, mult
9549
9554
  const selectRef = (0, react.useRef)(null);
9550
9555
  const [hasValue, setHasValue] = (0, react.useState)(false);
9551
9556
  (0, react.useEffect)(() => {
9552
- setHasValue((selectRef.current?.selectedIndex ?? -1) !== 0);
9557
+ const selectedIndex = selectRef.current?.selectedIndex ?? -1;
9558
+ setHasValue(selectedIndex !== 0);
9553
9559
  }, []);
9554
9560
  (0, react.useEffect)(() => {
9555
9561
  if (clearable) {
@@ -11860,7 +11866,8 @@ const Search$1 = ({ componentSize = "medium", buttonProps, showIcon = true, name
11860
11866
  onChange?.(e);
11861
11867
  };
11862
11868
  const clearInput = () => {
11863
- handleChange(createClearChangeEvent(uniqueId));
11869
+ const clearChangeEvent = createClearChangeEvent(uniqueId);
11870
+ handleChange(clearChangeEvent);
11864
11871
  };
11865
11872
  const { label: buttonLabel, onClick, ...otherButtonProps } = buttonProps ?? {};
11866
11873
  const hasSuggestions = !!context.suggestions;