@norges-domstoler/dds-components 0.0.0-dev-20260112140706 → 0.0.0-dev-20260119083800
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +21 -12
- package/dist/index.d.ts +21 -12
- package/dist/index.js +20 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -23
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -3203,32 +3203,27 @@ var AccordionBase_default = {
|
|
|
3203
3203
|
|
|
3204
3204
|
// src/components/helpers/AccordionBase/useAccordion.tsx
|
|
3205
3205
|
var useAccordion = ({
|
|
3206
|
-
|
|
3206
|
+
isInitiallyExpanded = false,
|
|
3207
|
+
isExpanded: isExpandedProp,
|
|
3207
3208
|
onChange,
|
|
3208
3209
|
id
|
|
3209
3210
|
}) => {
|
|
3210
3211
|
var _a;
|
|
3211
|
-
const [isExpanded, setIsExpanded] =
|
|
3212
|
+
const [isExpanded, setIsExpanded] = useControllableState({
|
|
3213
|
+
onChange,
|
|
3214
|
+
defaultValue: isInitiallyExpanded,
|
|
3215
|
+
value: isExpandedProp
|
|
3216
|
+
});
|
|
3212
3217
|
const generatedId = useId2();
|
|
3213
3218
|
const accordionId = id != null ? id : `${generatedId}-accordion`;
|
|
3214
|
-
const openAccordion = () =>
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
};
|
|
3220
|
-
useEffect13(() => {
|
|
3221
|
-
setIsExpanded(isExpanded);
|
|
3222
|
-
}, [isExpanded]);
|
|
3219
|
+
const openAccordion = useCallback5(() => setIsExpanded(true), [setIsExpanded]);
|
|
3220
|
+
const closeAccordion = useCallback5(
|
|
3221
|
+
() => setIsExpanded(false),
|
|
3222
|
+
[setIsExpanded]
|
|
3223
|
+
);
|
|
3223
3224
|
const toggleExpanded = useCallback5(() => {
|
|
3224
|
-
setIsExpanded((
|
|
3225
|
-
|
|
3226
|
-
if (onChange) {
|
|
3227
|
-
onChange(newExpanded);
|
|
3228
|
-
}
|
|
3229
|
-
return newExpanded;
|
|
3230
|
-
});
|
|
3231
|
-
}, [onChange]);
|
|
3225
|
+
setIsExpanded((prev) => !prev);
|
|
3226
|
+
}, [setIsExpanded]);
|
|
3232
3227
|
const bodyContentRef = useRef7(null);
|
|
3233
3228
|
const [animate, setAnimate] = useState7(false);
|
|
3234
3229
|
const isMounted = useIsMounted();
|
|
@@ -3301,7 +3296,8 @@ var useAccordionContext = () => {
|
|
|
3301
3296
|
// src/components/Accordion/Accordion.tsx
|
|
3302
3297
|
import { jsx as jsx185 } from "react/jsx-runtime";
|
|
3303
3298
|
var Accordion = ({
|
|
3304
|
-
|
|
3299
|
+
isInitiallyExpanded = false,
|
|
3300
|
+
isExpanded,
|
|
3305
3301
|
onChange,
|
|
3306
3302
|
id,
|
|
3307
3303
|
children,
|
|
@@ -3317,7 +3313,7 @@ var Accordion = ({
|
|
|
3317
3313
|
bodyContentRef,
|
|
3318
3314
|
headerProps,
|
|
3319
3315
|
bodyProps
|
|
3320
|
-
} = useAccordion({
|
|
3316
|
+
} = useAccordion({ isInitiallyExpanded, isExpanded, onChange, id });
|
|
3321
3317
|
return /* @__PURE__ */ jsx185(
|
|
3322
3318
|
"div",
|
|
3323
3319
|
{
|
|
@@ -4676,7 +4672,8 @@ var CardExpandable_default = {
|
|
|
4676
4672
|
// src/components/Card/CardExpandable/CardExpandable.tsx
|
|
4677
4673
|
import { jsx as jsx212 } from "react/jsx-runtime";
|
|
4678
4674
|
var CardExpandable = ({
|
|
4679
|
-
|
|
4675
|
+
isInitiallyExpanded = false,
|
|
4676
|
+
isExpanded,
|
|
4680
4677
|
onChange,
|
|
4681
4678
|
id,
|
|
4682
4679
|
children,
|
|
@@ -4692,7 +4689,7 @@ var CardExpandable = ({
|
|
|
4692
4689
|
bodyContentRef,
|
|
4693
4690
|
headerProps,
|
|
4694
4691
|
bodyProps
|
|
4695
|
-
} = useAccordion({
|
|
4692
|
+
} = useAccordion({ isInitiallyExpanded, isExpanded, onChange, id });
|
|
4696
4693
|
return /* @__PURE__ */ jsx212(
|
|
4697
4694
|
"div",
|
|
4698
4695
|
{
|