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

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
@@ -5006,7 +5006,7 @@ const CardExpandableHeader = ({ children, className, style, htmlProps, padding,
5006
5006
  style: containerStyleVariables,
5007
5007
  className: cn(CardExpandable_module_default["header-container"], typographyStyles_module_default[typographyType], bold && typographyStyles_module_default.bold),
5008
5008
  children: /* @__PURE__ */ jsxs("div", {
5009
- className: (AccordionBase_module_default.header__content, CardExpandable_module_default.header__content),
5009
+ className: cn(AccordionBase_module_default.header__content, CardExpandable_module_default.header__content),
5010
5010
  children: [children, /* @__PURE__ */ jsx(Icon, {
5011
5011
  icon: AnimatedChevronUpDownIcon,
5012
5012
  className: CardExpandable_module_default["header-container__chevron"],
@@ -7715,9 +7715,8 @@ const useFileUploader = (props) => {
7715
7715
  });
7716
7716
  const { files: stateFiles } = state;
7717
7717
  useEffect(() => {
7718
- if (isControlled) dispatch({
7719
- type: "onSetFiles",
7720
- payload: value.map((file) => {
7718
+ if (isControlled) {
7719
+ const files = value.map((file) => {
7721
7720
  if (file instanceof File) {
7722
7721
  const accepted = isFileAccepted(file, accept);
7723
7722
  return {
@@ -7731,8 +7730,12 @@ const useFileUploader = (props) => {
7731
7730
  name: file.name,
7732
7731
  errors: []
7733
7732
  };
7734
- })
7735
- });
7733
+ });
7734
+ dispatch({
7735
+ type: "onSetFiles",
7736
+ payload: files
7737
+ });
7738
+ }
7736
7739
  }, [
7737
7740
  value,
7738
7741
  isControlled,
@@ -7775,10 +7778,11 @@ const useFileUploader = (props) => {
7775
7778
  name: file.name,
7776
7779
  errors: isFileAccepted(file, accept) ? [] : [t(texts$13.invalidFileType)]
7777
7780
  })).concat(stateFiles);
7778
- onChange([...stateFiles.filter((f) => f.url).map((f) => ({
7781
+ const mergedFiles = [...stateFiles.filter((f) => f.url).map((f) => ({
7779
7782
  name: f.name,
7780
7783
  url: f.url
7781
- })), ...newFiles.filter((f) => f.file).map((f) => f.file)]);
7784
+ })), ...newFiles.filter((f) => f.file).map((f) => f.file)];
7785
+ onChange(mergedFiles);
7782
7786
  if (!isControlled) dispatch({
7783
7787
  type: "onSetFiles",
7784
7788
  payload: newFiles
@@ -7802,10 +7806,11 @@ const useFileUploader = (props) => {
7802
7806
  const removeFile = useCallback((file) => {
7803
7807
  const newFiles = [...stateFiles];
7804
7808
  newFiles.splice(stateFiles.indexOf(file), 1);
7805
- onChange([...newFiles.filter((f) => f.url).map((f) => ({
7809
+ const mergedFiles = [...newFiles.filter((f) => f.url).map((f) => ({
7806
7810
  name: f.name,
7807
7811
  url: f.url
7808
- })), ...newFiles.filter((f) => f.file).map((f) => f.file)]);
7812
+ })), ...newFiles.filter((f) => f.file).map((f) => f.file)];
7813
+ onChange(mergedFiles);
7809
7814
  if (!isControlled) dispatch({
7810
7815
  type: "onRemoveFile",
7811
7816
  payload: newFiles
@@ -9516,7 +9521,8 @@ const NativeSelect = ({ ref, id, children, componentSize = "medium", label, mult
9516
9521
  const selectRef = useRef(null);
9517
9522
  const [hasValue, setHasValue] = useState(false);
9518
9523
  useEffect(() => {
9519
- setHasValue((selectRef.current?.selectedIndex ?? -1) !== 0);
9524
+ const selectedIndex = selectRef.current?.selectedIndex ?? -1;
9525
+ setHasValue(selectedIndex !== 0);
9520
9526
  }, []);
9521
9527
  useEffect(() => {
9522
9528
  if (clearable) {
@@ -11827,7 +11833,8 @@ const Search$1 = ({ componentSize = "medium", buttonProps, showIcon = true, name
11827
11833
  onChange?.(e);
11828
11834
  };
11829
11835
  const clearInput = () => {
11830
- handleChange(createClearChangeEvent(uniqueId));
11836
+ const clearChangeEvent = createClearChangeEvent(uniqueId);
11837
+ handleChange(clearChangeEvent);
11831
11838
  };
11832
11839
  const { label: buttonLabel, onClick, ...otherButtonProps } = buttonProps ?? {};
11833
11840
  const hasSuggestions = !!context.suggestions;