@norges-domstoler/dds-components 0.0.0-dev-20250306095813 → 0.0.0-dev-20250306095911
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.js +67 -78
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +67 -78
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -587,6 +587,9 @@ var spaceSeparatedIdListGenerator = (values) => {
|
|
|
587
587
|
return filtered.length > 0 ? filtered.join(" ") : void 0;
|
|
588
588
|
};
|
|
589
589
|
|
|
590
|
+
// src/utils/object.tsx
|
|
591
|
+
var isEmpty = (obj) => Object.keys(obj).length === 0 && obj.constructor === Object;
|
|
592
|
+
|
|
590
593
|
// src/utils/readonlyEventHandlers.tsx
|
|
591
594
|
var readOnlyMouseDownHandler = (readOnly, onMouseDown) => {
|
|
592
595
|
return (evt) => {
|
|
@@ -3177,7 +3180,7 @@ var AccordionContextProvider = ({
|
|
|
3177
3180
|
};
|
|
3178
3181
|
var useAccordionContext = () => {
|
|
3179
3182
|
const context = (0, import_react13.useContext)(AccordionContext);
|
|
3180
|
-
if (
|
|
3183
|
+
if (isEmpty(context)) {
|
|
3181
3184
|
throw new Error(
|
|
3182
3185
|
"useAccordionContext must be used within a AccordionContextProvider. Have you wrapped <AccordionHeader> and <AccordionBody> inside a <Accordion>, or <CardAccordionHeader> and <CardAccordionBody> inside a <CardAccordion>?"
|
|
3183
3186
|
);
|
|
@@ -3240,7 +3243,7 @@ var AccordionHeader = ({
|
|
|
3240
3243
|
...rest
|
|
3241
3244
|
}) => {
|
|
3242
3245
|
const { isExpanded, headerProps } = useAccordionContext();
|
|
3243
|
-
const { id, ...restHeaderProps } = headerProps;
|
|
3246
|
+
const { id, ...restHeaderProps } = headerProps != null ? headerProps : {};
|
|
3244
3247
|
return /* @__PURE__ */ (0, import_jsx_runtime180.jsxs)(
|
|
3245
3248
|
"button",
|
|
3246
3249
|
{
|
|
@@ -3305,7 +3308,12 @@ var AccordionBody = ({
|
|
|
3305
3308
|
...rest
|
|
3306
3309
|
}) => {
|
|
3307
3310
|
const { bodyContentRef, bodyProps } = useAccordionContext();
|
|
3308
|
-
const {
|
|
3311
|
+
const {
|
|
3312
|
+
className: bodyContextCn,
|
|
3313
|
+
id,
|
|
3314
|
+
height,
|
|
3315
|
+
...restBodyProps
|
|
3316
|
+
} = bodyProps != null ? bodyProps : {};
|
|
3309
3317
|
const styleVariables = {
|
|
3310
3318
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3311
3319
|
["--dds-card-accordion-body-height"]: height + "px"
|
|
@@ -3336,14 +3344,7 @@ var BackLink_default = {
|
|
|
3336
3344
|
var import_jsx_runtime182 = require("react/jsx-runtime");
|
|
3337
3345
|
var BackLink = ({ label, ref, ...rest }) => {
|
|
3338
3346
|
return /* @__PURE__ */ (0, import_jsx_runtime182.jsx)("nav", { ref, "aria-label": "G\xE5 tilbake", children: /* @__PURE__ */ (0, import_jsx_runtime182.jsxs)(Link, { ...rest, children: [
|
|
3339
|
-
/* @__PURE__ */ (0, import_jsx_runtime182.jsx)(
|
|
3340
|
-
Icon,
|
|
3341
|
-
{
|
|
3342
|
-
icon: ArrowLeftIcon,
|
|
3343
|
-
iconSize: "inherit",
|
|
3344
|
-
className: BackLink_default.icon
|
|
3345
|
-
}
|
|
3346
|
-
),
|
|
3347
|
+
/* @__PURE__ */ (0, import_jsx_runtime182.jsx)(Icon, { icon: ArrowLeftIcon, iconSize: "inherit", className: BackLink_default.icon }),
|
|
3347
3348
|
label
|
|
3348
3349
|
] }) });
|
|
3349
3350
|
};
|
|
@@ -3930,16 +3931,13 @@ var OverflowMenuGroup = ({
|
|
|
3930
3931
|
handleClose();
|
|
3931
3932
|
});
|
|
3932
3933
|
const Children7 = import_react20.Children.map(children, (child, childIndex) => {
|
|
3933
|
-
return (0, import_react20.isValidElement)(child) && (childIndex === 0 ? (0, import_react20.cloneElement)(
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
ref: combinedAnchorRef
|
|
3941
|
-
}
|
|
3942
|
-
) : child);
|
|
3934
|
+
return (0, import_react20.isValidElement)(child) && (childIndex === 0 ? (0, import_react20.cloneElement)(child, {
|
|
3935
|
+
"aria-haspopup": "menu",
|
|
3936
|
+
"aria-controls": uniqueOverflowMenuId,
|
|
3937
|
+
"aria-expanded": isOpen,
|
|
3938
|
+
onClick: handleToggle,
|
|
3939
|
+
ref: combinedAnchorRef
|
|
3940
|
+
}) : child);
|
|
3943
3941
|
});
|
|
3944
3942
|
return /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(
|
|
3945
3943
|
OverflowMenuContextProvider,
|
|
@@ -4203,7 +4201,7 @@ var CardExpandableHeader = ({
|
|
|
4203
4201
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4204
4202
|
["--dds-card-accordion-header-container-padding"]: padding != null ? padding : "var(--dds-spacing-x1) var(--dds-spacing-x0-75) var(--dds-spacing-x1) var(--dds-spacing-x1-5)"
|
|
4205
4203
|
};
|
|
4206
|
-
const { id, ...restHeaderProps } = headerProps;
|
|
4204
|
+
const { id, ...restHeaderProps } = headerProps != null ? headerProps : {};
|
|
4207
4205
|
return /* @__PURE__ */ (0, import_jsx_runtime200.jsx)(
|
|
4208
4206
|
"button",
|
|
4209
4207
|
{
|
|
@@ -4269,7 +4267,12 @@ var CardExpandableBody = ({
|
|
|
4269
4267
|
...rest
|
|
4270
4268
|
}) => {
|
|
4271
4269
|
const { bodyContentRef, bodyProps } = useAccordionContext();
|
|
4272
|
-
const {
|
|
4270
|
+
const {
|
|
4271
|
+
className: bodyContextCn,
|
|
4272
|
+
id,
|
|
4273
|
+
height,
|
|
4274
|
+
...restBodyProps
|
|
4275
|
+
} = bodyProps != null ? bodyProps : {};
|
|
4273
4276
|
const styleVariables = {
|
|
4274
4277
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4275
4278
|
["--dds-card-accordion-body-height"]: height + "px"
|
|
@@ -5535,9 +5538,7 @@ var Drawer = ({
|
|
|
5535
5538
|
return () => handleElementWithBackdropUnmount(document.body);
|
|
5536
5539
|
}
|
|
5537
5540
|
}, [isOpen]);
|
|
5538
|
-
const elements = [
|
|
5539
|
-
drawerRef.current
|
|
5540
|
-
];
|
|
5541
|
+
const elements = [drawerRef.current];
|
|
5541
5542
|
if (triggerEl) elements.push(triggerEl);
|
|
5542
5543
|
useOnClickOutside(elements, () => {
|
|
5543
5544
|
if (isOpen && !withBackdrop) {
|
|
@@ -5657,16 +5658,13 @@ var DrawerGroup = ({
|
|
|
5657
5658
|
}
|
|
5658
5659
|
});
|
|
5659
5660
|
const Children7 = import_react38.Children.map(children, (child, childIndex) => {
|
|
5660
|
-
return (0, import_react38.isValidElement)(child) && (childIndex === 0 ? (0, import_react38.cloneElement)(
|
|
5661
|
-
|
|
5662
|
-
|
|
5663
|
-
|
|
5664
|
-
|
|
5665
|
-
|
|
5666
|
-
|
|
5667
|
-
onClick: handleOpen
|
|
5668
|
-
}
|
|
5669
|
-
) : child);
|
|
5661
|
+
return (0, import_react38.isValidElement)(child) && (childIndex === 0 ? (0, import_react38.cloneElement)(child, {
|
|
5662
|
+
"aria-haspopup": "dialog",
|
|
5663
|
+
"aria-controls": uniqueDrawerId,
|
|
5664
|
+
"aria-expanded": isOpen,
|
|
5665
|
+
ref: triggerRef,
|
|
5666
|
+
onClick: handleOpen
|
|
5667
|
+
}) : child);
|
|
5670
5668
|
});
|
|
5671
5669
|
return /* @__PURE__ */ (0, import_jsx_runtime227.jsx)(
|
|
5672
5670
|
DrawerContext,
|
|
@@ -8440,38 +8438,32 @@ var DDSInput = (props, ariaInvalid, ariaDescribedby) => /* @__PURE__ */ (0, impo
|
|
|
8440
8438
|
);
|
|
8441
8439
|
var DDSControl = (props, componentSize, readOnly, icon, dataTestId) => {
|
|
8442
8440
|
const { className, ...rest } = props;
|
|
8443
|
-
return /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
|
|
8444
|
-
|
|
8441
|
+
return /* @__PURE__ */ (0, import_jsx_runtime267.jsx)("div", { "data-testid": dataTestId ? dataTestId + "-control" : void 0, children: /* @__PURE__ */ (0, import_jsx_runtime267.jsxs)(
|
|
8442
|
+
Control,
|
|
8445
8443
|
{
|
|
8446
|
-
|
|
8447
|
-
|
|
8448
|
-
|
|
8449
|
-
|
|
8450
|
-
|
|
8451
|
-
|
|
8452
|
-
|
|
8453
|
-
|
|
8454
|
-
|
|
8455
|
-
|
|
8456
|
-
|
|
8457
|
-
|
|
8458
|
-
|
|
8459
|
-
|
|
8460
|
-
|
|
8461
|
-
|
|
8462
|
-
|
|
8463
|
-
|
|
8464
|
-
|
|
8465
|
-
|
|
8466
|
-
|
|
8467
|
-
}
|
|
8468
|
-
),
|
|
8469
|
-
props.children
|
|
8470
|
-
]
|
|
8471
|
-
}
|
|
8472
|
-
)
|
|
8444
|
+
...rest,
|
|
8445
|
+
className: cn(
|
|
8446
|
+
className,
|
|
8447
|
+
Select_default.control,
|
|
8448
|
+
rest.isDisabled && Select_default["control--disabled"],
|
|
8449
|
+
readOnly && Select_default["control--readonly"]
|
|
8450
|
+
),
|
|
8451
|
+
children: [
|
|
8452
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
|
|
8453
|
+
Icon,
|
|
8454
|
+
{
|
|
8455
|
+
icon,
|
|
8456
|
+
iconSize: getFormInputIconSize(componentSize),
|
|
8457
|
+
className: cn(
|
|
8458
|
+
Input_default["input-group__absolute-element"],
|
|
8459
|
+
Select_default[`icon--${componentSize}`]
|
|
8460
|
+
)
|
|
8461
|
+
}
|
|
8462
|
+
),
|
|
8463
|
+
props.children
|
|
8464
|
+
]
|
|
8473
8465
|
}
|
|
8474
|
-
);
|
|
8466
|
+
) });
|
|
8475
8467
|
};
|
|
8476
8468
|
|
|
8477
8469
|
// src/components/Select/Select.tsx
|
|
@@ -8763,7 +8755,7 @@ var Pagination = ({
|
|
|
8763
8755
|
};
|
|
8764
8756
|
const listItems = items.length > 0 ? items.map((item, i) => {
|
|
8765
8757
|
const isActive = item === activePage;
|
|
8766
|
-
return /* @__PURE__ */ (0, import_jsx_runtime270.jsx)("li", { className: Pagination_default.list__item, children: item !== "truncator" ? /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
|
|
8758
|
+
return /* @__PURE__ */ (0, import_jsx_runtime270.jsx)("li", { className: Pagination_default.list__item, children: item !== "truncator" && typeof item === "number" ? /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
|
|
8767
8759
|
Button,
|
|
8768
8760
|
{
|
|
8769
8761
|
purpose: isActive ? "primary" : "secondary",
|
|
@@ -9662,7 +9654,7 @@ var Popover = ({
|
|
|
9662
9654
|
isOpen: contextIsOpen,
|
|
9663
9655
|
anchorEl: contextAnchorEl
|
|
9664
9656
|
} = context;
|
|
9665
|
-
const hasContext =
|
|
9657
|
+
const hasContext = !isEmpty(context);
|
|
9666
9658
|
const generatedId = (0, import_react61.useId)();
|
|
9667
9659
|
const uniquePopoverId = id != null ? id : `${generatedId}-popover`;
|
|
9668
9660
|
const [
|
|
@@ -9817,16 +9809,13 @@ var PopoverGroup = ({
|
|
|
9817
9809
|
});
|
|
9818
9810
|
const isAnchorChild = (i) => i === 0;
|
|
9819
9811
|
const Children7 = import_react62.Children.map(children, (child, childIndex) => {
|
|
9820
|
-
return (0, import_react62.isValidElement)(child) && (isAnchorChild(childIndex) ? (0, import_react62.cloneElement)(
|
|
9821
|
-
|
|
9822
|
-
|
|
9823
|
-
|
|
9824
|
-
|
|
9825
|
-
|
|
9826
|
-
|
|
9827
|
-
ref: combinedAnchorRef
|
|
9828
|
-
}
|
|
9829
|
-
) : child);
|
|
9812
|
+
return (0, import_react62.isValidElement)(child) && (isAnchorChild(childIndex) ? (0, import_react62.cloneElement)(child, {
|
|
9813
|
+
"aria-haspopup": "dialog",
|
|
9814
|
+
"aria-controls": uniquePopoverId,
|
|
9815
|
+
"aria-expanded": open,
|
|
9816
|
+
onClick: handleToggle,
|
|
9817
|
+
ref: combinedAnchorRef
|
|
9818
|
+
}) : child);
|
|
9830
9819
|
});
|
|
9831
9820
|
return /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
|
|
9832
9821
|
PopoverContext,
|