@dt-dds/react-dropdown 1.0.0-beta.67 → 1.0.0-beta.69

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,413 +1,337 @@
1
- // src/components/detail/DropdownDetail.tsx
2
- import { Typography } from "@dt-dds/react-typography";
3
-
4
- // src/components/detail/DropdownDetail.styled.ts
5
- import styled from "@emotion/styled";
6
- var DropdownDetailStyled = styled.div`
7
- display: flex;
8
- align-items: center;
9
- padding-left: 15px;
10
- margin-top: 4px;
11
- `;
12
-
13
- // src/components/detail/DropdownDetail.tsx
14
- import { jsx } from "react/jsx-runtime";
15
- var DropdownDetail = ({
16
- dataTestId,
17
- isDisabled = false,
18
- hasError = false,
19
- children = ""
20
- }) => {
21
- const messageColor = isDisabled ? "content.light" : "content.medium";
22
- return /* @__PURE__ */ jsx(DropdownDetailStyled, { "data-testid": dataTestId != null ? dataTestId : "dropdown-text", children: /* @__PURE__ */ jsx(
23
- Typography,
24
- {
25
- color: hasError ? "error.default" : messageColor,
26
- element: "span",
27
- fontStyles: "bodySmRegular",
28
- children
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
29
16
  }
30
- ) });
17
+ return a;
31
18
  };
32
-
33
- // src/context/DropdownProvider.tsx
34
- import {
35
- createContext,
36
- useContext,
37
- useEffect,
38
- useState
39
- } from "react";
40
- import { jsx as jsx2 } from "react/jsx-runtime";
41
- var DEFAULT_VALUE = {
42
- state: {
43
- text: "",
44
- value: ""
45
- },
46
- isOpen: false,
47
- setState: () => null,
48
- setIsOpen: () => null
49
- };
50
- var DropdownContext = createContext(DEFAULT_VALUE);
51
- var DropdownContextProvider = ({
52
- children,
53
- defaultValue,
54
- name
55
- }) => {
56
- const [state, setState] = useState(defaultValue != null ? defaultValue : DEFAULT_VALUE.state);
57
- const [isOpen, setIsOpen] = useState(DEFAULT_VALUE.isOpen);
58
- useEffect(() => defaultValue && setState(defaultValue), [defaultValue]);
59
- return /* @__PURE__ */ jsx2(
60
- DropdownContext.Provider,
61
- {
62
- value: {
63
- state,
64
- setState,
65
- isOpen,
66
- setIsOpen,
67
- name
68
- },
69
- children
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ var __objRest = (source, exclude) => {
21
+ var target = {};
22
+ for (var prop in source)
23
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
+ target[prop] = source[prop];
25
+ if (source != null && __getOwnPropSymbols)
26
+ for (var prop of __getOwnPropSymbols(source)) {
27
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
+ target[prop] = source[prop];
70
29
  }
71
- );
72
- };
73
- var useDropdownContext = () => {
74
- const context = useContext(DropdownContext);
75
- if (!context) {
76
- throw new Error(
77
- "Dropdown compound components cannot be rendered outside the Dropdown component"
78
- );
79
- }
80
- return context;
30
+ return target;
81
31
  };
82
32
 
33
+ // src/Dropdown.tsx
34
+ import { Portal, useClickOutside } from "@dt-dds/react-core";
35
+ import { forwardRef as forwardRef2, useCallback, useRef } from "react";
36
+
37
+ // src/components/option/DropdownOption.tsx
38
+ import { forwardRef } from "react";
39
+
83
40
  // src/components/option/DropdownOption.styled.ts
84
- import styled2 from "@emotion/styled";
85
- var DropdownOptionStyled = styled2.li`
86
- ${({ theme, disabled, isSelected }) => `
87
- ${theme.fontStyles[isSelected ? "bodyMdBold" : "bodyMdRegular"]};
41
+ import styled from "@emotion/styled";
42
+ var DropdownOptionStyled = styled.li`
43
+ ${({ theme }) => `
44
+ ${theme.fontStyles.bodyMdRegular};
45
+
88
46
  color: ${theme.palette.content.default};
47
+ padding: ${theme.spacing.spacing_40} ${theme.spacing.spacing_50};
89
48
  list-style: none;
90
- padding: ${theme.spacing.spacing_30} ${theme.spacing.spacing_50};
91
49
  text-overflow: ellipsis;
92
50
  overflow-x: hidden;
51
+ text-wrap: nowrap;
93
52
 
94
- &:hover {
95
- background: ${disabled ? theme.palette.surface.light : theme.palette.primary.light};
96
- cursor: ${disabled ? "not-allowed" : "pointer"};
53
+ &:not([aria-disabled="true"]) {
54
+ &[aria-selected="true"], &[aria-selected="true"] span {
55
+ ${theme.fontStyles.bodyMdBold};
56
+ }
57
+
58
+ &:hover, &[data-highlighted="true"] {
59
+ background: ${theme.palette.accent.light};
60
+ cursor: pointer;
61
+ }
97
62
  }
98
63
 
99
- ${disabled && `
100
- color: ${theme.palette.content.light};
101
- background: ${theme.palette.surface.light};
102
- `}
64
+ &[aria-disabled="true"] {
65
+ color: ${theme.palette.content.light};
66
+ cursor: not-allowed;
67
+
68
+ &[aria-selected="true"] {
69
+ background-color: ${theme.palette.surface.light};
70
+ }
71
+ }
103
72
  `}
104
73
  `;
105
74
 
106
75
  // src/components/option/DropdownOption.tsx
107
- import { jsx as jsx3 } from "react/jsx-runtime";
108
- var DropdownOption = ({
109
- dataTestId,
110
- option,
111
- children,
112
- style,
113
- isDisabled,
114
- onClick
115
- }) => {
116
- var _a;
117
- const { state, setState, setIsOpen, name } = useDropdownContext();
118
- const testId = dataTestId != null ? dataTestId : `dropdown-option-${option.value}`;
119
- const value = {
120
- text: (_a = option.text) != null ? _a : option.value,
121
- value: option.value
122
- };
123
- const handleClick = (event) => {
124
- if (isDisabled) {
125
- return;
126
- }
127
- setIsOpen(false);
128
- setState(value);
129
- onClick && onClick(option.value, name, event);
130
- };
131
- return /* @__PURE__ */ jsx3(
132
- DropdownOptionStyled,
133
- {
134
- "data-testid": testId,
135
- disabled: isDisabled,
136
- isSelected: state.value === option.value,
137
- onClick: handleClick,
138
- role: "option",
76
+ import { jsx } from "react/jsx-runtime";
77
+ var DropdownOption = forwardRef(
78
+ (_a, ref) => {
79
+ var _b = _a, {
80
+ dataTestId,
81
+ children,
139
82
  style,
140
- children
141
- },
142
- option.value
143
- );
144
- };
83
+ isDisabled,
84
+ isSelected = false,
85
+ isHighlighted = false,
86
+ onClick
87
+ } = _b, rest = __objRest(_b, [
88
+ "dataTestId",
89
+ "children",
90
+ "style",
91
+ "isDisabled",
92
+ "isSelected",
93
+ "isHighlighted",
94
+ "onClick"
95
+ ]);
96
+ const testId = dataTestId != null ? dataTestId : "dropdown-option";
97
+ const handleClick = (e) => {
98
+ if (isDisabled) {
99
+ e.preventDefault();
100
+ e.stopPropagation();
101
+ return;
102
+ }
103
+ onClick == null ? void 0 : onClick(e);
104
+ };
105
+ return /* @__PURE__ */ jsx(
106
+ DropdownOptionStyled,
107
+ __spreadProps(__spreadValues({}, rest), {
108
+ "aria-disabled": isDisabled,
109
+ "aria-selected": isSelected,
110
+ "data-highlighted": isHighlighted,
111
+ "data-testid": testId,
112
+ onClick: handleClick,
113
+ ref,
114
+ style,
115
+ children
116
+ })
117
+ );
118
+ }
119
+ );
145
120
 
146
- // src/components/select/DropdownSelect.tsx
147
- import { Box } from "@dt-dds/react-box";
148
- import { Icon } from "@dt-dds/react-icon";
149
- import { IconButton } from "@dt-dds/react-icon-button";
150
- import { Typography as Typography2 } from "@dt-dds/react-typography";
151
- import { useTheme } from "@emotion/react";
152
- import { Children, useEffect as useEffect2 } from "react";
121
+ // src/Dropdown.styled.ts
122
+ import styled2 from "@emotion/styled";
123
+ var DropdownStyled = styled2.div`
124
+ list-style-type: none;
125
+ width: 100%;
126
+ overflow: auto;
153
127
 
154
- // src/components/menu/DropdownMenu.styled.ts
155
- import { DROPDOWN_MENU_Z_INDEX } from "@dt-dds/react-core";
156
- import styled3 from "@emotion/styled";
157
- var DropdownMenuStyled = styled3.ul`
158
128
  ${({ theme }) => `
159
- background: ${theme.palette.surface.contrast};
160
- border: 1px solid ${theme.palette.border.default};
129
+ padding: ${theme.spacing.spacing_50} ${theme.spacing.spacing_0};
130
+ background-color: ${theme.palette.surface.contrast};
161
131
  border-radius: ${theme.shape.dropdown};
162
- width: 100%;
163
- padding:${theme.spacing.spacing_50} ${theme.spacing.spacing_0};
164
- margin: ${theme.spacing.spacing_20} ${theme.spacing.spacing_0};
165
- position: absolute;
166
- right: 0;
167
- z-index: ${DROPDOWN_MENU_Z_INDEX};
168
- max-height: 180px;
169
- overflow: auto;
132
+ border: 1px solid ${theme.palette.border.medium};
170
133
  `}
171
134
  `;
172
135
 
173
- // src/components/menu/DropdownMenu.tsx
174
- import { jsx as jsx4 } from "react/jsx-runtime";
175
- var DropdownMenu = ({ children, dataTestId, style }) => {
176
- return /* @__PURE__ */ jsx4(
177
- DropdownMenuStyled,
178
- {
179
- "data-testid": `${dataTestId ? dataTestId + "-" : ""}menu`,
180
- style,
181
- children
182
- }
183
- );
184
- };
185
-
186
- // src/components/select/DropdownSelect.styled.ts
187
- import styled4 from "@emotion/styled";
188
- var getThemedBackgroundFill = (fill, theme) => ({
189
- default: theme.palette.surface.default,
190
- contrast: theme.palette.surface.contrast,
191
- light: theme.palette.surface.light
192
- })[fill];
193
- var SelectDropdownStyled = styled4.button`
194
- ${({
195
- theme,
196
- hasBorder = true,
197
- hasError = false,
198
- isOpen = false,
199
- variant = "outlined",
200
- fill = "default"
201
- }) => {
202
- const borderColor = theme.palette.border.medium;
203
- const activeBorderColor = theme.palette.content.dark;
204
- const errorBorderColor = theme.palette.error.default;
205
- return `
206
- background: ${theme.palette.surface.contrast};
207
- padding: ${theme.spacing.spacing_30} ${hasBorder ? theme.spacing.spacing_50 : "0"};
208
- position: relative;
209
- display: flex;
210
- align-items: center;
211
- justify-content: space-between;
212
- text-align: left;
213
- width: 100%;
214
- height: 53px;
215
- cursor: pointer;
216
- outline: none;
217
-
218
- background-color: ${getThemedBackgroundFill(fill, theme)};
219
-
220
- border-width: ${variant === "outlined" ? "1px" : "0 0 1px"};
221
- border-color: ${isOpen ? activeBorderColor : borderColor};
222
- border-style: solid;
223
-
224
- &:focus, &:hover {
225
- border-color: ${hasError ? errorBorderColor : activeBorderColor};
226
- }
227
-
228
- ${hasError && `border-color: ${errorBorderColor}`};
229
- ${!hasBorder && "border: none"};
230
-
231
- &:disabled {
232
- pointer-events: none;
233
- }
234
- `;
235
- }}
236
- `;
237
-
238
- // src/components/select/DropdownSelect.tsx
239
- import { Fragment, jsx as jsx5, jsxs } from "react/jsx-runtime";
240
- var DropdownSelect = ({
241
- children,
242
- label,
243
- style,
244
- dataTestId = "dropdown-select",
245
- isDisabled = false,
246
- isRequired,
247
- hasBorder = true,
248
- hasError = false,
249
- hasDeselect = false,
250
- variant = "outlined",
251
- fill = "default"
252
- }) => {
253
- const { state, setState, isOpen, setIsOpen } = useDropdownContext();
254
- const theme = useTheme();
255
- const childCount = Children.count(children);
256
- const hasOneChild = childCount === 1;
257
- const disabled = isDisabled || hasOneChild;
258
- const disabledIconColor = disabled ? theme.palette.content.light : theme.palette.content.default;
259
- const handleClick = (event) => {
260
- event.preventDefault();
261
- setIsOpen((prev) => !prev);
262
- };
263
- const handleDeselectClick = (event) => {
264
- event.stopPropagation();
265
- setState({ text: "", value: "" });
266
- };
267
- useEffect2(() => {
268
- const hasOption = Children.toArray(children).find(
269
- (child) => child.props.option.value === state.value
270
- );
271
- if (!hasOption) {
272
- setState({ text: "", value: "" });
136
+ // src/hooks/useFloatingPosition.ts
137
+ import { DROPDOWN_MENU_Z_INDEX } from "@dt-dds/react-core";
138
+ import { useLayoutEffect, useState } from "react";
139
+ function basePos({
140
+ placement,
141
+ anchor,
142
+ menuWidth,
143
+ menuHeight,
144
+ offsetX,
145
+ offsetY
146
+ }) {
147
+ switch (placement) {
148
+ case "bottom":
149
+ return { top: anchor.bottom + offsetY, left: anchor.left + offsetX };
150
+ case "top":
151
+ return {
152
+ top: anchor.top - offsetY - menuHeight,
153
+ left: anchor.left + offsetX
154
+ };
155
+ case "right":
156
+ return { top: anchor.top + offsetY, left: anchor.right + offsetX };
157
+ case "left":
158
+ return {
159
+ top: anchor.top + offsetY,
160
+ left: anchor.left - offsetX - menuWidth
161
+ };
162
+ }
163
+ }
164
+ function useFloatingPosition(anchorEl, open, {
165
+ offsetX = 0,
166
+ offsetY = 4,
167
+ matchWidth = true,
168
+ minViewportPadding = 8,
169
+ placement = "bottom",
170
+ menuRef
171
+ } = {}) {
172
+ const [style, setStyle] = useState({
173
+ visibility: "hidden",
174
+ position: "fixed"
175
+ });
176
+ useLayoutEffect(() => {
177
+ if (!open || !(anchorEl == null ? void 0 : anchorEl.current)) {
178
+ setStyle({
179
+ visibility: "hidden",
180
+ position: "fixed"
181
+ });
182
+ return;
273
183
  }
274
- }, [children, setState, state.value]);
275
- useEffect2(() => {
276
- var _a;
277
- if (hasOneChild) {
278
- const options = Children.map(
279
- children,
280
- (child) => child && child.props.option
184
+ const anchorElement = anchorEl == null ? void 0 : anchorEl.current;
185
+ const menuElement = menuRef == null ? void 0 : menuRef.current;
186
+ const updatePosition = () => {
187
+ var _a, _b;
188
+ const vw = window.innerWidth;
189
+ const vh = window.innerHeight;
190
+ const anchor = anchorElement.getBoundingClientRect();
191
+ const menuRect = menuElement == null ? void 0 : menuElement.getBoundingClientRect();
192
+ const menuWidth = matchWidth ? anchor.width : (_a = menuRect == null ? void 0 : menuRect.width) != null ? _a : anchor.width;
193
+ const menuHeight = (_b = menuRect == null ? void 0 : menuRect.height) != null ? _b : 0;
194
+ let { top, left } = basePos({
195
+ placement,
196
+ anchor,
197
+ menuWidth,
198
+ menuHeight,
199
+ offsetX,
200
+ offsetY
201
+ });
202
+ const maxLeft = Math.max(
203
+ minViewportPadding,
204
+ vw - menuWidth - minViewportPadding
281
205
  );
282
- if (options && options[0]) {
283
- const option = {
284
- text: (_a = options[0].text) != null ? _a : options[0].value,
285
- value: options[0].value
286
- };
287
- setState(option);
288
- }
206
+ const maxTop = Math.max(
207
+ minViewportPadding,
208
+ vh - menuHeight - minViewportPadding
209
+ );
210
+ left = Math.max(minViewportPadding, Math.min(left, maxLeft));
211
+ top = Math.max(minViewportPadding, Math.min(top, maxTop));
212
+ setStyle({
213
+ position: "fixed",
214
+ top,
215
+ left,
216
+ width: matchWidth ? anchor.width : void 0,
217
+ maxWidth: matchWidth ? anchor.width : 300,
218
+ boxSizing: "border-box",
219
+ zIndex: DROPDOWN_MENU_Z_INDEX
220
+ });
221
+ };
222
+ updatePosition();
223
+ const ro = new ResizeObserver(updatePosition);
224
+ ro.observe(anchorElement);
225
+ if (anchorElement) {
226
+ ro.observe(anchorElement);
289
227
  }
290
- }, [hasOneChild, setState, children]);
291
- return /* @__PURE__ */ jsxs(Fragment, { children: [
292
- /* @__PURE__ */ jsxs(
293
- SelectDropdownStyled,
294
- {
295
- "data-testid": dataTestId,
296
- disabled,
297
- fill,
298
- hasBorder,
299
- hasError,
300
- isOpen,
301
- onClick: handleClick,
302
- style,
303
- variant,
304
- children: [
305
- /* @__PURE__ */ jsxs("div", { style: { overflow: "hidden" }, children: [
306
- /* @__PURE__ */ jsxs(
307
- Typography2,
308
- {
309
- color: disabled ? "content.light" : "content.default",
310
- fontStyles: "bodySmRegular",
311
- children: [
312
- label,
313
- isRequired ? /* @__PURE__ */ jsx5(
314
- Typography2,
315
- {
316
- color: "error.default",
317
- element: "span",
318
- fontStyles: "bodySmRegular",
319
- children: "*"
320
- }
321
- ) : null
322
- ]
323
- }
324
- ),
325
- /* @__PURE__ */ jsx5(
326
- Typography2,
327
- {
328
- color: disabled ? "content.light" : "content.default",
329
- fontStyles: "bodyMdRegular",
330
- style: { textOverflow: "ellipsis", overflow: "hidden" },
331
- children: !state.value ? "Select an option" : state.text
332
- }
333
- )
334
- ] }),
335
- /* @__PURE__ */ jsxs(Box, { style: { flexDirection: "row", gap: "0.5rem" }, children: [
336
- hasDeselect && !!state.value ? /* @__PURE__ */ jsx5(IconButton, { onClick: handleDeselectClick, children: /* @__PURE__ */ jsx5(
337
- Icon,
338
- {
339
- code: "close",
340
- color: disabledIconColor,
341
- dataTestId: "deselect-value",
342
- size: "s"
343
- }
344
- ) }) : null,
345
- /* @__PURE__ */ jsx5(
346
- Icon,
347
- {
348
- code: isOpen ? "expand_less" : "expand_more",
349
- color: disabledIconColor,
350
- size: "l"
351
- }
352
- )
353
- ] })
354
- ]
355
- }
356
- ),
357
- isOpen ? /* @__PURE__ */ jsx5(DropdownMenu, { dataTestId, children }) : null
358
- ] });
359
- };
228
+ const opts = { passive: true };
229
+ window.addEventListener("scroll", updatePosition, opts);
230
+ window.addEventListener("resize", updatePosition, opts);
231
+ return () => {
232
+ ro.disconnect();
233
+ window.removeEventListener("scroll", updatePosition, opts);
234
+ window.removeEventListener("resize", updatePosition, opts);
235
+ };
236
+ }, [
237
+ menuRef,
238
+ anchorEl,
239
+ open,
240
+ placement,
241
+ offsetX,
242
+ offsetY,
243
+ matchWidth,
244
+ minViewportPadding
245
+ ]);
246
+ return { style };
247
+ }
360
248
 
361
- // src/components/container/DropdownContainer.tsx
362
- import { useClickOutside } from "@dt-dds/react-core";
363
- import { useRef } from "react";
364
- import { jsx as jsx6 } from "react/jsx-runtime";
365
- var DropdownContainer = ({
366
- children,
367
- style,
368
- dataTestId
369
- }) => {
370
- const { setIsOpen } = useDropdownContext();
371
- const ref = useRef(null);
372
- useClickOutside({ ref, handler: () => setIsOpen(false) });
373
- return /* @__PURE__ */ jsx6("div", { "data-testid": dataTestId, ref, style, children });
249
+ // src/utils/set-ref.ts
250
+ var setRef = (target, node) => {
251
+ if (!target) {
252
+ return;
253
+ }
254
+ if (typeof target === "function") {
255
+ target(node);
256
+ return;
257
+ }
258
+ target.current = node;
374
259
  };
375
260
 
376
- // src/Dropdown.styled.ts
377
- import styled5 from "@emotion/styled";
378
- var DropdownStyled = styled5.div`
379
- ${({ theme, style }) => `
380
- margin: ${theme.spacing.spacing_0};
381
- display: inline-block;
382
- position: relative;
383
- width: 100%;
384
- ${style}
385
- `}
386
- `;
387
-
388
261
  // src/Dropdown.tsx
389
- import { jsx as jsx7 } from "react/jsx-runtime";
390
- var Dropdown = ({
391
- children,
392
- defaultValue,
393
- style,
394
- name,
395
- dataTestId = "dropdown"
396
- }) => /* @__PURE__ */ jsx7(DropdownContextProvider, { defaultValue, name, children: /* @__PURE__ */ jsx7(DropdownStyled, { "data-testid": dataTestId, role: "menu", style, children }) });
397
- Dropdown.Container = DropdownContainer;
398
- Dropdown.Detail = DropdownDetail;
399
- Dropdown.Select = DropdownSelect;
400
- Dropdown.Option = DropdownOption;
401
- Dropdown.Menu = DropdownMenu;
402
- var Dropdown_default = Dropdown;
262
+ import { jsx as jsx2 } from "react/jsx-runtime";
263
+ var Dropdown = Object.assign(
264
+ forwardRef2(
265
+ (_a, forwardedRef) => {
266
+ var _b = _a, {
267
+ children,
268
+ style,
269
+ dataTestId = "dropdown",
270
+ isOpen = false,
271
+ anchorRef,
272
+ matchWidth = true,
273
+ offsetX,
274
+ offsetY,
275
+ as = "div",
276
+ onClose,
277
+ placement
278
+ } = _b, rest = __objRest(_b, [
279
+ "children",
280
+ "style",
281
+ "dataTestId",
282
+ "isOpen",
283
+ "anchorRef",
284
+ "matchWidth",
285
+ "offsetX",
286
+ "offsetY",
287
+ "as",
288
+ "onClose",
289
+ "placement"
290
+ ]);
291
+ const localMenuRef = useRef(null);
292
+ const setMenuRef = useCallback(
293
+ (node) => {
294
+ localMenuRef.current = node;
295
+ setRef(forwardedRef, node);
296
+ },
297
+ [forwardedRef]
298
+ );
299
+ const { style: floatingStyle } = useFloatingPosition(
300
+ anchorRef,
301
+ isOpen,
302
+ {
303
+ matchWidth,
304
+ offsetX,
305
+ offsetY,
306
+ placement,
307
+ menuRef: localMenuRef
308
+ }
309
+ );
310
+ useClickOutside({
311
+ refs: [localMenuRef, anchorRef],
312
+ handler: () => onClose == null ? void 0 : onClose()
313
+ });
314
+ return /* @__PURE__ */ jsx2(Portal, { isOpen: true, children: /* @__PURE__ */ jsx2(
315
+ DropdownStyled,
316
+ __spreadProps(__spreadValues({
317
+ as,
318
+ "data-testid": dataTestId,
319
+ ref: setMenuRef,
320
+ role: "menu",
321
+ style: __spreadValues(__spreadValues({}, floatingStyle), style)
322
+ }, rest), {
323
+ "aria-hidden": !isOpen,
324
+ onMouseDown: (e) => e.preventDefault(),
325
+ children
326
+ })
327
+ ) });
328
+ }
329
+ ),
330
+ {
331
+ Option: DropdownOption
332
+ }
333
+ );
403
334
  export {
404
- Dropdown_default as Dropdown,
405
- DropdownContainer,
406
- DropdownContext,
407
- DropdownContextProvider,
408
- DropdownDetail,
409
- DropdownMenu,
410
- DropdownOption,
411
- DropdownSelect,
412
- useDropdownContext
335
+ Dropdown,
336
+ DropdownOption
413
337
  };