@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 CHANGED
@@ -44,12 +44,14 @@ const ItemDescription = designSystemStitches.styled(designSystemPrimitive.Primit
44
44
  overflow: "hidden",
45
45
  gridArea: "item-description",
46
46
  fontSize: "$150",
47
+ lineHeight: 1.5,
47
48
  color: "$text-neutrals-subtle"
48
49
  });
49
50
 
50
51
  const LeftSlot = designSystemStitches.styled(designSystemPrimitive.Primitive.div, {
51
52
  display: "flex",
52
- placeContent: "center",
53
+ alignItems: "center",
54
+ justifyContent: "center",
53
55
  marginRight: "$100",
54
56
  gridArea: "left-slot"
55
57
  });
@@ -58,82 +60,6 @@ const StyledIllustrationSlot = designSystemStitches.styled(LeftSlot, {
58
60
  width: "$13"
59
61
  });
60
62
 
61
- const itemDefaults = {
62
- all: "unset",
63
- boxSizing: "border-box",
64
- fontSize: 14,
65
- lineHeight: "20px",
66
- color: "$text-neutrals",
67
- borderRadius: "$50",
68
- display: "grid",
69
- gridTemplateColumns: "auto 1fr minmax(auto, var(--right-slot-max-width))",
70
- gridTemplateRows: "1fr auto",
71
- gridTemplateAreas: `'left-slot item-text right-slot'
72
- 'left-slot item-description right-slot'`,
73
- alignItems: "start",
74
- minHeight: "$10",
75
- padding: "$100 $100",
76
- position: "relative",
77
- userSelect: "none",
78
- cursor: "pointer",
79
- "&[data-no-left-slot]": {
80
- gridTemplateColumns: "1fr minmax(auto, var(--right-slot-max-width))",
81
- gridTemplateRows: "auto",
82
- gridTemplateAreas: `'item-text right-slot'
83
- 'item-description right-slot'`
84
- },
85
- "&:not(:last-child)": {
86
- marginBottom: "$50"
87
- },
88
- "&:not(:first-child)": {
89
- marginTop: "$50"
90
- },
91
- ...designSystemStyles.focus.defaults,
92
- '&:disabled, &[aria-disabled="true"], &[data-disabled]': {
93
- pointerEvents: "none",
94
- [`&, & ${ItemDescription}`]: {
95
- color: "$text-neutrals-disabled"
96
- },
97
- [`& ${StyledIllustrationSlot}`]: {
98
- filter: "grayscale(1)"
99
- }
100
- },
101
- "&:hover": {
102
- background: "$background-primary-subtle-hover",
103
- color: "$text-primary-hover",
104
- '&:not([aria-disabled="true"])': {
105
- boxShadow: "none"
106
- }
107
- },
108
- "&:active": {
109
- background: "$background-primary-subtle-active",
110
- boxShadow: "none",
111
- color: "$text-primary-active"
112
- },
113
- '&[tabindex="0"]': {
114
- zIndex: "1"
115
- }
116
- };
117
-
118
- const StyledIndicator = designSystemStitches.styled(designSystemPrimitive.Primitive.span, {
119
- padding: "4px 6px"
120
- });
121
- const StyledCheckboxItem = designSystemStitches.styled(RadixDropdownMenu__namespace.CheckboxItem, {
122
- ...itemDefaults,
123
- [`&[data-state="checked"] ${StyledIndicator}`]: {
124
- color: "$icon-primary"
125
- },
126
- [`&[data-state="checked"]:hover ${StyledIndicator}`]: {
127
- color: "$icon-primary-hover"
128
- },
129
- [`
130
- &[aria-disabled="true"] ${StyledIndicator},
131
- &[data-disabled] ${StyledIndicator}
132
- `]: {
133
- color: "$icon-neutrals-disabled"
134
- }
135
- });
136
-
137
63
  const Context$1 = React.createContext({
138
64
  rightSlotMount: () => 0,
139
65
  rightSlotDestroy: () => {
@@ -193,13 +119,16 @@ const useContent = () => React.useContext(Context$1);
193
119
  const StyledRightSlot = designSystemStitches.styled(designSystemPrimitive.Primitive.div, {
194
120
  display: "flex",
195
121
  alignItems: "center",
122
+ justifyContent: "center",
196
123
  marginLeft: "auto",
197
124
  paddingLeft: "$200",
198
125
  gridArea: "right-slot",
126
+ height: "$5",
127
+ width: "$7",
199
128
  minWidth: "max-content",
200
129
  textAlign: "right",
201
130
  "&:empty": {
202
- paddingLeft: "$none"
131
+ paddingLeft: "$0"
203
132
  }
204
133
  });
205
134
 
@@ -221,7 +150,99 @@ const RightSlot = (props) => {
221
150
  });
222
151
  };
223
152
 
224
- const useAriaDisabled = ({ "aria-disabled": ariaDisabled, onKeyDown, onSelect }, preventDefault = false) => React.useMemo(
153
+ const HotkeySlot = designSystemStitches.styled(RightSlot, {
154
+ color: "$text-neutrals-subtle"
155
+ });
156
+
157
+ const itemDefaults = {
158
+ all: "unset",
159
+ boxSizing: "border-box",
160
+ fontSize: 14,
161
+ lineHeight: "20px",
162
+ color: "$text-neutrals",
163
+ borderRadius: "$50",
164
+ display: "grid",
165
+ gridTemplateColumns: "auto 1fr minmax(auto, var(--right-slot-max-width))",
166
+ gridTemplateRows: "auto 1fr",
167
+ gridTemplateAreas: `'left-slot item-text right-slot'
168
+ 'left-slot item-description right-slot'`,
169
+ alignItems: "start",
170
+ padding: "10px $100",
171
+ position: "relative",
172
+ userSelect: "none",
173
+ cursor: "pointer",
174
+ "&[data-no-left-slot]": {
175
+ gridTemplateColumns: "1fr minmax(auto, var(--right-slot-max-width))",
176
+ gridTemplateAreas: `'item-text right-slot'
177
+ 'item-description right-slot'`
178
+ },
179
+ "&:not(:last-child)": {
180
+ marginBottom: "$50"
181
+ },
182
+ "&:not(:first-child)": {
183
+ marginTop: "$50"
184
+ },
185
+ ...designSystemStyles.focus.css({
186
+ boxShadow: "$focus-small",
187
+ outline: "1px solid transparent"
188
+ }),
189
+ '&:disabled, &[aria-disabled="true"], &[data-disabled]': {
190
+ cursor: "default",
191
+ [`&, & ${ItemDescription}, & ${HotkeySlot}`]: {
192
+ color: "$text-neutrals-disabled"
193
+ },
194
+ [`& ${StyledIllustrationSlot}`]: {
195
+ filter: "grayscale(1)"
196
+ }
197
+ },
198
+ "&:disabled, &[data-disabled]": {
199
+ pointerEvents: "none"
200
+ },
201
+ '&:hover:not([aria-disabled="true"])': {
202
+ background: "$background-primary-subtle-hover",
203
+ color: "$text-primary-hover",
204
+ '&:not([aria-disabled="true"])': {
205
+ boxShadow: "none"
206
+ }
207
+ },
208
+ '&:active:not([aria-disabled="true"])': {
209
+ background: "$background-primary-subtle-active",
210
+ boxShadow: "none",
211
+ color: "$text-primary-active"
212
+ },
213
+ '&[tabindex="0"]': {
214
+ zIndex: "1"
215
+ }
216
+ };
217
+
218
+ const StyledIndicator = designSystemStitches.styled(designSystemPrimitive.Primitive.span, {
219
+ display: "flex",
220
+ alignItems: "center",
221
+ justifyContent: "center"
222
+ });
223
+ const StyledCheckboxItem = designSystemStitches.styled(RadixDropdownMenu__namespace.CheckboxItem, {
224
+ ...itemDefaults,
225
+ [`&[data-state="checked"] ${StyledIndicator}`]: {
226
+ color: "$icon-primary"
227
+ },
228
+ [`&[data-state="checked"]:hover:not([aria-disabled="true"]) ${StyledIndicator}`]: {
229
+ color: "$icon-primary-hover"
230
+ },
231
+ [`
232
+ &[aria-disabled="true"] ${StyledIndicator},
233
+ &[data-disabled] ${StyledIndicator}
234
+ `]: {
235
+ color: "$icon-neutrals-disabled"
236
+ }
237
+ });
238
+
239
+ const useAriaDisabled = ({
240
+ "aria-disabled": ariaDisabled,
241
+ onKeyDown,
242
+ onSelect,
243
+ onPointerMove,
244
+ onClick
245
+ }, preventDefault = false) => React.useMemo(
225
246
  () => ({
226
247
  "aria-disabled": designSystemUtils.booleanify(ariaDisabled) ? ariaDisabled : void 0,
227
248
  onKeyDown: (e) => {
@@ -237,12 +258,27 @@ const useAriaDisabled = ({ "aria-disabled": ariaDisabled, onKeyDown, onSelect },
237
258
  e.preventDefault();
238
259
  }
239
260
  if (designSystemUtils.booleanify(ariaDisabled)) {
261
+ e.preventDefault();
240
262
  return;
241
263
  }
242
264
  onSelect == null ? void 0 : onSelect(e);
265
+ },
266
+ onPointerMove: (e) => {
267
+ if (designSystemUtils.booleanify(ariaDisabled)) {
268
+ e.preventDefault();
269
+ return;
270
+ }
271
+ onPointerMove == null ? void 0 : onPointerMove(e);
272
+ },
273
+ onClick: (e) => {
274
+ if (designSystemUtils.booleanify(ariaDisabled)) {
275
+ e.preventDefault();
276
+ return;
277
+ }
278
+ onClick == null ? void 0 : onClick(e);
243
279
  }
244
280
  }),
245
- [ariaDisabled, onKeyDown, onSelect, preventDefault]
281
+ [ariaDisabled, onKeyDown, onSelect, onPointerMove, onClick, preventDefault]
246
282
  );
247
283
 
248
284
  const Context = React.createContext({
@@ -284,6 +320,7 @@ const CheckboxItem = React__default["default"].forwardRef(({ children, checked,
284
320
  disabled,
285
321
  onCheckedChange: onChange
286
322
  }, children, /* @__PURE__ */ React__default["default"].createElement(RightSlot, null, /* @__PURE__ */ React__default["default"].createElement(StyledIndicator, null, (disabled === true || designSystemUtils.booleanify(ariaDisabled)) && !checked && /* @__PURE__ */ React__default["default"].createElement(designSystemIcons.IconProhibit, {
323
+ weight: "thin",
287
324
  css: { square: "$3", display: "block" }
288
325
  }), checked && /* @__PURE__ */ React__default["default"].createElement(designSystemIcons.IconCheckMark, {
289
326
  css: { square: "$3", display: "block" }
@@ -473,7 +510,7 @@ const RadioGroup = React__default["default"].forwardRef((props, forwardRef) => {
473
510
  });
474
511
  });
475
512
 
476
- const StyledRadioContainer = designSystemStitches.styled(designSystemPrimitive.Primitive.span, {
513
+ const StyledRadioContainer = designSystemStitches.styled(designSystemPrimitive.Primitive.div, {
477
514
  display: "flex",
478
515
  alignItems: "center",
479
516
  justifyContent: "center",
@@ -481,10 +518,9 @@ const StyledRadioContainer = designSystemStitches.styled(designSystemPrimitive.P
481
518
  height: "$4",
482
519
  boxSizing: "border-box",
483
520
  border: "1px solid $border-neutrals",
484
- borderRadius: "$half",
485
- margin: "2px 4px"
521
+ borderRadius: "$half"
486
522
  });
487
- const StyledPill = designSystemStitches.styled(designSystemPrimitive.Primitive.span, {
523
+ const StyledPill = designSystemStitches.styled(designSystemPrimitive.Primitive.div, {
488
524
  display: "none",
489
525
  width: "$2",
490
526
  height: "$2",
@@ -504,7 +540,7 @@ const StyledRadioItem = designSystemStitches.styled(RadixDropdownMenu__namespace
504
540
  backgroundColor: "$background-primary-prominent-selected"
505
541
  }
506
542
  },
507
- [`&:hover ${StyledRadioContainer}`]: {
543
+ [`&:hover:not([aria-disabled="true"]) ${StyledRadioContainer}`]: {
508
544
  borderColor: "$border-primary-hover",
509
545
  [`& ${StyledPill}`]: {
510
546
  backgroundColor: "$background-primary-prominent-hover"
@@ -537,7 +573,9 @@ const RadioItem = React__default["default"].forwardRef(({ disabled = false, chil
537
573
  ...ariaDisabledProps,
538
574
  disabled,
539
575
  ref: forwardRef
540
- }, children, /* @__PURE__ */ React__default["default"].createElement(RightSlot, null, /* @__PURE__ */ React__default["default"].createElement(StyledRadioContainer, null, /* @__PURE__ */ React__default["default"].createElement(StyledPill, null), /* @__PURE__ */ React__default["default"].createElement(StyledProhibited, null)))));
576
+ }, children, /* @__PURE__ */ React__default["default"].createElement(RightSlot, null, /* @__PURE__ */ React__default["default"].createElement(StyledRadioContainer, null, /* @__PURE__ */ React__default["default"].createElement(StyledPill, null), /* @__PURE__ */ React__default["default"].createElement(StyledProhibited, {
577
+ weight: "thin"
578
+ })))));
541
579
  });
542
580
 
543
581
  const StyledSeparator = designSystemStitches.styled(RadixDropdownMenu__namespace.Separator, {
@@ -552,14 +590,13 @@ const Separator = React__default["default"].forwardRef((props, forwardRef) => /*
552
590
  const StyledSwitch = designSystemStitches.styled(designSystemPrimitive.Primitive.span, {
553
591
  ...designSystemBaseSwitch.styles.default,
554
592
  width: "$7",
555
- height: "$4",
556
- marginTop: "2px"
593
+ height: "$4"
557
594
  });
558
595
  const StyledSwitchItem = designSystemStitches.styled(RadixDropdownMenu__namespace.CheckboxItem, {
559
596
  ...itemDefaults,
560
597
  [`&[data-state="checked"] ${StyledSwitch}`]: designSystemBaseSwitch.styles.checked,
561
- [`&[data-state="checked"]:hover ${StyledSwitch}`]: designSystemBaseSwitch.styles.checkedHovered,
562
- [`&:hover ${StyledSwitch}`]: designSystemBaseSwitch.styles.hovered,
598
+ [`&[data-state="checked"]:hover:not([aria-disabled="true"]) ${StyledSwitch}`]: designSystemBaseSwitch.styles.checkedHovered,
599
+ [`&:hover:not([aria-disabled="true"]) ${StyledSwitch}`]: designSystemBaseSwitch.styles.hovered,
563
600
  [`
564
601
  &[aria-disabled="true"] ${StyledSwitch},
565
602
  &[data-disabled] ${StyledSwitch}
@@ -587,7 +624,10 @@ const StyledTrigger = designSystemStitches.styled(RadixDropdownMenu__namespace.T
587
624
  all: "unset",
588
625
  boxSizing: "border-box",
589
626
  cursor: "pointer",
590
- ...designSystemStyles.focus.defaults
627
+ ...designSystemStyles.focus.css({
628
+ boxShadow: "$focus-small",
629
+ outline: "1px solid transparent"
630
+ })
591
631
  },
592
632
  false: {
593
633
  cursor: "pointer"
@@ -606,12 +646,13 @@ const Trigger = React__default["default"].forwardRef(({ asChild = false, onPress
606
646
 
607
647
  const StyledIconContainer = designSystemStitches.styled(designSystemPrimitive.Primitive.span, {
608
648
  color: "$icon-neutrals-with-text",
609
- marginRight: "-4px"
649
+ display: "flex",
650
+ alignItems: "center"
610
651
  });
611
652
  const StyledSubTrigger = designSystemStitches.styled(RadixDropdownMenu__namespace.SubTrigger, {
612
653
  ...itemDefaults,
613
- '&[data-state="open"]': itemDefaults["&:hover"],
614
- [`&[data-state="open"] ${StyledIconContainer}, &:hover ${StyledIconContainer}`]: {
654
+ '&[data-state="open"]': itemDefaults['&:hover:not([aria-disabled="true"])'],
655
+ [`&[data-state="open"] ${StyledIconContainer}, &:hover:not([aria-disabled="true"]) ${StyledIconContainer}`]: {
615
656
  color: "$icon-primary-hover"
616
657
  }
617
658
  });
@@ -695,7 +736,7 @@ const Portal = (props) => /* @__PURE__ */ React__default["default"].createElemen
695
736
  });
696
737
 
697
738
  const StyledIconSlot = designSystemStitches.styled(LeftSlot, {
698
- paddingTop: "2px",
739
+ square: "$5",
699
740
  "& svg:not([data-icon-component]), & img:not([data-icon-component])": {
700
741
  ...designSystemBaseIcon.styles.size.small,
701
742
  ...designSystemBaseIcon.styles.weight.thin
@@ -720,11 +761,10 @@ const IconSlot = React__default["default"].forwardRef(({ children, ...restProps
720
761
  return /* @__PURE__ */ React__default["default"].createElement(StyledIconSlot, {
721
762
  ref: forwardRef,
722
763
  ...restProps
723
- }, formattedChildren);
724
- });
725
-
726
- const HotkeySlot = designSystemStitches.styled(RightSlot, {
727
- color: "$text-neutrals-subtle"
764
+ }, /* @__PURE__ */ React__default["default"].createElement(designSystemPrimitive.Primitive.svg, {
765
+ asChild: true,
766
+ "aria-hidden": true
767
+ }, formattedChildren));
728
768
  });
729
769
 
730
770
  const IllustrationSlot = React__default["default"].forwardRef((props, forwardRef) => {