@digdir/designsystemet-react 0.0.0-main-20251021132802 → 0.0.0-main-20251027091428
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.
|
@@ -32,6 +32,11 @@ const Suggestion = react.forwardRef(function Suggestion({ children, className, c
|
|
|
32
32
|
const [isEmpty, setIsEmpty] = react.useState(false);
|
|
33
33
|
const [defaultItems, setDefaultItems] = react.useState(sanitizeItems(defaultSelected));
|
|
34
34
|
const selectedItems = selected ? sanitizeItems(selected) : defaultItems;
|
|
35
|
+
const onSelectedChangeRef = react.useRef(onSelectedChange);
|
|
36
|
+
// Keep the ref updated with the latest callback
|
|
37
|
+
react.useEffect(() => {
|
|
38
|
+
onSelectedChangeRef.current = onSelectedChange;
|
|
39
|
+
}, [onSelectedChange]);
|
|
35
40
|
/**
|
|
36
41
|
* Listerners and handling of adding/removing
|
|
37
42
|
*/
|
|
@@ -43,7 +48,7 @@ const Suggestion = react.forwardRef(function Suggestion({ children, className, c
|
|
|
43
48
|
const data = event.detail;
|
|
44
49
|
const nextItem = nextItems(data, selectedItems, multiple);
|
|
45
50
|
if (isControlled)
|
|
46
|
-
|
|
51
|
+
onSelectedChangeRef.current?.(nextItem);
|
|
47
52
|
else
|
|
48
53
|
setDefaultItems(sanitizeItems(nextItem));
|
|
49
54
|
};
|
|
@@ -30,6 +30,11 @@ const Suggestion = forwardRef(function Suggestion({ children, className, creatab
|
|
|
30
30
|
const [isEmpty, setIsEmpty] = useState(false);
|
|
31
31
|
const [defaultItems, setDefaultItems] = useState(sanitizeItems(defaultSelected));
|
|
32
32
|
const selectedItems = selected ? sanitizeItems(selected) : defaultItems;
|
|
33
|
+
const onSelectedChangeRef = useRef(onSelectedChange);
|
|
34
|
+
// Keep the ref updated with the latest callback
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
onSelectedChangeRef.current = onSelectedChange;
|
|
37
|
+
}, [onSelectedChange]);
|
|
33
38
|
/**
|
|
34
39
|
* Listerners and handling of adding/removing
|
|
35
40
|
*/
|
|
@@ -41,7 +46,7 @@ const Suggestion = forwardRef(function Suggestion({ children, className, creatab
|
|
|
41
46
|
const data = event.detail;
|
|
42
47
|
const nextItem = nextItems(data, selectedItems, multiple);
|
|
43
48
|
if (isControlled)
|
|
44
|
-
|
|
49
|
+
onSelectedChangeRef.current?.(nextItem);
|
|
45
50
|
else
|
|
46
51
|
setDefaultItems(sanitizeItems(nextItem));
|
|
47
52
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"suggestion.d.ts","sourceRoot":"","sources":["../../../src/components/suggestion/suggestion.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,SAAS,EAMf,MAAM,OAAO,CAAC;AACf,OAAO,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAKnE,MAAM,MAAM,cAAc,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9D,KAAK,gBAAgB,GAAG,IAAI,CAC1B,WAAW,CAAC,iBAAiB,GAAG,SAAS,CAAC,EAC1C,eAAe,CAChB,GAAG;IACF,aAAa,EAAE,oBAAoB,CAAC;CACrC,CAAC;AAEF,KAAK,MAAM,GAAG,CAAC,IAAI,EAAE;IACnB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,aAAa,EAAE,iBAAiB,CAAC;IACjC;;OAEG;IACH,KAAK,EAAE,gBAAgB,CAAC;CACzB,KAAK,OAAO,CAAC;AAEd,KAAK,qBAAqB,GAAG;IAC3B,YAAY,EAAE,CAAC,KAAK,CAAC,EAAE,gBAAgB,GAAG,IAAI,KAAK,IA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E,CACjB,KAAK,EAAE,CAAC,CAAC,UAAU,CAAC,SAAS,IAAI,GAC7B,cAAc,EAAE,GAChB,cAAc,GAAG,SAAS,KAC3B,IAAI,CAAC;CACX,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,mBAAmB,GACrD,oBAAoB,CAAC;IAAE,QAAQ,EAAE,KAAK,CAAA;CAAE,CAAC,CAAC;AAE5C,MAAM,MAAM,uBAAuB,GAAG,mBAAmB,GACvD,oBAAoB,CAAC;IAAE,QAAQ,EAAE,IAAI,CAAA;CAAE,CAAC,GAAG;IAAE,QAAQ,EAAE,IAAI,CAAA;CAAE,CAAC;AAEhE,MAAM,MAAM,eAAe,GAAG,qBAAqB,GAAG,uBAAuB,CAAC;AAiC9E,eAAO,MAAM,UAAU,kHAqHtB,CAAC;AAEF,eAAO,MAAM,iBAAiB,gDAE5B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digdir/designsystemet-react",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.0-main-
|
|
4
|
+
"version": "0.0.0-main-20251027091428",
|
|
5
5
|
"description": "React components for Designsystemet",
|
|
6
6
|
"author": "Designsystemet team",
|
|
7
7
|
"repository": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@floating-ui/dom": "^1.7.4",
|
|
40
40
|
"@floating-ui/react": "0.26.23",
|
|
41
|
-
"@navikt/aksel-icons": "^7.32.
|
|
41
|
+
"@navikt/aksel-icons": "^7.32.2",
|
|
42
42
|
"@radix-ui/react-slot": "^1.2.3",
|
|
43
43
|
"@tanstack/react-virtual": "^3.13.12",
|
|
44
44
|
"@u-elements/u-combobox": "^1.0.2",
|
|
@@ -47,27 +47,27 @@
|
|
|
47
47
|
"clsx": "^2.1.1"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@rollup/plugin-commonjs": "^28.0.
|
|
50
|
+
"@rollup/plugin-commonjs": "^28.0.8",
|
|
51
51
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
52
|
-
"@storybook/addon-docs": "^9.1.
|
|
53
|
-
"@storybook/addon-vitest": "^9.1.
|
|
54
|
-
"@storybook/react-vite": "^9.1.
|
|
52
|
+
"@storybook/addon-docs": "^9.1.13",
|
|
53
|
+
"@storybook/addon-vitest": "^9.1.13",
|
|
54
|
+
"@storybook/react-vite": "^9.1.13",
|
|
55
55
|
"@testing-library/dom": "^10.4.1",
|
|
56
56
|
"@testing-library/jest-dom": "^6.9.1",
|
|
57
57
|
"@testing-library/react": "^16.3.0",
|
|
58
58
|
"@testing-library/user-event": "^14.6.1",
|
|
59
59
|
"@types/react": "^19.2.2",
|
|
60
|
-
"@types/react-dom": "^19.2.
|
|
60
|
+
"@types/react-dom": "^19.2.2",
|
|
61
61
|
"react": "^19.2.0",
|
|
62
62
|
"react-dom": "^19.2.0",
|
|
63
63
|
"rimraf": "^6.0.1",
|
|
64
|
-
"rollup": "^4.52.
|
|
64
|
+
"rollup": "^4.52.5",
|
|
65
65
|
"rollup-plugin-copy": "^3.5.0",
|
|
66
|
-
"storybook": "^9.1.
|
|
66
|
+
"storybook": "^9.1.13",
|
|
67
67
|
"tsx": "4.20.6",
|
|
68
68
|
"typescript": "^5.9.3",
|
|
69
|
-
"@digdir/designsystemet": "^0.0.0-main-
|
|
70
|
-
"@digdir/designsystemet
|
|
69
|
+
"@digdir/designsystemet-css": "^0.0.0-main-20251027091428",
|
|
70
|
+
"@digdir/designsystemet": "^0.0.0-main-20251027091428"
|
|
71
71
|
},
|
|
72
72
|
"scripts": {
|
|
73
73
|
"build": "pnpm run clean && tsc -b tsconfig.lib.json --emitDeclarationOnly false && rollup -c --bundleConfigAsCjs",
|