@digdir/designsystemet-react 1.21.1 → 1.23.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/cjs/components/avatar/avatar.cjs +12 -16
- package/dist/cjs/components/avatar/avatar.d.cts +7 -3
- package/dist/cjs/components/avatar-stack/avatar-stack.cjs +1 -1
- package/dist/cjs/components/avatar-stack/avatar-stack.d.cts +1 -1
- package/dist/cjs/components/dialog/dialog.d.cts +1 -1
- package/dist/cjs/components/label/label.d.cts +2 -0
- package/dist/cjs/components/popover/popover.d.cts +1 -1
- package/dist/cjs/components/search/search-clear.cjs +4 -5
- package/dist/cjs/components/search/search-clear.d.cts +9 -6
- package/dist/cjs/components/search/search.cjs +1 -0
- package/dist/cjs/components/suggestion/suggestion-clear.cjs +1 -2
- package/dist/cjs/components/suggestion/suggestion-clear.d.cts +2 -2
- package/dist/cjs/components/suggestion/suggestion-empty.d.cts +2 -2
- package/dist/cjs/components/suggestion/suggestion-list.cjs +1 -1
- package/dist/cjs/components/suggestion/suggestion-list.d.cts +4 -4
- package/dist/cjs/components/suggestion/suggestion.cjs +3 -3
- package/dist/cjs/components/tag/tag.cjs +3 -2
- package/dist/cjs/components/tag/tag.d.cts +11 -1
- package/dist/cjs/components/tooltip/tooltip.d.cts +1 -1
- package/dist/esm/components/Combobox/Combobox.js +2 -2
- package/dist/esm/components/Combobox/internal/ComboboxChips.js +2 -2
- package/dist/esm/components/avatar/avatar.d.ts +7 -3
- package/dist/esm/components/avatar/avatar.js +14 -18
- package/dist/esm/components/avatar-stack/avatar-stack.d.ts +1 -1
- package/dist/esm/components/avatar-stack/avatar-stack.js +1 -1
- package/dist/esm/components/dialog/dialog.d.ts +1 -1
- package/dist/esm/components/label/label.d.ts +2 -0
- package/dist/esm/components/popover/popover.d.ts +1 -1
- package/dist/esm/components/search/search-clear.d.ts +9 -6
- package/dist/esm/components/search/search-clear.js +4 -5
- package/dist/esm/components/search/search.js +1 -0
- package/dist/esm/components/suggestion/suggestion-clear.d.ts +2 -2
- package/dist/esm/components/suggestion/suggestion-clear.js +1 -2
- package/dist/esm/components/suggestion/suggestion-empty.d.ts +2 -2
- package/dist/esm/components/suggestion/suggestion-list.d.ts +4 -4
- package/dist/esm/components/suggestion/suggestion-list.js +1 -1
- package/dist/esm/components/suggestion/suggestion.js +3 -3
- package/dist/esm/components/tag/tag.d.ts +11 -1
- package/dist/esm/components/tag/tag.js +3 -2
- package/dist/esm/components/tooltip/tooltip.d.ts +1 -1
- package/package.json +12 -12
|
@@ -10,7 +10,7 @@ let _radix_ui_react_slot = require("@radix-ui/react-slot");
|
|
|
10
10
|
* Avatars are used to represent people or entities.
|
|
11
11
|
*
|
|
12
12
|
* @example
|
|
13
|
-
* <Avatar aria-label="John Doe"
|
|
13
|
+
* <Avatar aria-label="John Doe">JD</Avatar>
|
|
14
14
|
*
|
|
15
15
|
* @example
|
|
16
16
|
* <Avatar aria-label="John Doe">
|
|
@@ -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":
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
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
|
-
|
|
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)(
|
|
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
|
}>;
|
|
@@ -51,7 +55,7 @@ type AvatarProps = MergeRight<DefaultProps & HTMLAttributes<HTMLSpanElement>, Ar
|
|
|
51
55
|
* Avatars are used to represent people or entities.
|
|
52
56
|
*
|
|
53
57
|
* @example
|
|
54
|
-
* <Avatar aria-label="John Doe"
|
|
58
|
+
* <Avatar aria-label="John Doe">JD</Avatar>
|
|
55
59
|
*
|
|
56
60
|
* @example
|
|
57
61
|
* <Avatar aria-label="John Doe">
|
|
@@ -16,7 +16,7 @@ let react_jsx_runtime = require("react/jsx-runtime");
|
|
|
16
16
|
* <Avatar aria-label='name'>
|
|
17
17
|
* <BriefcaseIcon />
|
|
18
18
|
* </Avatar>
|
|
19
|
-
* <Avatar aria-label='name'
|
|
19
|
+
* <Avatar aria-label='name'>sm</Avatar>
|
|
20
20
|
* </EXPERIMENTAL_AvatarStack>
|
|
21
21
|
*/
|
|
22
22
|
const EXPERIMENTAL_AvatarStack = (0, react.forwardRef)(function AvatarStack({ className, gap, suffix, children, avatarSize, overlap, style, expandable, ...rest }, ref) {
|
|
@@ -43,7 +43,7 @@ type AvatarStackProps = {
|
|
|
43
43
|
* <Avatar aria-label='name'>
|
|
44
44
|
* <BriefcaseIcon />
|
|
45
45
|
* </Avatar>
|
|
46
|
-
* <Avatar aria-label='name'
|
|
46
|
+
* <Avatar aria-label='name'>sm</Avatar>
|
|
47
47
|
* </EXPERIMENTAL_AvatarStack>
|
|
48
48
|
*/
|
|
49
49
|
declare const EXPERIMENTAL_AvatarStack: import("react").ForwardRefExoticComponent<{
|
|
@@ -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" | "
|
|
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'
|
|
@@ -5,6 +5,7 @@ import { LabelHTMLAttributes } from "react";
|
|
|
5
5
|
type LabelProps = {
|
|
6
6
|
/**
|
|
7
7
|
* Adjusts font weight. Use this when you have a label hierarchy, such as checkboxes/radios in a fieldset
|
|
8
|
+
* @deprecated as field now automatically changes font-weight based on input type
|
|
8
9
|
*/
|
|
9
10
|
weight?: 'regular' | 'medium' | 'semibold';
|
|
10
11
|
/**
|
|
@@ -22,6 +23,7 @@ type LabelProps = {
|
|
|
22
23
|
declare const Label: import("react").ForwardRefExoticComponent<{
|
|
23
24
|
/**
|
|
24
25
|
* Adjusts font weight. Use this when you have a label hierarchy, such as checkboxes/radios in a fieldset
|
|
26
|
+
* @deprecated as field now automatically changes font-weight based on input type
|
|
25
27
|
*/
|
|
26
28
|
weight?: "regular" | "medium" | "semibold";
|
|
27
29
|
/**
|
|
@@ -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" | "
|
|
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(
|
|
16
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
17
|
-
|
|
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
|
-
|
|
19
|
+
suppressHydrationWarning: true,
|
|
21
20
|
...rest
|
|
22
21
|
});
|
|
23
22
|
});
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
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 =
|
|
7
|
+
type SearchClearProps = MergeRight<DefaultProps & ButtonHTMLAttributes<HTMLButtonElement>, {
|
|
5
8
|
/**
|
|
6
9
|
* Aria label for the clear button
|
|
7
|
-
* @
|
|
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<
|
|
23
|
+
declare const SearchClear: import("react").ForwardRefExoticComponent<Omit<DefaultProps & ButtonHTMLAttributes<HTMLButtonElement>, "aria-label"> & {
|
|
21
24
|
/**
|
|
22
25
|
* Aria label for the clear button
|
|
23
|
-
* @
|
|
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(
|
|
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
|
-
* @
|
|
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
|
-
* @
|
|
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 `
|
|
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 `
|
|
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
|
|
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
|
-
* @
|
|
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
|
-
* @
|
|
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
|
-
* @
|
|
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
|
-
* @
|
|
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
|
|
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",
|
|
57
|
-
return () => combobox?.removeEventListener("comboboxbeforeselect",
|
|
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;
|
|
@@ -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" | "
|
|
57
|
+
declare const Tooltip: import("react").ForwardRefExoticComponent<Omit<DefaultProps & HTMLAttributes<HTMLDivElement>, "content" | "children" | "type" | "placement" | "open" | "autoPlacement"> & {
|
|
58
58
|
/**
|
|
59
59
|
* The element or string that triggers the tooltip.
|
|
60
60
|
*
|
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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
|
}>;
|
|
@@ -51,7 +55,7 @@ type AvatarProps = MergeRight<DefaultProps & HTMLAttributes<HTMLSpanElement>, Ar
|
|
|
51
55
|
* Avatars are used to represent people or entities.
|
|
52
56
|
*
|
|
53
57
|
* @example
|
|
54
|
-
* <Avatar aria-label="John Doe"
|
|
58
|
+
* <Avatar aria-label="John Doe">JD</Avatar>
|
|
55
59
|
*
|
|
56
60
|
* @example
|
|
57
61
|
* <Avatar aria-label="John Doe">
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import cl from "clsx/lite";
|
|
3
|
-
import {
|
|
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.
|
|
9
9
|
*
|
|
10
10
|
* @example
|
|
11
|
-
* <Avatar aria-label="John Doe"
|
|
11
|
+
* <Avatar aria-label="John Doe">JD</Avatar>
|
|
12
12
|
*
|
|
13
13
|
* @example
|
|
14
14
|
* <Avatar aria-label="John Doe">
|
|
@@ -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":
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
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
|
-
|
|
35
|
-
"data-tooltip": dataTooltip,
|
|
36
|
-
tabIndex: dataTooltip ? 0 : void 0,
|
|
35
|
+
tabIndex: tooltip ? 0 : void 0,
|
|
37
36
|
...rest,
|
|
38
|
-
children: /* @__PURE__ */ jsx(
|
|
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
|
|
@@ -43,7 +43,7 @@ type AvatarStackProps = {
|
|
|
43
43
|
* <Avatar aria-label='name'>
|
|
44
44
|
* <BriefcaseIcon />
|
|
45
45
|
* </Avatar>
|
|
46
|
-
* <Avatar aria-label='name'
|
|
46
|
+
* <Avatar aria-label='name'>sm</Avatar>
|
|
47
47
|
* </EXPERIMENTAL_AvatarStack>
|
|
48
48
|
*/
|
|
49
49
|
declare const EXPERIMENTAL_AvatarStack: import("react").ForwardRefExoticComponent<{
|
|
@@ -14,7 +14,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
14
14
|
* <Avatar aria-label='name'>
|
|
15
15
|
* <BriefcaseIcon />
|
|
16
16
|
* </Avatar>
|
|
17
|
-
* <Avatar aria-label='name'
|
|
17
|
+
* <Avatar aria-label='name'>sm</Avatar>
|
|
18
18
|
* </EXPERIMENTAL_AvatarStack>
|
|
19
19
|
*/
|
|
20
20
|
const EXPERIMENTAL_AvatarStack = forwardRef(function AvatarStack({ className, gap, suffix, children, avatarSize, overlap, style, expandable, ...rest }, ref) {
|
|
@@ -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" | "
|
|
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'
|
|
@@ -5,6 +5,7 @@ import { LabelHTMLAttributes } from "react";
|
|
|
5
5
|
type LabelProps = {
|
|
6
6
|
/**
|
|
7
7
|
* Adjusts font weight. Use this when you have a label hierarchy, such as checkboxes/radios in a fieldset
|
|
8
|
+
* @deprecated as field now automatically changes font-weight based on input type
|
|
8
9
|
*/
|
|
9
10
|
weight?: 'regular' | 'medium' | 'semibold';
|
|
10
11
|
/**
|
|
@@ -22,6 +23,7 @@ type LabelProps = {
|
|
|
22
23
|
declare const Label: import("react").ForwardRefExoticComponent<{
|
|
23
24
|
/**
|
|
24
25
|
* Adjusts font weight. Use this when you have a label hierarchy, such as checkboxes/radios in a fieldset
|
|
26
|
+
* @deprecated as field now automatically changes font-weight based on input type
|
|
25
27
|
*/
|
|
26
28
|
weight?: "regular" | "medium" | "semibold";
|
|
27
29
|
/**
|
|
@@ -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" | "
|
|
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 {
|
|
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 =
|
|
7
|
+
type SearchClearProps = MergeRight<DefaultProps & ButtonHTMLAttributes<HTMLButtonElement>, {
|
|
5
8
|
/**
|
|
6
9
|
* Aria label for the clear button
|
|
7
|
-
* @
|
|
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<
|
|
23
|
+
declare const SearchClear: import("react").ForwardRefExoticComponent<Omit<DefaultProps & ButtonHTMLAttributes<HTMLButtonElement>, "aria-label"> & {
|
|
21
24
|
/**
|
|
22
25
|
* Aria label for the clear button
|
|
23
|
-
* @
|
|
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(
|
|
16
|
-
return /* @__PURE__ */ jsx(
|
|
17
|
-
|
|
14
|
+
const SearchClear = forwardRef(function SearchClear(rest, ref) {
|
|
15
|
+
return /* @__PURE__ */ jsx("button", {
|
|
16
|
+
hidden: true,
|
|
18
17
|
ref,
|
|
19
18
|
type: "reset",
|
|
20
|
-
|
|
19
|
+
suppressHydrationWarning: true,
|
|
21
20
|
...rest
|
|
22
21
|
});
|
|
23
22
|
});
|
|
@@ -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
|
-
* @
|
|
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
|
-
* @
|
|
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(
|
|
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 `
|
|
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 `
|
|
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
|
-
* @
|
|
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
|
-
* @
|
|
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
|
-
* @
|
|
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
|
-
* @
|
|
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
|
|
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
|
|
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",
|
|
55
|
-
return () => combobox?.removeEventListener("comboboxbeforeselect",
|
|
54
|
+
combobox?.addEventListener("comboboxbeforeselect", beforeSelect);
|
|
55
|
+
return () => combobox?.removeEventListener("comboboxbeforeselect", beforeSelect);
|
|
56
56
|
}, [isControlled]);
|
|
57
57
|
useEffect(() => {
|
|
58
58
|
const combobox = dsSuggestionRef.current;
|
|
@@ -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" | "
|
|
57
|
+
declare const Tooltip: import("react").ForwardRefExoticComponent<Omit<DefaultProps & HTMLAttributes<HTMLDivElement>, "content" | "children" | "type" | "placement" | "open" | "autoPlacement"> & {
|
|
58
58
|
/**
|
|
59
59
|
* The element or string that triggers the tooltip.
|
|
60
60
|
*
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digdir/designsystemet-react",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.23.0",
|
|
5
5
|
"description": "React components for Designsystemet",
|
|
6
6
|
"author": "Designsystemet team",
|
|
7
7
|
"repository": {
|
|
@@ -40,34 +40,34 @@
|
|
|
40
40
|
"access": "public"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
+
"@digdir/designsystemet-types": "1.23.0",
|
|
44
|
+
"@digdir/designsystemet-web": "1.23.0",
|
|
43
45
|
"@floating-ui/dom": "^1.8.0",
|
|
44
46
|
"@floating-ui/react": "0.26.23",
|
|
45
47
|
"@navikt/aksel-icons": "^8.16.2",
|
|
46
48
|
"@radix-ui/react-slot": "^1.3.3",
|
|
47
|
-
"@tanstack/react-virtual": "^3.14.
|
|
48
|
-
"clsx": "^2.1.1"
|
|
49
|
-
"@digdir/designsystemet-types": "1.21.1",
|
|
50
|
-
"@digdir/designsystemet-web": "1.21.1"
|
|
49
|
+
"@tanstack/react-virtual": "^3.14.12",
|
|
50
|
+
"clsx": "^2.1.1"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
+
"@digdir/designsystemet-css": "^1.23.0",
|
|
53
54
|
"@storybook/addon-docs": "10.6.0",
|
|
54
55
|
"@storybook/addon-vitest": "10.6.0",
|
|
55
56
|
"@storybook/react-vite": "10.6.0",
|
|
56
57
|
"@testing-library/jest-dom": "7.0.1",
|
|
57
58
|
"@testing-library/react": "16.3.3",
|
|
58
59
|
"@testing-library/user-event": "14.6.7",
|
|
59
|
-
"@types/react": "19.
|
|
60
|
-
"@types/react-dom": "19.
|
|
61
|
-
"react": "19.
|
|
62
|
-
"react-dom": "19.
|
|
60
|
+
"@types/react": "19.3.0",
|
|
61
|
+
"@types/react-dom": "19.3.0",
|
|
62
|
+
"react": "19.3.0",
|
|
63
|
+
"react-dom": "19.3.0",
|
|
63
64
|
"react-dropzone": "19.3.0",
|
|
64
65
|
"storybook": "10.6.0",
|
|
65
66
|
"tsdown": "0.22.14",
|
|
66
|
-
"typescript": "6.0.3"
|
|
67
|
-
"@digdir/designsystemet-css": "^1.21.1"
|
|
67
|
+
"typescript": "6.0.3"
|
|
68
68
|
},
|
|
69
69
|
"scripts": {
|
|
70
70
|
"build": "tsdown",
|
|
71
|
-
"types": "tsc --noEmit"
|
|
71
|
+
"types": "tsc --build --noEmit"
|
|
72
72
|
}
|
|
73
73
|
}
|