@mirohq/design-system-dropdown-menu 3.3.4-use-press.2 → 3.4.1
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 +78 -76
- package/dist/main.js.map +1 -1
- package/dist/module.js +78 -76
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +12 -0
- package/package.json +9 -9
package/dist/main.js
CHANGED
|
@@ -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,8 +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'`
|
|
179
|
+
gridTemplateAreas: "'item-text right-slot'\n 'item-description right-slot'"
|
|
182
180
|
},
|
|
183
181
|
"&:not(:last-child)": {
|
|
184
182
|
marginBottom: "$50"
|
|
@@ -192,10 +190,10 @@ const itemDefaults = {
|
|
|
192
190
|
}),
|
|
193
191
|
'&:disabled, &[aria-disabled="true"], &[data-disabled]': {
|
|
194
192
|
cursor: "default",
|
|
195
|
-
[
|
|
193
|
+
["&, & ".concat(ItemDescription, ", & ").concat(HotkeySlot)]: {
|
|
196
194
|
color: "$text-neutrals-disabled"
|
|
197
195
|
},
|
|
198
|
-
[
|
|
196
|
+
["& ".concat(StyledIllustrationSlot)]: {
|
|
199
197
|
filter: "grayscale(1)"
|
|
200
198
|
}
|
|
201
199
|
},
|
|
@@ -226,16 +224,13 @@ const StyledIndicator = designSystemStitches.styled(designSystemPrimitive.Primit
|
|
|
226
224
|
});
|
|
227
225
|
const StyledCheckboxItem = designSystemStitches.styled(RadixDropdownMenu__namespace.CheckboxItem, {
|
|
228
226
|
...itemDefaults,
|
|
229
|
-
[
|
|
227
|
+
['&[data-state="checked"] '.concat(StyledIndicator)]: {
|
|
230
228
|
color: "$icon-primary"
|
|
231
229
|
},
|
|
232
|
-
[
|
|
230
|
+
['&[data-state="checked"]:hover:not([aria-disabled="true"]) '.concat(StyledIndicator)]: {
|
|
233
231
|
color: "$icon-primary-hover"
|
|
234
232
|
},
|
|
235
|
-
[
|
|
236
|
-
&[aria-disabled="true"] ${StyledIndicator},
|
|
237
|
-
&[data-disabled] ${StyledIndicator}
|
|
238
|
-
`]: {
|
|
233
|
+
['\n &[aria-disabled="true"] '.concat(StyledIndicator, ",\n &[data-disabled] ").concat(StyledIndicator, "\n ")]: {
|
|
239
234
|
color: "$icon-neutrals-disabled"
|
|
240
235
|
}
|
|
241
236
|
});
|
|
@@ -246,7 +241,7 @@ const useAriaDisabled = ({
|
|
|
246
241
|
onSelect,
|
|
247
242
|
onPointerMove,
|
|
248
243
|
onClick
|
|
249
|
-
},
|
|
244
|
+
}, closeOnCheck = true) => React.useMemo(
|
|
250
245
|
() => ({
|
|
251
246
|
"aria-disabled": designSystemUtils.booleanify(ariaDisabled) ? ariaDisabled : void 0,
|
|
252
247
|
onKeyDown: (e) => {
|
|
@@ -258,13 +253,13 @@ const useAriaDisabled = ({
|
|
|
258
253
|
onKeyDown == null ? void 0 : onKeyDown(e);
|
|
259
254
|
},
|
|
260
255
|
onSelect: (e) => {
|
|
261
|
-
if (preventDefault) {
|
|
262
|
-
e.preventDefault();
|
|
263
|
-
}
|
|
264
256
|
if (designSystemUtils.booleanify(ariaDisabled)) {
|
|
265
257
|
e.preventDefault();
|
|
266
258
|
return;
|
|
267
259
|
}
|
|
260
|
+
if (!closeOnCheck) {
|
|
261
|
+
e.preventDefault();
|
|
262
|
+
}
|
|
268
263
|
onSelect == null ? void 0 : onSelect(e);
|
|
269
264
|
},
|
|
270
265
|
onPointerMove: (e) => {
|
|
@@ -282,7 +277,7 @@ const useAriaDisabled = ({
|
|
|
282
277
|
onClick == null ? void 0 : onClick(e);
|
|
283
278
|
}
|
|
284
279
|
}),
|
|
285
|
-
[ariaDisabled, onKeyDown, onSelect, onPointerMove, onClick,
|
|
280
|
+
[ariaDisabled, onKeyDown, onSelect, onPointerMove, onClick, closeOnCheck]
|
|
286
281
|
);
|
|
287
282
|
|
|
288
283
|
const Context = React.createContext({
|
|
@@ -317,34 +312,43 @@ const ItemProvider = ({
|
|
|
317
312
|
};
|
|
318
313
|
const useItem = () => React.useContext(Context);
|
|
319
314
|
|
|
320
|
-
const CheckboxItem = React__default["default"].forwardRef(
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
}
|
|
315
|
+
const CheckboxItem = React__default["default"].forwardRef(
|
|
316
|
+
({
|
|
317
|
+
children,
|
|
318
|
+
checked,
|
|
319
|
+
onChange,
|
|
320
|
+
disabled,
|
|
321
|
+
closeOnSelect = false,
|
|
322
|
+
...restProps
|
|
323
|
+
}, forwardRef) => {
|
|
324
|
+
const ariaDisabledProps = useAriaDisabled(restProps, closeOnSelect);
|
|
325
|
+
const { "aria-disabled": ariaDisabled } = ariaDisabledProps;
|
|
326
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ItemProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
327
|
+
StyledCheckboxItem,
|
|
328
|
+
{
|
|
329
|
+
...restProps,
|
|
330
|
+
...ariaDisabledProps,
|
|
331
|
+
ref: forwardRef,
|
|
332
|
+
checked,
|
|
333
|
+
disabled,
|
|
334
|
+
onCheckedChange: onChange,
|
|
335
|
+
children: [
|
|
336
|
+
children,
|
|
337
|
+
/* @__PURE__ */ jsxRuntime.jsx(RightSlot, { children: /* @__PURE__ */ jsxRuntime.jsxs(StyledIndicator, { children: [
|
|
338
|
+
(disabled === true || designSystemUtils.booleanify(ariaDisabled)) && !checked && /* @__PURE__ */ jsxRuntime.jsx(
|
|
339
|
+
designSystemIcons.IconProhibit,
|
|
340
|
+
{
|
|
341
|
+
weight: "thin",
|
|
342
|
+
css: { square: "$3", display: "block" }
|
|
343
|
+
}
|
|
344
|
+
),
|
|
345
|
+
checked && /* @__PURE__ */ jsxRuntime.jsx(designSystemIcons.IconCheckMark, { css: { square: "$3", display: "block" } })
|
|
346
|
+
] }) })
|
|
347
|
+
]
|
|
348
|
+
}
|
|
349
|
+
) });
|
|
350
|
+
}
|
|
351
|
+
);
|
|
348
352
|
|
|
349
353
|
const CONTENT_GUTTER = parseInt(designSystemStitches.theme.space[150]);
|
|
350
354
|
const CONTENT_OFFSET = parseInt(designSystemStitches.theme.space[50]);
|
|
@@ -360,7 +364,7 @@ const contentDefaults = {
|
|
|
360
364
|
borderRadius: "$50",
|
|
361
365
|
boxShadow: "$50",
|
|
362
366
|
"& [data-radix-scroll-area-viewport]": {
|
|
363
|
-
padding:
|
|
367
|
+
padding: "".concat(CONTENT_BORDER_FOCUS_ITEM, " $50 ").concat(CONTENT_BORDER_FOCUS_ITEM, " ").concat(CONTENT_BORDER_FOCUS_ITEM),
|
|
364
368
|
boxSizing: "border-box"
|
|
365
369
|
},
|
|
366
370
|
"@media (prefers-reduced-motion: no-preference)": {
|
|
@@ -425,9 +429,9 @@ const ScrollableContent = ({
|
|
|
425
429
|
}) => {
|
|
426
430
|
const getOverflowMaxHeight = React.useCallback(() => {
|
|
427
431
|
const [top, , bottom] = CONTENT_PADDING[containerSpacing].split(" ").map((value) => value.replace("$", ""));
|
|
428
|
-
const topBottom = top !== void 0 && bottom !== void 0 ?
|
|
429
|
-
const overflowMaxHeigh = overflow === "auto" ?
|
|
430
|
-
const newMaxHeight =
|
|
432
|
+
const topBottom = top !== void 0 && bottom !== void 0 ? "var(--space-".concat(top, ") + var(--space-").concat(bottom, ")") : "var(--space-".concat(top, ") + var(--space-").concat(top, ")");
|
|
433
|
+
const overflowMaxHeigh = overflow === "auto" ? "calc(var(--radix-dropdown-menu-content-available-height) - (".concat(topBottom, "))") : "auto";
|
|
434
|
+
const newMaxHeight = "calc(".concat(maxHeight, " - (").concat(topBottom, "))");
|
|
431
435
|
return {
|
|
432
436
|
maxHeight: maxHeight === void 0 ? overflowMaxHeigh : newMaxHeight
|
|
433
437
|
};
|
|
@@ -436,7 +440,7 @@ const ScrollableContent = ({
|
|
|
436
440
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
437
441
|
designSystemScrollArea.ScrollArea,
|
|
438
442
|
{
|
|
439
|
-
css: { margin:
|
|
443
|
+
css: { margin: "-".concat(CONTENT_BORDER_FOCUS_ITEM) },
|
|
440
444
|
type: "always",
|
|
441
445
|
children: [
|
|
442
446
|
/* @__PURE__ */ jsxRuntime.jsx(designSystemScrollArea.ScrollArea.Viewport, { css: { ...getOverflowMaxHeight() }, children }),
|
|
@@ -555,42 +559,36 @@ const StyledProhibited = designSystemStitches.styled(designSystemIcons.IconProhi
|
|
|
555
559
|
});
|
|
556
560
|
const StyledRadioItem = designSystemStitches.styled(RadixDropdownMenu__namespace.RadioItem, {
|
|
557
561
|
...itemDefaults,
|
|
558
|
-
[
|
|
562
|
+
['&[data-state="checked"] '.concat(StyledRadioContainer)]: {
|
|
559
563
|
color: "$icon-primary",
|
|
560
564
|
borderColor: "$border-primary",
|
|
561
|
-
[
|
|
565
|
+
["& ".concat(StyledPill)]: {
|
|
562
566
|
display: "block",
|
|
563
567
|
backgroundColor: "$background-primary-prominent-selected"
|
|
564
568
|
}
|
|
565
569
|
},
|
|
566
|
-
[
|
|
570
|
+
['&:hover:not([aria-disabled="true"]) '.concat(StyledRadioContainer)]: {
|
|
567
571
|
borderColor: "$border-primary-hover",
|
|
568
|
-
[
|
|
572
|
+
["& ".concat(StyledPill)]: {
|
|
569
573
|
backgroundColor: "$background-primary-prominent-hover"
|
|
570
574
|
}
|
|
571
575
|
},
|
|
572
|
-
[
|
|
573
|
-
&[aria-disabled="true"] ${StyledRadioContainer},
|
|
574
|
-
&[data-disabled] ${StyledRadioContainer}
|
|
575
|
-
`]: {
|
|
576
|
+
['\n &[aria-disabled="true"] '.concat(StyledRadioContainer, ",\n &[data-disabled] ").concat(StyledRadioContainer, "\n ")]: {
|
|
576
577
|
color: "$icon-neutrals-disabled",
|
|
577
578
|
borderColor: "$border-neutrals-disabled",
|
|
578
|
-
[
|
|
579
|
+
["& ".concat(StyledPill)]: {
|
|
579
580
|
backgroundColor: "$icon-neutrals-disabled"
|
|
580
581
|
}
|
|
581
582
|
},
|
|
582
583
|
'&[data-state="unchecked"]': {
|
|
583
|
-
[
|
|
584
|
-
&[aria-disabled="true"] ${StyledProhibited},
|
|
585
|
-
&[data-disabled] ${StyledProhibited}
|
|
586
|
-
`]: {
|
|
584
|
+
['\n &[aria-disabled="true"] '.concat(StyledProhibited, ",\n &[data-disabled] ").concat(StyledProhibited, "\n ")]: {
|
|
587
585
|
display: "flex"
|
|
588
586
|
}
|
|
589
587
|
}
|
|
590
588
|
});
|
|
591
589
|
|
|
592
|
-
const RadioItem = React__default["default"].forwardRef(({ disabled = false,
|
|
593
|
-
const ariaDisabledProps = useAriaDisabled(restProps,
|
|
590
|
+
const RadioItem = React__default["default"].forwardRef(({ disabled, children, closeOnSelect = false, ...restProps }, forwardRef) => {
|
|
591
|
+
const ariaDisabledProps = useAriaDisabled(restProps, closeOnSelect);
|
|
594
592
|
return /* @__PURE__ */ jsxRuntime.jsx(ItemProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
595
593
|
StyledRadioItem,
|
|
596
594
|
{
|
|
@@ -622,18 +620,22 @@ const StyledSwitch = designSystemStitches.styled(designSystemPrimitive.Primitive
|
|
|
622
620
|
});
|
|
623
621
|
const StyledSwitchItem = designSystemStitches.styled(RadixDropdownMenu__namespace.CheckboxItem, {
|
|
624
622
|
...itemDefaults,
|
|
625
|
-
[
|
|
626
|
-
[
|
|
627
|
-
[
|
|
628
|
-
[
|
|
629
|
-
&[aria-disabled="true"] ${StyledSwitch},
|
|
630
|
-
&[data-disabled] ${StyledSwitch}
|
|
631
|
-
`]: 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
|
|
632
627
|
});
|
|
633
628
|
|
|
634
629
|
const SwitchItem = React__default["default"].forwardRef(
|
|
635
|
-
({
|
|
636
|
-
|
|
630
|
+
({
|
|
631
|
+
disabled,
|
|
632
|
+
checked,
|
|
633
|
+
onChange,
|
|
634
|
+
children,
|
|
635
|
+
closeOnSelect = false,
|
|
636
|
+
...restProps
|
|
637
|
+
}, forwardRef) => {
|
|
638
|
+
const ariaDisabledProps = useAriaDisabled(restProps, closeOnSelect);
|
|
637
639
|
return /* @__PURE__ */ jsxRuntime.jsx(ItemProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
638
640
|
StyledSwitchItem,
|
|
639
641
|
{
|
|
@@ -706,7 +708,7 @@ const StyledIconContainer = designSystemStitches.styled(designSystemPrimitive.Pr
|
|
|
706
708
|
const StyledSubTrigger = designSystemStitches.styled(RadixDropdownMenu__namespace.SubTrigger, {
|
|
707
709
|
...itemDefaults,
|
|
708
710
|
'&[data-state="open"]': itemDefaults['&:hover:not([aria-disabled="true"])'],
|
|
709
|
-
[
|
|
711
|
+
['&[data-state="open"] '.concat(StyledIconContainer, ', &:hover:not([aria-disabled="true"]) ').concat(StyledIconContainer)]: {
|
|
710
712
|
color: "$icon-primary-hover"
|
|
711
713
|
}
|
|
712
714
|
});
|