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