@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.d.mts
CHANGED
|
@@ -3224,14 +3224,28 @@ type PropsOfWithRef<T extends ElementType> = ComponentPropsWithRef<T> & {
|
|
|
3224
3224
|
type PolymorphicProps<T extends ElementType> = PropsOfWithRef<T>;
|
|
3225
3225
|
declare const ElementAs: <T extends ElementType>({ as, ref, children, ...props }: PolymorphicProps<T>) => react_jsx_runtime.JSX.Element;
|
|
3226
3226
|
|
|
3227
|
-
|
|
3228
|
-
/**
|
|
3227
|
+
interface AccordionConfig {
|
|
3228
|
+
/**
|
|
3229
|
+
* Ukontrollerttilstand: om utvidbare delen skal være utvidet ved første render.
|
|
3230
|
+
*/
|
|
3231
|
+
isInitiallyExpanded?: boolean;
|
|
3232
|
+
/**
|
|
3233
|
+
* Kontrollert tilstand: om utvidbare delen er utvidet.
|
|
3234
|
+
*/
|
|
3229
3235
|
isExpanded?: boolean;
|
|
3230
|
-
/**
|
|
3236
|
+
/**
|
|
3237
|
+
* Callback når tilstanden endres.
|
|
3238
|
+
*/
|
|
3231
3239
|
onChange?: (expanded: boolean) => void;
|
|
3232
|
-
|
|
3240
|
+
/**
|
|
3241
|
+
* Custom id for accordion; delene får i tillegg suffix `'header'` og `'body'`.
|
|
3242
|
+
*/
|
|
3243
|
+
id?: string;
|
|
3244
|
+
}
|
|
3245
|
+
|
|
3246
|
+
type AccordionProps = BaseComponentPropsWithChildren<HTMLDivElement, Pick<AccordionConfig, 'isExpanded' | 'isInitiallyExpanded' | 'onChange'>>;
|
|
3233
3247
|
declare const Accordion: {
|
|
3234
|
-
({ isExpanded, onChange, id, children, className, style, htmlProps, ...rest }: AccordionProps): react_jsx_runtime.JSX.Element;
|
|
3248
|
+
({ isInitiallyExpanded, isExpanded, onChange, id, children, className, style, htmlProps, ...rest }: AccordionProps): react_jsx_runtime.JSX.Element;
|
|
3235
3249
|
displayName: string;
|
|
3236
3250
|
};
|
|
3237
3251
|
|
|
@@ -3543,14 +3557,9 @@ declare const Card: {
|
|
|
3543
3557
|
displayName: string;
|
|
3544
3558
|
};
|
|
3545
3559
|
|
|
3546
|
-
type CardExpandableProps = BaseComponentPropsWithChildren<HTMLDivElement,
|
|
3547
|
-
/**Spesifiserer om body skal være utvidet ved innlastning. */
|
|
3548
|
-
isExpanded?: boolean;
|
|
3549
|
-
/**For å lytte til endringer i expanded-state. */
|
|
3550
|
-
onChange?: (expanded: boolean) => void;
|
|
3551
|
-
}>;
|
|
3560
|
+
type CardExpandableProps = BaseComponentPropsWithChildren<HTMLDivElement, Pick<AccordionConfig, 'isExpanded' | 'isInitiallyExpanded' | 'onChange'>>;
|
|
3552
3561
|
declare const CardExpandable: {
|
|
3553
|
-
({ isExpanded, onChange, id, children, className, style, htmlProps, ...rest }: CardExpandableProps): react_jsx_runtime.JSX.Element;
|
|
3562
|
+
({ isInitiallyExpanded, isExpanded, onChange, id, children, className, style, htmlProps, ...rest }: CardExpandableProps): react_jsx_runtime.JSX.Element;
|
|
3554
3563
|
displayName: string;
|
|
3555
3564
|
};
|
|
3556
3565
|
|
package/dist/index.d.ts
CHANGED
|
@@ -3224,14 +3224,28 @@ type PropsOfWithRef<T extends ElementType> = ComponentPropsWithRef<T> & {
|
|
|
3224
3224
|
type PolymorphicProps<T extends ElementType> = PropsOfWithRef<T>;
|
|
3225
3225
|
declare const ElementAs: <T extends ElementType>({ as, ref, children, ...props }: PolymorphicProps<T>) => react_jsx_runtime.JSX.Element;
|
|
3226
3226
|
|
|
3227
|
-
|
|
3228
|
-
/**
|
|
3227
|
+
interface AccordionConfig {
|
|
3228
|
+
/**
|
|
3229
|
+
* Ukontrollerttilstand: om utvidbare delen skal være utvidet ved første render.
|
|
3230
|
+
*/
|
|
3231
|
+
isInitiallyExpanded?: boolean;
|
|
3232
|
+
/**
|
|
3233
|
+
* Kontrollert tilstand: om utvidbare delen er utvidet.
|
|
3234
|
+
*/
|
|
3229
3235
|
isExpanded?: boolean;
|
|
3230
|
-
/**
|
|
3236
|
+
/**
|
|
3237
|
+
* Callback når tilstanden endres.
|
|
3238
|
+
*/
|
|
3231
3239
|
onChange?: (expanded: boolean) => void;
|
|
3232
|
-
|
|
3240
|
+
/**
|
|
3241
|
+
* Custom id for accordion; delene får i tillegg suffix `'header'` og `'body'`.
|
|
3242
|
+
*/
|
|
3243
|
+
id?: string;
|
|
3244
|
+
}
|
|
3245
|
+
|
|
3246
|
+
type AccordionProps = BaseComponentPropsWithChildren<HTMLDivElement, Pick<AccordionConfig, 'isExpanded' | 'isInitiallyExpanded' | 'onChange'>>;
|
|
3233
3247
|
declare const Accordion: {
|
|
3234
|
-
({ isExpanded, onChange, id, children, className, style, htmlProps, ...rest }: AccordionProps): react_jsx_runtime.JSX.Element;
|
|
3248
|
+
({ isInitiallyExpanded, isExpanded, onChange, id, children, className, style, htmlProps, ...rest }: AccordionProps): react_jsx_runtime.JSX.Element;
|
|
3235
3249
|
displayName: string;
|
|
3236
3250
|
};
|
|
3237
3251
|
|
|
@@ -3543,14 +3557,9 @@ declare const Card: {
|
|
|
3543
3557
|
displayName: string;
|
|
3544
3558
|
};
|
|
3545
3559
|
|
|
3546
|
-
type CardExpandableProps = BaseComponentPropsWithChildren<HTMLDivElement,
|
|
3547
|
-
/**Spesifiserer om body skal være utvidet ved innlastning. */
|
|
3548
|
-
isExpanded?: boolean;
|
|
3549
|
-
/**For å lytte til endringer i expanded-state. */
|
|
3550
|
-
onChange?: (expanded: boolean) => void;
|
|
3551
|
-
}>;
|
|
3560
|
+
type CardExpandableProps = BaseComponentPropsWithChildren<HTMLDivElement, Pick<AccordionConfig, 'isExpanded' | 'isInitiallyExpanded' | 'onChange'>>;
|
|
3552
3561
|
declare const CardExpandable: {
|
|
3553
|
-
({ isExpanded, onChange, id, children, className, style, htmlProps, ...rest }: CardExpandableProps): react_jsx_runtime.JSX.Element;
|
|
3562
|
+
({ isInitiallyExpanded, isExpanded, onChange, id, children, className, style, htmlProps, ...rest }: CardExpandableProps): react_jsx_runtime.JSX.Element;
|
|
3554
3563
|
displayName: string;
|
|
3555
3564
|
};
|
|
3556
3565
|
|
package/dist/index.js
CHANGED
|
@@ -3581,32 +3581,27 @@ var AccordionBase_default = {
|
|
|
3581
3581
|
|
|
3582
3582
|
// src/components/helpers/AccordionBase/useAccordion.tsx
|
|
3583
3583
|
var useAccordion = ({
|
|
3584
|
-
|
|
3584
|
+
isInitiallyExpanded = false,
|
|
3585
|
+
isExpanded: isExpandedProp,
|
|
3585
3586
|
onChange,
|
|
3586
3587
|
id
|
|
3587
3588
|
}) => {
|
|
3588
3589
|
var _a;
|
|
3589
|
-
const [isExpanded, setIsExpanded] = (
|
|
3590
|
+
const [isExpanded, setIsExpanded] = useControllableState({
|
|
3591
|
+
onChange,
|
|
3592
|
+
defaultValue: isInitiallyExpanded,
|
|
3593
|
+
value: isExpandedProp
|
|
3594
|
+
});
|
|
3590
3595
|
const generatedId = (0, import_react17.useId)();
|
|
3591
3596
|
const accordionId = id != null ? id : `${generatedId}-accordion`;
|
|
3592
|
-
const openAccordion = () =>
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
};
|
|
3598
|
-
(0, import_react17.useEffect)(() => {
|
|
3599
|
-
setIsExpanded(isExpanded);
|
|
3600
|
-
}, [isExpanded]);
|
|
3597
|
+
const openAccordion = (0, import_react17.useCallback)(() => setIsExpanded(true), [setIsExpanded]);
|
|
3598
|
+
const closeAccordion = (0, import_react17.useCallback)(
|
|
3599
|
+
() => setIsExpanded(false),
|
|
3600
|
+
[setIsExpanded]
|
|
3601
|
+
);
|
|
3601
3602
|
const toggleExpanded = (0, import_react17.useCallback)(() => {
|
|
3602
|
-
setIsExpanded((
|
|
3603
|
-
|
|
3604
|
-
if (onChange) {
|
|
3605
|
-
onChange(newExpanded);
|
|
3606
|
-
}
|
|
3607
|
-
return newExpanded;
|
|
3608
|
-
});
|
|
3609
|
-
}, [onChange]);
|
|
3603
|
+
setIsExpanded((prev) => !prev);
|
|
3604
|
+
}, [setIsExpanded]);
|
|
3610
3605
|
const bodyContentRef = (0, import_react17.useRef)(null);
|
|
3611
3606
|
const [animate, setAnimate] = (0, import_react17.useState)(false);
|
|
3612
3607
|
const isMounted = useIsMounted();
|
|
@@ -3676,7 +3671,8 @@ var useAccordionContext = () => {
|
|
|
3676
3671
|
// src/components/Accordion/Accordion.tsx
|
|
3677
3672
|
var import_jsx_runtime185 = require("react/jsx-runtime");
|
|
3678
3673
|
var Accordion = ({
|
|
3679
|
-
|
|
3674
|
+
isInitiallyExpanded = false,
|
|
3675
|
+
isExpanded,
|
|
3680
3676
|
onChange,
|
|
3681
3677
|
id,
|
|
3682
3678
|
children,
|
|
@@ -3692,7 +3688,7 @@ var Accordion = ({
|
|
|
3692
3688
|
bodyContentRef,
|
|
3693
3689
|
headerProps,
|
|
3694
3690
|
bodyProps
|
|
3695
|
-
} = useAccordion({
|
|
3691
|
+
} = useAccordion({ isInitiallyExpanded, isExpanded, onChange, id });
|
|
3696
3692
|
return /* @__PURE__ */ (0, import_jsx_runtime185.jsx)(
|
|
3697
3693
|
"div",
|
|
3698
3694
|
{
|
|
@@ -5039,7 +5035,8 @@ var CardExpandable_default = {
|
|
|
5039
5035
|
// src/components/Card/CardExpandable/CardExpandable.tsx
|
|
5040
5036
|
var import_jsx_runtime212 = require("react/jsx-runtime");
|
|
5041
5037
|
var CardExpandable = ({
|
|
5042
|
-
|
|
5038
|
+
isInitiallyExpanded = false,
|
|
5039
|
+
isExpanded,
|
|
5043
5040
|
onChange,
|
|
5044
5041
|
id,
|
|
5045
5042
|
children,
|
|
@@ -5055,7 +5052,7 @@ var CardExpandable = ({
|
|
|
5055
5052
|
bodyContentRef,
|
|
5056
5053
|
headerProps,
|
|
5057
5054
|
bodyProps
|
|
5058
|
-
} = useAccordion({
|
|
5055
|
+
} = useAccordion({ isInitiallyExpanded, isExpanded, onChange, id });
|
|
5059
5056
|
return /* @__PURE__ */ (0, import_jsx_runtime212.jsx)(
|
|
5060
5057
|
"div",
|
|
5061
5058
|
{
|