@norges-domstoler/dds-components 18.1.0 → 18.3.0
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/README.md +2 -2
- package/dist/index.css +204 -20
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +121 -16
- package/dist/index.d.ts +121 -16
- package/dist/index.js +466 -270
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +384 -174
- package/dist/index.mjs.map +1 -1
- package/package.json +22 -22
package/dist/index.mjs
CHANGED
|
@@ -95,6 +95,8 @@ import { forwardRef } from "react";
|
|
|
95
95
|
// src/components/helpers/Backdrop/Backdrop.module.css
|
|
96
96
|
var Backdrop_default = {
|
|
97
97
|
backdrop: "Backdrop_backdrop",
|
|
98
|
+
drawer: "Backdrop_drawer",
|
|
99
|
+
modal: "Backdrop_modal",
|
|
98
100
|
"backdrop--visible": "Backdrop_backdrop--visible",
|
|
99
101
|
"backdrop--hidden": "Backdrop_backdrop--hidden"
|
|
100
102
|
};
|
|
@@ -287,13 +289,17 @@ function useElementHeight(element) {
|
|
|
287
289
|
// src/components/helpers/Backdrop/Backdrop.tsx
|
|
288
290
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
289
291
|
var Backdrop = forwardRef(
|
|
290
|
-
({ isMounted, ...props }, ref) => {
|
|
292
|
+
({ isMounted, zIndex, ...props }, ref) => {
|
|
291
293
|
const isMountedCn = isMounted ? "visible" : "hidden";
|
|
292
294
|
return /* @__PURE__ */ jsx2(
|
|
293
295
|
"div",
|
|
294
296
|
{
|
|
295
297
|
ref,
|
|
296
|
-
className: cn(
|
|
298
|
+
className: cn(
|
|
299
|
+
Backdrop_default.backdrop,
|
|
300
|
+
Backdrop_default[zIndex],
|
|
301
|
+
Backdrop_default[`backdrop--${isMountedCn}`]
|
|
302
|
+
),
|
|
297
303
|
...props
|
|
298
304
|
}
|
|
299
305
|
);
|
|
@@ -2568,7 +2574,7 @@ import {
|
|
|
2568
2574
|
useState as useState3
|
|
2569
2575
|
} from "react";
|
|
2570
2576
|
var isKeyboardEvent = (e) => e.key !== void 0;
|
|
2571
|
-
function useRoveFocus(size2, active, direction = "column") {
|
|
2577
|
+
function useRoveFocus(size2, active, direction = "column", noWrap) {
|
|
2572
2578
|
const [currentFocusIndex, setCurrentFocusIndex] = useState3(-1);
|
|
2573
2579
|
const nextKey = direction === "row" ? "ArrowRight" : "ArrowDown";
|
|
2574
2580
|
const previousKey = direction === "row" ? "ArrowLeft" : "ArrowUp";
|
|
@@ -2577,16 +2583,19 @@ function useRoveFocus(size2, active, direction = "column") {
|
|
|
2577
2583
|
if (!size2 || !isKeyboardEvent(e)) return;
|
|
2578
2584
|
if (e.key === nextKey) {
|
|
2579
2585
|
e.preventDefault();
|
|
2580
|
-
setCurrentFocusIndex((prev) =>
|
|
2586
|
+
setCurrentFocusIndex((prev) => {
|
|
2587
|
+
if (prev === size2 - 1) return noWrap ? prev : 0;
|
|
2588
|
+
return prev + 1;
|
|
2589
|
+
});
|
|
2581
2590
|
} else if (e.key === previousKey) {
|
|
2582
2591
|
e.preventDefault();
|
|
2583
2592
|
setCurrentFocusIndex((prev) => {
|
|
2584
|
-
if (prev === -1 || prev === 0) return size2 - 1;
|
|
2593
|
+
if (prev === -1 || prev === 0) return noWrap ? prev : size2 - 1;
|
|
2585
2594
|
return prev - 1;
|
|
2586
2595
|
});
|
|
2587
2596
|
}
|
|
2588
2597
|
},
|
|
2589
|
-
[size2, setCurrentFocusIndex]
|
|
2598
|
+
[size2, setCurrentFocusIndex, direction, noWrap]
|
|
2590
2599
|
);
|
|
2591
2600
|
useEffect8(() => {
|
|
2592
2601
|
if (!active) {
|
|
@@ -3364,6 +3373,8 @@ var OverflowMenu_default = {
|
|
|
3364
3373
|
container: "OverflowMenu_container",
|
|
3365
3374
|
list: "OverflowMenu_list",
|
|
3366
3375
|
list__item: "OverflowMenu_list__item",
|
|
3376
|
+
default: "OverflowMenu_default",
|
|
3377
|
+
danger: "OverflowMenu_danger",
|
|
3367
3378
|
"list__item--link": "OverflowMenu_list__item--link",
|
|
3368
3379
|
icon: "OverflowMenu_icon",
|
|
3369
3380
|
divider: "OverflowMenu_divider",
|
|
@@ -3460,7 +3471,15 @@ OverflowMenu.displayName = "OverflowMenu";
|
|
|
3460
3471
|
import { forwardRef as forwardRef20, useEffect as useEffect13, useRef as useRef6 } from "react";
|
|
3461
3472
|
import { jsx as jsx187, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
3462
3473
|
var OverflowMenuButton = forwardRef20((props, ref) => {
|
|
3463
|
-
const {
|
|
3474
|
+
const {
|
|
3475
|
+
id,
|
|
3476
|
+
icon,
|
|
3477
|
+
children,
|
|
3478
|
+
className,
|
|
3479
|
+
onClick,
|
|
3480
|
+
purpose = "default",
|
|
3481
|
+
...rest
|
|
3482
|
+
} = props;
|
|
3464
3483
|
const itemRef = useRef6(null);
|
|
3465
3484
|
const combinedRef = useCombinedRef(ref, itemRef);
|
|
3466
3485
|
const { onToggle, onClose, registerItem, unregisterItem, focusedRef } = useOverflowMenu();
|
|
@@ -3477,6 +3496,7 @@ var OverflowMenuButton = forwardRef20((props, ref) => {
|
|
|
3477
3496
|
className: cn(
|
|
3478
3497
|
className,
|
|
3479
3498
|
OverflowMenu_default.list__item,
|
|
3499
|
+
OverflowMenu_default[purpose],
|
|
3480
3500
|
typographyStyles_default["body-small"],
|
|
3481
3501
|
OverflowMenu_default["list__item--link"],
|
|
3482
3502
|
focus_default["focusable--inset"]
|
|
@@ -3501,7 +3521,16 @@ OverflowMenuButton.displayName = "OverflowMenuButton";
|
|
|
3501
3521
|
import { forwardRef as forwardRef21, useEffect as useEffect14, useRef as useRef7 } from "react";
|
|
3502
3522
|
import { jsx as jsx188, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
3503
3523
|
var OverflowMenuLink = forwardRef21((props, ref) => {
|
|
3504
|
-
const {
|
|
3524
|
+
const {
|
|
3525
|
+
id,
|
|
3526
|
+
href,
|
|
3527
|
+
icon,
|
|
3528
|
+
className,
|
|
3529
|
+
onClick,
|
|
3530
|
+
children,
|
|
3531
|
+
purpose = "default",
|
|
3532
|
+
...rest
|
|
3533
|
+
} = props;
|
|
3505
3534
|
const itemRef = useRef7(null);
|
|
3506
3535
|
const combinedRef = useCombinedRef(ref, itemRef);
|
|
3507
3536
|
const { onToggle, onClose, registerItem, unregisterItem, focusedRef } = useOverflowMenu();
|
|
@@ -3518,6 +3547,7 @@ var OverflowMenuLink = forwardRef21((props, ref) => {
|
|
|
3518
3547
|
className: cn(
|
|
3519
3548
|
className,
|
|
3520
3549
|
OverflowMenu_default.list__item,
|
|
3550
|
+
OverflowMenu_default[purpose],
|
|
3521
3551
|
typographyStyles_default["body-small"],
|
|
3522
3552
|
OverflowMenu_default["list__item--link"],
|
|
3523
3553
|
focus_default["focusable--inset"]
|
|
@@ -3605,7 +3635,7 @@ var OverflowMenuList = forwardRef24((props, ref) => {
|
|
|
3605
3635
|
import { forwardRef as forwardRef25 } from "react";
|
|
3606
3636
|
import { jsx as jsx192, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
3607
3637
|
var OverflowMenuSpan = forwardRef25((props, ref) => {
|
|
3608
|
-
const { icon, children, className, ...rest } = props;
|
|
3638
|
+
const { icon, children, className, purpose = "default", ...rest } = props;
|
|
3609
3639
|
return /* @__PURE__ */ jsx192("li", { children: /* @__PURE__ */ jsxs30(
|
|
3610
3640
|
"span",
|
|
3611
3641
|
{
|
|
@@ -3613,6 +3643,7 @@ var OverflowMenuSpan = forwardRef25((props, ref) => {
|
|
|
3613
3643
|
className: cn(
|
|
3614
3644
|
className,
|
|
3615
3645
|
OverflowMenu_default.list__item,
|
|
3646
|
+
OverflowMenu_default[purpose],
|
|
3616
3647
|
typographyStyles_default["body-small"]
|
|
3617
3648
|
),
|
|
3618
3649
|
...rest,
|
|
@@ -5383,7 +5414,16 @@ var Drawer = forwardRef48((props, ref) => {
|
|
|
5383
5414
|
]
|
|
5384
5415
|
}
|
|
5385
5416
|
);
|
|
5386
|
-
const component = withBackdrop ? /* @__PURE__ */ jsx225(
|
|
5417
|
+
const component = withBackdrop ? /* @__PURE__ */ jsx225(
|
|
5418
|
+
Backdrop,
|
|
5419
|
+
{
|
|
5420
|
+
zIndex: "drawer",
|
|
5421
|
+
isMounted,
|
|
5422
|
+
ref: backdropRef,
|
|
5423
|
+
onClick: onBackdropClick,
|
|
5424
|
+
children: drawer
|
|
5425
|
+
}
|
|
5426
|
+
) : drawer;
|
|
5387
5427
|
return (isOpen || hasTransitionedIn) && portalTarget ? createPortal(component, portalTarget) : null;
|
|
5388
5428
|
});
|
|
5389
5429
|
Drawer.displayName = "Drawer";
|
|
@@ -6007,59 +6047,63 @@ var Tooltip = forwardRef52(
|
|
|
6007
6047
|
"aria-describedby": uniqueTooltipId
|
|
6008
6048
|
})
|
|
6009
6049
|
);
|
|
6010
|
-
const containerProps = {
|
|
6011
|
-
...getBaseHTMLProps(id, cn(className, Tooltip_default.container), htmlProps, rest),
|
|
6012
|
-
style,
|
|
6013
|
-
onMouseLeave: combineHandlers(closeTooltip, onMouseLeave),
|
|
6014
|
-
onMouseOver: combineHandlers(openTooltip, onMouseOver)
|
|
6015
|
-
};
|
|
6016
|
-
const wrapperProps = {
|
|
6017
|
-
id: uniqueTooltipId,
|
|
6018
|
-
ref: combinedRef,
|
|
6019
|
-
role: "tooltip",
|
|
6020
|
-
"aria-hidden": !open,
|
|
6021
|
-
open: open && inView,
|
|
6022
|
-
style: { ...positionStyles.floating }
|
|
6023
|
-
};
|
|
6024
6050
|
const openCn = open && inView ? "open" : "closed";
|
|
6025
|
-
return /* @__PURE__ */ jsxs47(
|
|
6026
|
-
|
|
6027
|
-
|
|
6028
|
-
|
|
6029
|
-
|
|
6030
|
-
|
|
6031
|
-
|
|
6032
|
-
|
|
6033
|
-
|
|
6034
|
-
|
|
6035
|
-
|
|
6036
|
-
|
|
6037
|
-
|
|
6038
|
-
|
|
6039
|
-
|
|
6040
|
-
|
|
6041
|
-
|
|
6042
|
-
|
|
6043
|
-
|
|
6044
|
-
|
|
6045
|
-
|
|
6046
|
-
|
|
6047
|
-
|
|
6051
|
+
return /* @__PURE__ */ jsxs47(
|
|
6052
|
+
"div",
|
|
6053
|
+
{
|
|
6054
|
+
...getBaseHTMLProps(
|
|
6055
|
+
id,
|
|
6056
|
+
cn(className, Tooltip_default.container),
|
|
6057
|
+
htmlProps,
|
|
6058
|
+
rest
|
|
6059
|
+
),
|
|
6060
|
+
style,
|
|
6061
|
+
onMouseLeave: combineHandlers(closeTooltip, onMouseLeave),
|
|
6062
|
+
onMouseOver: combineHandlers(openTooltip, onMouseOver),
|
|
6063
|
+
children: [
|
|
6064
|
+
anchorElement,
|
|
6065
|
+
/* @__PURE__ */ jsxs47(
|
|
6066
|
+
Paper,
|
|
6067
|
+
{
|
|
6068
|
+
id: uniqueTooltipId,
|
|
6069
|
+
ref: combinedRef,
|
|
6070
|
+
role: "tooltip",
|
|
6071
|
+
"aria-hidden": !open,
|
|
6072
|
+
style: { ...positionStyles.floating },
|
|
6073
|
+
elevation: 1,
|
|
6074
|
+
border: "subtle",
|
|
6075
|
+
className: cn(
|
|
6076
|
+
Tooltip_default.paper,
|
|
6077
|
+
typographyStyles_default["body-medium"],
|
|
6078
|
+
utilStyles_default["visibility-transition"],
|
|
6079
|
+
utilStyles_default[`visibility-transition--${openCn}`]
|
|
6048
6080
|
),
|
|
6049
|
-
|
|
6050
|
-
|
|
6051
|
-
{
|
|
6052
|
-
|
|
6053
|
-
|
|
6054
|
-
|
|
6055
|
-
|
|
6056
|
-
|
|
6057
|
-
|
|
6058
|
-
|
|
6059
|
-
|
|
6060
|
-
|
|
6061
|
-
|
|
6062
|
-
|
|
6081
|
+
children: [
|
|
6082
|
+
text,
|
|
6083
|
+
/* @__PURE__ */ jsx232("div", { ref: setArrowElement, style: positionStyles.arrow, children: /* @__PURE__ */ jsxs47("svg", { width: "36", height: "9", children: [
|
|
6084
|
+
/* @__PURE__ */ jsx232(
|
|
6085
|
+
"path",
|
|
6086
|
+
{
|
|
6087
|
+
d: "M16.586 6.586L10 0h16.154a.373.373 0 00-.263.11l-6.477 6.476a2 2 0 01-2.828 0z",
|
|
6088
|
+
className: Tooltip_default["svg-arrow__background"]
|
|
6089
|
+
}
|
|
6090
|
+
),
|
|
6091
|
+
/* @__PURE__ */ jsx232(
|
|
6092
|
+
"path",
|
|
6093
|
+
{
|
|
6094
|
+
fillRule: "evenodd",
|
|
6095
|
+
clipRule: "evenodd",
|
|
6096
|
+
d: "M26.5.5l-6.732 6.94a2.5 2.5 0 01-3.536 0L9.5.5H11l5.94 6.232a1.5 1.5 0 002.12 0L25 .5h1.5z",
|
|
6097
|
+
className: Tooltip_default["svg-arrow__border"]
|
|
6098
|
+
}
|
|
6099
|
+
)
|
|
6100
|
+
] }) })
|
|
6101
|
+
]
|
|
6102
|
+
}
|
|
6103
|
+
)
|
|
6104
|
+
]
|
|
6105
|
+
}
|
|
6106
|
+
);
|
|
6063
6107
|
}
|
|
6064
6108
|
);
|
|
6065
6109
|
Tooltip.displayName = "Tooltip";
|
|
@@ -6691,7 +6735,15 @@ var FileUploader = (props) => {
|
|
|
6691
6735
|
style: { ...style, width },
|
|
6692
6736
|
...rest,
|
|
6693
6737
|
children: [
|
|
6694
|
-
hasLabel && /* @__PURE__ */ jsx238(
|
|
6738
|
+
hasLabel && /* @__PURE__ */ jsx238(
|
|
6739
|
+
Label,
|
|
6740
|
+
{
|
|
6741
|
+
id: labelId,
|
|
6742
|
+
showRequiredStyling: showRequiredMarker,
|
|
6743
|
+
htmlFor: inputId,
|
|
6744
|
+
children: label
|
|
6745
|
+
}
|
|
6746
|
+
),
|
|
6695
6747
|
hasTip && /* @__PURE__ */ jsx238(InputMessage, { id: tipId, message: tip, messageType: "tip" }),
|
|
6696
6748
|
withDragAndDrop ? /* @__PURE__ */ jsxs50(
|
|
6697
6749
|
"div",
|
|
@@ -7856,6 +7908,7 @@ var Modal = forwardRef72((props, ref) => {
|
|
|
7856
7908
|
/* @__PURE__ */ jsx261(
|
|
7857
7909
|
Backdrop,
|
|
7858
7910
|
{
|
|
7911
|
+
zIndex: "modal",
|
|
7859
7912
|
isMounted: isOpen && hasTransitionedIn,
|
|
7860
7913
|
ref: backdropRef,
|
|
7861
7914
|
onClick: onBackdropClick,
|
|
@@ -8012,7 +8065,11 @@ function PaginationGenerator(pagesAmount, activePage) {
|
|
|
8012
8065
|
}
|
|
8013
8066
|
|
|
8014
8067
|
// src/components/Select/Select.tsx
|
|
8015
|
-
import {
|
|
8068
|
+
import {
|
|
8069
|
+
forwardRef as forwardRef75,
|
|
8070
|
+
useContext as useContext11,
|
|
8071
|
+
useId as useId15
|
|
8072
|
+
} from "react";
|
|
8016
8073
|
import {
|
|
8017
8074
|
default as ReactSelect
|
|
8018
8075
|
} from "react-select";
|
|
@@ -9534,7 +9591,7 @@ var getCallingCode = (s) => {
|
|
|
9534
9591
|
};
|
|
9535
9592
|
|
|
9536
9593
|
// src/components/Popover/Popover.tsx
|
|
9537
|
-
import { forwardRef as forwardRef79 } from "react";
|
|
9594
|
+
import { forwardRef as forwardRef79, useEffect as useEffect25 } from "react";
|
|
9538
9595
|
|
|
9539
9596
|
// src/components/Popover/Popover.module.css
|
|
9540
9597
|
var Popover_default = {
|
|
@@ -9544,6 +9601,14 @@ var Popover_default = {
|
|
|
9544
9601
|
"close-button": "Popover_close-button"
|
|
9545
9602
|
};
|
|
9546
9603
|
|
|
9604
|
+
// src/components/Popover/Popover.context.tsx
|
|
9605
|
+
import {
|
|
9606
|
+
createContext as createContext5,
|
|
9607
|
+
useContext as useContext12
|
|
9608
|
+
} from "react";
|
|
9609
|
+
var PopoverContext = createContext5({});
|
|
9610
|
+
var usePopoverContext = () => useContext12(PopoverContext);
|
|
9611
|
+
|
|
9547
9612
|
// src/components/Popover/Popover.tsx
|
|
9548
9613
|
import { jsx as jsx269, jsxs as jsxs63 } from "react/jsx-runtime";
|
|
9549
9614
|
var Popover = forwardRef79(
|
|
@@ -9561,17 +9626,12 @@ var Popover = forwardRef79(
|
|
|
9561
9626
|
offset = 8,
|
|
9562
9627
|
sizeProps,
|
|
9563
9628
|
returnFocusOnBlur = true,
|
|
9564
|
-
id,
|
|
9565
9629
|
className,
|
|
9566
9630
|
htmlProps = {},
|
|
9567
9631
|
...rest
|
|
9568
9632
|
} = props;
|
|
9569
9633
|
const hasTransitionedIn = useMountTransition(isOpen, 400);
|
|
9570
|
-
const {
|
|
9571
|
-
placement,
|
|
9572
|
-
offset
|
|
9573
|
-
});
|
|
9574
|
-
refs.setReference(anchorElement || null);
|
|
9634
|
+
const { floatStyling, setFloatOptions, floatingRef, popoverId } = usePopoverContext();
|
|
9575
9635
|
const popoverRef = useReturnFocusOnBlur(
|
|
9576
9636
|
isOpen && hasTransitionedIn && returnFocusOnBlur,
|
|
9577
9637
|
() => {
|
|
@@ -9580,23 +9640,27 @@ var Popover = forwardRef79(
|
|
|
9580
9640
|
},
|
|
9581
9641
|
anchorElement && anchorElement
|
|
9582
9642
|
);
|
|
9583
|
-
const multiRef = useCombinedRef(ref, popoverRef,
|
|
9643
|
+
const multiRef = useCombinedRef(ref, popoverRef, floatingRef);
|
|
9644
|
+
useEffect25(() => {
|
|
9645
|
+
setFloatOptions && setFloatOptions({ placement, offset });
|
|
9646
|
+
}, []);
|
|
9584
9647
|
const elements = [popoverRef.current];
|
|
9585
9648
|
if (anchorElement) elements.push(anchorElement);
|
|
9586
9649
|
const hasTitle = !!title;
|
|
9587
9650
|
useOnClickOutside(elements, () => {
|
|
9588
9651
|
if (isOpen) onClose && onClose();
|
|
9589
9652
|
});
|
|
9653
|
+
const openCn = hasTransitionedIn && isOpen ? "open" : "closed";
|
|
9590
9654
|
return isOpen || hasTransitionedIn ? /* @__PURE__ */ jsxs63(
|
|
9591
9655
|
Paper,
|
|
9592
9656
|
{
|
|
9593
9657
|
...getBaseHTMLProps(
|
|
9594
|
-
|
|
9658
|
+
popoverId,
|
|
9595
9659
|
cn(
|
|
9596
9660
|
className,
|
|
9597
9661
|
Popover_default.container,
|
|
9598
9662
|
utilStyles_default["visibility-transition"],
|
|
9599
|
-
|
|
9663
|
+
utilStyles_default[`visibility-transition--${openCn}`],
|
|
9600
9664
|
focus_default.focusable
|
|
9601
9665
|
),
|
|
9602
9666
|
htmlProps,
|
|
@@ -9604,7 +9668,11 @@ var Popover = forwardRef79(
|
|
|
9604
9668
|
),
|
|
9605
9669
|
ref: multiRef,
|
|
9606
9670
|
tabIndex: -1,
|
|
9607
|
-
style: {
|
|
9671
|
+
style: {
|
|
9672
|
+
...htmlProps.style,
|
|
9673
|
+
...floatStyling,
|
|
9674
|
+
...sizeProps
|
|
9675
|
+
},
|
|
9608
9676
|
role: "dialog",
|
|
9609
9677
|
elevation: 3,
|
|
9610
9678
|
border: "subtle",
|
|
@@ -9644,7 +9712,7 @@ import {
|
|
|
9644
9712
|
useRef as useRef31,
|
|
9645
9713
|
useState as useState21
|
|
9646
9714
|
} from "react";
|
|
9647
|
-
import {
|
|
9715
|
+
import { jsx as jsx270 } from "react/jsx-runtime";
|
|
9648
9716
|
var PopoverGroup = ({
|
|
9649
9717
|
isOpen = false,
|
|
9650
9718
|
onCloseButtonClick,
|
|
@@ -9655,6 +9723,8 @@ var PopoverGroup = ({
|
|
|
9655
9723
|
const [open, setOpen] = useState21(isOpen);
|
|
9656
9724
|
const generatedId = useId18();
|
|
9657
9725
|
const uniquePopoverId = popoverId != null ? popoverId : `${generatedId}-popover`;
|
|
9726
|
+
const [floatOptions, setFloatOptions] = useState21();
|
|
9727
|
+
const { refs, styles: positionStyles } = useFloatPosition(null, floatOptions);
|
|
9658
9728
|
const handleOnCloseButtonClick = () => {
|
|
9659
9729
|
setOpen(false);
|
|
9660
9730
|
onCloseButtonClick && onCloseButtonClick();
|
|
@@ -9664,7 +9734,8 @@ var PopoverGroup = ({
|
|
|
9664
9734
|
onTriggerClick && onTriggerClick();
|
|
9665
9735
|
};
|
|
9666
9736
|
const buttonRef = useRef31(null);
|
|
9667
|
-
const
|
|
9737
|
+
const anchorRef = refs.setReference;
|
|
9738
|
+
const combinedRef = useCombinedRef(buttonRef, anchorRef);
|
|
9668
9739
|
useOnKeyDown(["Esc", "Escape"], () => {
|
|
9669
9740
|
var _a;
|
|
9670
9741
|
if (open) {
|
|
@@ -9673,47 +9744,57 @@ var PopoverGroup = ({
|
|
|
9673
9744
|
}
|
|
9674
9745
|
});
|
|
9675
9746
|
const handleClose = () => setOpen(false);
|
|
9747
|
+
const isAnchorChild = (i) => i === 0;
|
|
9676
9748
|
const Children8 = ReactChildren5.map(children, (child, childIndex) => {
|
|
9677
|
-
return isValidElement7(child) && (childIndex
|
|
9749
|
+
return isValidElement7(child) && (isAnchorChild(childIndex) ? cloneElement6(child, {
|
|
9678
9750
|
"aria-haspopup": "dialog",
|
|
9679
9751
|
"aria-controls": uniquePopoverId,
|
|
9680
9752
|
"aria-expanded": open,
|
|
9681
9753
|
onClick: handleOnTriggerClick,
|
|
9682
|
-
ref:
|
|
9754
|
+
ref: combinedRef
|
|
9683
9755
|
}) : cloneElement6(child, {
|
|
9684
9756
|
isOpen: open,
|
|
9685
9757
|
"aria-hidden": !open,
|
|
9686
|
-
id: uniquePopoverId,
|
|
9687
9758
|
onCloseButtonClick: handleOnCloseButtonClick,
|
|
9688
9759
|
anchorElement: buttonRef.current,
|
|
9689
|
-
ref: popoverRef,
|
|
9690
9760
|
onClose: handleClose
|
|
9691
9761
|
}));
|
|
9692
9762
|
});
|
|
9693
|
-
return /* @__PURE__ */ jsx270(
|
|
9763
|
+
return /* @__PURE__ */ jsx270(
|
|
9764
|
+
PopoverContext.Provider,
|
|
9765
|
+
{
|
|
9766
|
+
value: {
|
|
9767
|
+
floatStyling: positionStyles.floating,
|
|
9768
|
+
setFloatOptions,
|
|
9769
|
+
floatingRef: refs.setFloating,
|
|
9770
|
+
popoverId: uniquePopoverId
|
|
9771
|
+
},
|
|
9772
|
+
children: Children8
|
|
9773
|
+
}
|
|
9774
|
+
);
|
|
9694
9775
|
};
|
|
9695
9776
|
PopoverGroup.displayName = "PopoverGroup";
|
|
9696
9777
|
|
|
9697
9778
|
// src/components/ProgressTracker/ProgressTracker.tsx
|
|
9698
9779
|
import {
|
|
9699
9780
|
Children as Children4,
|
|
9700
|
-
Fragment as
|
|
9781
|
+
Fragment as Fragment10,
|
|
9701
9782
|
cloneElement as cloneElement7,
|
|
9702
9783
|
forwardRef as forwardRef80,
|
|
9703
9784
|
isValidElement as isValidElement8,
|
|
9704
|
-
useEffect as
|
|
9785
|
+
useEffect as useEffect26,
|
|
9705
9786
|
useMemo as useMemo3,
|
|
9706
9787
|
useState as useState22
|
|
9707
9788
|
} from "react";
|
|
9708
9789
|
|
|
9709
9790
|
// src/components/ProgressTracker/ProgressTracker.context.tsx
|
|
9710
|
-
import { createContext as
|
|
9711
|
-
var ProgressTrackerContext =
|
|
9791
|
+
import { createContext as createContext6, useContext as useContext13 } from "react";
|
|
9792
|
+
var ProgressTrackerContext = createContext6(
|
|
9712
9793
|
{
|
|
9713
9794
|
activeStep: 0
|
|
9714
9795
|
}
|
|
9715
9796
|
);
|
|
9716
|
-
var useProgressTrackerContext = () =>
|
|
9797
|
+
var useProgressTrackerContext = () => useContext13(ProgressTrackerContext);
|
|
9717
9798
|
|
|
9718
9799
|
// src/components/ProgressTracker/ProgressTracker.module.css
|
|
9719
9800
|
var ProgressTracker_default = {
|
|
@@ -9738,7 +9819,7 @@ var ProgressTracker_default = {
|
|
|
9738
9819
|
|
|
9739
9820
|
// src/components/ProgressTracker/ProgressTrackerItem.tsx
|
|
9740
9821
|
import { useMemo as useMemo2 } from "react";
|
|
9741
|
-
import { Fragment as
|
|
9822
|
+
import { Fragment as Fragment9, jsx as jsx271, jsxs as jsxs64 } from "react/jsx-runtime";
|
|
9742
9823
|
var toItemState = (active, completed, disabled) => {
|
|
9743
9824
|
if (disabled) {
|
|
9744
9825
|
return "disabled";
|
|
@@ -9788,7 +9869,7 @@ var ProgressTrackerItem = (props) => {
|
|
|
9788
9869
|
}
|
|
9789
9870
|
return index + 1;
|
|
9790
9871
|
}, [completed, icon, index]);
|
|
9791
|
-
const stepContent = /* @__PURE__ */ jsxs64(
|
|
9872
|
+
const stepContent = /* @__PURE__ */ jsxs64(Fragment9, { children: [
|
|
9792
9873
|
/* @__PURE__ */ jsx271(
|
|
9793
9874
|
"div",
|
|
9794
9875
|
{
|
|
@@ -9862,7 +9943,7 @@ var ProgressTracker = (() => {
|
|
|
9862
9943
|
setActiveStep(step);
|
|
9863
9944
|
onStepChange && onStepChange(step);
|
|
9864
9945
|
};
|
|
9865
|
-
|
|
9946
|
+
useEffect26(() => {
|
|
9866
9947
|
if (activeStep !== void 0 && activeStep != thisActiveStep) {
|
|
9867
9948
|
setActiveStep(activeStep);
|
|
9868
9949
|
}
|
|
@@ -9908,7 +9989,7 @@ var intersperseItemsWithConnector = (children) => Children4.map(children, (child
|
|
|
9908
9989
|
if (index === 0) {
|
|
9909
9990
|
return child;
|
|
9910
9991
|
}
|
|
9911
|
-
return /* @__PURE__ */ jsxs65(
|
|
9992
|
+
return /* @__PURE__ */ jsxs65(Fragment10, { children: [
|
|
9912
9993
|
/* @__PURE__ */ jsx272("div", { "aria-hidden": true, className: ProgressTracker_default.connector }),
|
|
9913
9994
|
child
|
|
9914
9995
|
] }, index);
|
|
@@ -10019,12 +10100,12 @@ import {
|
|
|
10019
10100
|
|
|
10020
10101
|
// src/components/Search/AutocompleteSearch.context.tsx
|
|
10021
10102
|
import {
|
|
10022
|
-
createContext as
|
|
10023
|
-
useContext as
|
|
10103
|
+
createContext as createContext7,
|
|
10104
|
+
useContext as useContext14
|
|
10024
10105
|
} from "react";
|
|
10025
|
-
var AutocompleteSearchContext =
|
|
10106
|
+
var AutocompleteSearchContext = createContext7({});
|
|
10026
10107
|
var useAutocompleteSearch = () => {
|
|
10027
|
-
return
|
|
10108
|
+
return useContext14(AutocompleteSearchContext);
|
|
10028
10109
|
};
|
|
10029
10110
|
|
|
10030
10111
|
// src/components/Search/Search.module.css
|
|
@@ -10079,7 +10160,7 @@ import { forwardRef as forwardRef83 } from "react";
|
|
|
10079
10160
|
// src/components/Search/SearchSuggestionItem.tsx
|
|
10080
10161
|
import {
|
|
10081
10162
|
forwardRef as forwardRef82,
|
|
10082
|
-
useEffect as
|
|
10163
|
+
useEffect as useEffect27,
|
|
10083
10164
|
useRef as useRef32
|
|
10084
10165
|
} from "react";
|
|
10085
10166
|
import { jsx as jsx274 } from "react/jsx-runtime";
|
|
@@ -10087,7 +10168,7 @@ var SearchSuggestionItem = forwardRef82((props, ref) => {
|
|
|
10087
10168
|
const { focus, className, ...rest } = props;
|
|
10088
10169
|
const itemRef = useRef32(null);
|
|
10089
10170
|
const combinedRef = useCombinedRef(ref, itemRef);
|
|
10090
|
-
|
|
10171
|
+
useEffect27(() => {
|
|
10091
10172
|
var _a;
|
|
10092
10173
|
if (focus) {
|
|
10093
10174
|
(_a = itemRef.current) == null ? void 0 : _a.focus();
|
|
@@ -10192,7 +10273,7 @@ var SearchSuggestions = forwardRef83((props, ref) => {
|
|
|
10192
10273
|
SearchSuggestions.displayName = "SearchSuggestions";
|
|
10193
10274
|
|
|
10194
10275
|
// src/components/Search/Search.tsx
|
|
10195
|
-
import { Fragment as
|
|
10276
|
+
import { Fragment as Fragment11, jsx as jsx276, jsxs as jsxs68 } from "react/jsx-runtime";
|
|
10196
10277
|
var getIconSize2 = (size2) => {
|
|
10197
10278
|
switch (size2) {
|
|
10198
10279
|
case "large":
|
|
@@ -10298,7 +10379,7 @@ var Search = forwardRef84(
|
|
|
10298
10379
|
)
|
|
10299
10380
|
}
|
|
10300
10381
|
),
|
|
10301
|
-
hasSuggestions && /* @__PURE__ */ jsxs68(
|
|
10382
|
+
hasSuggestions && /* @__PURE__ */ jsxs68(Fragment11, { children: [
|
|
10302
10383
|
/* @__PURE__ */ jsx276(
|
|
10303
10384
|
SearchSuggestions,
|
|
10304
10385
|
{
|
|
@@ -10346,7 +10427,7 @@ Search.displayName = "Search";
|
|
|
10346
10427
|
|
|
10347
10428
|
// src/components/Search/SearchAutocompleteWrapper.tsx
|
|
10348
10429
|
import {
|
|
10349
|
-
useEffect as
|
|
10430
|
+
useEffect as useEffect28,
|
|
10350
10431
|
useRef as useRef33,
|
|
10351
10432
|
useState as useState24
|
|
10352
10433
|
} from "react";
|
|
@@ -10366,7 +10447,7 @@ var SearchAutocompleteWrapper = (props) => {
|
|
|
10366
10447
|
const [showSuggestions, setShowSuggestions] = useState24(false);
|
|
10367
10448
|
const closeSuggestions = () => showSuggestions === true && setShowSuggestions(false);
|
|
10368
10449
|
const openSuggestions = () => showSuggestions === false && setShowSuggestions(true);
|
|
10369
|
-
|
|
10450
|
+
useEffect28(() => {
|
|
10370
10451
|
if (suggestions.length > 0) {
|
|
10371
10452
|
openSuggestions();
|
|
10372
10453
|
} else {
|
|
@@ -10439,10 +10520,10 @@ Search2.Suggestions = SearchSuggestions;
|
|
|
10439
10520
|
import { forwardRef as forwardRef86, useId as useId21 } from "react";
|
|
10440
10521
|
|
|
10441
10522
|
// src/components/SelectionControl/Checkbox/CheckboxGroupContext.tsx
|
|
10442
|
-
import { createContext as
|
|
10443
|
-
var CheckboxGroupContext =
|
|
10523
|
+
import { createContext as createContext8, useContext as useContext15 } from "react";
|
|
10524
|
+
var CheckboxGroupContext = createContext8(null);
|
|
10444
10525
|
var useCheckboxGroup = () => {
|
|
10445
|
-
return
|
|
10526
|
+
return useContext15(CheckboxGroupContext);
|
|
10446
10527
|
};
|
|
10447
10528
|
|
|
10448
10529
|
// src/components/SelectionControl/SelectionControl.styles.tsx
|
|
@@ -10692,10 +10773,10 @@ CheckboxGroup.displayName = "CheckboxGroup";
|
|
|
10692
10773
|
import { forwardRef as forwardRef87, useId as useId23 } from "react";
|
|
10693
10774
|
|
|
10694
10775
|
// src/components/SelectionControl/RadioButton/RadioButtonGroupContext.tsx
|
|
10695
|
-
import { createContext as
|
|
10696
|
-
var RadioButtonGroupContext =
|
|
10776
|
+
import { createContext as createContext9, useContext as useContext16 } from "react";
|
|
10777
|
+
var RadioButtonGroupContext = createContext9(null);
|
|
10697
10778
|
var useRadioButtonGroup = () => {
|
|
10698
|
-
return
|
|
10779
|
+
return useContext16(RadioButtonGroupContext);
|
|
10699
10780
|
};
|
|
10700
10781
|
|
|
10701
10782
|
// src/components/SelectionControl/RadioButton/RadioButton.tsx
|
|
@@ -11045,21 +11126,21 @@ SplitButton.displayName = "SplitButton";
|
|
|
11045
11126
|
// src/components/Table/collapsible/CollapsibleRow.tsx
|
|
11046
11127
|
import {
|
|
11047
11128
|
Children as Children5,
|
|
11048
|
-
Fragment as
|
|
11129
|
+
Fragment as Fragment12,
|
|
11049
11130
|
cloneElement as cloneElement8,
|
|
11050
11131
|
forwardRef as forwardRef99,
|
|
11051
11132
|
isValidElement as isValidElement9,
|
|
11052
|
-
useEffect as
|
|
11133
|
+
useEffect as useEffect30,
|
|
11053
11134
|
useState as useState28
|
|
11054
11135
|
} from "react";
|
|
11055
11136
|
|
|
11056
11137
|
// src/components/Table/collapsible/Table.context.tsx
|
|
11057
|
-
import { createContext as
|
|
11058
|
-
var CollapsibleTableContext =
|
|
11138
|
+
import { createContext as createContext10, useContext as useContext17 } from "react";
|
|
11139
|
+
var CollapsibleTableContext = createContext10({
|
|
11059
11140
|
headerValues: [],
|
|
11060
11141
|
definingColumnIndex: [0]
|
|
11061
11142
|
});
|
|
11062
|
-
var useCollapsibleTableContext = () =>
|
|
11143
|
+
var useCollapsibleTableContext = () => useContext17(CollapsibleTableContext);
|
|
11063
11144
|
|
|
11064
11145
|
// src/components/Table/normal/Body.tsx
|
|
11065
11146
|
import { forwardRef as forwardRef92 } from "react";
|
|
@@ -11078,9 +11159,9 @@ import {
|
|
|
11078
11159
|
|
|
11079
11160
|
// src/components/Table/normal/Head.tsx
|
|
11080
11161
|
import {
|
|
11081
|
-
createContext as
|
|
11162
|
+
createContext as createContext11,
|
|
11082
11163
|
forwardRef as forwardRef93,
|
|
11083
|
-
useContext as
|
|
11164
|
+
useContext as useContext18
|
|
11084
11165
|
} from "react";
|
|
11085
11166
|
import { jsx as jsx287 } from "react/jsx-runtime";
|
|
11086
11167
|
var Head = forwardRef93(
|
|
@@ -11089,9 +11170,9 @@ var Head = forwardRef93(
|
|
|
11089
11170
|
}
|
|
11090
11171
|
);
|
|
11091
11172
|
Head.displayName = "Table.Head";
|
|
11092
|
-
var HeadContext =
|
|
11173
|
+
var HeadContext = createContext11(false);
|
|
11093
11174
|
function useIsInTableHead() {
|
|
11094
|
-
const isInTableHead =
|
|
11175
|
+
const isInTableHead = useContext18(HeadContext);
|
|
11095
11176
|
return isInTableHead;
|
|
11096
11177
|
}
|
|
11097
11178
|
|
|
@@ -11271,25 +11352,33 @@ var Table = forwardRef98(
|
|
|
11271
11352
|
Table.displayName = "Table";
|
|
11272
11353
|
|
|
11273
11354
|
// src/components/Table/normal/TableWrapper.tsx
|
|
11274
|
-
import {
|
|
11355
|
+
import {
|
|
11356
|
+
useContext as useContext19,
|
|
11357
|
+
useEffect as useEffect29,
|
|
11358
|
+
useRef as useRef34,
|
|
11359
|
+
useState as useState27
|
|
11360
|
+
} from "react";
|
|
11275
11361
|
import { jsx as jsx293 } from "react/jsx-runtime";
|
|
11276
11362
|
var TableWrapper = ({ className, ...rest }) => {
|
|
11363
|
+
const themeContext = useContext19(ThemeContext);
|
|
11364
|
+
const container = themeContext == null ? void 0 : themeContext.el;
|
|
11365
|
+
const containerWidth = container ? container.clientWidth : 0;
|
|
11277
11366
|
const [overflowX, setOverflowX] = useState27(false);
|
|
11278
|
-
const [
|
|
11367
|
+
const [themeContainerWidth, setThemeContainerWidth] = useState27(containerWidth);
|
|
11279
11368
|
function isOverflowingX(event) {
|
|
11280
11369
|
return event.offsetWidth < event.scrollWidth;
|
|
11281
11370
|
}
|
|
11282
11371
|
const wrapperRef = useRef34(null);
|
|
11283
|
-
|
|
11372
|
+
useEffect29(() => {
|
|
11284
11373
|
if ((wrapperRef == null ? void 0 : wrapperRef.current) && isOverflowingX(wrapperRef.current)) {
|
|
11285
11374
|
setOverflowX(true);
|
|
11286
11375
|
return;
|
|
11287
11376
|
}
|
|
11288
11377
|
setOverflowX(false);
|
|
11289
|
-
}, [
|
|
11290
|
-
|
|
11378
|
+
}, [themeContainerWidth]);
|
|
11379
|
+
useEffect29(() => {
|
|
11291
11380
|
function handleResize() {
|
|
11292
|
-
|
|
11381
|
+
setThemeContainerWidth(containerWidth);
|
|
11293
11382
|
}
|
|
11294
11383
|
window.addEventListener("resize", handleResize);
|
|
11295
11384
|
return () => window.removeEventListener("resize", handleResize);
|
|
@@ -11321,7 +11410,7 @@ Table2.Row = Row;
|
|
|
11321
11410
|
Table2.Foot = Foot;
|
|
11322
11411
|
|
|
11323
11412
|
// src/components/Table/collapsible/CollapsibleRow.tsx
|
|
11324
|
-
import { Fragment as
|
|
11413
|
+
import { Fragment as Fragment13, jsx as jsx294, jsxs as jsxs75 } from "react/jsx-runtime";
|
|
11325
11414
|
var CollapsibleRow = forwardRef99(
|
|
11326
11415
|
({
|
|
11327
11416
|
type: _type,
|
|
@@ -11336,7 +11425,7 @@ var CollapsibleRow = forwardRef99(
|
|
|
11336
11425
|
const type = _type != null ? _type : isInHead ? "head" : "body";
|
|
11337
11426
|
const { isCollapsed, headerValues, definingColumnIndex } = useCollapsibleTableContext();
|
|
11338
11427
|
const [childrenCollapsed, setChildrenCollapsed] = useState28(true);
|
|
11339
|
-
|
|
11428
|
+
useEffect30(() => {
|
|
11340
11429
|
!isCollapsed && setChildrenCollapsed(true);
|
|
11341
11430
|
}, [isCollapsed]);
|
|
11342
11431
|
const rowProps = (isOpenCollapsibleHeader) => {
|
|
@@ -11363,7 +11452,7 @@ var CollapsibleRow = forwardRef99(
|
|
|
11363
11452
|
const collapsedRenderedChildren = isCollapsed && collapsedHeaderValues.length > 0 ? collapsedChildren.map(function(child, index) {
|
|
11364
11453
|
const id = derivativeIdGenerator(prefix2, index.toString());
|
|
11365
11454
|
collapsibleIds.push(id);
|
|
11366
|
-
return /* @__PURE__ */ jsxs75(
|
|
11455
|
+
return /* @__PURE__ */ jsxs75(Fragment12, { children: [
|
|
11367
11456
|
/* @__PURE__ */ jsx294(DescriptionListTerm, { children: collapsedHeaderValues[index].content }),
|
|
11368
11457
|
isValidElement9(child) && cloneElement8(child, {
|
|
11369
11458
|
collapsibleProps: { isCollapsibleChild: true }
|
|
@@ -11376,7 +11465,7 @@ var CollapsibleRow = forwardRef99(
|
|
|
11376
11465
|
});
|
|
11377
11466
|
const headerRow = () => {
|
|
11378
11467
|
if (type !== "head" || !isCollapsed) return null;
|
|
11379
|
-
return /* @__PURE__ */ jsx294(Row, { ref, ...rowProps(), children: /* @__PURE__ */ jsxs75(
|
|
11468
|
+
return /* @__PURE__ */ jsx294(Row, { ref, ...rowProps(), children: /* @__PURE__ */ jsxs75(Fragment13, { children: [
|
|
11380
11469
|
definingColumnCells,
|
|
11381
11470
|
/* @__PURE__ */ jsxs75(Table2.Cell, { type: "head", layout: "center", children: [
|
|
11382
11471
|
"Utvid",
|
|
@@ -11413,9 +11502,9 @@ var CollapsibleRow = forwardRef99(
|
|
|
11413
11502
|
) })
|
|
11414
11503
|
] });
|
|
11415
11504
|
};
|
|
11416
|
-
return isCollapsed && collapsedRenderedChildren && collapsedRenderedChildren.length > 0 ? /* @__PURE__ */ jsxs75(
|
|
11505
|
+
return isCollapsed && collapsedRenderedChildren && collapsedRenderedChildren.length > 0 ? /* @__PURE__ */ jsxs75(Fragment13, { children: [
|
|
11417
11506
|
headerRow(),
|
|
11418
|
-
type === "body" && /* @__PURE__ */ jsxs75(
|
|
11507
|
+
type === "body" && /* @__PURE__ */ jsxs75(Fragment13, { children: [
|
|
11419
11508
|
rowWithChevron(),
|
|
11420
11509
|
childrenCollapsed ? null : collapsedRows
|
|
11421
11510
|
] })
|
|
@@ -11455,15 +11544,15 @@ CollapsibleTable2.Row = CollapsibleRow;
|
|
|
11455
11544
|
// src/components/Tabs/Tabs.tsx
|
|
11456
11545
|
import {
|
|
11457
11546
|
forwardRef as forwardRef101,
|
|
11458
|
-
useEffect as
|
|
11547
|
+
useEffect as useEffect31,
|
|
11459
11548
|
useId as useId25,
|
|
11460
11549
|
useRef as useRef35,
|
|
11461
11550
|
useState as useState29
|
|
11462
11551
|
} from "react";
|
|
11463
11552
|
|
|
11464
11553
|
// src/components/Tabs/Tabs.context.tsx
|
|
11465
|
-
import { createContext as
|
|
11466
|
-
var TabsContext =
|
|
11554
|
+
import { createContext as createContext12, useContext as useContext20 } from "react";
|
|
11555
|
+
var TabsContext = createContext12({
|
|
11467
11556
|
activeTab: 0,
|
|
11468
11557
|
tabsId: "",
|
|
11469
11558
|
handleTabChange: () => null,
|
|
@@ -11473,7 +11562,7 @@ var TabsContext = createContext11({
|
|
|
11473
11562
|
setHasTabFocus: () => null,
|
|
11474
11563
|
tabContentDirection: "row"
|
|
11475
11564
|
});
|
|
11476
|
-
var useTabsContext = () =>
|
|
11565
|
+
var useTabsContext = () => useContext20(TabsContext);
|
|
11477
11566
|
|
|
11478
11567
|
// src/components/Tabs/Tabs.module.css
|
|
11479
11568
|
var Tabs_default = {
|
|
@@ -11512,7 +11601,7 @@ var Tabs = forwardRef101((props, ref) => {
|
|
|
11512
11601
|
setActiveTab(index);
|
|
11513
11602
|
onChange && onChange(index);
|
|
11514
11603
|
};
|
|
11515
|
-
|
|
11604
|
+
useEffect31(() => {
|
|
11516
11605
|
if (activeTab !== void 0 && activeTab !== thisActiveTab) {
|
|
11517
11606
|
setActiveTab(activeTab);
|
|
11518
11607
|
}
|
|
@@ -11557,18 +11646,18 @@ Tabs.displayName = "Tabs";
|
|
|
11557
11646
|
import {
|
|
11558
11647
|
forwardRef as forwardRef102,
|
|
11559
11648
|
useCallback as useCallback7,
|
|
11560
|
-
useEffect as
|
|
11649
|
+
useEffect as useEffect32,
|
|
11561
11650
|
useRef as useRef36
|
|
11562
11651
|
} from "react";
|
|
11563
11652
|
|
|
11564
11653
|
// src/components/Tabs/TabWidthContext.tsx
|
|
11565
11654
|
import {
|
|
11566
|
-
createContext as
|
|
11567
|
-
useContext as
|
|
11655
|
+
createContext as createContext13,
|
|
11656
|
+
useContext as useContext21,
|
|
11568
11657
|
useLayoutEffect as useLayoutEffect3
|
|
11569
11658
|
} from "react";
|
|
11570
11659
|
import { jsx as jsx297 } from "react/jsx-runtime";
|
|
11571
|
-
var TabContext =
|
|
11660
|
+
var TabContext = createContext13(null);
|
|
11572
11661
|
function TabWidthContextProvider({
|
|
11573
11662
|
children,
|
|
11574
11663
|
onChangeWidths
|
|
@@ -11597,7 +11686,7 @@ function TabWidthContextProvider({
|
|
|
11597
11686
|
);
|
|
11598
11687
|
}
|
|
11599
11688
|
function useSetTabWidth(index, width) {
|
|
11600
|
-
const context =
|
|
11689
|
+
const context = useContext21(TabContext);
|
|
11601
11690
|
useLayoutEffect3(() => {
|
|
11602
11691
|
context == null ? void 0 : context.updateWidth(index, width);
|
|
11603
11692
|
return () => context == null ? void 0 : context.removeTab(index);
|
|
@@ -11626,7 +11715,7 @@ var Tab = forwardRef102((props, ref) => {
|
|
|
11626
11715
|
const itemRef = useRef36(null);
|
|
11627
11716
|
const combinedRef = useCombinedRef(ref, itemRef);
|
|
11628
11717
|
const { tabContentDirection } = useTabsContext();
|
|
11629
|
-
|
|
11718
|
+
useEffect32(() => {
|
|
11630
11719
|
var _a;
|
|
11631
11720
|
if (focus) {
|
|
11632
11721
|
(_a = itemRef.current) == null ? void 0 : _a.focus();
|
|
@@ -12130,15 +12219,132 @@ var TextInput = forwardRef107(
|
|
|
12130
12219
|
);
|
|
12131
12220
|
TextInput.displayName = "TextInput";
|
|
12132
12221
|
|
|
12222
|
+
// src/components/Toggle/Toggle.tsx
|
|
12223
|
+
import {
|
|
12224
|
+
forwardRef as forwardRef108,
|
|
12225
|
+
useId as useId27
|
|
12226
|
+
} from "react";
|
|
12227
|
+
|
|
12228
|
+
// src/components/Toggle/Toggle.module.css
|
|
12229
|
+
var Toggle_default = {
|
|
12230
|
+
label: "Toggle_label",
|
|
12231
|
+
track: "Toggle_track",
|
|
12232
|
+
thumb: "Toggle_thumb",
|
|
12233
|
+
checkmark: "Toggle_checkmark",
|
|
12234
|
+
"labeltext--readonly": "Toggle_labeltext--readonly",
|
|
12235
|
+
"icon--read-only": "Toggle_icon--read-only",
|
|
12236
|
+
medium: "Toggle_medium",
|
|
12237
|
+
large: "Toggle_large",
|
|
12238
|
+
"label--is-loading": "Toggle_label--is-loading",
|
|
12239
|
+
"label--disabled": "Toggle_label--disabled",
|
|
12240
|
+
"label--read-only": "Toggle_label--read-only"
|
|
12241
|
+
};
|
|
12242
|
+
|
|
12243
|
+
// src/components/Toggle/Toggle.tsx
|
|
12244
|
+
import { jsx as jsx304, jsxs as jsxs79 } from "react/jsx-runtime";
|
|
12245
|
+
var Toggle = forwardRef108(
|
|
12246
|
+
({
|
|
12247
|
+
id,
|
|
12248
|
+
children,
|
|
12249
|
+
size: size2 = "medium",
|
|
12250
|
+
checked: checkedProp,
|
|
12251
|
+
defaultChecked,
|
|
12252
|
+
onChange,
|
|
12253
|
+
disabled,
|
|
12254
|
+
readOnly,
|
|
12255
|
+
isLoading,
|
|
12256
|
+
className,
|
|
12257
|
+
htmlProps = {},
|
|
12258
|
+
...rest
|
|
12259
|
+
}, ref) => {
|
|
12260
|
+
const generatedId = useId27();
|
|
12261
|
+
const uniqueId = id != null ? id : `${generatedId}-toggle`;
|
|
12262
|
+
const iconSize = size2 === "large" ? "medium" : "small";
|
|
12263
|
+
const [checked, setChecked] = useControllableState({
|
|
12264
|
+
value: checkedProp,
|
|
12265
|
+
defaultValue: defaultChecked != null ? defaultChecked : false,
|
|
12266
|
+
onChange
|
|
12267
|
+
});
|
|
12268
|
+
return /* @__PURE__ */ jsxs79(
|
|
12269
|
+
"label",
|
|
12270
|
+
{
|
|
12271
|
+
htmlFor: uniqueId,
|
|
12272
|
+
className: cn(
|
|
12273
|
+
Toggle_default.label,
|
|
12274
|
+
Toggle_default[size2],
|
|
12275
|
+
isLoading && Toggle_default["label--is-loading"],
|
|
12276
|
+
disabled && Toggle_default["label--disabled"],
|
|
12277
|
+
readOnly && Toggle_default["label--read-only"]
|
|
12278
|
+
),
|
|
12279
|
+
children: [
|
|
12280
|
+
/* @__PURE__ */ jsx304(
|
|
12281
|
+
"input",
|
|
12282
|
+
{
|
|
12283
|
+
...getBaseHTMLProps(
|
|
12284
|
+
uniqueId,
|
|
12285
|
+
cn(
|
|
12286
|
+
className,
|
|
12287
|
+
focus_default["focusable-sibling"],
|
|
12288
|
+
utilStyles_default["hide-input"]
|
|
12289
|
+
),
|
|
12290
|
+
htmlProps,
|
|
12291
|
+
rest
|
|
12292
|
+
),
|
|
12293
|
+
ref,
|
|
12294
|
+
type: "checkbox",
|
|
12295
|
+
checked,
|
|
12296
|
+
onChange: (e) => setChecked(e.target.checked),
|
|
12297
|
+
disabled,
|
|
12298
|
+
"aria-disabled": isLoading,
|
|
12299
|
+
"aria-readonly": readOnly,
|
|
12300
|
+
onKeyDown: readOnlyKeyDownHandler(
|
|
12301
|
+
"selectionControl",
|
|
12302
|
+
readOnly || isLoading,
|
|
12303
|
+
htmlProps.onKeyDown
|
|
12304
|
+
),
|
|
12305
|
+
onClick: readOnlyClickHandler(
|
|
12306
|
+
readOnly || isLoading,
|
|
12307
|
+
htmlProps.onClick
|
|
12308
|
+
)
|
|
12309
|
+
}
|
|
12310
|
+
),
|
|
12311
|
+
/* @__PURE__ */ jsx304("span", { className: cn(Toggle_default.track, focus_default["focus-styled-sibling"]), children: /* @__PURE__ */ jsx304("span", { className: Toggle_default.thumb, children: isLoading ? /* @__PURE__ */ jsx304(Spinner, { size: `var(--dds-icon-size-${size2})` }) : /* @__PURE__ */ jsx304(
|
|
12312
|
+
Icon,
|
|
12313
|
+
{
|
|
12314
|
+
className: Toggle_default.checkmark,
|
|
12315
|
+
icon: CheckIcon,
|
|
12316
|
+
iconSize
|
|
12317
|
+
}
|
|
12318
|
+
) }) }),
|
|
12319
|
+
/* @__PURE__ */ jsxs79("span", { className: cn(readOnly && Toggle_default["labeltext--readonly"]), children: [
|
|
12320
|
+
readOnly && /* @__PURE__ */ jsx304(
|
|
12321
|
+
Icon,
|
|
12322
|
+
{
|
|
12323
|
+
icon: LockIcon,
|
|
12324
|
+
iconSize: "small",
|
|
12325
|
+
className: Toggle_default["icon--read-only"]
|
|
12326
|
+
}
|
|
12327
|
+
),
|
|
12328
|
+
children,
|
|
12329
|
+
" ",
|
|
12330
|
+
isLoading && /* @__PURE__ */ jsx304(VisuallyHidden, { as: "span", children: "Innlastning p\xE5g\xE5r" })
|
|
12331
|
+
] })
|
|
12332
|
+
]
|
|
12333
|
+
}
|
|
12334
|
+
);
|
|
12335
|
+
}
|
|
12336
|
+
);
|
|
12337
|
+
Toggle.displayName = "Toggle";
|
|
12338
|
+
|
|
12133
12339
|
// src/components/ToggleBar/ToggleBar.tsx
|
|
12134
|
-
import { useId as
|
|
12340
|
+
import { useId as useId28, useState as useState32 } from "react";
|
|
12135
12341
|
|
|
12136
12342
|
// src/components/ToggleBar/ToggleBar.context.tsx
|
|
12137
|
-
import { createContext as
|
|
12138
|
-
var ToggleBarContext =
|
|
12343
|
+
import { createContext as createContext14, useContext as useContext22 } from "react";
|
|
12344
|
+
var ToggleBarContext = createContext14({
|
|
12139
12345
|
size: "medium"
|
|
12140
12346
|
});
|
|
12141
|
-
var useToggleBarContext = () =>
|
|
12347
|
+
var useToggleBarContext = () => useContext22(ToggleBarContext);
|
|
12142
12348
|
|
|
12143
12349
|
// src/components/ToggleBar/ToggleBar.module.css
|
|
12144
12350
|
var ToggleBar_default = {
|
|
@@ -12157,7 +12363,7 @@ var ToggleBar_default = {
|
|
|
12157
12363
|
};
|
|
12158
12364
|
|
|
12159
12365
|
// src/components/ToggleBar/ToggleBar.tsx
|
|
12160
|
-
import { jsx as
|
|
12366
|
+
import { jsx as jsx305, jsxs as jsxs80 } from "react/jsx-runtime";
|
|
12161
12367
|
var ToggleBar = (props) => {
|
|
12162
12368
|
const {
|
|
12163
12369
|
children,
|
|
@@ -12172,7 +12378,7 @@ var ToggleBar = (props) => {
|
|
|
12172
12378
|
id,
|
|
12173
12379
|
...rest
|
|
12174
12380
|
} = props;
|
|
12175
|
-
const generatedId =
|
|
12381
|
+
const generatedId = useId28();
|
|
12176
12382
|
const uniqueId = id != null ? id : `${generatedId}-ToggleBar`;
|
|
12177
12383
|
const [groupValue, setGroupValue] = useState32(value);
|
|
12178
12384
|
const handleChange = combineHandlers(
|
|
@@ -12180,7 +12386,7 @@ var ToggleBar = (props) => {
|
|
|
12180
12386
|
(e) => onChange && onChange(e, e.target.value)
|
|
12181
12387
|
);
|
|
12182
12388
|
const labelId = label && `${uniqueId}-label`;
|
|
12183
|
-
return /* @__PURE__ */
|
|
12389
|
+
return /* @__PURE__ */ jsx305(
|
|
12184
12390
|
ToggleBarContext.Provider,
|
|
12185
12391
|
{
|
|
12186
12392
|
value: {
|
|
@@ -12189,7 +12395,7 @@ var ToggleBar = (props) => {
|
|
|
12189
12395
|
name,
|
|
12190
12396
|
value: groupValue
|
|
12191
12397
|
},
|
|
12192
|
-
children: /* @__PURE__ */
|
|
12398
|
+
children: /* @__PURE__ */ jsxs80(
|
|
12193
12399
|
"div",
|
|
12194
12400
|
{
|
|
12195
12401
|
...getBaseHTMLProps(
|
|
@@ -12202,8 +12408,8 @@ var ToggleBar = (props) => {
|
|
|
12202
12408
|
role: "radiogroup",
|
|
12203
12409
|
"aria-labelledby": labelId != null ? labelId : htmlProps == null ? void 0 : htmlProps["aria-labelledby"],
|
|
12204
12410
|
children: [
|
|
12205
|
-
label && /* @__PURE__ */
|
|
12206
|
-
/* @__PURE__ */
|
|
12411
|
+
label && /* @__PURE__ */ jsx305(Typography, { id: labelId, as: "span", typographyType: "labelMedium", children: label }),
|
|
12412
|
+
/* @__PURE__ */ jsx305("div", { className: ToggleBar_default.bar, children })
|
|
12207
12413
|
]
|
|
12208
12414
|
}
|
|
12209
12415
|
)
|
|
@@ -12214,10 +12420,10 @@ ToggleBar.displayName = "ToggleBar";
|
|
|
12214
12420
|
|
|
12215
12421
|
// src/components/ToggleBar/ToggleRadio.tsx
|
|
12216
12422
|
import {
|
|
12217
|
-
forwardRef as
|
|
12218
|
-
useId as
|
|
12423
|
+
forwardRef as forwardRef109,
|
|
12424
|
+
useId as useId29
|
|
12219
12425
|
} from "react";
|
|
12220
|
-
import { jsx as
|
|
12426
|
+
import { jsx as jsx306, jsxs as jsxs81 } from "react/jsx-runtime";
|
|
12221
12427
|
var typographyTypes4 = {
|
|
12222
12428
|
large: "bodyLarge",
|
|
12223
12429
|
medium: "bodyMedium",
|
|
@@ -12234,7 +12440,7 @@ var calculateChecked = (value, group, checked) => {
|
|
|
12234
12440
|
}
|
|
12235
12441
|
return !!value;
|
|
12236
12442
|
};
|
|
12237
|
-
var ToggleRadio =
|
|
12443
|
+
var ToggleRadio = forwardRef109(
|
|
12238
12444
|
(props, ref) => {
|
|
12239
12445
|
const {
|
|
12240
12446
|
value,
|
|
@@ -12250,7 +12456,7 @@ var ToggleRadio = forwardRef108(
|
|
|
12250
12456
|
id,
|
|
12251
12457
|
...rest
|
|
12252
12458
|
} = props;
|
|
12253
|
-
const generatedId =
|
|
12459
|
+
const generatedId = useId29();
|
|
12254
12460
|
const uniqueId = id != null ? id : `${generatedId}-ToggleRadio`;
|
|
12255
12461
|
const group = useToggleBarContext();
|
|
12256
12462
|
const handleChange = (event) => {
|
|
@@ -12258,8 +12464,8 @@ var ToggleRadio = forwardRef108(
|
|
|
12258
12464
|
(group == null ? void 0 : group.onChange) && group.onChange(event);
|
|
12259
12465
|
};
|
|
12260
12466
|
const contentTypeCn = label ? "with-text" : "just-icon";
|
|
12261
|
-
return /* @__PURE__ */
|
|
12262
|
-
/* @__PURE__ */
|
|
12467
|
+
return /* @__PURE__ */ jsxs81("label", { htmlFor: uniqueId, className: ToggleBar_default.label, children: [
|
|
12468
|
+
/* @__PURE__ */ jsx306(
|
|
12263
12469
|
"input",
|
|
12264
12470
|
{
|
|
12265
12471
|
...getBaseHTMLProps(
|
|
@@ -12282,7 +12488,7 @@ var ToggleRadio = forwardRef108(
|
|
|
12282
12488
|
"aria-labelledby": ariaLabelledBy
|
|
12283
12489
|
}
|
|
12284
12490
|
),
|
|
12285
|
-
/* @__PURE__ */
|
|
12491
|
+
/* @__PURE__ */ jsxs81(
|
|
12286
12492
|
Typography,
|
|
12287
12493
|
{
|
|
12288
12494
|
as: "span",
|
|
@@ -12293,8 +12499,8 @@ var ToggleRadio = forwardRef108(
|
|
|
12293
12499
|
focus_default["focus-styled-sibling"]
|
|
12294
12500
|
),
|
|
12295
12501
|
children: [
|
|
12296
|
-
icon && /* @__PURE__ */
|
|
12297
|
-
label && /* @__PURE__ */
|
|
12502
|
+
icon && /* @__PURE__ */ jsx306(Icon, { icon, iconSize: "inherit" }),
|
|
12503
|
+
label && /* @__PURE__ */ jsx306("span", { children: label })
|
|
12298
12504
|
]
|
|
12299
12505
|
}
|
|
12300
12506
|
)
|
|
@@ -12304,7 +12510,7 @@ var ToggleRadio = forwardRef108(
|
|
|
12304
12510
|
ToggleRadio.displayName = "ToggleRadio";
|
|
12305
12511
|
|
|
12306
12512
|
// src/components/ToggleButton/ToggleButton.tsx
|
|
12307
|
-
import { forwardRef as
|
|
12513
|
+
import { forwardRef as forwardRef110, useId as useId30 } from "react";
|
|
12308
12514
|
|
|
12309
12515
|
// src/components/ToggleButton/ToggleButton.module.css
|
|
12310
12516
|
var ToggleButton_default = {
|
|
@@ -12314,18 +12520,20 @@ var ToggleButton_default = {
|
|
|
12314
12520
|
"group--column": "ToggleButton_group--column",
|
|
12315
12521
|
container: "ToggleButton_container",
|
|
12316
12522
|
content: "ToggleButton_content",
|
|
12523
|
+
small: "ToggleButton_small",
|
|
12524
|
+
xsmall: "ToggleButton_xsmall",
|
|
12317
12525
|
"content--with-icon": "ToggleButton_content--with-icon"
|
|
12318
12526
|
};
|
|
12319
12527
|
|
|
12320
12528
|
// src/components/ToggleButton/ToggleButton.tsx
|
|
12321
|
-
import { jsx as
|
|
12322
|
-
var ToggleButton =
|
|
12323
|
-
({ id, label, icon, className, htmlProps, ...rest }, ref) => {
|
|
12324
|
-
const generatedId =
|
|
12529
|
+
import { jsx as jsx307, jsxs as jsxs82 } from "react/jsx-runtime";
|
|
12530
|
+
var ToggleButton = forwardRef110(
|
|
12531
|
+
({ id, label, icon, size: size2 = "small", className, htmlProps, ...rest }, ref) => {
|
|
12532
|
+
const generatedId = useId30();
|
|
12325
12533
|
const uniqueId = id != null ? id : `${generatedId}-toggleButton`;
|
|
12326
12534
|
const hasIcon = !!icon;
|
|
12327
|
-
return /* @__PURE__ */
|
|
12328
|
-
/* @__PURE__ */
|
|
12535
|
+
return /* @__PURE__ */ jsxs82("label", { htmlFor: uniqueId, className: ToggleButton_default.container, children: [
|
|
12536
|
+
/* @__PURE__ */ jsx307(
|
|
12329
12537
|
"input",
|
|
12330
12538
|
{
|
|
12331
12539
|
...getBaseHTMLProps(
|
|
@@ -12342,17 +12550,18 @@ var ToggleButton = forwardRef109(
|
|
|
12342
12550
|
type: "checkbox"
|
|
12343
12551
|
}
|
|
12344
12552
|
),
|
|
12345
|
-
/* @__PURE__ */
|
|
12553
|
+
/* @__PURE__ */ jsxs82(
|
|
12346
12554
|
"span",
|
|
12347
12555
|
{
|
|
12348
12556
|
className: cn(
|
|
12349
12557
|
ToggleButton_default.content,
|
|
12558
|
+
ToggleButton_default[size2],
|
|
12350
12559
|
hasIcon && ToggleButton_default["content--with-icon"],
|
|
12351
|
-
typographyStyles_default[
|
|
12560
|
+
typographyStyles_default[`body-${size2}`],
|
|
12352
12561
|
focus_default["focus-styled-sibling"]
|
|
12353
12562
|
),
|
|
12354
12563
|
children: [
|
|
12355
|
-
hasIcon && /* @__PURE__ */
|
|
12564
|
+
hasIcon && /* @__PURE__ */ jsx307(Icon, { icon, iconSize: "inherit" }),
|
|
12356
12565
|
" ",
|
|
12357
12566
|
label
|
|
12358
12567
|
]
|
|
@@ -12364,8 +12573,8 @@ var ToggleButton = forwardRef109(
|
|
|
12364
12573
|
ToggleButton.displayName = "ToggleButton";
|
|
12365
12574
|
|
|
12366
12575
|
// src/components/ToggleButton/ToggleButtonGroup.tsx
|
|
12367
|
-
import { useId as
|
|
12368
|
-
import { jsx as
|
|
12576
|
+
import { useId as useId31 } from "react";
|
|
12577
|
+
import { jsx as jsx308, jsxs as jsxs83 } from "react/jsx-runtime";
|
|
12369
12578
|
var ToggleButtonGroup = (props) => {
|
|
12370
12579
|
const {
|
|
12371
12580
|
children,
|
|
@@ -12377,9 +12586,9 @@ var ToggleButtonGroup = (props) => {
|
|
|
12377
12586
|
htmlProps,
|
|
12378
12587
|
...rest
|
|
12379
12588
|
} = props;
|
|
12380
|
-
const generatedId =
|
|
12589
|
+
const generatedId = useId31();
|
|
12381
12590
|
const uniqueLabelId = labelId != null ? labelId : `${generatedId}-ToggleButtonGroupLabel`;
|
|
12382
|
-
return /* @__PURE__ */
|
|
12591
|
+
return /* @__PURE__ */ jsxs83(
|
|
12383
12592
|
"div",
|
|
12384
12593
|
{
|
|
12385
12594
|
...getBaseHTMLProps(
|
|
@@ -12391,8 +12600,8 @@ var ToggleButtonGroup = (props) => {
|
|
|
12391
12600
|
role: "group",
|
|
12392
12601
|
"aria-labelledby": label ? uniqueLabelId : void 0,
|
|
12393
12602
|
children: [
|
|
12394
|
-
!!label && /* @__PURE__ */
|
|
12395
|
-
/* @__PURE__ */
|
|
12603
|
+
!!label && /* @__PURE__ */ jsx308(Typography, { as: "span", typographyType: "labelMedium", id: uniqueLabelId, children: label }),
|
|
12604
|
+
/* @__PURE__ */ jsx308("div", { className: cn(ToggleButton_default.group, ToggleButton_default[`group--${direction}`]), children })
|
|
12396
12605
|
]
|
|
12397
12606
|
}
|
|
12398
12607
|
);
|
|
@@ -12669,6 +12878,7 @@ export {
|
|
|
12669
12878
|
TimePicker,
|
|
12670
12879
|
TingrettIcon,
|
|
12671
12880
|
TipIcon,
|
|
12881
|
+
Toggle,
|
|
12672
12882
|
ToggleBar,
|
|
12673
12883
|
ToggleButton,
|
|
12674
12884
|
ToggleButtonGroup,
|