@mirohq/design-system-dropdown-menu 3.5.1 → 3.5.3

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
@@ -8,7 +8,7 @@ import { Primitive } from '@mirohq/design-system-primitive';
8
8
  import { styled, theme } from '@mirohq/design-system-stitches';
9
9
  import { focus, animations } from '@mirohq/design-system-styles';
10
10
  import { useLayoutEffect } from '@mirohq/design-system-use-layout-effect';
11
- import { ScrollArea } from '@mirohq/design-system-scroll-area';
11
+ import { ScrollArea } from '@mirohq/design-system';
12
12
  import { styles, Thumb } from '@mirohq/design-system-base-switch';
13
13
  import { isVirtualClick } from '@react-aria/utils';
14
14
  import { styles as styles$1, isIconComponent } from '@mirohq/design-system-base-icon';
@@ -80,7 +80,7 @@ const ContentProvider = ({
80
80
  );
81
81
  const formattedChildren = addPropsToChildren(children, () => true, {
82
82
  UNSAFE_style: {
83
- "--right-slot-max-width": `${Math.ceil(maxWidth)}px`
83
+ "--right-slot-max-width": "".concat(Math.ceil(maxWidth), "px")
84
84
  }
85
85
  });
86
86
  return /* @__PURE__ */ jsx(
@@ -142,8 +142,7 @@ const itemDefaults = {
142
142
  display: "grid",
143
143
  gridTemplateColumns: "auto 1fr minmax(min-content, var(--right-slot-max-width))",
144
144
  gridTemplateRows: "auto 1fr",
145
- gridTemplateAreas: `'left-slot item-text right-slot'
146
- 'left-slot item-description right-slot'`,
145
+ gridTemplateAreas: "'left-slot item-text right-slot'\n 'left-slot item-description right-slot'",
147
146
  alignItems: "start",
148
147
  padding: "10px $100",
149
148
  position: "relative",
@@ -151,14 +150,7 @@ const itemDefaults = {
151
150
  cursor: "pointer",
152
151
  "&[data-no-left-slot]": {
153
152
  gridTemplateColumns: "1fr minmax(auto, var(--right-slot-max-width))",
154
- gridTemplateAreas: `'item-text right-slot'
155
- 'item-description right-slot'`
156
- },
157
- "&:not(:last-child)": {
158
- marginBottom: "$50"
159
- },
160
- "&:not(:first-child)": {
161
- marginTop: "$50"
153
+ gridTemplateAreas: "'item-text right-slot'\n 'item-description right-slot'"
162
154
  },
163
155
  ...focus.css({
164
156
  boxShadow: "$focus-small",
@@ -166,10 +158,10 @@ const itemDefaults = {
166
158
  }),
167
159
  '&:disabled, &[aria-disabled="true"], &[data-disabled]': {
168
160
  cursor: "default",
169
- [`&, & ${ItemDescription}, & ${HotkeySlot}`]: {
161
+ ["&, & ".concat(ItemDescription, ", & ").concat(HotkeySlot)]: {
170
162
  color: "$text-neutrals-disabled"
171
163
  },
172
- [`& ${StyledIllustrationSlot}`]: {
164
+ ["& ".concat(StyledIllustrationSlot)]: {
173
165
  filter: "grayscale(1)"
174
166
  }
175
167
  },
@@ -200,16 +192,13 @@ const StyledIndicator = styled(Primitive.span, {
200
192
  });
201
193
  const StyledCheckboxItem = styled(RadixDropdownMenu.CheckboxItem, {
202
194
  ...itemDefaults,
203
- [`&[data-state="checked"] ${StyledIndicator}`]: {
195
+ ['&[data-state="checked"] '.concat(StyledIndicator)]: {
204
196
  color: "$icon-primary"
205
197
  },
206
- [`&[data-state="checked"]:hover:not([aria-disabled="true"]) ${StyledIndicator}`]: {
198
+ ['&[data-state="checked"]:hover:not([aria-disabled="true"]) '.concat(StyledIndicator)]: {
207
199
  color: "$icon-primary-hover"
208
200
  },
209
- [`
210
- &[aria-disabled="true"] ${StyledIndicator},
211
- &[data-disabled] ${StyledIndicator}
212
- `]: {
201
+ ['\n &[aria-disabled="true"] '.concat(StyledIndicator, ",\n &[data-disabled] ").concat(StyledIndicator, "\n ")]: {
213
202
  color: "$icon-neutrals-disabled"
214
203
  }
215
204
  });
@@ -329,6 +318,7 @@ const CheckboxItem = React.forwardRef(
329
318
  }
330
319
  );
331
320
 
321
+ const CONTENT_GAP = "$50";
332
322
  const CONTENT_GUTTER = parseInt(theme.space[150]);
333
323
  const CONTENT_OFFSET = parseInt(theme.space[50]);
334
324
  const CONTENT_BORDER_FOCUS_ITEM = "2px";
@@ -343,7 +333,7 @@ const contentDefaults = {
343
333
  borderRadius: "$50",
344
334
  boxShadow: "$50",
345
335
  "& [data-radix-scroll-area-viewport]": {
346
- padding: `${CONTENT_BORDER_FOCUS_ITEM} $50 ${CONTENT_BORDER_FOCUS_ITEM} ${CONTENT_BORDER_FOCUS_ITEM}`,
336
+ padding: "".concat(CONTENT_BORDER_FOCUS_ITEM, " $50 ").concat(CONTENT_BORDER_FOCUS_ITEM, " ").concat(CONTENT_BORDER_FOCUS_ITEM),
347
337
  boxSizing: "border-box"
348
338
  },
349
339
  "@media (prefers-reduced-motion: no-preference)": {
@@ -377,6 +367,10 @@ const contentDefaults = {
377
367
  zIndex: "$dropdownMenu"
378
368
  };
379
369
 
370
+ const StyledItemsContainer = styled("div", {
371
+ display: "grid",
372
+ gap: CONTENT_GAP
373
+ });
380
374
  const StyledContent = styled(RadixDropdownMenu.Content, {
381
375
  ...contentDefaults,
382
376
  variants: {
@@ -408,9 +402,9 @@ const ScrollableContent = ({
408
402
  }) => {
409
403
  const getOverflowMaxHeight = useCallback(() => {
410
404
  const [top, , bottom] = CONTENT_PADDING[containerSpacing].split(" ").map((value) => value.replace("$", ""));
411
- const topBottom = top !== void 0 && bottom !== void 0 ? `var(--space-${top}) + var(--space-${bottom})` : `var(--space-${top}) + var(--space-${top})`;
412
- const overflowMaxHeigh = overflow === "auto" ? `calc(var(--radix-dropdown-menu-content-available-height) - (${topBottom}))` : "auto";
413
- const newMaxHeight = `calc(${maxHeight} - (${topBottom}))`;
405
+ const topBottom = top !== void 0 && bottom !== void 0 ? "var(--space-".concat(top, ") + var(--space-").concat(bottom, ")") : "var(--space-".concat(top, ") + var(--space-").concat(top, ")");
406
+ const overflowMaxHeigh = overflow === "auto" ? "calc(var(--radix-dropdown-menu-content-available-height) - (".concat(topBottom, "))") : "auto";
407
+ const newMaxHeight = "calc(".concat(maxHeight, " - (").concat(topBottom, "))");
414
408
  return {
415
409
  maxHeight: maxHeight === void 0 ? overflowMaxHeigh : newMaxHeight
416
410
  };
@@ -419,7 +413,7 @@ const ScrollableContent = ({
419
413
  return /* @__PURE__ */ jsxs(
420
414
  ScrollArea,
421
415
  {
422
- css: { margin: `-${CONTENT_BORDER_FOCUS_ITEM}` },
416
+ css: { margin: "-".concat(CONTENT_BORDER_FOCUS_ITEM) },
423
417
  type: "always",
424
418
  children: [
425
419
  /* @__PURE__ */ jsx(ScrollArea.Viewport, { css: { ...getOverflowMaxHeight() }, children }),
@@ -462,7 +456,7 @@ const Content = React.forwardRef(
462
456
  sticky,
463
457
  hideWhenDetached,
464
458
  containerSpacing,
465
- children: /* @__PURE__ */ jsx(ScrollableContent, { ...{ containerSpacing, maxHeight, overflow }, children })
459
+ children: /* @__PURE__ */ jsx(ScrollableContent, { ...{ containerSpacing, maxHeight, overflow }, children: /* @__PURE__ */ jsx(StyledItemsContainer, { children }) })
466
460
  }
467
461
  ) })
468
462
  );
@@ -501,7 +495,8 @@ const LinkItem = React.forwardRef(({ children, href, ...restProps }, forwardRef)
501
495
  });
502
496
 
503
497
  const StyledRadioGroup = styled(RadixDropdownMenu.RadioGroup, {
504
- marginY: "$50"
498
+ display: "grid",
499
+ gap: CONTENT_GAP
505
500
  });
506
501
 
507
502
  const RadioGroup = React.forwardRef((props, forwardRef) => {
@@ -538,35 +533,29 @@ const StyledProhibited = styled(IconProhibit, {
538
533
  });
539
534
  const StyledRadioItem = styled(RadixDropdownMenu.RadioItem, {
540
535
  ...itemDefaults,
541
- [`&[data-state="checked"] ${StyledRadioContainer}`]: {
536
+ ['&[data-state="checked"] '.concat(StyledRadioContainer)]: {
542
537
  color: "$icon-primary",
543
538
  borderColor: "$border-primary",
544
- [`& ${StyledPill}`]: {
539
+ ["& ".concat(StyledPill)]: {
545
540
  display: "block",
546
541
  backgroundColor: "$background-primary-prominent-selected"
547
542
  }
548
543
  },
549
- [`&:hover:not([aria-disabled="true"]) ${StyledRadioContainer}`]: {
544
+ ['&:hover:not([aria-disabled="true"]) '.concat(StyledRadioContainer)]: {
550
545
  borderColor: "$border-primary-hover",
551
- [`& ${StyledPill}`]: {
546
+ ["& ".concat(StyledPill)]: {
552
547
  backgroundColor: "$background-primary-prominent-hover"
553
548
  }
554
549
  },
555
- [`
556
- &[aria-disabled="true"] ${StyledRadioContainer},
557
- &[data-disabled] ${StyledRadioContainer}
558
- `]: {
550
+ ['\n &[aria-disabled="true"] '.concat(StyledRadioContainer, ",\n &[data-disabled] ").concat(StyledRadioContainer, "\n ")]: {
559
551
  color: "$icon-neutrals-disabled",
560
552
  borderColor: "$border-neutrals-disabled",
561
- [`& ${StyledPill}`]: {
553
+ ["& ".concat(StyledPill)]: {
562
554
  backgroundColor: "$icon-neutrals-disabled"
563
555
  }
564
556
  },
565
557
  '&[data-state="unchecked"]': {
566
- [`
567
- &[aria-disabled="true"] ${StyledProhibited},
568
- &[data-disabled] ${StyledProhibited}
569
- `]: {
558
+ ['\n &[aria-disabled="true"] '.concat(StyledProhibited, ",\n &[data-disabled] ").concat(StyledProhibited, "\n ")]: {
570
559
  display: "flex"
571
560
  }
572
561
  }
@@ -605,13 +594,10 @@ const StyledSwitch = styled(Primitive.span, {
605
594
  });
606
595
  const StyledSwitchItem = styled(RadixDropdownMenu.CheckboxItem, {
607
596
  ...itemDefaults,
608
- [`&[data-state="checked"] ${StyledSwitch}`]: styles.checked,
609
- [`&[data-state="checked"]:hover:not([aria-disabled="true"]) ${StyledSwitch}`]: styles.checkedHovered,
610
- [`&:hover:not([aria-disabled="true"]) ${StyledSwitch}`]: styles.hovered,
611
- [`
612
- &[aria-disabled="true"] ${StyledSwitch},
613
- &[data-disabled] ${StyledSwitch}
614
- `]: styles.disabled
597
+ ['&[data-state="checked"] '.concat(StyledSwitch)]: styles.checked,
598
+ ['&[data-state="checked"]:hover:not([aria-disabled="true"]) '.concat(StyledSwitch)]: styles.checkedHovered,
599
+ ['&:hover:not([aria-disabled="true"]) '.concat(StyledSwitch)]: styles.hovered,
600
+ ['\n &[aria-disabled="true"] '.concat(StyledSwitch, ",\n &[data-disabled] ").concat(StyledSwitch, "\n ")]: styles.disabled
615
601
  });
616
602
 
617
603
  const SwitchItem = React.forwardRef(
@@ -696,7 +682,7 @@ const StyledIconContainer = styled(Primitive.span, {
696
682
  const StyledSubTrigger = styled(RadixDropdownMenu.SubTrigger, {
697
683
  ...itemDefaults,
698
684
  '&[data-state="open"]': itemDefaults['&:hover:not([aria-disabled="true"])'],
699
- [`&[data-state="open"] ${StyledIconContainer}, &:hover:not([aria-disabled="true"]) ${StyledIconContainer}`]: {
685
+ ['&[data-state="open"] '.concat(StyledIconContainer, ', &:hover:not([aria-disabled="true"]) ').concat(StyledIconContainer)]: {
700
686
  color: "$icon-primary-hover"
701
687
  }
702
688
  });
@@ -758,7 +744,7 @@ const SubContent = React.forwardRef(
758
744
  loop,
759
745
  hideWhenDetached,
760
746
  sticky,
761
- children: /* @__PURE__ */ jsx(ScrollableContent, { ...{ containerSpacing, maxHeight, overflow }, children })
747
+ children: /* @__PURE__ */ jsx(ScrollableContent, { ...{ containerSpacing, maxHeight, overflow }, children: /* @__PURE__ */ jsx(StyledItemsContainer, { children }) })
762
748
  }
763
749
  ) });
764
750
  }