@mirohq/design-system-dropdown-menu 3.3.2 → 3.4.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/dist/module.js CHANGED
@@ -1,4 +1,5 @@
1
- import React, { createContext, useState, useRef, useCallback, useContext, useEffect, useMemo } from 'react';
1
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
+ import React, { createContext, useState, useRef, useCallback, useContext, useMemo } from 'react';
2
3
  import * as RadixDropdownMenu from '@radix-ui/react-dropdown-menu';
3
4
  import { Portal as Portal$1 } from '@radix-ui/react-dropdown-menu';
4
5
  import { IconProhibit, IconCheckMark, IconChevronRight } from '@mirohq/design-system-icons';
@@ -6,6 +7,7 @@ import { addPropsToChildren, booleanify } from '@mirohq/design-system-utils';
6
7
  import { Primitive } from '@mirohq/design-system-primitive';
7
8
  import { styled, theme } from '@mirohq/design-system-stitches';
8
9
  import { focus, animations } from '@mirohq/design-system-styles';
10
+ import { useLayoutEffect } from '@mirohq/design-system-use-layout-effect';
9
11
  import { ScrollArea } from '@mirohq/design-system-scroll-area';
10
12
  import { styles, Thumb } from '@mirohq/design-system-base-switch';
11
13
  import { styles as styles$1, isIconComponent } from '@mirohq/design-system-base-icon';
@@ -80,13 +82,17 @@ const ContentProvider = ({
80
82
  "--right-slot-max-width": `${Math.ceil(maxWidth)}px`
81
83
  }
82
84
  });
83
- return /* @__PURE__ */ React.createElement(Context$1.Provider, {
84
- value: {
85
- rightSlotMount,
86
- rightSlotDestroy,
87
- containerSpacing
85
+ return /* @__PURE__ */ jsx(
86
+ Context$1.Provider,
87
+ {
88
+ value: {
89
+ rightSlotMount,
90
+ rightSlotDestroy,
91
+ containerSpacing
92
+ },
93
+ children: formattedChildren
88
94
  }
89
- }, formattedChildren);
95
+ );
90
96
  };
91
97
  const useContent = () => useContext(Context$1);
92
98
 
@@ -109,7 +115,7 @@ const StyledRightSlot = styled(Primitive.div, {
109
115
  const RightSlot = (props) => {
110
116
  const { rightSlotMount, rightSlotDestroy } = useContent();
111
117
  const ref = useRef(null);
112
- useEffect(() => {
118
+ useLayoutEffect(() => {
113
119
  if (ref.current !== null) {
114
120
  const width = ref.current.getBoundingClientRect().width;
115
121
  const index = rightSlotMount(width);
@@ -118,10 +124,7 @@ const RightSlot = (props) => {
118
124
  return () => {
119
125
  };
120
126
  }, [rightSlotMount, rightSlotDestroy, ref]);
121
- return /* @__PURE__ */ React.createElement(StyledRightSlot, {
122
- ref,
123
- ...props
124
- });
127
+ return /* @__PURE__ */ jsx(StyledRightSlot, { ref, ...props });
125
128
  };
126
129
 
127
130
  const HotkeySlot = styled(RightSlot, {
@@ -216,7 +219,7 @@ const useAriaDisabled = ({
216
219
  onSelect,
217
220
  onPointerMove,
218
221
  onClick
219
- }, preventDefault = false) => useMemo(
222
+ }, closeOnCheck = true) => useMemo(
220
223
  () => ({
221
224
  "aria-disabled": booleanify(ariaDisabled) ? ariaDisabled : void 0,
222
225
  onKeyDown: (e) => {
@@ -228,13 +231,13 @@ const useAriaDisabled = ({
228
231
  onKeyDown == null ? void 0 : onKeyDown(e);
229
232
  },
230
233
  onSelect: (e) => {
231
- if (preventDefault) {
232
- e.preventDefault();
233
- }
234
234
  if (booleanify(ariaDisabled)) {
235
235
  e.preventDefault();
236
236
  return;
237
237
  }
238
+ if (!closeOnCheck) {
239
+ e.preventDefault();
240
+ }
238
241
  onSelect == null ? void 0 : onSelect(e);
239
242
  },
240
243
  onPointerMove: (e) => {
@@ -252,7 +255,7 @@ const useAriaDisabled = ({
252
255
  onClick == null ? void 0 : onClick(e);
253
256
  }
254
257
  }),
255
- [ariaDisabled, onKeyDown, onSelect, onPointerMove, onClick, preventDefault]
258
+ [ariaDisabled, onKeyDown, onSelect, onPointerMove, onClick, closeOnCheck]
256
259
  );
257
260
 
258
261
  const Context = createContext({
@@ -274,32 +277,56 @@ const ItemProvider = ({
274
277
  const formattedChildren = hasSlot ? children : addPropsToChildren(children, () => true, {
275
278
  "data-no-left-slot": ""
276
279
  });
277
- return /* @__PURE__ */ React.createElement(Context.Provider, {
278
- value: {
279
- leftSlotMount,
280
- leftSlotDestroy
280
+ return /* @__PURE__ */ jsx(
281
+ Context.Provider,
282
+ {
283
+ value: {
284
+ leftSlotMount,
285
+ leftSlotDestroy
286
+ },
287
+ children: formattedChildren
281
288
  }
282
- }, formattedChildren);
289
+ );
283
290
  };
284
291
  const useItem = () => useContext(Context);
285
292
 
286
- const CheckboxItem = React.forwardRef(({ children, checked, onChange, disabled, ...restProps }, forwardRef) => {
287
- const ariaDisabledProps = useAriaDisabled(restProps, true);
288
- const { "aria-disabled": ariaDisabled } = ariaDisabledProps;
289
- return /* @__PURE__ */ React.createElement(ItemProvider, null, /* @__PURE__ */ React.createElement(StyledCheckboxItem, {
290
- ...restProps,
291
- ...ariaDisabledProps,
292
- ref: forwardRef,
293
+ const CheckboxItem = React.forwardRef(
294
+ ({
295
+ children,
293
296
  checked,
297
+ onChange,
294
298
  disabled,
295
- onCheckedChange: onChange
296
- }, children, /* @__PURE__ */ React.createElement(RightSlot, null, /* @__PURE__ */ React.createElement(StyledIndicator, null, (disabled === true || booleanify(ariaDisabled)) && !checked && /* @__PURE__ */ React.createElement(IconProhibit, {
297
- weight: "thin",
298
- css: { square: "$3", display: "block" }
299
- }), checked && /* @__PURE__ */ React.createElement(IconCheckMark, {
300
- css: { square: "$3", display: "block" }
301
- })))));
302
- });
299
+ closeOnSelect = false,
300
+ ...restProps
301
+ }, forwardRef) => {
302
+ const ariaDisabledProps = useAriaDisabled(restProps, closeOnSelect);
303
+ const { "aria-disabled": ariaDisabled } = ariaDisabledProps;
304
+ return /* @__PURE__ */ jsx(ItemProvider, { children: /* @__PURE__ */ jsxs(
305
+ StyledCheckboxItem,
306
+ {
307
+ ...restProps,
308
+ ...ariaDisabledProps,
309
+ ref: forwardRef,
310
+ checked,
311
+ disabled,
312
+ onCheckedChange: onChange,
313
+ children: [
314
+ children,
315
+ /* @__PURE__ */ jsx(RightSlot, { children: /* @__PURE__ */ jsxs(StyledIndicator, { children: [
316
+ (disabled === true || booleanify(ariaDisabled)) && !checked && /* @__PURE__ */ jsx(
317
+ IconProhibit,
318
+ {
319
+ weight: "thin",
320
+ css: { square: "$3", display: "block" }
321
+ }
322
+ ),
323
+ checked && /* @__PURE__ */ jsx(IconCheckMark, { css: { square: "$3", display: "block" } })
324
+ ] }) })
325
+ ]
326
+ }
327
+ ) });
328
+ }
329
+ );
303
330
 
304
331
  const CONTENT_GUTTER = parseInt(theme.space[150]);
305
332
  const CONTENT_OFFSET = parseInt(theme.space[50]);
@@ -388,16 +415,19 @@ const ScrollableContent = ({
388
415
  };
389
416
  }, [maxHeight, overflow, containerSpacing]);
390
417
  if (overflow === "auto") {
391
- return /* @__PURE__ */ React.createElement(ScrollArea, {
392
- css: { margin: `-${CONTENT_BORDER_FOCUS_ITEM}` },
393
- type: "always"
394
- }, /* @__PURE__ */ React.createElement(ScrollArea.Viewport, {
395
- css: { ...getOverflowMaxHeight() }
396
- }, children), /* @__PURE__ */ React.createElement(ScrollArea.Scrollbar, {
397
- orientation: "vertical"
398
- }, /* @__PURE__ */ React.createElement(ScrollArea.Thumb, null)));
418
+ return /* @__PURE__ */ jsxs(
419
+ ScrollArea,
420
+ {
421
+ css: { margin: `-${CONTENT_BORDER_FOCUS_ITEM}` },
422
+ type: "always",
423
+ children: [
424
+ /* @__PURE__ */ jsx(ScrollArea.Viewport, { css: { ...getOverflowMaxHeight() }, children }),
425
+ /* @__PURE__ */ jsx(ScrollArea.Scrollbar, { orientation: "vertical", children: /* @__PURE__ */ jsx(ScrollArea.Thumb, {}) })
426
+ ]
427
+ }
428
+ );
399
429
  }
400
- return /* @__PURE__ */ React.createElement(React.Fragment, null, children);
430
+ return /* @__PURE__ */ jsx(Fragment, { children });
401
431
  };
402
432
 
403
433
  const Content = React.forwardRef(
@@ -416,29 +446,31 @@ const Content = React.forwardRef(
416
446
  maxHeight,
417
447
  children,
418
448
  ...restProps
419
- }, forwardRef) => /* @__PURE__ */ React.createElement(ContentProvider, {
420
- containerSpacing
421
- }, /* @__PURE__ */ React.createElement(StyledContent, {
422
- ...restProps,
423
- ref: forwardRef,
424
- loop,
425
- side,
426
- sideOffset,
427
- align,
428
- alignOffset,
429
- avoidCollisions,
430
- collisionPadding,
431
- sticky,
432
- hideWhenDetached,
433
- containerSpacing
434
- }, /* @__PURE__ */ React.createElement(ScrollableContent, {
435
- ...{ containerSpacing, maxHeight, overflow }
436
- }, children)))
449
+ }, forwardRef) => /* @__PURE__ */ jsx(ContentProvider, { containerSpacing, children: /* @__PURE__ */ jsx(
450
+ StyledContent,
451
+ {
452
+ ...restProps,
453
+ ref: forwardRef,
454
+ loop,
455
+ side,
456
+ sideOffset,
457
+ align,
458
+ alignOffset,
459
+ avoidCollisions,
460
+ collisionPadding,
461
+ sticky,
462
+ hideWhenDetached,
463
+ containerSpacing,
464
+ children: /* @__PURE__ */ jsx(ScrollableContent, { ...{ containerSpacing, maxHeight, overflow }, children })
465
+ }
466
+ ) })
437
467
  );
438
468
 
439
469
  const StyledItem = styled(RadixDropdownMenu.Item, {
440
470
  ...itemDefaults,
441
471
  variants: {
472
+ // This is a hack for the :has() selector
473
+ // Remove it after Firefox implements it
442
474
  hasRightSlot: {
443
475
  true: {
444
476
  paddingRight: "$600"
@@ -450,25 +482,21 @@ const StyledItem = styled(RadixDropdownMenu.Item, {
450
482
  const Item = React.forwardRef(
451
483
  ({ disabled = false, ...restProps }, forwardRef) => {
452
484
  const ariaDisabledProps = useAriaDisabled(restProps);
453
- return /* @__PURE__ */ React.createElement(ItemProvider, null, /* @__PURE__ */ React.createElement(StyledItem, {
454
- ...restProps,
455
- ...ariaDisabledProps,
456
- disabled,
457
- ref: forwardRef
458
- }));
485
+ return /* @__PURE__ */ jsx(ItemProvider, { children: /* @__PURE__ */ jsx(
486
+ StyledItem,
487
+ {
488
+ ...restProps,
489
+ ...ariaDisabledProps,
490
+ disabled,
491
+ ref: forwardRef
492
+ }
493
+ ) });
459
494
  }
460
495
  );
461
496
 
462
497
  const LinkItem = React.forwardRef(({ children, href, ...restProps }, forwardRef) => {
463
498
  const ariaDisabledProps = useAriaDisabled(restProps);
464
- return /* @__PURE__ */ React.createElement(Item, {
465
- asChild: true,
466
- ref: forwardRef,
467
- ...restProps,
468
- ...ariaDisabledProps
469
- }, /* @__PURE__ */ React.createElement("a", {
470
- href
471
- }, children));
499
+ return /* @__PURE__ */ jsx(Item, { asChild: true, ref: forwardRef, ...restProps, ...ariaDisabledProps, children: /* @__PURE__ */ jsx("a", { href, children }) });
472
500
  });
473
501
 
474
502
  const StyledRadioGroup = styled(RadixDropdownMenu.RadioGroup, {
@@ -477,11 +505,14 @@ const StyledRadioGroup = styled(RadixDropdownMenu.RadioGroup, {
477
505
 
478
506
  const RadioGroup = React.forwardRef((props, forwardRef) => {
479
507
  const { onChange, ...restProps } = props;
480
- return /* @__PURE__ */ React.createElement(StyledRadioGroup, {
481
- ...restProps,
482
- ref: forwardRef,
483
- onValueChange: onChange
484
- });
508
+ return /* @__PURE__ */ jsx(
509
+ StyledRadioGroup,
510
+ {
511
+ ...restProps,
512
+ ref: forwardRef,
513
+ onValueChange: onChange
514
+ }
515
+ );
485
516
  });
486
517
 
487
518
  const StyledRadioContainer = styled(Primitive.div, {
@@ -540,26 +571,31 @@ const StyledRadioItem = styled(RadixDropdownMenu.RadioItem, {
540
571
  }
541
572
  });
542
573
 
543
- const RadioItem = React.forwardRef(({ disabled = false, children, ...restProps }, forwardRef) => {
544
- const ariaDisabledProps = useAriaDisabled(restProps, true);
545
- return /* @__PURE__ */ React.createElement(ItemProvider, null, /* @__PURE__ */ React.createElement(StyledRadioItem, {
546
- ...restProps,
547
- ...ariaDisabledProps,
548
- disabled,
549
- ref: forwardRef
550
- }, children, /* @__PURE__ */ React.createElement(RightSlot, null, /* @__PURE__ */ React.createElement(StyledRadioContainer, null, /* @__PURE__ */ React.createElement(StyledPill, null), /* @__PURE__ */ React.createElement(StyledProhibited, {
551
- weight: "thin"
552
- })))));
574
+ const RadioItem = React.forwardRef(({ disabled, children, closeOnSelect = false, ...restProps }, forwardRef) => {
575
+ const ariaDisabledProps = useAriaDisabled(restProps, closeOnSelect);
576
+ return /* @__PURE__ */ jsx(ItemProvider, { children: /* @__PURE__ */ jsxs(
577
+ StyledRadioItem,
578
+ {
579
+ ...restProps,
580
+ ...ariaDisabledProps,
581
+ disabled,
582
+ ref: forwardRef,
583
+ children: [
584
+ children,
585
+ /* @__PURE__ */ jsx(RightSlot, { children: /* @__PURE__ */ jsxs(StyledRadioContainer, { children: [
586
+ /* @__PURE__ */ jsx(StyledPill, {}),
587
+ /* @__PURE__ */ jsx(StyledProhibited, { weight: "thin" })
588
+ ] }) })
589
+ ]
590
+ }
591
+ ) });
553
592
  });
554
593
 
555
594
  const StyledSeparator = styled(RadixDropdownMenu.Separator, {
556
595
  borderTop: "1px solid $border-neutrals-subtle"
557
596
  });
558
597
 
559
- const Separator = React.forwardRef((props, forwardRef) => /* @__PURE__ */ React.createElement(StyledSeparator, {
560
- ...props,
561
- ref: forwardRef
562
- }));
598
+ const Separator = React.forwardRef((props, forwardRef) => /* @__PURE__ */ jsx(StyledSeparator, { ...props, ref: forwardRef }));
563
599
 
564
600
  const StyledSwitch = styled(Primitive.span, {
565
601
  ...styles.default,
@@ -578,16 +614,30 @@ const StyledSwitchItem = styled(RadixDropdownMenu.CheckboxItem, {
578
614
  });
579
615
 
580
616
  const SwitchItem = React.forwardRef(
581
- ({ disabled = false, checked, onChange, children, ...restProps }, forwardRef) => {
582
- const ariaDisabledProps = useAriaDisabled(restProps, true);
583
- return /* @__PURE__ */ React.createElement(ItemProvider, null, /* @__PURE__ */ React.createElement(StyledSwitchItem, {
584
- ...restProps,
585
- ...ariaDisabledProps,
586
- disabled,
587
- checked,
588
- onCheckedChange: onChange,
589
- ref: forwardRef
590
- }, children, /* @__PURE__ */ React.createElement(RightSlot, null, /* @__PURE__ */ React.createElement(StyledSwitch, null, /* @__PURE__ */ React.createElement(Thumb, null)))));
617
+ ({
618
+ disabled,
619
+ checked,
620
+ onChange,
621
+ children,
622
+ closeOnSelect = false,
623
+ ...restProps
624
+ }, forwardRef) => {
625
+ const ariaDisabledProps = useAriaDisabled(restProps, closeOnSelect);
626
+ return /* @__PURE__ */ jsx(ItemProvider, { children: /* @__PURE__ */ jsxs(
627
+ StyledSwitchItem,
628
+ {
629
+ ...restProps,
630
+ ...ariaDisabledProps,
631
+ disabled,
632
+ checked,
633
+ onCheckedChange: onChange,
634
+ ref: forwardRef,
635
+ children: [
636
+ children,
637
+ /* @__PURE__ */ jsx(RightSlot, { children: /* @__PURE__ */ jsx(StyledSwitch, { children: /* @__PURE__ */ jsx(Thumb, {}) }) })
638
+ ]
639
+ }
640
+ ) });
591
641
  }
592
642
  );
593
643
 
@@ -610,13 +660,16 @@ const StyledTrigger = styled(RadixDropdownMenu.Trigger, {
610
660
  }
611
661
  });
612
662
 
613
- const Trigger = React.forwardRef(({ asChild = false, onPress, onClick, ...restProps }, forwardRef) => /* @__PURE__ */ React.createElement(StyledTrigger, {
614
- ...restProps,
615
- onClick: onPress != null ? onPress : onClick,
616
- ref: forwardRef,
617
- unstyled: !asChild,
618
- asChild
619
- }));
663
+ const Trigger = React.forwardRef(({ asChild = false, onPress, onClick, ...restProps }, forwardRef) => /* @__PURE__ */ jsx(
664
+ StyledTrigger,
665
+ {
666
+ ...restProps,
667
+ onClick: onPress != null ? onPress : onClick,
668
+ ref: forwardRef,
669
+ unstyled: !asChild,
670
+ asChild
671
+ }
672
+ ));
620
673
 
621
674
  const StyledIconContainer = styled(Primitive.span, {
622
675
  color: "$icon-neutrals-with-text",
@@ -636,17 +689,25 @@ const SubTrigger = React.forwardRef(({ children, disabled = false, ...restProps
636
689
  onKeyDown: restProps.onKeyDown,
637
690
  "aria-disabled": restProps["aria-disabled"]
638
691
  });
639
- return /* @__PURE__ */ React.createElement(StyledSubTrigger, {
640
- ...restProps,
641
- ...ariaDisabledProps,
642
- disabled,
643
- ref: forwardRef
644
- }, children, /* @__PURE__ */ React.createElement(RightSlot, null, /* @__PURE__ */ React.createElement(StyledIconContainer, {
645
- "data-testid": process.env.NODE_ENV === "test" ? "submenu-arrow-icon" : void 0
646
- }, /* @__PURE__ */ React.createElement(IconChevronRight, {
647
- size: "small",
648
- weight: "thin"
649
- }))));
692
+ return /* @__PURE__ */ jsxs(
693
+ StyledSubTrigger,
694
+ {
695
+ ...restProps,
696
+ ...ariaDisabledProps,
697
+ disabled,
698
+ ref: forwardRef,
699
+ children: [
700
+ children,
701
+ /* @__PURE__ */ jsx(RightSlot, { children: /* @__PURE__ */ jsx(
702
+ StyledIconContainer,
703
+ {
704
+ "data-testid": process.env.NODE_ENV === "test" ? "submenu-arrow-icon" : void 0,
705
+ children: /* @__PURE__ */ jsx(IconChevronRight, { size: "small", weight: "thin" })
706
+ }
707
+ ) })
708
+ ]
709
+ }
710
+ );
650
711
  });
651
712
 
652
713
  const StyledSubContent = styled(
@@ -669,20 +730,20 @@ const SubContent = React.forwardRef(
669
730
  ...restProps
670
731
  }, forwardRef) => {
671
732
  const { containerSpacing } = useContent();
672
- return /* @__PURE__ */ React.createElement(ContentProvider, {
673
- containerSpacing
674
- }, /* @__PURE__ */ React.createElement(StyledSubContent, {
675
- ...restProps,
676
- ref: forwardRef,
677
- sideOffset,
678
- alignOffset,
679
- collisionPadding,
680
- loop,
681
- hideWhenDetached,
682
- sticky
683
- }, /* @__PURE__ */ React.createElement(ScrollableContent, {
684
- ...{ containerSpacing, maxHeight, overflow }
685
- }, children)));
733
+ return /* @__PURE__ */ jsx(ContentProvider, { containerSpacing, children: /* @__PURE__ */ jsx(
734
+ StyledSubContent,
735
+ {
736
+ ...restProps,
737
+ ref: forwardRef,
738
+ sideOffset,
739
+ alignOffset,
740
+ collisionPadding,
741
+ loop,
742
+ hideWhenDetached,
743
+ sticky,
744
+ children: /* @__PURE__ */ jsx(ScrollableContent, { ...{ containerSpacing, maxHeight, overflow }, children })
745
+ }
746
+ ) });
686
747
  }
687
748
  );
688
749
 
@@ -691,23 +752,24 @@ const StyledSub = styled(RadixDropdownMenu.Sub, {});
691
752
  const Sub = React.forwardRef(
692
753
  ({ defaultOpen, onOpen, onClose, open, ...restProps }, forwardRef) => {
693
754
  const [openState, setOpenState] = useState(defaultOpen);
694
- return /* @__PURE__ */ React.createElement(StyledSub, {
695
- ...restProps,
696
- open: open != null ? open : openState,
697
- onOpenChange: (newOpen) => {
698
- if (open == null) {
699
- setOpenState(newOpen);
700
- }
701
- newOpen ? onOpen == null ? void 0 : onOpen() : onClose == null ? void 0 : onClose();
702
- },
703
- ref: forwardRef
704
- });
755
+ return /* @__PURE__ */ jsx(
756
+ StyledSub,
757
+ {
758
+ ...restProps,
759
+ open: open != null ? open : openState,
760
+ onOpenChange: (newOpen) => {
761
+ if (open == null) {
762
+ setOpenState(newOpen);
763
+ }
764
+ newOpen ? onOpen == null ? void 0 : onOpen() : onClose == null ? void 0 : onClose();
765
+ },
766
+ ref: forwardRef
767
+ }
768
+ );
705
769
  }
706
770
  );
707
771
 
708
- const Portal = (props) => /* @__PURE__ */ React.createElement(Portal$1, {
709
- ...props
710
- });
772
+ const Portal = (props) => /* @__PURE__ */ jsx(Portal$1, { ...props });
711
773
 
712
774
  const StyledIconSlot = styled(LeftSlot, {
713
775
  square: "$5",
@@ -728,29 +790,20 @@ const IconSlot = React.forwardRef(({ children, ...restProps }, forwardRef) => {
728
790
  weight: "thin"
729
791
  }
730
792
  );
731
- useEffect(() => {
793
+ useLayoutEffect(() => {
732
794
  leftSlotMount();
733
795
  return () => leftSlotDestroy();
734
796
  }, [leftSlotMount, leftSlotDestroy]);
735
- return /* @__PURE__ */ React.createElement(StyledIconSlot, {
736
- ref: forwardRef,
737
- ...restProps
738
- }, /* @__PURE__ */ React.createElement(Primitive.svg, {
739
- asChild: true,
740
- "aria-hidden": true
741
- }, formattedChildren));
797
+ return /* @__PURE__ */ jsx(StyledIconSlot, { ref: forwardRef, ...restProps, children: /* @__PURE__ */ jsx(Primitive.svg, { asChild: true, "aria-hidden": true, children: formattedChildren }) });
742
798
  });
743
799
 
744
800
  const IllustrationSlot = React.forwardRef((props, forwardRef) => {
745
801
  const { leftSlotMount, leftSlotDestroy } = useItem();
746
- useEffect(() => {
802
+ useLayoutEffect(() => {
747
803
  leftSlotMount();
748
804
  return () => leftSlotDestroy();
749
805
  }, [leftSlotMount, leftSlotDestroy]);
750
- return /* @__PURE__ */ React.createElement(StyledIllustrationSlot, {
751
- ref: forwardRef,
752
- ...props
753
- });
806
+ return /* @__PURE__ */ jsx(StyledIllustrationSlot, { ref: forwardRef, ...props });
754
807
  });
755
808
 
756
809
  const DropdownMenu = ({
@@ -763,18 +816,21 @@ const DropdownMenu = ({
763
816
  ...restProps
764
817
  }) => {
765
818
  const [openState, setOpenState] = useState(defaultOpen);
766
- return /* @__PURE__ */ React.createElement(RadixDropdownMenu.Root, {
767
- ...restProps,
768
- dir: direction,
769
- modal: interactOutside,
770
- open: open != null ? open : openState,
771
- onOpenChange: (newOpen) => {
772
- if (open == null) {
773
- setOpenState(newOpen);
819
+ return /* @__PURE__ */ jsx(
820
+ RadixDropdownMenu.Root,
821
+ {
822
+ ...restProps,
823
+ dir: direction,
824
+ modal: interactOutside,
825
+ open: open != null ? open : openState,
826
+ onOpenChange: (newOpen) => {
827
+ if (open == null) {
828
+ setOpenState(newOpen);
829
+ }
830
+ newOpen ? onOpen == null ? void 0 : onOpen() : onClose == null ? void 0 : onClose();
774
831
  }
775
- newOpen ? onOpen == null ? void 0 : onOpen() : onClose == null ? void 0 : onClose();
776
832
  }
777
- });
833
+ );
778
834
  };
779
835
  DropdownMenu.CheckboxItem = CheckboxItem;
780
836
  DropdownMenu.Content = Content;