@norges-domstoler/dds-components 0.0.0-dev-20240604095924 → 0.0.0-dev-20240605061318
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 +22 -44
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -44
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -9
package/dist/index.js
CHANGED
|
@@ -490,8 +490,7 @@ function isTextColor(color) {
|
|
|
490
490
|
return textColorsArray.indexOf(color) !== -1;
|
|
491
491
|
}
|
|
492
492
|
var getTextColor = (color) => {
|
|
493
|
-
if (isTextColor(color))
|
|
494
|
-
return textColors[color];
|
|
493
|
+
if (isTextColor(color)) return textColors[color];
|
|
495
494
|
return color;
|
|
496
495
|
};
|
|
497
496
|
|
|
@@ -2417,8 +2416,7 @@ var import_react5 = require("react");
|
|
|
2417
2416
|
function useCombinedRef(...refs) {
|
|
2418
2417
|
return (0, import_react5.useCallback)((element) => {
|
|
2419
2418
|
refs.forEach((ref) => {
|
|
2420
|
-
if (typeof ref === "function")
|
|
2421
|
-
ref(element);
|
|
2419
|
+
if (typeof ref === "function") ref(element);
|
|
2422
2420
|
else if (ref && typeof ref === "object")
|
|
2423
2421
|
ref.current = element;
|
|
2424
2422
|
});
|
|
@@ -2516,8 +2514,7 @@ function useFocusTrap(active, initialFocusRef = void 0) {
|
|
|
2516
2514
|
const elementRef = (0, import_react6.useRef)(null);
|
|
2517
2515
|
(0, import_react6.useEffect)(() => {
|
|
2518
2516
|
function handleFocus(e) {
|
|
2519
|
-
if (e.key !== "Tab" || !active || !elementRef.current)
|
|
2520
|
-
return;
|
|
2517
|
+
if (e.key !== "Tab" || !active || !elementRef.current) return;
|
|
2521
2518
|
const focusableElements = getFocusableElements(elementRef);
|
|
2522
2519
|
const firstElement = focusableElements[0];
|
|
2523
2520
|
const lastElement = focusableElements[focusableElements.length - 1];
|
|
@@ -2565,8 +2562,7 @@ var useMountTransition = (isMounted, unmountDelay) => {
|
|
|
2565
2562
|
const [hasTransitionedIn, setHasTransitionedIn] = (0, import_react8.useState)(false);
|
|
2566
2563
|
(0, import_react8.useEffect)(() => {
|
|
2567
2564
|
let timeoutId;
|
|
2568
|
-
if (isMounted && !hasTransitionedIn)
|
|
2569
|
-
setHasTransitionedIn(true);
|
|
2565
|
+
if (isMounted && !hasTransitionedIn) setHasTransitionedIn(true);
|
|
2570
2566
|
else if (!isMounted && hasTransitionedIn) {
|
|
2571
2567
|
timeoutId = setTimeout(() => setHasTransitionedIn(false), unmountDelay);
|
|
2572
2568
|
}
|
|
@@ -2589,8 +2585,7 @@ function useOnClickOutside(element, handler) {
|
|
|
2589
2585
|
const clickedOnSomethingInDocument = document.contains(
|
|
2590
2586
|
event.target
|
|
2591
2587
|
);
|
|
2592
|
-
if (hasClickedInside || !clickedOnSomethingInDocument)
|
|
2593
|
-
return;
|
|
2588
|
+
if (hasClickedInside || !clickedOnSomethingInDocument) return;
|
|
2594
2589
|
handler(event);
|
|
2595
2590
|
};
|
|
2596
2591
|
document.addEventListener("mousedown", listener);
|
|
@@ -2657,16 +2652,14 @@ function useRoveFocus(size2, active, direction = "column") {
|
|
|
2657
2652
|
const previousKey = direction === "row" ? "ArrowLeft" : "ArrowUp";
|
|
2658
2653
|
const handleKeyDown = (0, import_react12.useCallback)(
|
|
2659
2654
|
(e) => {
|
|
2660
|
-
if (!size2 || !isKeyboardEvent(e))
|
|
2661
|
-
return;
|
|
2655
|
+
if (!size2 || !isKeyboardEvent(e)) return;
|
|
2662
2656
|
if (e.key === nextKey) {
|
|
2663
2657
|
e.preventDefault();
|
|
2664
2658
|
setCurrentFocusIndex((prev) => prev === size2 - 1 ? 0 : prev + 1);
|
|
2665
2659
|
} else if (e.key === previousKey) {
|
|
2666
2660
|
e.preventDefault();
|
|
2667
2661
|
setCurrentFocusIndex((prev) => {
|
|
2668
|
-
if (prev === -1 || prev === 0)
|
|
2669
|
-
return size2 - 1;
|
|
2662
|
+
if (prev === -1 || prev === 0) return size2 - 1;
|
|
2670
2663
|
return prev - 1;
|
|
2671
2664
|
});
|
|
2672
2665
|
}
|
|
@@ -4071,8 +4064,7 @@ var import_react34 = require("react");
|
|
|
4071
4064
|
function useElementHeight(element) {
|
|
4072
4065
|
const [height, setHeight] = (0, import_react34.useState)(null);
|
|
4073
4066
|
(0, import_react34.useEffect)(() => {
|
|
4074
|
-
if (!element)
|
|
4075
|
-
return;
|
|
4067
|
+
if (!element) return;
|
|
4076
4068
|
const resizeObserver = new ResizeObserver(() => {
|
|
4077
4069
|
setHeight(element.offsetHeight);
|
|
4078
4070
|
});
|
|
@@ -4307,8 +4299,7 @@ var CalendarPopoverContent = ({
|
|
|
4307
4299
|
var _a;
|
|
4308
4300
|
refs.setReference((_a = anchorRef == null ? void 0 : anchorRef.current) != null ? _a : null);
|
|
4309
4301
|
}, []);
|
|
4310
|
-
if (!isOpen)
|
|
4311
|
-
return null;
|
|
4302
|
+
if (!isOpen) return null;
|
|
4312
4303
|
return /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
|
|
4313
4304
|
"div",
|
|
4314
4305
|
{
|
|
@@ -5126,8 +5117,7 @@ var Drawer = (0, import_react53.forwardRef)((props, ref) => {
|
|
|
5126
5117
|
const elements = [
|
|
5127
5118
|
drawerRef.current
|
|
5128
5119
|
];
|
|
5129
|
-
if (triggerRef)
|
|
5130
|
-
elements.push(triggerRef.current);
|
|
5120
|
+
if (triggerRef) elements.push(triggerRef.current);
|
|
5131
5121
|
useOnClickOutside(elements, () => {
|
|
5132
5122
|
if (isOpen) {
|
|
5133
5123
|
onClose == null ? void 0 : onClose();
|
|
@@ -5707,11 +5697,9 @@ var Tooltip = (0, import_react60.forwardRef)(
|
|
|
5707
5697
|
};
|
|
5708
5698
|
const ref2 = tooltipRef.current;
|
|
5709
5699
|
const observer = new IntersectionObserver(closeWhenNotInView, options);
|
|
5710
|
-
if (ref2)
|
|
5711
|
-
observer.observe(ref2);
|
|
5700
|
+
if (ref2) observer.observe(ref2);
|
|
5712
5701
|
return () => {
|
|
5713
|
-
if (ref2)
|
|
5714
|
-
observer.unobserve(ref2);
|
|
5702
|
+
if (ref2) observer.unobserve(ref2);
|
|
5715
5703
|
};
|
|
5716
5704
|
}, [tooltipRef]);
|
|
5717
5705
|
(0, import_react60.useEffect)(() => {
|
|
@@ -5733,8 +5721,7 @@ var Tooltip = (0, import_react60.forwardRef)(
|
|
|
5733
5721
|
};
|
|
5734
5722
|
}, []);
|
|
5735
5723
|
useOnKeyDown(["Escape", "Esc"], () => {
|
|
5736
|
-
if (open)
|
|
5737
|
-
setOpen(false);
|
|
5724
|
+
if (open) setOpen(false);
|
|
5738
5725
|
});
|
|
5739
5726
|
const closeTooltip = () => {
|
|
5740
5727
|
clearTimeout(timer);
|
|
@@ -6202,8 +6189,7 @@ var useFileUploader = (props) => {
|
|
|
6202
6189
|
if (isEventWithFiles(evt)) {
|
|
6203
6190
|
const files = await (0, import_file_selector.fromEvent)(evt);
|
|
6204
6191
|
const fileCount = files.length;
|
|
6205
|
-
if (fileCount === 0)
|
|
6206
|
-
return;
|
|
6192
|
+
if (fileCount === 0) return;
|
|
6207
6193
|
dispatch({ type: "dragEnter" });
|
|
6208
6194
|
}
|
|
6209
6195
|
},
|
|
@@ -6222,8 +6208,7 @@ var useFileUploader = (props) => {
|
|
|
6222
6208
|
const onRootDragLeave = (0, import_react63.useCallback)(
|
|
6223
6209
|
(evt) => {
|
|
6224
6210
|
preventDefaults(evt);
|
|
6225
|
-
if (evt.currentTarget.contains(evt.relatedTarget))
|
|
6226
|
-
return;
|
|
6211
|
+
if (evt.currentTarget.contains(evt.relatedTarget)) return;
|
|
6227
6212
|
dispatch({ type: "dragLeave" });
|
|
6228
6213
|
},
|
|
6229
6214
|
[dispatch]
|
|
@@ -6623,8 +6608,7 @@ var isRelativeGridColumn = (type) => {
|
|
|
6623
6608
|
return type === "all" || type === "firstHalf" || type === "secondHalf";
|
|
6624
6609
|
};
|
|
6625
6610
|
var isGridColumn = (type) => {
|
|
6626
|
-
if (type === void 0)
|
|
6627
|
-
return false;
|
|
6611
|
+
if (type === void 0) return false;
|
|
6628
6612
|
return type.xs !== void 0 || type.sm !== void 0 || type.md !== void 0 || type.lg !== void 0 || type.xl !== void 0;
|
|
6629
6613
|
};
|
|
6630
6614
|
var GridChild = (props) => {
|
|
@@ -8355,12 +8339,10 @@ var Popover = (0, import_react82.forwardRef)(
|
|
|
8355
8339
|
);
|
|
8356
8340
|
const multiRef = useCombinedRef(ref, popoverRef, refs.setFloating);
|
|
8357
8341
|
const elements = [popoverRef.current];
|
|
8358
|
-
if (anchorElement)
|
|
8359
|
-
elements.push(anchorElement);
|
|
8342
|
+
if (anchorElement) elements.push(anchorElement);
|
|
8360
8343
|
const hasTitle = !!title;
|
|
8361
8344
|
useOnClickOutside(elements, () => {
|
|
8362
|
-
if (isOpen)
|
|
8363
|
-
onClose && onClose();
|
|
8345
|
+
if (isOpen) onClose && onClose();
|
|
8364
8346
|
});
|
|
8365
8347
|
return isOpen || hasTransitionedIn ? /* @__PURE__ */ (0, import_jsx_runtime242.jsxs)(
|
|
8366
8348
|
Paper,
|
|
@@ -9313,8 +9295,7 @@ var RadioButton = (0, import_react96.forwardRef)(
|
|
|
9313
9295
|
const describedByIds = [];
|
|
9314
9296
|
if (radioButtonGroup == null ? void 0 : radioButtonGroup.errorMessageId)
|
|
9315
9297
|
describedByIds.push(radioButtonGroup == null ? void 0 : radioButtonGroup.errorMessageId);
|
|
9316
|
-
if (ariaDescribedby)
|
|
9317
|
-
describedByIds.push(ariaDescribedby);
|
|
9298
|
+
if (ariaDescribedby) describedByIds.push(ariaDescribedby);
|
|
9318
9299
|
return /* @__PURE__ */ (0, import_jsx_runtime252.jsxs)(
|
|
9319
9300
|
Label2,
|
|
9320
9301
|
{
|
|
@@ -9885,8 +9866,7 @@ var CollapsibleRow = (0, import_react109.forwardRef)(
|
|
|
9885
9866
|
return definingColumnIndex.indexOf(childrenArray.indexOf(a2)) - definingColumnIndex.indexOf(childrenArray.indexOf(b));
|
|
9886
9867
|
});
|
|
9887
9868
|
const headerRow = () => {
|
|
9888
|
-
if (type !== "head" || !isCollapsed)
|
|
9889
|
-
return null;
|
|
9869
|
+
if (type !== "head" || !isCollapsed) return null;
|
|
9890
9870
|
return /* @__PURE__ */ (0, import_jsx_runtime264.jsx)(Row, { ref, ...rowProps(), children: /* @__PURE__ */ (0, import_jsx_runtime264.jsxs)(import_jsx_runtime264.Fragment, { children: [
|
|
9891
9871
|
definingColumnCells,
|
|
9892
9872
|
/* @__PURE__ */ (0, import_jsx_runtime264.jsxs)(Table2.Cell, { type: "head", layout: "center", children: [
|
|
@@ -9897,8 +9877,7 @@ var CollapsibleRow = (0, import_react109.forwardRef)(
|
|
|
9897
9877
|
};
|
|
9898
9878
|
const idList = spaceSeparatedIdListGenerator(collapsibleIds);
|
|
9899
9879
|
const rowWithChevron = () => {
|
|
9900
|
-
if (type !== "body" || !isCollapsed)
|
|
9901
|
-
return null;
|
|
9880
|
+
if (type !== "body" || !isCollapsed) return null;
|
|
9902
9881
|
return /* @__PURE__ */ (0, import_jsx_runtime264.jsxs)(Row, { ref, ...rowProps(!childrenCollapsed && true), children: [
|
|
9903
9882
|
definingColumnCells,
|
|
9904
9883
|
/* @__PURE__ */ (0, import_jsx_runtime264.jsx)(Table2.Cell, { children: /* @__PURE__ */ (0, import_jsx_runtime264.jsx)(
|
|
@@ -10714,8 +10693,7 @@ var typographyTypes5 = {
|
|
|
10714
10693
|
tiny: "supportingStyleTiny01"
|
|
10715
10694
|
};
|
|
10716
10695
|
var calculateChecked = (value, group, checked) => {
|
|
10717
|
-
if (typeof checked !== "undefined")
|
|
10718
|
-
return checked;
|
|
10696
|
+
if (typeof checked !== "undefined") return checked;
|
|
10719
10697
|
if (typeof value !== "undefined" && value !== null && group) {
|
|
10720
10698
|
if (typeof value === "number") {
|
|
10721
10699
|
return value === Number(group == null ? void 0 : group.value);
|