@sproutsocial/seeds-react-menu 1.8.4 → 1.8.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sproutsocial/seeds-react-menu",
3
- "version": "1.8.4",
3
+ "version": "1.8.6",
4
4
  "description": "Seeds React Menu",
5
5
  "author": "Sprout Social, Inc.",
6
6
  "license": "MIT",
@@ -37,7 +37,7 @@
37
37
  "@sproutsocial/seeds-react-icon": "^2.2.4",
38
38
  "@sproutsocial/seeds-react-input": "^1.5.4",
39
39
  "@sproutsocial/seeds-react-label": "^1.0.13",
40
- "@sproutsocial/seeds-react-popout": "^2.4.24",
40
+ "@sproutsocial/seeds-react-popout": "^2.4.25",
41
41
  "@sproutsocial/seeds-react-radio": "^1.3.12",
42
42
  "@sproutsocial/seeds-react-switch": "^1.2.21",
43
43
  "@sproutsocial/seeds-react-system-props": "^3.0.2",
@@ -51,7 +51,7 @@
51
51
  "styled-system": "^5.1.5"
52
52
  },
53
53
  "devDependencies": {
54
- "@sproutsocial/seeds-react-tooltip": "^1.1.6",
54
+ "@sproutsocial/seeds-react-tooltip": "^1.1.7",
55
55
  "@sproutsocial/eslint-config-seeds": "*",
56
56
  "@sproutsocial/seeds-react-testing-library": "*",
57
57
  "@sproutsocial/seeds-testing": "*",
@@ -72,6 +72,8 @@ export function MultiAutocomplete<T extends DataWithId>({
72
72
  stateReducer = defaultReducer,
73
73
  menuProps,
74
74
  inputType = "checkbox",
75
+ onPointerDownOutside,
76
+ onInteractOutside,
75
77
  }: MultiAutocompleteProps<T>) {
76
78
  const [uncontrolledInputValue, setUncontrolledInputValue] =
77
79
  useState<string>("");
@@ -379,6 +381,8 @@ export function MultiAutocomplete<T extends DataWithId>({
379
381
  // Prevent default auto-focus behavior
380
382
  e.preventDefault();
381
383
  }}
384
+ onPointerDownOutside={onPointerDownOutside}
385
+ onInteractOutside={onInteractOutside}
382
386
  animationConfig={menuAnimationConfig}
383
387
  content={
384
388
  <ComboboxContent
@@ -65,6 +65,8 @@ export function SingleAutocomplete<T extends DataWithId>({
65
65
  menuProps,
66
66
  inputType = "icon",
67
67
  includePlaceholderItem = false,
68
+ onPointerDownOutside,
69
+ onInteractOutside,
68
70
  }: SingleAutocompleteProps<T>) {
69
71
  const [uncontrolledInputValue, setUncontrolledInputValue] =
70
72
  useState<string>("");
@@ -300,6 +302,8 @@ export function SingleAutocomplete<T extends DataWithId>({
300
302
  // Prevent default auto-focus behavior
301
303
  e.preventDefault();
302
304
  }}
305
+ onPointerDownOutside={onPointerDownOutside}
306
+ onInteractOutside={onInteractOutside}
303
307
  content={
304
308
  <ComboboxContent
305
309
  items={items}
@@ -46,6 +46,8 @@ export function Popout({
46
46
  onOpenAutoFocus,
47
47
  onEscapeKeyDown,
48
48
  onCloseAutoFocus,
49
+ onPointerDownOutside,
50
+ onInteractOutside,
49
51
  ...rest
50
52
  }: TypePopoutProps) {
51
53
  const [isOpen, setIsOpen] = React.useState(defaultOpen ?? false);
@@ -90,6 +92,8 @@ export function Popout({
90
92
  onOpenAutoFocus={onOpenAutoFocus}
91
93
  onEscapeKeyDown={onEscapeKeyDown}
92
94
  onCloseAutoFocus={onCloseAutoFocus}
95
+ onPointerDownOutside={onPointerDownOutside}
96
+ onInteractOutside={onInteractOutside}
93
97
  // This only needs added to Popouts used in Menus
94
98
  // those do not need the dialog role which radix applies automatically
95
99
  role="presentation"
@@ -89,4 +89,21 @@ export interface TypePopoutProps
89
89
  * Can be used to prevent the default focus return behavior or customize it.
90
90
  */
91
91
  onCloseAutoFocus?: (event: Event) => void;
92
+
93
+ /**
94
+ * Event handler called when a pointer down event occurs outside the popout content.
95
+ * Call `event.preventDefault()` to prevent the default dismiss behavior.
96
+ * Useful when the Popout is nested inside a Radix Dialog (e.g. ModalV2) to
97
+ * avoid conflicts between nested DismissableLayer instances.
98
+ */
99
+ onPointerDownOutside?: (
100
+ event: CustomEvent<{ originalEvent: PointerEvent }>
101
+ ) => void;
102
+
103
+ /**
104
+ * Event handler called when an interaction (pointer or focus) occurs outside
105
+ * the popout content. Call `event.preventDefault()` to prevent the popout
106
+ * from closing.
107
+ */
108
+ onInteractOutside?: (event: CustomEvent<{ originalEvent: Event }>) => void;
92
109
  }
@@ -18,6 +18,10 @@ export interface BaseSelectProps<T extends DataWithId> {
18
18
  onIsOpenChange?: (isOpen: boolean) => void;
19
19
  stateReducer?: any;
20
20
  menuProps?: React.HTMLAttributes<HTMLDivElement>;
21
+ onPointerDownOutside?: (
22
+ event: CustomEvent<{ originalEvent: PointerEvent }>
23
+ ) => void;
24
+ onInteractOutside?: (event: CustomEvent<{ originalEvent: Event }>) => void;
21
25
  }
22
26
  /**
23
27
  * Props common to all single-select components
@@ -76,6 +76,8 @@ export function SearchableMultiSelect<T extends DataWithId>({
76
76
  onIsOpenChange,
77
77
  stateReducer = defaultReducer,
78
78
  triggerButtonProps,
79
+ onPointerDownOutside,
80
+ onInteractOutside,
79
81
  }: SearchableMultiSelectProps<T>) {
80
82
  const [uncontrolledInputValue, setUncontrolledInputValue] =
81
83
  useState<string>("");
@@ -383,6 +385,8 @@ export function SearchableMultiSelect<T extends DataWithId>({
383
385
  // Prevent default auto-focus behavior
384
386
  e.preventDefault();
385
387
  }}
388
+ onPointerDownOutside={onPointerDownOutside}
389
+ onInteractOutside={onInteractOutside}
386
390
  content={
387
391
  <div>
388
392
  {/* Input inside the Popout */}
@@ -72,6 +72,8 @@ export function SearchableSelect<T extends DataWithId>({
72
72
  onIsOpenChange,
73
73
  stateReducer = defaultReducer,
74
74
  triggerButtonProps,
75
+ onPointerDownOutside,
76
+ onInteractOutside,
75
77
  }: SearchableSelectProps<T>) {
76
78
  const [uncontrolledInputValue, setUncontrolledInputValue] =
77
79
  useState<string>("");
@@ -273,6 +275,8 @@ export function SearchableSelect<T extends DataWithId>({
273
275
  // Prevent default auto-focus behavior
274
276
  e.preventDefault();
275
277
  }}
278
+ onPointerDownOutside={onPointerDownOutside}
279
+ onInteractOutside={onInteractOutside}
276
280
  content={
277
281
  <div>
278
282
  {/* Input inside the Popout */}
@@ -77,6 +77,8 @@ export function MultiSelect<T extends DataWithId>({
77
77
  menuProps,
78
78
  inputType = "checkbox",
79
79
  shouldOverflow,
80
+ onPointerDownOutside,
81
+ onInteractOutside,
80
82
  }: MultiSelectProps<T>) {
81
83
  const [uncontrolledSelectedItemIds, setUncontrolledSelectedItemIds] =
82
84
  useState<T["id"][]>([]);
@@ -341,6 +343,8 @@ export function MultiSelect<T extends DataWithId>({
341
343
  // Prevent default auto-focus behavior
342
344
  e.preventDefault();
343
345
  }}
346
+ onPointerDownOutside={onPointerDownOutside}
347
+ onInteractOutside={onInteractOutside}
344
348
  animationConfig={menuAnimationConfig}
345
349
  content={
346
350
  <ComboboxContent
@@ -64,6 +64,8 @@ export function SingleSelect<T extends DataWithId>({
64
64
  menuProps,
65
65
  inputType = "icon",
66
66
  removePlaceholderItem = false,
67
+ onPointerDownOutside,
68
+ onInteractOutside,
67
69
  }: SingleSelectProps<T>) {
68
70
  const [uncontrolledSelectedItemId, setUncontrolledSelectedItemId] = useState<
69
71
  T["id"] | null
@@ -221,6 +223,8 @@ export function SingleSelect<T extends DataWithId>({
221
223
  // Prevent default auto-focus behavior
222
224
  e.preventDefault();
223
225
  }}
226
+ onPointerDownOutside={onPointerDownOutside}
227
+ onInteractOutside={onInteractOutside}
224
228
  content={
225
229
  <ComboboxContent
226
230
  items={items}