@salt-ds/core 1.65.0 → 1.66.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/CHANGELOG.md +36 -0
- package/css/salt-core.css +154 -3
- package/dist-cjs/index.js +22 -0
- package/dist-cjs/index.js.map +1 -1
- package/dist-cjs/mega-menu/MegaMenu.js +81 -0
- package/dist-cjs/mega-menu/MegaMenu.js.map +1 -0
- package/dist-cjs/mega-menu/MegaMenuActions.css.js +6 -0
- package/dist-cjs/mega-menu/MegaMenuActions.css.js.map +1 -0
- package/dist-cjs/mega-menu/MegaMenuActions.js +37 -0
- package/dist-cjs/mega-menu/MegaMenuActions.js.map +1 -0
- package/dist-cjs/mega-menu/MegaMenuAside.css.js +6 -0
- package/dist-cjs/mega-menu/MegaMenuAside.css.js.map +1 -0
- package/dist-cjs/mega-menu/MegaMenuAside.js +37 -0
- package/dist-cjs/mega-menu/MegaMenuAside.js.map +1 -0
- package/dist-cjs/mega-menu/MegaMenuContent.css.js +6 -0
- package/dist-cjs/mega-menu/MegaMenuContent.css.js.map +1 -0
- package/dist-cjs/mega-menu/MegaMenuContent.js +29 -0
- package/dist-cjs/mega-menu/MegaMenuContent.js.map +1 -0
- package/dist-cjs/mega-menu/MegaMenuContext.js +18 -0
- package/dist-cjs/mega-menu/MegaMenuContext.js.map +1 -0
- package/dist-cjs/mega-menu/MegaMenuGroup.css.js +6 -0
- package/dist-cjs/mega-menu/MegaMenuGroup.css.js.map +1 -0
- package/dist-cjs/mega-menu/MegaMenuGroup.js +44 -0
- package/dist-cjs/mega-menu/MegaMenuGroup.js.map +1 -0
- package/dist-cjs/mega-menu/MegaMenuGroupContext.js +23 -0
- package/dist-cjs/mega-menu/MegaMenuGroupContext.js.map +1 -0
- package/dist-cjs/mega-menu/MegaMenuGroupHeading.css.js +6 -0
- package/dist-cjs/mega-menu/MegaMenuGroupHeading.css.js.map +1 -0
- package/dist-cjs/mega-menu/MegaMenuGroupHeading.js +44 -0
- package/dist-cjs/mega-menu/MegaMenuGroupHeading.js.map +1 -0
- package/dist-cjs/mega-menu/MegaMenuGroups.css.js +6 -0
- package/dist-cjs/mega-menu/MegaMenuGroups.css.js.map +1 -0
- package/dist-cjs/mega-menu/MegaMenuGroups.js +29 -0
- package/dist-cjs/mega-menu/MegaMenuGroups.js.map +1 -0
- package/dist-cjs/mega-menu/MegaMenuList.css.js +6 -0
- package/dist-cjs/mega-menu/MegaMenuList.css.js.map +1 -0
- package/dist-cjs/mega-menu/MegaMenuList.js +47 -0
- package/dist-cjs/mega-menu/MegaMenuList.js.map +1 -0
- package/dist-cjs/mega-menu/MegaMenuListItem.css.js +6 -0
- package/dist-cjs/mega-menu/MegaMenuListItem.css.js.map +1 -0
- package/dist-cjs/mega-menu/MegaMenuListItem.js +50 -0
- package/dist-cjs/mega-menu/MegaMenuListItem.js.map +1 -0
- package/dist-cjs/mega-menu/MegaMenuPanel.css.js +6 -0
- package/dist-cjs/mega-menu/MegaMenuPanel.css.js.map +1 -0
- package/dist-cjs/mega-menu/MegaMenuPanel.js +94 -0
- package/dist-cjs/mega-menu/MegaMenuPanel.js.map +1 -0
- package/dist-cjs/mega-menu/MegaMenuTrigger.js +97 -0
- package/dist-cjs/mega-menu/MegaMenuTrigger.js.map +1 -0
- package/dist-cjs/mega-menu/useMegaMenu.js +15 -0
- package/dist-cjs/mega-menu/useMegaMenu.js.map +1 -0
- package/dist-cjs/mega-menu/useMegaMenuNavigation.js +282 -0
- package/dist-cjs/mega-menu/useMegaMenuNavigation.js.map +1 -0
- package/dist-cjs/mega-menu/usePageMargin.js +28 -0
- package/dist-cjs/mega-menu/usePageMargin.js.map +1 -0
- package/dist-cjs/spinner/Spinner.css.js +1 -1
- package/dist-cjs/spinner/Spinner.js +4 -5
- package/dist-cjs/spinner/Spinner.js.map +1 -1
- package/dist-cjs/spinner/svgSpinners/SpinnerSVG.js +32 -50
- package/dist-cjs/spinner/svgSpinners/SpinnerSVG.js.map +1 -1
- package/dist-es/index.js +11 -0
- package/dist-es/index.js.map +1 -1
- package/dist-es/mega-menu/MegaMenu.js +79 -0
- package/dist-es/mega-menu/MegaMenu.js.map +1 -0
- package/dist-es/mega-menu/MegaMenuActions.css.js +4 -0
- package/dist-es/mega-menu/MegaMenuActions.css.js.map +1 -0
- package/dist-es/mega-menu/MegaMenuActions.js +35 -0
- package/dist-es/mega-menu/MegaMenuActions.js.map +1 -0
- package/dist-es/mega-menu/MegaMenuAside.css.js +4 -0
- package/dist-es/mega-menu/MegaMenuAside.css.js.map +1 -0
- package/dist-es/mega-menu/MegaMenuAside.js +35 -0
- package/dist-es/mega-menu/MegaMenuAside.js.map +1 -0
- package/dist-es/mega-menu/MegaMenuContent.css.js +4 -0
- package/dist-es/mega-menu/MegaMenuContent.css.js.map +1 -0
- package/dist-es/mega-menu/MegaMenuContent.js +27 -0
- package/dist-es/mega-menu/MegaMenuContent.js.map +1 -0
- package/dist-es/mega-menu/MegaMenuContext.js +16 -0
- package/dist-es/mega-menu/MegaMenuContext.js.map +1 -0
- package/dist-es/mega-menu/MegaMenuGroup.css.js +4 -0
- package/dist-es/mega-menu/MegaMenuGroup.css.js.map +1 -0
- package/dist-es/mega-menu/MegaMenuGroup.js +42 -0
- package/dist-es/mega-menu/MegaMenuGroup.js.map +1 -0
- package/dist-es/mega-menu/MegaMenuGroupContext.js +20 -0
- package/dist-es/mega-menu/MegaMenuGroupContext.js.map +1 -0
- package/dist-es/mega-menu/MegaMenuGroupHeading.css.js +4 -0
- package/dist-es/mega-menu/MegaMenuGroupHeading.css.js.map +1 -0
- package/dist-es/mega-menu/MegaMenuGroupHeading.js +42 -0
- package/dist-es/mega-menu/MegaMenuGroupHeading.js.map +1 -0
- package/dist-es/mega-menu/MegaMenuGroups.css.js +4 -0
- package/dist-es/mega-menu/MegaMenuGroups.css.js.map +1 -0
- package/dist-es/mega-menu/MegaMenuGroups.js +27 -0
- package/dist-es/mega-menu/MegaMenuGroups.js.map +1 -0
- package/dist-es/mega-menu/MegaMenuList.css.js +4 -0
- package/dist-es/mega-menu/MegaMenuList.css.js.map +1 -0
- package/dist-es/mega-menu/MegaMenuList.js +45 -0
- package/dist-es/mega-menu/MegaMenuList.js.map +1 -0
- package/dist-es/mega-menu/MegaMenuListItem.css.js +4 -0
- package/dist-es/mega-menu/MegaMenuListItem.css.js.map +1 -0
- package/dist-es/mega-menu/MegaMenuListItem.js +48 -0
- package/dist-es/mega-menu/MegaMenuListItem.js.map +1 -0
- package/dist-es/mega-menu/MegaMenuPanel.css.js +4 -0
- package/dist-es/mega-menu/MegaMenuPanel.css.js.map +1 -0
- package/dist-es/mega-menu/MegaMenuPanel.js +92 -0
- package/dist-es/mega-menu/MegaMenuPanel.js.map +1 -0
- package/dist-es/mega-menu/MegaMenuTrigger.js +95 -0
- package/dist-es/mega-menu/MegaMenuTrigger.js.map +1 -0
- package/dist-es/mega-menu/useMegaMenu.js +13 -0
- package/dist-es/mega-menu/useMegaMenu.js.map +1 -0
- package/dist-es/mega-menu/useMegaMenuNavigation.js +278 -0
- package/dist-es/mega-menu/useMegaMenuNavigation.js.map +1 -0
- package/dist-es/mega-menu/usePageMargin.js +26 -0
- package/dist-es/mega-menu/usePageMargin.js.map +1 -0
- package/dist-es/spinner/Spinner.css.js +1 -1
- package/dist-es/spinner/Spinner.js +4 -5
- package/dist-es/spinner/Spinner.js.map +1 -1
- package/dist-es/spinner/svgSpinners/SpinnerSVG.js +32 -50
- package/dist-es/spinner/svgSpinners/SpinnerSVG.js.map +1 -1
- package/dist-types/index.d.ts +1 -0
- package/dist-types/mega-menu/MegaMenu.d.ts +36 -0
- package/dist-types/mega-menu/MegaMenuActions.d.ts +10 -0
- package/dist-types/mega-menu/MegaMenuAside.d.ts +9 -0
- package/dist-types/mega-menu/MegaMenuContent.d.ts +9 -0
- package/dist-types/mega-menu/MegaMenuContext.d.ts +28 -0
- package/dist-types/mega-menu/MegaMenuGroup.d.ts +9 -0
- package/dist-types/mega-menu/MegaMenuGroupContext.d.ts +12 -0
- package/dist-types/mega-menu/MegaMenuGroupHeading.d.ts +13 -0
- package/dist-types/mega-menu/MegaMenuGroups.d.ts +8 -0
- package/dist-types/mega-menu/MegaMenuList.d.ts +16 -0
- package/dist-types/mega-menu/MegaMenuListItem.d.ts +25 -0
- package/dist-types/mega-menu/MegaMenuPanel.d.ts +8 -0
- package/dist-types/mega-menu/MegaMenuTrigger.d.ts +9 -0
- package/dist-types/mega-menu/index.d.ts +11 -0
- package/dist-types/mega-menu/useMegaMenu.d.ts +6 -0
- package/dist-types/mega-menu/useMegaMenuNavigation.d.ts +16 -0
- package/dist-types/mega-menu/usePageMargin.d.ts +6 -0
- package/dist-types/spinner/svgSpinners/SpinnerSVG.d.ts +10 -10
- package/package.json +2 -1
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useFloatingRootContext, useInteractions, useClick, useDismiss } from '@floating-ui/react';
|
|
3
|
+
import { useState, useRef, useCallback, useMemo } from 'react';
|
|
4
|
+
import 'clsx';
|
|
5
|
+
import { useControlled } from '../utils/useControlled.js';
|
|
6
|
+
import '../utils/useFloatingUI/useFloatingUI.js';
|
|
7
|
+
import '../utils/useId.js';
|
|
8
|
+
import '../salt-provider/SaltProvider.js';
|
|
9
|
+
import '../viewport/ViewportProvider.js';
|
|
10
|
+
import { MegaMenuContext } from './MegaMenuContext.js';
|
|
11
|
+
import { useMegaMenuNavigation } from './useMegaMenuNavigation.js';
|
|
12
|
+
|
|
13
|
+
function MegaMenu({
|
|
14
|
+
children,
|
|
15
|
+
open,
|
|
16
|
+
defaultOpen = false,
|
|
17
|
+
onOpenChange,
|
|
18
|
+
placement = "bottom"
|
|
19
|
+
}) {
|
|
20
|
+
const [openState, setOpenState] = useControlled({
|
|
21
|
+
controlled: open,
|
|
22
|
+
default: defaultOpen,
|
|
23
|
+
name: "MegaMenu",
|
|
24
|
+
state: "open"
|
|
25
|
+
});
|
|
26
|
+
const [reference, setReference] = useState(null);
|
|
27
|
+
const [floating, setFloating] = useState(null);
|
|
28
|
+
const focusFirstItemOnOpenRef = useRef(false);
|
|
29
|
+
const [panelId, setPanelId] = useState();
|
|
30
|
+
const setOpen = useCallback(
|
|
31
|
+
(newOpen) => {
|
|
32
|
+
if (!newOpen) {
|
|
33
|
+
focusFirstItemOnOpenRef.current = false;
|
|
34
|
+
}
|
|
35
|
+
setOpenState(newOpen);
|
|
36
|
+
onOpenChange == null ? void 0 : onOpenChange(newOpen);
|
|
37
|
+
},
|
|
38
|
+
[onOpenChange]
|
|
39
|
+
);
|
|
40
|
+
const floatingRootContext = useFloatingRootContext({
|
|
41
|
+
open: openState,
|
|
42
|
+
onOpenChange: setOpen,
|
|
43
|
+
elements: { reference, floating }
|
|
44
|
+
});
|
|
45
|
+
const megaMenuNavigation = useMegaMenuNavigation(floatingRootContext);
|
|
46
|
+
const { getReferenceProps, getFloatingProps } = useInteractions([
|
|
47
|
+
useClick(floatingRootContext),
|
|
48
|
+
useDismiss(floatingRootContext),
|
|
49
|
+
megaMenuNavigation
|
|
50
|
+
]);
|
|
51
|
+
const contextValue = useMemo(
|
|
52
|
+
() => ({
|
|
53
|
+
openState,
|
|
54
|
+
floatingRootContext,
|
|
55
|
+
placement,
|
|
56
|
+
getFloatingProps,
|
|
57
|
+
getReferenceProps,
|
|
58
|
+
setFloating,
|
|
59
|
+
setReference,
|
|
60
|
+
setOpen,
|
|
61
|
+
focusFirstItemOnOpenRef,
|
|
62
|
+
panelId,
|
|
63
|
+
setPanelId
|
|
64
|
+
}),
|
|
65
|
+
[
|
|
66
|
+
openState,
|
|
67
|
+
floatingRootContext,
|
|
68
|
+
placement,
|
|
69
|
+
getFloatingProps,
|
|
70
|
+
getReferenceProps,
|
|
71
|
+
setOpen,
|
|
72
|
+
panelId
|
|
73
|
+
]
|
|
74
|
+
);
|
|
75
|
+
return /* @__PURE__ */ jsx(MegaMenuContext.Provider, { value: contextValue, children });
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export { MegaMenu };
|
|
79
|
+
//# sourceMappingURL=MegaMenu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MegaMenu.js","sources":["../src/mega-menu/MegaMenu.tsx"],"sourcesContent":["import {\n useClick,\n useDismiss,\n useFloatingRootContext,\n useInteractions,\n} from \"@floating-ui/react\";\nimport { type ReactNode, useCallback, useMemo, useRef, useState } from \"react\";\nimport { useControlled } from \"../utils\";\nimport { MegaMenuContext } from \"./MegaMenuContext\";\nimport { useMegaMenuNavigation } from \"./useMegaMenuNavigation\";\n\n/**\n * Supported placements for the mega menu panel.\n */\nexport type MegaMenuPlacement = \"bottom\" | \"bottom-start\" | \"bottom-end\";\n\nexport interface MegaMenuProps {\n /**\n * The content of the mega menu, typically `MegaMenuTrigger` and `MegaMenuPanel`.\n */\n children?: ReactNode;\n /**\n * Whether the mega menu is open. Use for controlled mode.\n */\n open?: boolean;\n /**\n * Whether the mega menu is initially open. Use for uncontrolled mode.\n * @default false\n */\n defaultOpen?: boolean;\n /**\n * Callback fired when the open state changes.\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * The placement of the mega menu panel relative to the trigger.\n * @default \"bottom\"\n */\n placement?: MegaMenuPlacement;\n}\n\n/**\n * Root of a mega menu, coordinating its trigger and panel.\n *\n * Not intended to be nested inside another floating overlay (e.g. a dialog or\n * popover): the mega menu does not participate in floating-ui's `FloatingTree`\n */\nexport function MegaMenu({\n children,\n open,\n defaultOpen = false,\n onOpenChange,\n placement = \"bottom\",\n}: MegaMenuProps) {\n const [openState, setOpenState] = useControlled({\n controlled: open,\n default: defaultOpen,\n name: \"MegaMenu\",\n state: \"open\",\n });\n\n const [reference, setReference] = useState<HTMLElement | null>(null);\n const [floating, setFloating] = useState<HTMLElement | null>(null);\n const focusFirstItemOnOpenRef = useRef(false);\n const [panelId, setPanelId] = useState<string>();\n\n const setOpen = useCallback(\n (newOpen: boolean) => {\n if (!newOpen) {\n focusFirstItemOnOpenRef.current = false;\n }\n setOpenState(newOpen);\n onOpenChange?.(newOpen);\n },\n [onOpenChange],\n );\n\n const floatingRootContext = useFloatingRootContext({\n open: openState,\n onOpenChange: setOpen,\n elements: { reference, floating },\n });\n\n const megaMenuNavigation = useMegaMenuNavigation(floatingRootContext);\n\n const { getReferenceProps, getFloatingProps } = useInteractions([\n useClick(floatingRootContext),\n useDismiss(floatingRootContext),\n megaMenuNavigation,\n ]);\n\n const contextValue = useMemo(\n () => ({\n openState,\n floatingRootContext,\n placement,\n getFloatingProps,\n getReferenceProps,\n setFloating,\n setReference,\n setOpen,\n focusFirstItemOnOpenRef,\n panelId,\n setPanelId,\n }),\n [\n openState,\n floatingRootContext,\n placement,\n getFloatingProps,\n getReferenceProps,\n setOpen,\n panelId,\n ],\n );\n\n return (\n <MegaMenuContext.Provider value={contextValue}>\n {children}\n </MegaMenuContext.Provider>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AA+CO,SAAS,QAAA,CAAS;AAAA,EACvB,QAAA;AAAA,EACA,IAAA;AAAA,EACA,WAAA,GAAc,KAAA;AAAA,EACd,YAAA;AAAA,EACA,SAAA,GAAY;AACd,CAAA,EAAkB;AAChB,EAAA,MAAM,CAAC,SAAA,EAAW,YAAY,CAAA,GAAI,aAAA,CAAc;AAAA,IAC9C,UAAA,EAAY,IAAA;AAAA,IACZ,OAAA,EAAS,WAAA;AAAA,IACT,IAAA,EAAM,UAAA;AAAA,IACN,KAAA,EAAO;AAAA,GACR,CAAA;AAED,EAAA,MAAM,CAAC,SAAA,EAAW,YAAY,CAAA,GAAI,SAA6B,IAAI,CAAA;AACnE,EAAA,MAAM,CAAC,QAAA,EAAU,WAAW,CAAA,GAAI,SAA6B,IAAI,CAAA;AACjE,EAAA,MAAM,uBAAA,GAA0B,OAAO,KAAK,CAAA;AAC5C,EAAA,MAAM,CAAC,OAAA,EAAS,UAAU,CAAA,GAAI,QAAA,EAAiB;AAE/C,EAAA,MAAM,OAAA,GAAU,WAAA;AAAA,IACd,CAAC,OAAA,KAAqB;AACpB,MAAA,IAAI,CAAC,OAAA,EAAS;AACZ,QAAA,uBAAA,CAAwB,OAAA,GAAU,KAAA;AAAA,MACpC;AACA,MAAA,YAAA,CAAa,OAAO,CAAA;AACpB,MAAA,YAAA,IAAA,IAAA,GAAA,MAAA,GAAA,YAAA,CAAe,OAAA,CAAA;AAAA,IACjB,CAAA;AAAA,IACA,CAAC,YAAY;AAAA,GACf;AAEA,EAAA,MAAM,sBAAsB,sBAAA,CAAuB;AAAA,IACjD,IAAA,EAAM,SAAA;AAAA,IACN,YAAA,EAAc,OAAA;AAAA,IACd,QAAA,EAAU,EAAE,SAAA,EAAW,QAAA;AAAS,GACjC,CAAA;AAED,EAAA,MAAM,kBAAA,GAAqB,sBAAsB,mBAAmB,CAAA;AAEpE,EAAA,MAAM,EAAE,iBAAA,EAAmB,gBAAA,EAAiB,GAAI,eAAA,CAAgB;AAAA,IAC9D,SAAS,mBAAmB,CAAA;AAAA,IAC5B,WAAW,mBAAmB,CAAA;AAAA,IAC9B;AAAA,GACD,CAAA;AAED,EAAA,MAAM,YAAA,GAAe,OAAA;AAAA,IACnB,OAAO;AAAA,MACL,SAAA;AAAA,MACA,mBAAA;AAAA,MACA,SAAA;AAAA,MACA,gBAAA;AAAA,MACA,iBAAA;AAAA,MACA,WAAA;AAAA,MACA,YAAA;AAAA,MACA,OAAA;AAAA,MACA,uBAAA;AAAA,MACA,OAAA;AAAA,MACA;AAAA,KACF,CAAA;AAAA,IACA;AAAA,MACE,SAAA;AAAA,MACA,mBAAA;AAAA,MACA,SAAA;AAAA,MACA,gBAAA;AAAA,MACA,iBAAA;AAAA,MACA,OAAA;AAAA,MACA;AAAA;AACF,GACF;AAEA,EAAA,2BACG,eAAA,CAAgB,QAAA,EAAhB,EAAyB,KAAA,EAAO,cAC9B,QAAA,EACH,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MegaMenuActions.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useComponentCssInjection } from '@salt-ds/styles';
|
|
3
|
+
import { useWindow } from '@salt-ds/window';
|
|
4
|
+
import { clsx } from 'clsx';
|
|
5
|
+
import { forwardRef } from 'react';
|
|
6
|
+
import { makePrefixer } from '../utils/makePrefixer.js';
|
|
7
|
+
import '../utils/useFloatingUI/useFloatingUI.js';
|
|
8
|
+
import '../utils/useId.js';
|
|
9
|
+
import '../salt-provider/SaltProvider.js';
|
|
10
|
+
import '../viewport/ViewportProvider.js';
|
|
11
|
+
import css_248z from './MegaMenuActions.css.js';
|
|
12
|
+
|
|
13
|
+
const withBaseName = makePrefixer("saltMegaMenuActions");
|
|
14
|
+
const MegaMenuActions = forwardRef(
|
|
15
|
+
function MegaMenuActions2({ className, ...rest }, ref) {
|
|
16
|
+
const targetWindow = useWindow();
|
|
17
|
+
useComponentCssInjection({
|
|
18
|
+
testId: "salt-mega-menu-actions",
|
|
19
|
+
css: css_248z,
|
|
20
|
+
window: targetWindow
|
|
21
|
+
});
|
|
22
|
+
return /* @__PURE__ */ jsx(
|
|
23
|
+
"div",
|
|
24
|
+
{
|
|
25
|
+
"data-mega-menu-actions": "",
|
|
26
|
+
className: clsx(withBaseName(), className),
|
|
27
|
+
ref,
|
|
28
|
+
...rest
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
export { MegaMenuActions };
|
|
35
|
+
//# sourceMappingURL=MegaMenuActions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MegaMenuActions.js","sources":["../src/mega-menu/MegaMenuActions.tsx"],"sourcesContent":["import { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { clsx } from \"clsx\";\nimport {\n type ComponentPropsWithoutRef,\n forwardRef,\n type ReactNode,\n} from \"react\";\nimport { makePrefixer } from \"../utils\";\nimport megaMenuActionsCss from \"./MegaMenuActions.css\";\n\nconst withBaseName = makePrefixer(\"saltMegaMenuActions\");\n\nexport interface MegaMenuActionsProps extends ComponentPropsWithoutRef<\"div\"> {\n /**\n * The content of the actions. Place `MegaMenuActions` inside\n * `MegaMenuContent`, after `MegaMenuGroups`; it renders as a band beneath the\n * groups, spanning their width.\n */\n children?: ReactNode;\n}\n\nexport const MegaMenuActions = forwardRef<HTMLDivElement, MegaMenuActionsProps>(\n function MegaMenuActions({ className, ...rest }, ref) {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-mega-menu-actions\",\n css: megaMenuActionsCss,\n window: targetWindow,\n });\n\n return (\n <div\n data-mega-menu-actions=\"\"\n className={clsx(withBaseName(), className)}\n ref={ref}\n {...rest}\n />\n );\n },\n);\n"],"names":["MegaMenuActions","megaMenuActionsCss"],"mappings":";;;;;;;;;;;;AAWA,MAAM,YAAA,GAAe,aAAa,qBAAqB,CAAA;AAWhD,MAAM,eAAA,GAAkB,UAAA;AAAA,EAC7B,SAASA,gBAAAA,CAAgB,EAAE,WAAW,GAAG,IAAA,IAAQ,GAAA,EAAK;AACpD,IAAA,MAAM,eAAe,SAAA,EAAU;AAC/B,IAAA,wBAAA,CAAyB;AAAA,MACvB,MAAA,EAAQ,wBAAA;AAAA,MACR,GAAA,EAAKC,QAAA;AAAA,MACL,MAAA,EAAQ;AAAA,KACT,CAAA;AAED,IAAA,uBACE,GAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,wBAAA,EAAuB,EAAA;AAAA,QACvB,SAAA,EAAW,IAAA,CAAK,YAAA,EAAa,EAAG,SAAS,CAAA;AAAA,QACzC,GAAA;AAAA,QACC,GAAG;AAAA;AAAA,KACN;AAAA,EAEJ;AACF;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MegaMenuAside.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useComponentCssInjection } from '@salt-ds/styles';
|
|
3
|
+
import { useWindow } from '@salt-ds/window';
|
|
4
|
+
import { clsx } from 'clsx';
|
|
5
|
+
import { forwardRef } from 'react';
|
|
6
|
+
import { makePrefixer } from '../utils/makePrefixer.js';
|
|
7
|
+
import '../utils/useFloatingUI/useFloatingUI.js';
|
|
8
|
+
import '../utils/useId.js';
|
|
9
|
+
import '../salt-provider/SaltProvider.js';
|
|
10
|
+
import '../viewport/ViewportProvider.js';
|
|
11
|
+
import css_248z from './MegaMenuAside.css.js';
|
|
12
|
+
|
|
13
|
+
const withBaseName = makePrefixer("saltMegaMenuAside");
|
|
14
|
+
const MegaMenuAside = forwardRef(
|
|
15
|
+
function MegaMenuAside2({ className, ...rest }, ref) {
|
|
16
|
+
const targetWindow = useWindow();
|
|
17
|
+
useComponentCssInjection({
|
|
18
|
+
testId: "salt-mega-menu-aside",
|
|
19
|
+
css: css_248z,
|
|
20
|
+
window: targetWindow
|
|
21
|
+
});
|
|
22
|
+
return /* @__PURE__ */ jsx(
|
|
23
|
+
"aside",
|
|
24
|
+
{
|
|
25
|
+
"data-mega-menu-column": "",
|
|
26
|
+
className: clsx(withBaseName(), className),
|
|
27
|
+
ref,
|
|
28
|
+
...rest
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
export { MegaMenuAside };
|
|
35
|
+
//# sourceMappingURL=MegaMenuAside.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MegaMenuAside.js","sources":["../src/mega-menu/MegaMenuAside.tsx"],"sourcesContent":["import { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { clsx } from \"clsx\";\nimport {\n type ComponentPropsWithoutRef,\n forwardRef,\n type ReactNode,\n} from \"react\";\nimport { makePrefixer } from \"../utils\";\nimport megaMenuAsideCss from \"./MegaMenuAside.css\";\n\nconst withBaseName = makePrefixer(\"saltMegaMenuAside\");\n\nexport interface MegaMenuAsideProps extends ComponentPropsWithoutRef<\"aside\"> {\n /**\n * The content. Renders to the left of `MegaMenuContent` when placed before\n * it, and to the right when placed after.\n */\n children?: ReactNode;\n}\n\nexport const MegaMenuAside = forwardRef<HTMLElement, MegaMenuAsideProps>(\n function MegaMenuAside({ className, ...rest }, ref) {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-mega-menu-aside\",\n css: megaMenuAsideCss,\n window: targetWindow,\n });\n\n // Side content is also a navigation column (`data-mega-menu-column`).\n return (\n <aside\n data-mega-menu-column=\"\"\n className={clsx(withBaseName(), className)}\n ref={ref}\n {...rest}\n />\n );\n },\n);\n"],"names":["MegaMenuAside","megaMenuAsideCss"],"mappings":";;;;;;;;;;;;AAWA,MAAM,YAAA,GAAe,aAAa,mBAAmB,CAAA;AAU9C,MAAM,aAAA,GAAgB,UAAA;AAAA,EAC3B,SAASA,cAAAA,CAAc,EAAE,WAAW,GAAG,IAAA,IAAQ,GAAA,EAAK;AAClD,IAAA,MAAM,eAAe,SAAA,EAAU;AAC/B,IAAA,wBAAA,CAAyB;AAAA,MACvB,MAAA,EAAQ,sBAAA;AAAA,MACR,GAAA,EAAKC,QAAA;AAAA,MACL,MAAA,EAAQ;AAAA,KACT,CAAA;AAGD,IAAA,uBACE,GAAA;AAAA,MAAC,OAAA;AAAA,MAAA;AAAA,QACC,uBAAA,EAAsB,EAAA;AAAA,QACtB,SAAA,EAAW,IAAA,CAAK,YAAA,EAAa,EAAG,SAAS,CAAA;AAAA,QACzC,GAAA;AAAA,QACC,GAAG;AAAA;AAAA,KACN;AAAA,EAEJ;AACF;;;;"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var css_248z = ".saltMegaMenuContent {\n display: flex;\n flex-direction: column;\n gap: var(--salt-spacing-300);\n padding: var(--salt-spacing-300);\n min-width: 0;\n flex: 0 1 auto;\n max-inline-size: var(--saltMegaMenuPanel-availableWidth);\n box-sizing: border-box;\n}\n";
|
|
2
|
+
|
|
3
|
+
export { css_248z as default };
|
|
4
|
+
//# sourceMappingURL=MegaMenuContent.css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MegaMenuContent.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useComponentCssInjection } from '@salt-ds/styles';
|
|
3
|
+
import { useWindow } from '@salt-ds/window';
|
|
4
|
+
import { clsx } from 'clsx';
|
|
5
|
+
import { forwardRef } from 'react';
|
|
6
|
+
import { makePrefixer } from '../utils/makePrefixer.js';
|
|
7
|
+
import '../utils/useFloatingUI/useFloatingUI.js';
|
|
8
|
+
import '../utils/useId.js';
|
|
9
|
+
import '../salt-provider/SaltProvider.js';
|
|
10
|
+
import '../viewport/ViewportProvider.js';
|
|
11
|
+
import css_248z from './MegaMenuContent.css.js';
|
|
12
|
+
|
|
13
|
+
const withBaseName = makePrefixer("saltMegaMenuContent");
|
|
14
|
+
const MegaMenuContent = forwardRef(
|
|
15
|
+
function MegaMenuContent2({ children, className, ...rest }, ref) {
|
|
16
|
+
const targetWindow = useWindow();
|
|
17
|
+
useComponentCssInjection({
|
|
18
|
+
testId: "salt-mega-menu-content",
|
|
19
|
+
css: css_248z,
|
|
20
|
+
window: targetWindow
|
|
21
|
+
});
|
|
22
|
+
return /* @__PURE__ */ jsx("div", { className: clsx(withBaseName(), className), ref, ...rest, children });
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
export { MegaMenuContent };
|
|
27
|
+
//# sourceMappingURL=MegaMenuContent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MegaMenuContent.js","sources":["../src/mega-menu/MegaMenuContent.tsx"],"sourcesContent":["import { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { clsx } from \"clsx\";\nimport {\n type ComponentPropsWithoutRef,\n forwardRef,\n type ReactNode,\n} from \"react\";\nimport { makePrefixer } from \"../utils\";\nimport megaMenuContentCss from \"./MegaMenuContent.css\";\n\nconst withBaseName = makePrefixer(\"saltMegaMenuContent\");\n\nexport interface MegaMenuContentProps extends ComponentPropsWithoutRef<\"div\"> {\n /**\n * The content of the mega menu navigation area, typically a `MegaMenuGroups`\n * and an optional `MegaMenuActions`.\n */\n children?: ReactNode;\n}\n\nexport const MegaMenuContent = forwardRef<HTMLDivElement, MegaMenuContentProps>(\n function MegaMenuContent({ children, className, ...rest }, ref) {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-mega-menu-content\",\n css: megaMenuContentCss,\n window: targetWindow,\n });\n\n return (\n <div className={clsx(withBaseName(), className)} ref={ref} {...rest}>\n {children}\n </div>\n );\n },\n);\n"],"names":["MegaMenuContent","megaMenuContentCss"],"mappings":";;;;;;;;;;;;AAWA,MAAM,YAAA,GAAe,aAAa,qBAAqB,CAAA;AAUhD,MAAM,eAAA,GAAkB,UAAA;AAAA,EAC7B,SAASA,iBAAgB,EAAE,QAAA,EAAU,WAAW,GAAG,IAAA,IAAQ,GAAA,EAAK;AAC9D,IAAA,MAAM,eAAe,SAAA,EAAU;AAC/B,IAAA,wBAAA,CAAyB;AAAA,MACvB,MAAA,EAAQ,wBAAA;AAAA,MACR,GAAA,EAAKC,QAAA;AAAA,MACL,MAAA,EAAQ;AAAA,KACT,CAAA;AAED,IAAA,uBACE,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,IAAA,CAAK,YAAA,EAAa,EAAG,SAAS,CAAA,EAAG,GAAA,EAAW,GAAG,IAAA,EAC5D,QAAA,EACH,CAAA;AAAA,EAEJ;AACF;;;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { createContext } from '../utils/createContext.js';
|
|
2
|
+
import 'react';
|
|
3
|
+
import 'clsx';
|
|
4
|
+
import 'react/jsx-runtime';
|
|
5
|
+
import '../utils/useFloatingUI/useFloatingUI.js';
|
|
6
|
+
import '../utils/useId.js';
|
|
7
|
+
import '../salt-provider/SaltProvider.js';
|
|
8
|
+
import '../viewport/ViewportProvider.js';
|
|
9
|
+
|
|
10
|
+
const MegaMenuContext = createContext(
|
|
11
|
+
"MegaMenuContext",
|
|
12
|
+
void 0
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
export { MegaMenuContext };
|
|
16
|
+
//# sourceMappingURL=MegaMenuContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MegaMenuContext.js","sources":["../src/mega-menu/MegaMenuContext.ts"],"sourcesContent":["import type { FloatingRootContext } from \"@floating-ui/react\";\nimport type {\n Dispatch,\n HTMLProps,\n MutableRefObject,\n SetStateAction,\n} from \"react\";\nimport { createContext } from \"../utils\";\nimport type { MegaMenuPlacement } from \"./MegaMenu\";\n\nexport interface MegaMenuContextValue {\n /** Whether the mega menu is currently open. */\n openState: boolean;\n /** Toggle or set the open state of the mega menu. */\n setOpen: (open: boolean) => void;\n /** The floating-ui root context for coordinating interactions. */\n floatingRootContext: FloatingRootContext;\n /** The placement of the mega menu panel relative to the trigger. */\n placement: MegaMenuPlacement;\n /** Props getter for the trigger (reference) element. Merges floating-ui interaction props with user props. */\n getReferenceProps: (\n userProps?: HTMLProps<Element> | undefined,\n ) => Record<string, unknown>;\n /** Props getter for the floating panel element. Merges floating-ui interaction props with user props. */\n getFloatingProps: (\n userProps?: HTMLProps<HTMLElement> | undefined,\n ) => Record<string, unknown>;\n /** Ref setter for the floating panel element. */\n setFloating: Dispatch<SetStateAction<HTMLElement | null>>;\n /** Ref setter for the trigger (reference) element. */\n setReference: Dispatch<SetStateAction<HTMLElement | null>>;\n /** Whether the first item should receive focus when the panel opens. */\n focusFirstItemOnOpenRef: MutableRefObject<boolean>;\n /** The id of the mega menu panel, used for aria-controls on the trigger. */\n panelId: string | undefined;\n /** Registers the panel's id so the trigger's aria-controls stays in sync. */\n setPanelId: Dispatch<SetStateAction<string | undefined>>;\n}\n\nexport const MegaMenuContext = createContext<MegaMenuContextValue | undefined>(\n \"MegaMenuContext\",\n undefined,\n);\n"],"names":[],"mappings":";;;;;;;;;AAuCO,MAAM,eAAA,GAAkB,aAAA;AAAA,EAC7B,iBAAA;AAAA,EACA;AACF;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MegaMenuGroup.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useComponentCssInjection } from '@salt-ds/styles';
|
|
3
|
+
import { useWindow } from '@salt-ds/window';
|
|
4
|
+
import { clsx } from 'clsx';
|
|
5
|
+
import { forwardRef, useState, useMemo } from 'react';
|
|
6
|
+
import { makePrefixer } from '../utils/makePrefixer.js';
|
|
7
|
+
import '../utils/useFloatingUI/useFloatingUI.js';
|
|
8
|
+
import '../utils/useId.js';
|
|
9
|
+
import '../salt-provider/SaltProvider.js';
|
|
10
|
+
import '../viewport/ViewportProvider.js';
|
|
11
|
+
import css_248z from './MegaMenuGroup.css.js';
|
|
12
|
+
import { MegaMenuGroupContext } from './MegaMenuGroupContext.js';
|
|
13
|
+
|
|
14
|
+
const withBaseName = makePrefixer("saltMegaMenuGroup");
|
|
15
|
+
const MegaMenuGroup = forwardRef(
|
|
16
|
+
function MegaMenuGroup2({ children, className, ...rest }, ref) {
|
|
17
|
+
const targetWindow = useWindow();
|
|
18
|
+
useComponentCssInjection({
|
|
19
|
+
testId: "salt-mega-menu-group",
|
|
20
|
+
css: css_248z,
|
|
21
|
+
window: targetWindow
|
|
22
|
+
});
|
|
23
|
+
const [headingId, setHeadingId] = useState(void 0);
|
|
24
|
+
const contextValue = useMemo(
|
|
25
|
+
() => ({ headingId, setHeadingId }),
|
|
26
|
+
[headingId]
|
|
27
|
+
);
|
|
28
|
+
return /* @__PURE__ */ jsx(MegaMenuGroupContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(
|
|
29
|
+
"div",
|
|
30
|
+
{
|
|
31
|
+
"data-mega-menu-column": "",
|
|
32
|
+
className: clsx(withBaseName(), className),
|
|
33
|
+
ref,
|
|
34
|
+
...rest,
|
|
35
|
+
children
|
|
36
|
+
}
|
|
37
|
+
) });
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
export { MegaMenuGroup };
|
|
42
|
+
//# sourceMappingURL=MegaMenuGroup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MegaMenuGroup.js","sources":["../src/mega-menu/MegaMenuGroup.tsx"],"sourcesContent":["import { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { clsx } from \"clsx\";\nimport {\n type ComponentPropsWithoutRef,\n forwardRef,\n type ReactNode,\n useMemo,\n useState,\n} from \"react\";\nimport { makePrefixer } from \"../utils\";\nimport megaMenuGroupCss from \"./MegaMenuGroup.css\";\nimport { MegaMenuGroupContext } from \"./MegaMenuGroupContext\";\n\nconst withBaseName = makePrefixer(\"saltMegaMenuGroup\");\n\nexport interface MegaMenuGroupProps extends ComponentPropsWithoutRef<\"div\"> {\n /**\n * The content of the mega menu group: a `MegaMenuGroupHeading` and a\n * `MegaMenuList` of `MegaMenuListItem`s.\n */\n children?: ReactNode;\n}\n\nexport const MegaMenuGroup = forwardRef<HTMLDivElement, MegaMenuGroupProps>(\n function MegaMenuGroup({ children, className, ...rest }, ref) {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-mega-menu-group\",\n css: megaMenuGroupCss,\n window: targetWindow,\n });\n\n // The heading registers its id so the list can label itself; `undefined`\n // with no heading. The group is also a navigation column.\n const [headingId, setHeadingId] = useState<string | undefined>(undefined);\n const contextValue = useMemo(\n () => ({ headingId, setHeadingId }),\n [headingId],\n );\n\n return (\n <MegaMenuGroupContext.Provider value={contextValue}>\n <div\n data-mega-menu-column=\"\"\n className={clsx(withBaseName(), className)}\n ref={ref}\n {...rest}\n >\n {children}\n </div>\n </MegaMenuGroupContext.Provider>\n );\n },\n);\n"],"names":["MegaMenuGroup","megaMenuGroupCss"],"mappings":";;;;;;;;;;;;;AAcA,MAAM,YAAA,GAAe,aAAa,mBAAmB,CAAA;AAU9C,MAAM,aAAA,GAAgB,UAAA;AAAA,EAC3B,SAASA,eAAc,EAAE,QAAA,EAAU,WAAW,GAAG,IAAA,IAAQ,GAAA,EAAK;AAC5D,IAAA,MAAM,eAAe,SAAA,EAAU;AAC/B,IAAA,wBAAA,CAAyB;AAAA,MACvB,MAAA,EAAQ,sBAAA;AAAA,MACR,GAAA,EAAKC,QAAA;AAAA,MACL,MAAA,EAAQ;AAAA,KACT,CAAA;AAID,IAAA,MAAM,CAAC,SAAA,EAAW,YAAY,CAAA,GAAI,SAA6B,MAAS,CAAA;AACxE,IAAA,MAAM,YAAA,GAAe,OAAA;AAAA,MACnB,OAAO,EAAE,SAAA,EAAW,YAAA,EAAa,CAAA;AAAA,MACjC,CAAC,SAAS;AAAA,KACZ;AAEA,IAAA,uBACE,GAAA,CAAC,oBAAA,CAAqB,QAAA,EAArB,EAA8B,OAAO,YAAA,EACpC,QAAA,kBAAA,GAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,uBAAA,EAAsB,EAAA;AAAA,QACtB,SAAA,EAAW,IAAA,CAAK,YAAA,EAAa,EAAG,SAAS,CAAA;AAAA,QACzC,GAAA;AAAA,QACC,GAAG,IAAA;AAAA,QAEH;AAAA;AAAA,KACH,EACF,CAAA;AAAA,EAEJ;AACF;;;;"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import { createContext } from '../utils/createContext.js';
|
|
3
|
+
import 'clsx';
|
|
4
|
+
import 'react/jsx-runtime';
|
|
5
|
+
import '../utils/useFloatingUI/useFloatingUI.js';
|
|
6
|
+
import '../utils/useId.js';
|
|
7
|
+
import '../salt-provider/SaltProvider.js';
|
|
8
|
+
import '../viewport/ViewportProvider.js';
|
|
9
|
+
|
|
10
|
+
const MegaMenuGroupContext = createContext(
|
|
11
|
+
"MegaMenuGroupContext",
|
|
12
|
+
{ headingId: void 0, setHeadingId: () => {
|
|
13
|
+
} }
|
|
14
|
+
);
|
|
15
|
+
function useMegaMenuGroup() {
|
|
16
|
+
return useContext(MegaMenuGroupContext);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { MegaMenuGroupContext, useMegaMenuGroup };
|
|
20
|
+
//# sourceMappingURL=MegaMenuGroupContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MegaMenuGroupContext.js","sources":["../src/mega-menu/MegaMenuGroupContext.ts"],"sourcesContent":["import { useContext } from \"react\";\nimport { createContext } from \"../utils\";\n\nexport interface MegaMenuGroupContextValue {\n /**\n * The rendered heading's id, used to label the item list via `aria-labelledby`.\n * `undefined` when the group has no `MegaMenuGroupHeading`.\n */\n headingId: string | undefined;\n /** Register (or clear, with `undefined`) the heading's id. */\n setHeadingId: (id: string | undefined) => void;\n}\n\nexport const MegaMenuGroupContext = createContext<MegaMenuGroupContextValue>(\n \"MegaMenuGroupContext\",\n { headingId: undefined, setHeadingId: () => {} },\n);\n\n/** Access the nearest `MegaMenuGroup` context. */\nexport function useMegaMenuGroup(): MegaMenuGroupContextValue {\n return useContext(MegaMenuGroupContext);\n}\n"],"names":[],"mappings":";;;;;;;;;AAaO,MAAM,oBAAA,GAAuB,aAAA;AAAA,EAClC,sBAAA;AAAA,EACA,EAAE,SAAA,EAAW,MAAA,EAAW,YAAA,EAAc,MAAM;AAAA,EAAC,CAAA;AAC/C;AAGO,SAAS,gBAAA,GAA8C;AAC5D,EAAA,OAAO,WAAW,oBAAoB,CAAA;AACxC;;;;"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var css_248z = ".saltMegaMenuGroupHeading {\n display: flex;\n align-items: center;\n margin: 0 0 var(--salt-spacing-50);\n padding: var(--salt-spacing-50) var(--salt-spacing-100);\n border-bottom: var(--salt-size-fixed-100) var(--salt-borderStyle-solid) var(--salt-separable-tertiary-borderColor);\n min-height: var(--salt-size-base);\n font-family: var(--salt-text-label-fontFamily);\n font-size: var(--salt-text-label-fontSize);\n font-weight: var(--salt-text-fontWeight-strong);\n line-height: var(--salt-text-label-lineHeight);\n color: var(--salt-content-secondary-foreground);\n}\n";
|
|
2
|
+
|
|
3
|
+
export { css_248z as default };
|
|
4
|
+
//# sourceMappingURL=MegaMenuGroupHeading.css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MegaMenuGroupHeading.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useComponentCssInjection } from '@salt-ds/styles';
|
|
3
|
+
import { useWindow } from '@salt-ds/window';
|
|
4
|
+
import { clsx } from 'clsx';
|
|
5
|
+
import { forwardRef } from 'react';
|
|
6
|
+
import { makePrefixer } from '../utils/makePrefixer.js';
|
|
7
|
+
import { useIsomorphicLayoutEffect } from '../utils/useIsomorphicLayoutEffect.js';
|
|
8
|
+
import '../utils/useFloatingUI/useFloatingUI.js';
|
|
9
|
+
import { useId } from '../utils/useId.js';
|
|
10
|
+
import '../salt-provider/SaltProvider.js';
|
|
11
|
+
import '../viewport/ViewportProvider.js';
|
|
12
|
+
import { useMegaMenuGroup } from './MegaMenuGroupContext.js';
|
|
13
|
+
import css_248z from './MegaMenuGroupHeading.css.js';
|
|
14
|
+
|
|
15
|
+
const withBaseName = makePrefixer("saltMegaMenuGroupHeading");
|
|
16
|
+
const MegaMenuGroupHeading = forwardRef(function MegaMenuGroupHeading2({ children, className, id: idProp, as: Heading = "h3", ...rest }, ref) {
|
|
17
|
+
const targetWindow = useWindow();
|
|
18
|
+
useComponentCssInjection({
|
|
19
|
+
testId: "salt-mega-menu-group-heading",
|
|
20
|
+
css: css_248z,
|
|
21
|
+
window: targetWindow
|
|
22
|
+
});
|
|
23
|
+
const id = useId(idProp);
|
|
24
|
+
const { setHeadingId } = useMegaMenuGroup();
|
|
25
|
+
useIsomorphicLayoutEffect(() => {
|
|
26
|
+
setHeadingId(id);
|
|
27
|
+
return () => setHeadingId(void 0);
|
|
28
|
+
}, [id, setHeadingId]);
|
|
29
|
+
return /* @__PURE__ */ jsx(
|
|
30
|
+
Heading,
|
|
31
|
+
{
|
|
32
|
+
className: clsx(withBaseName(), className),
|
|
33
|
+
ref,
|
|
34
|
+
...rest,
|
|
35
|
+
id,
|
|
36
|
+
children
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export { MegaMenuGroupHeading };
|
|
42
|
+
//# sourceMappingURL=MegaMenuGroupHeading.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MegaMenuGroupHeading.js","sources":["../src/mega-menu/MegaMenuGroupHeading.tsx"],"sourcesContent":["import { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { clsx } from \"clsx\";\nimport {\n type ComponentPropsWithoutRef,\n forwardRef,\n type ReactNode,\n} from \"react\";\nimport { makePrefixer, useId, useIsomorphicLayoutEffect } from \"../utils\";\nimport { useMegaMenuGroup } from \"./MegaMenuGroupContext\";\nimport megaMenuGroupHeadingCss from \"./MegaMenuGroupHeading.css\";\n\nconst withBaseName = makePrefixer(\"saltMegaMenuGroupHeading\");\n\nexport interface MegaMenuGroupHeadingProps\n extends ComponentPropsWithoutRef<\"h2\"> {\n /**\n * The content of the mega menu group heading.\n */\n children?: ReactNode;\n /**\n * The heading element to render.\n * @default \"h3\"\n */\n as?: \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\";\n}\n\nexport const MegaMenuGroupHeading = forwardRef<\n HTMLHeadingElement,\n MegaMenuGroupHeadingProps\n>(function MegaMenuGroupHeading(\n { children, className, id: idProp, as: Heading = \"h3\", ...rest },\n ref,\n) {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-mega-menu-group-heading\",\n css: megaMenuGroupHeadingCss,\n window: targetWindow,\n });\n\n const id = useId(idProp);\n const { setHeadingId } = useMegaMenuGroup();\n useIsomorphicLayoutEffect(() => {\n setHeadingId(id);\n return () => setHeadingId(undefined);\n }, [id, setHeadingId]);\n\n return (\n <Heading\n className={clsx(withBaseName(), className)}\n ref={ref}\n {...rest}\n id={id}\n >\n {children}\n </Heading>\n );\n});\n"],"names":["MegaMenuGroupHeading","megaMenuGroupHeadingCss"],"mappings":";;;;;;;;;;;;;;AAYA,MAAM,YAAA,GAAe,aAAa,0BAA0B,CAAA;AAerD,MAAM,oBAAA,GAAuB,UAAA,CAGlC,SAASA,qBAAAA,CACT,EAAE,QAAA,EAAU,SAAA,EAAW,EAAA,EAAI,MAAA,EAAQ,IAAI,OAAA,GAAU,IAAA,EAAM,GAAG,IAAA,IAC1D,GAAA,EACA;AACA,EAAA,MAAM,eAAe,SAAA,EAAU;AAC/B,EAAA,wBAAA,CAAyB;AAAA,IACvB,MAAA,EAAQ,8BAAA;AAAA,IACR,GAAA,EAAKC,QAAA;AAAA,IACL,MAAA,EAAQ;AAAA,GACT,CAAA;AAED,EAAA,MAAM,EAAA,GAAK,MAAM,MAAM,CAAA;AACvB,EAAA,MAAM,EAAE,YAAA,EAAa,GAAI,gBAAA,EAAiB;AAC1C,EAAA,yBAAA,CAA0B,MAAM;AAC9B,IAAA,YAAA,CAAa,EAAE,CAAA;AACf,IAAA,OAAO,MAAM,aAAa,MAAS,CAAA;AAAA,EACrC,CAAA,EAAG,CAAC,EAAA,EAAI,YAAY,CAAC,CAAA;AAErB,EAAA,uBACE,GAAA;AAAA,IAAC,OAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAW,IAAA,CAAK,YAAA,EAAa,EAAG,SAAS,CAAA;AAAA,MACzC,GAAA;AAAA,MACC,GAAG,IAAA;AAAA,MACJ,EAAA;AAAA,MAEC;AAAA;AAAA,GACH;AAEJ,CAAC;;;;"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var css_248z = ".saltMegaMenuGroups {\n align-self: start;\n display: grid;\n grid-template-columns: repeat(auto-fit, minmax(0, var(--saltMegaMenuGroups-columnWidth, 12rem)));\n gap: var(--salt-spacing-300);\n min-width: 0;\n max-inline-size: var(--saltMegaMenuPanel-availableWidth);\n}\n";
|
|
2
|
+
|
|
3
|
+
export { css_248z as default };
|
|
4
|
+
//# sourceMappingURL=MegaMenuGroups.css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MegaMenuGroups.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useComponentCssInjection } from '@salt-ds/styles';
|
|
3
|
+
import { useWindow } from '@salt-ds/window';
|
|
4
|
+
import { clsx } from 'clsx';
|
|
5
|
+
import { forwardRef } from 'react';
|
|
6
|
+
import { makePrefixer } from '../utils/makePrefixer.js';
|
|
7
|
+
import '../utils/useFloatingUI/useFloatingUI.js';
|
|
8
|
+
import '../utils/useId.js';
|
|
9
|
+
import '../salt-provider/SaltProvider.js';
|
|
10
|
+
import '../viewport/ViewportProvider.js';
|
|
11
|
+
import css_248z from './MegaMenuGroups.css.js';
|
|
12
|
+
|
|
13
|
+
const withBaseName = makePrefixer("saltMegaMenuGroups");
|
|
14
|
+
const MegaMenuGroups = forwardRef(
|
|
15
|
+
function MegaMenuGroups2({ children, className, ...rest }, ref) {
|
|
16
|
+
const targetWindow = useWindow();
|
|
17
|
+
useComponentCssInjection({
|
|
18
|
+
testId: "salt-mega-menu-groups",
|
|
19
|
+
css: css_248z,
|
|
20
|
+
window: targetWindow
|
|
21
|
+
});
|
|
22
|
+
return /* @__PURE__ */ jsx("div", { className: clsx(withBaseName(), className), ref, ...rest, children });
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
export { MegaMenuGroups };
|
|
27
|
+
//# sourceMappingURL=MegaMenuGroups.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MegaMenuGroups.js","sources":["../src/mega-menu/MegaMenuGroups.tsx"],"sourcesContent":["import { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { clsx } from \"clsx\";\nimport {\n type ComponentPropsWithoutRef,\n forwardRef,\n type ReactNode,\n} from \"react\";\nimport { makePrefixer } from \"../utils\";\nimport megaMenuGroupsCss from \"./MegaMenuGroups.css\";\n\nconst withBaseName = makePrefixer(\"saltMegaMenuGroups\");\n\nexport interface MegaMenuGroupsProps extends ComponentPropsWithoutRef<\"div\"> {\n /**\n * The `MegaMenuGroup` columns of the mega menu.\n */\n children?: ReactNode;\n}\n\nexport const MegaMenuGroups = forwardRef<HTMLDivElement, MegaMenuGroupsProps>(\n function MegaMenuGroups({ children, className, ...rest }, ref) {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-mega-menu-groups\",\n css: megaMenuGroupsCss,\n window: targetWindow,\n });\n\n return (\n <div className={clsx(withBaseName(), className)} ref={ref} {...rest}>\n {children}\n </div>\n );\n },\n);\n"],"names":["MegaMenuGroups","megaMenuGroupsCss"],"mappings":";;;;;;;;;;;;AAWA,MAAM,YAAA,GAAe,aAAa,oBAAoB,CAAA;AAS/C,MAAM,cAAA,GAAiB,UAAA;AAAA,EAC5B,SAASA,gBAAe,EAAE,QAAA,EAAU,WAAW,GAAG,IAAA,IAAQ,GAAA,EAAK;AAC7D,IAAA,MAAM,eAAe,SAAA,EAAU;AAC/B,IAAA,wBAAA,CAAyB;AAAA,MACvB,MAAA,EAAQ,uBAAA;AAAA,MACR,GAAA,EAAKC,QAAA;AAAA,MACL,MAAA,EAAQ;AAAA,KACT,CAAA;AAED,IAAA,uBACE,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,IAAA,CAAK,YAAA,EAAa,EAAG,SAAS,CAAA,EAAG,GAAA,EAAW,GAAG,IAAA,EAC5D,QAAA,EACH,CAAA;AAAA,EAEJ;AACF;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MegaMenuList.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useComponentCssInjection } from '@salt-ds/styles';
|
|
3
|
+
import { useWindow } from '@salt-ds/window';
|
|
4
|
+
import { clsx } from 'clsx';
|
|
5
|
+
import { forwardRef } from 'react';
|
|
6
|
+
import { makePrefixer } from '../utils/makePrefixer.js';
|
|
7
|
+
import '../utils/useFloatingUI/useFloatingUI.js';
|
|
8
|
+
import '../utils/useId.js';
|
|
9
|
+
import '../salt-provider/SaltProvider.js';
|
|
10
|
+
import '../viewport/ViewportProvider.js';
|
|
11
|
+
import { useMegaMenuGroup } from './MegaMenuGroupContext.js';
|
|
12
|
+
import css_248z from './MegaMenuList.css.js';
|
|
13
|
+
|
|
14
|
+
const withBaseName = makePrefixer("saltMegaMenuList");
|
|
15
|
+
const MegaMenuList = forwardRef(
|
|
16
|
+
function MegaMenuList2({
|
|
17
|
+
as,
|
|
18
|
+
children,
|
|
19
|
+
className,
|
|
20
|
+
"aria-labelledby": ariaLabelledBy,
|
|
21
|
+
...rest
|
|
22
|
+
}, ref) {
|
|
23
|
+
const targetWindow = useWindow();
|
|
24
|
+
useComponentCssInjection({
|
|
25
|
+
testId: "salt-mega-menu-list",
|
|
26
|
+
css: css_248z,
|
|
27
|
+
window: targetWindow
|
|
28
|
+
});
|
|
29
|
+
const { headingId } = useMegaMenuGroup();
|
|
30
|
+
const Component = as || "ul";
|
|
31
|
+
return /* @__PURE__ */ jsx(
|
|
32
|
+
Component,
|
|
33
|
+
{
|
|
34
|
+
ref,
|
|
35
|
+
className: clsx(withBaseName(), className),
|
|
36
|
+
"aria-labelledby": clsx(headingId, ariaLabelledBy) || void 0,
|
|
37
|
+
...rest,
|
|
38
|
+
children
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
export { MegaMenuList };
|
|
45
|
+
//# sourceMappingURL=MegaMenuList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MegaMenuList.js","sources":["../src/mega-menu/MegaMenuList.tsx"],"sourcesContent":["import { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { clsx } from \"clsx\";\nimport {\n type ElementType,\n type ForwardedRef,\n type FunctionComponent,\n forwardRef,\n type ReactNode,\n} from \"react\";\nimport {\n makePrefixer,\n type PolymorphicComponentPropWithRef,\n type PolymorphicRef,\n} from \"../utils\";\nimport { useMegaMenuGroup } from \"./MegaMenuGroupContext\";\nimport megaMenuListCss from \"./MegaMenuList.css\";\n\nconst withBaseName = makePrefixer(\"saltMegaMenuList\");\n\nexport type MegaMenuListProps<T extends ElementType = \"ul\"> =\n PolymorphicComponentPropWithRef<\n T,\n {\n /**\n * The items of the group, typically `MegaMenuListItem` components. Each\n * `MegaMenuListItem` renders its own `<li>`.\n */\n children?: ReactNode;\n }\n >;\n\ntype MegaMenuListComponent = <T extends ElementType = \"ul\">(\n props: MegaMenuListProps<T>,\n) => ReturnType<FunctionComponent>;\n\n/**\n * The list of a group's `MegaMenuListItem`s. Renders a `<ul>` by default; pass\n * `as=\"ol\"` for an ordered list.\n */\nexport const MegaMenuList: MegaMenuListComponent = forwardRef(\n function MegaMenuList<T extends ElementType = \"ul\">(\n {\n as,\n children,\n className,\n \"aria-labelledby\": ariaLabelledBy,\n ...rest\n }: MegaMenuListProps<T>,\n ref?: ForwardedRef<unknown>,\n ) {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-mega-menu-list\",\n css: megaMenuListCss,\n window: targetWindow,\n });\n\n const { headingId } = useMegaMenuGroup();\n\n const Component = as || \"ul\";\n\n return (\n <Component\n ref={ref as PolymorphicRef<T>}\n className={clsx(withBaseName(), className)}\n aria-labelledby={clsx(headingId, ariaLabelledBy) || undefined}\n {...rest}\n >\n {children}\n </Component>\n );\n },\n);\n"],"names":["MegaMenuList","megaMenuListCss"],"mappings":";;;;;;;;;;;;;AAkBA,MAAM,YAAA,GAAe,aAAa,kBAAkB,CAAA;AAsB7C,MAAM,YAAA,GAAsC,UAAA;AAAA,EACjD,SAASA,aAAAA,CACP;AAAA,IACE,EAAA;AAAA,IACA,QAAA;AAAA,IACA,SAAA;AAAA,IACA,iBAAA,EAAmB,cAAA;AAAA,IACnB,GAAG;AAAA,KAEL,GAAA,EACA;AACA,IAAA,MAAM,eAAe,SAAA,EAAU;AAC/B,IAAA,wBAAA,CAAyB;AAAA,MACvB,MAAA,EAAQ,qBAAA;AAAA,MACR,GAAA,EAAKC,QAAA;AAAA,MACL,MAAA,EAAQ;AAAA,KACT,CAAA;AAED,IAAA,MAAM,EAAE,SAAA,EAAU,GAAI,gBAAA,EAAiB;AAEvC,IAAA,MAAM,YAAY,EAAA,IAAM,IAAA;AAExB,IAAA,uBACE,GAAA;AAAA,MAAC,SAAA;AAAA,MAAA;AAAA,QACC,GAAA;AAAA,QACA,SAAA,EAAW,IAAA,CAAK,YAAA,EAAa,EAAG,SAAS,CAAA;AAAA,QACzC,iBAAA,EAAiB,IAAA,CAAK,SAAA,EAAW,cAAc,CAAA,IAAK,MAAA;AAAA,QACnD,GAAG,IAAA;AAAA,QAEH;AAAA;AAAA,KACH;AAAA,EAEJ;AACF;;;;"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var css_248z = ".saltMegaMenuListItem {\n list-style: none;\n display: flex;\n flex-direction: column;\n}\n\n.saltMegaMenuListItem-wrapper {\n display: flex;\n padding: var(--salt-spacing-50) var(--salt-spacing-100);\n align-items: flex-start;\n color: var(--salt-content-primary-foreground);\n background: var(--salt-selectable-background);\n cursor: var(--salt-cursor-hover);\n min-height: calc(var(--salt-size-base) + var(--salt-spacing-100));\n box-sizing: border-box;\n gap: var(--salt-spacing-100);\n position: relative;\n border-radius: var(--salt-palette-corner-weak, 0);\n text-decoration: none;\n border: none;\n font: inherit;\n text-align: start;\n}\n\n.saltMegaMenuListItem-wrapper > .saltIcon {\n display: flex;\n height: var(--salt-size-base);\n align-items: center;\n}\n\n.saltMegaMenuListItem-content {\n flex: 1 0;\n margin: var(--salt-spacing-75) 0;\n font-family: var(--salt-text-fontFamily);\n font-size: var(--salt-text-fontSize);\n font-weight: var(--salt-text-fontWeight);\n line-height: var(--salt-text-lineHeight);\n}\n\n.saltMegaMenuListItem-wrapper:focus-visible {\n outline: var(--salt-focused-outline);\n outline-offset: calc(var(--salt-size-fixed-100) * -2);\n}\n\n.saltMegaMenuListItem-wrapper:hover:not(:focus-visible) {\n outline: none;\n background: var(--salt-overlayable-background-hover);\n}\n\n.saltMegaMenuListItem-wrapper:active {\n background: var(--salt-navigable-accent-background-active);\n}\n\n.saltMegaMenuListItem-wrapper:active::before {\n content: \"\";\n position: absolute;\n inset: 0;\n box-sizing: border-box;\n border-radius: inherit;\n border: var(--salt-size-fixed-100) var(--salt-borderStyle-solid) var(--salt-navigable-accent-borderColor-active);\n pointer-events: none;\n}\n";
|
|
2
|
+
|
|
3
|
+
export { css_248z as default };
|
|
4
|
+
//# sourceMappingURL=MegaMenuListItem.css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MegaMenuListItem.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useComponentCssInjection } from '@salt-ds/styles';
|
|
3
|
+
import { useWindow } from '@salt-ds/window';
|
|
4
|
+
import { clsx } from 'clsx';
|
|
5
|
+
import { forwardRef, Children } from 'react';
|
|
6
|
+
import { makePrefixer } from '../utils/makePrefixer.js';
|
|
7
|
+
import { renderProps } from '../utils/renderProps.js';
|
|
8
|
+
import '../utils/useFloatingUI/useFloatingUI.js';
|
|
9
|
+
import '../utils/useId.js';
|
|
10
|
+
import '../salt-provider/SaltProvider.js';
|
|
11
|
+
import '../viewport/ViewportProvider.js';
|
|
12
|
+
import css_248z from './MegaMenuListItem.css.js';
|
|
13
|
+
import { useMegaMenu } from './useMegaMenu.js';
|
|
14
|
+
|
|
15
|
+
const withBaseName = makePrefixer("saltMegaMenuListItem");
|
|
16
|
+
function MegaMenuListItemAction(props) {
|
|
17
|
+
return renderProps("a", props);
|
|
18
|
+
}
|
|
19
|
+
const MegaMenuListItem = forwardRef(function MegaMenuListItem2({ children, className, onClick, render, href, current, ...rest }, ref) {
|
|
20
|
+
const targetWindow = useWindow();
|
|
21
|
+
const megaMenu = useMegaMenu();
|
|
22
|
+
useComponentCssInjection({
|
|
23
|
+
testId: "salt-mega-menu-list-item",
|
|
24
|
+
css: css_248z,
|
|
25
|
+
window: targetWindow
|
|
26
|
+
});
|
|
27
|
+
const handleClick = (event) => {
|
|
28
|
+
onClick == null ? void 0 : onClick(event);
|
|
29
|
+
megaMenu.setOpen(false);
|
|
30
|
+
};
|
|
31
|
+
return /* @__PURE__ */ jsx("li", { ref, className: clsx(withBaseName(), className), ...rest, children: /* @__PURE__ */ jsx(
|
|
32
|
+
MegaMenuListItemAction,
|
|
33
|
+
{
|
|
34
|
+
className: withBaseName("wrapper"),
|
|
35
|
+
href,
|
|
36
|
+
onClick: handleClick,
|
|
37
|
+
"aria-current": current ? "page" : void 0,
|
|
38
|
+
render,
|
|
39
|
+
children: Children.map(
|
|
40
|
+
children,
|
|
41
|
+
(child) => typeof child === "string" || typeof child === "number" ? /* @__PURE__ */ jsx("span", { className: withBaseName("content"), children: child }) : child
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
) });
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
export { MegaMenuListItem };
|
|
48
|
+
//# sourceMappingURL=MegaMenuListItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MegaMenuListItem.js","sources":["../src/mega-menu/MegaMenuListItem.tsx"],"sourcesContent":["import { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { clsx } from \"clsx\";\nimport {\n Children,\n type ComponentPropsWithoutRef,\n forwardRef,\n type MouseEventHandler,\n type ReactNode,\n} from \"react\";\nimport { makePrefixer, type RenderPropsType, renderProps } from \"../utils\";\nimport megaMenuListItemCss from \"./MegaMenuListItem.css\";\nimport { useMegaMenu } from \"./useMegaMenu\";\n\nconst withBaseName = makePrefixer(\"saltMegaMenuListItem\");\n\n// biome-ignore lint/suspicious/noExplicitAny: We don't know the exact type here\nfunction MegaMenuListItemAction(props: ComponentPropsWithoutRef<any>) {\n return renderProps(\"a\", props);\n}\n\nexport interface MegaMenuListItemProps\n extends Omit<ComponentPropsWithoutRef<\"li\">, \"onClick\"> {\n /**\n * The content of the mega menu item.\n */\n children?: ReactNode;\n /**\n * Whether the item is the current page. Sets `aria-current=\"page\"`\n */\n current?: boolean;\n /**\n * Href passed to the link action element.\n */\n href?: string;\n /**\n * Called when the item's action is activated, before the menu closes.\n */\n onClick?: MouseEventHandler<HTMLAnchorElement>;\n /**\n * Render prop to enable customization of the underlying action element (e.g. a router `Link`).\n */\n render?: RenderPropsType[\"render\"];\n}\n\nexport const MegaMenuListItem = forwardRef<\n HTMLLIElement,\n MegaMenuListItemProps\n>(function MegaMenuListItem(\n { children, className, onClick, render, href, current, ...rest },\n ref,\n) {\n const targetWindow = useWindow();\n const megaMenu = useMegaMenu();\n\n useComponentCssInjection({\n testId: \"salt-mega-menu-list-item\",\n css: megaMenuListItemCss,\n window: targetWindow,\n });\n\n const handleClick: MouseEventHandler<HTMLAnchorElement> = (event) => {\n onClick?.(event);\n megaMenu.setOpen(false);\n };\n\n return (\n <li ref={ref} className={clsx(withBaseName(), className)} {...rest}>\n <MegaMenuListItemAction\n className={withBaseName(\"wrapper\")}\n href={href}\n onClick={handleClick}\n aria-current={current ? \"page\" : undefined}\n render={render}\n >\n {Children.map(children, (child) =>\n typeof child === \"string\" || typeof child === \"number\" ? (\n <span className={withBaseName(\"content\")}>{child}</span>\n ) : (\n child\n ),\n )}\n </MegaMenuListItemAction>\n </li>\n );\n});\n"],"names":["MegaMenuListItem","megaMenuListItemCss"],"mappings":";;;;;;;;;;;;;;AAcA,MAAM,YAAA,GAAe,aAAa,sBAAsB,CAAA;AAGxD,SAAS,uBAAuB,KAAA,EAAsC;AACpE,EAAA,OAAO,WAAA,CAAY,KAAK,KAAK,CAAA;AAC/B;AA0BO,MAAM,gBAAA,GAAmB,UAAA,CAG9B,SAASA,iBAAAA,CACT,EAAE,QAAA,EAAU,SAAA,EAAW,OAAA,EAAS,MAAA,EAAQ,IAAA,EAAM,OAAA,EAAS,GAAG,IAAA,IAC1D,GAAA,EACA;AACA,EAAA,MAAM,eAAe,SAAA,EAAU;AAC/B,EAAA,MAAM,WAAW,WAAA,EAAY;AAE7B,EAAA,wBAAA,CAAyB;AAAA,IACvB,MAAA,EAAQ,0BAAA;AAAA,IACR,GAAA,EAAKC,QAAA;AAAA,IACL,MAAA,EAAQ;AAAA,GACT,CAAA;AAED,EAAA,MAAM,WAAA,GAAoD,CAAC,KAAA,KAAU;AACnE,IAAA,OAAA,IAAA,IAAA,GAAA,MAAA,GAAA,OAAA,CAAU,KAAA,CAAA;AACV,IAAA,QAAA,CAAS,QAAQ,KAAK,CAAA;AAAA,EACxB,CAAA;AAEA,EAAA,uBACE,GAAA,CAAC,IAAA,EAAA,EAAG,GAAA,EAAU,SAAA,EAAW,IAAA,CAAK,cAAa,EAAG,SAAS,CAAA,EAAI,GAAG,IAAA,EAC5D,QAAA,kBAAA,GAAA;AAAA,IAAC,sBAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAW,aAAa,SAAS,CAAA;AAAA,MACjC,IAAA;AAAA,MACA,OAAA,EAAS,WAAA;AAAA,MACT,cAAA,EAAc,UAAU,MAAA,GAAS,MAAA;AAAA,MACjC,MAAA;AAAA,MAEC,QAAA,EAAA,QAAA,CAAS,GAAA;AAAA,QAAI,QAAA;AAAA,QAAU,CAAC,KAAA,KACvB,OAAO,KAAA,KAAU,YAAY,OAAO,KAAA,KAAU,QAAA,mBAC5C,GAAA,CAAC,UAAK,SAAA,EAAW,YAAA,CAAa,SAAS,CAAA,EAAI,iBAAM,CAAA,GAEjD;AAAA;AAEJ;AAAA,GACF,EACF,CAAA;AAEJ,CAAC;;;;"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var css_248z = ".saltMegaMenuPanel {\n /* Single horizontal row: optional side content, the center navigation area,\n optional side content. Position is derived from source order alone, so\n authors need no wrapper scaffolding. */\n --saltMegaMenuPanel-availableWidth: calc(100vw - var(--salt-spacing-600));\n display: flex;\n align-items: stretch;\n inline-size: var(--saltMegaMenuPanel-inlineSize, fit-content);\n max-inline-size: var(--saltMegaMenuPanel-maxInlineSize, var(--saltMegaMenuPanel-availableWidth));\n max-block-size: 90vh;\n overflow-x: hidden;\n overflow-y: auto;\n box-sizing: border-box;\n border-radius: var(--salt-palette-corner, 0);\n border: var(--salt-size-fixed-100) var(--salt-borderStyle-solid) var(--salt-container-primary-borderColor);\n background: var(--salt-container-primary-background);\n box-shadow: var(--salt-overlayable-shadow-modal);\n}\n";
|
|
2
|
+
|
|
3
|
+
export { css_248z as default };
|
|
4
|
+
//# sourceMappingURL=MegaMenuPanel.css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MegaMenuPanel.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|