@sproutsocial/seeds-react-menu 1.2.3 → 1.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/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +10 -0
- package/dist/esm/index.js +153 -113
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +5 -2
- package/dist/index.d.ts +5 -2
- package/dist/index.js +165 -126
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/Autocomplete/MultiAutocomplete.tsx +3 -0
- package/src/Autocomplete/SingleAutocomplete.tsx +3 -7
- package/src/Autocomplete/__tests__/Autocomplete.test.tsx +21 -0
- package/src/MenuContent/DefaultMenuEmptyState.tsx +17 -0
- package/src/MenuContent/MenuContent.tsx +14 -2
- package/src/MenuContent/MenuContentTypes.ts +2 -0
- package/src/MenuContent/__tests__/MenuContent.test.tsx +38 -17
- package/src/MenuContext.tsx +13 -0
- package/src/MenuItem/__tests__/MenuItem.test.tsx +11 -14
- package/src/MenuRoot/MenuRoot.tsx +9 -2
- package/src/SingleSelectMenu/SingleSelectMenu.stories.tsx +44 -0
- package/src/menuTestingUtils.tsx +12 -7
package/dist/esm/index.js
CHANGED
|
@@ -101,7 +101,8 @@ var defaultMenuContext = {
|
|
|
101
101
|
items: [],
|
|
102
102
|
itemsMap: {},
|
|
103
103
|
isItemSelected: () => false,
|
|
104
|
-
getInputComponentProps: () => ({})
|
|
104
|
+
getInputComponentProps: () => ({}),
|
|
105
|
+
hasVisibleItems: false
|
|
105
106
|
};
|
|
106
107
|
var getSelectedItemIds = (selectedItems) => selectedItems?.reduce(
|
|
107
108
|
(selected, item) => ({ ...selected, [item.id]: true }),
|
|
@@ -122,6 +123,8 @@ var useMenu = ({
|
|
|
122
123
|
selectedItems,
|
|
123
124
|
getInputProps,
|
|
124
125
|
contentRef: contentRefFromProps,
|
|
126
|
+
autoCloseOnEmpty,
|
|
127
|
+
hiddenItemsCount,
|
|
125
128
|
...rest
|
|
126
129
|
} = {}) => {
|
|
127
130
|
const contentRef = contentRefFromProps || React.createRef();
|
|
@@ -176,6 +179,9 @@ var useMenu = ({
|
|
|
176
179
|
},
|
|
177
180
|
[getInputProps]
|
|
178
181
|
);
|
|
182
|
+
const hasVisibleItems = useMemo(() => {
|
|
183
|
+
return (hiddenItemsCount ?? 0) < items.length;
|
|
184
|
+
}, [items, hiddenItemsCount]);
|
|
179
185
|
return {
|
|
180
186
|
isOpen,
|
|
181
187
|
isListbox,
|
|
@@ -188,6 +194,8 @@ var useMenu = ({
|
|
|
188
194
|
getInputProps,
|
|
189
195
|
getInputComponentProps,
|
|
190
196
|
contentRef,
|
|
197
|
+
hasVisibleItems,
|
|
198
|
+
autoCloseOnEmpty,
|
|
191
199
|
...menuProps
|
|
192
200
|
};
|
|
193
201
|
};
|
|
@@ -2301,7 +2309,23 @@ var useMenuChildren = ({
|
|
|
2301
2309
|
|
|
2302
2310
|
// src/MenuContent/MenuContent.tsx
|
|
2303
2311
|
import { useCallback } from "react";
|
|
2312
|
+
|
|
2313
|
+
// src/MenuContent/DefaultMenuEmptyState.tsx
|
|
2314
|
+
import styled4 from "styled-components";
|
|
2304
2315
|
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
2316
|
+
var StyledEmptyState = styled4.div`
|
|
2317
|
+
padding: ${({ theme: theme2 }) => theme2.space[350]};
|
|
2318
|
+
text-align: center;
|
|
2319
|
+
font-size: ${({ theme: theme2 }) => theme2.typography[200].fontSize};
|
|
2320
|
+
`;
|
|
2321
|
+
var DefaultMenuEmptyState = ({
|
|
2322
|
+
children
|
|
2323
|
+
}) => {
|
|
2324
|
+
return /* @__PURE__ */ jsx6(StyledEmptyState, { children: children || "No results found." });
|
|
2325
|
+
};
|
|
2326
|
+
|
|
2327
|
+
// src/MenuContent/MenuContent.tsx
|
|
2328
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
2305
2329
|
var MenuContent = ({
|
|
2306
2330
|
id = "menu_content",
|
|
2307
2331
|
children: childrenProp,
|
|
@@ -2309,11 +2333,21 @@ var MenuContent = ({
|
|
|
2309
2333
|
MenuItemComponent,
|
|
2310
2334
|
onKeyDown,
|
|
2311
2335
|
innerRef = null,
|
|
2336
|
+
emptyStateElement,
|
|
2312
2337
|
...rest
|
|
2313
2338
|
}) => {
|
|
2314
|
-
const {
|
|
2339
|
+
const {
|
|
2340
|
+
getToggleButtonProps,
|
|
2341
|
+
getMenuProps,
|
|
2342
|
+
isListbox,
|
|
2343
|
+
hasVisibleItems,
|
|
2344
|
+
autoCloseOnEmpty
|
|
2345
|
+
} = useMenuContentContext();
|
|
2315
2346
|
const toggleButtonProps = getToggleButtonProps?.();
|
|
2316
2347
|
const children = childrenProp || !menuItems || !menuItems.length ? childrenProp : mapMenuItems({ menuItems, MenuItemComponent });
|
|
2348
|
+
if (!hasVisibleItems && !autoCloseOnEmpty) {
|
|
2349
|
+
return emptyStateElement ?? /* @__PURE__ */ jsx7(DefaultMenuEmptyState, {});
|
|
2350
|
+
}
|
|
2317
2351
|
if (!children) {
|
|
2318
2352
|
return null;
|
|
2319
2353
|
}
|
|
@@ -2324,7 +2358,7 @@ var MenuContent = ({
|
|
|
2324
2358
|
},
|
|
2325
2359
|
[onKeyDown, toggleButtonProps?.["onKeyDown"]]
|
|
2326
2360
|
);
|
|
2327
|
-
return /* @__PURE__ */
|
|
2361
|
+
return /* @__PURE__ */ jsx7(
|
|
2328
2362
|
StyledMenuContent,
|
|
2329
2363
|
{
|
|
2330
2364
|
autoFocus: true,
|
|
@@ -2350,29 +2384,29 @@ MenuContent.__MENU_PRIMITIVE_TYPE = "MenuContent";
|
|
|
2350
2384
|
import "react";
|
|
2351
2385
|
|
|
2352
2386
|
// src/MenuFooter/styles.tsx
|
|
2353
|
-
import
|
|
2387
|
+
import styled5 from "styled-components";
|
|
2354
2388
|
import { Box as Box2 } from "@sproutsocial/seeds-react-box";
|
|
2355
|
-
var StyledMenuFooterBox =
|
|
2389
|
+
var StyledMenuFooterBox = styled5(Box2)`
|
|
2356
2390
|
padding: ${({ theme: theme2 }) => theme2.space[350]} ${({ theme: theme2 }) => theme2.space[400]};
|
|
2357
2391
|
border-top: 1px solid ${(p) => p.theme.colors.container.border.base};
|
|
2358
2392
|
`;
|
|
2359
2393
|
|
|
2360
2394
|
// src/MenuFooter/MenuFooter.tsx
|
|
2361
|
-
import { jsx as
|
|
2395
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
2362
2396
|
var MenuFooter = ({ children, ...rest }) => {
|
|
2363
|
-
return /* @__PURE__ */
|
|
2397
|
+
return /* @__PURE__ */ jsx8(StyledMenuFooterBox, { ...rest, children });
|
|
2364
2398
|
};
|
|
2365
2399
|
|
|
2366
2400
|
// src/MenuGroup/MenuGroup.tsx
|
|
2367
2401
|
import "react";
|
|
2368
2402
|
|
|
2369
2403
|
// src/MenuGroup/styles.tsx
|
|
2370
|
-
import
|
|
2404
|
+
import styled7 from "styled-components";
|
|
2371
2405
|
|
|
2372
2406
|
// ../seeds-react-text/dist/esm/index.js
|
|
2373
2407
|
import "react";
|
|
2374
2408
|
import styled22 from "styled-components";
|
|
2375
|
-
import
|
|
2409
|
+
import styled6, { css as css5 } from "styled-components";
|
|
2376
2410
|
import {
|
|
2377
2411
|
COMMON,
|
|
2378
2412
|
LAYOUT,
|
|
@@ -2380,9 +2414,9 @@ import {
|
|
|
2380
2414
|
GRID,
|
|
2381
2415
|
TYPOGRAPHY
|
|
2382
2416
|
} from "@sproutsocial/seeds-react-system-props";
|
|
2383
|
-
import { jsx as
|
|
2417
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
2384
2418
|
import "react";
|
|
2385
|
-
var Container =
|
|
2419
|
+
var Container = styled6.span`
|
|
2386
2420
|
margin: 0;
|
|
2387
2421
|
padding-left: 0;
|
|
2388
2422
|
padding-right: 0;
|
|
@@ -2441,7 +2475,7 @@ var SmallBodyCopy = styled22(styles_default)`
|
|
|
2441
2475
|
`;
|
|
2442
2476
|
var Text = ({ fontSize: fontSize2, children, qa, color: color2, ...rest }) => {
|
|
2443
2477
|
const qaText = typeof children === "string" ? children : void 0;
|
|
2444
|
-
return /* @__PURE__ */
|
|
2478
|
+
return /* @__PURE__ */ jsx9(
|
|
2445
2479
|
styles_default,
|
|
2446
2480
|
{
|
|
2447
2481
|
typeScale: fontSize2,
|
|
@@ -2456,7 +2490,7 @@ var Text = ({ fontSize: fontSize2, children, qa, color: color2, ...rest }) => {
|
|
|
2456
2490
|
var withTextLogic = (Component) => {
|
|
2457
2491
|
return ({ children, ...props }) => {
|
|
2458
2492
|
const qaText = typeof children === "string" ? children : void 0;
|
|
2459
|
-
return /* @__PURE__ */
|
|
2493
|
+
return /* @__PURE__ */ jsx9(Component, { "data-qa-text": qaText, ...props, children });
|
|
2460
2494
|
};
|
|
2461
2495
|
};
|
|
2462
2496
|
var HeadlineWithLogic = withTextLogic(Headline);
|
|
@@ -2484,7 +2518,7 @@ var Text_default = Text;
|
|
|
2484
2518
|
var index_default = Text_default;
|
|
2485
2519
|
|
|
2486
2520
|
// src/MenuGroup/styles.tsx
|
|
2487
|
-
var StyledMenuGroup =
|
|
2521
|
+
var StyledMenuGroup = styled7.li`
|
|
2488
2522
|
&:not(:last-child) {
|
|
2489
2523
|
border-bottom: 1px solid
|
|
2490
2524
|
${({ theme: theme2 }) => theme2.colors.container.border.base};
|
|
@@ -2500,18 +2534,18 @@ var StyledMenuGroup = styled6.li`
|
|
|
2500
2534
|
${layout}
|
|
2501
2535
|
${space}
|
|
2502
2536
|
`;
|
|
2503
|
-
var StyledTitle =
|
|
2537
|
+
var StyledTitle = styled7(index_default.SmallSubHeadline)`
|
|
2504
2538
|
font-size: ${({ theme: theme2 }) => theme2.typography[100].fontSize};
|
|
2505
2539
|
margin: ${({ theme: theme2 }) => theme2.space[400]} ${({ theme: theme2 }) => theme2.space[400]}
|
|
2506
2540
|
0px ${({ theme: theme2 }) => theme2.space[400]};
|
|
2507
2541
|
`;
|
|
2508
|
-
var StyledMenuGroupUl =
|
|
2542
|
+
var StyledMenuGroupUl = styled7.ul`
|
|
2509
2543
|
margin: 0;
|
|
2510
2544
|
padding: 0;
|
|
2511
2545
|
`;
|
|
2512
2546
|
|
|
2513
2547
|
// src/MenuGroup/MenuGroup.tsx
|
|
2514
|
-
import { jsx as
|
|
2548
|
+
import { jsx as jsx10, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
2515
2549
|
var MenuGroup = ({
|
|
2516
2550
|
titleAs = "h3",
|
|
2517
2551
|
children: childrenProp,
|
|
@@ -2538,8 +2572,8 @@ var MenuGroup = ({
|
|
|
2538
2572
|
color: color2,
|
|
2539
2573
|
...rest,
|
|
2540
2574
|
children: [
|
|
2541
|
-
title && /* @__PURE__ */
|
|
2542
|
-
/* @__PURE__ */
|
|
2575
|
+
title && /* @__PURE__ */ jsx10(StyledTitle, { role: "heading", as: titleAs, id: titleId, children: title }),
|
|
2576
|
+
/* @__PURE__ */ jsx10(StyledMenuGroupUl, { children })
|
|
2543
2577
|
]
|
|
2544
2578
|
}
|
|
2545
2579
|
);
|
|
@@ -2549,9 +2583,10 @@ MenuGroup.__MENU_PRIMITIVE_TYPE = "MenuGroup";
|
|
|
2549
2583
|
// src/MenuRoot/MenuRoot.tsx
|
|
2550
2584
|
import React7, {
|
|
2551
2585
|
useCallback as useCallback2,
|
|
2586
|
+
useEffect,
|
|
2552
2587
|
useLayoutEffect
|
|
2553
2588
|
} from "react";
|
|
2554
|
-
import
|
|
2589
|
+
import styled8 from "styled-components";
|
|
2555
2590
|
import { Popout } from "@sproutsocial/seeds-react-popout";
|
|
2556
2591
|
import { mergeRefs } from "@sproutsocial/seeds-react-utilities";
|
|
2557
2592
|
|
|
@@ -2559,8 +2594,8 @@ import { mergeRefs } from "@sproutsocial/seeds-react-utilities";
|
|
|
2559
2594
|
var MOTION_DURATION_FAST = 0.15;
|
|
2560
2595
|
|
|
2561
2596
|
// src/MenuRoot/MenuRoot.tsx
|
|
2562
|
-
import { jsx as
|
|
2563
|
-
var CustomPopoutContent =
|
|
2597
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
2598
|
+
var CustomPopoutContent = styled8(Popout.Content)`
|
|
2564
2599
|
padding: 0;
|
|
2565
2600
|
margin-left: 0;
|
|
2566
2601
|
margin-right: 0;
|
|
@@ -2608,12 +2643,12 @@ var MenuPopout = ({
|
|
|
2608
2643
|
},
|
|
2609
2644
|
[openMenu, closeMenu]
|
|
2610
2645
|
);
|
|
2611
|
-
return /* @__PURE__ */
|
|
2646
|
+
return /* @__PURE__ */ jsx11(
|
|
2612
2647
|
Popout,
|
|
2613
2648
|
{
|
|
2614
2649
|
isOpen: !!isOpen,
|
|
2615
2650
|
setIsOpen,
|
|
2616
|
-
content: (props) => /* @__PURE__ */
|
|
2651
|
+
content: (props) => /* @__PURE__ */ jsx11(CustomPopoutContent, { width: popoutProps.fullWidth ? "initial" : width2, children: typeof content === "function" ? content(props) : content }),
|
|
2617
2652
|
focusLockProps: {
|
|
2618
2653
|
// correct jerking motion when scrolling while the Popout is open
|
|
2619
2654
|
// returnFocus: false,
|
|
@@ -2638,9 +2673,8 @@ var MenuRoot = ({
|
|
|
2638
2673
|
openMenu,
|
|
2639
2674
|
closeMenu,
|
|
2640
2675
|
inputValue,
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
getMenuProps
|
|
2676
|
+
getMenuProps,
|
|
2677
|
+
autoCloseOnEmpty = false
|
|
2644
2678
|
} = contextProps;
|
|
2645
2679
|
const toggleElementRef = React7.useRef(null);
|
|
2646
2680
|
const [finalWidth, setFinalWidth] = React7.useState();
|
|
@@ -2657,17 +2691,23 @@ var MenuRoot = ({
|
|
|
2657
2691
|
}, [width2, toggleElementRef.current?.offsetWidth]);
|
|
2658
2692
|
const menuContext = useMenu(contextProps);
|
|
2659
2693
|
getMenuProps?.({}, { suppressRefError: true });
|
|
2660
|
-
|
|
2694
|
+
useEffect(() => {
|
|
2695
|
+
if (!inputValue || !autoCloseOnEmpty) return;
|
|
2696
|
+
if (!menuContext.hasVisibleItems && isOpen) {
|
|
2697
|
+
closeMenu?.();
|
|
2698
|
+
}
|
|
2699
|
+
}, [menuContext.hasVisibleItems, isOpen, inputValue, autoCloseOnEmpty]);
|
|
2700
|
+
return /* @__PURE__ */ jsx11(
|
|
2661
2701
|
MenuPopout,
|
|
2662
2702
|
{
|
|
2663
2703
|
placement,
|
|
2664
2704
|
isOpen: !!isOpen,
|
|
2665
2705
|
openMenu,
|
|
2666
2706
|
closeMenu,
|
|
2667
|
-
content: /* @__PURE__ */
|
|
2707
|
+
content: /* @__PURE__ */ jsx11(MenuContentProvider, { menuContext, children }),
|
|
2668
2708
|
width: finalWidth,
|
|
2669
2709
|
...popoutProps,
|
|
2670
|
-
children: (toggleProps) => /* @__PURE__ */
|
|
2710
|
+
children: (toggleProps) => /* @__PURE__ */ jsx11(
|
|
2671
2711
|
MenuToggleProvider,
|
|
2672
2712
|
{
|
|
2673
2713
|
menuContext: {
|
|
@@ -2688,7 +2728,7 @@ var MenuRoot = ({
|
|
|
2688
2728
|
// src/MenuLabel.tsx
|
|
2689
2729
|
import "react";
|
|
2690
2730
|
import { Label } from "@sproutsocial/seeds-react-label";
|
|
2691
|
-
import { jsx as
|
|
2731
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
2692
2732
|
var MenuLabel = ({
|
|
2693
2733
|
children,
|
|
2694
2734
|
required = false,
|
|
@@ -2697,7 +2737,7 @@ var MenuLabel = ({
|
|
|
2697
2737
|
const { getLabelProps } = useMenuToggleContext();
|
|
2698
2738
|
return (
|
|
2699
2739
|
// This fallback id should never be used, but it is here to satisfy TypeScript since getLabelProps could be undefined.
|
|
2700
|
-
/* @__PURE__ */
|
|
2740
|
+
/* @__PURE__ */ jsx12(
|
|
2701
2741
|
Label,
|
|
2702
2742
|
{
|
|
2703
2743
|
htmlFor: "fallback_menu_label",
|
|
@@ -2712,10 +2752,10 @@ var MenuLabel = ({
|
|
|
2712
2752
|
|
|
2713
2753
|
// src/MenuToggleButton/MenuToggleButton.tsx
|
|
2714
2754
|
import { Button } from "@sproutsocial/seeds-react-button";
|
|
2715
|
-
import { jsx as
|
|
2755
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
2716
2756
|
var MenuToggleButton = (props) => {
|
|
2717
2757
|
const { getToggleButtonProps, isListbox, getDropdownProps, ref, ariaProps } = useMenuToggleContext();
|
|
2718
|
-
return /* @__PURE__ */
|
|
2758
|
+
return /* @__PURE__ */ jsx13(
|
|
2719
2759
|
Button,
|
|
2720
2760
|
{
|
|
2721
2761
|
appearance: "secondary",
|
|
@@ -2775,7 +2815,7 @@ var useItemFiltering = ({
|
|
|
2775
2815
|
};
|
|
2776
2816
|
|
|
2777
2817
|
// src/MenuSearchInput/MenuSearchInput.tsx
|
|
2778
|
-
import { jsx as
|
|
2818
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
2779
2819
|
var MenuSearchInput = ({
|
|
2780
2820
|
getIsItemVisible,
|
|
2781
2821
|
inputProps,
|
|
@@ -2805,7 +2845,7 @@ var MenuSearchInput = ({
|
|
|
2805
2845
|
},
|
|
2806
2846
|
[toggleButtonProps.onKeyDown]
|
|
2807
2847
|
);
|
|
2808
|
-
return /* @__PURE__ */
|
|
2848
|
+
return /* @__PURE__ */ jsx14(
|
|
2809
2849
|
Input,
|
|
2810
2850
|
{
|
|
2811
2851
|
onChange: (e, value) => {
|
|
@@ -2826,12 +2866,12 @@ var MenuSearchInput = ({
|
|
|
2826
2866
|
|
|
2827
2867
|
// src/MenuTokenInput.tsx
|
|
2828
2868
|
import React11 from "react";
|
|
2829
|
-
import
|
|
2869
|
+
import styled9 from "styled-components";
|
|
2830
2870
|
import {
|
|
2831
2871
|
TokenInput
|
|
2832
2872
|
} from "@sproutsocial/seeds-react-token-input";
|
|
2833
|
-
import { jsx as
|
|
2834
|
-
var StyledTokenInputWrapper =
|
|
2873
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
2874
|
+
var StyledTokenInputWrapper = styled9.div`
|
|
2835
2875
|
> div {
|
|
2836
2876
|
padding: 4px;
|
|
2837
2877
|
}
|
|
@@ -2865,7 +2905,7 @@ var MenuTokenInput = ({
|
|
|
2865
2905
|
const tokenToRemove = selectedItems?.find((item) => item.id === tokenId);
|
|
2866
2906
|
tokenToRemove && removeSelectedItem?.(tokenToRemove);
|
|
2867
2907
|
};
|
|
2868
|
-
return /* @__PURE__ */
|
|
2908
|
+
return /* @__PURE__ */ jsx15(StyledTokenInputWrapper, { children: /* @__PURE__ */ jsx15(
|
|
2869
2909
|
TokenInput,
|
|
2870
2910
|
{
|
|
2871
2911
|
onKeyDown: (e, value) => {
|
|
@@ -2915,7 +2955,7 @@ var MenuTokenInput = ({
|
|
|
2915
2955
|
|
|
2916
2956
|
// src/MenuSearchTokenInput/MenuSearchTokenInput.tsx
|
|
2917
2957
|
import React12 from "react";
|
|
2918
|
-
import { jsx as
|
|
2958
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
2919
2959
|
var MenuSearchTokenInput = ({
|
|
2920
2960
|
getIsItemVisible,
|
|
2921
2961
|
getTokenProps,
|
|
@@ -2963,7 +3003,7 @@ var MenuSearchTokenInput = ({
|
|
|
2963
3003
|
},
|
|
2964
3004
|
[toggleButtonProps.onKeyDown]
|
|
2965
3005
|
);
|
|
2966
|
-
return /* @__PURE__ */
|
|
3006
|
+
return /* @__PURE__ */ jsx16(
|
|
2967
3007
|
MenuTokenInput,
|
|
2968
3008
|
{
|
|
2969
3009
|
onChange: (e, value2) => {
|
|
@@ -2988,7 +3028,7 @@ import React13 from "react";
|
|
|
2988
3028
|
import { Icon as Icon2 } from "@sproutsocial/seeds-react-icon";
|
|
2989
3029
|
import { Box as Box3 } from "@sproutsocial/seeds-react-box";
|
|
2990
3030
|
import { mergeRefs as mergeRefs2 } from "@sproutsocial/seeds-react-utilities";
|
|
2991
|
-
import { jsx as
|
|
3031
|
+
import { jsx as jsx17, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
2992
3032
|
var SubmenuItemTrigger = ({
|
|
2993
3033
|
id,
|
|
2994
3034
|
children,
|
|
@@ -2997,7 +3037,7 @@ var SubmenuItemTrigger = ({
|
|
|
2997
3037
|
}) => {
|
|
2998
3038
|
const { getToggleButtonProps, getDropdownProps, ref, ariaProps } = useMenuToggleContext();
|
|
2999
3039
|
const toggleRef = ref && innerRef ? mergeRefs2([ref, innerRef].filter(Boolean)) : ref || innerRef;
|
|
3000
|
-
return /* @__PURE__ */
|
|
3040
|
+
return /* @__PURE__ */ jsx17(
|
|
3001
3041
|
MenuItem,
|
|
3002
3042
|
{
|
|
3003
3043
|
...rest,
|
|
@@ -3016,7 +3056,7 @@ var SubmenuItemTrigger = ({
|
|
|
3016
3056
|
id,
|
|
3017
3057
|
children: /* @__PURE__ */ jsxs4(Box3, { display: "flex", justifyContent: "space-between", children: [
|
|
3018
3058
|
children,
|
|
3019
|
-
/* @__PURE__ */
|
|
3059
|
+
/* @__PURE__ */ jsx17(MenuItemActionRight, { children: /* @__PURE__ */ jsx17(Icon2, { name: "chevron-right-outline" }) })
|
|
3020
3060
|
] })
|
|
3021
3061
|
}
|
|
3022
3062
|
);
|
|
@@ -3126,7 +3166,7 @@ var SubmenuItem = ({
|
|
|
3126
3166
|
};
|
|
3127
3167
|
}
|
|
3128
3168
|
}, [document, onSubmenuKeydown]);
|
|
3129
|
-
const subMenuContent = /* @__PURE__ */
|
|
3169
|
+
const subMenuContent = /* @__PURE__ */ jsx17(
|
|
3130
3170
|
"div",
|
|
3131
3171
|
{
|
|
3132
3172
|
ref: submenuRef,
|
|
@@ -3137,13 +3177,13 @@ var SubmenuItem = ({
|
|
|
3137
3177
|
children: menuContent
|
|
3138
3178
|
}
|
|
3139
3179
|
);
|
|
3140
|
-
return /* @__PURE__ */
|
|
3180
|
+
return /* @__PURE__ */ jsx17(
|
|
3141
3181
|
MenuComponent,
|
|
3142
3182
|
{
|
|
3143
3183
|
...{
|
|
3144
3184
|
...menuProps,
|
|
3145
3185
|
children: subMenuContent,
|
|
3146
|
-
menuToggleElement: /* @__PURE__ */
|
|
3186
|
+
menuToggleElement: /* @__PURE__ */ jsx17(
|
|
3147
3187
|
SubmenuItemTrigger,
|
|
3148
3188
|
{
|
|
3149
3189
|
innerRef: submenuItemRef,
|
|
@@ -3175,17 +3215,17 @@ var SubmenuItem = ({
|
|
|
3175
3215
|
SubmenuItem.__MENU_PRIMITIVE_TYPE = "MenuItem";
|
|
3176
3216
|
|
|
3177
3217
|
// src/ListboxToggleButton.tsx
|
|
3178
|
-
import
|
|
3218
|
+
import styled10, { css as css6 } from "styled-components";
|
|
3179
3219
|
import { Icon as Icon3 } from "@sproutsocial/seeds-react-icon";
|
|
3180
|
-
import { jsx as
|
|
3181
|
-
var StyledListboxToggleButton =
|
|
3220
|
+
import { jsx as jsx18, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
3221
|
+
var StyledListboxToggleButton = styled10(
|
|
3182
3222
|
MenuToggleButton
|
|
3183
3223
|
)`
|
|
3184
3224
|
${(props) => props.invalid && css6`
|
|
3185
3225
|
border-color: ${(props2) => props2.theme.colors.form.border.error};
|
|
3186
3226
|
`}
|
|
3187
3227
|
`;
|
|
3188
|
-
var StyledChevron =
|
|
3228
|
+
var StyledChevron = styled10.div`
|
|
3189
3229
|
margin-left: ${({ theme: theme2 }) => theme2.space[300]};
|
|
3190
3230
|
${({ $isOpen }) => $isOpen && `
|
|
3191
3231
|
transform: rotate(-180deg);
|
|
@@ -3196,7 +3236,7 @@ var StyledChevron = styled9.div`
|
|
|
3196
3236
|
color: ${(props) => props.theme.colors.icon.error};
|
|
3197
3237
|
`}
|
|
3198
3238
|
`;
|
|
3199
|
-
var StyledInnerButton =
|
|
3239
|
+
var StyledInnerButton = styled10.div`
|
|
3200
3240
|
display: flex;
|
|
3201
3241
|
justify-content: space-between;
|
|
3202
3242
|
`;
|
|
@@ -3205,9 +3245,9 @@ var ListboxToggleButton = ({
|
|
|
3205
3245
|
...buttonProps
|
|
3206
3246
|
}) => {
|
|
3207
3247
|
const { isOpen } = useMenuToggleContext();
|
|
3208
|
-
return /* @__PURE__ */
|
|
3248
|
+
return /* @__PURE__ */ jsx18(StyledListboxToggleButton, { appearance: "secondary", ...buttonProps, children: /* @__PURE__ */ jsxs5(StyledInnerButton, { children: [
|
|
3209
3249
|
children,
|
|
3210
|
-
/* @__PURE__ */
|
|
3250
|
+
/* @__PURE__ */ jsx18(StyledChevron, { $isOpen: isOpen, invalid: buttonProps.invalid, children: /* @__PURE__ */ jsx18(Icon3, { name: "chevron-down-outline", fixedWidth: true, "aria-hidden": true }) })
|
|
3211
3251
|
] }) });
|
|
3212
3252
|
};
|
|
3213
3253
|
|
|
@@ -3378,7 +3418,7 @@ var useDownshiftDefaults = ({
|
|
|
3378
3418
|
};
|
|
3379
3419
|
|
|
3380
3420
|
// src/ActionMenu/ActionMenu.tsx
|
|
3381
|
-
import { jsx as
|
|
3421
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
3382
3422
|
var handleStateChange = (changes, currentSelectedItem) => {
|
|
3383
3423
|
if (!(changes.type === useSelect2.stateChangeTypes.ToggleButtonKeyDownEnter || changes.type === useSelect2.stateChangeTypes.ToggleButtonKeyDownSpaceButton)) {
|
|
3384
3424
|
return;
|
|
@@ -3441,7 +3481,7 @@ var ActionMenu = ({
|
|
|
3441
3481
|
useEffect2(() => {
|
|
3442
3482
|
setCurrentSelectedItem(useSelectReturnProps.selectedItem);
|
|
3443
3483
|
}, [useSelectReturnProps.selectedItem]);
|
|
3444
|
-
return /* @__PURE__ */
|
|
3484
|
+
return /* @__PURE__ */ jsx19(
|
|
3445
3485
|
MenuRootComponent,
|
|
3446
3486
|
{
|
|
3447
3487
|
...{
|
|
@@ -3462,7 +3502,7 @@ var ActionMenu = ({
|
|
|
3462
3502
|
// src/SingleSelectMenu/SingleSelectMenu.tsx
|
|
3463
3503
|
import "react";
|
|
3464
3504
|
import { useSelect as useSelect3 } from "downshift";
|
|
3465
|
-
import { jsx as
|
|
3505
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
3466
3506
|
var SingleSelectMenu = ({
|
|
3467
3507
|
children: childrenProp,
|
|
3468
3508
|
stateReducer: externalStateReducer,
|
|
@@ -3489,7 +3529,7 @@ var SingleSelectMenu = ({
|
|
|
3489
3529
|
),
|
|
3490
3530
|
...useSelectProps
|
|
3491
3531
|
});
|
|
3492
|
-
return /* @__PURE__ */
|
|
3532
|
+
return /* @__PURE__ */ jsx20(
|
|
3493
3533
|
MenuRootComponent,
|
|
3494
3534
|
{
|
|
3495
3535
|
...{
|
|
@@ -3510,7 +3550,7 @@ var SingleSelectMenu = ({
|
|
|
3510
3550
|
// src/MultiSelectMenu/MultiSelectMenu.tsx
|
|
3511
3551
|
import "react";
|
|
3512
3552
|
import { useSelect as useSelect4, useMultipleSelection } from "downshift";
|
|
3513
|
-
import { jsx as
|
|
3553
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
3514
3554
|
var MultiSelectMenu = ({
|
|
3515
3555
|
children: childrenProp,
|
|
3516
3556
|
menuItems,
|
|
@@ -3583,7 +3623,7 @@ var MultiSelectMenu = ({
|
|
|
3583
3623
|
},
|
|
3584
3624
|
...useSelectProps
|
|
3585
3625
|
});
|
|
3586
|
-
return /* @__PURE__ */
|
|
3626
|
+
return /* @__PURE__ */ jsx21(
|
|
3587
3627
|
MenuRootComponent,
|
|
3588
3628
|
{
|
|
3589
3629
|
...{
|
|
@@ -3614,9 +3654,9 @@ var MultiSelectMenu = ({
|
|
|
3614
3654
|
import "react";
|
|
3615
3655
|
|
|
3616
3656
|
// src/Autocomplete/SingleAutocomplete.tsx
|
|
3617
|
-
import
|
|
3657
|
+
import "react";
|
|
3618
3658
|
import { useCombobox as useCombobox2 } from "downshift";
|
|
3619
|
-
import { jsx as
|
|
3659
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
3620
3660
|
var SingleAutocomplete = ({
|
|
3621
3661
|
children: childrenProp,
|
|
3622
3662
|
stateReducer: externalStateReducer,
|
|
@@ -3652,13 +3692,8 @@ var SingleAutocomplete = ({
|
|
|
3652
3692
|
...useComboboxProps
|
|
3653
3693
|
});
|
|
3654
3694
|
const { isOpen, closeMenu, inputValue } = useComboboxReturnProps;
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
if (allMenuItems && hiddenItemsCount >= allMenuItems.length && isOpen) {
|
|
3658
|
-
closeMenu?.();
|
|
3659
|
-
}
|
|
3660
|
-
}, [hiddenItemsCount, allMenuItems?.length, isOpen, inputValue]);
|
|
3661
|
-
return /* @__PURE__ */ jsx21(
|
|
3695
|
+
const { popoutProps: userPopoutProps } = useComboboxProps;
|
|
3696
|
+
return /* @__PURE__ */ jsx22(
|
|
3662
3697
|
MenuRootComponent,
|
|
3663
3698
|
{
|
|
3664
3699
|
...{
|
|
@@ -3670,8 +3705,10 @@ var SingleAutocomplete = ({
|
|
|
3670
3705
|
...downshiftDefaults
|
|
3671
3706
|
},
|
|
3672
3707
|
popoutProps: {
|
|
3673
|
-
focusOnContent: false
|
|
3708
|
+
focusOnContent: false,
|
|
3709
|
+
...userPopoutProps
|
|
3674
3710
|
},
|
|
3711
|
+
autoCloseOnEmpty: true,
|
|
3675
3712
|
children
|
|
3676
3713
|
}
|
|
3677
3714
|
);
|
|
@@ -3680,7 +3717,7 @@ var SingleAutocomplete = ({
|
|
|
3680
3717
|
// src/Autocomplete/MultiAutocomplete.tsx
|
|
3681
3718
|
import React19 from "react";
|
|
3682
3719
|
import { useCombobox as useCombobox3, useMultipleSelection as useMultipleSelection2 } from "downshift";
|
|
3683
|
-
import { jsx as
|
|
3720
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
3684
3721
|
var MultiAutocomplete = ({
|
|
3685
3722
|
children: childrenProp,
|
|
3686
3723
|
stateReducer: externalStateReducer,
|
|
@@ -3787,13 +3824,14 @@ var MultiAutocomplete = ({
|
|
|
3787
3824
|
...useComboboxProps
|
|
3788
3825
|
});
|
|
3789
3826
|
const { isOpen, closeMenu, inputValue } = useComboboxReturnProps;
|
|
3827
|
+
const { popoutProps: userPopoutProps } = useComboboxProps;
|
|
3790
3828
|
React19.useEffect(() => {
|
|
3791
3829
|
if (!inputValue) return;
|
|
3792
3830
|
if (allMenuItems && hiddenItemsCount >= allMenuItems.length && isOpen) {
|
|
3793
3831
|
closeMenu?.();
|
|
3794
3832
|
}
|
|
3795
3833
|
}, [hiddenItemsCount, allMenuItems?.length, isOpen, inputValue]);
|
|
3796
|
-
return /* @__PURE__ */
|
|
3834
|
+
return /* @__PURE__ */ jsx23(
|
|
3797
3835
|
MenuRootComponent,
|
|
3798
3836
|
{
|
|
3799
3837
|
...{
|
|
@@ -3812,29 +3850,31 @@ var MultiAutocomplete = ({
|
|
|
3812
3850
|
...downshiftDefaults
|
|
3813
3851
|
},
|
|
3814
3852
|
popoutProps: {
|
|
3815
|
-
focusOnContent: false
|
|
3853
|
+
focusOnContent: false,
|
|
3854
|
+
...userPopoutProps
|
|
3816
3855
|
},
|
|
3856
|
+
autoCloseOnEmpty: true,
|
|
3817
3857
|
children
|
|
3818
3858
|
}
|
|
3819
3859
|
);
|
|
3820
3860
|
};
|
|
3821
3861
|
|
|
3822
3862
|
// src/Autocomplete/Autocomplete.tsx
|
|
3823
|
-
import { jsx as
|
|
3863
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
3824
3864
|
var Autocomplete = ({
|
|
3825
3865
|
multiSelect = false,
|
|
3826
3866
|
...rest
|
|
3827
3867
|
}) => {
|
|
3828
3868
|
if (multiSelect) {
|
|
3829
|
-
return /* @__PURE__ */
|
|
3869
|
+
return /* @__PURE__ */ jsx24(MultiAutocomplete, { ...rest });
|
|
3830
3870
|
}
|
|
3831
|
-
return /* @__PURE__ */
|
|
3871
|
+
return /* @__PURE__ */ jsx24(SingleAutocomplete, { ...rest });
|
|
3832
3872
|
};
|
|
3833
3873
|
|
|
3834
3874
|
// src/Autocomplete/AutocompleteInput.tsx
|
|
3835
3875
|
import "react";
|
|
3836
3876
|
import { Input as Input2 } from "@sproutsocial/seeds-react-input";
|
|
3837
|
-
import { jsx as
|
|
3877
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
3838
3878
|
var AutocompleteInput = ({
|
|
3839
3879
|
onKeyDown,
|
|
3840
3880
|
onChange,
|
|
@@ -3845,7 +3885,7 @@ var AutocompleteInput = ({
|
|
|
3845
3885
|
...rest
|
|
3846
3886
|
}) => {
|
|
3847
3887
|
const { getInputComponentProps, inputValue, ref, ariaProps } = useMenuToggleContext();
|
|
3848
|
-
return /* @__PURE__ */
|
|
3888
|
+
return /* @__PURE__ */ jsx25(
|
|
3849
3889
|
Input2,
|
|
3850
3890
|
{
|
|
3851
3891
|
id: "autocomplete_input",
|
|
@@ -3871,7 +3911,7 @@ var AutocompleteInput = ({
|
|
|
3871
3911
|
|
|
3872
3912
|
// src/Autocomplete/AutocompleteTokenInput.tsx
|
|
3873
3913
|
import "react";
|
|
3874
|
-
import { jsx as
|
|
3914
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
3875
3915
|
var AutocompleteTokenInput = ({
|
|
3876
3916
|
onKeyDown,
|
|
3877
3917
|
onChange,
|
|
@@ -3890,7 +3930,7 @@ var AutocompleteTokenInput = ({
|
|
|
3890
3930
|
ref,
|
|
3891
3931
|
ariaProps
|
|
3892
3932
|
} = useMenuToggleContext();
|
|
3893
|
-
return /* @__PURE__ */
|
|
3933
|
+
return /* @__PURE__ */ jsx26(
|
|
3894
3934
|
MenuTokenInput,
|
|
3895
3935
|
{
|
|
3896
3936
|
id: "autocomplete_input",
|
|
@@ -3915,19 +3955,19 @@ var AutocompleteTokenInput = ({
|
|
|
3915
3955
|
// src/Autocomplete/AutocompleteSelect.tsx
|
|
3916
3956
|
import Icon4 from "@sproutsocial/seeds-react-icon";
|
|
3917
3957
|
import "react";
|
|
3918
|
-
import
|
|
3958
|
+
import styled11 from "styled-components";
|
|
3919
3959
|
import { Accessory } from "@sproutsocial/seeds-react-input";
|
|
3920
|
-
import { jsx as
|
|
3921
|
-
var StyledAutocompleteInput =
|
|
3960
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
3961
|
+
var StyledAutocompleteInput = styled11(AutocompleteInput)`
|
|
3922
3962
|
${Accessory} {
|
|
3923
3963
|
pointer-events: none;
|
|
3924
3964
|
}
|
|
3925
3965
|
`;
|
|
3926
3966
|
var AutocompleteSelect = (props) => {
|
|
3927
|
-
return /* @__PURE__ */
|
|
3967
|
+
return /* @__PURE__ */ jsx27(
|
|
3928
3968
|
StyledAutocompleteInput,
|
|
3929
3969
|
{
|
|
3930
|
-
elemAfter: /* @__PURE__ */
|
|
3970
|
+
elemAfter: /* @__PURE__ */ jsx27(Icon4, { name: "chevron-down" }),
|
|
3931
3971
|
...props
|
|
3932
3972
|
}
|
|
3933
3973
|
);
|
|
@@ -3964,7 +4004,7 @@ var nestedMenuStateReducer = (_state, actionAndChanges) => {
|
|
|
3964
4004
|
|
|
3965
4005
|
// src/NestedMenu/NestedMenuContext.tsx
|
|
3966
4006
|
import { createContext as createContext2, useContext as useContext5 } from "react";
|
|
3967
|
-
import { jsx as
|
|
4007
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
3968
4008
|
var defaultNestedMenuContext = {
|
|
3969
4009
|
selectedMenuPath: [],
|
|
3970
4010
|
setSelectedMenuId: () => {
|
|
@@ -3988,7 +4028,7 @@ var NestedMenuProvider = ({
|
|
|
3988
4028
|
children,
|
|
3989
4029
|
...nestedMenuProps
|
|
3990
4030
|
}) => {
|
|
3991
|
-
return /* @__PURE__ */
|
|
4031
|
+
return /* @__PURE__ */ jsx28(NestedMenuContext.Provider, { value: nestedMenuProps, children });
|
|
3992
4032
|
};
|
|
3993
4033
|
var useNestedMenuContext = () => {
|
|
3994
4034
|
const nestedMenuContextValue = useContext5(NestedMenuContext);
|
|
@@ -4007,7 +4047,7 @@ import { mergeRefs as mergeRefs3 } from "@sproutsocial/seeds-react-utilities";
|
|
|
4007
4047
|
// src/NestedMenu/NestedMenuItem.tsx
|
|
4008
4048
|
import { Icon as Icon5 } from "@sproutsocial/seeds-react-icon";
|
|
4009
4049
|
import { Box as Box4 } from "@sproutsocial/seeds-react-box";
|
|
4010
|
-
import { jsx as
|
|
4050
|
+
import { jsx as jsx29, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
4011
4051
|
var NestedMenuItem = ({
|
|
4012
4052
|
children,
|
|
4013
4053
|
childMenuId,
|
|
@@ -4023,15 +4063,15 @@ var NestedMenuItem = ({
|
|
|
4023
4063
|
}
|
|
4024
4064
|
}
|
|
4025
4065
|
} : {};
|
|
4026
|
-
return /* @__PURE__ */
|
|
4066
|
+
return /* @__PURE__ */ jsx29(MenuItem, { ...onClickProps, ...rest, children: /* @__PURE__ */ jsxs6(Box4, { display: "flex", justifyContent: "space-between", children: [
|
|
4027
4067
|
children,
|
|
4028
|
-
childMenuId && /* @__PURE__ */
|
|
4068
|
+
childMenuId && /* @__PURE__ */ jsx29(MenuItemActionRight, { children: /* @__PURE__ */ jsx29(Icon5, { name: "arrow-right-outline" }) })
|
|
4029
4069
|
] }) });
|
|
4030
4070
|
};
|
|
4031
4071
|
NestedMenuItem.__MENU_PRIMITIVE_TYPE = "MenuItem";
|
|
4032
4072
|
|
|
4033
4073
|
// src/NestedMenu/NestedMenuContent.tsx
|
|
4034
|
-
import { jsx as
|
|
4074
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
4035
4075
|
var NestedMenuContent = ({
|
|
4036
4076
|
innerRef: innerRefProp = null,
|
|
4037
4077
|
onKeyDown: onKeyDownProp,
|
|
@@ -4068,7 +4108,7 @@ var NestedMenuContent = ({
|
|
|
4068
4108
|
break;
|
|
4069
4109
|
}
|
|
4070
4110
|
};
|
|
4071
|
-
return /* @__PURE__ */
|
|
4111
|
+
return /* @__PURE__ */ jsx30(
|
|
4072
4112
|
MenuContent,
|
|
4073
4113
|
{
|
|
4074
4114
|
onKeyDown,
|
|
@@ -4084,17 +4124,17 @@ NestedMenuContent.__MENU_PRIMITIVE_TYPE = "MenuContent";
|
|
|
4084
4124
|
import { Button as Button2 } from "@sproutsocial/seeds-react-button";
|
|
4085
4125
|
import { Icon as Icon6 } from "@sproutsocial/seeds-react-icon";
|
|
4086
4126
|
import { AnimatePresence, motion } from "motion/react";
|
|
4087
|
-
import { jsx as
|
|
4127
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
4088
4128
|
var NestedMenuHeader = ({
|
|
4089
4129
|
backArrowLabel,
|
|
4090
4130
|
...props
|
|
4091
4131
|
}) => {
|
|
4092
4132
|
const { goBack, selectedMenuPath, animationSpeed } = useNestedMenuContext();
|
|
4093
4133
|
const showBackArrow = selectedMenuPath.length > 1;
|
|
4094
|
-
return /* @__PURE__ */
|
|
4134
|
+
return /* @__PURE__ */ jsx31(
|
|
4095
4135
|
MenuHeader,
|
|
4096
4136
|
{
|
|
4097
|
-
leftAction: /* @__PURE__ */
|
|
4137
|
+
leftAction: /* @__PURE__ */ jsx31(AnimatePresence, { mode: "wait", children: /* @__PURE__ */ jsx31(
|
|
4098
4138
|
motion.div,
|
|
4099
4139
|
{
|
|
4100
4140
|
initial: { opacity: 0 },
|
|
@@ -4103,7 +4143,7 @@ var NestedMenuHeader = ({
|
|
|
4103
4143
|
opacity: 0,
|
|
4104
4144
|
transition: { duration: animationSpeed }
|
|
4105
4145
|
},
|
|
4106
|
-
children: showBackArrow ? /* @__PURE__ */
|
|
4146
|
+
children: showBackArrow ? /* @__PURE__ */ jsx31(Button2, { onClick: goBack, ariaLabel: backArrowLabel, children: /* @__PURE__ */ jsx31(Icon6, { name: "arrow-left" }) }) : void 0
|
|
4107
4147
|
},
|
|
4108
4148
|
`${selectedMenuPath}-header--button`
|
|
4109
4149
|
) }),
|
|
@@ -4114,7 +4154,7 @@ var NestedMenuHeader = ({
|
|
|
4114
4154
|
|
|
4115
4155
|
// src/NestedMenu/NestedMenuRoot.tsx
|
|
4116
4156
|
import React24 from "react";
|
|
4117
|
-
import { jsx as
|
|
4157
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
4118
4158
|
var NestedMenuRoot = ({
|
|
4119
4159
|
children,
|
|
4120
4160
|
menuToggleElement,
|
|
@@ -4129,14 +4169,14 @@ var NestedMenuRoot = ({
|
|
|
4129
4169
|
menuContext.selectedItem,
|
|
4130
4170
|
menuContext.selectedItems?.length
|
|
4131
4171
|
]);
|
|
4132
|
-
return /* @__PURE__ */
|
|
4172
|
+
return /* @__PURE__ */ jsx32(MenuContentProvider, { menuContext, children });
|
|
4133
4173
|
};
|
|
4134
4174
|
|
|
4135
4175
|
// src/NestedMenu/NestedMenuPopout.tsx
|
|
4136
4176
|
import { motion as motion2 } from "motion/react";
|
|
4137
|
-
import
|
|
4138
|
-
import { jsx as
|
|
4139
|
-
var StyledDiv =
|
|
4177
|
+
import styled12 from "styled-components";
|
|
4178
|
+
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
4179
|
+
var StyledDiv = styled12(motion2.div)`
|
|
4140
4180
|
overflow: hidden;
|
|
4141
4181
|
`;
|
|
4142
4182
|
var NestedMenuPopout = ({
|
|
@@ -4146,7 +4186,7 @@ var NestedMenuPopout = ({
|
|
|
4146
4186
|
...popoutProps
|
|
4147
4187
|
}) => {
|
|
4148
4188
|
const { activeMenuContext, rootMenuContextProps, resetSelectedMenuPath } = useNestedMenuContext();
|
|
4149
|
-
return /* @__PURE__ */
|
|
4189
|
+
return /* @__PURE__ */ jsx33(
|
|
4150
4190
|
MenuPopout,
|
|
4151
4191
|
{
|
|
4152
4192
|
...popoutProps,
|
|
@@ -4155,8 +4195,8 @@ var NestedMenuPopout = ({
|
|
|
4155
4195
|
openMenu: rootMenuContextProps.openMenu,
|
|
4156
4196
|
closeMenu: rootMenuContextProps.closeMenu,
|
|
4157
4197
|
width: width2,
|
|
4158
|
-
content: (props) => /* @__PURE__ */
|
|
4159
|
-
children: (toggleProps) => /* @__PURE__ */
|
|
4198
|
+
content: (props) => /* @__PURE__ */ jsx33(StyledDiv, { layout: "position", children: typeof content === "function" ? content(props) : content }),
|
|
4199
|
+
children: (toggleProps) => /* @__PURE__ */ jsx33(
|
|
4160
4200
|
MenuToggleProvider,
|
|
4161
4201
|
{
|
|
4162
4202
|
menuContext: {
|
|
@@ -4172,7 +4212,7 @@ var NestedMenuPopout = ({
|
|
|
4172
4212
|
};
|
|
4173
4213
|
|
|
4174
4214
|
// src/NestedMenu/NestedMenu.tsx
|
|
4175
|
-
import { jsx as
|
|
4215
|
+
import { jsx as jsx34, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
4176
4216
|
var NestedMenu = ({
|
|
4177
4217
|
initialMenuId,
|
|
4178
4218
|
menus,
|
|
@@ -4326,7 +4366,7 @@ var NestedMenu = ({
|
|
|
4326
4366
|
initialIsOpen: true,
|
|
4327
4367
|
children: (
|
|
4328
4368
|
// Handles the smooth animating of the content
|
|
4329
|
-
/* @__PURE__ */
|
|
4369
|
+
/* @__PURE__ */ jsx34(AnimatePresence2, { mode: "wait", children: /* @__PURE__ */ jsxs7(
|
|
4330
4370
|
motion3.div,
|
|
4331
4371
|
{
|
|
4332
4372
|
variants: contentVariants,
|
|
@@ -4335,7 +4375,7 @@ var NestedMenu = ({
|
|
|
4335
4375
|
exit: "leave",
|
|
4336
4376
|
custom: { isAdding, hasLoadedOnce },
|
|
4337
4377
|
children: [
|
|
4338
|
-
MenuHeaderComponent && /* @__PURE__ */
|
|
4378
|
+
MenuHeaderComponent && /* @__PURE__ */ jsx34(
|
|
4339
4379
|
MenuHeaderComponent,
|
|
4340
4380
|
{
|
|
4341
4381
|
backArrowLabel,
|
|
@@ -4343,7 +4383,7 @@ var NestedMenu = ({
|
|
|
4343
4383
|
}
|
|
4344
4384
|
),
|
|
4345
4385
|
children && children,
|
|
4346
|
-
menuItems && !children && /* @__PURE__ */
|
|
4386
|
+
menuItems && !children && /* @__PURE__ */ jsx34(
|
|
4347
4387
|
NestedMenuContent,
|
|
4348
4388
|
{
|
|
4349
4389
|
menuItems,
|
|
@@ -4357,7 +4397,7 @@ var NestedMenu = ({
|
|
|
4357
4397
|
),
|
|
4358
4398
|
...restMenuProps
|
|
4359
4399
|
};
|
|
4360
|
-
return /* @__PURE__ */
|
|
4400
|
+
return /* @__PURE__ */ jsx34(
|
|
4361
4401
|
NestedMenuProvider,
|
|
4362
4402
|
{
|
|
4363
4403
|
...{
|
|
@@ -4371,11 +4411,11 @@ var NestedMenu = ({
|
|
|
4371
4411
|
setActiveMenuContext,
|
|
4372
4412
|
animationSpeed
|
|
4373
4413
|
},
|
|
4374
|
-
children: /* @__PURE__ */
|
|
4414
|
+
children: /* @__PURE__ */ jsx34(
|
|
4375
4415
|
NestedMenuPopout,
|
|
4376
4416
|
{
|
|
4377
4417
|
content: MenuComponent && // Handles the rerender of the component
|
|
4378
|
-
/* @__PURE__ */
|
|
4418
|
+
/* @__PURE__ */ jsx34(AnimatePresence2, { mode: "wait", children: /* @__PURE__ */ jsx34(
|
|
4379
4419
|
motion3.div,
|
|
4380
4420
|
{
|
|
4381
4421
|
variants: menuVariants,
|
|
@@ -4383,7 +4423,7 @@ var NestedMenu = ({
|
|
|
4383
4423
|
animate: "enter",
|
|
4384
4424
|
exit: "leave",
|
|
4385
4425
|
custom: { isAdding, hasLoadedOnce },
|
|
4386
|
-
children: /* @__PURE__ */
|
|
4426
|
+
children: /* @__PURE__ */ jsx34(MenuComponent, { ...nestedMenuProps })
|
|
4387
4427
|
},
|
|
4388
4428
|
`${currentMenuId}-content`
|
|
4389
4429
|
) }),
|