@mirohq/design-system-dropdown-menu 4.5.0-new-focus-keyboard.0 → 5.0.0-v1.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
@@ -43,7 +43,37 @@ function _interopNamespace(e) {
43
43
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
44
44
  var RadixDropdownMenu__namespace = /*#__PURE__*/_interopNamespace(RadixDropdownMenu);
45
45
 
46
- const ItemDescription = designSystemStitches.styled(designSystemPrimitive.Primitive.div, {
46
+ const Context$1 = React.createContext({
47
+ leftSlotMount: () => {
48
+ },
49
+ leftSlotDestroy: () => {
50
+ }
51
+ });
52
+ const ItemProvider = ({ children }) => {
53
+ const [hasSlot, setHasSlot] = React.useState(false);
54
+ const leftSlotMount = React.useCallback(() => {
55
+ setHasSlot(true);
56
+ }, []);
57
+ const leftSlotDestroy = React.useCallback(() => {
58
+ setHasSlot(false);
59
+ }, []);
60
+ const formattedChildren = hasSlot ? children : designSystemUtils.addPropsToChildren(children, () => true, {
61
+ "data-no-left-slot": ""
62
+ });
63
+ return /* @__PURE__ */ jsxRuntime.jsx(
64
+ Context$1.Provider,
65
+ {
66
+ value: {
67
+ leftSlotMount,
68
+ leftSlotDestroy
69
+ },
70
+ children: formattedChildren
71
+ }
72
+ );
73
+ };
74
+ const useItem = () => React.useContext(Context$1);
75
+
76
+ const StyledItemDescription = designSystemStitches.styled(designSystemPrimitive.Primitive.div, {
47
77
  display: "-webkit-box",
48
78
  width: "100%",
49
79
  WebkitBoxOrient: "vertical",
@@ -52,8 +82,16 @@ const ItemDescription = designSystemStitches.styled(designSystemPrimitive.Primit
52
82
  gridArea: "item-description",
53
83
  fontSize: "$150",
54
84
  lineHeight: 1.5,
55
- color: "$text-neutrals-subtle"
85
+ color: "$text-neutrals-subtle",
86
+ '&:is(:hover,[data-hovered]):not([aria-disabled="true"],[data-disabled])': {
87
+ background: "$background-neutrals-hover",
88
+ color: "$text-neutrals-hover",
89
+ '&:not([aria-disabled="true"])': {
90
+ boxShadow: "none"
91
+ }
92
+ }
56
93
  });
94
+ const ItemDescription = React__default["default"].forwardRef(({ ...props }, forwardRef) => /* @__PURE__ */ jsxRuntime.jsx(ItemProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(StyledItemDescription, { ...props, ref: forwardRef }) }));
57
95
 
58
96
  const LeftSlot = designSystemStitches.styled(designSystemPrimitive.Primitive.div, {
59
97
  display: "flex",
@@ -67,13 +105,6 @@ const StyledIllustrationSlot = designSystemStitches.styled(LeftSlot, {
67
105
  width: "$13"
68
106
  });
69
107
 
70
- const hoverStyles = {
71
- background: "$background-primary-subtle-hover",
72
- color: "$text-primary-hover",
73
- '&:not([aria-disabled="true"])': {
74
- boxShadow: "none"
75
- }
76
- };
77
108
  const itemDefaults = {
78
109
  all: "unset",
79
110
  boxSizing: "border-box",
@@ -95,12 +126,12 @@ const itemDefaults = {
95
126
  gridTemplateAreas: "'item-text right-slot'\n 'item-description right-slot'"
96
127
  },
97
128
  ...designSystemStyles.focus.css({
98
- boxShadow: "$focus-keyboard",
129
+ boxShadow: "$focus",
99
130
  outline: "1px solid transparent"
100
131
  }),
101
132
  '&:disabled, &[aria-disabled="true"], &[data-disabled]': {
102
133
  cursor: "default",
103
- ["&, & ".concat(ItemDescription, ", & ").concat(designSystemBaseHotkey.Hotkey)]: {
134
+ ["&, & ".concat(StyledItemDescription, ", & ").concat(designSystemBaseHotkey.Hotkey)]: {
104
135
  color: "$text-neutrals-disabled"
105
136
  },
106
137
  ["& ".concat(StyledIllustrationSlot)]: {
@@ -110,7 +141,13 @@ const itemDefaults = {
110
141
  "&:disabled, &[data-disabled]": {
111
142
  pointerEvents: "none"
112
143
  },
113
- '&:is(:hover,[data-hovered]):not([aria-disabled="true"],[data-disabled])': hoverStyles,
144
+ '&:is(:hover,[data-hovered]):not([aria-disabled="true"],[data-disabled])': {
145
+ background: "$background-neutrals-hover",
146
+ color: "$text-neutrals-hover",
147
+ '&:not([aria-disabled="true"])': {
148
+ boxShadow: "none"
149
+ }
150
+ },
114
151
  '&:active:not([aria-disabled="true"])': {
115
152
  background: "$background-primary-subtle-active",
116
153
  boxShadow: "none",
@@ -183,7 +220,7 @@ const StyledCheckboxItem = designSystemStitches.styled(RadixDropdownMenu__namesp
183
220
  }
184
221
  });
185
222
 
186
- const Context$1 = React.createContext({
223
+ const Context = React.createContext({
187
224
  rightSlotMount: () => 0,
188
225
  rightSlotDestroy: () => {
189
226
  },
@@ -230,7 +267,7 @@ const ContentProvider = ({
230
267
  }
231
268
  });
232
269
  return /* @__PURE__ */ jsxRuntime.jsx(
233
- Context$1.Provider,
270
+ Context.Provider,
234
271
  {
235
272
  value: {
236
273
  rightSlotMount,
@@ -241,7 +278,7 @@ const ContentProvider = ({
241
278
  }
242
279
  );
243
280
  };
244
- const useContent = () => React.useContext(Context$1);
281
+ const useContent = () => React.useContext(Context);
245
282
 
246
283
  const StyledRightSlot = designSystemStitches.styled(designSystemPrimitive.Primitive.div, {
247
284
  display: "flex",
@@ -313,38 +350,6 @@ const useAriaDisabled = ({ onSelect, ...restProps }, { exceptions, closeOnSelect
313
350
  };
314
351
  };
315
352
 
316
- const Context = React.createContext({
317
- leftSlotMount: () => {
318
- },
319
- leftSlotDestroy: () => {
320
- }
321
- });
322
- const ItemProvider = ({
323
- children
324
- }) => {
325
- const [hasSlot, setHasSlot] = React.useState(false);
326
- const leftSlotMount = React.useCallback(() => {
327
- setHasSlot(true);
328
- }, []);
329
- const leftSlotDestroy = React.useCallback(() => {
330
- setHasSlot(false);
331
- }, []);
332
- const formattedChildren = hasSlot ? children : designSystemUtils.addPropsToChildren(children, () => true, {
333
- "data-no-left-slot": ""
334
- });
335
- return /* @__PURE__ */ jsxRuntime.jsx(
336
- Context.Provider,
337
- {
338
- value: {
339
- leftSlotMount,
340
- leftSlotDestroy
341
- },
342
- children: formattedChildren
343
- }
344
- );
345
- };
346
- const useItem = () => React.useContext(Context);
347
-
348
353
  const CheckboxItem = React__default["default"].forwardRef(
349
354
  ({
350
355
  children,
@@ -396,9 +401,6 @@ const CONTENT_PADDING = {
396
401
  };
397
402
  const contentDefaults = {
398
403
  maxWidth: "$125",
399
- backgroundColor: "$background-neutrals-container",
400
- borderRadius: "$50",
401
- boxShadow: "$50",
402
404
  "@media (prefers-reduced-motion: no-preference)": {
403
405
  animationDuration: "150ms",
404
406
  animationTimingFunction: "cubic-bezier(0.25, 0.5, 0.5, 0.9)",
@@ -428,8 +430,12 @@ const contentDefaults = {
428
430
  },
429
431
  position: "relative",
430
432
  zIndex: "$dropdown-menu",
431
- outline: "1px solid transparent !important"
433
+ outline: "1px solid transparent !important",
432
434
  // important because Radix overrides outline in element styles
435
+ borderRadius: "$100",
436
+ backgroundColor: "$background-neutrals-layout",
437
+ border: ".5px solid $border-neutrals-subtle",
438
+ boxShadow: "$elevation-200"
433
439
  };
434
440
 
435
441
  const StyledItemsContainer = designSystemStitches.styled("div", {
@@ -647,7 +653,6 @@ const StyledRadioItem = designSystemStitches.styled(RadixDropdownMenu__namespace
647
653
  }
648
654
  },
649
655
  ['&:is(:hover,[data-hovered]):not([aria-disabled="true"],[data-disabled]) '.concat(StyledRadioContainer)]: {
650
- borderColor: "$border-primary-hover",
651
656
  ["& ".concat(StyledPill)]: {
652
657
  backgroundColor: "$background-primary-prominent-hover"
653
658
  }
@@ -663,6 +668,10 @@ const StyledRadioItem = designSystemStitches.styled(RadixDropdownMenu__namespace
663
668
  ['\n &[aria-disabled="true"] '.concat(StyledProhibited, ",\n &[data-disabled] ").concat(StyledProhibited, "\n ")]: {
664
669
  display: "flex"
665
670
  }
671
+ },
672
+ ["".concat(StyledRadioContainer)]: {
673
+ borderWidth: "2px",
674
+ borderColor: "$border-neutrals-controls"
666
675
  }
667
676
  });
668
677
 
@@ -733,7 +742,7 @@ const StyledTrigger = designSystemStitches.styled(RadixDropdownMenu__namespace.T
733
742
  boxSizing: "border-box",
734
743
  cursor: "pointer",
735
744
  ...designSystemStyles.focus.css({
736
- boxShadow: "$focus-keyboard",
745
+ boxShadow: "$focus",
737
746
  outline: "1px solid transparent"
738
747
  })
739
748
  },
@@ -788,9 +797,15 @@ const StyledIconContainer = designSystemStitches.styled(designSystemPrimitive.Pr
788
797
  });
789
798
  const StyledSubTrigger = designSystemStitches.styled(RadixDropdownMenu__namespace.SubTrigger, {
790
799
  ...itemDefaults,
791
- '&[data-state="open"]': hoverStyles,
800
+ '&[data-state="open"]': {
801
+ background: "$background-neutrals-hover",
802
+ color: "$text-neutrals-hover",
803
+ '&:not([aria-disabled="true"])': {
804
+ boxShadow: "none"
805
+ }
806
+ },
792
807
  ['&[data-state="open"] '.concat(StyledIconContainer, ', &:is(:hover,[data-hovered]):not([aria-disabled="true"]) ').concat(StyledIconContainer)]: {
793
- color: "$icon-primary-hover"
808
+ color: "$icon-neutrals-hover"
794
809
  }
795
810
  });
796
811
 
@@ -954,10 +969,7 @@ const Root = ({
954
969
  }
955
970
  );
956
971
  };
957
- const DropdownMenu = ({
958
- direction = "ltr",
959
- ...restProps
960
- }) => /* @__PURE__ */ jsxRuntime.jsx(DropdownProvider, { direction, children: /* @__PURE__ */ jsxRuntime.jsx(designSystemBaseTooltip.BaseTooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(Root, { direction, ...restProps }) }) });
972
+ const DropdownMenu = ({ direction = "ltr", ...restProps }) => /* @__PURE__ */ jsxRuntime.jsx(DropdownProvider, { direction, children: /* @__PURE__ */ jsxRuntime.jsx(designSystemBaseTooltip.BaseTooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(Root, { direction, ...restProps }) }) });
961
973
  DropdownMenu.CheckboxItem = CheckboxItem;
962
974
  DropdownMenu.Content = Content;
963
975
  DropdownMenu.Hotkey = Hotkey;