@helsenorge/designsystem-react 12.8.0 → 13.0.0-beta.2
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/AnchorLink.js +4 -4
- package/AnchorLink.js.map +1 -1
- package/Button.js +4 -4
- package/Button.js.map +1 -1
- package/CHANGELOG.md +22 -57
- package/Checkbox.js +4 -5
- package/Checkbox.js.map +1 -1
- package/Close.js +3 -3
- package/Close.js.map +1 -1
- package/Drawer.js +6 -261
- package/Drawer.js.map +1 -1
- package/Expander.js +2 -2
- package/Expander.js.map +1 -1
- package/FormFieldTag.js +1 -2
- package/FormFieldTag.js.map +1 -1
- package/FormGroup.js +16 -16
- package/FormGroup.js.map +1 -1
- package/HelpDetails.js +1 -1
- package/HelpTriggerIcon.js +5 -3
- package/HelpTriggerIcon.js.map +1 -1
- package/HelpTriggerStandalone.js +3 -3
- package/HelpTriggerStandalone.js.map +1 -1
- package/Icon.js +2 -3
- package/Icon.js.map +1 -1
- package/Illustration.js +2 -3
- package/Illustration.js.map +1 -1
- package/InfoTeaser.js +2 -3
- package/InfoTeaser.js.map +1 -1
- package/Input.js +9 -10
- package/Input.js.map +1 -1
- package/Label.js +3 -3
- package/Label.js.map +1 -1
- package/LinkList.js +4 -5
- package/LinkList.js.map +1 -1
- package/ListEditMode.js +3 -3
- package/ListEditMode.js.map +1 -1
- package/RadioButton.js +4 -5
- package/RadioButton.js.map +1 -1
- package/Select.js +8 -10
- package/Select.js.map +1 -1
- package/Slider.js +8 -8
- package/Slider.js.map +1 -1
- package/TabList.js +2 -2
- package/TabList.js.map +1 -1
- package/Textarea.js +2 -3
- package/Textarea.js.map +1 -1
- package/__mocks__/usePseudoClasses.js +1 -1
- package/__mocks__/usePseudoClasses.js.map +1 -1
- package/components/ArticleTeaser/styles.module.scss +5 -3
- package/components/Chip/index.js +3 -3
- package/components/Chip/index.js.map +1 -1
- package/components/Drawer/styles.module.scss +26 -45
- package/components/Drawer/styles.module.scss.d.ts +0 -5
- package/components/Dropdown/Dropdown.d.ts +21 -19
- package/components/Dropdown/Dropdown.test.d.ts +0 -1
- package/components/Dropdown/index.js +78 -142
- package/components/Dropdown/index.js.map +1 -1
- package/components/Dropdown/styles.module.scss +136 -90
- package/components/Dropdown/styles.module.scss.d.ts +9 -8
- package/components/ExpanderHierarchy/index.js +3 -3
- package/components/ExpanderHierarchy/index.js.map +1 -1
- package/components/ExpanderList/index.js +4 -5
- package/components/ExpanderList/index.js.map +1 -1
- package/components/FormFieldTag/FormFieldTag.d.ts +0 -2
- package/components/FormGroup/FormGroup.d.ts +2 -1
- package/components/HelpExpanderStandalone/index.js +3 -3
- package/components/HelpExpanderStandalone/index.js.map +1 -1
- package/components/HelpTooltip/index.js +2 -3
- package/components/HelpTooltip/index.js.map +1 -1
- package/components/HelpTriggerInline/index.js +3 -3
- package/components/HelpTriggerInline/index.js.map +1 -1
- package/components/Icons/EmoticonAnnoyed.js +11 -8
- package/components/Icons/EmoticonAnnoyed.js.map +1 -1
- package/components/Icons/EmoticonDelighted.js +4 -8
- package/components/Icons/EmoticonDelighted.js.map +1 -1
- package/components/Icons/EmoticonDisappointed.js +4 -8
- package/components/Icons/EmoticonDisappointed.js.map +1 -1
- package/components/Icons/EmoticonHappy.js +4 -8
- package/components/Icons/EmoticonHappy.js.map +1 -1
- package/components/Icons/EmoticonMeh.js +4 -8
- package/components/Icons/EmoticonMeh.js.map +1 -1
- package/components/Icons/PatientAndPerson.js +2 -2
- package/components/Icons/PatientAndPerson.js.map +1 -1
- package/components/Icons/PersonAndPatient.js +2 -2
- package/components/Icons/PersonAndPatient.js.map +1 -1
- package/components/Input/styles.module.scss +21 -22
- package/components/Input/styles.module.scss.d.ts +1 -1
- package/components/Label/Label.d.ts +2 -1
- package/components/LinkList/styles.module.scss +61 -47
- package/components/LinkList/styles.module.scss.d.ts +0 -1
- package/components/ListEditMode/styles.module.scss +0 -1
- package/components/Logo/index.js +6 -6
- package/components/Logo/index.js.map +1 -1
- package/components/NotificationPanel/index.js +6 -9
- package/components/NotificationPanel/index.js.map +1 -1
- package/components/NotificationPanel/styles.module.scss +5 -10
- package/components/PopMenu/index.js +2 -2
- package/components/PopMenu/index.js.map +1 -1
- package/components/PromoPanel/index.js +3 -3
- package/components/PromoPanel/index.js.map +1 -1
- package/components/Select/styles.module.scss +2 -2
- package/components/ServiceMessage/index.js +7 -8
- package/components/ServiceMessage/index.js.map +1 -1
- package/components/StickyNote/index.js +6 -8
- package/components/StickyNote/index.js.map +1 -1
- package/components/Textarea/styles.module.scss.d.ts +0 -1
- package/components/Tile/index.js +3 -3
- package/components/Tile/index.js.map +1 -1
- package/components/Toggle/index.js +14 -12
- package/components/Toggle/index.js.map +1 -1
- package/components/Validation/index.js +2 -3
- package/components/Validation/index.js.map +1 -1
- package/constants.d.ts +0 -1
- package/constants.js +0 -1
- package/constants.js.map +1 -1
- package/designsystem-react.css +1 -11
- package/floating-ui.react.js +38 -18
- package/floating-ui.react.js.map +1 -1
- package/hooks/useIdWithFallback.d.ts +6 -0
- package/hooks/useIdWithFallback.js +9 -0
- package/hooks/useIdWithFallback.js.map +1 -0
- package/index.d.ts +0 -2
- package/index.js +0 -4
- package/index.js.map +1 -1
- package/package.json +4 -4
- package/scss/_input.scss +0 -29
- package/scss/supernova/styles/colors.css +1 -11
- package/scss/supernova/styles/typography.css +51 -52
- package/AsChildSlot.js +0 -74
- package/AsChildSlot.js.map +0 -1
- package/HN.Designsystem.Dropdown.nb-NO.js +0 -13
- package/HN.Designsystem.Dropdown.nb-NO.js.map +0 -1
- package/PanelOld.js +0 -325
- package/PanelOld.js.map +0 -1
- package/SingleSelectItem.js +0 -96
- package/SingleSelectItem.js.map +0 -1
- package/__mocks__/useHover.d.ts +0 -1
- package/__mocks__/useHover.js +0 -6
- package/__mocks__/useHover.js.map +0 -1
- package/clamp.js +0 -11
- package/clamp.js.map +0 -1
- package/components/AsChildSlot/AsChildSlot.d.ts +0 -23
- package/components/AsChildSlot/AsChildSlot.test.d.ts +0 -1
- package/components/AsChildSlot/index.d.ts +0 -3
- package/components/AsChildSlot/index.js +0 -6
- package/components/AsChildSlot/index.js.map +0 -1
- package/components/AsChildSlot/styles.module.scss +0 -13
- package/components/AsChildSlot/styles.module.scss.d.ts +0 -9
- package/components/Dropdown/SingleSelect/SingleSelect.d.ts +0 -18
- package/components/Dropdown/SingleSelect/SingleSelect.test.d.ts +0 -1
- package/components/Dropdown/SingleSelect/SingleSelectItem.d.ts +0 -21
- package/components/Dropdown/SingleSelect/index.d.ts +0 -3
- package/components/Dropdown/SingleSelect/index.js +0 -6
- package/components/Dropdown/SingleSelect/index.js.map +0 -1
- package/components/Dropdown/SingleSelect/styles.module.scss +0 -54
- package/components/Dropdown/SingleSelect/styles.module.scss.d.ts +0 -14
- package/components/DropdownOld/DropdownOld.d.ts +0 -42
- package/components/DropdownOld/index.d.ts +0 -3
- package/components/DropdownOld/index.js +0 -194
- package/components/DropdownOld/index.js.map +0 -1
- package/components/DropdownOld/resourceHelper.d.ts +0 -3
- package/components/DropdownOld/styles.module.scss +0 -230
- package/components/DropdownOld/styles.module.scss.d.ts +0 -25
- package/components/PanelListOld/PanelListOld.d.ts +0 -12
- package/components/PanelListOld/PanelListOld.test.d.ts +0 -1
- package/components/PanelListOld/index.d.ts +0 -3
- package/components/PanelListOld/index.js +0 -20
- package/components/PanelListOld/index.js.map +0 -1
- package/components/PanelListOld/styles.module.scss +0 -14
- package/components/PanelListOld/styles.module.scss.d.ts +0 -9
- package/components/PanelOld/PanelOld.d.ts +0 -89
- package/components/PanelOld/PanelOld.test.d.ts +0 -1
- package/components/PanelOld/index.d.ts +0 -3
- package/components/PanelOld/index.js +0 -9
- package/components/PanelOld/index.js.map +0 -1
- package/components/PanelOld/styles.module.scss +0 -433
- package/components/PanelOld/styles.module.scss.d.ts +0 -61
- package/hooks/useHover.d.ts +0 -10
- package/hooks/useHover.js +0 -9
- package/hooks/useHover.js.map +0 -1
- package/hooks/useUuid.d.ts +0 -6
- package/hooks/useUuid.js +0 -10
- package/hooks/useUuid.js.map +0 -1
- package/use-animate.js +0 -3946
- package/use-animate.js.map +0 -1
- /package/{components/DropdownOld/DropdownOld.test.d.ts → resources/index.d.ts} +0 -0
|
@@ -1,30 +1,27 @@
|
|
|
1
|
-
import { jsx, jsxs
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React__default, { useRef, useId, useEffect } from "react";
|
|
3
|
-
import { u as useFloating, f as autoUpdate, o as offset, s as shift, j as size } from "../../floating-ui.react.js";
|
|
4
3
|
import classNames from "classnames";
|
|
5
|
-
import "../../theme/
|
|
4
|
+
import { theme } from "../../theme/index.js";
|
|
6
5
|
import "../../hooks/useBreakpoint.js";
|
|
7
|
-
import { useHover } from "../../hooks/useHover.js";
|
|
8
6
|
import { useToggle } from "../../hooks/useToggle.js";
|
|
9
7
|
import { useKeyboardEvent } from "../../hooks/useKeyboardEvent.js";
|
|
10
8
|
import { useOutsideEvent } from "../../hooks/useOutsideEvent.js";
|
|
11
|
-
import { LanguageLocales, ZIndex,
|
|
12
|
-
import {
|
|
13
|
-
import { a as SingleSelect, S as SingleSelectItem } from "../../SingleSelectItem.js";
|
|
14
|
-
import { useIsMobileBreakpoint } from "../../hooks/useIsMobileBreakpoint.js";
|
|
15
|
-
import { isComponent } from "../../utils/component.js";
|
|
9
|
+
import { LanguageLocales, ZIndex, KeyboardEventKey, AnalyticsId, IconSize } from "../../constants.js";
|
|
10
|
+
import { usePseudoClasses } from "../../hooks/usePseudoClasses.js";
|
|
16
11
|
import { useLanguage } from "../../utils/language.js";
|
|
17
12
|
import { mergeRefs } from "../../utils/refs.js";
|
|
18
13
|
import { B as Button } from "../../Button.js";
|
|
19
|
-
import { C as Checkbox } from "../../Checkbox.js";
|
|
20
14
|
import { I as Icon } from "../../Icon.js";
|
|
21
|
-
import ChevronDown from "../Icons/ChevronDown.js";
|
|
22
|
-
import ChevronUp from "../Icons/ChevronUp.js";
|
|
23
15
|
import PlusSmall from "../Icons/PlusSmall.js";
|
|
24
|
-
import { L as Label } from "../../Label.js";
|
|
25
|
-
import { L as LazyIcon } from "../../LazyIcon.js";
|
|
26
16
|
import styles from "./styles.module.scss";
|
|
27
|
-
|
|
17
|
+
const closeText$1 = "Close";
|
|
18
|
+
const enGB = {
|
|
19
|
+
closeText: closeText$1
|
|
20
|
+
};
|
|
21
|
+
const closeText = "Lukk";
|
|
22
|
+
const nbNO = {
|
|
23
|
+
closeText
|
|
24
|
+
};
|
|
28
25
|
const getResources = (language) => {
|
|
29
26
|
switch (language) {
|
|
30
27
|
case LanguageLocales.ENGLISH:
|
|
@@ -34,82 +31,47 @@ const getResources = (language) => {
|
|
|
34
31
|
return nbNO;
|
|
35
32
|
}
|
|
36
33
|
};
|
|
37
|
-
|
|
34
|
+
var DropdownOnColor = /* @__PURE__ */ ((DropdownOnColor2) => {
|
|
35
|
+
DropdownOnColor2["onwhite"] = "onwhite";
|
|
36
|
+
DropdownOnColor2["ongrey"] = "ongrey";
|
|
37
|
+
DropdownOnColor2["onblueberry"] = "onblueberry";
|
|
38
|
+
DropdownOnColor2["oncherry"] = "oncherry";
|
|
39
|
+
return DropdownOnColor2;
|
|
40
|
+
})(DropdownOnColor || {});
|
|
41
|
+
const Dropdown = (props) => {
|
|
38
42
|
const {
|
|
39
|
-
|
|
43
|
+
label,
|
|
44
|
+
placeholder,
|
|
40
45
|
noCloseButton = false,
|
|
41
46
|
onToggle,
|
|
42
47
|
dropdownMinWidth,
|
|
43
|
-
triggerMinWidth,
|
|
44
48
|
open = false,
|
|
45
49
|
children,
|
|
50
|
+
onColor = "onwhite",
|
|
51
|
+
transparent = false,
|
|
52
|
+
fluid = false,
|
|
46
53
|
testId,
|
|
47
54
|
disabled,
|
|
48
55
|
zIndex = ZIndex.PopOver,
|
|
49
|
-
resources
|
|
50
|
-
svgIcon,
|
|
51
|
-
variant = "fill"
|
|
56
|
+
resources
|
|
52
57
|
} = props;
|
|
53
58
|
const dropdownRef = useRef(null);
|
|
54
59
|
const optionsRef = useRef(null);
|
|
55
|
-
const
|
|
56
|
-
const { hoverRef: buttonRef, isHovered } = useHover();
|
|
60
|
+
const { refObject: buttonRef, isHovered } = usePseudoClasses();
|
|
57
61
|
const openedByKeyboard = useRef(false);
|
|
58
62
|
const { value: isOpen, toggleValue: toggleIsOpen } = useToggle(!disabled && open, onToggle);
|
|
59
|
-
const
|
|
60
|
-
const
|
|
61
|
-
const
|
|
62
|
-
const maxWidth = isMobile ? 384 : 400;
|
|
63
|
-
const toggleTextId = useId();
|
|
63
|
+
const inputRefList = useRef(React__default.Children.map(children, () => React__default.createRef()));
|
|
64
|
+
const labelId = useId();
|
|
65
|
+
const toggleLabelId = useId();
|
|
64
66
|
const optionIdPrefix = useId();
|
|
65
67
|
const contentId = useId();
|
|
66
|
-
const leftIconProps = {
|
|
67
|
-
className: styles["dropdown__left-icon"],
|
|
68
|
-
size: IconSize.XSmall,
|
|
69
|
-
isHovered: !disabled && isHovered
|
|
70
|
-
};
|
|
71
|
-
const isSingleSelect = React__default.Children.toArray(children).every(
|
|
72
|
-
(child) => React__default.isValidElement(child) && isComponent(child, SingleSelectItem)
|
|
73
|
-
);
|
|
74
|
-
const isMultiSelect = React__default.Children.toArray(children).every(
|
|
75
|
-
(child) => React__default.isValidElement(child) && isComponent(child, Checkbox)
|
|
76
|
-
);
|
|
77
68
|
const { language } = useLanguage(LanguageLocales.NORWEGIAN);
|
|
78
69
|
const defaultResources = getResources(language);
|
|
79
70
|
const mergedResources = {
|
|
80
71
|
...defaultResources,
|
|
81
|
-
...resources
|
|
72
|
+
...resources,
|
|
73
|
+
closeText: props.closeText ?? (resources == null ? void 0 : resources.closeText) ?? defaultResources.closeText
|
|
82
74
|
};
|
|
83
|
-
const toggleClasses = classNames(styles.dropdown__toggle, {
|
|
84
|
-
[styles["dropdown__toggle--open"]]: isOpen && !disabled,
|
|
85
|
-
[styles["dropdown__toggle--with-icon"]]: typeof svgIcon !== "undefined",
|
|
86
|
-
[styles["dropdown__toggle--transparent"]]: variant === "transparent",
|
|
87
|
-
[styles["dropdown__toggle--borderless"]]: variant === "borderless"
|
|
88
|
-
});
|
|
89
|
-
const contentClasses = classNames(styles.dropdown__content, isOpen && styles["dropdown__content--open"]);
|
|
90
|
-
const listItemClasses = classNames(styles["dropdown__list-item"], { [styles["dropdown__list-item--single-select"]]: isSingleSelect });
|
|
91
|
-
const { refs, floatingStyles } = useFloating({
|
|
92
|
-
placement: "bottom",
|
|
93
|
-
middleware: [
|
|
94
|
-
offset(8),
|
|
95
|
-
shift({ padding: 8 }),
|
|
96
|
-
size({
|
|
97
|
-
apply({ availableWidth, availableHeight, elements, rects }) {
|
|
98
|
-
const triggerW = rects.reference.width;
|
|
99
|
-
const minProp = typeof dropdownMinWidth !== "undefined" ? clamp(0, maxWidth, dropdownMinWidth) : 0;
|
|
100
|
-
const targetW = Math.max(triggerW, minProp);
|
|
101
|
-
const finalW = Math.min(availableWidth, targetW);
|
|
102
|
-
Object.assign(elements.floating.style, {
|
|
103
|
-
width: `${finalW}px`,
|
|
104
|
-
maxHeight: `${availableHeight}px`,
|
|
105
|
-
overflowY: "auto",
|
|
106
|
-
overflowX: "hidden"
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
})
|
|
110
|
-
],
|
|
111
|
-
whileElementsMounted: autoUpdate
|
|
112
|
-
});
|
|
113
75
|
const handleOpen = (isKeyboard) => {
|
|
114
76
|
openedByKeyboard.current = isKeyboard;
|
|
115
77
|
toggleIsOpen();
|
|
@@ -122,50 +84,41 @@ const DropdownBase = (props) => {
|
|
|
122
84
|
useEffect(() => {
|
|
123
85
|
var _a, _b;
|
|
124
86
|
if (isOpen && openedByKeyboard.current) {
|
|
125
|
-
const firstEnabled = (_a =
|
|
87
|
+
const firstEnabled = (_a = inputRefList.current) == null ? void 0 : _a.find((r) => r.current && !r.current.hasAttribute("disabled"));
|
|
126
88
|
(_b = firstEnabled == null ? void 0 : firstEnabled.current) == null ? void 0 : _b.focus();
|
|
127
89
|
openedByKeyboard.current = false;
|
|
128
90
|
}
|
|
129
91
|
}, [isOpen]);
|
|
130
|
-
const focusByIndex = (nextIndex) => {
|
|
131
|
-
var _a, _b, _c;
|
|
132
|
-
(_c = (_b = (_a = childrenRefList.current) == null ? void 0 : _a[nextIndex]) == null ? void 0 : _b.current) == null ? void 0 : _c.focus();
|
|
133
|
-
};
|
|
134
|
-
const isListNavKey = (key) => key === KeyboardEventKey.ArrowDown || key === KeyboardEventKey.ArrowUp || key === KeyboardEventKey.Home || key === KeyboardEventKey.End;
|
|
135
92
|
const handleKeyboardNavigation = (event) => {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
if (key === KeyboardEventKey.Escape) {
|
|
139
|
-
if (isOpen) {
|
|
140
|
-
event.preventDefault();
|
|
141
|
-
handleClose();
|
|
142
|
-
}
|
|
93
|
+
var _a;
|
|
94
|
+
if (!inputRefList.current) {
|
|
143
95
|
return;
|
|
144
96
|
}
|
|
145
|
-
if (
|
|
146
|
-
if (
|
|
147
|
-
event.preventDefault();
|
|
148
|
-
handleOpen(true);
|
|
149
|
-
}
|
|
97
|
+
if (event.key === KeyboardEventKey.Escape) {
|
|
98
|
+
if (isOpen) handleClose();
|
|
150
99
|
return;
|
|
151
100
|
}
|
|
152
|
-
if (!
|
|
101
|
+
if (!isOpen) {
|
|
102
|
+
handleOpen(true);
|
|
103
|
+
event.preventDefault();
|
|
153
104
|
return;
|
|
154
105
|
}
|
|
155
|
-
const index =
|
|
106
|
+
const index = inputRefList.current.findIndex((x) => x.current === event.target);
|
|
156
107
|
let nextIndex = index;
|
|
157
|
-
if (key === KeyboardEventKey.Home) {
|
|
108
|
+
if (event.key === KeyboardEventKey.Home) {
|
|
158
109
|
nextIndex = 0;
|
|
159
|
-
} else if (key === KeyboardEventKey.End) {
|
|
160
|
-
nextIndex =
|
|
161
|
-
} else if (key === KeyboardEventKey.ArrowDown && index <
|
|
110
|
+
} else if (event.key === KeyboardEventKey.End) {
|
|
111
|
+
nextIndex = inputRefList.current.length - 1;
|
|
112
|
+
} else if (event.key === KeyboardEventKey.ArrowDown && index < inputRefList.current.length - 1) {
|
|
162
113
|
nextIndex = index + 1;
|
|
163
|
-
} else if (key === KeyboardEventKey.ArrowUp && index > 0) {
|
|
114
|
+
} else if (event.key === KeyboardEventKey.ArrowUp && index > 0) {
|
|
164
115
|
nextIndex = index - 1;
|
|
116
|
+
} else if (event.key === KeyboardEventKey.Enter && index !== -1) {
|
|
117
|
+
nextIndex = index;
|
|
165
118
|
}
|
|
166
|
-
if (nextIndex !== -1) {
|
|
119
|
+
if (nextIndex !== -1 && event.key !== KeyboardEventKey.Space) {
|
|
167
120
|
event.preventDefault();
|
|
168
|
-
|
|
121
|
+
(_a = inputRefList.current[nextIndex].current) == null ? void 0 : _a.focus();
|
|
169
122
|
}
|
|
170
123
|
};
|
|
171
124
|
useKeyboardEvent(dropdownRef, handleKeyboardNavigation, [
|
|
@@ -178,54 +131,48 @@ const DropdownBase = (props) => {
|
|
|
178
131
|
KeyboardEventKey.Space
|
|
179
132
|
]);
|
|
180
133
|
useOutsideEvent(dropdownRef, () => isOpen && handleClose());
|
|
134
|
+
const toggleClasses = classNames(
|
|
135
|
+
styles.dropdown__toggle,
|
|
136
|
+
!disabled && {
|
|
137
|
+
[styles["dropdown__toggle--on-white"]]: onColor === "onwhite",
|
|
138
|
+
[styles["dropdown__toggle--on-grey"]]: onColor === "ongrey",
|
|
139
|
+
[styles["dropdown__toggle--on-blueberry"]]: onColor === "onblueberry",
|
|
140
|
+
[styles["dropdown__toggle--on-cherry"]]: onColor === "oncherry",
|
|
141
|
+
[styles["dropdown__toggle--transparent"]]: transparent,
|
|
142
|
+
[styles["dropdown__toggle--fluid"]]: fluid,
|
|
143
|
+
[styles["dropdown__toggle--open"]]: isOpen
|
|
144
|
+
}
|
|
145
|
+
);
|
|
146
|
+
const contentClasses = classNames(styles.dropdown__content, isOpen && styles["dropdown__content--open"]);
|
|
181
147
|
const renderChildren = React__default.Children.map(children, (child, index) => {
|
|
182
|
-
return /* @__PURE__ */ jsx("li", { className:
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
ref: mergeRefs([child.props.ref, childrenRefList.current[index]])
|
|
186
|
-
};
|
|
187
|
-
if (isMultiSelect) {
|
|
188
|
-
const label = child.props.label;
|
|
189
|
-
if (React__default.isValidElement(label) && isComponent(label, Label)) {
|
|
190
|
-
return React__default.cloneElement(child, {
|
|
191
|
-
...baseProps,
|
|
192
|
-
label: React__default.cloneElement(label, {
|
|
193
|
-
labelClassName: classNames((_a = label.props) == null ? void 0 : _a.labelClassName, styles["dropdown__multiselect-item"])
|
|
194
|
-
})
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
return React__default.cloneElement(child, baseProps);
|
|
199
|
-
})() : child });
|
|
148
|
+
return /* @__PURE__ */ jsx("li", { className: styles.dropdown__input, id: `${optionIdPrefix}-${index}`, children: React__default.isValidElement(child) && inputRefList.current && inputRefList.current[index] ? React__default.cloneElement(child, {
|
|
149
|
+
ref: mergeRefs([child.props.ref, inputRefList.current[index]])
|
|
150
|
+
}) : child });
|
|
200
151
|
});
|
|
201
152
|
return /* @__PURE__ */ jsxs("div", { className: styles.dropdown, ref: dropdownRef, children: [
|
|
153
|
+
/* @__PURE__ */ jsx("span", { id: labelId, className: styles.dropdown__label, children: label }),
|
|
202
154
|
/* @__PURE__ */ jsxs(
|
|
203
155
|
"button",
|
|
204
156
|
{
|
|
205
157
|
type: "button",
|
|
206
158
|
onClick: () => handleOpen(false),
|
|
207
159
|
className: toggleClasses,
|
|
208
|
-
ref:
|
|
160
|
+
ref: buttonRef,
|
|
209
161
|
"data-testid": testId,
|
|
210
162
|
"data-analyticsid": AnalyticsId.Dropdown,
|
|
211
163
|
disabled,
|
|
212
|
-
"aria-labelledby":
|
|
164
|
+
"aria-labelledby": toggleLabelId,
|
|
213
165
|
"aria-haspopup": true,
|
|
214
166
|
"aria-controls": contentId,
|
|
215
167
|
"aria-expanded": isOpen,
|
|
216
|
-
style: {
|
|
217
|
-
width: triggerActualMinWidth,
|
|
218
|
-
maxWidth: "100%",
|
|
219
|
-
minWidth: `${triggerMinWidthLimit}px`
|
|
220
|
-
},
|
|
221
168
|
children: [
|
|
222
|
-
|
|
223
|
-
/* @__PURE__ */ jsx("span", { id: toggleTextId, className: styles.dropdown__toggle__text, children: triggerText }),
|
|
169
|
+
/* @__PURE__ */ jsx("span", { id: toggleLabelId, className: styles.dropdown__toggle__label, children: placeholder }),
|
|
224
170
|
/* @__PURE__ */ jsx(
|
|
225
171
|
Icon,
|
|
226
172
|
{
|
|
227
|
-
|
|
228
|
-
|
|
173
|
+
color: disabled ? theme.palette.neutral700 : theme.palette.blueberry600,
|
|
174
|
+
svgIcon: PlusSmall,
|
|
175
|
+
className: styles.dropdown__icon,
|
|
229
176
|
isHovered: !disabled && isHovered,
|
|
230
177
|
size: IconSize.XSmall
|
|
231
178
|
}
|
|
@@ -238,28 +185,17 @@ const DropdownBase = (props) => {
|
|
|
238
185
|
{
|
|
239
186
|
id: contentId,
|
|
240
187
|
className: contentClasses,
|
|
241
|
-
|
|
242
|
-
style: {
|
|
243
|
-
...floatingStyles,
|
|
244
|
-
zIndex
|
|
245
|
-
},
|
|
188
|
+
style: { width: fluid ? "100%" : `auto`, minWidth: dropdownMinWidth ?? "auto", zIndex },
|
|
246
189
|
children: [
|
|
247
|
-
/* @__PURE__ */
|
|
248
|
-
|
|
249
|
-
isMultiSelect && renderChildren
|
|
250
|
-
] }),
|
|
251
|
-
!isSingleSelect && !noCloseButton && /* @__PURE__ */ jsx("div", { className: styles.dropdown__close, children: /* @__PURE__ */ jsx(Button, { onClick: handleClose, children: mergedResources.closeText }) })
|
|
190
|
+
/* @__PURE__ */ jsx("ul", { className: styles.dropdown__options, role: "group", "aria-labelledby": labelId, tabIndex: -1, ref: optionsRef, children: renderChildren }),
|
|
191
|
+
!noCloseButton && /* @__PURE__ */ jsx("div", { className: styles.dropdown__close, children: /* @__PURE__ */ jsx(Button, { onClick: handleClose, children: mergedResources.closeText }) })
|
|
252
192
|
]
|
|
253
|
-
}
|
|
254
|
-
dropdownMinWidth ?? "auto"
|
|
193
|
+
}
|
|
255
194
|
)
|
|
256
195
|
] });
|
|
257
196
|
};
|
|
258
|
-
const Dropdown = DropdownBase;
|
|
259
|
-
Dropdown.SingleSelectItem = SingleSelectItem;
|
|
260
|
-
DropdownBase.displayName = "Dropdown";
|
|
261
197
|
export {
|
|
262
|
-
|
|
198
|
+
DropdownOnColor,
|
|
263
199
|
Dropdown as default
|
|
264
200
|
};
|
|
265
201
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/Dropdown/resourceHelper.ts","../../../src/components/Dropdown/Dropdown.tsx"],"sourcesContent":["import { LanguageLocales } from '../../constants';\nimport enGB from '../../resources/HN.Designsystem.Dropdown.en-GB.json';\nimport nbNO from '../../resources/HN.Designsystem.Dropdown.nb-NO.json';\nimport { HNDesignsystemDropdown } from '../../resources/Resources';\n\nexport const getResources = (language: LanguageLocales): HNDesignsystemDropdown => {\n switch (language) {\n case LanguageLocales.ENGLISH:\n return enGB;\n case LanguageLocales.NORWEGIAN:\n default:\n return nbNO;\n }\n};\n","import React, { useEffect, useRef, useId, ComponentType } from 'react';\n\nimport { autoUpdate, offset, shift, size, useFloating } from '@floating-ui/react';\nimport classNames from 'classnames';\nimport { clamp } from 'motion/react';\n\nimport {\n AnalyticsId,\n IconSize,\n KeyboardEventKey,\n LanguageLocales,\n ZIndex,\n useHover,\n useKeyboardEvent,\n useOutsideEvent,\n useToggle,\n} from '../..';\nimport { getResources } from './resourceHelper';\nimport { SingleSelectItem, SingleSelectItemProps } from './SingleSelect/SingleSelectItem';\nimport { useIsMobileBreakpoint } from '../../hooks/useIsMobileBreakpoint';\nimport { HNDesignsystemDropdown } from '../../resources/Resources';\nimport { isComponent } from '../../utils/component';\nimport { useLanguage } from '../../utils/language';\nimport { mergeRefs } from '../../utils/refs';\nimport Button from '../Button';\nimport Checkbox, { CheckboxProps } from '../Checkbox';\nimport Icon, { SvgIcon } from '../Icon';\nimport ChevronDown from '../Icons/ChevronDown';\nimport ChevronUp from '../Icons/ChevronUp';\nimport { IconName } from '../Icons/IconNames';\nimport PlusSmall from '../Icons/PlusSmall';\nimport Label, { LabelProps } from '../Label';\nimport LazyIcon from '../LazyIcon';\nimport { SingleSelect } from './SingleSelect/SingleSelect';\n\nimport styles from './styles.module.scss';\n\ntype DropdownVariants = 'fill' | 'transparent' | 'borderless';\n\nexport interface DropdownProps {\n /** Text on the trigger button that opens the dropdown */\n triggerText: string;\n /** Sets the dropdown content */\n children: React.ReactNode;\n /** Minimum width for the dropdown in pixels. Does not affect trigger button. */\n dropdownMinWidth?: number;\n /** Minimum width for the trigger in pixels. Does not apply for borderless variant */\n triggerMinWidth?: number;\n /** Disables rendring of the close button in the list */\n noCloseButton?: boolean;\n /** Called when dropdown is open/closed */\n onToggle?: (isOpen: boolean) => void;\n /** Whether the dropdown is open or not */\n open?: boolean;\n /** Makes the dropdown disabled */\n disabled?: boolean;\n /** Sets the data-testid attribute on the dropdown button */\n testId?: string;\n /** Overrides the default z-index of the DropDownContent */\n zIndex?: number;\n /** Resources for component */\n resources?: Partial<HNDesignsystemDropdown>;\n /** Adds an icon to the trigger */\n svgIcon?: SvgIcon | IconName;\n /** Sets the visual variant of the Dropdown */\n variant?: DropdownVariants;\n}\n\nexport const DropdownBase: React.FC<DropdownProps> = props => {\n const {\n triggerText,\n noCloseButton = false,\n onToggle,\n dropdownMinWidth,\n triggerMinWidth,\n open = false,\n children,\n testId,\n disabled,\n zIndex = ZIndex.PopOver,\n resources,\n svgIcon,\n variant = 'fill',\n } = props;\n\n const dropdownRef = useRef<HTMLDivElement>(null);\n const optionsRef = useRef<HTMLUListElement>(null);\n const childrenRefList = useRef(React.Children.map(children, () => React.createRef<HTMLElement>()));\n const { hoverRef: buttonRef, isHovered } = useHover<HTMLButtonElement>();\n const openedByKeyboard = useRef<boolean>(false);\n const { value: isOpen, toggleValue: toggleIsOpen } = useToggle(!disabled && open, onToggle);\n const isMobile = useIsMobileBreakpoint();\n const triggerActualMinWidth = variant !== 'borderless' && typeof triggerMinWidth != 'undefined' ? `${triggerMinWidth}px` : 'auto';\n const triggerMinWidthLimit = isMobile ? 96 : 112;\n const maxWidth = isMobile ? 384 : 400;\n const toggleTextId = useId();\n const optionIdPrefix = useId();\n const contentId = useId();\n const leftIconProps = {\n className: styles['dropdown__left-icon'],\n size: IconSize.XSmall,\n isHovered: !disabled && isHovered,\n };\n\n const isSingleSelect = React.Children.toArray(children).every(\n child => React.isValidElement(child) && isComponent<SingleSelectItemProps>(child, SingleSelectItem)\n );\n const isMultiSelect = React.Children.toArray(children).every(\n child => React.isValidElement(child) && isComponent<CheckboxProps>(child, Checkbox)\n );\n\n const { language } = useLanguage<LanguageLocales>(LanguageLocales.NORWEGIAN);\n const defaultResources = getResources(language);\n const mergedResources: HNDesignsystemDropdown = {\n ...defaultResources,\n ...resources,\n };\n\n const toggleClasses = classNames(styles.dropdown__toggle, {\n [styles['dropdown__toggle--open']]: isOpen && !disabled,\n [styles['dropdown__toggle--with-icon']]: typeof svgIcon !== 'undefined',\n [styles['dropdown__toggle--transparent']]: variant === 'transparent',\n [styles['dropdown__toggle--borderless']]: variant === 'borderless',\n });\n const contentClasses = classNames(styles.dropdown__content, isOpen && styles['dropdown__content--open']);\n const listItemClasses = classNames(styles['dropdown__list-item'], { [styles['dropdown__list-item--single-select']]: isSingleSelect });\n\n const { refs, floatingStyles } = useFloating({\n placement: 'bottom',\n middleware: [\n offset(8),\n shift({ padding: 8 }),\n size({\n apply({ availableWidth, availableHeight, elements, rects }) {\n const triggerW = rects.reference.width;\n const minProp = typeof dropdownMinWidth !== 'undefined' ? clamp(0, maxWidth, dropdownMinWidth) : 0;\n const targetW = Math.max(triggerW, minProp);\n const finalW = Math.min(availableWidth, targetW);\n\n Object.assign(elements.floating.style, {\n width: `${finalW}px`,\n maxHeight: `${availableHeight}px`,\n overflowY: 'auto',\n overflowX: 'hidden',\n });\n },\n }),\n ],\n whileElementsMounted: autoUpdate,\n });\n\n const handleOpen = (isKeyboard: boolean): void => {\n openedByKeyboard.current = isKeyboard;\n toggleIsOpen();\n };\n\n const handleClose = (): void => {\n toggleIsOpen();\n buttonRef.current?.focus();\n };\n\n useEffect(() => {\n if (isOpen && openedByKeyboard.current) {\n const firstEnabled = childrenRefList.current?.find(r => r.current && !r.current.hasAttribute('disabled'));\n firstEnabled?.current?.focus();\n openedByKeyboard.current = false;\n }\n }, [isOpen]);\n\n const focusByIndex = (nextIndex: number): void => {\n childrenRefList.current?.[nextIndex]?.current?.focus();\n };\n\n const isListNavKey = (key: string): boolean =>\n key === KeyboardEventKey.ArrowDown || key === KeyboardEventKey.ArrowUp || key === KeyboardEventKey.Home || key === KeyboardEventKey.End;\n\n const handleKeyboardNavigation = (event: KeyboardEvent): void => {\n if (!childrenRefList.current) return;\n\n const key = event.key as KeyboardEventKey;\n\n if (key === KeyboardEventKey.Escape) {\n if (isOpen) {\n event.preventDefault();\n handleClose();\n }\n return;\n }\n\n if (!isOpen) {\n if (isListNavKey(key)) {\n event.preventDefault();\n handleOpen(true);\n }\n return;\n }\n\n if (!isListNavKey(key)) {\n return;\n }\n\n const index = childrenRefList.current.findIndex(x => x.current === (event.target as HTMLElement));\n let nextIndex = index;\n\n if (key === KeyboardEventKey.Home) {\n nextIndex = 0;\n } else if (key === KeyboardEventKey.End) {\n nextIndex = childrenRefList.current.length - 1;\n } else if (key === KeyboardEventKey.ArrowDown && index < childrenRefList.current.length - 1) {\n nextIndex = index + 1;\n } else if (key === KeyboardEventKey.ArrowUp && index > 0) {\n nextIndex = index - 1;\n }\n\n if (nextIndex !== -1) {\n event.preventDefault();\n focusByIndex(nextIndex);\n }\n };\n\n useKeyboardEvent(dropdownRef, handleKeyboardNavigation, [\n KeyboardEventKey.ArrowDown,\n KeyboardEventKey.ArrowUp,\n KeyboardEventKey.End,\n KeyboardEventKey.Enter,\n KeyboardEventKey.Escape,\n KeyboardEventKey.Home,\n KeyboardEventKey.Space,\n ]);\n\n useOutsideEvent(dropdownRef, () => isOpen && handleClose());\n\n const renderChildren = React.Children.map(children, (child, index) => {\n return (\n <li className={listItemClasses} id={`${optionIdPrefix}-${index}`}>\n {React.isValidElement(child) && childrenRefList.current && childrenRefList.current[index]\n ? ((): React.ReactElement => {\n const baseProps: { ref: React.Ref<HTMLElement> } = {\n ref: mergeRefs([child.props.ref, childrenRefList.current[index]]),\n };\n\n if (isMultiSelect) {\n const label = (child.props as CheckboxProps).label as React.ReactNode;\n if (React.isValidElement(label) && isComponent<LabelProps>(label, Label)) {\n return React.cloneElement(child as React.ReactElement<CheckboxProps>, {\n ...baseProps,\n label: React.cloneElement(label, {\n labelClassName: classNames((label.props as LabelProps)?.labelClassName, styles['dropdown__multiselect-item']),\n }),\n });\n }\n }\n\n return React.cloneElement(child as React.ReactElement<Record<string, unknown>>, baseProps);\n })()\n : child}\n </li>\n );\n });\n\n return (\n <div className={styles.dropdown} ref={dropdownRef}>\n <button\n type=\"button\"\n onClick={(): false | void => handleOpen(false)}\n className={toggleClasses}\n ref={mergeRefs([buttonRef, refs.setReference])}\n data-testid={testId}\n data-analyticsid={AnalyticsId.Dropdown}\n disabled={disabled}\n aria-labelledby={toggleTextId}\n aria-haspopup={true}\n aria-controls={contentId}\n aria-expanded={isOpen}\n style={{\n width: triggerActualMinWidth,\n maxWidth: '100%',\n minWidth: `${triggerMinWidthLimit}px`,\n }}\n >\n {svgIcon && (\n <>\n {typeof svgIcon === 'string' ? (\n <LazyIcon {...leftIconProps} iconName={svgIcon} />\n ) : (\n <Icon {...leftIconProps} svgIcon={svgIcon} />\n )}\n </>\n )}\n <span id={toggleTextId} className={styles.dropdown__toggle__text}>\n {triggerText}\n </span>\n <Icon\n svgIcon={!isSingleSelect ? PlusSmall : isOpen ? ChevronUp : ChevronDown}\n className={styles['dropdown__right-icon']}\n isHovered={!disabled && isHovered}\n size={IconSize.XSmall}\n />\n </button>\n <div\n key={dropdownMinWidth ?? 'auto'}\n id={contentId}\n className={contentClasses}\n ref={refs.setFloating}\n style={{\n ...floatingStyles,\n zIndex: zIndex,\n }}\n >\n <ul className={styles.dropdown__options} role=\"group\" aria-labelledby={toggleTextId} tabIndex={-1} ref={optionsRef}>\n {isSingleSelect && <SingleSelect onValueChange={() => handleClose()}>{renderChildren}</SingleSelect>}\n {isMultiSelect && renderChildren}\n </ul>\n {!isSingleSelect && !noCloseButton && (\n <div className={styles.dropdown__close}>\n <Button onClick={handleClose}>{mergedResources.closeText}</Button>\n </div>\n )}\n </div>\n </div>\n );\n};\n\nexport interface DropdownCompound extends React.FC<DropdownProps> {\n SingleSelectItem: ComponentType<SingleSelectItemProps>;\n}\nconst Dropdown = DropdownBase as DropdownCompound;\nDropdown.SingleSelectItem = SingleSelectItem;\nDropdownBase.displayName = 'Dropdown';\n\nexport default Dropdown;\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAKO,MAAM,eAAe,CAAC,aAAsD;AACjF,UAAQ,UAAA;AAAA,IACN,KAAK,gBAAgB;AACnB,aAAO;AAAA,IACT,KAAK,gBAAgB;AAAA,IACrB;AACE,aAAO;AAAA,EAAA;AAEb;ACuDO,MAAM,eAAwC,CAAA,UAAS;AAC5D,QAAM;AAAA,IACJ;AAAA,IACA,gBAAgB;AAAA,IAChB;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS,OAAO;AAAA,IAChB;AAAA,IACA;AAAA,IACA,UAAU;AAAA,EAAA,IACR;AAEJ,QAAM,cAAc,OAAuB,IAAI;AAC/C,QAAM,aAAa,OAAyB,IAAI;AAChD,QAAM,kBAAkB,OAAOA,eAAM,SAAS,IAAI,UAAU,MAAMA,eAAM,UAAA,CAAwB,CAAC;AACjG,QAAM,EAAE,UAAU,WAAW,UAAA,IAAc,SAAA;A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oBAAC,YAAU,GAAG,eAAe,UAAU,SAAS,IAEhD,oBAAC,MAAA,EAAM,GAAG,eAAe,SAAkB,GAE/C;AAAA,8BAED,QAAA,EAAK,IAAI,cAAc,WAAW,OAAO,wBACvC,UAAA,aACH;AAAA,UACA;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,SAAS,CAAC,iBAAiB,YAAY,SAAS,YAAY;AAAA,cAC5D,WAAW,OAAO,sBAAsB;AAAA,cACxC,WAAW,CAAC,YAAY;AAAA,cACxB,MAAM,SAAS;AAAA,YAAA;AAAA,UAAA;AAAA,QACjB;AAAA,MAAA;AAAA,IAAA;AAAA,IAEF;AAAA,MAAC;AAAA,MAAA;AAAA,QAEC,IAAI;AAAA,QACJ,WAAW;AAAA,QACX,KAAK,KAAK;AAAA,QACV,OAAO;AAAA,UACL,GAAG;AAAA,UACH;AAAA,QAAA;AAAA,QAGF,UAAA;AAAA,UAAA,qBAAC,MAAA,EAAG,WAAW,OAAO,mBAAmB,MAAK,SAAQ,mBAAiB,cAAc,UAAU,IAAI,KAAK,YACrG,UAAA;AAAA,YAAA,sCAAmB,cAAA,EAAa,eAAe,MAAM,YAAA,GAAgB,UAAA,gBAAe;AAAA,YACpF,iBAAiB;AAAA,UAAA,GACpB;AAAA,UACC,CAAC,kBAAkB,CAAC,qCAClB,OAAA,EAAI,WAAW,OAAO,iBACrB,8BAAC,QAAA,EAAO,SAAS,aAAc,UAAA,gBAAgB,WAAU,EAAA,CAC3D;AAAA,QAAA;AAAA,MAAA;AAAA,MAhBG,oBAAoB;AAAA,IAAA;AAAA,EAkB3B,GACF;AAEJ;AAKA,MAAM,WAAW;AACjB,SAAS,mBAAmB;AAC5B,aAAa,cAAc;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/Dropdown/resourceHelper.ts","../../../src/components/Dropdown/Dropdown.tsx"],"sourcesContent":["import { LanguageLocales } from '../../constants';\nimport enGB from '../../resources/HN.Designsystem.Dropdown.en-GB.json';\nimport nbNO from '../../resources/HN.Designsystem.Dropdown.nb-NO.json';\nimport { HNDesignsystemDropdown } from '../../resources/Resources';\n\nexport const getResources = (language: LanguageLocales): HNDesignsystemDropdown => {\n switch (language) {\n case LanguageLocales.ENGLISH:\n return enGB;\n case LanguageLocales.NORWEGIAN:\n default:\n return nbNO;\n }\n};\n","import React, { useEffect, useRef, useId } from 'react';\n\nimport classNames from 'classnames';\n\nimport {\n AnalyticsId,\n IconSize,\n KeyboardEventKey,\n LanguageLocales,\n ZIndex,\n theme,\n useKeyboardEvent,\n useOutsideEvent,\n useToggle,\n} from '../..';\nimport { getResources } from './resourceHelper';\nimport { usePseudoClasses } from '../../hooks/usePseudoClasses';\nimport { HNDesignsystemDropdown } from '../../resources/Resources';\nimport { useLanguage } from '../../utils/language';\nimport { mergeRefs } from '../../utils/refs';\nimport Button from '../Button';\nimport Icon from '../Icon';\nimport PlusSmall from '../Icons/PlusSmall';\n\nimport styles from './styles.module.scss';\n\nexport enum DropdownOnColor {\n onwhite = 'onwhite',\n ongrey = 'ongrey',\n onblueberry = 'onblueberry',\n oncherry = 'oncherry',\n}\n\nexport interface DropdownProps {\n /** Label for dropdown. Visible for screen readers */\n label: string;\n /** Text on the trigger button that opens the dropdown */\n placeholder: string;\n /** Sets the dropdown content */\n children: React.ReactNode;\n /** @deprecated Close button text */\n closeText?: string;\n /** Minimum width for the dropdown in pixels. Does not affect trigger button */\n dropdownMinWidth?: number;\n /** No close button */\n noCloseButton?: boolean;\n /** Called when dropdown is open/closed */\n onToggle?: (isOpen: boolean) => void;\n /** Whether the dropdown is open or not */\n open?: boolean;\n /** Changes the visuals of the dropdown */\n onColor?: keyof typeof DropdownOnColor;\n /** Makes the background of the trigger transparent */\n transparent?: boolean;\n /** Makes the width of the full component adjust to its parent */\n fluid?: boolean;\n /** Makes the dropdown disabled */\n disabled?: boolean;\n /** Sets the data-testid attribute on the dropdown button */\n testId?: string;\n /** Overrides the default z-index of the DropDownContent */\n zIndex?: number;\n /** Resources for component */\n resources?: Partial<HNDesignsystemDropdown>;\n}\n\nconst Dropdown: React.FC<DropdownProps> = props => {\n const {\n label,\n placeholder,\n noCloseButton = false,\n onToggle,\n dropdownMinWidth,\n open = false,\n children,\n onColor = DropdownOnColor.onwhite,\n transparent = false,\n fluid = false,\n testId,\n disabled,\n zIndex = ZIndex.PopOver,\n resources,\n } = props;\n\n const dropdownRef = useRef<HTMLDivElement>(null);\n const optionsRef = useRef<HTMLUListElement>(null);\n const { refObject: buttonRef, isHovered } = usePseudoClasses<HTMLButtonElement>();\n const openedByKeyboard = useRef<boolean>(false);\n const { value: isOpen, toggleValue: toggleIsOpen } = useToggle(!disabled && open, onToggle);\n const inputRefList = useRef(React.Children.map(children, () => React.createRef<HTMLElement>()));\n const labelId = useId();\n const toggleLabelId = useId();\n const optionIdPrefix = useId();\n const contentId = useId();\n const { language } = useLanguage<LanguageLocales>(LanguageLocales.NORWEGIAN);\n const defaultResources = getResources(language);\n\n const mergedResources: HNDesignsystemDropdown = {\n ...defaultResources,\n ...resources,\n closeText: props.closeText ?? resources?.closeText ?? defaultResources.closeText,\n };\n\n const handleOpen = (isKeyboard: boolean): void => {\n openedByKeyboard.current = isKeyboard;\n toggleIsOpen();\n };\n\n const handleClose = (): void => {\n toggleIsOpen();\n buttonRef.current?.focus();\n };\n\n useEffect(() => {\n if (isOpen && openedByKeyboard.current) {\n const firstEnabled = inputRefList.current?.find(r => r.current && !r.current.hasAttribute('disabled'));\n firstEnabled?.current?.focus();\n openedByKeyboard.current = false;\n }\n }, [isOpen]);\n\n const handleKeyboardNavigation = (event: KeyboardEvent): void => {\n if (!inputRefList.current) {\n return;\n }\n\n if (event.key === KeyboardEventKey.Escape) {\n if (isOpen) handleClose();\n return;\n }\n\n if (!isOpen) {\n handleOpen(true);\n event.preventDefault();\n return;\n }\n\n const index = inputRefList.current.findIndex(x => x.current === event.target);\n let nextIndex = index;\n\n if (event.key === KeyboardEventKey.Home) {\n nextIndex = 0;\n } else if (event.key === KeyboardEventKey.End) {\n nextIndex = inputRefList.current.length - 1;\n } else if (event.key === KeyboardEventKey.ArrowDown && index < inputRefList.current.length - 1) {\n nextIndex = index + 1;\n } else if (event.key === KeyboardEventKey.ArrowUp && index > 0) {\n nextIndex = index - 1;\n } else if (event.key === KeyboardEventKey.Enter && index !== -1) {\n nextIndex = index;\n }\n\n if (nextIndex !== -1 && event.key !== KeyboardEventKey.Space) {\n event.preventDefault();\n\n inputRefList.current[nextIndex].current?.focus();\n }\n };\n\n useKeyboardEvent(dropdownRef, handleKeyboardNavigation, [\n KeyboardEventKey.ArrowDown,\n KeyboardEventKey.ArrowUp,\n KeyboardEventKey.End,\n KeyboardEventKey.Enter,\n KeyboardEventKey.Escape,\n KeyboardEventKey.Home,\n KeyboardEventKey.Space,\n ]);\n\n useOutsideEvent(dropdownRef, () => isOpen && handleClose());\n\n const toggleClasses = classNames(\n styles.dropdown__toggle,\n !disabled && {\n [styles['dropdown__toggle--on-white']]: onColor === DropdownOnColor.onwhite,\n [styles['dropdown__toggle--on-grey']]: onColor === DropdownOnColor.ongrey,\n [styles['dropdown__toggle--on-blueberry']]: onColor === DropdownOnColor.onblueberry,\n [styles['dropdown__toggle--on-cherry']]: onColor === DropdownOnColor.oncherry,\n [styles['dropdown__toggle--transparent']]: transparent,\n [styles['dropdown__toggle--fluid']]: fluid,\n [styles['dropdown__toggle--open']]: isOpen,\n }\n );\n\n const contentClasses = classNames(styles.dropdown__content, isOpen && styles['dropdown__content--open']);\n\n const renderChildren = React.Children.map(children, (child, index) => {\n return (\n <li className={styles.dropdown__input} id={`${optionIdPrefix}-${index}`}>\n {React.isValidElement(child) && inputRefList.current && inputRefList.current[index]\n ? React.cloneElement(child as React.ReactElement, {\n ref: mergeRefs([child.props.ref, inputRefList.current[index]]),\n })\n : child}\n </li>\n );\n });\n\n return (\n <div className={styles.dropdown} ref={dropdownRef}>\n <span id={labelId} className={styles.dropdown__label}>\n {label}\n </span>\n <button\n type=\"button\"\n onClick={(): false | void => handleOpen(false)}\n className={toggleClasses}\n ref={buttonRef}\n data-testid={testId}\n data-analyticsid={AnalyticsId.Dropdown}\n disabled={disabled}\n aria-labelledby={toggleLabelId}\n aria-haspopup={true}\n aria-controls={contentId}\n aria-expanded={isOpen}\n >\n <span id={toggleLabelId} className={styles.dropdown__toggle__label}>\n {placeholder}\n </span>\n <Icon\n color={disabled ? theme.palette.neutral700 : theme.palette.blueberry600}\n svgIcon={PlusSmall}\n className={styles.dropdown__icon}\n isHovered={!disabled && isHovered}\n size={IconSize.XSmall}\n />\n </button>\n <div\n id={contentId}\n className={contentClasses}\n style={{ width: fluid ? '100%' : `auto`, minWidth: dropdownMinWidth ?? 'auto', zIndex: zIndex }}\n >\n <ul className={styles.dropdown__options} role=\"group\" aria-labelledby={labelId} tabIndex={-1} ref={optionsRef}>\n {renderChildren}\n </ul>\n {!noCloseButton && (\n <div className={styles.dropdown__close}>\n <Button onClick={handleClose}>{mergedResources.closeText}</Button>\n </div>\n )}\n </div>\n </div>\n );\n};\n\nexport default Dropdown;\n"],"names":["DropdownOnColor","React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAKO,MAAM,eAAe,CAAC,aAAsD;AACjF,UAAQ,UAAA;AAAA,IACN,KAAK,gBAAgB;AACnB,aAAO;AAAA,IACT,KAAK,gBAAgB;AAAA,IACrB;AACE,aAAO;AAAA,EAAA;AAEb;ACaO,IAAK,oCAAAA,qBAAL;AACLA,mBAAA,SAAA,IAAU;AACVA,mBAAA,QAAA,IAAS;AACTA,mBAAA,aAAA,IAAc;AACdA,mBAAA,UAAA,IAAW;AAJD,SAAAA;AAAA,GAAA,mBAAA,CAAA,CAAA;AAwCZ,MAAM,WAAoC,CAAA,UAAS;AACjD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,gBAAgB;AAAA,IAChB;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP;AAAA,IACA,UAAU;AAAA,IACV,cAAc;AAAA,IACd,QAAQ;AAAA,IACR;AAAA,IACA;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