@mirohq/design-system-dropdown-menu 3.3.0-dropdown.9 → 3.3.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/main.js +140 -100
- package/dist/main.js.map +1 -1
- package/dist/module.js +140 -100
- package/dist/module.js.map +1 -1
- package/package.json +8 -12
package/dist/module.js
CHANGED
|
@@ -18,12 +18,14 @@ const ItemDescription = styled(Primitive.div, {
|
|
|
18
18
|
overflow: "hidden",
|
|
19
19
|
gridArea: "item-description",
|
|
20
20
|
fontSize: "$150",
|
|
21
|
+
lineHeight: 1.5,
|
|
21
22
|
color: "$text-neutrals-subtle"
|
|
22
23
|
});
|
|
23
24
|
|
|
24
25
|
const LeftSlot = styled(Primitive.div, {
|
|
25
26
|
display: "flex",
|
|
26
|
-
|
|
27
|
+
alignItems: "center",
|
|
28
|
+
justifyContent: "center",
|
|
27
29
|
marginRight: "$100",
|
|
28
30
|
gridArea: "left-slot"
|
|
29
31
|
});
|
|
@@ -32,82 +34,6 @@ const StyledIllustrationSlot = styled(LeftSlot, {
|
|
|
32
34
|
width: "$13"
|
|
33
35
|
});
|
|
34
36
|
|
|
35
|
-
const itemDefaults = {
|
|
36
|
-
all: "unset",
|
|
37
|
-
boxSizing: "border-box",
|
|
38
|
-
fontSize: 14,
|
|
39
|
-
lineHeight: "20px",
|
|
40
|
-
color: "$text-neutrals",
|
|
41
|
-
borderRadius: "$50",
|
|
42
|
-
display: "grid",
|
|
43
|
-
gridTemplateColumns: "auto 1fr minmax(auto, var(--right-slot-max-width))",
|
|
44
|
-
gridTemplateRows: "1fr auto",
|
|
45
|
-
gridTemplateAreas: `'left-slot item-text right-slot'
|
|
46
|
-
'left-slot item-description right-slot'`,
|
|
47
|
-
alignItems: "start",
|
|
48
|
-
minHeight: "$10",
|
|
49
|
-
padding: "$100 $100",
|
|
50
|
-
position: "relative",
|
|
51
|
-
userSelect: "none",
|
|
52
|
-
cursor: "pointer",
|
|
53
|
-
"&[data-no-left-slot]": {
|
|
54
|
-
gridTemplateColumns: "1fr minmax(auto, var(--right-slot-max-width))",
|
|
55
|
-
gridTemplateRows: "auto",
|
|
56
|
-
gridTemplateAreas: `'item-text right-slot'
|
|
57
|
-
'item-description right-slot'`
|
|
58
|
-
},
|
|
59
|
-
"&:not(:last-child)": {
|
|
60
|
-
marginBottom: "$50"
|
|
61
|
-
},
|
|
62
|
-
"&:not(:first-child)": {
|
|
63
|
-
marginTop: "$50"
|
|
64
|
-
},
|
|
65
|
-
...focus.defaults,
|
|
66
|
-
'&:disabled, &[aria-disabled="true"], &[data-disabled]': {
|
|
67
|
-
pointerEvents: "none",
|
|
68
|
-
[`&, & ${ItemDescription}`]: {
|
|
69
|
-
color: "$text-neutrals-disabled"
|
|
70
|
-
},
|
|
71
|
-
[`& ${StyledIllustrationSlot}`]: {
|
|
72
|
-
filter: "grayscale(1)"
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
"&:hover": {
|
|
76
|
-
background: "$background-primary-subtle-hover",
|
|
77
|
-
color: "$text-primary-hover",
|
|
78
|
-
'&:not([aria-disabled="true"])': {
|
|
79
|
-
boxShadow: "none"
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
"&:active": {
|
|
83
|
-
background: "$background-primary-subtle-active",
|
|
84
|
-
boxShadow: "none",
|
|
85
|
-
color: "$text-primary-active"
|
|
86
|
-
},
|
|
87
|
-
'&[tabindex="0"]': {
|
|
88
|
-
zIndex: "1"
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
const StyledIndicator = styled(Primitive.span, {
|
|
93
|
-
padding: "4px 6px"
|
|
94
|
-
});
|
|
95
|
-
const StyledCheckboxItem = styled(RadixDropdownMenu.CheckboxItem, {
|
|
96
|
-
...itemDefaults,
|
|
97
|
-
[`&[data-state="checked"] ${StyledIndicator}`]: {
|
|
98
|
-
color: "$icon-primary"
|
|
99
|
-
},
|
|
100
|
-
[`&[data-state="checked"]:hover ${StyledIndicator}`]: {
|
|
101
|
-
color: "$icon-primary-hover"
|
|
102
|
-
},
|
|
103
|
-
[`
|
|
104
|
-
&[aria-disabled="true"] ${StyledIndicator},
|
|
105
|
-
&[data-disabled] ${StyledIndicator}
|
|
106
|
-
`]: {
|
|
107
|
-
color: "$icon-neutrals-disabled"
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
|
|
111
37
|
const Context$1 = createContext({
|
|
112
38
|
rightSlotMount: () => 0,
|
|
113
39
|
rightSlotDestroy: () => {
|
|
@@ -167,13 +93,16 @@ const useContent = () => useContext(Context$1);
|
|
|
167
93
|
const StyledRightSlot = styled(Primitive.div, {
|
|
168
94
|
display: "flex",
|
|
169
95
|
alignItems: "center",
|
|
96
|
+
justifyContent: "center",
|
|
170
97
|
marginLeft: "auto",
|
|
171
98
|
paddingLeft: "$200",
|
|
172
99
|
gridArea: "right-slot",
|
|
100
|
+
height: "$5",
|
|
101
|
+
width: "$7",
|
|
173
102
|
minWidth: "max-content",
|
|
174
103
|
textAlign: "right",
|
|
175
104
|
"&:empty": {
|
|
176
|
-
paddingLeft: "$
|
|
105
|
+
paddingLeft: "$0"
|
|
177
106
|
}
|
|
178
107
|
});
|
|
179
108
|
|
|
@@ -195,7 +124,99 @@ const RightSlot = (props) => {
|
|
|
195
124
|
});
|
|
196
125
|
};
|
|
197
126
|
|
|
198
|
-
const
|
|
127
|
+
const HotkeySlot = styled(RightSlot, {
|
|
128
|
+
color: "$text-neutrals-subtle"
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
const itemDefaults = {
|
|
132
|
+
all: "unset",
|
|
133
|
+
boxSizing: "border-box",
|
|
134
|
+
fontSize: 14,
|
|
135
|
+
lineHeight: "20px",
|
|
136
|
+
color: "$text-neutrals",
|
|
137
|
+
borderRadius: "$50",
|
|
138
|
+
display: "grid",
|
|
139
|
+
gridTemplateColumns: "auto 1fr minmax(auto, var(--right-slot-max-width))",
|
|
140
|
+
gridTemplateRows: "auto 1fr",
|
|
141
|
+
gridTemplateAreas: `'left-slot item-text right-slot'
|
|
142
|
+
'left-slot item-description right-slot'`,
|
|
143
|
+
alignItems: "start",
|
|
144
|
+
padding: "10px $100",
|
|
145
|
+
position: "relative",
|
|
146
|
+
userSelect: "none",
|
|
147
|
+
cursor: "pointer",
|
|
148
|
+
"&[data-no-left-slot]": {
|
|
149
|
+
gridTemplateColumns: "1fr minmax(auto, var(--right-slot-max-width))",
|
|
150
|
+
gridTemplateAreas: `'item-text right-slot'
|
|
151
|
+
'item-description right-slot'`
|
|
152
|
+
},
|
|
153
|
+
"&:not(:last-child)": {
|
|
154
|
+
marginBottom: "$50"
|
|
155
|
+
},
|
|
156
|
+
"&:not(:first-child)": {
|
|
157
|
+
marginTop: "$50"
|
|
158
|
+
},
|
|
159
|
+
...focus.css({
|
|
160
|
+
boxShadow: "$focus-small",
|
|
161
|
+
outline: "1px solid transparent"
|
|
162
|
+
}),
|
|
163
|
+
'&:disabled, &[aria-disabled="true"], &[data-disabled]': {
|
|
164
|
+
cursor: "default",
|
|
165
|
+
[`&, & ${ItemDescription}, & ${HotkeySlot}`]: {
|
|
166
|
+
color: "$text-neutrals-disabled"
|
|
167
|
+
},
|
|
168
|
+
[`& ${StyledIllustrationSlot}`]: {
|
|
169
|
+
filter: "grayscale(1)"
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
"&:disabled, &[data-disabled]": {
|
|
173
|
+
pointerEvents: "none"
|
|
174
|
+
},
|
|
175
|
+
'&:hover:not([aria-disabled="true"])': {
|
|
176
|
+
background: "$background-primary-subtle-hover",
|
|
177
|
+
color: "$text-primary-hover",
|
|
178
|
+
'&:not([aria-disabled="true"])': {
|
|
179
|
+
boxShadow: "none"
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
'&:active:not([aria-disabled="true"])': {
|
|
183
|
+
background: "$background-primary-subtle-active",
|
|
184
|
+
boxShadow: "none",
|
|
185
|
+
color: "$text-primary-active"
|
|
186
|
+
},
|
|
187
|
+
'&[tabindex="0"]': {
|
|
188
|
+
zIndex: "1"
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
const StyledIndicator = styled(Primitive.span, {
|
|
193
|
+
display: "flex",
|
|
194
|
+
alignItems: "center",
|
|
195
|
+
justifyContent: "center"
|
|
196
|
+
});
|
|
197
|
+
const StyledCheckboxItem = styled(RadixDropdownMenu.CheckboxItem, {
|
|
198
|
+
...itemDefaults,
|
|
199
|
+
[`&[data-state="checked"] ${StyledIndicator}`]: {
|
|
200
|
+
color: "$icon-primary"
|
|
201
|
+
},
|
|
202
|
+
[`&[data-state="checked"]:hover:not([aria-disabled="true"]) ${StyledIndicator}`]: {
|
|
203
|
+
color: "$icon-primary-hover"
|
|
204
|
+
},
|
|
205
|
+
[`
|
|
206
|
+
&[aria-disabled="true"] ${StyledIndicator},
|
|
207
|
+
&[data-disabled] ${StyledIndicator}
|
|
208
|
+
`]: {
|
|
209
|
+
color: "$icon-neutrals-disabled"
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
const useAriaDisabled = ({
|
|
214
|
+
"aria-disabled": ariaDisabled,
|
|
215
|
+
onKeyDown,
|
|
216
|
+
onSelect,
|
|
217
|
+
onPointerMove,
|
|
218
|
+
onClick
|
|
219
|
+
}, preventDefault = false) => useMemo(
|
|
199
220
|
() => ({
|
|
200
221
|
"aria-disabled": booleanify(ariaDisabled) ? ariaDisabled : void 0,
|
|
201
222
|
onKeyDown: (e) => {
|
|
@@ -211,12 +232,27 @@ const useAriaDisabled = ({ "aria-disabled": ariaDisabled, onKeyDown, onSelect },
|
|
|
211
232
|
e.preventDefault();
|
|
212
233
|
}
|
|
213
234
|
if (booleanify(ariaDisabled)) {
|
|
235
|
+
e.preventDefault();
|
|
214
236
|
return;
|
|
215
237
|
}
|
|
216
238
|
onSelect == null ? void 0 : onSelect(e);
|
|
239
|
+
},
|
|
240
|
+
onPointerMove: (e) => {
|
|
241
|
+
if (booleanify(ariaDisabled)) {
|
|
242
|
+
e.preventDefault();
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
onPointerMove == null ? void 0 : onPointerMove(e);
|
|
246
|
+
},
|
|
247
|
+
onClick: (e) => {
|
|
248
|
+
if (booleanify(ariaDisabled)) {
|
|
249
|
+
e.preventDefault();
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
onClick == null ? void 0 : onClick(e);
|
|
217
253
|
}
|
|
218
254
|
}),
|
|
219
|
-
[ariaDisabled, onKeyDown, onSelect, preventDefault]
|
|
255
|
+
[ariaDisabled, onKeyDown, onSelect, onPointerMove, onClick, preventDefault]
|
|
220
256
|
);
|
|
221
257
|
|
|
222
258
|
const Context = createContext({
|
|
@@ -258,6 +294,7 @@ const CheckboxItem = React.forwardRef(({ children, checked, onChange, disabled,
|
|
|
258
294
|
disabled,
|
|
259
295
|
onCheckedChange: onChange
|
|
260
296
|
}, children, /* @__PURE__ */ React.createElement(RightSlot, null, /* @__PURE__ */ React.createElement(StyledIndicator, null, (disabled === true || booleanify(ariaDisabled)) && !checked && /* @__PURE__ */ React.createElement(IconProhibit, {
|
|
297
|
+
weight: "thin",
|
|
261
298
|
css: { square: "$3", display: "block" }
|
|
262
299
|
}), checked && /* @__PURE__ */ React.createElement(IconCheckMark, {
|
|
263
300
|
css: { square: "$3", display: "block" }
|
|
@@ -447,7 +484,7 @@ const RadioGroup = React.forwardRef((props, forwardRef) => {
|
|
|
447
484
|
});
|
|
448
485
|
});
|
|
449
486
|
|
|
450
|
-
const StyledRadioContainer = styled(Primitive.
|
|
487
|
+
const StyledRadioContainer = styled(Primitive.div, {
|
|
451
488
|
display: "flex",
|
|
452
489
|
alignItems: "center",
|
|
453
490
|
justifyContent: "center",
|
|
@@ -455,10 +492,9 @@ const StyledRadioContainer = styled(Primitive.span, {
|
|
|
455
492
|
height: "$4",
|
|
456
493
|
boxSizing: "border-box",
|
|
457
494
|
border: "1px solid $border-neutrals",
|
|
458
|
-
borderRadius: "$half"
|
|
459
|
-
margin: "2px 4px"
|
|
495
|
+
borderRadius: "$half"
|
|
460
496
|
});
|
|
461
|
-
const StyledPill = styled(Primitive.
|
|
497
|
+
const StyledPill = styled(Primitive.div, {
|
|
462
498
|
display: "none",
|
|
463
499
|
width: "$2",
|
|
464
500
|
height: "$2",
|
|
@@ -478,7 +514,7 @@ const StyledRadioItem = styled(RadixDropdownMenu.RadioItem, {
|
|
|
478
514
|
backgroundColor: "$background-primary-prominent-selected"
|
|
479
515
|
}
|
|
480
516
|
},
|
|
481
|
-
[`&:hover ${StyledRadioContainer}`]: {
|
|
517
|
+
[`&:hover:not([aria-disabled="true"]) ${StyledRadioContainer}`]: {
|
|
482
518
|
borderColor: "$border-primary-hover",
|
|
483
519
|
[`& ${StyledPill}`]: {
|
|
484
520
|
backgroundColor: "$background-primary-prominent-hover"
|
|
@@ -511,7 +547,9 @@ const RadioItem = React.forwardRef(({ disabled = false, children, ...restProps }
|
|
|
511
547
|
...ariaDisabledProps,
|
|
512
548
|
disabled,
|
|
513
549
|
ref: forwardRef
|
|
514
|
-
}, children, /* @__PURE__ */ React.createElement(RightSlot, null, /* @__PURE__ */ React.createElement(StyledRadioContainer, null, /* @__PURE__ */ React.createElement(StyledPill, null), /* @__PURE__ */ React.createElement(StyledProhibited,
|
|
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
|
+
})))));
|
|
515
553
|
});
|
|
516
554
|
|
|
517
555
|
const StyledSeparator = styled(RadixDropdownMenu.Separator, {
|
|
@@ -526,14 +564,13 @@ const Separator = React.forwardRef((props, forwardRef) => /* @__PURE__ */ React.
|
|
|
526
564
|
const StyledSwitch = styled(Primitive.span, {
|
|
527
565
|
...styles.default,
|
|
528
566
|
width: "$7",
|
|
529
|
-
height: "$4"
|
|
530
|
-
marginTop: "2px"
|
|
567
|
+
height: "$4"
|
|
531
568
|
});
|
|
532
569
|
const StyledSwitchItem = styled(RadixDropdownMenu.CheckboxItem, {
|
|
533
570
|
...itemDefaults,
|
|
534
571
|
[`&[data-state="checked"] ${StyledSwitch}`]: styles.checked,
|
|
535
|
-
[`&[data-state="checked"]:hover ${StyledSwitch}`]: styles.checkedHovered,
|
|
536
|
-
[`&:hover ${StyledSwitch}`]: styles.hovered,
|
|
572
|
+
[`&[data-state="checked"]:hover:not([aria-disabled="true"]) ${StyledSwitch}`]: styles.checkedHovered,
|
|
573
|
+
[`&:hover:not([aria-disabled="true"]) ${StyledSwitch}`]: styles.hovered,
|
|
537
574
|
[`
|
|
538
575
|
&[aria-disabled="true"] ${StyledSwitch},
|
|
539
576
|
&[data-disabled] ${StyledSwitch}
|
|
@@ -561,7 +598,10 @@ const StyledTrigger = styled(RadixDropdownMenu.Trigger, {
|
|
|
561
598
|
all: "unset",
|
|
562
599
|
boxSizing: "border-box",
|
|
563
600
|
cursor: "pointer",
|
|
564
|
-
...focus.
|
|
601
|
+
...focus.css({
|
|
602
|
+
boxShadow: "$focus-small",
|
|
603
|
+
outline: "1px solid transparent"
|
|
604
|
+
})
|
|
565
605
|
},
|
|
566
606
|
false: {
|
|
567
607
|
cursor: "pointer"
|
|
@@ -580,12 +620,13 @@ const Trigger = React.forwardRef(({ asChild = false, onPress, onClick, ...restPr
|
|
|
580
620
|
|
|
581
621
|
const StyledIconContainer = styled(Primitive.span, {
|
|
582
622
|
color: "$icon-neutrals-with-text",
|
|
583
|
-
|
|
623
|
+
display: "flex",
|
|
624
|
+
alignItems: "center"
|
|
584
625
|
});
|
|
585
626
|
const StyledSubTrigger = styled(RadixDropdownMenu.SubTrigger, {
|
|
586
627
|
...itemDefaults,
|
|
587
|
-
'&[data-state="open"]': itemDefaults[
|
|
588
|
-
[`&[data-state="open"] ${StyledIconContainer}, &:hover ${StyledIconContainer}`]: {
|
|
628
|
+
'&[data-state="open"]': itemDefaults['&:hover:not([aria-disabled="true"])'],
|
|
629
|
+
[`&[data-state="open"] ${StyledIconContainer}, &:hover:not([aria-disabled="true"]) ${StyledIconContainer}`]: {
|
|
589
630
|
color: "$icon-primary-hover"
|
|
590
631
|
}
|
|
591
632
|
});
|
|
@@ -669,7 +710,7 @@ const Portal = (props) => /* @__PURE__ */ React.createElement(Portal$1, {
|
|
|
669
710
|
});
|
|
670
711
|
|
|
671
712
|
const StyledIconSlot = styled(LeftSlot, {
|
|
672
|
-
|
|
713
|
+
square: "$5",
|
|
673
714
|
"& svg:not([data-icon-component]), & img:not([data-icon-component])": {
|
|
674
715
|
...styles$1.size.small,
|
|
675
716
|
...styles$1.weight.thin
|
|
@@ -694,11 +735,10 @@ const IconSlot = React.forwardRef(({ children, ...restProps }, forwardRef) => {
|
|
|
694
735
|
return /* @__PURE__ */ React.createElement(StyledIconSlot, {
|
|
695
736
|
ref: forwardRef,
|
|
696
737
|
...restProps
|
|
697
|
-
},
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
color: "$text-neutrals-subtle"
|
|
738
|
+
}, /* @__PURE__ */ React.createElement(Primitive.svg, {
|
|
739
|
+
asChild: true,
|
|
740
|
+
"aria-hidden": true
|
|
741
|
+
}, formattedChildren));
|
|
702
742
|
});
|
|
703
743
|
|
|
704
744
|
const IllustrationSlot = React.forwardRef((props, forwardRef) => {
|