@digdir/designsystemet-react 1.21.0 → 1.22.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.
Files changed (53) hide show
  1. package/dist/cjs/components/avatar/avatar.cjs +11 -15
  2. package/dist/cjs/components/avatar/avatar.d.cts +6 -2
  3. package/dist/cjs/components/badge/badge-position.d.cts +1 -1
  4. package/dist/cjs/components/badge/index.d.cts +1 -1
  5. package/dist/cjs/components/breadcrumbs/breadcrumbs-link.d.cts +1 -1
  6. package/dist/cjs/components/card/card.d.cts +1 -1
  7. package/dist/cjs/components/dialog/dialog.d.cts +1 -1
  8. package/dist/cjs/components/error-summary/error-summary-link.d.cts +1 -1
  9. package/dist/cjs/components/link/link.d.cts +1 -1
  10. package/dist/cjs/components/popover/popover.d.cts +1 -1
  11. package/dist/cjs/components/search/search-clear.cjs +4 -5
  12. package/dist/cjs/components/search/search-clear.d.cts +9 -6
  13. package/dist/cjs/components/search/search.cjs +1 -0
  14. package/dist/cjs/components/suggestion/suggestion-clear.cjs +1 -2
  15. package/dist/cjs/components/suggestion/suggestion-clear.d.cts +2 -2
  16. package/dist/cjs/components/suggestion/suggestion-empty.d.cts +2 -2
  17. package/dist/cjs/components/suggestion/suggestion-list.cjs +1 -1
  18. package/dist/cjs/components/suggestion/suggestion-list.d.cts +4 -4
  19. package/dist/cjs/components/suggestion/suggestion.cjs +3 -3
  20. package/dist/cjs/components/tabs/tabs.d.cts +1 -1
  21. package/dist/cjs/components/tag/tag.cjs +3 -2
  22. package/dist/cjs/components/tag/tag.d.cts +11 -1
  23. package/dist/cjs/components/tooltip/tooltip.d.cts +1 -1
  24. package/dist/cjs/utilities/hooks/deprecated/use-isomorphic-layout-effect/use-isomorphic-layout-effect.d.cts +2 -2
  25. package/dist/cjs/utilities/hooks/use-synchronized-animation/use-synchronized-animation.d.cts +1 -1
  26. package/dist/esm/components/Combobox/Combobox.js +2 -2
  27. package/dist/esm/components/Combobox/internal/ComboboxChips.js +2 -2
  28. package/dist/esm/components/avatar/avatar.d.ts +6 -2
  29. package/dist/esm/components/avatar/avatar.js +13 -17
  30. package/dist/esm/components/badge/badge-position.d.ts +1 -1
  31. package/dist/esm/components/badge/index.d.ts +1 -1
  32. package/dist/esm/components/breadcrumbs/breadcrumbs-link.d.ts +1 -1
  33. package/dist/esm/components/card/card.d.ts +1 -1
  34. package/dist/esm/components/dialog/dialog.d.ts +1 -1
  35. package/dist/esm/components/error-summary/error-summary-link.d.ts +1 -1
  36. package/dist/esm/components/link/link.d.ts +1 -1
  37. package/dist/esm/components/popover/popover.d.ts +1 -1
  38. package/dist/esm/components/search/search-clear.d.ts +9 -6
  39. package/dist/esm/components/search/search-clear.js +4 -5
  40. package/dist/esm/components/search/search.js +1 -0
  41. package/dist/esm/components/suggestion/suggestion-clear.d.ts +2 -2
  42. package/dist/esm/components/suggestion/suggestion-clear.js +1 -2
  43. package/dist/esm/components/suggestion/suggestion-empty.d.ts +2 -2
  44. package/dist/esm/components/suggestion/suggestion-list.d.ts +4 -4
  45. package/dist/esm/components/suggestion/suggestion-list.js +1 -1
  46. package/dist/esm/components/suggestion/suggestion.js +3 -3
  47. package/dist/esm/components/tabs/tabs.d.ts +1 -1
  48. package/dist/esm/components/tag/tag.d.ts +11 -1
  49. package/dist/esm/components/tag/tag.js +3 -2
  50. package/dist/esm/components/tooltip/tooltip.d.ts +1 -1
  51. package/dist/esm/utilities/hooks/deprecated/use-isomorphic-layout-effect/use-isomorphic-layout-effect.d.ts +2 -2
  52. package/dist/esm/utilities/hooks/use-synchronized-animation/use-synchronized-animation.d.ts +1 -1
  53. package/package.json +14 -14
@@ -22,25 +22,21 @@ let _radix_ui_react_slot = require("@radix-ui/react-slot");
22
22
  * <Icon />
23
23
  * </Avatar>
24
24
  */
25
- const Avatar = (0, react.forwardRef)(function Avatar({ "aria-label": ariaLabel, "data-tooltip": dataTooltip, variant, className, children, initials, asChild, ...rest }, ref) {
26
- const OuterComponent = asChild ? _radix_ui_react_slot.Slot : "span";
27
- const useSlot = children && typeof children !== "string";
28
- const textChild = children && typeof children === "string";
29
- const Component = useSlot ? _radix_ui_react_slot.Slot : react.Fragment;
30
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OuterComponent, {
31
- ref,
25
+ const Avatar = (0, react.forwardRef)(function Avatar({ "aria-label": label, "data-tooltip": tooltip, "data-initials": dataInitials, children, variant, className, initials: propInitials, asChild, ...rest }, ref) {
26
+ const Component = asChild ? _radix_ui_react_slot.Slot : "span";
27
+ const initials = propInitials ?? dataInitials;
28
+ const hasSlottedChildren = asChild && (0, react.isValidElement)(children) && children.props.children !== void 0 && children.props.children !== null;
29
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Component, {
30
+ "aria-label": label || tooltip,
32
31
  className: (0, clsx_lite.default)("ds-avatar", className),
33
- "data-variant": variant,
34
32
  "data-initials": initials,
33
+ "data-tooltip": tooltip,
34
+ "data-variant": variant,
35
+ ref,
35
36
  role: asChild ? void 0 : "img",
36
- "aria-label": ariaLabel || dataTooltip,
37
- "data-tooltip": dataTooltip,
38
- tabIndex: dataTooltip ? 0 : void 0,
37
+ tabIndex: tooltip ? 0 : void 0,
39
38
  ...rest,
40
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Component, {
41
- ...useSlot && !asChild ? { "aria-hidden": true } : {},
42
- children: textChild ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children }) : children
43
- })
39
+ children: asChild ? [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_slot.Slottable, { children }, "slottable"), hasSlottedChildren ? null : initials] : children ?? initials
44
40
  });
45
41
  });
46
42
  //#endregion
@@ -33,8 +33,14 @@ type AvatarProps = MergeRight<DefaultProps & HTMLAttributes<HTMLSpanElement>, Ar
33
33
  variant?: 'circle' | 'square';
34
34
  /**
35
35
  * Initials to display inside the avatar.
36
+ * @deprecated Please use text content as children instead
36
37
  */
37
38
  initials?: string;
39
+ /**
40
+ * Initials to display inside the avatar.
41
+ * @deprecated Please use text content as children instead
42
+ */
43
+ 'data-initials'?: string;
38
44
  /**
39
45
  * Change the default rendered element for the one passed as a child, merging their props and behavior.
40
46
  * @default false
@@ -42,8 +48,6 @@ type AvatarProps = MergeRight<DefaultProps & HTMLAttributes<HTMLSpanElement>, Ar
42
48
  asChild?: boolean;
43
49
  /**
44
50
  * Image, icon or initials to display inside the avatar.
45
- *
46
- * Gets `aria-hidden="true"`
47
51
  */
48
52
  children?: ReactNode;
49
53
  }>;
@@ -27,7 +27,7 @@ type BadgePositionProps = MergeRight<DefaultProps & HTMLAttributes<HTMLSpanEleme
27
27
  * <Element />
28
28
  * </BadgePosition>
29
29
  */
30
- declare const BadgePosition: import("react").ForwardRefExoticComponent<Omit<DefaultProps & HTMLAttributes<HTMLSpanElement>, "placement" | "overlap"> & {
30
+ declare const BadgePosition: import("react").ForwardRefExoticComponent<Omit<DefaultProps & HTMLAttributes<HTMLSpanElement>, "overlap" | "placement"> & {
31
31
  /**
32
32
  * The placement of the badge
33
33
  *
@@ -16,7 +16,7 @@ declare const Badge: import("react").ForwardRefExoticComponent<Omit<DefaultProps
16
16
  variant?: "base" | "tinted";
17
17
  children?: never;
18
18
  } & import("react").RefAttributes<HTMLSpanElement>> & {
19
- Position: import("react").ForwardRefExoticComponent<Omit<DefaultProps & import("react").HTMLAttributes<HTMLSpanElement>, "placement" | "overlap"> & {
19
+ Position: import("react").ForwardRefExoticComponent<Omit<DefaultProps & import("react").HTMLAttributes<HTMLSpanElement>, "overlap" | "placement"> & {
20
20
  placement?: "top-right" | "top-left" | "bottom-right" | "bottom-left";
21
21
  overlap?: "circle" | "rectangle";
22
22
  } & import("react").RefAttributes<HTMLSpanElement>>;
@@ -4,7 +4,7 @@ import { LinkProps } from "../link/link.cjs";
4
4
  import "../../index.cjs";
5
5
  //#region src/components/breadcrumbs/breadcrumbs-link.d.ts
6
6
  type BreadcrumbsLinkProps = LinkProps;
7
- declare const BreadcrumbsLink: import("react").ForwardRefExoticComponent<Omit<DefaultProps & import("react").AnchorHTMLAttributes<HTMLAnchorElement>, "asChild" | "children"> & {
7
+ declare const BreadcrumbsLink: import("react").ForwardRefExoticComponent<Omit<DefaultProps & import("react").AnchorHTMLAttributes<HTMLAnchorElement>, "children" | "asChild"> & {
8
8
  children: import("react").ReactNode;
9
9
  asChild?: boolean;
10
10
  } & import("react").RefAttributes<HTMLAnchorElement>>;
@@ -29,7 +29,7 @@ type CardProps = MergeRight<DefaultProps & HTMLAttributes<HTMLDivElement>, {
29
29
  * <Card.Block>Footer</Card.Block>
30
30
  * </Card>
31
31
  */
32
- declare const Card: import("react").ForwardRefExoticComponent<Omit<DefaultProps & HTMLAttributes<HTMLDivElement>, "asChild" | "children" | "variant"> & {
32
+ declare const Card: import("react").ForwardRefExoticComponent<Omit<DefaultProps & HTMLAttributes<HTMLDivElement>, "children" | "asChild" | "variant"> & {
33
33
  /**
34
34
  * Change the background color of the card.
35
35
  *
@@ -71,7 +71,7 @@ type DialogProps = MergeRight<DefaultProps & DialogHTMLAttributes<HTMLDialogElem
71
71
  * Content
72
72
  * </Dialog>
73
73
  */
74
- declare const Dialog: import("react").ForwardRefExoticComponent<Omit<DefaultProps & DialogHTMLAttributes<HTMLDialogElement>, "asChild" | "placement" | "open" | "onClose" | "closedby" | "closeButton" | "modal"> & {
74
+ declare const Dialog: import("react").ForwardRefExoticComponent<Omit<DefaultProps & DialogHTMLAttributes<HTMLDialogElement>, "asChild" | "placement" | "open" | "closedby" | "onClose" | "closeButton" | "modal"> & {
75
75
  /**
76
76
  * Screen reader label of close button. Set false to hide the close button.
77
77
  * @default 'Lukk dialogvindu'
@@ -14,7 +14,7 @@ type ErrorSummaryLinkProps = LinkProps;
14
14
  * </ErrorSummaryItem>
15
15
  * </ErrorSummary>
16
16
  */
17
- declare const ErrorSummaryLink: import("react").ForwardRefExoticComponent<Omit<DefaultProps & import("react").AnchorHTMLAttributes<HTMLAnchorElement>, "asChild" | "children"> & {
17
+ declare const ErrorSummaryLink: import("react").ForwardRefExoticComponent<Omit<DefaultProps & import("react").AnchorHTMLAttributes<HTMLAnchorElement>, "children" | "asChild"> & {
18
18
  children: import("react").ReactNode;
19
19
  asChild?: boolean;
20
20
  } & import("react").RefAttributes<HTMLAnchorElement>>;
@@ -21,7 +21,7 @@ type LinkProps = MergeRight<DefaultProps & AnchorHTMLAttributes<HTMLAnchorElemen
21
21
  * @example
22
22
  * <Link href='#'>Link</Link>
23
23
  */
24
- declare const Link: import("react").ForwardRefExoticComponent<Omit<DefaultProps & AnchorHTMLAttributes<HTMLAnchorElement>, "asChild" | "children"> & {
24
+ declare const Link: import("react").ForwardRefExoticComponent<Omit<DefaultProps & AnchorHTMLAttributes<HTMLAnchorElement>, "children" | "asChild"> & {
25
25
  /**
26
26
  * The content to display inside the link.
27
27
  **/
@@ -62,7 +62,7 @@ type PopoverProps = MergeRight<DefaultProps & HTMLAttributes<HTMLDivElement>, {
62
62
  * Content
63
63
  * </Popover>
64
64
  */
65
- declare const Popover: import("react").ForwardRefExoticComponent<Omit<DefaultProps & HTMLAttributes<HTMLDivElement>, "asChild" | "id" | "variant" | "placement" | "open" | "onOpen" | "onClose" | "autoPlacement"> & {
65
+ declare const Popover: import("react").ForwardRefExoticComponent<Omit<DefaultProps & HTMLAttributes<HTMLDivElement>, "asChild" | "id" | "variant" | "placement" | "open" | "onClose" | "onOpen" | "autoPlacement"> & {
66
66
  /**
67
67
  * id to connect the trigger with the popover - required when not using Popover.Context.
68
68
  */
@@ -1,5 +1,4 @@
1
1
  'use client';
2
- const require_button = require("../button/button.cjs");
3
2
  let react = require("react");
4
3
  let react_jsx_runtime = require("react/jsx-runtime");
5
4
  //#region src/components/search/search-clear.tsx
@@ -12,12 +11,12 @@ let react_jsx_runtime = require("react/jsx-runtime");
12
11
  * <SearchClear />
13
12
  * </Search>
14
13
  */
15
- const SearchClear = (0, react.forwardRef)(function SearchClear({ "aria-label": label = "Tøm", ...rest }, ref) {
16
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_button.Button, {
17
- "aria-label": label,
14
+ const SearchClear = (0, react.forwardRef)(function SearchClear(rest, ref) {
15
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
16
+ hidden: true,
18
17
  ref,
19
18
  type: "reset",
20
- variant: "tertiary",
19
+ suppressHydrationWarning: true,
21
20
  ...rest
22
21
  });
23
22
  });
@@ -1,13 +1,16 @@
1
1
 
2
- import { ButtonProps } from "../button/button.cjs";
2
+ import { DefaultProps } from "../../types.cjs";
3
+ import { MergeRight } from "../../utilities/types.cjs";
4
+ import "../../utilities/index.cjs";
5
+ import { ButtonHTMLAttributes } from "react";
3
6
  //#region src/components/search/search-clear.d.ts
4
- type SearchClearProps = Omit<ButtonProps, 'variant' | 'children'> & {
7
+ type SearchClearProps = MergeRight<DefaultProps & ButtonHTMLAttributes<HTMLButtonElement>, {
5
8
  /**
6
9
  * Aria label for the clear button
7
- * @default 'Tøm'
10
+ * @deprecated Please use `--dsc-suggestion-sr-clear` or `data-sr-clear` on Suggestion to set label.
8
11
  */
9
12
  'aria-label'?: string;
10
- };
13
+ }>;
11
14
  /**
12
15
  * SearchClear component, used to display a clear button when the search input is not empty.
13
16
  *
@@ -17,10 +20,10 @@ type SearchClearProps = Omit<ButtonProps, 'variant' | 'children'> & {
17
20
  * <SearchClear />
18
21
  * </Search>
19
22
  */
20
- declare const SearchClear: import("react").ForwardRefExoticComponent<Omit<ButtonProps, "children" | "variant"> & {
23
+ declare const SearchClear: import("react").ForwardRefExoticComponent<Omit<DefaultProps & ButtonHTMLAttributes<HTMLButtonElement>, "aria-label"> & {
21
24
  /**
22
25
  * Aria label for the clear button
23
- * @default 'Tøm'
26
+ * @deprecated Please use `--dsc-suggestion-sr-clear` or `data-sr-clear` on Suggestion to set label.
24
27
  */
25
28
  'aria-label'?: string;
26
29
  } & import("react").RefAttributes<HTMLButtonElement>>;
@@ -26,6 +26,7 @@ const Search = (0, react.forwardRef)(function Search({ className, ...rest }, ref
26
26
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ds-suggestion", {
27
27
  ref,
28
28
  class: (0, clsx_lite.default)("ds-search", className),
29
+ suppressHydrationWarning: true,
29
30
  ...rest
30
31
  });
31
32
  });
@@ -15,9 +15,8 @@ let react_jsx_runtime = require("react/jsx-runtime");
15
15
  * <Suggestion.List />
16
16
  * </Suggestion>
17
17
  */
18
- const SuggestionClear = (0, react.forwardRef)(function SuggestionClear({ "aria-label": label = "Tøm", ...rest }, ref) {
18
+ const SuggestionClear = (0, react.forwardRef)(function SuggestionClear(rest, ref) {
19
19
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
20
- "aria-label": label,
21
20
  hidden: true,
22
21
  ref,
23
22
  suppressHydrationWarning: true,
@@ -7,7 +7,7 @@ import { ButtonHTMLAttributes } from "react";
7
7
  type SuggestionClearProps = MergeRight<DefaultProps & ButtonHTMLAttributes<HTMLButtonElement>, {
8
8
  /**
9
9
  * Aria label for the clear button
10
- * @default 'Tøm'
10
+ * @deprecated Please use `--dsc-suggestion-sr-clear` or `data-sr-clear` on Suggestion to set label.
11
11
  */
12
12
  'aria-label'?: string;
13
13
  }>;
@@ -27,7 +27,7 @@ type SuggestionClearProps = MergeRight<DefaultProps & ButtonHTMLAttributes<HTMLB
27
27
  declare const SuggestionClear: import("react").ForwardRefExoticComponent<Omit<DefaultProps & ButtonHTMLAttributes<HTMLButtonElement>, "aria-label"> & {
28
28
  /**
29
29
  * Aria label for the clear button
30
- * @default 'Tøm'
30
+ * @deprecated Please use `--dsc-suggestion-sr-clear` or `data-sr-clear` on Suggestion to set label.
31
31
  */
32
32
  'aria-label'?: string;
33
33
  } & import("react").RefAttributes<HTMLButtonElement>>;
@@ -6,7 +6,7 @@ import { OptionHTMLAttributes } from "react";
6
6
  type SuggestionEmptyProps = DefaultProps & OptionHTMLAttributes<HTMLOptionElement> & {
7
7
  /**
8
8
  * Optionally the text to display when the suggestion list is empty.
9
- * If <Suggestion> has `data-creatable`, use `{value}` to replace with the current input value.
9
+ * If <Suggestion> has `data-creatable`, use `%s` to replace with the current input value.
10
10
  **/
11
11
  'data-empty'?: string;
12
12
  };
@@ -23,7 +23,7 @@ type SuggestionEmptyProps = DefaultProps & OptionHTMLAttributes<HTMLOptionElemen
23
23
  declare const SuggestionEmpty: import("react").ForwardRefExoticComponent<DefaultProps & OptionHTMLAttributes<HTMLOptionElement> & {
24
24
  /**
25
25
  * Optionally the text to display when the suggestion list is empty.
26
- * If <Suggestion> has `data-creatable`, use `{value}` to replace with the current input value.
26
+ * If <Suggestion> has `data-creatable`, use `%s` to replace with the current input value.
27
27
  **/
28
28
  'data-empty'?: string;
29
29
  } & import("react").RefAttributes<HTMLOptionElement>>;
@@ -15,7 +15,7 @@ let react_jsx_runtime = require("react/jsx-runtime");
15
15
  * <Suggestion.List />
16
16
  * </Suggestion>
17
17
  */
18
- const SuggestionList = (0, react.forwardRef)(function SuggestionList({ singular = "%d forslag", plural = "%d forslag", className, id, autoPlacement = true, ...rest }, ref) {
18
+ const SuggestionList = (0, react.forwardRef)(function SuggestionList({ singular, plural, className, id, autoPlacement = true, ...rest }, ref) {
19
19
  const { handleFilter } = (0, react.useContext)(require_suggestion.SuggestionContext);
20
20
  (0, react.useEffect)(handleFilter);
21
21
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("u-datalist", {
@@ -8,12 +8,12 @@ import { HTMLAttributes } from "react";
8
8
  type SuggestionListProps = MergeRight<DefaultProps & HTMLAttributes<HTMLDataListElement>, {
9
9
  /**
10
10
  * The screen reader announcement for singular Suggestion, where %d is the number of Suggestions
11
- * @default '%d forslag'
11
+ * @deprecated Please use `data-sr-singular` on `<Suggestion>` instead
12
12
  */
13
13
  singular?: string;
14
14
  /**
15
15
  * The screen reader announcement for plural Suggestions, where %d is the number of Suggestions
16
- * @default '%d forslag'
16
+ * @deprecated Please use `data-sr-plural` on `<Suggestion>` instead
17
17
  */
18
18
  plural?: string;
19
19
  /**
@@ -36,12 +36,12 @@ type SuggestionListProps = MergeRight<DefaultProps & HTMLAttributes<HTMLDataList
36
36
  declare const SuggestionList: import("react").ForwardRefExoticComponent<Omit<DefaultProps & HTMLAttributes<HTMLDataListElement>, "autoPlacement" | "singular" | "plural"> & {
37
37
  /**
38
38
  * The screen reader announcement for singular Suggestion, where %d is the number of Suggestions
39
- * @default '%d forslag'
39
+ * @deprecated Please use `data-sr-singular` on `<Suggestion>` instead
40
40
  */
41
41
  singular?: string;
42
42
  /**
43
43
  * The screen reader announcement for plural Suggestions, where %d is the number of Suggestions
44
- * @default '%d forslag'
44
+ * @deprecated Please use `data-sr-plural` on `<Suggestion>` instead
45
45
  */
46
46
  plural?: string;
47
47
  /**
@@ -45,7 +45,7 @@ const Suggestion = (0, react.forwardRef)(function Suggestion({ children, classNa
45
45
  */
46
46
  (0, react.useEffect)(() => {
47
47
  const combobox = dsSuggestionRef.current;
48
- const beforeChange = (event) => {
48
+ const beforeSelect = (event) => {
49
49
  event.preventDefault();
50
50
  const multiple = combobox?.multiple;
51
51
  const data = event.detail;
@@ -53,8 +53,8 @@ const Suggestion = (0, react.forwardRef)(function Suggestion({ children, classNa
53
53
  onSelectedChangeRef.current?.(nextItem || null);
54
54
  if (!isControlled) setDefaultItems(sanitizeItems(nextItem));
55
55
  };
56
- combobox?.addEventListener("comboboxbeforeselect", beforeChange);
57
- return () => combobox?.removeEventListener("comboboxbeforeselect", beforeChange);
56
+ combobox?.addEventListener("comboboxbeforeselect", beforeSelect);
57
+ return () => combobox?.removeEventListener("comboboxbeforeselect", beforeSelect);
58
58
  }, [isControlled]);
59
59
  (0, react.useEffect)(() => {
60
60
  const combobox = dsSuggestionRef.current;
@@ -37,7 +37,7 @@ type TabsProps = MergeRight<DefaultProps & Omit<HTMLAttributes<DSTabElement>, 'o
37
37
  * <Tabs.Panel value='3'>content 3</Tabs.Panel>
38
38
  * </Tabs>
39
39
  */
40
- declare const Tabs: import("react").ForwardRefExoticComponent<Omit<DefaultProps & Omit<HTMLAttributes<DSTabElement>, "value" | "onChange">, "value" | "defaultValue" | "onChange"> & {
40
+ declare const Tabs: import("react").ForwardRefExoticComponent<Omit<DefaultProps & Omit<HTMLAttributes<DSTabElement>, "onChange" | "value">, "defaultValue" | "onChange" | "value"> & {
41
41
  /**
42
42
  * Controlled state for `Tabs` component
43
43
  * @default undefined
@@ -4,6 +4,7 @@ let clsx_lite = require("clsx/lite");
4
4
  clsx_lite = require_runtime.__toESM(clsx_lite, 1);
5
5
  let react = require("react");
6
6
  let react_jsx_runtime = require("react/jsx-runtime");
7
+ let _radix_ui_react_slot = require("@radix-ui/react-slot");
7
8
  //#region src/components/tag/tag.tsx
8
9
  /**
9
10
  * Use `Tag` to display categories or statuses.
@@ -11,8 +12,8 @@ let react_jsx_runtime = require("react/jsx-runtime");
11
12
  * @example
12
13
  * <Tag>Melk</Tag>
13
14
  */
14
- const Tag = (0, react.forwardRef)(function Tag({ className, variant, ...rest }, ref) {
15
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
15
+ const Tag = (0, react.forwardRef)(function Tag({ asChild, className, variant, ...rest }, ref) {
16
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(asChild ? _radix_ui_react_slot.Slot : "span", {
16
17
  className: (0, clsx_lite.default)("ds-tag", className),
17
18
  ref,
18
19
  "data-variant": variant,
@@ -5,6 +5,11 @@ import "../../utilities/index.cjs";
5
5
  import { HTMLAttributes } from "react";
6
6
  //#region src/components/tag/tag.d.ts
7
7
  type TagProps = MergeRight<DefaultProps & HTMLAttributes<HTMLSpanElement>, {
8
+ /**
9
+ * Change the default rendered element for the one passed as a child, merging their props and behavior.
10
+ * @default false
11
+ */
12
+ asChild?: boolean;
8
13
  /**
9
14
  * The visual variant of the tag
10
15
  *
@@ -18,7 +23,12 @@ type TagProps = MergeRight<DefaultProps & HTMLAttributes<HTMLSpanElement>, {
18
23
  * @example
19
24
  * <Tag>Melk</Tag>
20
25
  */
21
- declare const Tag: import("react").ForwardRefExoticComponent<Omit<DefaultProps & HTMLAttributes<HTMLSpanElement>, "variant"> & {
26
+ declare const Tag: import("react").ForwardRefExoticComponent<Omit<DefaultProps & HTMLAttributes<HTMLSpanElement>, "asChild" | "variant"> & {
27
+ /**
28
+ * Change the default rendered element for the one passed as a child, merging their props and behavior.
29
+ * @default false
30
+ */
31
+ asChild?: boolean;
22
32
  /**
23
33
  * The visual variant of the tag
24
34
  *
@@ -54,7 +54,7 @@ type TooltipProps = MergeRight<DefaultProps & HTMLAttributes<HTMLDivElement>, {
54
54
  * Hover me
55
55
  * </Tooltip>
56
56
  */
57
- declare const Tooltip: import("react").ForwardRefExoticComponent<Omit<DefaultProps & HTMLAttributes<HTMLDivElement>, "content" | "children" | "type" | "placement" | "open" | "autoPlacement"> & {
57
+ declare const Tooltip: import("react").ForwardRefExoticComponent<Omit<DefaultProps & HTMLAttributes<HTMLDivElement>, "children" | "content" | "type" | "placement" | "open" | "autoPlacement"> & {
58
58
  /**
59
59
  * The element or string that triggers the tooltip.
60
60
  *
@@ -1,6 +1,6 @@
1
1
 
2
- import { useEffect } from "react";
2
+ import { useLayoutEffect } from "react";
3
3
  //#region src/utilities/hooks/deprecated/use-isomorphic-layout-effect/use-isomorphic-layout-effect.d.ts
4
- declare const useIsomorphicLayoutEffect: typeof useEffect;
4
+ declare const useIsomorphicLayoutEffect: typeof useLayoutEffect;
5
5
  //#endregion
6
6
  export { useIsomorphicLayoutEffect };
@@ -1,5 +1,5 @@
1
1
 
2
- import { useEffect } from "react";
2
+ import { useLayoutEffect } from "react";
3
3
  //#region src/utilities/hooks/use-synchronized-animation/use-synchronized-animation.d.ts
4
4
  /**
5
5
  * Synchronizes the css animation of multiple elements with the same `animationName`.
@@ -17,7 +17,7 @@ import { useFloatingCombobox } from "./useFloatingCombobox.js";
17
17
  import { useFormField } from "./useFormField/useFormField.js";
18
18
  import cl from "clsx/lite";
19
19
  import { forwardRef, useEffect, useRef, useState } from "react";
20
- import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
20
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
21
21
  import { FloatingFocusManager, FloatingPortal } from "@floating-ui/react";
22
22
  import { useVirtualizer } from "@tanstack/react-virtual";
23
23
  //#region src/components/Combobox/Combobox.tsx
@@ -241,7 +241,7 @@ const ComboboxComponent = forwardRef(({ value, initialValue = [], onValueChange,
241
241
  "aria-label": "Laster",
242
242
  "data-size": "sm"
243
243
  }), loadingLabel]
244
- }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [restChildren, !virtual && filteredOptionsChildren] })]
244
+ }) : /* @__PURE__ */ jsxs(Fragment, { children: [restChildren, !virtual && filteredOptionsChildren] })]
245
245
  })
246
246
  })
247
247
  })]
@@ -3,13 +3,13 @@ import { ComboboxContext } from "../ComboboxContext.js";
3
3
  import { ChipRemovable } from "../../chip/chips.js";
4
4
  import "../../chip/index.js";
5
5
  import { useContext } from "react";
6
- import { Fragment as Fragment$1, jsx } from "react/jsx-runtime";
6
+ import { Fragment, jsx } from "react/jsx-runtime";
7
7
  //#region src/components/Combobox/internal/ComboboxChips.tsx
8
8
  const ComboboxChips = () => {
9
9
  const context = useContext(ComboboxContext);
10
10
  if (!context) throw new Error("ComboboxContext is missing");
11
11
  const { size, readOnly, disabled, selectedOptions, chipSrLabel, handleSelectOption, inputRef } = context;
12
- return /* @__PURE__ */ jsx(Fragment$1, { children: Object.keys(selectedOptions).map((value) => {
12
+ return /* @__PURE__ */ jsx(Fragment, { children: Object.keys(selectedOptions).map((value) => {
13
13
  return /* @__PURE__ */ jsx(ChipRemovable, {
14
14
  "data-size": size,
15
15
  disabled,
@@ -33,8 +33,14 @@ type AvatarProps = MergeRight<DefaultProps & HTMLAttributes<HTMLSpanElement>, Ar
33
33
  variant?: 'circle' | 'square';
34
34
  /**
35
35
  * Initials to display inside the avatar.
36
+ * @deprecated Please use text content as children instead
36
37
  */
37
38
  initials?: string;
39
+ /**
40
+ * Initials to display inside the avatar.
41
+ * @deprecated Please use text content as children instead
42
+ */
43
+ 'data-initials'?: string;
38
44
  /**
39
45
  * Change the default rendered element for the one passed as a child, merging their props and behavior.
40
46
  * @default false
@@ -42,8 +48,6 @@ type AvatarProps = MergeRight<DefaultProps & HTMLAttributes<HTMLSpanElement>, Ar
42
48
  asChild?: boolean;
43
49
  /**
44
50
  * Image, icon or initials to display inside the avatar.
45
- *
46
- * Gets `aria-hidden="true"`
47
51
  */
48
52
  children?: ReactNode;
49
53
  }>;
@@ -1,8 +1,8 @@
1
1
  'use client';
2
2
  import cl from "clsx/lite";
3
- import { Fragment, forwardRef } from "react";
3
+ import { forwardRef, isValidElement } from "react";
4
4
  import { jsx } from "react/jsx-runtime";
5
- import { Slot } from "@radix-ui/react-slot";
5
+ import { Slot, Slottable } from "@radix-ui/react-slot";
6
6
  //#region src/components/avatar/avatar.tsx
7
7
  /**
8
8
  * Avatars are used to represent people or entities.
@@ -20,25 +20,21 @@ import { Slot } from "@radix-ui/react-slot";
20
20
  * <Icon />
21
21
  * </Avatar>
22
22
  */
23
- const Avatar = forwardRef(function Avatar({ "aria-label": ariaLabel, "data-tooltip": dataTooltip, variant, className, children, initials, asChild, ...rest }, ref) {
24
- const OuterComponent = asChild ? Slot : "span";
25
- const useSlot = children && typeof children !== "string";
26
- const textChild = children && typeof children === "string";
27
- const Component = useSlot ? Slot : Fragment;
28
- return /* @__PURE__ */ jsx(OuterComponent, {
29
- ref,
23
+ const Avatar = forwardRef(function Avatar({ "aria-label": label, "data-tooltip": tooltip, "data-initials": dataInitials, children, variant, className, initials: propInitials, asChild, ...rest }, ref) {
24
+ const Component = asChild ? Slot : "span";
25
+ const initials = propInitials ?? dataInitials;
26
+ const hasSlottedChildren = asChild && isValidElement(children) && children.props.children !== void 0 && children.props.children !== null;
27
+ return /* @__PURE__ */ jsx(Component, {
28
+ "aria-label": label || tooltip,
30
29
  className: cl("ds-avatar", className),
31
- "data-variant": variant,
32
30
  "data-initials": initials,
31
+ "data-tooltip": tooltip,
32
+ "data-variant": variant,
33
+ ref,
33
34
  role: asChild ? void 0 : "img",
34
- "aria-label": ariaLabel || dataTooltip,
35
- "data-tooltip": dataTooltip,
36
- tabIndex: dataTooltip ? 0 : void 0,
35
+ tabIndex: tooltip ? 0 : void 0,
37
36
  ...rest,
38
- children: /* @__PURE__ */ jsx(Component, {
39
- ...useSlot && !asChild ? { "aria-hidden": true } : {},
40
- children: textChild ? /* @__PURE__ */ jsx("span", { children }) : children
41
- })
37
+ children: asChild ? [/* @__PURE__ */ jsx(Slottable, { children }, "slottable"), hasSlottedChildren ? null : initials] : children ?? initials
42
38
  });
43
39
  });
44
40
  //#endregion
@@ -27,7 +27,7 @@ type BadgePositionProps = MergeRight<DefaultProps & HTMLAttributes<HTMLSpanEleme
27
27
  * <Element />
28
28
  * </BadgePosition>
29
29
  */
30
- declare const BadgePosition: import("react").ForwardRefExoticComponent<Omit<DefaultProps & HTMLAttributes<HTMLSpanElement>, "placement" | "overlap"> & {
30
+ declare const BadgePosition: import("react").ForwardRefExoticComponent<Omit<DefaultProps & HTMLAttributes<HTMLSpanElement>, "overlap" | "placement"> & {
31
31
  /**
32
32
  * The placement of the badge
33
33
  *
@@ -16,7 +16,7 @@ declare const Badge: import("react").ForwardRefExoticComponent<Omit<DefaultProps
16
16
  variant?: "base" | "tinted";
17
17
  children?: never;
18
18
  } & import("react").RefAttributes<HTMLSpanElement>> & {
19
- Position: import("react").ForwardRefExoticComponent<Omit<DefaultProps & import("react").HTMLAttributes<HTMLSpanElement>, "placement" | "overlap"> & {
19
+ Position: import("react").ForwardRefExoticComponent<Omit<DefaultProps & import("react").HTMLAttributes<HTMLSpanElement>, "overlap" | "placement"> & {
20
20
  placement?: "top-right" | "top-left" | "bottom-right" | "bottom-left";
21
21
  overlap?: "circle" | "rectangle";
22
22
  } & import("react").RefAttributes<HTMLSpanElement>>;
@@ -4,7 +4,7 @@ import { LinkProps } from "../link/link.js";
4
4
  import "../../index.js";
5
5
  //#region src/components/breadcrumbs/breadcrumbs-link.d.ts
6
6
  type BreadcrumbsLinkProps = LinkProps;
7
- declare const BreadcrumbsLink: import("react").ForwardRefExoticComponent<Omit<DefaultProps & import("react").AnchorHTMLAttributes<HTMLAnchorElement>, "asChild" | "children"> & {
7
+ declare const BreadcrumbsLink: import("react").ForwardRefExoticComponent<Omit<DefaultProps & import("react").AnchorHTMLAttributes<HTMLAnchorElement>, "children" | "asChild"> & {
8
8
  children: import("react").ReactNode;
9
9
  asChild?: boolean;
10
10
  } & import("react").RefAttributes<HTMLAnchorElement>>;
@@ -29,7 +29,7 @@ type CardProps = MergeRight<DefaultProps & HTMLAttributes<HTMLDivElement>, {
29
29
  * <Card.Block>Footer</Card.Block>
30
30
  * </Card>
31
31
  */
32
- declare const Card: import("react").ForwardRefExoticComponent<Omit<DefaultProps & HTMLAttributes<HTMLDivElement>, "asChild" | "children" | "variant"> & {
32
+ declare const Card: import("react").ForwardRefExoticComponent<Omit<DefaultProps & HTMLAttributes<HTMLDivElement>, "children" | "asChild" | "variant"> & {
33
33
  /**
34
34
  * Change the background color of the card.
35
35
  *
@@ -71,7 +71,7 @@ type DialogProps = MergeRight<DefaultProps & DialogHTMLAttributes<HTMLDialogElem
71
71
  * Content
72
72
  * </Dialog>
73
73
  */
74
- declare const Dialog: import("react").ForwardRefExoticComponent<Omit<DefaultProps & DialogHTMLAttributes<HTMLDialogElement>, "asChild" | "placement" | "open" | "onClose" | "closedby" | "closeButton" | "modal"> & {
74
+ declare const Dialog: import("react").ForwardRefExoticComponent<Omit<DefaultProps & DialogHTMLAttributes<HTMLDialogElement>, "asChild" | "placement" | "open" | "closedby" | "onClose" | "closeButton" | "modal"> & {
75
75
  /**
76
76
  * Screen reader label of close button. Set false to hide the close button.
77
77
  * @default 'Lukk dialogvindu'
@@ -14,7 +14,7 @@ type ErrorSummaryLinkProps = LinkProps;
14
14
  * </ErrorSummaryItem>
15
15
  * </ErrorSummary>
16
16
  */
17
- declare const ErrorSummaryLink: import("react").ForwardRefExoticComponent<Omit<DefaultProps & import("react").AnchorHTMLAttributes<HTMLAnchorElement>, "asChild" | "children"> & {
17
+ declare const ErrorSummaryLink: import("react").ForwardRefExoticComponent<Omit<DefaultProps & import("react").AnchorHTMLAttributes<HTMLAnchorElement>, "children" | "asChild"> & {
18
18
  children: import("react").ReactNode;
19
19
  asChild?: boolean;
20
20
  } & import("react").RefAttributes<HTMLAnchorElement>>;
@@ -21,7 +21,7 @@ type LinkProps = MergeRight<DefaultProps & AnchorHTMLAttributes<HTMLAnchorElemen
21
21
  * @example
22
22
  * <Link href='#'>Link</Link>
23
23
  */
24
- declare const Link: import("react").ForwardRefExoticComponent<Omit<DefaultProps & AnchorHTMLAttributes<HTMLAnchorElement>, "asChild" | "children"> & {
24
+ declare const Link: import("react").ForwardRefExoticComponent<Omit<DefaultProps & AnchorHTMLAttributes<HTMLAnchorElement>, "children" | "asChild"> & {
25
25
  /**
26
26
  * The content to display inside the link.
27
27
  **/
@@ -62,7 +62,7 @@ type PopoverProps = MergeRight<DefaultProps & HTMLAttributes<HTMLDivElement>, {
62
62
  * Content
63
63
  * </Popover>
64
64
  */
65
- declare const Popover: import("react").ForwardRefExoticComponent<Omit<DefaultProps & HTMLAttributes<HTMLDivElement>, "asChild" | "id" | "variant" | "placement" | "open" | "onOpen" | "onClose" | "autoPlacement"> & {
65
+ declare const Popover: import("react").ForwardRefExoticComponent<Omit<DefaultProps & HTMLAttributes<HTMLDivElement>, "asChild" | "id" | "variant" | "placement" | "open" | "onClose" | "onOpen" | "autoPlacement"> & {
66
66
  /**
67
67
  * id to connect the trigger with the popover - required when not using Popover.Context.
68
68
  */
@@ -1,13 +1,16 @@
1
1
 
2
- import { ButtonProps } from "../button/button.js";
2
+ import { DefaultProps } from "../../types.js";
3
+ import { MergeRight } from "../../utilities/types.js";
4
+ import "../../utilities/index.js";
5
+ import { ButtonHTMLAttributes } from "react";
3
6
  //#region src/components/search/search-clear.d.ts
4
- type SearchClearProps = Omit<ButtonProps, 'variant' | 'children'> & {
7
+ type SearchClearProps = MergeRight<DefaultProps & ButtonHTMLAttributes<HTMLButtonElement>, {
5
8
  /**
6
9
  * Aria label for the clear button
7
- * @default 'Tøm'
10
+ * @deprecated Please use `--dsc-suggestion-sr-clear` or `data-sr-clear` on Suggestion to set label.
8
11
  */
9
12
  'aria-label'?: string;
10
- };
13
+ }>;
11
14
  /**
12
15
  * SearchClear component, used to display a clear button when the search input is not empty.
13
16
  *
@@ -17,10 +20,10 @@ type SearchClearProps = Omit<ButtonProps, 'variant' | 'children'> & {
17
20
  * <SearchClear />
18
21
  * </Search>
19
22
  */
20
- declare const SearchClear: import("react").ForwardRefExoticComponent<Omit<ButtonProps, "children" | "variant"> & {
23
+ declare const SearchClear: import("react").ForwardRefExoticComponent<Omit<DefaultProps & ButtonHTMLAttributes<HTMLButtonElement>, "aria-label"> & {
21
24
  /**
22
25
  * Aria label for the clear button
23
- * @default 'Tøm'
26
+ * @deprecated Please use `--dsc-suggestion-sr-clear` or `data-sr-clear` on Suggestion to set label.
24
27
  */
25
28
  'aria-label'?: string;
26
29
  } & import("react").RefAttributes<HTMLButtonElement>>;
@@ -1,5 +1,4 @@
1
1
  'use client';
2
- import { Button } from "../button/button.js";
3
2
  import { forwardRef } from "react";
4
3
  import { jsx } from "react/jsx-runtime";
5
4
  //#region src/components/search/search-clear.tsx
@@ -12,12 +11,12 @@ import { jsx } from "react/jsx-runtime";
12
11
  * <SearchClear />
13
12
  * </Search>
14
13
  */
15
- const SearchClear = forwardRef(function SearchClear({ "aria-label": label = "Tøm", ...rest }, ref) {
16
- return /* @__PURE__ */ jsx(Button, {
17
- "aria-label": label,
14
+ const SearchClear = forwardRef(function SearchClear(rest, ref) {
15
+ return /* @__PURE__ */ jsx("button", {
16
+ hidden: true,
18
17
  ref,
19
18
  type: "reset",
20
- variant: "tertiary",
19
+ suppressHydrationWarning: true,
21
20
  ...rest
22
21
  });
23
22
  });
@@ -24,6 +24,7 @@ const Search = forwardRef(function Search({ className, ...rest }, ref) {
24
24
  return /* @__PURE__ */ jsx("ds-suggestion", {
25
25
  ref,
26
26
  class: cl("ds-search", className),
27
+ suppressHydrationWarning: true,
27
28
  ...rest
28
29
  });
29
30
  });
@@ -7,7 +7,7 @@ import { ButtonHTMLAttributes } from "react";
7
7
  type SuggestionClearProps = MergeRight<DefaultProps & ButtonHTMLAttributes<HTMLButtonElement>, {
8
8
  /**
9
9
  * Aria label for the clear button
10
- * @default 'Tøm'
10
+ * @deprecated Please use `--dsc-suggestion-sr-clear` or `data-sr-clear` on Suggestion to set label.
11
11
  */
12
12
  'aria-label'?: string;
13
13
  }>;
@@ -27,7 +27,7 @@ type SuggestionClearProps = MergeRight<DefaultProps & ButtonHTMLAttributes<HTMLB
27
27
  declare const SuggestionClear: import("react").ForwardRefExoticComponent<Omit<DefaultProps & ButtonHTMLAttributes<HTMLButtonElement>, "aria-label"> & {
28
28
  /**
29
29
  * Aria label for the clear button
30
- * @default 'Tøm'
30
+ * @deprecated Please use `--dsc-suggestion-sr-clear` or `data-sr-clear` on Suggestion to set label.
31
31
  */
32
32
  'aria-label'?: string;
33
33
  } & import("react").RefAttributes<HTMLButtonElement>>;
@@ -15,9 +15,8 @@ import { jsx } from "react/jsx-runtime";
15
15
  * <Suggestion.List />
16
16
  * </Suggestion>
17
17
  */
18
- const SuggestionClear = forwardRef(function SuggestionClear({ "aria-label": label = "Tøm", ...rest }, ref) {
18
+ const SuggestionClear = forwardRef(function SuggestionClear(rest, ref) {
19
19
  return /* @__PURE__ */ jsx("button", {
20
- "aria-label": label,
21
20
  hidden: true,
22
21
  ref,
23
22
  suppressHydrationWarning: true,
@@ -6,7 +6,7 @@ import { OptionHTMLAttributes } from "react";
6
6
  type SuggestionEmptyProps = DefaultProps & OptionHTMLAttributes<HTMLOptionElement> & {
7
7
  /**
8
8
  * Optionally the text to display when the suggestion list is empty.
9
- * If <Suggestion> has `data-creatable`, use `{value}` to replace with the current input value.
9
+ * If <Suggestion> has `data-creatable`, use `%s` to replace with the current input value.
10
10
  **/
11
11
  'data-empty'?: string;
12
12
  };
@@ -23,7 +23,7 @@ type SuggestionEmptyProps = DefaultProps & OptionHTMLAttributes<HTMLOptionElemen
23
23
  declare const SuggestionEmpty: import("react").ForwardRefExoticComponent<DefaultProps & OptionHTMLAttributes<HTMLOptionElement> & {
24
24
  /**
25
25
  * Optionally the text to display when the suggestion list is empty.
26
- * If <Suggestion> has `data-creatable`, use `{value}` to replace with the current input value.
26
+ * If <Suggestion> has `data-creatable`, use `%s` to replace with the current input value.
27
27
  **/
28
28
  'data-empty'?: string;
29
29
  } & import("react").RefAttributes<HTMLOptionElement>>;
@@ -8,12 +8,12 @@ import { HTMLAttributes } from "react";
8
8
  type SuggestionListProps = MergeRight<DefaultProps & HTMLAttributes<HTMLDataListElement>, {
9
9
  /**
10
10
  * The screen reader announcement for singular Suggestion, where %d is the number of Suggestions
11
- * @default '%d forslag'
11
+ * @deprecated Please use `data-sr-singular` on `<Suggestion>` instead
12
12
  */
13
13
  singular?: string;
14
14
  /**
15
15
  * The screen reader announcement for plural Suggestions, where %d is the number of Suggestions
16
- * @default '%d forslag'
16
+ * @deprecated Please use `data-sr-plural` on `<Suggestion>` instead
17
17
  */
18
18
  plural?: string;
19
19
  /**
@@ -36,12 +36,12 @@ type SuggestionListProps = MergeRight<DefaultProps & HTMLAttributes<HTMLDataList
36
36
  declare const SuggestionList: import("react").ForwardRefExoticComponent<Omit<DefaultProps & HTMLAttributes<HTMLDataListElement>, "autoPlacement" | "singular" | "plural"> & {
37
37
  /**
38
38
  * The screen reader announcement for singular Suggestion, where %d is the number of Suggestions
39
- * @default '%d forslag'
39
+ * @deprecated Please use `data-sr-singular` on `<Suggestion>` instead
40
40
  */
41
41
  singular?: string;
42
42
  /**
43
43
  * The screen reader announcement for plural Suggestions, where %d is the number of Suggestions
44
- * @default '%d forslag'
44
+ * @deprecated Please use `data-sr-plural` on `<Suggestion>` instead
45
45
  */
46
46
  plural?: string;
47
47
  /**
@@ -15,7 +15,7 @@ import { jsx } from "react/jsx-runtime";
15
15
  * <Suggestion.List />
16
16
  * </Suggestion>
17
17
  */
18
- const SuggestionList = forwardRef(function SuggestionList({ singular = "%d forslag", plural = "%d forslag", className, id, autoPlacement = true, ...rest }, ref) {
18
+ const SuggestionList = forwardRef(function SuggestionList({ singular, plural, className, id, autoPlacement = true, ...rest }, ref) {
19
19
  const { handleFilter } = useContext(SuggestionContext);
20
20
  useEffect(handleFilter);
21
21
  return /* @__PURE__ */ jsx("u-datalist", {
@@ -43,7 +43,7 @@ const Suggestion = forwardRef(function Suggestion({ children, className, creatab
43
43
  */
44
44
  useEffect(() => {
45
45
  const combobox = dsSuggestionRef.current;
46
- const beforeChange = (event) => {
46
+ const beforeSelect = (event) => {
47
47
  event.preventDefault();
48
48
  const multiple = combobox?.multiple;
49
49
  const data = event.detail;
@@ -51,8 +51,8 @@ const Suggestion = forwardRef(function Suggestion({ children, className, creatab
51
51
  onSelectedChangeRef.current?.(nextItem || null);
52
52
  if (!isControlled) setDefaultItems(sanitizeItems(nextItem));
53
53
  };
54
- combobox?.addEventListener("comboboxbeforeselect", beforeChange);
55
- return () => combobox?.removeEventListener("comboboxbeforeselect", beforeChange);
54
+ combobox?.addEventListener("comboboxbeforeselect", beforeSelect);
55
+ return () => combobox?.removeEventListener("comboboxbeforeselect", beforeSelect);
56
56
  }, [isControlled]);
57
57
  useEffect(() => {
58
58
  const combobox = dsSuggestionRef.current;
@@ -37,7 +37,7 @@ type TabsProps = MergeRight<DefaultProps & Omit<HTMLAttributes<DSTabElement>, 'o
37
37
  * <Tabs.Panel value='3'>content 3</Tabs.Panel>
38
38
  * </Tabs>
39
39
  */
40
- declare const Tabs: import("react").ForwardRefExoticComponent<Omit<DefaultProps & Omit<HTMLAttributes<DSTabElement>, "value" | "onChange">, "value" | "defaultValue" | "onChange"> & {
40
+ declare const Tabs: import("react").ForwardRefExoticComponent<Omit<DefaultProps & Omit<HTMLAttributes<DSTabElement>, "onChange" | "value">, "defaultValue" | "onChange" | "value"> & {
41
41
  /**
42
42
  * Controlled state for `Tabs` component
43
43
  * @default undefined
@@ -5,6 +5,11 @@ import "../../utilities/index.js";
5
5
  import { HTMLAttributes } from "react";
6
6
  //#region src/components/tag/tag.d.ts
7
7
  type TagProps = MergeRight<DefaultProps & HTMLAttributes<HTMLSpanElement>, {
8
+ /**
9
+ * Change the default rendered element for the one passed as a child, merging their props and behavior.
10
+ * @default false
11
+ */
12
+ asChild?: boolean;
8
13
  /**
9
14
  * The visual variant of the tag
10
15
  *
@@ -18,7 +23,12 @@ type TagProps = MergeRight<DefaultProps & HTMLAttributes<HTMLSpanElement>, {
18
23
  * @example
19
24
  * <Tag>Melk</Tag>
20
25
  */
21
- declare const Tag: import("react").ForwardRefExoticComponent<Omit<DefaultProps & HTMLAttributes<HTMLSpanElement>, "variant"> & {
26
+ declare const Tag: import("react").ForwardRefExoticComponent<Omit<DefaultProps & HTMLAttributes<HTMLSpanElement>, "asChild" | "variant"> & {
27
+ /**
28
+ * Change the default rendered element for the one passed as a child, merging their props and behavior.
29
+ * @default false
30
+ */
31
+ asChild?: boolean;
22
32
  /**
23
33
  * The visual variant of the tag
24
34
  *
@@ -2,6 +2,7 @@
2
2
  import cl from "clsx/lite";
3
3
  import { forwardRef } from "react";
4
4
  import { jsx } from "react/jsx-runtime";
5
+ import { Slot } from "@radix-ui/react-slot";
5
6
  //#region src/components/tag/tag.tsx
6
7
  /**
7
8
  * Use `Tag` to display categories or statuses.
@@ -9,8 +10,8 @@ import { jsx } from "react/jsx-runtime";
9
10
  * @example
10
11
  * <Tag>Melk</Tag>
11
12
  */
12
- const Tag = forwardRef(function Tag({ className, variant, ...rest }, ref) {
13
- return /* @__PURE__ */ jsx("span", {
13
+ const Tag = forwardRef(function Tag({ asChild, className, variant, ...rest }, ref) {
14
+ return /* @__PURE__ */ jsx(asChild ? Slot : "span", {
14
15
  className: cl("ds-tag", className),
15
16
  ref,
16
17
  "data-variant": variant,
@@ -54,7 +54,7 @@ type TooltipProps = MergeRight<DefaultProps & HTMLAttributes<HTMLDivElement>, {
54
54
  * Hover me
55
55
  * </Tooltip>
56
56
  */
57
- declare const Tooltip: import("react").ForwardRefExoticComponent<Omit<DefaultProps & HTMLAttributes<HTMLDivElement>, "content" | "children" | "type" | "placement" | "open" | "autoPlacement"> & {
57
+ declare const Tooltip: import("react").ForwardRefExoticComponent<Omit<DefaultProps & HTMLAttributes<HTMLDivElement>, "children" | "content" | "type" | "placement" | "open" | "autoPlacement"> & {
58
58
  /**
59
59
  * The element or string that triggers the tooltip.
60
60
  *
@@ -1,6 +1,6 @@
1
1
 
2
- import { useEffect } from "react";
2
+ import { useLayoutEffect } from "react";
3
3
  //#region src/utilities/hooks/deprecated/use-isomorphic-layout-effect/use-isomorphic-layout-effect.d.ts
4
- declare const useIsomorphicLayoutEffect: typeof useEffect;
4
+ declare const useIsomorphicLayoutEffect: typeof useLayoutEffect;
5
5
  //#endregion
6
6
  export { useIsomorphicLayoutEffect };
@@ -1,5 +1,5 @@
1
1
 
2
- import { useEffect } from "react";
2
+ import { useLayoutEffect } from "react";
3
3
  //#region src/utilities/hooks/use-synchronized-animation/use-synchronized-animation.d.ts
4
4
  /**
5
5
  * Synchronizes the css animation of multiple elements with the same `animationName`.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@digdir/designsystemet-react",
3
3
  "type": "module",
4
- "version": "1.21.0",
4
+ "version": "1.22.0",
5
5
  "description": "React components for Designsystemet",
6
6
  "author": "Designsystemet team",
7
7
  "repository": {
@@ -40,31 +40,31 @@
40
40
  "access": "public"
41
41
  },
42
42
  "dependencies": {
43
+ "@digdir/designsystemet-types": "1.22.0",
44
+ "@digdir/designsystemet-web": "1.22.0",
43
45
  "@floating-ui/dom": "^1.8.0",
44
46
  "@floating-ui/react": "0.26.23",
45
- "@navikt/aksel-icons": "^8.16.1",
47
+ "@navikt/aksel-icons": "^8.16.2",
46
48
  "@radix-ui/react-slot": "^1.3.3",
47
49
  "@tanstack/react-virtual": "^3.14.10",
48
- "clsx": "^2.1.1",
49
- "@digdir/designsystemet-types": "1.21.0",
50
- "@digdir/designsystemet-web": "1.21.0"
50
+ "clsx": "^2.1.1"
51
51
  },
52
52
  "devDependencies": {
53
- "@storybook/addon-docs": "10.5.10",
54
- "@storybook/addon-vitest": "10.5.10",
55
- "@storybook/react-vite": "10.5.10",
53
+ "@digdir/designsystemet-css": "^1.22.0",
54
+ "@storybook/addon-docs": "10.6.0",
55
+ "@storybook/addon-vitest": "10.6.0",
56
+ "@storybook/react-vite": "10.6.0",
56
57
  "@testing-library/jest-dom": "7.0.1",
57
- "@testing-library/react": "16.3.2",
58
- "@testing-library/user-event": "14.6.6",
58
+ "@testing-library/react": "16.3.3",
59
+ "@testing-library/user-event": "14.6.7",
59
60
  "@types/react": "19.2.18",
60
- "@types/react-dom": "19.2.5",
61
+ "@types/react-dom": "19.2.7",
61
62
  "react": "19.2.8",
62
63
  "react-dom": "19.2.8",
63
64
  "react-dropzone": "19.3.0",
64
- "storybook": "10.5.10",
65
+ "storybook": "10.6.0",
65
66
  "tsdown": "0.22.14",
66
- "typescript": "6.0.3",
67
- "@digdir/designsystemet-css": "^1.21.0"
67
+ "typescript": "6.0.3"
68
68
  },
69
69
  "scripts": {
70
70
  "build": "tsdown",