@smudi/designsystem 1.5.3 → 2.0.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/@smudi/components/button/button.d.ts +19 -1
- package/@smudi/components/button/button.d.ts.map +1 -1
- package/@smudi/components/button/button.js +16 -15
- package/@smudi/components/card/card-icon-block.d.ts +18 -0
- package/@smudi/components/card/card-icon-block.d.ts.map +1 -1
- package/@smudi/components/card/card.d.ts +13 -0
- package/@smudi/components/card/card.d.ts.map +1 -1
- package/@smudi/components/dialog/dialog.d.ts +12 -0
- package/@smudi/components/dialog/dialog.d.ts.map +1 -1
- package/@smudi/components/dropdown/dropdown-button.d.ts +15 -6
- package/@smudi/components/dropdown/dropdown-button.d.ts.map +1 -1
- package/@smudi/components/dropdown/dropdown-item.d.ts +11 -1
- package/@smudi/components/dropdown/dropdown-item.d.ts.map +1 -1
- package/@smudi/components/dropdown/dropdown-list.d.ts +11 -1
- package/@smudi/components/dropdown/dropdown-list.d.ts.map +1 -1
- package/@smudi/components/dropdown/dropdown.d.ts +16 -1
- package/@smudi/components/dropdown/dropdown.d.ts.map +1 -1
- package/@smudi/components/file-upload/file-upload.d.ts +6 -0
- package/@smudi/components/file-upload/file-upload.d.ts.map +1 -0
- package/@smudi/components/file-upload/file-upload.js +7 -0
- package/@smudi/components/header/header-content.d.ts +11 -0
- package/@smudi/components/header/header-content.d.ts.map +1 -1
- package/@smudi/components/header/header-divider.d.ts +14 -0
- package/@smudi/components/header/header-divider.d.ts.map +1 -1
- package/@smudi/components/header/header-menu/header-menu-button.d.ts +9 -0
- package/@smudi/components/header/header-menu/header-menu-button.d.ts.map +1 -1
- package/@smudi/components/header/header-menu/header-menu-content.d.ts +13 -0
- package/@smudi/components/header/header-menu/header-menu-content.d.ts.map +1 -1
- package/@smudi/components/header/header-menu/header-menu-group.d.ts +10 -0
- package/@smudi/components/header/header-menu/header-menu-group.d.ts.map +1 -1
- package/@smudi/components/header/header-menu/header-menu-item.d.ts +16 -0
- package/@smudi/components/header/header-menu/header-menu-item.d.ts.map +1 -1
- package/@smudi/components/header/header-menu/header-menu.d.ts +15 -0
- package/@smudi/components/header/header-menu/header-menu.d.ts.map +1 -1
- package/@smudi/components/header/header-search/header-search-button.d.ts +17 -0
- package/@smudi/components/header/header-search/header-search-button.d.ts.map +1 -1
- package/@smudi/components/header/header-search/header-search.d.ts +18 -0
- package/@smudi/components/header/header-search/header-search.d.ts.map +1 -1
- package/@smudi/components/header/header.d.ts +65 -23
- package/@smudi/components/header/header.d.ts.map +1 -1
- package/@smudi/components/layout-components/cluster-layouts/cluster-layout.module.css.js +1 -1
- package/@smudi/components/layout-components/split-view/index.d.ts +8 -0
- package/@smudi/components/layout-components/split-view/index.d.ts.map +1 -0
- package/@smudi/components/layout-components/split-view/index.js +10 -0
- package/@smudi/components/layout-components/split-view/split-view-divider.d.ts +8 -0
- package/@smudi/components/layout-components/split-view/split-view-divider.d.ts.map +1 -0
- package/@smudi/components/layout-components/split-view/split-view-divider.js +44 -0
- package/@smudi/components/layout-components/split-view/split-view-divider.module.css.js +9 -0
- package/@smudi/components/layout-components/split-view/split-view-panel.d.ts +23 -0
- package/@smudi/components/layout-components/split-view/split-view-panel.d.ts.map +1 -0
- package/@smudi/components/layout-components/split-view/split-view-panel.js +8 -0
- package/@smudi/components/layout-components/split-view/split-view.d.ts +14 -0
- package/@smudi/components/layout-components/split-view/split-view.d.ts.map +1 -0
- package/@smudi/components/layout-components/split-view/split-view.js +67 -0
- package/@smudi/components/layout-components/split-view/split-view.module.css.js +8 -0
- package/@smudi/components/layout-components/split-view/use-resize.d.ts +34 -0
- package/@smudi/components/layout-components/split-view/use-resize.d.ts.map +1 -0
- package/@smudi/components/layout-components/split-view/use-resize.js +67 -0
- package/@smudi/components/select/select.d.ts +7 -0
- package/@smudi/components/select/select.d.ts.map +1 -1
- package/@smudi/components/select/select.js +13 -6
- package/@smudi/components/suggestion/smudi-suggestion/smudi-suggestion-list.d.ts +4 -0
- package/@smudi/components/suggestion/smudi-suggestion/smudi-suggestion-list.d.ts.map +1 -1
- package/@smudi/components/suggestion/smudi-suggestion/smudi-suggestion.d.ts +17 -0
- package/@smudi/components/suggestion/smudi-suggestion/smudi-suggestion.d.ts.map +1 -1
- package/@smudi/components/suggestion/smudi-suggestion/smudi-suggestion.js +43 -82
- package/@smudi/components/suggestion/suggestion-no-chips/suggestion-no-chips.d.ts +10 -0
- package/@smudi/components/suggestion/suggestion-no-chips/suggestion-no-chips.d.ts.map +1 -1
- package/@smudi/components/suggestion/suggestion-no-chips/suggestion-no-chips.js +44 -33
- package/@smudi/components/suggestion/suggestion.d.ts +1 -0
- package/@smudi/components/suggestion/suggestion.d.ts.map +1 -1
- package/@smudi/components/table/table.d.ts +25 -3
- package/@smudi/components/table/table.d.ts.map +1 -1
- package/@smudi/components/table/table.js +21 -3
- package/@smudi/components/toast/toast.d.ts +45 -0
- package/@smudi/components/toast/toast.d.ts.map +1 -1
- package/@smudi/components/toast/toast.js +144 -141
- package/@smudi/react.js +94 -94
- package/@smudi/smudi/icons/metadata.d.ts +9 -9
- package/@smudi/smudi/react.d.ts +3 -2
- package/@smudi/smudi/react.d.ts.map +1 -1
- package/@smudi/styles.css +1 -1
- package/@smudi/types/modular-scale.type.d.ts +1 -1
- package/README.md +33 -0
- package/package.json +11 -10
- package/@smudi/components/stepper/index.js +0 -17
- package/@smudi/components/stepper/step/step-list.js +0 -40
- package/@smudi/components/stepper/step/step-list.module.css.js +0 -7
- package/@smudi/components/stepper/step/step.js +0 -86
- package/@smudi/components/stepper/step/step.module.css.js +0 -10
- package/@smudi/components/stepper/step-content/step-content-list.js +0 -25
- package/@smudi/components/stepper/step-content/step-content-list.module.css.js +0 -7
- package/@smudi/components/stepper/step-content/step-content.js +0 -28
- package/@smudi/components/stepper/step-content/step-content.module.css.js +0 -7
- package/@smudi/components/stepper/stepper-context.js +0 -23
- package/@smudi/components/stepper/stepper.js +0 -62
- package/@smudi/components/stepper/stepper.module.css.js +0 -7
- package/@smudi/components/stepper/use-stepper-state.js +0 -17
|
@@ -1,96 +1,57 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
const i = "internal_select_all_marker", F = (a) => /* @__PURE__ */ l("data", { className: "smudi-chip", children: /* @__PURE__ */ l("span", { className: "smudi-label", children: a.label }) }), I = N, q = ({
|
|
2
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
3
|
+
import { EXPERIMENTAL_Suggestion as L } from "@digdir/designsystemet-react";
|
|
4
|
+
import { SmudiSuggestionContext as R } from "./smudi-suggestion-context.js";
|
|
5
|
+
const s = "internal_select_all_marker", p = (a) => /* @__PURE__ */ o("data", { className: "smudi-chip", children: /* @__PURE__ */ o("span", { className: "smudi-label", children: a.label }) }), v = L, b = ({
|
|
7
6
|
children: a,
|
|
8
|
-
renderSelected:
|
|
9
|
-
selected:
|
|
10
|
-
multiple:
|
|
11
|
-
items:
|
|
12
|
-
showToggleAll:
|
|
13
|
-
onSelectedChange:
|
|
14
|
-
|
|
15
|
-
...y
|
|
7
|
+
renderSelected: A,
|
|
8
|
+
selected: n,
|
|
9
|
+
multiple: e,
|
|
10
|
+
items: i,
|
|
11
|
+
showToggleAll: d,
|
|
12
|
+
onSelectedChange: t,
|
|
13
|
+
...g
|
|
16
14
|
}) => {
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
(
|
|
15
|
+
const l = e === !0 && Array.isArray(n) ? new Set(
|
|
16
|
+
n.map(
|
|
17
|
+
(r) => typeof r == "string" ? r : r?.value
|
|
20
18
|
)
|
|
21
|
-
) : null,
|
|
22
|
-
...
|
|
19
|
+
) : null, c = e === !0 && !!i?.length && !!l && i.every((r) => l.has(r.value)), f = e && Array.isArray(n) ? c ? [
|
|
20
|
+
...n,
|
|
23
21
|
{
|
|
24
|
-
label:
|
|
25
|
-
value:
|
|
22
|
+
label: s,
|
|
23
|
+
value: s
|
|
26
24
|
}
|
|
27
|
-
] :
|
|
28
|
-
function
|
|
29
|
-
if (!
|
|
30
|
-
if (
|
|
31
|
-
const
|
|
32
|
-
(
|
|
25
|
+
] : n : n ?? void 0;
|
|
26
|
+
function S(r) {
|
|
27
|
+
if (!t) return;
|
|
28
|
+
if (e) {
|
|
29
|
+
const m = t, E = (Array.isArray(r) ? r : []).filter(
|
|
30
|
+
(_) => _.value !== s
|
|
33
31
|
);
|
|
34
|
-
|
|
32
|
+
m(E);
|
|
35
33
|
return;
|
|
36
34
|
}
|
|
37
|
-
const
|
|
38
|
-
!
|
|
39
|
-
}
|
|
40
|
-
const P = (t) => t.value === i ? null : (v ?? F)(t);
|
|
41
|
-
function _() {
|
|
42
|
-
if (!o || !s) return;
|
|
43
|
-
s(f ? [] : g ?? []);
|
|
35
|
+
const u = t;
|
|
36
|
+
!r || Array.isArray(r) || r.value !== s && u(r);
|
|
44
37
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
);
|
|
49
|
-
return { list: n, input: e };
|
|
50
|
-
}
|
|
51
|
-
w(() => {
|
|
52
|
-
const { list: t } = d();
|
|
53
|
-
if (!t) return;
|
|
54
|
-
const n = (e) => {
|
|
55
|
-
const u = e.newState === "open";
|
|
56
|
-
if (u && !c.current) {
|
|
57
|
-
t.togglePopover?.(!1);
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
c.current = u;
|
|
61
|
-
};
|
|
62
|
-
return t.addEventListener("toggle", n), () => t.removeEventListener("toggle", n);
|
|
63
|
-
}, []);
|
|
64
|
-
function b(t) {
|
|
65
|
-
return (t.nativeEvent.composedPath?.() ?? []).some(
|
|
66
|
-
(e) => e instanceof HTMLElement && (e.hasAttribute("popovertarget") || e.hasAttribute("popoverTarget") || e.hasAttribute("commandfor") || e.hasAttribute("commandFor"))
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
function T() {
|
|
70
|
-
const { list: t, input: n } = d();
|
|
71
|
-
if (t && typeof t.togglePopover == "function") {
|
|
72
|
-
const e = !c.current;
|
|
73
|
-
t.togglePopover(e), t.hidden = !e, c.current = e, n?.focus();
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
n?.focus(), n?.click();
|
|
38
|
+
const h = (r) => r.value === s ? null : (A ?? p)(r);
|
|
39
|
+
function y() {
|
|
40
|
+
if (!e || !t) return;
|
|
41
|
+
t(c ? [] : i ?? []);
|
|
77
42
|
}
|
|
78
|
-
return /* @__PURE__ */
|
|
79
|
-
|
|
43
|
+
return /* @__PURE__ */ o(
|
|
44
|
+
v,
|
|
80
45
|
{
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
},
|
|
89
|
-
...y,
|
|
90
|
-
children: /* @__PURE__ */ l(
|
|
91
|
-
C.Provider,
|
|
46
|
+
multiple: e,
|
|
47
|
+
selected: f,
|
|
48
|
+
onSelectedChange: S,
|
|
49
|
+
renderSelected: h,
|
|
50
|
+
...g,
|
|
51
|
+
children: /* @__PURE__ */ o(
|
|
52
|
+
R.Provider,
|
|
92
53
|
{
|
|
93
|
-
value: { isAllSelected:
|
|
54
|
+
value: { isAllSelected: c, showToggleAll: d, toggleSelectAll: y },
|
|
94
55
|
children: a
|
|
95
56
|
}
|
|
96
57
|
)
|
|
@@ -98,6 +59,6 @@ const i = "internal_select_all_marker", F = (a) => /* @__PURE__ */ l("data", { c
|
|
|
98
59
|
);
|
|
99
60
|
};
|
|
100
61
|
export {
|
|
101
|
-
|
|
102
|
-
|
|
62
|
+
s as INTERNAL_SELECT_ALL_MARKER_VALUE,
|
|
63
|
+
b as SmudiSuggestion
|
|
103
64
|
};
|
|
@@ -3,15 +3,25 @@ import { SuggestionProps, SuggestionItem, EXPERIMENTAL_Suggestion as SuggestionR
|
|
|
3
3
|
import { SuggestionComponentProps } from '../smudi-suggestion/smudi-suggestion';
|
|
4
4
|
import { SmudiSuggestionList } from '../smudi-suggestion/smudi-suggestion-list';
|
|
5
5
|
type SuggestionNoChipsProps = Omit<SuggestionComponentProps, "multiple" | "selected" | "defaultSelected" | "onSelectedChange"> & {
|
|
6
|
+
/** Placeholder text shown when nothing is typed or selected. */
|
|
6
7
|
placeholder?: string;
|
|
8
|
+
/** The items that can be selected. */
|
|
7
9
|
items?: SuggestionItem[];
|
|
10
|
+
/**
|
|
11
|
+
* Size of the input.
|
|
12
|
+
* @default "md"
|
|
13
|
+
*/
|
|
8
14
|
"data-size"?: "sm" | "md" | "lg";
|
|
15
|
+
/** Currently selected items (controlled). */
|
|
9
16
|
selected?: (string | SuggestionItem)[] | null;
|
|
17
|
+
/** Initially selected items (uncontrolled). */
|
|
10
18
|
defaultSelected?: (string | SuggestionItem)[];
|
|
19
|
+
/** Called whenever the selection changes. */
|
|
11
20
|
onSelectedChange?: (value: SuggestionItem[]) => void;
|
|
12
21
|
};
|
|
13
22
|
export declare const SuggestionNoChips: React.FC<SuggestionNoChipsProps> & {
|
|
14
23
|
Input: typeof SuggestionRoot.Input;
|
|
24
|
+
Toggle: typeof SuggestionRoot.Toggle;
|
|
15
25
|
Clear: typeof SuggestionRoot.Clear;
|
|
16
26
|
List: typeof SmudiSuggestionList;
|
|
17
27
|
Option: typeof SuggestionRoot.Option;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"suggestion-no-chips.d.ts","sourceRoot":"","sources":["../../../../components/suggestion/suggestion-no-chips/suggestion-no-chips.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,cAAc,EACpB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,uBAAuB,IAAI,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACzF,OAAO,EAEL,wBAAwB,EACzB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAEhF,KAAK,sBAAsB,GAAG,IAAI,CAChC,wBAAwB,EACxB,UAAU,GAAG,UAAU,GAAG,iBAAiB,GAAG,kBAAkB,CACjE,GAAG;IACF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,cAAc,EAAE,CAAC;IACzB,WAAW,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,EAAE,CAAC,MAAM,GAAG,cAAc,CAAC,EAAE,GAAG,IAAI,CAAC;IAC9C,eAAe,CAAC,EAAE,CAAC,MAAM,GAAG,cAAc,CAAC,EAAE,CAAC;IAC9C,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,EAAE,KAAK,IAAI,CAAC;CACtD,CAAC;AAsFF,eAAO,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"suggestion-no-chips.d.ts","sourceRoot":"","sources":["../../../../components/suggestion/suggestion-no-chips/suggestion-no-chips.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,cAAc,EACpB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,uBAAuB,IAAI,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACzF,OAAO,EAEL,wBAAwB,EACzB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAEhF,KAAK,sBAAsB,GAAG,IAAI,CAChC,wBAAwB,EACxB,UAAU,GAAG,UAAU,GAAG,iBAAiB,GAAG,kBAAkB,CACjE,GAAG;IACF,gEAAgE;IAChE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sCAAsC;IACtC,KAAK,CAAC,EAAE,cAAc,EAAE,CAAC;IACzB;;;OAGG;IACH,WAAW,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IACjC,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,CAAC,MAAM,GAAG,cAAc,CAAC,EAAE,GAAG,IAAI,CAAC;IAC9C,+CAA+C;IAC/C,eAAe,CAAC,EAAE,CAAC,MAAM,GAAG,cAAc,CAAC,EAAE,CAAC;IAC9C,6CAA6C;IAC7C,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,EAAE,KAAK,IAAI,CAAC;CACtD,CAAC;AAsFF,eAAO,MAAM,iBAAiB,EAoFzB,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAAC,GAAG;IACtC,KAAK,EAAE,OAAO,cAAc,CAAC,KAAK,CAAC;IACnC,MAAM,EAAE,OAAO,cAAc,CAAC,MAAM,CAAC;IACrC,KAAK,EAAE,OAAO,cAAc,CAAC,KAAK,CAAC;IACnC,IAAI,EAAE,OAAO,mBAAmB,CAAC;IACjC,MAAM,EAAE,OAAO,cAAc,CAAC,MAAM,CAAC;IACrC,KAAK,EAAE,OAAO,cAAc,CAAC,KAAK,CAAC;CACpC,CAAC;AAEF,YAAY,EAAE,eAAe,EAAE,sBAAsB,EAAE,CAAC"}
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs as f, jsx as s, Fragment as v } from "react/jsx-runtime";
|
|
3
3
|
import { useState as S } from "react";
|
|
4
|
-
import { EXPERIMENTAL_Suggestion as
|
|
5
|
-
import { SmudiSuggestion as
|
|
6
|
-
import { SmudiSuggestionList as
|
|
4
|
+
import { EXPERIMENTAL_Suggestion as r, Badge as b } from "@digdir/designsystemet-react";
|
|
5
|
+
import { SmudiSuggestion as T } from "../smudi-suggestion/smudi-suggestion.js";
|
|
6
|
+
import { SmudiSuggestionList as E } from "../smudi-suggestion/smudi-suggestion-list.js";
|
|
7
7
|
function h(n) {
|
|
8
8
|
return n ? n.map(
|
|
9
9
|
(e) => typeof e == "string" ? { value: e, label: e } : e
|
|
10
10
|
) : [];
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
const [i, p] = S(!1),
|
|
12
|
+
function L(n, e, t) {
|
|
13
|
+
const [i, p] = S(!1), u = n !== void 0, [c, o] = S(
|
|
14
14
|
() => h(e)
|
|
15
|
-
), l =
|
|
15
|
+
), l = u ? h(n) : c, a = l.length, g = t.length > 0 && a === t.length, m = a === 1 ? l[0]?.label ?? String(l[0]?.value ?? "") : null;
|
|
16
16
|
return {
|
|
17
17
|
isTyping: i,
|
|
18
18
|
setIsTyping: p,
|
|
19
19
|
count: a,
|
|
20
|
-
allSelected:
|
|
20
|
+
allSelected: g,
|
|
21
21
|
singleLabel: m,
|
|
22
|
-
isControlled:
|
|
22
|
+
isControlled: u,
|
|
23
23
|
setInternalSelected: o
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function z({
|
|
27
27
|
count: n,
|
|
28
28
|
allSelected: e,
|
|
29
29
|
isTyping: t,
|
|
@@ -35,75 +35,85 @@ function O({
|
|
|
35
35
|
className: `smudi-suggestion-badge-wrapper${t ? " smudi-suggestion-badge-wrapper--typing" : ""}`,
|
|
36
36
|
children: [
|
|
37
37
|
!t && /* @__PURE__ */ s("span", { children: e ? "Alle valgt" : "Antall valgt" }),
|
|
38
|
-
!e && /* @__PURE__ */ s(b, { "data-color": "
|
|
38
|
+
!e && /* @__PURE__ */ s(b, { "data-color": "primary", "data-size": i, count: n })
|
|
39
39
|
]
|
|
40
40
|
}
|
|
41
41
|
);
|
|
42
42
|
}
|
|
43
|
-
function
|
|
43
|
+
function O({
|
|
44
44
|
singleLabel: n,
|
|
45
45
|
placeholder: e
|
|
46
46
|
}) {
|
|
47
47
|
return /* @__PURE__ */ s("span", { className: "smudi-suggestion-no-chips-overlay", children: n ?? e });
|
|
48
48
|
}
|
|
49
49
|
const B = Object.assign(
|
|
50
|
+
/**
|
|
51
|
+
* Multi-select `Suggestion` variant that shows selected items as a count
|
|
52
|
+
* badge and an overlay label instead of individual chips, useful when
|
|
53
|
+
* many items can be selected at once.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```tsx
|
|
57
|
+
* <Suggestion.NoChips items={items} onSelectedChange={setSelected} />
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
50
60
|
function({
|
|
51
61
|
className: e,
|
|
52
62
|
placeholder: t,
|
|
53
63
|
items: i,
|
|
54
64
|
onSelectedChange: p,
|
|
55
|
-
showToggleAll:
|
|
56
|
-
"data-size":
|
|
65
|
+
showToggleAll: u,
|
|
66
|
+
"data-size": c = "md",
|
|
57
67
|
...o
|
|
58
68
|
}) {
|
|
59
69
|
const {
|
|
60
70
|
isTyping: l,
|
|
61
71
|
setIsTyping: a,
|
|
62
|
-
count:
|
|
72
|
+
count: g,
|
|
63
73
|
allSelected: m,
|
|
64
74
|
singleLabel: y,
|
|
65
75
|
isControlled: C,
|
|
66
76
|
setInternalSelected: I
|
|
67
|
-
} =
|
|
77
|
+
} = L(
|
|
68
78
|
o.selected,
|
|
69
79
|
o.defaultSelected,
|
|
70
80
|
i ?? []
|
|
71
81
|
);
|
|
72
|
-
function N(
|
|
73
|
-
C || I(
|
|
82
|
+
function N(d) {
|
|
83
|
+
C || I(d), p?.(d);
|
|
74
84
|
}
|
|
75
85
|
return /* @__PURE__ */ f(
|
|
76
86
|
"div",
|
|
77
87
|
{
|
|
78
88
|
className: "smudi-suggestion-no-chips-wrapper",
|
|
79
|
-
onInput: (
|
|
80
|
-
a(
|
|
89
|
+
onInput: (d) => {
|
|
90
|
+
a(d.target.value.length > 0);
|
|
81
91
|
},
|
|
82
92
|
children: [
|
|
83
|
-
|
|
84
|
-
|
|
93
|
+
g >= 2 && /* @__PURE__ */ s(
|
|
94
|
+
z,
|
|
85
95
|
{
|
|
86
|
-
count:
|
|
96
|
+
count: g,
|
|
87
97
|
allSelected: m,
|
|
88
98
|
isTyping: l,
|
|
89
|
-
size:
|
|
99
|
+
size: c
|
|
90
100
|
}
|
|
91
101
|
),
|
|
92
102
|
/* @__PURE__ */ s(
|
|
93
|
-
|
|
103
|
+
T,
|
|
94
104
|
{
|
|
95
105
|
multiple: !0,
|
|
96
106
|
items: i,
|
|
97
|
-
showToggleAll:
|
|
107
|
+
showToggleAll: u,
|
|
98
108
|
renderSelected: () => /* @__PURE__ */ s(v, {}),
|
|
99
|
-
"data-size":
|
|
109
|
+
"data-size": c,
|
|
100
110
|
className: `smudi-suggestion-no-chips${e ? ` ${e}` : ""}`,
|
|
101
111
|
...o,
|
|
102
112
|
onSelectedChange: N
|
|
103
113
|
}
|
|
104
114
|
),
|
|
105
|
-
|
|
106
|
-
|
|
115
|
+
g < 2 && !l && /* @__PURE__ */ s(
|
|
116
|
+
O,
|
|
107
117
|
{
|
|
108
118
|
singleLabel: y,
|
|
109
119
|
placeholder: t
|
|
@@ -115,11 +125,12 @@ const B = Object.assign(
|
|
|
115
125
|
},
|
|
116
126
|
{
|
|
117
127
|
displayName: "Suggestion.NoChips",
|
|
118
|
-
Input:
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
128
|
+
Input: r.Input,
|
|
129
|
+
Toggle: r.Toggle,
|
|
130
|
+
Clear: r.Clear,
|
|
131
|
+
List: E,
|
|
132
|
+
Option: r.Option,
|
|
133
|
+
Empty: r.Empty
|
|
123
134
|
}
|
|
124
135
|
);
|
|
125
136
|
export {
|
|
@@ -10,6 +10,7 @@ declare const SuggestionComponent: React.FC<SuggestionComponentProps> & {
|
|
|
10
10
|
Clear: typeof SuggestionRoot.Clear;
|
|
11
11
|
Option: typeof SuggestionRoot.Option;
|
|
12
12
|
Empty: typeof SuggestionRoot.Empty;
|
|
13
|
+
Toggle: typeof SuggestionRoot.Toggle;
|
|
13
14
|
};
|
|
14
15
|
export type { SuggestionComponentProps as SuggestionProps, SuggestionNoChipsProps, };
|
|
15
16
|
export { SuggestionComponent as Suggestion };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"suggestion.d.ts","sourceRoot":"","sources":["../../../components/suggestion/suggestion.tsx"],"names":[],"mappings":"AAAA,OAAO,KA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AO,cAAc,CAAC,KAAK,CAAC;IACnC,MAAM,EAAE,OAAO,cAAc,CAAC,MAAM,CAAC;IACrC,KAAK,EAAE,OAAO,cAAc,CAAC,KAAK,CAAC;IACnC,MAAM,EAAE,OAAO,cAAc,CAAC,MAAM,CAAC;CACtC,CAAC;AAEF,YAAY,EACV,wBAAwB,IAAI,eAAe,EAC3C,sBAAsB,GACvB,CAAC;AACF,OAAO,EAAE,mBAAmB,IAAI,UAAU,EAAE,CAAC"}
|
|
@@ -1,6 +1,28 @@
|
|
|
1
|
-
import { Table as TableRoot, TableProps } from '@digdir/designsystemet-react';
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { Table as TableRoot, TableProps as DigdirTableProps } from '@digdir/designsystemet-react';
|
|
2
|
+
interface TableProps extends DigdirTableProps {
|
|
3
|
+
/**
|
|
4
|
+
* Gives the table header a tinted background instead of the default style.
|
|
5
|
+
* @default false
|
|
6
|
+
*/
|
|
7
|
+
tintedHeader?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Table used to display tabular data. Wraps Digdir's `Table` with an extra
|
|
11
|
+
* `tintedHeader` option.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* <Table tintedHeader>
|
|
16
|
+
* <Table.Head>
|
|
17
|
+
* <Table.Row>
|
|
18
|
+
* <Table.HeaderCell>Name</Table.HeaderCell>
|
|
19
|
+
* </Table.Row>
|
|
20
|
+
* </Table.Head>
|
|
21
|
+
* </Table>
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
declare const TableBase: React.ForwardRefExoticComponent<TableProps & React.RefAttributes<HTMLTableElement>>;
|
|
25
|
+
declare const TableComponent: typeof TableBase & Omit<typeof TableRoot, "$$typeof" | "render">;
|
|
4
26
|
export type { TableProps };
|
|
5
27
|
export { TableComponent as Table };
|
|
6
28
|
//# sourceMappingURL=table.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../components/table/table.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,IAAI,SAAS,EAClB,KAAK,UAAU,
|
|
1
|
+
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../components/table/table.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,IAAI,SAAS,EAClB,KAAK,UAAU,IAAI,gBAAgB,EACpC,MAAM,8BAA8B,CAAC;AAItC,UAAU,UAAW,SAAQ,gBAAgB;IAC3C;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;;;;;;;;;;;;;GAcG;AACH,QAAA,MAAM,SAAS,qFAcb,CAAC;AAIH,QAAA,MAAM,cAAc,EAGf,OAAO,SAAS,GAAG,IAAI,CAAC,OAAO,SAAS,EAAE,UAAU,GAAG,QAAQ,CAAC,CAAC;AAItE,YAAY,EAAE,UAAU,EAAE,CAAC;AAC3B,OAAO,EAAE,cAAc,IAAI,KAAK,EAAE,CAAC"}
|
|
@@ -1,7 +1,25 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
3
|
import { Table as e } from "@digdir/designsystemet-react";
|
|
3
|
-
|
|
4
|
-
|
|
4
|
+
import { forwardRef as l } from "react";
|
|
5
|
+
import { classNames as m } from "../utils/class-names.js";
|
|
6
|
+
const n = l(function({ className: a, tintedHeader: t = !1, ...s }, o) {
|
|
7
|
+
return /* @__PURE__ */ r(
|
|
8
|
+
e,
|
|
9
|
+
{
|
|
10
|
+
...s,
|
|
11
|
+
ref: o,
|
|
12
|
+
className: m(
|
|
13
|
+
a,
|
|
14
|
+
t && "smudi-table--tinted-header"
|
|
15
|
+
)
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
}), { $$typeof: u, render: N, ...i } = e, b = Object.assign(
|
|
19
|
+
n,
|
|
20
|
+
i
|
|
21
|
+
);
|
|
22
|
+
b.displayName = "Table";
|
|
5
23
|
export {
|
|
6
|
-
|
|
24
|
+
b as Table
|
|
7
25
|
};
|
|
@@ -2,18 +2,39 @@ import { ReactNode } from 'react';
|
|
|
2
2
|
type ToastColor = "neutral" | "success" | "danger" | "info" | "warning";
|
|
3
3
|
type ToastSize = "sm" | "md" | "lg";
|
|
4
4
|
export type ToastOptions = {
|
|
5
|
+
/** Custom CSS class applied to the toast. */
|
|
5
6
|
className?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Color/severity of the toast.
|
|
9
|
+
* @default "info"
|
|
10
|
+
*/
|
|
6
11
|
color?: ToastColor;
|
|
12
|
+
/**
|
|
13
|
+
* Size of the toast.
|
|
14
|
+
* @default "md"
|
|
15
|
+
*/
|
|
7
16
|
"data-size"?: ToastSize;
|
|
17
|
+
/** Fixed width of the toast. */
|
|
8
18
|
width?: string;
|
|
19
|
+
/** Minimum width of the toast. */
|
|
9
20
|
minWidth?: string;
|
|
21
|
+
/** Maximum width of the toast. */
|
|
10
22
|
maxWidth?: string;
|
|
23
|
+
/**
|
|
24
|
+
* How long the toast stays visible before auto-closing, in milliseconds.
|
|
25
|
+
* Pass `false` to disable auto-close.
|
|
26
|
+
* @default 5000
|
|
27
|
+
*/
|
|
11
28
|
duration?: number | false;
|
|
29
|
+
/** Shows a busy/loading indicator on the toast. */
|
|
12
30
|
busy?: boolean;
|
|
31
|
+
/** Custom id for the toast. Auto-generated if not provided. */
|
|
13
32
|
id?: string;
|
|
14
33
|
};
|
|
15
34
|
export type ToastHandle = {
|
|
35
|
+
/** The id of the shown toast. */
|
|
16
36
|
id: string;
|
|
37
|
+
/** Closes the toast. */
|
|
17
38
|
close: () => void;
|
|
18
39
|
};
|
|
19
40
|
type ToastPromiseOptions = ToastOptions & {
|
|
@@ -30,10 +51,34 @@ type ToastFunction = ((content: ReactNode, options?: ToastOptions) => ToastHandl
|
|
|
30
51
|
neutral: (content: ReactNode, options?: ToastOptions) => ToastHandle;
|
|
31
52
|
promise: <T>(action: () => Promise<T>, options: ToastPromiseOptions) => Promise<T>;
|
|
32
53
|
};
|
|
54
|
+
/**
|
|
55
|
+
* Shows a toast notification. Requires a `ToastProvider` to be mounted
|
|
56
|
+
* somewhere in the app. Also exposes `toast.success`, `toast.danger`,
|
|
57
|
+
* `toast.info`, `toast.warning`, `toast.neutral`, `toast.dismiss` and
|
|
58
|
+
* `toast.promise`.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```tsx
|
|
62
|
+
* toast.success("Saved!");
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
33
65
|
export declare const toast: ToastFunction;
|
|
34
66
|
type ToastProviderProps = {
|
|
67
|
+
/** The application content that toasts triggered by `toast(...)` are shown alongside. */
|
|
35
68
|
children?: ReactNode;
|
|
36
69
|
};
|
|
70
|
+
/**
|
|
71
|
+
* Mounts the toast stack for the app and provides the `toast(...)` function
|
|
72
|
+
* with somewhere to render. Must be rendered once near the root of the app
|
|
73
|
+
* for `toast(...)` to have any visible effect.
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```tsx
|
|
77
|
+
* <ToastProvider>
|
|
78
|
+
* <App />
|
|
79
|
+
* </ToastProvider>
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
37
82
|
export declare function ToastProvider({ children }: ToastProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
38
83
|
export {};
|
|
39
84
|
//# sourceMappingURL=toast.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toast.d.ts","sourceRoot":"","sources":["../../../components/toast/toast.tsx"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"toast.d.ts","sourceRoot":"","sources":["../../../components/toast/toast.tsx"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,SAAS,EAKf,MAAM,OAAO,CAAC;AAIf,KAAK,UAAU,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,C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