@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/main.js +38 -52
- package/dist/main.js.map +1 -1
- package/dist/module.js +35 -49
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +3 -3
- package/package.json +4 -4
package/dist/main.js
CHANGED
|
@@ -11,7 +11,7 @@ var designSystemPrimitive = require('@mirohq/design-system-primitive');
|
|
|
11
11
|
var designSystemStitches = require('@mirohq/design-system-stitches');
|
|
12
12
|
var designSystemStyles = require('@mirohq/design-system-styles');
|
|
13
13
|
var designSystemUseLayoutEffect = require('@mirohq/design-system-use-layout-effect');
|
|
14
|
-
var
|
|
14
|
+
var designSystem = require('@mirohq/design-system');
|
|
15
15
|
var designSystemBaseSwitch = require('@mirohq/design-system-base-switch');
|
|
16
16
|
var utils = require('@react-aria/utils');
|
|
17
17
|
var designSystemBaseIcon = require('@mirohq/design-system-base-icon');
|
|
@@ -106,7 +106,7 @@ const ContentProvider = ({
|
|
|
106
106
|
);
|
|
107
107
|
const formattedChildren = designSystemUtils.addPropsToChildren(children, () => true, {
|
|
108
108
|
UNSAFE_style: {
|
|
109
|
-
"--right-slot-max-width":
|
|
109
|
+
"--right-slot-max-width": "".concat(Math.ceil(maxWidth), "px")
|
|
110
110
|
}
|
|
111
111
|
});
|
|
112
112
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -168,8 +168,7 @@ const itemDefaults = {
|
|
|
168
168
|
display: "grid",
|
|
169
169
|
gridTemplateColumns: "auto 1fr minmax(min-content, var(--right-slot-max-width))",
|
|
170
170
|
gridTemplateRows: "auto 1fr",
|
|
171
|
-
gridTemplateAreas:
|
|
172
|
-
'left-slot item-description right-slot'`,
|
|
171
|
+
gridTemplateAreas: "'left-slot item-text right-slot'\n 'left-slot item-description right-slot'",
|
|
173
172
|
alignItems: "start",
|
|
174
173
|
padding: "10px $100",
|
|
175
174
|
position: "relative",
|
|
@@ -177,14 +176,7 @@ const itemDefaults = {
|
|
|
177
176
|
cursor: "pointer",
|
|
178
177
|
"&[data-no-left-slot]": {
|
|
179
178
|
gridTemplateColumns: "1fr minmax(auto, var(--right-slot-max-width))",
|
|
180
|
-
gridTemplateAreas:
|
|
181
|
-
'item-description right-slot'`
|
|
182
|
-
},
|
|
183
|
-
"&:not(:last-child)": {
|
|
184
|
-
marginBottom: "$50"
|
|
185
|
-
},
|
|
186
|
-
"&:not(:first-child)": {
|
|
187
|
-
marginTop: "$50"
|
|
179
|
+
gridTemplateAreas: "'item-text right-slot'\n 'item-description right-slot'"
|
|
188
180
|
},
|
|
189
181
|
...designSystemStyles.focus.css({
|
|
190
182
|
boxShadow: "$focus-small",
|
|
@@ -192,10 +184,10 @@ const itemDefaults = {
|
|
|
192
184
|
}),
|
|
193
185
|
'&:disabled, &[aria-disabled="true"], &[data-disabled]': {
|
|
194
186
|
cursor: "default",
|
|
195
|
-
[
|
|
187
|
+
["&, & ".concat(ItemDescription, ", & ").concat(HotkeySlot)]: {
|
|
196
188
|
color: "$text-neutrals-disabled"
|
|
197
189
|
},
|
|
198
|
-
[
|
|
190
|
+
["& ".concat(StyledIllustrationSlot)]: {
|
|
199
191
|
filter: "grayscale(1)"
|
|
200
192
|
}
|
|
201
193
|
},
|
|
@@ -226,16 +218,13 @@ const StyledIndicator = designSystemStitches.styled(designSystemPrimitive.Primit
|
|
|
226
218
|
});
|
|
227
219
|
const StyledCheckboxItem = designSystemStitches.styled(RadixDropdownMenu__namespace.CheckboxItem, {
|
|
228
220
|
...itemDefaults,
|
|
229
|
-
[
|
|
221
|
+
['&[data-state="checked"] '.concat(StyledIndicator)]: {
|
|
230
222
|
color: "$icon-primary"
|
|
231
223
|
},
|
|
232
|
-
[
|
|
224
|
+
['&[data-state="checked"]:hover:not([aria-disabled="true"]) '.concat(StyledIndicator)]: {
|
|
233
225
|
color: "$icon-primary-hover"
|
|
234
226
|
},
|
|
235
|
-
[
|
|
236
|
-
&[aria-disabled="true"] ${StyledIndicator},
|
|
237
|
-
&[data-disabled] ${StyledIndicator}
|
|
238
|
-
`]: {
|
|
227
|
+
['\n &[aria-disabled="true"] '.concat(StyledIndicator, ",\n &[data-disabled] ").concat(StyledIndicator, "\n ")]: {
|
|
239
228
|
color: "$icon-neutrals-disabled"
|
|
240
229
|
}
|
|
241
230
|
});
|
|
@@ -355,6 +344,7 @@ const CheckboxItem = React__default["default"].forwardRef(
|
|
|
355
344
|
}
|
|
356
345
|
);
|
|
357
346
|
|
|
347
|
+
const CONTENT_GAP = "$50";
|
|
358
348
|
const CONTENT_GUTTER = parseInt(designSystemStitches.theme.space[150]);
|
|
359
349
|
const CONTENT_OFFSET = parseInt(designSystemStitches.theme.space[50]);
|
|
360
350
|
const CONTENT_BORDER_FOCUS_ITEM = "2px";
|
|
@@ -369,7 +359,7 @@ const contentDefaults = {
|
|
|
369
359
|
borderRadius: "$50",
|
|
370
360
|
boxShadow: "$50",
|
|
371
361
|
"& [data-radix-scroll-area-viewport]": {
|
|
372
|
-
padding:
|
|
362
|
+
padding: "".concat(CONTENT_BORDER_FOCUS_ITEM, " $50 ").concat(CONTENT_BORDER_FOCUS_ITEM, " ").concat(CONTENT_BORDER_FOCUS_ITEM),
|
|
373
363
|
boxSizing: "border-box"
|
|
374
364
|
},
|
|
375
365
|
"@media (prefers-reduced-motion: no-preference)": {
|
|
@@ -403,6 +393,10 @@ const contentDefaults = {
|
|
|
403
393
|
zIndex: "$dropdownMenu"
|
|
404
394
|
};
|
|
405
395
|
|
|
396
|
+
const StyledItemsContainer = designSystemStitches.styled("div", {
|
|
397
|
+
display: "grid",
|
|
398
|
+
gap: CONTENT_GAP
|
|
399
|
+
});
|
|
406
400
|
const StyledContent = designSystemStitches.styled(RadixDropdownMenu__namespace.Content, {
|
|
407
401
|
...contentDefaults,
|
|
408
402
|
variants: {
|
|
@@ -434,22 +428,22 @@ const ScrollableContent = ({
|
|
|
434
428
|
}) => {
|
|
435
429
|
const getOverflowMaxHeight = React.useCallback(() => {
|
|
436
430
|
const [top, , bottom] = CONTENT_PADDING[containerSpacing].split(" ").map((value) => value.replace("$", ""));
|
|
437
|
-
const topBottom = top !== void 0 && bottom !== void 0 ?
|
|
438
|
-
const overflowMaxHeigh = overflow === "auto" ?
|
|
439
|
-
const newMaxHeight =
|
|
431
|
+
const topBottom = top !== void 0 && bottom !== void 0 ? "var(--space-".concat(top, ") + var(--space-").concat(bottom, ")") : "var(--space-".concat(top, ") + var(--space-").concat(top, ")");
|
|
432
|
+
const overflowMaxHeigh = overflow === "auto" ? "calc(var(--radix-dropdown-menu-content-available-height) - (".concat(topBottom, "))") : "auto";
|
|
433
|
+
const newMaxHeight = "calc(".concat(maxHeight, " - (").concat(topBottom, "))");
|
|
440
434
|
return {
|
|
441
435
|
maxHeight: maxHeight === void 0 ? overflowMaxHeigh : newMaxHeight
|
|
442
436
|
};
|
|
443
437
|
}, [maxHeight, overflow, containerSpacing]);
|
|
444
438
|
if (overflow === "auto") {
|
|
445
439
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
446
|
-
|
|
440
|
+
designSystem.ScrollArea,
|
|
447
441
|
{
|
|
448
|
-
css: { margin:
|
|
442
|
+
css: { margin: "-".concat(CONTENT_BORDER_FOCUS_ITEM) },
|
|
449
443
|
type: "always",
|
|
450
444
|
children: [
|
|
451
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
452
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
445
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.ScrollArea.Viewport, { css: { ...getOverflowMaxHeight() }, children }),
|
|
446
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.ScrollArea.Scrollbar, { orientation: "vertical", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.ScrollArea.Thumb, {}) })
|
|
453
447
|
]
|
|
454
448
|
}
|
|
455
449
|
);
|
|
@@ -488,7 +482,7 @@ const Content = React__default["default"].forwardRef(
|
|
|
488
482
|
sticky,
|
|
489
483
|
hideWhenDetached,
|
|
490
484
|
containerSpacing,
|
|
491
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(ScrollableContent, { ...{ containerSpacing, maxHeight, overflow }, children })
|
|
485
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ScrollableContent, { ...{ containerSpacing, maxHeight, overflow }, children: /* @__PURE__ */ jsxRuntime.jsx(StyledItemsContainer, { children }) })
|
|
492
486
|
}
|
|
493
487
|
) })
|
|
494
488
|
);
|
|
@@ -527,7 +521,8 @@ const LinkItem = React__default["default"].forwardRef(({ children, href, ...rest
|
|
|
527
521
|
});
|
|
528
522
|
|
|
529
523
|
const StyledRadioGroup = designSystemStitches.styled(RadixDropdownMenu__namespace.RadioGroup, {
|
|
530
|
-
|
|
524
|
+
display: "grid",
|
|
525
|
+
gap: CONTENT_GAP
|
|
531
526
|
});
|
|
532
527
|
|
|
533
528
|
const RadioGroup = React__default["default"].forwardRef((props, forwardRef) => {
|
|
@@ -564,35 +559,29 @@ const StyledProhibited = designSystemStitches.styled(designSystemIcons.IconProhi
|
|
|
564
559
|
});
|
|
565
560
|
const StyledRadioItem = designSystemStitches.styled(RadixDropdownMenu__namespace.RadioItem, {
|
|
566
561
|
...itemDefaults,
|
|
567
|
-
[
|
|
562
|
+
['&[data-state="checked"] '.concat(StyledRadioContainer)]: {
|
|
568
563
|
color: "$icon-primary",
|
|
569
564
|
borderColor: "$border-primary",
|
|
570
|
-
[
|
|
565
|
+
["& ".concat(StyledPill)]: {
|
|
571
566
|
display: "block",
|
|
572
567
|
backgroundColor: "$background-primary-prominent-selected"
|
|
573
568
|
}
|
|
574
569
|
},
|
|
575
|
-
[
|
|
570
|
+
['&:hover:not([aria-disabled="true"]) '.concat(StyledRadioContainer)]: {
|
|
576
571
|
borderColor: "$border-primary-hover",
|
|
577
|
-
[
|
|
572
|
+
["& ".concat(StyledPill)]: {
|
|
578
573
|
backgroundColor: "$background-primary-prominent-hover"
|
|
579
574
|
}
|
|
580
575
|
},
|
|
581
|
-
[
|
|
582
|
-
&[aria-disabled="true"] ${StyledRadioContainer},
|
|
583
|
-
&[data-disabled] ${StyledRadioContainer}
|
|
584
|
-
`]: {
|
|
576
|
+
['\n &[aria-disabled="true"] '.concat(StyledRadioContainer, ",\n &[data-disabled] ").concat(StyledRadioContainer, "\n ")]: {
|
|
585
577
|
color: "$icon-neutrals-disabled",
|
|
586
578
|
borderColor: "$border-neutrals-disabled",
|
|
587
|
-
[
|
|
579
|
+
["& ".concat(StyledPill)]: {
|
|
588
580
|
backgroundColor: "$icon-neutrals-disabled"
|
|
589
581
|
}
|
|
590
582
|
},
|
|
591
583
|
'&[data-state="unchecked"]': {
|
|
592
|
-
[
|
|
593
|
-
&[aria-disabled="true"] ${StyledProhibited},
|
|
594
|
-
&[data-disabled] ${StyledProhibited}
|
|
595
|
-
`]: {
|
|
584
|
+
['\n &[aria-disabled="true"] '.concat(StyledProhibited, ",\n &[data-disabled] ").concat(StyledProhibited, "\n ")]: {
|
|
596
585
|
display: "flex"
|
|
597
586
|
}
|
|
598
587
|
}
|
|
@@ -631,13 +620,10 @@ const StyledSwitch = designSystemStitches.styled(designSystemPrimitive.Primitive
|
|
|
631
620
|
});
|
|
632
621
|
const StyledSwitchItem = designSystemStitches.styled(RadixDropdownMenu__namespace.CheckboxItem, {
|
|
633
622
|
...itemDefaults,
|
|
634
|
-
[
|
|
635
|
-
[
|
|
636
|
-
[
|
|
637
|
-
[
|
|
638
|
-
&[aria-disabled="true"] ${StyledSwitch},
|
|
639
|
-
&[data-disabled] ${StyledSwitch}
|
|
640
|
-
`]: designSystemBaseSwitch.styles.disabled
|
|
623
|
+
['&[data-state="checked"] '.concat(StyledSwitch)]: designSystemBaseSwitch.styles.checked,
|
|
624
|
+
['&[data-state="checked"]:hover:not([aria-disabled="true"]) '.concat(StyledSwitch)]: designSystemBaseSwitch.styles.checkedHovered,
|
|
625
|
+
['&:hover:not([aria-disabled="true"]) '.concat(StyledSwitch)]: designSystemBaseSwitch.styles.hovered,
|
|
626
|
+
['\n &[aria-disabled="true"] '.concat(StyledSwitch, ",\n &[data-disabled] ").concat(StyledSwitch, "\n ")]: designSystemBaseSwitch.styles.disabled
|
|
641
627
|
});
|
|
642
628
|
|
|
643
629
|
const SwitchItem = React__default["default"].forwardRef(
|
|
@@ -722,7 +708,7 @@ const StyledIconContainer = designSystemStitches.styled(designSystemPrimitive.Pr
|
|
|
722
708
|
const StyledSubTrigger = designSystemStitches.styled(RadixDropdownMenu__namespace.SubTrigger, {
|
|
723
709
|
...itemDefaults,
|
|
724
710
|
'&[data-state="open"]': itemDefaults['&:hover:not([aria-disabled="true"])'],
|
|
725
|
-
[
|
|
711
|
+
['&[data-state="open"] '.concat(StyledIconContainer, ', &:hover:not([aria-disabled="true"]) ').concat(StyledIconContainer)]: {
|
|
726
712
|
color: "$icon-primary-hover"
|
|
727
713
|
}
|
|
728
714
|
});
|
|
@@ -784,7 +770,7 @@ const SubContent = React__default["default"].forwardRef(
|
|
|
784
770
|
loop,
|
|
785
771
|
hideWhenDetached,
|
|
786
772
|
sticky,
|
|
787
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(ScrollableContent, { ...{ containerSpacing, maxHeight, overflow }, children })
|
|
773
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ScrollableContent, { ...{ containerSpacing, maxHeight, overflow }, children: /* @__PURE__ */ jsxRuntime.jsx(StyledItemsContainer, { children }) })
|
|
788
774
|
}
|
|
789
775
|
) });
|
|
790
776
|
}
|