@lobehub/ui 5.12.2 → 5.13.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/es/ActionIcon/ActionIcon.mjs +1 -1
- package/es/ActionIcon/ActionIcon.mjs.map +1 -1
- package/es/DropdownMenu/index.d.mts +2 -2
- package/es/DropdownMenu/index.mjs +2 -2
- package/es/Menu/sharedStyle.d.mts +4 -0
- package/es/Menu/sharedStyle.mjs +23 -0
- package/es/Menu/sharedStyle.mjs.map +1 -1
- package/es/Tooltip/TooltipGroup.mjs +7 -7
- package/es/Tooltip/TooltipGroup.mjs.map +1 -1
- package/es/Tooltip/TooltipInGroup.mjs +8 -1
- package/es/Tooltip/TooltipInGroup.mjs.map +1 -1
- package/es/Tooltip/TooltipStandalone.mjs +8 -2
- package/es/Tooltip/TooltipStandalone.mjs.map +1 -1
- package/es/base-ui/ContextMenu/ContextMenuHost.mjs +19 -4
- package/es/base-ui/ContextMenu/ContextMenuHost.mjs.map +1 -1
- package/es/base-ui/ContextMenu/ContextMenuTrigger.d.mts +8 -0
- package/es/base-ui/ContextMenu/ContextMenuTrigger.mjs +11 -3
- package/es/base-ui/ContextMenu/ContextMenuTrigger.mjs.map +1 -1
- package/es/base-ui/ContextMenu/store.d.mts +3 -0
- package/es/base-ui/ContextMenu/store.mjs +4 -0
- package/es/base-ui/ContextMenu/store.mjs.map +1 -1
- package/es/base-ui/DropdownMenu/DropdownMenu.mjs +12 -4
- package/es/base-ui/DropdownMenu/DropdownMenu.mjs.map +1 -1
- package/es/base-ui/DropdownMenu/atoms.d.mts +25 -1
- package/es/base-ui/DropdownMenu/atoms.mjs +22 -1
- package/es/base-ui/DropdownMenu/atoms.mjs.map +1 -1
- package/es/base-ui/DropdownMenu/index.d.mts +1 -1
- package/es/base-ui/DropdownMenu/type.d.mts +8 -0
- package/es/base-ui/index.d.mts +2 -2
- package/es/base-ui/index.mjs +2 -2
- package/es/index.d.mts +2 -2
- package/es/index.mjs +2 -2
- package/package.json +1 -1
|
@@ -57,7 +57,7 @@ const ActionIcon = memo(({ color, fill, className, active, icon, size = "middle"
|
|
|
57
57
|
style: { pointerEvents: "none" }
|
|
58
58
|
})
|
|
59
59
|
});
|
|
60
|
-
if (!title
|
|
60
|
+
if (!title) return node;
|
|
61
61
|
return /* @__PURE__ */ jsx(Tooltip, {
|
|
62
62
|
title,
|
|
63
63
|
...tooltipProps,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionIcon.mjs","names":[],"sources":["../../src/ActionIcon/ActionIcon.tsx"],"sourcesContent":["'use client';\n\nimport { cx } from 'antd-style';\nimport { Loader2 } from 'lucide-react';\nimport { memo, type MouseEventHandler, useCallback, useMemo } from 'react';\n\nimport { Center } from '@/Flex';\nimport Icon from '@/Icon';\nimport Tooltip from '@/Tooltip';\n\nimport { calcSize } from './components/utils';\nimport { variants } from './style';\nimport { type ActionIconProps } from './type';\n\nconst ActionIcon = memo<ActionIconProps>(\n ({\n color,\n fill,\n className,\n active,\n icon,\n size = 'middle',\n variant = 'borderless',\n style,\n glass,\n title,\n onClick,\n loading,\n fillOpacity,\n fillRule,\n focusable,\n shadow,\n disabled,\n spin: iconSpinning,\n tooltipProps,\n danger,\n ref,\n ...rest\n }) => {\n const { blockSize, borderRadius } = useMemo(() => calcSize(size), [size]);\n const popupTriggerAria = rest as {\n 'aria-expanded'?: unknown;\n 'aria-haspopup'?: unknown;\n 'aria-label'?: string;\n };\n const isPopupTrigger =\n popupTriggerAria['aria-haspopup'] !== undefined ||\n popupTriggerAria['aria-expanded'] !== undefined;\n const popupTriggerLabel =\n popupTriggerAria['aria-label'] ??\n (isPopupTrigger && typeof title === 'string' ? title : undefined);\n\n const handleClick = useCallback<MouseEventHandler<HTMLDivElement>>(\n (event) => {\n if (loading || disabled) return;\n onClick?.(event);\n },\n [loading, disabled, onClick],\n );\n\n const node = (\n <Center\n horizontal\n className={cx(variants({ active, danger, disabled, glass, shadow, variant }), className)}\n flex={'none'}\n ref={ref}\n role=\"button\"\n style={{ borderRadius, height: blockSize, width: blockSize, ...style }}\n tabIndex={disabled ? -1 : 0}\n onClick={handleClick}\n {...rest}\n aria-label={popupTriggerLabel}\n >\n {icon && (\n <Icon\n color={color}\n fill={fill}\n fillOpacity={fillOpacity}\n fillRule={fillRule}\n focusable={focusable}\n icon={loading ? Loader2 : icon}\n size={size}\n spin={loading ? true : iconSpinning}\n style={{\n pointerEvents: 'none',\n }}\n />\n )}\n </Center>\n );\n\n if (!title
|
|
1
|
+
{"version":3,"file":"ActionIcon.mjs","names":[],"sources":["../../src/ActionIcon/ActionIcon.tsx"],"sourcesContent":["'use client';\n\nimport { cx } from 'antd-style';\nimport { Loader2 } from 'lucide-react';\nimport { memo, type MouseEventHandler, useCallback, useMemo } from 'react';\n\nimport { Center } from '@/Flex';\nimport Icon from '@/Icon';\nimport Tooltip from '@/Tooltip';\n\nimport { calcSize } from './components/utils';\nimport { variants } from './style';\nimport { type ActionIconProps } from './type';\n\nconst ActionIcon = memo<ActionIconProps>(\n ({\n color,\n fill,\n className,\n active,\n icon,\n size = 'middle',\n variant = 'borderless',\n style,\n glass,\n title,\n onClick,\n loading,\n fillOpacity,\n fillRule,\n focusable,\n shadow,\n disabled,\n spin: iconSpinning,\n tooltipProps,\n danger,\n ref,\n ...rest\n }) => {\n const { blockSize, borderRadius } = useMemo(() => calcSize(size), [size]);\n const popupTriggerAria = rest as {\n 'aria-expanded'?: unknown;\n 'aria-haspopup'?: unknown;\n 'aria-label'?: string;\n };\n const isPopupTrigger =\n popupTriggerAria['aria-haspopup'] !== undefined ||\n popupTriggerAria['aria-expanded'] !== undefined;\n const popupTriggerLabel =\n popupTriggerAria['aria-label'] ??\n (isPopupTrigger && typeof title === 'string' ? title : undefined);\n\n const handleClick = useCallback<MouseEventHandler<HTMLDivElement>>(\n (event) => {\n if (loading || disabled) return;\n onClick?.(event);\n },\n [loading, disabled, onClick],\n );\n\n const node = (\n <Center\n horizontal\n className={cx(variants({ active, danger, disabled, glass, shadow, variant }), className)}\n flex={'none'}\n ref={ref}\n role=\"button\"\n style={{ borderRadius, height: blockSize, width: blockSize, ...style }}\n tabIndex={disabled ? -1 : 0}\n onClick={handleClick}\n {...rest}\n aria-label={popupTriggerLabel}\n >\n {icon && (\n <Icon\n color={color}\n fill={fill}\n fillOpacity={fillOpacity}\n fillRule={fillRule}\n focusable={focusable}\n icon={loading ? Loader2 : icon}\n size={size}\n spin={loading ? true : iconSpinning}\n style={{\n pointerEvents: 'none',\n }}\n />\n )}\n </Center>\n );\n\n if (!title) return node;\n\n return (\n <Tooltip\n title={title}\n {...tooltipProps}\n styles={\n typeof tooltipProps?.styles === 'function'\n ? tooltipProps.styles\n : {\n ...tooltipProps?.styles,\n container: { pointerEvents: 'none', ...tooltipProps?.styles?.container },\n }\n }\n >\n {node}\n </Tooltip>\n );\n },\n);\n\nActionIcon.displayName = 'ActionIcon';\n\nexport default ActionIcon;\n"],"mappings":";;;;;;;;;;;AAcA,MAAM,aAAa,MAChB,EACC,OACA,MACA,WACA,QACA,MACA,OAAO,UACP,UAAU,cACV,OACA,OACA,OACA,SACA,SACA,aACA,UACA,WACA,QACA,UACA,MAAM,cACN,cACA,QACA,KACA,GAAG,WACC;CACJ,MAAM,EAAE,WAAW,iBAAiB,cAAc,SAAS,KAAK,EAAE,CAAC,KAAK,CAAC;CACzE,MAAM,mBAAmB;CAKzB,MAAM,iBACJ,iBAAiB,qBAAqB,KAAA,KACtC,iBAAiB,qBAAqB,KAAA;CACxC,MAAM,oBACJ,iBAAiB,kBAChB,kBAAkB,OAAO,UAAU,WAAW,QAAQ,KAAA;CAEzD,MAAM,cAAc,aACjB,UAAU;AACT,MAAI,WAAW,SAAU;AACzB,YAAU,MAAM;IAElB;EAAC;EAAS;EAAU;EAAQ,CAC7B;CAED,MAAM,OACJ,oBAAC,QAAD;EACE,YAAA;EACA,WAAW,GAAG,SAAS;GAAE;GAAQ;GAAQ;GAAU;GAAO;GAAQ;GAAS,CAAC,EAAE,UAAU;EACxF,MAAM;EACD;EACL,MAAK;EACL,OAAO;GAAE;GAAc,QAAQ;GAAW,OAAO;GAAW,GAAG;GAAO;EACtE,UAAU,WAAW,KAAK;EAC1B,SAAS;EACT,GAAI;EACJ,cAAY;YAEX,QACC,oBAAC,MAAD;GACS;GACD;GACO;GACH;GACC;GACX,MAAM,UAAU,UAAU;GACpB;GACN,MAAM,UAAU,OAAO;GACvB,OAAO,EACL,eAAe,QAChB;GACD,CAAA;EAEG,CAAA;AAGX,KAAI,CAAC,MAAO,QAAO;AAEnB,QACE,oBAAC,SAAD;EACS;EACP,GAAI;EACJ,QACE,OAAO,cAAc,WAAW,aAC5B,aAAa,SACb;GACE,GAAG,cAAc;GACjB,WAAW;IAAE,eAAe;IAAQ,GAAG,cAAc,QAAQ;IAAW;GACzE;YAGN;EACO,CAAA;EAGf;AAED,WAAW,cAAc"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IconSpaceMode } from "../Menu/renderUtils.mjs";
|
|
2
2
|
import { renderDropdownMenuItems } from "../base-ui/DropdownMenu/renderItems.mjs";
|
|
3
3
|
import { DropdownItem, DropdownMenuCheckboxItem, DropdownMenuPlacement, DropdownMenuProps, DropdownMenuSwitchItem as DropdownMenuSwitchItem$1 } from "../base-ui/DropdownMenu/type.mjs";
|
|
4
|
-
import { DropdownMenuCheckboxItemIndicator, DropdownMenuCheckboxItemPrimitive, DropdownMenuCheckboxItemProps, DropdownMenuGroup, DropdownMenuGroupLabel, DropdownMenuGroupLabelProps, DropdownMenuItem, DropdownMenuItemContent, DropdownMenuItemContentProps, DropdownMenuItemDesc, DropdownMenuItemDescProps, DropdownMenuItemExtra, DropdownMenuItemExtraProps, DropdownMenuItemIcon, DropdownMenuItemIconProps, DropdownMenuItemLabel, DropdownMenuItemLabelGroup, DropdownMenuItemLabelGroupProps, DropdownMenuItemLabelProps, DropdownMenuItemProps, DropdownMenuPopup, DropdownMenuPopupProps, DropdownMenuPortal, DropdownMenuPortalProps, DropdownMenuPositioner, DropdownMenuPositionerProps, DropdownMenuRoot, DropdownMenuSeparator, DropdownMenuSeparatorProps, DropdownMenuSubmenuArrow, DropdownMenuSubmenuArrowProps, DropdownMenuSubmenuRoot, DropdownMenuSubmenuTrigger, DropdownMenuSubmenuTriggerProps, DropdownMenuSwitchItem, DropdownMenuSwitchItemProps, DropdownMenuTrigger, DropdownMenuTriggerProps } from "../base-ui/DropdownMenu/atoms.mjs";
|
|
4
|
+
import { DropdownMenuCheckboxItemIndicator, DropdownMenuCheckboxItemPrimitive, DropdownMenuCheckboxItemProps, DropdownMenuFooter, DropdownMenuFooterProps, DropdownMenuGroup, DropdownMenuGroupLabel, DropdownMenuGroupLabelProps, DropdownMenuHeader, DropdownMenuHeaderProps, DropdownMenuItem, DropdownMenuItemContent, DropdownMenuItemContentProps, DropdownMenuItemDesc, DropdownMenuItemDescProps, DropdownMenuItemExtra, DropdownMenuItemExtraProps, DropdownMenuItemIcon, DropdownMenuItemIconProps, DropdownMenuItemLabel, DropdownMenuItemLabelGroup, DropdownMenuItemLabelGroupProps, DropdownMenuItemLabelProps, DropdownMenuItemProps, DropdownMenuPopup, DropdownMenuPopupProps, DropdownMenuPortal, DropdownMenuPortalProps, DropdownMenuPositioner, DropdownMenuPositionerProps, DropdownMenuRoot, DropdownMenuScrollViewport, DropdownMenuScrollViewportProps, DropdownMenuSeparator, DropdownMenuSeparatorProps, DropdownMenuSubmenuArrow, DropdownMenuSubmenuArrowProps, DropdownMenuSubmenuRoot, DropdownMenuSubmenuTrigger, DropdownMenuSubmenuTriggerProps, DropdownMenuSwitchItem, DropdownMenuSwitchItemProps, DropdownMenuTrigger, DropdownMenuTriggerProps } from "../base-ui/DropdownMenu/atoms.mjs";
|
|
5
5
|
import { DropdownMenu } from "../base-ui/DropdownMenu/DropdownMenu.mjs";
|
|
6
|
-
export { DropdownItem, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuCheckboxItemIndicator, DropdownMenuCheckboxItemPrimitive, DropdownMenuCheckboxItemProps, DropdownMenuGroup, DropdownMenuGroupLabel, DropdownMenuGroupLabelProps, DropdownMenuItem, DropdownMenuItemContent, DropdownMenuItemContentProps, DropdownMenuItemDesc, DropdownMenuItemDescProps, DropdownMenuItemExtra, DropdownMenuItemExtraProps, DropdownMenuItemIcon, DropdownMenuItemIconProps, DropdownMenuItemLabel, DropdownMenuItemLabelGroup, DropdownMenuItemLabelGroupProps, DropdownMenuItemLabelProps, DropdownMenuItemProps, DropdownMenuPlacement, DropdownMenuPopup, DropdownMenuPopupProps, DropdownMenuPortal, DropdownMenuPortalProps, DropdownMenuPositioner, DropdownMenuPositionerProps, DropdownMenuProps, DropdownMenuRoot, DropdownMenuSeparator, DropdownMenuSeparatorProps, DropdownMenuSubmenuArrow, DropdownMenuSubmenuArrowProps, DropdownMenuSubmenuRoot, DropdownMenuSubmenuTrigger, DropdownMenuSubmenuTriggerProps, DropdownMenuSwitchItem, DropdownMenuSwitchItemProps, DropdownMenuSwitchItem$1 as DropdownMenuSwitchItemType, DropdownMenuTrigger, DropdownMenuTriggerProps, IconSpaceMode, DropdownMenu as default, renderDropdownMenuItems };
|
|
6
|
+
export { DropdownItem, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuCheckboxItemIndicator, DropdownMenuCheckboxItemPrimitive, DropdownMenuCheckboxItemProps, DropdownMenuFooter, DropdownMenuFooterProps, DropdownMenuGroup, DropdownMenuGroupLabel, DropdownMenuGroupLabelProps, DropdownMenuHeader, DropdownMenuHeaderProps, DropdownMenuItem, DropdownMenuItemContent, DropdownMenuItemContentProps, DropdownMenuItemDesc, DropdownMenuItemDescProps, DropdownMenuItemExtra, DropdownMenuItemExtraProps, DropdownMenuItemIcon, DropdownMenuItemIconProps, DropdownMenuItemLabel, DropdownMenuItemLabelGroup, DropdownMenuItemLabelGroupProps, DropdownMenuItemLabelProps, DropdownMenuItemProps, DropdownMenuPlacement, DropdownMenuPopup, DropdownMenuPopupProps, DropdownMenuPortal, DropdownMenuPortalProps, DropdownMenuPositioner, DropdownMenuPositionerProps, DropdownMenuProps, DropdownMenuRoot, DropdownMenuScrollViewport, DropdownMenuScrollViewportProps, DropdownMenuSeparator, DropdownMenuSeparatorProps, DropdownMenuSubmenuArrow, DropdownMenuSubmenuArrowProps, DropdownMenuSubmenuRoot, DropdownMenuSubmenuTrigger, DropdownMenuSubmenuTriggerProps, DropdownMenuSwitchItem, DropdownMenuSwitchItemProps, DropdownMenuSwitchItem$1 as DropdownMenuSwitchItemType, DropdownMenuTrigger, DropdownMenuTriggerProps, IconSpaceMode, DropdownMenu as default, renderDropdownMenuItems };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DropdownMenuCheckboxItemIndicator, DropdownMenuCheckboxItemPrimitive, DropdownMenuGroup, DropdownMenuGroupLabel, DropdownMenuItem, DropdownMenuItemContent, DropdownMenuItemDesc, DropdownMenuItemExtra, DropdownMenuItemIcon, DropdownMenuItemLabel, DropdownMenuItemLabelGroup, DropdownMenuPopup, DropdownMenuPortal, DropdownMenuPositioner, DropdownMenuRoot, DropdownMenuSeparator, DropdownMenuSubmenuArrow, DropdownMenuSubmenuRoot, DropdownMenuSubmenuTrigger, DropdownMenuSwitchItem, DropdownMenuTrigger } from "../base-ui/DropdownMenu/atoms.mjs";
|
|
1
|
+
import { DropdownMenuCheckboxItemIndicator, DropdownMenuCheckboxItemPrimitive, DropdownMenuFooter, DropdownMenuGroup, DropdownMenuGroupLabel, DropdownMenuHeader, DropdownMenuItem, DropdownMenuItemContent, DropdownMenuItemDesc, DropdownMenuItemExtra, DropdownMenuItemIcon, DropdownMenuItemLabel, DropdownMenuItemLabelGroup, DropdownMenuPopup, DropdownMenuPortal, DropdownMenuPositioner, DropdownMenuRoot, DropdownMenuScrollViewport, DropdownMenuSeparator, DropdownMenuSubmenuArrow, DropdownMenuSubmenuRoot, DropdownMenuSubmenuTrigger, DropdownMenuSwitchItem, DropdownMenuTrigger } from "../base-ui/DropdownMenu/atoms.mjs";
|
|
2
2
|
import { renderDropdownMenuItems } from "../base-ui/DropdownMenu/renderItems.mjs";
|
|
3
3
|
import DropdownMenu from "../base-ui/DropdownMenu/DropdownMenu.mjs";
|
|
4
|
-
export { DropdownMenu, DropdownMenuCheckboxItemIndicator, DropdownMenuCheckboxItemPrimitive, DropdownMenuGroup, DropdownMenuGroupLabel, DropdownMenuItem, DropdownMenuItemContent, DropdownMenuItemDesc, DropdownMenuItemExtra, DropdownMenuItemIcon, DropdownMenuItemLabel, DropdownMenuItemLabelGroup, DropdownMenuPopup, DropdownMenuPortal, DropdownMenuPositioner, DropdownMenuRoot, DropdownMenuSeparator, DropdownMenuSubmenuArrow, DropdownMenuSubmenuRoot, DropdownMenuSubmenuTrigger, DropdownMenuSwitchItem, DropdownMenuTrigger, DropdownMenu as default, renderDropdownMenuItems };
|
|
4
|
+
export { DropdownMenu, DropdownMenuCheckboxItemIndicator, DropdownMenuCheckboxItemPrimitive, DropdownMenuFooter, DropdownMenuGroup, DropdownMenuGroupLabel, DropdownMenuHeader, DropdownMenuItem, DropdownMenuItemContent, DropdownMenuItemDesc, DropdownMenuItemExtra, DropdownMenuItemIcon, DropdownMenuItemLabel, DropdownMenuItemLabelGroup, DropdownMenuPopup, DropdownMenuPortal, DropdownMenuPositioner, DropdownMenuRoot, DropdownMenuScrollViewport, DropdownMenuSeparator, DropdownMenuSubmenuArrow, DropdownMenuSubmenuRoot, DropdownMenuSubmenuTrigger, DropdownMenuSwitchItem, DropdownMenuTrigger, DropdownMenu as default, renderDropdownMenuItems };
|
|
@@ -3,6 +3,8 @@ declare const styles: {
|
|
|
3
3
|
danger: string;
|
|
4
4
|
empty: string;
|
|
5
5
|
extra: string;
|
|
6
|
+
footer: string;
|
|
7
|
+
header: string;
|
|
6
8
|
groupLabel: string;
|
|
7
9
|
icon: string;
|
|
8
10
|
item: string;
|
|
@@ -13,6 +15,8 @@ declare const styles: {
|
|
|
13
15
|
labelGroup: string;
|
|
14
16
|
desc: string;
|
|
15
17
|
popup: string;
|
|
18
|
+
popupWithSlots: string;
|
|
19
|
+
slotViewport: string;
|
|
16
20
|
positioner: string;
|
|
17
21
|
separator: string;
|
|
18
22
|
submenuArrow: string;
|
package/es/Menu/sharedStyle.mjs
CHANGED
|
@@ -18,6 +18,18 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
|
|
|
18
18
|
padding-inline-start: 16px;
|
|
19
19
|
font-size: 12px;
|
|
20
20
|
color: ${cssVar.colorTextTertiary};
|
|
21
|
+
`,
|
|
22
|
+
footer: css`
|
|
23
|
+
flex-shrink: 0;
|
|
24
|
+
padding-block: 8px;
|
|
25
|
+
padding-inline: 12px;
|
|
26
|
+
border-block-start: 1px solid ${cssVar.colorBorder};
|
|
27
|
+
`,
|
|
28
|
+
header: css`
|
|
29
|
+
flex-shrink: 0;
|
|
30
|
+
padding-block: 8px;
|
|
31
|
+
padding-inline: 12px;
|
|
32
|
+
border-block-end: 1px solid ${cssVar.colorBorder};
|
|
21
33
|
`,
|
|
22
34
|
groupLabel: css`
|
|
23
35
|
user-select: none;
|
|
@@ -146,6 +158,17 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
|
|
|
146
158
|
box-shadow:
|
|
147
159
|
0 0 15px 0 #00000008,
|
|
148
160
|
0 2px 30px 0 #00000014;
|
|
161
|
+
`,
|
|
162
|
+
popupWithSlots: css`
|
|
163
|
+
overflow: hidden;
|
|
164
|
+
display: flex;
|
|
165
|
+
flex-direction: column;
|
|
166
|
+
max-height: var(--available-height);
|
|
167
|
+
`,
|
|
168
|
+
slotViewport: css`
|
|
169
|
+
overflow-y: auto;
|
|
170
|
+
flex: 1;
|
|
171
|
+
min-height: 0;
|
|
149
172
|
`,
|
|
150
173
|
positioner: css`
|
|
151
174
|
--lobe-dropdown-animation-duration: 140ms;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharedStyle.mjs","names":[],"sources":["../../src/Menu/sharedStyle.ts"],"sourcesContent":["import { createStaticStyles } from 'antd-style';\n\nexport const styles = createStaticStyles(({ css, cssVar }) => ({\n danger: css`\n color: ${cssVar.colorError} !important;\n\n &:hover {\n background: ${cssVar.colorErrorBg} !important;\n }\n `,\n\n empty: css`\n cursor: default;\n font-style: italic;\n color: ${cssVar.colorTextTertiary};\n `,\n\n extra: css`\n margin-inline-start: auto;\n padding-inline-start: 16px;\n font-size: 12px;\n color: ${cssVar.colorTextTertiary};\n `,\n\n groupLabel: css`\n user-select: none;\n\n padding-block: 8px 4px;\n padding-inline: 12px;\n\n font-size: 12px;\n font-weight: 500;\n line-height: 16px;\n color: ${cssVar.colorTextTertiary};\n text-transform: capitalize;\n `,\n\n icon: css`\n display: flex;\n flex-shrink: 0;\n align-items: center;\n justify-content: center;\n\n width: 16px;\n height: 16px;\n margin-inline-end: 8px;\n `,\n\n item: css`\n cursor: pointer;\n user-select: none;\n\n position: relative;\n\n overflow: hidden;\n display: flex;\n align-items: center;\n\n width: 100%;\n min-height: 36px;\n padding-block: 8px;\n padding-inline: 12px;\n border-radius: ${cssVar.borderRadiusSM};\n\n font-size: 14px;\n line-height: 20px;\n color: ${cssVar.colorText};\n\n outline: none;\n\n transition: all 150ms ${cssVar.motionEaseOut};\n\n &:hover {\n background: ${cssVar.colorFillTertiary};\n }\n\n &:active {\n background: ${cssVar.colorFillSecondary};\n }\n\n &[data-disabled] {\n cursor: not-allowed;\n color: ${cssVar.colorTextDisabled};\n opacity: 0.5;\n\n &:hover {\n background: transparent;\n }\n }\n\n &[data-highlighted]:not([data-disabled]) {\n background: ${cssVar.colorFillTertiary};\n }\n\n &[data-state='open']:not([data-disabled]),\n &[data-open]:not([data-disabled]),\n &[aria-expanded='true']:not([data-disabled]) {\n background: ${cssVar.colorFillTertiary};\n }\n `,\n\n itemContent: css`\n display: flex;\n flex: 1;\n gap: 0;\n align-items: center;\n `,\n\n itemContentAlignStart: css`\n align-items: flex-start;\n `,\n\n iconAlignStart: css`\n align-self: flex-start;\n margin-block-start: 2px;\n `,\n\n label: css`\n overflow: hidden;\n flex: 1;\n text-overflow: ellipsis;\n white-space: nowrap;\n\n & a,\n & a:visited,\n & a:hover,\n & a:active {\n color: inherit;\n }\n `,\n\n labelGroup: css`\n overflow: hidden;\n display: flex;\n flex: 1;\n flex-direction: column;\n\n min-width: 0;\n `,\n\n desc: css`\n overflow: hidden;\n\n font-size: 12px;\n line-height: 16px;\n color: ${cssVar.colorTextTertiary};\n text-overflow: ellipsis;\n white-space: nowrap;\n `,\n\n popup: css`\n min-width: 120px;\n padding: 4px;\n border-radius: ${cssVar.borderRadius};\n\n background: ${cssVar.colorBgElevated};\n outline: none;\n box-shadow:\n 0 0 15px 0 #00000008,\n 0 2px 30px 0 #00000014;\n `,\n positioner: css`\n --lobe-dropdown-animation-duration: 140ms;\n --lobe-dropdown-animation-scale-y: 0.92;\n --lobe-dropdown-animation-ease-in: ease-in;\n --lobe-dropdown-animation-ease-out: ${cssVar.motionEaseOut};\n\n z-index: 1100;\n\n & > * {\n will-change: opacity, transform;\n transform-origin: var(--transform-origin);\n animation: none;\n }\n\n &[data-open] > * {\n transform: scaleY(1);\n opacity: 1;\n transition:\n opacity var(--lobe-dropdown-animation-duration) var(--lobe-dropdown-animation-ease-out),\n transform var(--lobe-dropdown-animation-duration) var(--lobe-dropdown-animation-ease-out);\n }\n\n &[data-open] > *[data-starting-style] {\n transform: scaleY(var(--lobe-dropdown-animation-scale-y));\n opacity: 0;\n }\n\n &[data-closed] > * {\n transform: scaleY(var(--lobe-dropdown-animation-scale-y));\n opacity: 0;\n transition:\n opacity var(--lobe-dropdown-animation-duration) var(--lobe-dropdown-animation-ease-in),\n transform var(--lobe-dropdown-animation-duration) var(--lobe-dropdown-animation-ease-in);\n }\n\n &[data-hover-trigger] {\n --lobe-dropdown-animation-duration: 140ms;\n }\n\n &[data-submenu],\n &[data-nested] {\n --lobe-dropdown-animation-duration: 0ms;\n --lobe-dropdown-animation-scale-y: 1;\n }\n\n &[data-side='left'],\n &[data-side='right'] {\n --lobe-dropdown-animation-duration: 0ms;\n --lobe-dropdown-animation-scale-y: 1;\n }\n `,\n\n separator: css`\n height: 1px;\n margin-block: 4px;\n margin-inline: 0;\n background: ${cssVar.colorBorder};\n `,\n\n submenuArrow: css`\n display: flex;\n flex-shrink: 0;\n align-items: center;\n justify-content: center;\n\n width: 20px;\n height: 20px;\n margin-inline-start: auto;\n padding-inline-start: 8px;\n `,\n}));\n"],"mappings":";;AAEA,MAAa,SAAS,oBAAoB,EAAE,KAAK,cAAc;CAC7D,QAAQ,GAAG;aACA,OAAO,WAAW;;;oBAGX,OAAO,aAAa;;;CAItC,OAAO,GAAG;;;aAGC,OAAO,kBAAkB;;CAGpC,OAAO,GAAG;;;;aAIC,OAAO,kBAAkB;;CAGpC,YAAY,GAAG;;;;;;;;;aASJ,OAAO,kBAAkB;;;CAIpC,MAAM,GAAG;;;;;;;;;;CAWT,MAAM,GAAG;;;;;;;;;;;;;;qBAcU,OAAO,eAAe;;;;aAI9B,OAAO,UAAU;;;;4BAIF,OAAO,cAAc;;;oBAG7B,OAAO,kBAAkB;;;;oBAIzB,OAAO,mBAAmB;;;;;eAK/B,OAAO,kBAAkB;;;;;;;;;oBASpB,OAAO,kBAAkB;;;;;;oBAMzB,OAAO,kBAAkB;;;CAI3C,aAAa,GAAG;;;;;;CAOhB,uBAAuB,GAAG;;;CAI1B,gBAAgB,GAAG;;;;CAKnB,OAAO,GAAG;;;;;;;;;;;;;CAcV,YAAY,GAAG;;;;;;;;CASf,MAAM,GAAG;;;;;aAKE,OAAO,kBAAkB;;;;CAKpC,OAAO,GAAG;;;qBAGS,OAAO,aAAa;;kBAEvB,OAAO,gBAAgB;;;;;;
|
|
1
|
+
{"version":3,"file":"sharedStyle.mjs","names":[],"sources":["../../src/Menu/sharedStyle.ts"],"sourcesContent":["import { createStaticStyles } from 'antd-style';\n\nexport const styles = createStaticStyles(({ css, cssVar }) => ({\n danger: css`\n color: ${cssVar.colorError} !important;\n\n &:hover {\n background: ${cssVar.colorErrorBg} !important;\n }\n `,\n\n empty: css`\n cursor: default;\n font-style: italic;\n color: ${cssVar.colorTextTertiary};\n `,\n\n extra: css`\n margin-inline-start: auto;\n padding-inline-start: 16px;\n font-size: 12px;\n color: ${cssVar.colorTextTertiary};\n `,\n\n footer: css`\n flex-shrink: 0;\n padding-block: 8px;\n padding-inline: 12px;\n border-block-start: 1px solid ${cssVar.colorBorder};\n `,\n\n header: css`\n flex-shrink: 0;\n padding-block: 8px;\n padding-inline: 12px;\n border-block-end: 1px solid ${cssVar.colorBorder};\n `,\n\n groupLabel: css`\n user-select: none;\n\n padding-block: 8px 4px;\n padding-inline: 12px;\n\n font-size: 12px;\n font-weight: 500;\n line-height: 16px;\n color: ${cssVar.colorTextTertiary};\n text-transform: capitalize;\n `,\n\n icon: css`\n display: flex;\n flex-shrink: 0;\n align-items: center;\n justify-content: center;\n\n width: 16px;\n height: 16px;\n margin-inline-end: 8px;\n `,\n\n item: css`\n cursor: pointer;\n user-select: none;\n\n position: relative;\n\n overflow: hidden;\n display: flex;\n align-items: center;\n\n width: 100%;\n min-height: 36px;\n padding-block: 8px;\n padding-inline: 12px;\n border-radius: ${cssVar.borderRadiusSM};\n\n font-size: 14px;\n line-height: 20px;\n color: ${cssVar.colorText};\n\n outline: none;\n\n transition: all 150ms ${cssVar.motionEaseOut};\n\n &:hover {\n background: ${cssVar.colorFillTertiary};\n }\n\n &:active {\n background: ${cssVar.colorFillSecondary};\n }\n\n &[data-disabled] {\n cursor: not-allowed;\n color: ${cssVar.colorTextDisabled};\n opacity: 0.5;\n\n &:hover {\n background: transparent;\n }\n }\n\n &[data-highlighted]:not([data-disabled]) {\n background: ${cssVar.colorFillTertiary};\n }\n\n &[data-state='open']:not([data-disabled]),\n &[data-open]:not([data-disabled]),\n &[aria-expanded='true']:not([data-disabled]) {\n background: ${cssVar.colorFillTertiary};\n }\n `,\n\n itemContent: css`\n display: flex;\n flex: 1;\n gap: 0;\n align-items: center;\n `,\n\n itemContentAlignStart: css`\n align-items: flex-start;\n `,\n\n iconAlignStart: css`\n align-self: flex-start;\n margin-block-start: 2px;\n `,\n\n label: css`\n overflow: hidden;\n flex: 1;\n text-overflow: ellipsis;\n white-space: nowrap;\n\n & a,\n & a:visited,\n & a:hover,\n & a:active {\n color: inherit;\n }\n `,\n\n labelGroup: css`\n overflow: hidden;\n display: flex;\n flex: 1;\n flex-direction: column;\n\n min-width: 0;\n `,\n\n desc: css`\n overflow: hidden;\n\n font-size: 12px;\n line-height: 16px;\n color: ${cssVar.colorTextTertiary};\n text-overflow: ellipsis;\n white-space: nowrap;\n `,\n\n popup: css`\n min-width: 120px;\n padding: 4px;\n border-radius: ${cssVar.borderRadius};\n\n background: ${cssVar.colorBgElevated};\n outline: none;\n box-shadow:\n 0 0 15px 0 #00000008,\n 0 2px 30px 0 #00000014;\n `,\n\n popupWithSlots: css`\n overflow: hidden;\n display: flex;\n flex-direction: column;\n max-height: var(--available-height);\n `,\n\n slotViewport: css`\n overflow-y: auto;\n flex: 1;\n min-height: 0;\n `,\n\n positioner: css`\n --lobe-dropdown-animation-duration: 140ms;\n --lobe-dropdown-animation-scale-y: 0.92;\n --lobe-dropdown-animation-ease-in: ease-in;\n --lobe-dropdown-animation-ease-out: ${cssVar.motionEaseOut};\n\n z-index: 1100;\n\n & > * {\n will-change: opacity, transform;\n transform-origin: var(--transform-origin);\n animation: none;\n }\n\n &[data-open] > * {\n transform: scaleY(1);\n opacity: 1;\n transition:\n opacity var(--lobe-dropdown-animation-duration) var(--lobe-dropdown-animation-ease-out),\n transform var(--lobe-dropdown-animation-duration) var(--lobe-dropdown-animation-ease-out);\n }\n\n &[data-open] > *[data-starting-style] {\n transform: scaleY(var(--lobe-dropdown-animation-scale-y));\n opacity: 0;\n }\n\n &[data-closed] > * {\n transform: scaleY(var(--lobe-dropdown-animation-scale-y));\n opacity: 0;\n transition:\n opacity var(--lobe-dropdown-animation-duration) var(--lobe-dropdown-animation-ease-in),\n transform var(--lobe-dropdown-animation-duration) var(--lobe-dropdown-animation-ease-in);\n }\n\n &[data-hover-trigger] {\n --lobe-dropdown-animation-duration: 140ms;\n }\n\n &[data-submenu],\n &[data-nested] {\n --lobe-dropdown-animation-duration: 0ms;\n --lobe-dropdown-animation-scale-y: 1;\n }\n\n &[data-side='left'],\n &[data-side='right'] {\n --lobe-dropdown-animation-duration: 0ms;\n --lobe-dropdown-animation-scale-y: 1;\n }\n `,\n\n separator: css`\n height: 1px;\n margin-block: 4px;\n margin-inline: 0;\n background: ${cssVar.colorBorder};\n `,\n\n submenuArrow: css`\n display: flex;\n flex-shrink: 0;\n align-items: center;\n justify-content: center;\n\n width: 20px;\n height: 20px;\n margin-inline-start: auto;\n padding-inline-start: 8px;\n `,\n}));\n"],"mappings":";;AAEA,MAAa,SAAS,oBAAoB,EAAE,KAAK,cAAc;CAC7D,QAAQ,GAAG;aACA,OAAO,WAAW;;;oBAGX,OAAO,aAAa;;;CAItC,OAAO,GAAG;;;aAGC,OAAO,kBAAkB;;CAGpC,OAAO,GAAG;;;;aAIC,OAAO,kBAAkB;;CAGpC,QAAQ,GAAG;;;;oCAIuB,OAAO,YAAY;;CAGrD,QAAQ,GAAG;;;;kCAIqB,OAAO,YAAY;;CAGnD,YAAY,GAAG;;;;;;;;;aASJ,OAAO,kBAAkB;;;CAIpC,MAAM,GAAG;;;;;;;;;;CAWT,MAAM,GAAG;;;;;;;;;;;;;;qBAcU,OAAO,eAAe;;;;aAI9B,OAAO,UAAU;;;;4BAIF,OAAO,cAAc;;;oBAG7B,OAAO,kBAAkB;;;;oBAIzB,OAAO,mBAAmB;;;;;eAK/B,OAAO,kBAAkB;;;;;;;;;oBASpB,OAAO,kBAAkB;;;;;;oBAMzB,OAAO,kBAAkB;;;CAI3C,aAAa,GAAG;;;;;;CAOhB,uBAAuB,GAAG;;;CAI1B,gBAAgB,GAAG;;;;CAKnB,OAAO,GAAG;;;;;;;;;;;;;CAcV,YAAY,GAAG;;;;;;;;CASf,MAAM,GAAG;;;;;aAKE,OAAO,kBAAkB;;;;CAKpC,OAAO,GAAG;;;qBAGS,OAAO,aAAa;;kBAEvB,OAAO,gBAAgB;;;;;;CAOvC,gBAAgB,GAAG;;;;;;CAOnB,cAAc,GAAG;;;;;CAMjB,YAAY,GAAG;;;;0CAIyB,OAAO,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgD7D,WAAW,GAAG;;;;kBAIE,OAAO,YAAY;;CAGnC,cAAc,GAAG;;;;;;;;;;;CAWlB,EAAE"}
|
|
@@ -8,7 +8,7 @@ import { styles } from "./style.mjs";
|
|
|
8
8
|
import TooltipContent from "./TooltipContent.mjs";
|
|
9
9
|
import { useDestroyOnInvalidActiveTriggerElement, useHidePopupWhenPositionerAtOrigin } from "../utils/destroyOnInvalidActiveTriggerElement.mjs";
|
|
10
10
|
import { useCallback, useRef, useState } from "react";
|
|
11
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
12
12
|
import { cx } from "antd-style";
|
|
13
13
|
import { Tooltip } from "@base-ui/react/tooltip";
|
|
14
14
|
//#region src/Tooltip/TooltipGroup.tsx
|
|
@@ -34,15 +34,15 @@ const TooltipGroup = ({ children, disableDestroyOnInvalidTrigger = false, disabl
|
|
|
34
34
|
useHidePopupWhenPositionerAtOrigin(handle.store, { enabled: !disableZeroOriginGuard });
|
|
35
35
|
return /* @__PURE__ */ jsx(TooltipGroupHandleContext, {
|
|
36
36
|
value: handle,
|
|
37
|
-
children: /* @__PURE__ */
|
|
37
|
+
children: /* @__PURE__ */ jsx(TooltipGroupPropsContext, {
|
|
38
38
|
value: sharedProps,
|
|
39
|
-
children:
|
|
39
|
+
children: /* @__PURE__ */ jsx(Tooltip.Root, {
|
|
40
40
|
handle,
|
|
41
41
|
onOpenChange: handleOpenChange,
|
|
42
42
|
children: ({ payload }) => {
|
|
43
43
|
const item = payload ?? null;
|
|
44
44
|
activeItemRef.current = item;
|
|
45
|
-
if (!item || item.title == null && !item.hotkey) return
|
|
45
|
+
if (!item || item.title == null && !item.hotkey) return children;
|
|
46
46
|
const arrow = item.arrow ?? false;
|
|
47
47
|
const placement = item.placement ?? "top";
|
|
48
48
|
const placementConfig = placementMap[placement] ?? placementMap.top;
|
|
@@ -105,12 +105,12 @@ const TooltipGroup = ({ children, disableDestroyOnInvalidTrigger = false, disabl
|
|
|
105
105
|
})
|
|
106
106
|
});
|
|
107
107
|
const resolvedPortalContainer = item.popupContainer ?? popupContainer ?? portalContainer;
|
|
108
|
-
return resolvedPortalContainer ? /* @__PURE__ */ jsx(Tooltip.Portal, {
|
|
108
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [children, resolvedPortalContainer ? /* @__PURE__ */ jsx(Tooltip.Portal, {
|
|
109
109
|
container: resolvedPortalContainer,
|
|
110
110
|
children: popup
|
|
111
|
-
}) : null;
|
|
111
|
+
}) : null] });
|
|
112
112
|
}
|
|
113
|
-
}, key)
|
|
113
|
+
}, key)
|
|
114
114
|
})
|
|
115
115
|
});
|
|
116
116
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TooltipGroup.mjs","names":["BaseTooltip"],"sources":["../../src/Tooltip/TooltipGroup.tsx"],"sourcesContent":["'use client';\n\nimport { Tooltip as BaseTooltip } from '@base-ui/react/tooltip';\nimport { cx } from 'antd-style';\nimport { type FC, useCallback, useRef, useState } from 'react';\n\nimport { useFloatingLayer } from '@/hooks/useFloatingLayer';\nimport { useAppElement } from '@/ThemeProvider';\nimport {\n useDestroyOnInvalidActiveTriggerElement,\n useHidePopupWhenPositionerAtOrigin,\n} from '@/utils/destroyOnInvalidActiveTriggerElement';\nimport { placementMap } from '@/utils/placement';\n\nimport { TooltipArrowIcon } from './ArrowIcon';\nimport {\n TooltipGroupHandleContext,\n type TooltipGroupItem,\n TooltipGroupPropsContext,\n} from './groupContext';\nimport { styles } from './style';\nimport TooltipContent from './TooltipContent';\nimport { type TooltipGroupProps } from './type';\n\nconst TooltipGroup: FC<TooltipGroupProps> = ({\n children,\n disableDestroyOnInvalidTrigger = false,\n disableZeroOriginGuard = false,\n layoutAnimation = false,\n popupContainer,\n ...sharedProps\n}) => {\n const [{ handle, key }, setHandleState] = useState(() => ({\n handle: BaseTooltip.createHandle<TooltipGroupItem>(),\n key: 0,\n }));\n const activeItemRef = useRef<TooltipGroupItem | null>(null);\n\n const destroy = useCallback(() => {\n activeItemRef.current = null;\n setHandleState(({ key }) => ({\n handle: BaseTooltip.createHandle<TooltipGroupItem>(),\n key: key + 1,\n }));\n }, []);\n\n const handleOpenChange = useCallback((open: boolean) => {\n activeItemRef.current?.onOpenChange?.(open);\n }, []);\n\n const appElement = useAppElement();\n const floatingLayerContainer = useFloatingLayer();\n const portalContainer = floatingLayerContainer ?? appElement;\n\n useDestroyOnInvalidActiveTriggerElement(handle.store, destroy, {\n enabled: !disableDestroyOnInvalidTrigger,\n });\n useHidePopupWhenPositionerAtOrigin(handle.store, { enabled: !disableZeroOriginGuard });\n\n return (\n <TooltipGroupHandleContext value={handle}>\n <TooltipGroupPropsContext value={sharedProps}>\n
|
|
1
|
+
{"version":3,"file":"TooltipGroup.mjs","names":["BaseTooltip"],"sources":["../../src/Tooltip/TooltipGroup.tsx"],"sourcesContent":["'use client';\n\nimport { Tooltip as BaseTooltip } from '@base-ui/react/tooltip';\nimport { cx } from 'antd-style';\nimport { type FC, useCallback, useRef, useState } from 'react';\n\nimport { useFloatingLayer } from '@/hooks/useFloatingLayer';\nimport { useAppElement } from '@/ThemeProvider';\nimport {\n useDestroyOnInvalidActiveTriggerElement,\n useHidePopupWhenPositionerAtOrigin,\n} from '@/utils/destroyOnInvalidActiveTriggerElement';\nimport { placementMap } from '@/utils/placement';\n\nimport { TooltipArrowIcon } from './ArrowIcon';\nimport {\n TooltipGroupHandleContext,\n type TooltipGroupItem,\n TooltipGroupPropsContext,\n} from './groupContext';\nimport { styles } from './style';\nimport TooltipContent from './TooltipContent';\nimport { type TooltipGroupProps } from './type';\n\nconst TooltipGroup: FC<TooltipGroupProps> = ({\n children,\n disableDestroyOnInvalidTrigger = false,\n disableZeroOriginGuard = false,\n layoutAnimation = false,\n popupContainer,\n ...sharedProps\n}) => {\n const [{ handle, key }, setHandleState] = useState(() => ({\n handle: BaseTooltip.createHandle<TooltipGroupItem>(),\n key: 0,\n }));\n const activeItemRef = useRef<TooltipGroupItem | null>(null);\n\n const destroy = useCallback(() => {\n activeItemRef.current = null;\n setHandleState(({ key }) => ({\n handle: BaseTooltip.createHandle<TooltipGroupItem>(),\n key: key + 1,\n }));\n }, []);\n\n const handleOpenChange = useCallback((open: boolean) => {\n activeItemRef.current?.onOpenChange?.(open);\n }, []);\n\n const appElement = useAppElement();\n const floatingLayerContainer = useFloatingLayer();\n const portalContainer = floatingLayerContainer ?? appElement;\n\n useDestroyOnInvalidActiveTriggerElement(handle.store, destroy, {\n enabled: !disableDestroyOnInvalidTrigger,\n });\n useHidePopupWhenPositionerAtOrigin(handle.store, { enabled: !disableZeroOriginGuard });\n\n return (\n <TooltipGroupHandleContext value={handle}>\n <TooltipGroupPropsContext value={sharedProps}>\n <BaseTooltip.Root handle={handle} key={key} onOpenChange={handleOpenChange}>\n {({ payload }) => {\n const item = (payload as TooltipGroupItem | null) ?? null;\n activeItemRef.current = item;\n\n if (!item || (item.title == null && !item.hotkey)) {\n return children;\n }\n\n const arrow = item.arrow ?? false;\n const placement = item.placement ?? 'top';\n const placementConfig = placementMap[placement] ?? placementMap.top;\n const baseSideOffset = arrow ? 8 : 6;\n\n const resolvedClassNames = {\n arrow: cx(styles.arrow, item.classNames?.arrow),\n popup: cx(\n styles.popup,\n item.className,\n item.classNames?.root,\n item.classNames?.container,\n ),\n positioner: styles.positioner,\n viewport: cx(styles.viewport, item.classNames?.content),\n };\n\n const resolvedStyleProps = (() => {\n if (typeof item.styles === 'function') return undefined;\n return item.styles;\n })();\n\n const resolvedStyles = {\n arrow: resolvedStyleProps?.arrow,\n popup: {\n ...resolvedStyleProps?.root,\n ...resolvedStyleProps?.container,\n },\n positioner: {\n zIndex: item.zIndex ?? 114_514,\n },\n viewport: resolvedStyleProps?.content,\n };\n\n const body = layoutAnimation ? (\n <BaseTooltip.Viewport\n className={resolvedClassNames.viewport}\n style={resolvedStyles.viewport}\n >\n <TooltipContent\n hotkey={item.hotkey}\n hotkeyProps={item.hotkeyProps}\n title={item.title}\n />\n </BaseTooltip.Viewport>\n ) : (\n <div className={resolvedClassNames.viewport} style={resolvedStyles.viewport}>\n <TooltipContent\n hotkey={item.hotkey}\n hotkeyProps={item.hotkeyProps}\n title={item.title}\n />\n </div>\n );\n\n const popup = (\n <BaseTooltip.Positioner\n align={placementConfig.align}\n className={resolvedClassNames.positioner}\n data-layout-animation={layoutAnimation || undefined}\n data-placement={placement}\n side={placementConfig.side}\n sideOffset={baseSideOffset}\n style={resolvedStyles.positioner}\n {...item.positionerProps}\n >\n <BaseTooltip.Popup\n className={resolvedClassNames.popup}\n data-layout-animation={layoutAnimation || undefined}\n style={resolvedStyles.popup}\n {...item.popupProps}\n >\n {arrow && (\n <BaseTooltip.Arrow\n className={resolvedClassNames.arrow}\n style={resolvedStyles.arrow}\n >\n {TooltipArrowIcon}\n </BaseTooltip.Arrow>\n )}\n {body}\n </BaseTooltip.Popup>\n </BaseTooltip.Positioner>\n );\n\n const resolvedPortalContainer =\n item.popupContainer ?? popupContainer ?? portalContainer;\n\n return (\n <>\n {children}\n {resolvedPortalContainer ? (\n <BaseTooltip.Portal container={resolvedPortalContainer}>\n {popup}\n </BaseTooltip.Portal>\n ) : null}\n </>\n );\n }}\n </BaseTooltip.Root>\n </TooltipGroupPropsContext>\n </TooltipGroupHandleContext>\n );\n};\n\nTooltipGroup.displayName = 'TooltipGroup';\n\nexport default TooltipGroup;\n"],"mappings":";;;;;;;;;;;;;;AAwBA,MAAM,gBAAuC,EAC3C,UACA,iCAAiC,OACjC,yBAAyB,OACzB,kBAAkB,OAClB,gBACA,GAAG,kBACC;CACJ,MAAM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|
|
75
75
|
const disabled = Boolean(item.disabled);
|
|
76
76
|
const { isNativeButtonTriggerElement } = useNativeButton({ children });
|
|
77
77
|
const childElement = isValidElement(children) ? children : null;
|
|
78
|
+
const popupTriggerId = childElement && childElement.props["aria-haspopup"] !== void 0 && childElement.props.id !== void 0 ? childElement.props.id : void 0;
|
|
78
79
|
const renderTrigger = useCallback((renderProps) => {
|
|
79
80
|
const resolvedProps = (() => {
|
|
80
81
|
if (isNativeButtonTriggerElement) return renderProps;
|
|
81
82
|
const { type, ref: triggerRef, ...triggerRest } = renderProps;
|
|
82
83
|
return triggerRest;
|
|
83
84
|
})();
|
|
85
|
+
const childProps = childElement.props;
|
|
86
|
+
const mergedProps = mergeProps(restProps, childProps, resolvedProps);
|
|
87
|
+
const shouldPreservePopupTriggerId = childProps["aria-haspopup"] !== void 0 && childProps.id !== void 0;
|
|
84
88
|
return cloneElement(childElement, {
|
|
85
|
-
...
|
|
89
|
+
...mergedProps,
|
|
90
|
+
id: shouldPreservePopupTriggerId ? childProps.id : mergedProps.id,
|
|
86
91
|
ref: mergeRefs([
|
|
87
92
|
childElement.ref,
|
|
88
93
|
renderProps.ref,
|
|
@@ -100,6 +105,8 @@ const TooltipInGroup = ({ children, ref: refProp, arrow, className, classNames,
|
|
|
100
105
|
closeDelay: resolvedCloseDelay,
|
|
101
106
|
delay: resolvedOpenDelay,
|
|
102
107
|
disabled,
|
|
108
|
+
...item.triggerProps,
|
|
109
|
+
id: popupTriggerId ?? item.triggerProps?.id,
|
|
103
110
|
payload: item
|
|
104
111
|
};
|
|
105
112
|
if (childElement) return /* @__PURE__ */ jsx(Tooltip.Trigger, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TooltipInGroup.mjs","names":["BaseTooltip"],"sources":["../../src/Tooltip/TooltipInGroup.tsx"],"sourcesContent":["'use client';\n\nimport { mergeProps } from '@base-ui/react/merge-props';\nimport { Tooltip as BaseTooltip } from '@base-ui/react/tooltip';\nimport { cloneElement, type FC, isValidElement, use, useCallback, useMemo } from 'react';\nimport { mergeRefs } from 'react-merge-refs';\n\nimport { useNativeButton } from '@/hooks/useNativeButton';\n\nimport { TooltipGroupHandleContext } from './groupContext';\nimport { type TooltipProps } from './type';\nimport { useMergedTooltipProps } from './useMergedTooltipProps';\n\nconst DEFAULT_OPEN_DELAY = 400;\nconst DEFAULT_CLOSE_DELAY = 100;\n\nexport const TooltipInGroup: FC<TooltipProps> = ({\n children,\n ref: refProp,\n arrow,\n className,\n classNames,\n closeDelay,\n defaultOpen,\n disabled: disabledProp,\n getPopupContainer,\n hotkey,\n hotkeyProps,\n mouseEnterDelay,\n mouseLeaveDelay,\n onOpenChange,\n open,\n openDelay,\n placement,\n popupContainer,\n popupProps,\n portalProps,\n positionerProps,\n standalone: _standalone,\n styles,\n title,\n triggerProps: triggerPropsProp,\n zIndex,\n ...restProps\n}) => {\n const tooltipProps = useMemo(\n () => ({\n arrow,\n className,\n classNames,\n closeDelay,\n defaultOpen,\n disabled: disabledProp,\n getPopupContainer,\n hotkey,\n hotkeyProps,\n mouseEnterDelay,\n mouseLeaveDelay,\n onOpenChange,\n open,\n openDelay,\n placement,\n popupContainer,\n popupProps,\n portalProps,\n positionerProps,\n styles,\n title,\n triggerProps: triggerPropsProp,\n zIndex,\n }),\n [\n arrow,\n className,\n classNames,\n closeDelay,\n defaultOpen,\n disabledProp,\n getPopupContainer,\n hotkey,\n hotkeyProps,\n mouseEnterDelay,\n mouseLeaveDelay,\n onOpenChange,\n open,\n openDelay,\n placement,\n popupContainer,\n popupProps,\n portalProps,\n positionerProps,\n styles,\n title,\n triggerPropsProp,\n zIndex,\n ],\n );\n\n const group = use(TooltipGroupHandleContext);\n const item = useMergedTooltipProps(tooltipProps);\n\n const resolvedOpenDelay = useMemo(() => {\n if (item.openDelay !== undefined) return item.openDelay;\n if (item.mouseEnterDelay !== undefined) return item.mouseEnterDelay * 1000;\n return DEFAULT_OPEN_DELAY;\n }, [item.mouseEnterDelay, item.openDelay]);\n\n const resolvedCloseDelay = useMemo(() => {\n if (item.closeDelay !== undefined) return item.closeDelay;\n if (item.mouseLeaveDelay !== undefined) return item.mouseLeaveDelay * 1000;\n return DEFAULT_CLOSE_DELAY;\n }, [item.closeDelay, item.mouseLeaveDelay]);\n\n const disabled = Boolean(item.disabled);\n\n const { isNativeButtonTriggerElement } = useNativeButton({\n children,\n });\n\n const childElement = isValidElement(children) ? children : null;\n\n const renderTrigger = useCallback(\n (renderProps: unknown) => {\n // Base UI's trigger props include `type=\"button\"` by default.\n // If we render into a non-<button> element, that prop is invalid and can warn.\n const resolvedProps = (() => {\n if (isNativeButtonTriggerElement) return renderProps as any;\n // eslint-disable-next-line unused-imports/no-unused-vars\n const { type, ref: triggerRef, ...triggerRest } = renderProps as any;\n return triggerRest;\n })();\n\n const
|
|
1
|
+
{"version":3,"file":"TooltipInGroup.mjs","names":["BaseTooltip"],"sources":["../../src/Tooltip/TooltipInGroup.tsx"],"sourcesContent":["'use client';\n\nimport { mergeProps } from '@base-ui/react/merge-props';\nimport { Tooltip as BaseTooltip } from '@base-ui/react/tooltip';\nimport { cloneElement, type FC, isValidElement, use, useCallback, useMemo } from 'react';\nimport { mergeRefs } from 'react-merge-refs';\n\nimport { useNativeButton } from '@/hooks/useNativeButton';\n\nimport { TooltipGroupHandleContext } from './groupContext';\nimport { type TooltipProps } from './type';\nimport { useMergedTooltipProps } from './useMergedTooltipProps';\n\nconst DEFAULT_OPEN_DELAY = 400;\nconst DEFAULT_CLOSE_DELAY = 100;\n\nexport const TooltipInGroup: FC<TooltipProps> = ({\n children,\n ref: refProp,\n arrow,\n className,\n classNames,\n closeDelay,\n defaultOpen,\n disabled: disabledProp,\n getPopupContainer,\n hotkey,\n hotkeyProps,\n mouseEnterDelay,\n mouseLeaveDelay,\n onOpenChange,\n open,\n openDelay,\n placement,\n popupContainer,\n popupProps,\n portalProps,\n positionerProps,\n standalone: _standalone,\n styles,\n title,\n triggerProps: triggerPropsProp,\n zIndex,\n ...restProps\n}) => {\n const tooltipProps = useMemo(\n () => ({\n arrow,\n className,\n classNames,\n closeDelay,\n defaultOpen,\n disabled: disabledProp,\n getPopupContainer,\n hotkey,\n hotkeyProps,\n mouseEnterDelay,\n mouseLeaveDelay,\n onOpenChange,\n open,\n openDelay,\n placement,\n popupContainer,\n popupProps,\n portalProps,\n positionerProps,\n styles,\n title,\n triggerProps: triggerPropsProp,\n zIndex,\n }),\n [\n arrow,\n className,\n classNames,\n closeDelay,\n defaultOpen,\n disabledProp,\n getPopupContainer,\n hotkey,\n hotkeyProps,\n mouseEnterDelay,\n mouseLeaveDelay,\n onOpenChange,\n open,\n openDelay,\n placement,\n popupContainer,\n popupProps,\n portalProps,\n positionerProps,\n styles,\n title,\n triggerPropsProp,\n zIndex,\n ],\n );\n\n const group = use(TooltipGroupHandleContext);\n const item = useMergedTooltipProps(tooltipProps);\n\n const resolvedOpenDelay = useMemo(() => {\n if (item.openDelay !== undefined) return item.openDelay;\n if (item.mouseEnterDelay !== undefined) return item.mouseEnterDelay * 1000;\n return DEFAULT_OPEN_DELAY;\n }, [item.mouseEnterDelay, item.openDelay]);\n\n const resolvedCloseDelay = useMemo(() => {\n if (item.closeDelay !== undefined) return item.closeDelay;\n if (item.mouseLeaveDelay !== undefined) return item.mouseLeaveDelay * 1000;\n return DEFAULT_CLOSE_DELAY;\n }, [item.closeDelay, item.mouseLeaveDelay]);\n\n const disabled = Boolean(item.disabled);\n\n const { isNativeButtonTriggerElement } = useNativeButton({\n children,\n });\n\n const childElement = isValidElement(children) ? children : null;\n const popupTriggerId =\n childElement &&\n (childElement as any).props['aria-haspopup'] !== undefined &&\n (childElement as any).props.id !== undefined\n ? (childElement as any).props.id\n : undefined;\n\n const renderTrigger = useCallback(\n (renderProps: unknown) => {\n // Base UI's trigger props include `type=\"button\"` by default.\n // If we render into a non-<button> element, that prop is invalid and can warn.\n const resolvedProps = (() => {\n if (isNativeButtonTriggerElement) return renderProps as any;\n // eslint-disable-next-line unused-imports/no-unused-vars\n const { type, ref: triggerRef, ...triggerRest } = renderProps as any;\n return triggerRest;\n })();\n\n const childProps = (childElement as any).props;\n const mergedProps = mergeProps(restProps, childProps, resolvedProps);\n const shouldPreservePopupTriggerId =\n childProps['aria-haspopup'] !== undefined && childProps.id !== undefined;\n\n return cloneElement(childElement as any, {\n ...mergedProps,\n id: shouldPreservePopupTriggerId ? childProps.id : mergedProps.id,\n ref: mergeRefs([(childElement as any).ref, (renderProps as any).ref, refProp]),\n });\n },\n [childElement, isNativeButtonTriggerElement, refProp, restProps],\n );\n\n // Don't render trigger behavior if no content\n\n if (item.title == null && !item.hotkey) {\n return children as any;\n }\n\n const triggerProps = {\n closeDelay: resolvedCloseDelay,\n delay: resolvedOpenDelay,\n disabled,\n ...item.triggerProps,\n id: popupTriggerId ?? item.triggerProps?.id,\n payload: item,\n };\n\n if (childElement) {\n return (\n <BaseTooltip.Trigger handle={group ?? undefined} {...triggerProps} render={renderTrigger} />\n );\n }\n\n return (\n <BaseTooltip.Trigger handle={group ?? undefined} {...triggerProps} ref={refProp}>\n {children}\n </BaseTooltip.Trigger>\n );\n};\n\nTooltipInGroup.displayName = 'TooltipInGroup';\n"],"mappings":";;;;;;;;;;AAaA,MAAM,qBAAqB;AAC3B,MAAM,sBAAsB;AAE5B,MAAa,kBAAoC,EAC/C,UACA,KAAK,SACL,OACA,WACA,YACA,YACA,aACA,UAAU,cACV,mBACA,QACA,aACA,iBACA,iBACA,cACA,MACA,WACA,WACA,gBACA,YACA,aACA,iBACA,YAAY,aACZ,QACA,OACA,cAAc,kBACd,QACA,GAAG,gBACC;CACJ,MAAM,eAAe,eACZ;EACL;EACA;EACA;EACA;EACA;EACA,UAAU;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,cAAc;EACd;EACD,GACD;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;E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AS,QAAQ,CAAC,KAAK,OAC9B,QAAO;CAGT,MAAM,eAAe;EACnB,YAAY;EACZ,OAAO;EACP;EACA,GAAG,KAAK;EACR,IAAI,kBAAkB,KAAK,cAAc;EACzC,SAAS;EACV;AAED,KAAI,aACF,QACE,oBAACA,QAAY,SAAb;EAAqB,QAAQ,SAAS,KAAA;EAAW,GAAI;EAAc,QAAQ;EAAiB,CAAA;AAIhG,QACE,oBAACA,QAAY,SAAb;EAAqB,QAAQ,SAAS,KAAA;EAAW,GAAI;EAAc,KAAK;EACrE;EACmB,CAAA;;AAI1B,eAAe,cAAc"}
|
|
@@ -78,11 +78,13 @@ const TooltipStandalone = memo(({ children, title, arrow = false, className, cla
|
|
|
78
78
|
viewport: resolvedStyleProps?.content
|
|
79
79
|
}), [resolvedStyleProps, zIndex]);
|
|
80
80
|
const triggerElement = useMemo(() => {
|
|
81
|
+
const popupTriggerId = isValidElement(children) && children.props["aria-haspopup"] !== void 0 && children.props.id !== void 0 ? children.props.id : void 0;
|
|
81
82
|
const baseTriggerProps = {
|
|
82
83
|
closeDelay: resolvedCloseDelay,
|
|
83
84
|
delay: resolvedOpenDelay,
|
|
84
85
|
disabled,
|
|
85
|
-
...triggerProps
|
|
86
|
+
...triggerProps,
|
|
87
|
+
id: popupTriggerId ?? triggerProps?.id
|
|
86
88
|
};
|
|
87
89
|
if (isValidElement(children)) return /* @__PURE__ */ jsx(Tooltip.Trigger, {
|
|
88
90
|
...baseTriggerProps,
|
|
@@ -92,8 +94,12 @@ const TooltipStandalone = memo(({ children, title, arrow = false, className, cla
|
|
|
92
94
|
const { type, ref: triggerRef, ...triggerRest } = props;
|
|
93
95
|
return triggerRest;
|
|
94
96
|
})();
|
|
97
|
+
const childProps = children.props;
|
|
98
|
+
const mergedProps = mergeProps(restProps, childProps, resolvedProps);
|
|
99
|
+
const shouldPreservePopupTriggerId = childProps["aria-haspopup"] !== void 0 && childProps.id !== void 0;
|
|
95
100
|
return cloneElement(children, {
|
|
96
|
-
...
|
|
101
|
+
...mergedProps,
|
|
102
|
+
id: shouldPreservePopupTriggerId ? childProps.id : mergedProps.id,
|
|
97
103
|
ref: mergeRefs([
|
|
98
104
|
children.ref,
|
|
99
105
|
props.ref,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TooltipStandalone.mjs","names":["BaseTooltip"],"sources":["../../src/Tooltip/TooltipStandalone.tsx"],"sourcesContent":["'use client';\n\nimport { mergeProps } from '@base-ui/react/merge-props';\nimport { Tooltip as BaseTooltip } from '@base-ui/react/tooltip';\nimport { cx } from 'antd-style';\nimport { cloneElement, isValidElement, memo, useCallback, useMemo, useState } from 'react';\nimport { mergeRefs } from 'react-merge-refs';\n\nimport { useFloatingLayer } from '@/hooks/useFloatingLayer';\nimport { useIsClient } from '@/hooks/useIsClient';\nimport { useNativeButton } from '@/hooks/useNativeButton';\nimport { useAppElement } from '@/ThemeProvider';\nimport { placementMap } from '@/utils/placement';\n\nimport { TooltipArrowIcon } from './ArrowIcon';\nimport { styles } from './style';\nimport TooltipContent from './TooltipContent';\nimport { type TooltipProps } from './type';\n\nconst DEFAULT_OPEN_DELAY = 400;\nconst DEFAULT_CLOSE_DELAY = 100;\n\n/**\n * Tooltip component - displays small contextual hints on hover/focus\n * Compatible with Ant Design Tooltip-like API (subset)\n */\nexport const TooltipStandalone = memo<TooltipProps>(\n ({\n children,\n title,\n arrow = false,\n className,\n classNames,\n closeDelay,\n defaultOpen = false,\n disabled = false,\n getPopupContainer,\n hotkey,\n hotkeyProps,\n mouseEnterDelay,\n mouseLeaveDelay,\n onOpenChange,\n open,\n openDelay,\n placement = 'top',\n popupContainer,\n styles: styleProps,\n zIndex,\n ref: refProp,\n positionerProps,\n triggerProps,\n popupProps,\n portalProps,\n standalone: _standalone,\n ...restProps\n }) => {\n const isClient = useIsClient();\n const [uncontrolledOpen, setUncontrolledOpen] = useState(Boolean(defaultOpen));\n const [triggerNode, setTriggerNode] = useState<HTMLElement | null>(null);\n const triggerCallbackRef = useCallback((node: HTMLElement | null) => {\n if (node) setTriggerNode(node);\n }, []);\n\n const mergedOpen = open ?? uncontrolledOpen;\n const resolvedOpen = disabled ? false : mergedOpen;\n\n const handleOpenChange = useCallback(\n (nextOpen: boolean) => {\n if (disabled && nextOpen) return;\n onOpenChange?.(nextOpen);\n if (open === undefined) {\n setUncontrolledOpen(nextOpen);\n }\n },\n [disabled, onOpenChange, open],\n );\n\n const resolvedOpenDelay = useMemo(() => {\n if (openDelay !== undefined) return openDelay;\n if (mouseEnterDelay !== undefined) return mouseEnterDelay * 1000;\n return DEFAULT_OPEN_DELAY;\n }, [mouseEnterDelay, openDelay]);\n\n const resolvedCloseDelay = useMemo(() => {\n if (closeDelay !== undefined) return closeDelay;\n if (mouseLeaveDelay !== undefined) return mouseLeaveDelay * 1000;\n return DEFAULT_CLOSE_DELAY;\n }, [closeDelay, mouseLeaveDelay]);\n\n const placementConfig = placementMap[placement] ?? placementMap.top;\n const baseSideOffset = arrow ? 8 : 6;\n\n const appElement = useAppElement();\n const floatingLayerContainer = useFloatingLayer();\n const portalContainer = floatingLayerContainer ?? appElement;\n\n const { isNativeButtonTriggerElement } = useNativeButton({\n children,\n });\n\n const resolvedClassNames = useMemo(\n () => ({\n arrow: cx(styles.arrow, classNames?.arrow),\n popup: cx(styles.popup, className, classNames?.root, classNames?.container),\n positioner: styles.positioner,\n viewport: cx(styles.viewport, classNames?.content),\n }),\n [className, classNames?.arrow, classNames?.container, classNames?.content, classNames?.root],\n );\n\n const resolvedStyleProps = useMemo(() => {\n if (typeof styleProps === 'function') return undefined;\n return styleProps;\n }, [styleProps]);\n\n const resolvedStyles = useMemo(\n () => ({\n arrow: resolvedStyleProps?.arrow,\n popup: {\n ...resolvedStyleProps?.root,\n ...resolvedStyleProps?.container,\n },\n positioner: {\n zIndex: zIndex ?? 114_514,\n },\n viewport: resolvedStyleProps?.content,\n }),\n [resolvedStyleProps, zIndex],\n );\n\n const triggerElement = useMemo(() => {\n const baseTriggerProps = {\n closeDelay: resolvedCloseDelay,\n delay: resolvedOpenDelay,\n disabled,\n ...triggerProps,\n };\n\n if (isValidElement(children)) {\n return (\n <BaseTooltip.Trigger\n {...baseTriggerProps}\n render={(props) => {\n // Base UI's trigger props include `type=\"button\"` by default.\n // If we render into a non-<button> element, that prop is invalid and can warn.\n const resolvedProps = (() => {\n if (isNativeButtonTriggerElement) return props as any;\n // eslint-disable-next-line unused-imports/no-unused-vars\n const { type, ref: triggerRef, ...triggerRest } = props as any;\n return triggerRest;\n })();\n\n const mergedProps = mergeProps(restProps, (children as any).props, resolvedProps);\n return cloneElement(children as any, {\n ...mergedProps,\n ref: mergeRefs([\n (children as any).ref,\n (props as any).ref,\n refProp,\n triggerCallbackRef,\n ]),\n });\n }}\n />\n );\n }\n\n return (\n <BaseTooltip.Trigger {...baseTriggerProps} ref={mergeRefs([refProp, triggerCallbackRef])}>\n {children}\n </BaseTooltip.Trigger>\n );\n }, [\n children,\n disabled,\n isNativeButtonTriggerElement,\n refProp,\n resolvedCloseDelay,\n resolvedOpenDelay,\n restProps,\n triggerCallbackRef,\n triggerProps,\n ]);\n\n const customContainer = useMemo(() => {\n if (popupContainer) return popupContainer;\n if (!getPopupContainer || !isClient || !triggerNode) return undefined;\n return getPopupContainer(triggerNode);\n }, [popupContainer, getPopupContainer, isClient, triggerNode]);\n\n const popup = useMemo(\n () => (\n <BaseTooltip.Positioner\n align={placementConfig.align}\n className={resolvedClassNames.positioner}\n data-placement={placement}\n side={placementConfig.side}\n sideOffset={baseSideOffset}\n style={resolvedStyles.positioner}\n {...positionerProps}\n >\n <BaseTooltip.Popup\n className={resolvedClassNames.popup}\n style={resolvedStyles.popup}\n {...popupProps}\n >\n {arrow && (\n <BaseTooltip.Arrow className={resolvedClassNames.arrow} style={resolvedStyles.arrow}>\n {TooltipArrowIcon}\n </BaseTooltip.Arrow>\n )}\n <div className={resolvedClassNames.viewport} style={resolvedStyles.viewport}>\n <TooltipContent hotkey={hotkey} hotkeyProps={hotkeyProps} title={title} />\n </div>\n </BaseTooltip.Popup>\n </BaseTooltip.Positioner>\n ),\n [\n arrow,\n baseSideOffset,\n hotkey,\n hotkeyProps,\n placement,\n placementConfig.align,\n placementConfig.side,\n popupProps,\n positionerProps,\n resolvedClassNames,\n resolvedStyles,\n title,\n ],\n );\n\n if (title == null && !hotkey) {\n return children;\n }\n\n const resolvedPortalContainer = customContainer ?? portalContainer;\n\n return (\n <BaseTooltip.Root\n defaultOpen={defaultOpen}\n disabled={disabled}\n open={resolvedOpen}\n onOpenChange={handleOpenChange}\n >\n {triggerElement}\n {resolvedPortalContainer ? (\n <BaseTooltip.Portal container={resolvedPortalContainer} {...portalProps}>\n {popup}\n </BaseTooltip.Portal>\n ) : null}\n </BaseTooltip.Root>\n );\n },\n);\n\nTooltipStandalone.displayName = 'TooltipStandalone';\n"],"mappings":";;;;;;;;;;;;;;;;AAmBA,MAAM,qBAAqB;AAC3B,MAAM,sBAAsB;;;;;AAM5B,MAAa,oBAAoB,MAC9B,EACC,UACA,OACA,QAAQ,OACR,WACA,YACA,YACA,cAAc,OACd,WAAW,OACX,mBACA,QACA,aACA,iBACA,iBACA,cACA,MACA,WACA,YAAY,OACZ,gBACA,QAAQ,YACR,QACA,KAAK,SACL,iBACA,cACA,YACA,aACA,YAAY,aACZ,GAAG,gBACC;CACJ,MAAM,WAAW,aAAa;CAC9B,MAAM,CAAC,kBAAkB,uBAAuB,SAAS,QAAQ,YAAY,CAAC;CAC9E,MAAM,CAAC,aAAa,kBAAkB,SAA6B,KAAK;CACxE,MAAM,qBAAqB,aAAa,SAA6B;AACnE,MAAI,KAAM,gBAAe,KAAK;IAC7B,EAAE,CAAC;CAGN,MAAM,eAAe,WAAW,QADb,QAAQ;CAG3B,MAAM,mBAAmB,aACtB,aAAsB;AACrB,MAAI,YAAY,SAAU;AAC1B,iBAAe,SAAS;AACxB,MAAI,SAAS,KAAA,EACX,qBAAoB,SAAS;IAGjC;EAAC;EAAU;EAAc;EAAK,CAC/B;CAED,MA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OACpB,QAAO;CAGT,MAAM,0BAA0B,mBAAmB;AAEnD,QACE,qBAACA,QAAY,MAAb;EACe;EACH;EACV,MAAM;EACN,cAAc;YAJhB,CAMG,gBACA,0BACC,oBAACA,QAAY,QAAb;GAAoB,WAAW;GAAyB,GAAI;aACzD;GACkB,CAAA,GACnB,KACa;;EAGxB;AAED,kBAAkB,cAAc"}
|
|
1
|
+
{"version":3,"file":"TooltipStandalone.mjs","names":["BaseTooltip"],"sources":["../../src/Tooltip/TooltipStandalone.tsx"],"sourcesContent":["'use client';\n\nimport { mergeProps } from '@base-ui/react/merge-props';\nimport { Tooltip as BaseTooltip } from '@base-ui/react/tooltip';\nimport { cx } from 'antd-style';\nimport { cloneElement, isValidElement, memo, useCallback, useMemo, useState } from 'react';\nimport { mergeRefs } from 'react-merge-refs';\n\nimport { useFloatingLayer } from '@/hooks/useFloatingLayer';\nimport { useIsClient } from '@/hooks/useIsClient';\nimport { useNativeButton } from '@/hooks/useNativeButton';\nimport { useAppElement } from '@/ThemeProvider';\nimport { placementMap } from '@/utils/placement';\n\nimport { TooltipArrowIcon } from './ArrowIcon';\nimport { styles } from './style';\nimport TooltipContent from './TooltipContent';\nimport { type TooltipProps } from './type';\n\nconst DEFAULT_OPEN_DELAY = 400;\nconst DEFAULT_CLOSE_DELAY = 100;\n\n/**\n * Tooltip component - displays small contextual hints on hover/focus\n * Compatible with Ant Design Tooltip-like API (subset)\n */\nexport const TooltipStandalone = memo<TooltipProps>(\n ({\n children,\n title,\n arrow = false,\n className,\n classNames,\n closeDelay,\n defaultOpen = false,\n disabled = false,\n getPopupContainer,\n hotkey,\n hotkeyProps,\n mouseEnterDelay,\n mouseLeaveDelay,\n onOpenChange,\n open,\n openDelay,\n placement = 'top',\n popupContainer,\n styles: styleProps,\n zIndex,\n ref: refProp,\n positionerProps,\n triggerProps,\n popupProps,\n portalProps,\n standalone: _standalone,\n ...restProps\n }) => {\n const isClient = useIsClient();\n const [uncontrolledOpen, setUncontrolledOpen] = useState(Boolean(defaultOpen));\n const [triggerNode, setTriggerNode] = useState<HTMLElement | null>(null);\n const triggerCallbackRef = useCallback((node: HTMLElement | null) => {\n if (node) setTriggerNode(node);\n }, []);\n\n const mergedOpen = open ?? uncontrolledOpen;\n const resolvedOpen = disabled ? false : mergedOpen;\n\n const handleOpenChange = useCallback(\n (nextOpen: boolean) => {\n if (disabled && nextOpen) return;\n onOpenChange?.(nextOpen);\n if (open === undefined) {\n setUncontrolledOpen(nextOpen);\n }\n },\n [disabled, onOpenChange, open],\n );\n\n const resolvedOpenDelay = useMemo(() => {\n if (openDelay !== undefined) return openDelay;\n if (mouseEnterDelay !== undefined) return mouseEnterDelay * 1000;\n return DEFAULT_OPEN_DELAY;\n }, [mouseEnterDelay, openDelay]);\n\n const resolvedCloseDelay = useMemo(() => {\n if (closeDelay !== undefined) return closeDelay;\n if (mouseLeaveDelay !== undefined) return mouseLeaveDelay * 1000;\n return DEFAULT_CLOSE_DELAY;\n }, [closeDelay, mouseLeaveDelay]);\n\n const placementConfig = placementMap[placement] ?? placementMap.top;\n const baseSideOffset = arrow ? 8 : 6;\n\n const appElement = useAppElement();\n const floatingLayerContainer = useFloatingLayer();\n const portalContainer = floatingLayerContainer ?? appElement;\n\n const { isNativeButtonTriggerElement } = useNativeButton({\n children,\n });\n\n const resolvedClassNames = useMemo(\n () => ({\n arrow: cx(styles.arrow, classNames?.arrow),\n popup: cx(styles.popup, className, classNames?.root, classNames?.container),\n positioner: styles.positioner,\n viewport: cx(styles.viewport, classNames?.content),\n }),\n [className, classNames?.arrow, classNames?.container, classNames?.content, classNames?.root],\n );\n\n const resolvedStyleProps = useMemo(() => {\n if (typeof styleProps === 'function') return undefined;\n return styleProps;\n }, [styleProps]);\n\n const resolvedStyles = useMemo(\n () => ({\n arrow: resolvedStyleProps?.arrow,\n popup: {\n ...resolvedStyleProps?.root,\n ...resolvedStyleProps?.container,\n },\n positioner: {\n zIndex: zIndex ?? 114_514,\n },\n viewport: resolvedStyleProps?.content,\n }),\n [resolvedStyleProps, zIndex],\n );\n\n const triggerElement = useMemo(() => {\n const popupTriggerId =\n isValidElement(children) &&\n (children as any).props['aria-haspopup'] !== undefined &&\n (children as any).props.id !== undefined\n ? (children as any).props.id\n : undefined;\n\n const baseTriggerProps = {\n closeDelay: resolvedCloseDelay,\n delay: resolvedOpenDelay,\n disabled,\n ...triggerProps,\n id: popupTriggerId ?? triggerProps?.id,\n };\n\n if (isValidElement(children)) {\n return (\n <BaseTooltip.Trigger\n {...baseTriggerProps}\n render={(props) => {\n // Base UI's trigger props include `type=\"button\"` by default.\n // If we render into a non-<button> element, that prop is invalid and can warn.\n const resolvedProps = (() => {\n if (isNativeButtonTriggerElement) return props as any;\n // eslint-disable-next-line unused-imports/no-unused-vars\n const { type, ref: triggerRef, ...triggerRest } = props as any;\n return triggerRest;\n })();\n\n const childProps = (children as any).props;\n const mergedProps = mergeProps(restProps, childProps, resolvedProps);\n const shouldPreservePopupTriggerId =\n childProps['aria-haspopup'] !== undefined && childProps.id !== undefined;\n\n return cloneElement(children as any, {\n ...mergedProps,\n id: shouldPreservePopupTriggerId ? childProps.id : mergedProps.id,\n ref: mergeRefs([\n (children as any).ref,\n (props as any).ref,\n refProp,\n triggerCallbackRef,\n ]),\n });\n }}\n />\n );\n }\n\n return (\n <BaseTooltip.Trigger {...baseTriggerProps} ref={mergeRefs([refProp, triggerCallbackRef])}>\n {children}\n </BaseTooltip.Trigger>\n );\n }, [\n children,\n disabled,\n isNativeButtonTriggerElement,\n refProp,\n resolvedCloseDelay,\n resolvedOpenDelay,\n restProps,\n triggerCallbackRef,\n triggerProps,\n ]);\n\n const customContainer = useMemo(() => {\n if (popupContainer) return popupContainer;\n if (!getPopupContainer || !isClient || !triggerNode) return undefined;\n return getPopupContainer(triggerNode);\n }, [popupContainer, getPopupContainer, isClient, triggerNode]);\n\n const popup = useMemo(\n () => (\n <BaseTooltip.Positioner\n align={placementConfig.align}\n className={resolvedClassNames.positioner}\n data-placement={placement}\n side={placementConfig.side}\n sideOffset={baseSideOffset}\n style={resolvedStyles.positioner}\n {...positionerProps}\n >\n <BaseTooltip.Popup\n className={resolvedClassNames.popup}\n style={resolvedStyles.popup}\n {...popupProps}\n >\n {arrow && (\n <BaseTooltip.Arrow className={resolvedClassNames.arrow} style={resolvedStyles.arrow}>\n {TooltipArrowIcon}\n </BaseTooltip.Arrow>\n )}\n <div className={resolvedClassNames.viewport} style={resolvedStyles.viewport}>\n <TooltipContent hotkey={hotkey} hotkeyProps={hotkeyProps} title={title} />\n </div>\n </BaseTooltip.Popup>\n </BaseTooltip.Positioner>\n ),\n [\n arrow,\n baseSideOffset,\n hotkey,\n hotkeyProps,\n placement,\n placementConfig.align,\n placementConfig.side,\n popupProps,\n positionerProps,\n resolvedClassNames,\n resolvedStyles,\n title,\n ],\n );\n\n if (title == null && !hotkey) {\n return children;\n }\n\n const resolvedPortalContainer = customContainer ?? portalContainer;\n\n return (\n <BaseTooltip.Root\n defaultOpen={defaultOpen}\n disabled={disabled}\n open={resolvedOpen}\n onOpenChange={handleOpenChange}\n >\n {triggerElement}\n {resolvedPortalContainer ? (\n <BaseTooltip.Portal container={resolvedPortalContainer} {...portalProps}>\n {popup}\n </BaseTooltip.Portal>\n ) : null}\n </BaseTooltip.Root>\n );\n },\n);\n\nTooltipStandalone.displayName = 'TooltipStandalone';\n"],"mappings":";;;;;;;;;;;;;;;;AAmBA,MAAM,qBAAqB;AAC3B,MAAM,sBAAsB;;;;;AAM5B,MAAa,oBAAoB,MAC9B,EACC,UACA,OACA,QAAQ,OACR,WACA,YACA,YACA,cAAc,OACd,WAAW,OACX,mBACA,QACA,aACA,iBACA,iBACA,cACA,MACA,WACA,YAAY,OACZ,gBACA,QAAQ,YACR,QACA,KAAK,SACL,iBACA,cACA,YACA,aACA,YAAY,aACZ,GAAG,gBACC;CACJ,MAAM,WAAW,aAAa;CAC9B,MAAM,CAAC,kBAAkB,uBAAuB,SAAS,QAAQ,YAAY,CAAC;CAC9E,MAAM,CAAC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AY,CAAC;CAE9D,MAAM,QAAQ,cAEV,oBAACA,QAAY,YAAb;EACE,OAAO,gBAAgB;EACvB,WAAW,mBAAmB;EAC9B,kBAAgB;EAChB,MAAM,gBAAgB;EACtB,YAAY;EACZ,OAAO,eAAe;EACtB,GAAI;YAEJ,qBAACA,QAAY,OAAb;GACE,WAAW,mBAAmB;GAC9B,OAAO,eAAe;GACtB,GAAI;aAHN,CAKG,SACC,oBAACA,QAAY,OAAb;IAAmB,WAAW,mBAAmB;IAAO,OAAO,eAAe;cAC3E;IACiB,CAAA,EAEtB,oBAAC,OAAD;IAAK,WAAW,mBAAmB;IAAU,OAAO,eAAe;cACjE,oBAAC,gBAAD;KAAwB;KAAqB;KAAoB;KAAS,CAAA;IACtE,CAAA,CACY;;EACG,CAAA,EAE3B;EACE;EACA;EACA;EACA;EACA;EACA,gBAAgB;EAChB,gBAAgB;EAChB;EACA;EACA;EACA;EACA;EACD,CACF;AAED,KAAI,SAAS,QAAQ,CAAC,OACpB,QAAO;CAGT,MAAM,0BAA0B,mBAAmB;AAEnD,QACE,qBAACA,QAAY,MAAb;EACe;EACH;EACV,MAAM;EACN,cAAc;YAJhB,CAMG,gBACA,0BACC,oBAACA,QAAY,QAAb;GAAoB,WAAW;GAAyB,GAAI;aACzD;GACkB,CAAA,GACnB,KACa;;EAGxB;AAED,kBAAkB,cAAc"}
|
|
@@ -8,7 +8,8 @@ import { registerDevSingleton } from "../../utils/devSingleton.mjs";
|
|
|
8
8
|
import { renderContextMenuItems } from "./renderItems.mjs";
|
|
9
9
|
import { closeContextMenu, getServerSnapshot, getSnapshot, setContextMenuState, subscribe, updateLastPointer } from "./store.mjs";
|
|
10
10
|
import { memo, useEffect, useMemo, useSyncExternalStore } from "react";
|
|
11
|
-
import { jsx } from "react/jsx-runtime";
|
|
11
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
import { cx } from "antd-style";
|
|
12
13
|
import { ContextMenu } from "@base-ui/react/context-menu";
|
|
13
14
|
//#region src/base-ui/ContextMenu/ContextMenuHost.tsx
|
|
14
15
|
const noAnimationStyles = { "--lobe-dropdown-animation-duration": "0ms" };
|
|
@@ -39,6 +40,7 @@ const ContextMenuHost = memo(() => {
|
|
|
39
40
|
state.iconSpaceMode
|
|
40
41
|
]);
|
|
41
42
|
const { zIndex, ref: zRef } = useLayerZIndex("floating");
|
|
43
|
+
const hasSlots = state.header != null || state.footer != null;
|
|
42
44
|
if (!isClient) return null;
|
|
43
45
|
if (!state.open && state.items.length === 0) return null;
|
|
44
46
|
return /* @__PURE__ */ jsx(ContextMenu.Root, {
|
|
@@ -61,10 +63,23 @@ const ContextMenuHost = memo(() => {
|
|
|
61
63
|
...noAnimationStyles,
|
|
62
64
|
zIndex
|
|
63
65
|
},
|
|
64
|
-
children: /* @__PURE__ */
|
|
65
|
-
className: styles.popup,
|
|
66
|
+
children: /* @__PURE__ */ jsxs(ContextMenu.Popup, {
|
|
67
|
+
className: cx(styles.popup, hasSlots && styles.popupWithSlots),
|
|
66
68
|
onContextMenu: preventDefaultAndStopPropagation,
|
|
67
|
-
children:
|
|
69
|
+
children: [
|
|
70
|
+
state.header == null ? null : /* @__PURE__ */ jsx("div", {
|
|
71
|
+
className: styles.header,
|
|
72
|
+
children: state.header
|
|
73
|
+
}),
|
|
74
|
+
hasSlots ? /* @__PURE__ */ jsx("div", {
|
|
75
|
+
className: styles.slotViewport,
|
|
76
|
+
children: menuItems
|
|
77
|
+
}) : menuItems,
|
|
78
|
+
state.footer == null ? null : /* @__PURE__ */ jsx("div", {
|
|
79
|
+
className: styles.footer,
|
|
80
|
+
children: state.footer
|
|
81
|
+
})
|
|
82
|
+
]
|
|
68
83
|
})
|
|
69
84
|
})
|
|
70
85
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextMenuHost.mjs","names":[],"sources":["../../../src/base-ui/ContextMenu/ContextMenuHost.tsx"],"sourcesContent":["'use client';\n\nimport { ContextMenu } from '@base-ui/react/context-menu';\nimport { memo, useEffect, useMemo, useSyncExternalStore } from 'react';\n\nimport { useIsClient } from '@/hooks/useIsClient';\nimport { useAppElement } from '@/ThemeProvider';\nimport { registerDevSingleton } from '@/utils/devSingleton';\nimport { preventDefaultAndStopPropagation } from '@/utils/dom';\n\nimport { useLayerZIndex } from '../zIndex';\nimport { renderContextMenuItems } from './renderItems';\nimport {\n closeContextMenu,\n getServerSnapshot,\n getSnapshot,\n setContextMenuState,\n subscribe,\n updateLastPointer,\n} from './store';\nimport { styles } from './style';\n\nconst noAnimationStyles = { '--lobe-dropdown-animation-duration': '0ms' } as React.CSSProperties;\n\nexport const ContextMenuHost = memo(() => {\n const isClient = useIsClient();\n const appElement = useAppElement();\n const state = useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);\n\n useEffect(() => {\n const DEV = process.env.NODE_ENV === 'development';\n if (!isClient || !DEV) return;\n return registerDevSingleton('ContextMenuHost', document.body);\n }, [isClient]);\n\n useEffect(() => {\n const handler = (event: MouseEvent | PointerEvent) => updateLastPointer(event);\n window.addEventListener('pointerdown', handler, true);\n window.addEventListener('contextmenu', handler, true);\n return () => {\n window.removeEventListener('pointerdown', handler, true);\n window.removeEventListener('contextmenu', handler, true);\n };\n }, []);\n\n const menuItems = useMemo(\n () =>\n renderContextMenuItems(state.items, [], {\n iconAlign: state.iconAlign,\n iconSpaceMode: state.iconSpaceMode,\n }),\n [state.items, state.iconAlign, state.iconSpaceMode],\n );\n const { zIndex, ref: zRef } = useLayerZIndex<HTMLDivElement>('floating');\n if (!isClient) return null;\n if (!state.open && state.items.length === 0) return null;\n\n return (\n <ContextMenu.Root\n open={state.open}\n onOpenChange={(open) => {\n if (open) {\n setContextMenuState({ open });\n return;\n }\n closeContextMenu();\n }}\n >\n <ContextMenu.Portal container={appElement}>\n <ContextMenu.Positioner\n anchor={state.anchor ?? undefined}\n className={styles.positioner}\n ref={zRef as any}\n sideOffset={6}\n style={{ ...noAnimationStyles, zIndex }}\n >\n <ContextMenu.Popup\n className={styles.popup}\n onContextMenu={preventDefaultAndStopPropagation}\n >\n {menuItems}\n </ContextMenu.Popup>\n </ContextMenu.Positioner>\n </ContextMenu.Portal>\n </ContextMenu.Root>\n );\n});\n\nContextMenuHost.displayName = 'ContextMenuHost';\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ContextMenuHost.mjs","names":[],"sources":["../../../src/base-ui/ContextMenu/ContextMenuHost.tsx"],"sourcesContent":["'use client';\n\nimport { ContextMenu } from '@base-ui/react/context-menu';\nimport { cx } from 'antd-style';\nimport { memo, useEffect, useMemo, useSyncExternalStore } from 'react';\n\nimport { useIsClient } from '@/hooks/useIsClient';\nimport { useAppElement } from '@/ThemeProvider';\nimport { registerDevSingleton } from '@/utils/devSingleton';\nimport { preventDefaultAndStopPropagation } from '@/utils/dom';\n\nimport { useLayerZIndex } from '../zIndex';\nimport { renderContextMenuItems } from './renderItems';\nimport {\n closeContextMenu,\n getServerSnapshot,\n getSnapshot,\n setContextMenuState,\n subscribe,\n updateLastPointer,\n} from './store';\nimport { styles } from './style';\n\nconst noAnimationStyles = { '--lobe-dropdown-animation-duration': '0ms' } as React.CSSProperties;\n\nexport const ContextMenuHost = memo(() => {\n const isClient = useIsClient();\n const appElement = useAppElement();\n const state = useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);\n\n useEffect(() => {\n const DEV = process.env.NODE_ENV === 'development';\n if (!isClient || !DEV) return;\n return registerDevSingleton('ContextMenuHost', document.body);\n }, [isClient]);\n\n useEffect(() => {\n const handler = (event: MouseEvent | PointerEvent) => updateLastPointer(event);\n window.addEventListener('pointerdown', handler, true);\n window.addEventListener('contextmenu', handler, true);\n return () => {\n window.removeEventListener('pointerdown', handler, true);\n window.removeEventListener('contextmenu', handler, true);\n };\n }, []);\n\n const menuItems = useMemo(\n () =>\n renderContextMenuItems(state.items, [], {\n iconAlign: state.iconAlign,\n iconSpaceMode: state.iconSpaceMode,\n }),\n [state.items, state.iconAlign, state.iconSpaceMode],\n );\n const { zIndex, ref: zRef } = useLayerZIndex<HTMLDivElement>('floating');\n const hasSlots = state.header != null || state.footer != null;\n if (!isClient) return null;\n if (!state.open && state.items.length === 0) return null;\n\n return (\n <ContextMenu.Root\n open={state.open}\n onOpenChange={(open) => {\n if (open) {\n setContextMenuState({ open });\n return;\n }\n closeContextMenu();\n }}\n >\n <ContextMenu.Portal container={appElement}>\n <ContextMenu.Positioner\n anchor={state.anchor ?? undefined}\n className={styles.positioner}\n ref={zRef as any}\n sideOffset={6}\n style={{ ...noAnimationStyles, zIndex }}\n >\n <ContextMenu.Popup\n className={cx(styles.popup, hasSlots && styles.popupWithSlots)}\n onContextMenu={preventDefaultAndStopPropagation}\n >\n {state.header == null ? null : <div className={styles.header}>{state.header}</div>}\n {hasSlots ? <div className={styles.slotViewport}>{menuItems}</div> : menuItems}\n {state.footer == null ? null : <div className={styles.footer}>{state.footer}</div>}\n </ContextMenu.Popup>\n </ContextMenu.Positioner>\n </ContextMenu.Portal>\n </ContextMenu.Root>\n );\n});\n\nContextMenuHost.displayName = 'ContextMenuHost';\n"],"mappings":";;;;;;;;;;;;;;AAuBA,MAAM,oBAAoB,EAAE,sCAAsC,OAAO;AAEzE,MAAa,kBAAkB,WAAW;CACxC,MAAM,WAAW,aAAa;CAC9B,MAAM,aAAa,eAAe;CAClC,MAAM,QAAQ,qBAAqB,WAAW,aAAa,kBAAkB;AAE7E,iBAAgB;EACd,MAAM,MAAM,QAAQ,IAAI,aAAa;AACrC,MAAI,CAAC,YAAY,CAAC,IAAK;AACvB,SAAO,qBAAqB,mBAAmB,SAAS,KAAK;IAC5D,CAAC,SAAS,CAAC;AAEd,iBAAgB;EACd,MAAM,WAAW,UAAqC,kBAAkB,MAAM;AAC9E,SAAO,iBAAiB,eAAe,SAAS,KAAK;AACrD,SAAO,iBAAiB,eAAe,SAAS,KAAK;AACrD,eAAa;AACX,UAAO,oBAAoB,eAAe,SAAS,KAAK;AACxD,UAAO,oBAAoB,eAAe,SAAS,KAAK;;IAEzD,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|
6
6
|
children: ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* Footer slot pinned below the scrollable items area, with a divider border.
|
|
9
|
+
*/
|
|
10
|
+
footer?: ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* Header slot pinned above the scrollable items area, with a divider border.
|
|
13
|
+
*/
|
|
14
|
+
header?: ReactNode;
|
|
7
15
|
/**
|
|
8
16
|
* Menu items to display. Supports lazy rendering via function.
|
|
9
17
|
* When provided, context menu will be automatically shown on right-click.
|
|
@@ -7,17 +7,25 @@ import { mergeProps } from "@base-ui/react/merge-props";
|
|
|
7
7
|
import clsx from "clsx";
|
|
8
8
|
//#region src/base-ui/ContextMenu/ContextMenuTrigger.tsx
|
|
9
9
|
const styles = { trigger: { display: "contents" } };
|
|
10
|
-
const ContextMenuTrigger = memo(({ children, items, onContextMenu, ...rest }) => {
|
|
10
|
+
const ContextMenuTrigger = memo(({ children, footer, header, items, onContextMenu, ...rest }) => {
|
|
11
11
|
const triggerId = useId();
|
|
12
12
|
const state = useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
13
13
|
const open = state.open && state.triggerId === triggerId;
|
|
14
14
|
const handleContextMenu = useCallback((event) => {
|
|
15
15
|
if (items) {
|
|
16
16
|
event.preventDefault();
|
|
17
|
-
showContextMenu(typeof items === "function" ? items() : items
|
|
17
|
+
showContextMenu(typeof items === "function" ? items() : items, {
|
|
18
|
+
footer,
|
|
19
|
+
header
|
|
20
|
+
});
|
|
18
21
|
}
|
|
19
22
|
onContextMenu?.(event);
|
|
20
|
-
}, [
|
|
23
|
+
}, [
|
|
24
|
+
items,
|
|
25
|
+
onContextMenu,
|
|
26
|
+
footer,
|
|
27
|
+
header
|
|
28
|
+
]);
|
|
21
29
|
const triggerProps = {
|
|
22
30
|
...rest,
|
|
23
31
|
"aria-expanded": open || void 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextMenuTrigger.mjs","names":[],"sources":["../../../src/base-ui/ContextMenu/ContextMenuTrigger.tsx"],"sourcesContent":["'use client';\n\nimport { mergeProps } from '@base-ui/react/merge-props';\nimport clsx from 'clsx';\nimport React, {\n cloneElement,\n type HTMLAttributes,\n isValidElement,\n memo,\n type MouseEvent,\n type ReactNode,\n useCallback,\n useId,\n useSyncExternalStore,\n} from 'react';\n\nimport { CLASSNAMES } from '@/styles/classNames';\n\nimport { getServerSnapshot, getSnapshot, showContextMenu, subscribe } from './store';\nimport { type ContextMenuItem } from './type';\n\nexport type ContextMenuTriggerProps = {\n children: ReactNode;\n /**\n * Menu items to display. Supports lazy rendering via function.\n * When provided, context menu will be automatically shown on right-click.\n */\n items?: ContextMenuItem[] | (() => ContextMenuItem[]);\n /**\n * Custom context menu handler. If `items` is provided, this is optional.\n */\n onContextMenu?: (event: MouseEvent<HTMLElement>) => void;\n} & Omit<HTMLAttributes<HTMLElement>, 'onContextMenu' | 'children'>;\n\nconst styles = {\n trigger: {\n display: 'contents',\n },\n};\n\nexport const ContextMenuTrigger = memo<ContextMenuTriggerProps>(\n ({ children, items, onContextMenu, ...rest }) => {\n const triggerId = useId();\n const state = useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);\n const open = state.open && state.triggerId === triggerId;\n\n const handleContextMenu = useCallback(\n (event: MouseEvent<HTMLElement>) => {\n if (items) {\n event.preventDefault();\n const resolvedItems = typeof items === 'function' ? items() : items;\n showContextMenu(resolvedItems);\n }\n onContextMenu?.(event);\n },\n [items, onContextMenu],\n );\n\n const triggerProps = {\n ...rest,\n 'aria-expanded': open || undefined,\n 'className': clsx(CLASSNAMES.ContextTrigger, rest.className),\n 'data-contextmenu-trigger': triggerId,\n 'data-popup-open': open ? '' : undefined,\n 'data-state': open ? 'open' : undefined,\n 'onContextMenu': handleContextMenu,\n };\n\n if (isValidElement(children) && React.Children.only(children)) {\n return cloneElement(children, mergeProps(children.props as any, triggerProps));\n }\n\n return (\n <span style={styles.trigger} {...triggerProps}>\n {children}\n </span>\n );\n },\n);\n\nContextMenuTrigger.displayName = 'ContextMenuTrigger';\n"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"ContextMenuTrigger.mjs","names":[],"sources":["../../../src/base-ui/ContextMenu/ContextMenuTrigger.tsx"],"sourcesContent":["'use client';\n\nimport { mergeProps } from '@base-ui/react/merge-props';\nimport clsx from 'clsx';\nimport React, {\n cloneElement,\n type HTMLAttributes,\n isValidElement,\n memo,\n type MouseEvent,\n type ReactNode,\n useCallback,\n useId,\n useSyncExternalStore,\n} from 'react';\n\nimport { CLASSNAMES } from '@/styles/classNames';\n\nimport { getServerSnapshot, getSnapshot, showContextMenu, subscribe } from './store';\nimport { type ContextMenuItem } from './type';\n\nexport type ContextMenuTriggerProps = {\n children: ReactNode;\n /**\n * Footer slot pinned below the scrollable items area, with a divider border.\n */\n footer?: ReactNode;\n /**\n * Header slot pinned above the scrollable items area, with a divider border.\n */\n header?: ReactNode;\n /**\n * Menu items to display. Supports lazy rendering via function.\n * When provided, context menu will be automatically shown on right-click.\n */\n items?: ContextMenuItem[] | (() => ContextMenuItem[]);\n /**\n * Custom context menu handler. If `items` is provided, this is optional.\n */\n onContextMenu?: (event: MouseEvent<HTMLElement>) => void;\n} & Omit<HTMLAttributes<HTMLElement>, 'onContextMenu' | 'children'>;\n\nconst styles = {\n trigger: {\n display: 'contents',\n },\n};\n\nexport const ContextMenuTrigger = memo<ContextMenuTriggerProps>(\n ({ children, footer, header, items, onContextMenu, ...rest }) => {\n const triggerId = useId();\n const state = useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);\n const open = state.open && state.triggerId === triggerId;\n\n const handleContextMenu = useCallback(\n (event: MouseEvent<HTMLElement>) => {\n if (items) {\n event.preventDefault();\n const resolvedItems = typeof items === 'function' ? items() : items;\n showContextMenu(resolvedItems, { footer, header });\n }\n onContextMenu?.(event);\n },\n [items, onContextMenu, footer, header],\n );\n\n const triggerProps = {\n ...rest,\n 'aria-expanded': open || undefined,\n 'className': clsx(CLASSNAMES.ContextTrigger, rest.className),\n 'data-contextmenu-trigger': triggerId,\n 'data-popup-open': open ? '' : undefined,\n 'data-state': open ? 'open' : undefined,\n 'onContextMenu': handleContextMenu,\n };\n\n if (isValidElement(children) && React.Children.only(children)) {\n return cloneElement(children, mergeProps(children.props as any, triggerProps));\n }\n\n return (\n <span style={styles.trigger} {...triggerProps}>\n {children}\n </span>\n );\n },\n);\n\nContextMenuTrigger.displayName = 'ContextMenuTrigger';\n"],"mappings":";;;;;;;;AA0CA,MAAM,SAAS,EACb,SAAS,EACP,SAAS,YACV,EACF;AAED,MAAa,qBAAqB,MAC/B,EAAE,UAAU,QAAQ,QAAQ,OAAO,eAAe,GAAG,WAAW;CAC/D,MAAM,YAAY,OAAO;CACzB,MAAM,QAAQ,qBAAqB,WAAW,aAAa,kBAAkB;CAC7E,MAAM,OAAO,MAAM,QAAQ,MAAM,cAAc;CAE/C,MAAM,oBAAoB,aACvB,UAAmC;AAClC,MAAI,OAAO;AACT,SAAM,gBAAgB;AAEtB,mBADsB,OAAO,UAAU,aAAa,OAAO,GAAG,OAC/B;IAAE;IAAQ;IAAQ,CAAC;;AAEpD,kBAAgB,MAAM;IAExB;EAAC;EAAO;EAAe;EAAQ;EAAO,CACvC;CAED,MAAM,eAAe;EACnB,GAAG;EACH,iBAAiB,QAAQ,KAAA;EACzB,aAAa,KAAK,WAAW,gBAAgB,KAAK,UAAU;EAC5D,4BAA4B;EAC5B,mBAAmB,OAAO,KAAK,KAAA;EAC/B,cAAc,OAAO,SAAS,KAAA;EAC9B,iBAAiB;EAClB;AAED,KAAI,eAAe,SAAS,IAAI,MAAM,SAAS,KAAK,SAAS,CAC3D,QAAO,aAAa,UAAU,WAAW,SAAS,OAAc,aAAa,CAAC;AAGhF,QACE,oBAAC,QAAD;EAAM,OAAO,OAAO;EAAS,GAAI;EAC9B;EACI,CAAA;EAGZ;AAED,mBAAmB,cAAc"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { IconAlign, IconSpaceMode } from "../../Menu/renderUtils.mjs";
|
|
2
2
|
import { ContextMenuItem } from "./type.mjs";
|
|
3
|
+
import { ReactNode } from "react";
|
|
3
4
|
//#region src/base-ui/ContextMenu/store.d.ts
|
|
4
5
|
interface ShowContextMenuOptions {
|
|
6
|
+
footer?: ReactNode;
|
|
7
|
+
header?: ReactNode;
|
|
5
8
|
iconAlign?: IconAlign;
|
|
6
9
|
iconSpaceMode?: IconSpaceMode;
|
|
7
10
|
}
|
|
@@ -62,6 +62,8 @@ const showContextMenu = (items, options) => {
|
|
|
62
62
|
x: lastPointer.x,
|
|
63
63
|
y: lastPointer.y
|
|
64
64
|
} : fallbackPoint),
|
|
65
|
+
footer: options?.footer,
|
|
66
|
+
header: options?.header,
|
|
65
67
|
iconAlign: options?.iconAlign,
|
|
66
68
|
iconSpaceMode: options?.iconSpaceMode ?? "global",
|
|
67
69
|
items,
|
|
@@ -80,6 +82,8 @@ const updateContextMenuItems = (items) => {
|
|
|
80
82
|
const closeContextMenu = () => {
|
|
81
83
|
setContextMenuState({
|
|
82
84
|
anchor: null,
|
|
85
|
+
footer: void 0,
|
|
86
|
+
header: void 0,
|
|
83
87
|
iconSpaceMode: "global",
|
|
84
88
|
items: [],
|
|
85
89
|
open: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.mjs","names":[],"sources":["../../../src/base-ui/ContextMenu/store.ts"],"sourcesContent":["import type { VirtualElement } from '@floating-ui/react';\n\nimport type { IconAlign } from '@/Menu';\n\nimport type { IconSpaceMode } from './renderItems';\nimport type { ContextMenuItem } from './type';\n\nexport type ContextMenuState = {\n anchor: VirtualElement | null;\n iconAlign?: IconAlign;\n iconSpaceMode: IconSpaceMode;\n items: ContextMenuItem[];\n open: boolean;\n triggerId: string | null;\n};\n\nconst emptyState: ContextMenuState = {\n anchor: null,\n iconSpaceMode: 'global',\n items: [],\n open: false,\n triggerId: null,\n};\n\nlet contextMenuState: ContextMenuState = emptyState;\nconst listeners = new Set<() => void>();\nconst lastPointer = { ready: false, triggerId: null as string | null, x: 0, y: 0 };\n\nconst notify = () => {\n listeners.forEach((listener) => listener());\n};\n\nexport const subscribe = (listener: () => void) => {\n listeners.add(listener);\n return () => listeners.delete(listener);\n};\n\nexport const getSnapshot = () => contextMenuState;\nexport const getServerSnapshot = () => emptyState;\n\nexport const updateLastPointer = (event: MouseEvent | PointerEvent) => {\n lastPointer.x = event.clientX;\n lastPointer.y = event.clientY;\n lastPointer.ready = true;\n if (event.target instanceof Element) {\n const trigger = event.target.closest<HTMLElement>('[data-contextmenu-trigger]');\n lastPointer.triggerId = trigger?.dataset.contextmenuTrigger ?? null;\n } else {\n lastPointer.triggerId = null;\n }\n};\n\nconst createVirtualElement = (point: { x: number; y: number }): VirtualElement => ({\n contextElement: typeof document === 'undefined' ? undefined : document.body,\n getBoundingClientRect: () =>\n ({\n bottom: point.y,\n height: 0,\n left: point.x,\n right: point.x,\n toJSON: () => undefined,\n top: point.y,\n width: 0,\n x: point.x,\n y: point.y,\n }) as DOMRect,\n});\n\nexport const setContextMenuState = (next: Partial<ContextMenuState>) => {\n contextMenuState = { ...contextMenuState, ...next };\n notify();\n};\n\nexport interface ShowContextMenuOptions {\n iconAlign?: IconAlign;\n iconSpaceMode?: IconSpaceMode;\n}\n\nexport const showContextMenu = (items: ContextMenuItem[], options?: ShowContextMenuOptions) => {\n if (typeof window === 'undefined') return;\n\n const fallbackPoint = { x: window.innerWidth / 2, y: window.innerHeight / 2 };\n const point = lastPointer.ready ? { x: lastPointer.x, y: lastPointer.y } : fallbackPoint;\n\n setContextMenuState({\n anchor: createVirtualElement(point),\n iconAlign: options?.iconAlign,\n iconSpaceMode: options?.iconSpaceMode ?? 'global',\n items,\n open: true,\n triggerId: lastPointer.triggerId ?? null,\n });\n};\n\n/**\n * Update menu items while keeping current anchor/position.\n * Useful for interactive menu items (e.g. checkbox) to avoid re-positioning.\n */\nexport const updateContextMenuItems = (items: ContextMenuItem[]) => {\n if (typeof window === 'undefined') return;\n setContextMenuState({ items });\n};\n\nexport const closeContextMenu = () => {\n setContextMenuState({\n anchor: null,\n iconSpaceMode: 'global',\n items: [],\n open: false,\n triggerId: null,\n });\n};\n"],"mappings":";
|
|
1
|
+
{"version":3,"file":"store.mjs","names":[],"sources":["../../../src/base-ui/ContextMenu/store.ts"],"sourcesContent":["import type { VirtualElement } from '@floating-ui/react';\nimport type { ReactNode } from 'react';\n\nimport type { IconAlign } from '@/Menu';\n\nimport type { IconSpaceMode } from './renderItems';\nimport type { ContextMenuItem } from './type';\n\nexport type ContextMenuState = {\n anchor: VirtualElement | null;\n footer?: ReactNode;\n header?: ReactNode;\n iconAlign?: IconAlign;\n iconSpaceMode: IconSpaceMode;\n items: ContextMenuItem[];\n open: boolean;\n triggerId: string | null;\n};\n\nconst emptyState: ContextMenuState = {\n anchor: null,\n iconSpaceMode: 'global',\n items: [],\n open: false,\n triggerId: null,\n};\n\nlet contextMenuState: ContextMenuState = emptyState;\nconst listeners = new Set<() => void>();\nconst lastPointer = { ready: false, triggerId: null as string | null, x: 0, y: 0 };\n\nconst notify = () => {\n listeners.forEach((listener) => listener());\n};\n\nexport const subscribe = (listener: () => void) => {\n listeners.add(listener);\n return () => listeners.delete(listener);\n};\n\nexport const getSnapshot = () => contextMenuState;\nexport const getServerSnapshot = () => emptyState;\n\nexport const updateLastPointer = (event: MouseEvent | PointerEvent) => {\n lastPointer.x = event.clientX;\n lastPointer.y = event.clientY;\n lastPointer.ready = true;\n if (event.target instanceof Element) {\n const trigger = event.target.closest<HTMLElement>('[data-contextmenu-trigger]');\n lastPointer.triggerId = trigger?.dataset.contextmenuTrigger ?? null;\n } else {\n lastPointer.triggerId = null;\n }\n};\n\nconst createVirtualElement = (point: { x: number; y: number }): VirtualElement => ({\n contextElement: typeof document === 'undefined' ? undefined : document.body,\n getBoundingClientRect: () =>\n ({\n bottom: point.y,\n height: 0,\n left: point.x,\n right: point.x,\n toJSON: () => undefined,\n top: point.y,\n width: 0,\n x: point.x,\n y: point.y,\n }) as DOMRect,\n});\n\nexport const setContextMenuState = (next: Partial<ContextMenuState>) => {\n contextMenuState = { ...contextMenuState, ...next };\n notify();\n};\n\nexport interface ShowContextMenuOptions {\n footer?: ReactNode;\n header?: ReactNode;\n iconAlign?: IconAlign;\n iconSpaceMode?: IconSpaceMode;\n}\n\nexport const showContextMenu = (items: ContextMenuItem[], options?: ShowContextMenuOptions) => {\n if (typeof window === 'undefined') return;\n\n const fallbackPoint = { x: window.innerWidth / 2, y: window.innerHeight / 2 };\n const point = lastPointer.ready ? { x: lastPointer.x, y: lastPointer.y } : fallbackPoint;\n\n setContextMenuState({\n anchor: createVirtualElement(point),\n footer: options?.footer,\n header: options?.header,\n iconAlign: options?.iconAlign,\n iconSpaceMode: options?.iconSpaceMode ?? 'global',\n items,\n open: true,\n triggerId: lastPointer.triggerId ?? null,\n });\n};\n\n/**\n * Update menu items while keeping current anchor/position.\n * Useful for interactive menu items (e.g. checkbox) to avoid re-positioning.\n */\nexport const updateContextMenuItems = (items: ContextMenuItem[]) => {\n if (typeof window === 'undefined') return;\n setContextMenuState({ items });\n};\n\nexport const closeContextMenu = () => {\n setContextMenuState({\n anchor: null,\n footer: undefined,\n header: undefined,\n iconSpaceMode: 'global',\n items: [],\n open: false,\n triggerId: null,\n });\n};\n"],"mappings":";AAmBA,MAAM,aAA+B;CACnC,QAAQ;CACR,eAAe;CACf,OAAO,EAAE;CACT,MAAM;CACN,WAAW;CACZ;AAED,IAAI,mBAAqC;AACzC,MAAM,4BAAY,IAAI,KAAiB;AACvC,MAAM,cAAc;CAAE,OAAO;CAAO,WAAW;CAAuB,GAAG;CAAG,GAAG;CAAG;AAElF,MAAM,eAAe;AACnB,WAAU,SAAS,aAAa,UAAU,CAAC;;AAG7C,MAAa,aAAa,aAAyB;AACjD,WAAU,IAAI,SAAS;AACvB,cAAa,UAAU,OAAO,SAAS;;AAGzC,MAAa,oBAAoB;AACjC,MAAa,0BAA0B;AAEvC,MAAa,qBAAqB,UAAqC;AACrE,aAAY,IAAI,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
|
3
|
+
import { styles } from "../../Menu/sharedStyle.mjs";
|
|
4
|
+
import { DropdownMenuFooter, DropdownMenuHeader, DropdownMenuPopup, DropdownMenuPortal, DropdownMenuPositioner, DropdownMenuScrollViewport, DropdownMenuTrigger } from "./atoms.mjs";
|
|
4
5
|
import { parseTrigger } from "../../utils/parseTrigger.mjs";
|
|
5
6
|
import { renderDropdownMenuItems } from "./renderItems.mjs";
|
|
6
7
|
import { memo, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
7
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { cx } from "antd-style";
|
|
8
10
|
import { Menu } from "@base-ui/react/menu";
|
|
9
11
|
//#region src/base-ui/DropdownMenu/DropdownMenu.tsx
|
|
10
|
-
const DropdownMenu = memo(({ children, defaultOpen, iconAlign, iconSpaceMode, items, nativeButton, onOpenChange, onOpenChangeComplete, open, placement = "bottomLeft", popupProps, portalProps, positionerProps, trigger = "click", triggerProps, ...rest }) => {
|
|
12
|
+
const DropdownMenu = memo(({ children, defaultOpen, footer, header, iconAlign, iconSpaceMode, items, nativeButton, onOpenChange, onOpenChangeComplete, open, placement = "bottomLeft", popupProps, portalProps, positionerProps, trigger = "click", triggerProps, ...rest }) => {
|
|
11
13
|
const [uncontrolledOpen, setUncontrolledOpen] = useState(Boolean(defaultOpen));
|
|
12
14
|
const { openOnHover } = useMemo(() => parseTrigger(trigger), [trigger]);
|
|
13
15
|
useEffect(() => {
|
|
@@ -46,6 +48,7 @@ const DropdownMenu = memo(({ children, defaultOpen, iconAlign, iconSpaceMode, it
|
|
|
46
48
|
nativeButton,
|
|
47
49
|
triggerNativeButton: triggerProps?.nativeButton
|
|
48
50
|
});
|
|
51
|
+
const hasSlots = header != null || footer != null;
|
|
49
52
|
const triggerElement = /* @__PURE__ */ jsx(DropdownMenuTrigger, {
|
|
50
53
|
...triggerProps,
|
|
51
54
|
nativeButton: resolvedNativeButton,
|
|
@@ -66,9 +69,14 @@ const DropdownMenu = memo(({ children, defaultOpen, iconAlign, iconSpaceMode, it
|
|
|
66
69
|
...positionerProps,
|
|
67
70
|
hoverTrigger: openOnHover,
|
|
68
71
|
placement,
|
|
69
|
-
children: /* @__PURE__ */
|
|
72
|
+
children: /* @__PURE__ */ jsxs(DropdownMenuPopup, {
|
|
70
73
|
...popupProps,
|
|
71
|
-
|
|
74
|
+
className: hasSlots ? cx(styles.popupWithSlots, popupProps?.className) : popupProps?.className,
|
|
75
|
+
children: [
|
|
76
|
+
header == null ? null : /* @__PURE__ */ jsx(DropdownMenuHeader, { children: header }),
|
|
77
|
+
hasSlots ? /* @__PURE__ */ jsx(DropdownMenuScrollViewport, { children: menuItems }) : menuItems,
|
|
78
|
+
footer == null ? null : /* @__PURE__ */ jsx(DropdownMenuFooter, { children: footer })
|
|
79
|
+
]
|
|
72
80
|
})
|
|
73
81
|
})
|
|
74
82
|
})]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownMenu.mjs","names":[],"sources":["../../../src/base-ui/DropdownMenu/DropdownMenu.tsx"],"sourcesContent":["'use client';\n\nimport { Menu } from '@base-ui/react/menu';\nimport { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\nimport { useNativeButton } from '@/hooks/useNativeButton';\nimport { parseTrigger } from '@/utils/parseTrigger';\n\nimport {\n DropdownMenuPopup,\n DropdownMenuPortal,\n DropdownMenuPositioner,\n DropdownMenuTrigger,\n} from './atoms';\nimport { renderDropdownMenuItems } from './renderItems';\nimport type { DropdownMenuProps } from './type';\n\nconst DropdownMenu = memo<DropdownMenuProps>(\n ({\n children,\n defaultOpen,\n iconAlign,\n iconSpaceMode,\n items,\n nativeButton,\n onOpenChange,\n onOpenChangeComplete,\n open,\n placement = 'bottomLeft',\n popupProps,\n portalProps,\n positionerProps,\n trigger = 'click',\n triggerProps,\n ...rest\n }) => {\n const [uncontrolledOpen, setUncontrolledOpen] = useState(Boolean(defaultOpen));\n\n const { openOnHover } = useMemo(() => parseTrigger(trigger), [trigger]);\n\n useEffect(() => {\n if (open === undefined) return;\n setUncontrolledOpen(open);\n }, [open]);\n\n const handleOpenChange = useCallback(\n (nextOpen: boolean, details: Parameters<NonNullable<typeof onOpenChange>>[1]) => {\n onOpenChange?.(nextOpen, details);\n if (open === undefined) {\n setUncontrolledOpen(nextOpen);\n }\n },\n [onOpenChange, open],\n );\n\n const menuItemsRef = useRef<ReturnType<typeof renderDropdownMenuItems> | null>(null);\n const isOpen = open ?? uncontrolledOpen;\n const menuItems = useMemo(() => {\n if (isOpen) {\n const resolvedItems = typeof items === 'function' ? items() : items;\n const renderedItems = renderDropdownMenuItems(resolvedItems, [], {\n iconAlign,\n iconSpaceMode,\n });\n menuItemsRef.current = renderedItems;\n return renderedItems;\n }\n return menuItemsRef.current;\n }, [isOpen, items, iconAlign, iconSpaceMode]);\n const handleOpenChangeComplete = useCallback(\n (nextOpen: boolean) => {\n onOpenChangeComplete?.(nextOpen);\n if (!nextOpen) {\n menuItemsRef.current = null;\n }\n },\n [onOpenChangeComplete],\n );\n const { container: portalContainer, ...restPortalProps } = (portalProps ?? {}) as any;\n\n const { resolvedNativeButton } = useNativeButton({\n children,\n nativeButton,\n triggerNativeButton: triggerProps?.nativeButton,\n });\n\n const triggerElement = (\n <DropdownMenuTrigger\n {...triggerProps}\n nativeButton={resolvedNativeButton}\n openOnHover={openOnHover}\n >\n {children}\n </DropdownMenuTrigger>\n );\n\n return (\n <Menu.Root\n {...rest}\n defaultOpen={defaultOpen}\n modal={false}\n open={open}\n onOpenChange={handleOpenChange}\n onOpenChangeComplete={handleOpenChangeComplete}\n >\n {triggerElement}\n <DropdownMenuPortal container={portalContainer} {...restPortalProps}>\n <DropdownMenuPositioner\n {...positionerProps}\n hoverTrigger={openOnHover}\n placement={placement}\n >\n <DropdownMenuPopup
|
|
1
|
+
{"version":3,"file":"DropdownMenu.mjs","names":[],"sources":["../../../src/base-ui/DropdownMenu/DropdownMenu.tsx"],"sourcesContent":["'use client';\n\nimport { Menu } from '@base-ui/react/menu';\nimport { cx } from 'antd-style';\nimport { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\nimport { useNativeButton } from '@/hooks/useNativeButton';\nimport { styles } from '@/Menu/sharedStyle';\nimport { parseTrigger } from '@/utils/parseTrigger';\n\nimport {\n DropdownMenuFooter,\n DropdownMenuHeader,\n DropdownMenuPopup,\n DropdownMenuPortal,\n DropdownMenuPositioner,\n DropdownMenuScrollViewport,\n DropdownMenuTrigger,\n} from './atoms';\nimport { renderDropdownMenuItems } from './renderItems';\nimport type { DropdownMenuProps } from './type';\n\nconst DropdownMenu = memo<DropdownMenuProps>(\n ({\n children,\n defaultOpen,\n footer,\n header,\n iconAlign,\n iconSpaceMode,\n items,\n nativeButton,\n onOpenChange,\n onOpenChangeComplete,\n open,\n placement = 'bottomLeft',\n popupProps,\n portalProps,\n positionerProps,\n trigger = 'click',\n triggerProps,\n ...rest\n }) => {\n const [uncontrolledOpen, setUncontrolledOpen] = useState(Boolean(defaultOpen));\n\n const { openOnHover } = useMemo(() => parseTrigger(trigger), [trigger]);\n\n useEffect(() => {\n if (open === undefined) return;\n setUncontrolledOpen(open);\n }, [open]);\n\n const handleOpenChange = useCallback(\n (nextOpen: boolean, details: Parameters<NonNullable<typeof onOpenChange>>[1]) => {\n onOpenChange?.(nextOpen, details);\n if (open === undefined) {\n setUncontrolledOpen(nextOpen);\n }\n },\n [onOpenChange, open],\n );\n\n const menuItemsRef = useRef<ReturnType<typeof renderDropdownMenuItems> | null>(null);\n const isOpen = open ?? uncontrolledOpen;\n const menuItems = useMemo(() => {\n if (isOpen) {\n const resolvedItems = typeof items === 'function' ? items() : items;\n const renderedItems = renderDropdownMenuItems(resolvedItems, [], {\n iconAlign,\n iconSpaceMode,\n });\n menuItemsRef.current = renderedItems;\n return renderedItems;\n }\n return menuItemsRef.current;\n }, [isOpen, items, iconAlign, iconSpaceMode]);\n const handleOpenChangeComplete = useCallback(\n (nextOpen: boolean) => {\n onOpenChangeComplete?.(nextOpen);\n if (!nextOpen) {\n menuItemsRef.current = null;\n }\n },\n [onOpenChangeComplete],\n );\n const { container: portalContainer, ...restPortalProps } = (portalProps ?? {}) as any;\n\n const { resolvedNativeButton } = useNativeButton({\n children,\n nativeButton,\n triggerNativeButton: triggerProps?.nativeButton,\n });\n\n const hasSlots = header != null || footer != null;\n\n const triggerElement = (\n <DropdownMenuTrigger\n {...triggerProps}\n nativeButton={resolvedNativeButton}\n openOnHover={openOnHover}\n >\n {children}\n </DropdownMenuTrigger>\n );\n\n return (\n <Menu.Root\n {...rest}\n defaultOpen={defaultOpen}\n modal={false}\n open={open}\n onOpenChange={handleOpenChange}\n onOpenChangeComplete={handleOpenChangeComplete}\n >\n {triggerElement}\n <DropdownMenuPortal container={portalContainer} {...restPortalProps}>\n <DropdownMenuPositioner\n {...positionerProps}\n hoverTrigger={openOnHover}\n placement={placement}\n >\n <DropdownMenuPopup\n {...popupProps}\n className={\n hasSlots\n ? (cx(styles.popupWithSlots, popupProps?.className as string) as any)\n : popupProps?.className\n }\n >\n {header == null ? null : <DropdownMenuHeader>{header}</DropdownMenuHeader>}\n {hasSlots ? (\n <DropdownMenuScrollViewport>{menuItems}</DropdownMenuScrollViewport>\n ) : (\n menuItems\n )}\n {footer == null ? null : <DropdownMenuFooter>{footer}</DropdownMenuFooter>}\n </DropdownMenuPopup>\n </DropdownMenuPositioner>\n </DropdownMenuPortal>\n </Menu.Root>\n );\n },\n);\n\nDropdownMenu.displayName = 'DropdownMenuV2';\n\nexport default DropdownMenu;\n"],"mappings":";;;;;;;;;;;AAsBA,MAAM,eAAe,MAClB,EACC,UACA,aACA,QACA,QACA,WACA,eACA,OACA,cACA,cACA,sBACA,MACA,YAAY,cACZ,YACA,aACA,iBACA,UAAU,SACV,cACA,GAAG,WACC;CACJ,MAAM,CAAC,kBAAkB,uBAAuB,SAAS,QAAQ,YAAY,CAAC;CAE9E,MAAM,EAAE,gBAAgB,cAAc,aAAa,QAAQ,EAAE,CAAC,QAAQ,C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EAAA,UAAqB,QAA4B,CAAA;MACzE,WACC,oBAAC,4BAAD,EAAA,UAA6B,WAAuC,CAAA,GAEpE;MAED,UAAU,OAAO,OAAO,oBAAC,oBAAD,EAAA,UAAqB,QAA4B,CAAA;MACxD;;IACG,CAAA;GACN,CAAA,CACX;;EAGjB;AAED,aAAa,cAAc"}
|
|
@@ -60,6 +60,30 @@ declare const DropdownMenuPopup: {
|
|
|
60
60
|
}: DropdownMenuPopupProps): _$react_jsx_runtime0.JSX.Element;
|
|
61
61
|
displayName: string;
|
|
62
62
|
};
|
|
63
|
+
type DropdownMenuHeaderProps = React.HTMLAttributes<HTMLDivElement>;
|
|
64
|
+
declare const DropdownMenuHeader: {
|
|
65
|
+
({
|
|
66
|
+
className,
|
|
67
|
+
...rest
|
|
68
|
+
}: DropdownMenuHeaderProps): _$react_jsx_runtime0.JSX.Element;
|
|
69
|
+
displayName: string;
|
|
70
|
+
};
|
|
71
|
+
type DropdownMenuFooterProps = React.HTMLAttributes<HTMLDivElement>;
|
|
72
|
+
declare const DropdownMenuFooter: {
|
|
73
|
+
({
|
|
74
|
+
className,
|
|
75
|
+
...rest
|
|
76
|
+
}: DropdownMenuFooterProps): _$react_jsx_runtime0.JSX.Element;
|
|
77
|
+
displayName: string;
|
|
78
|
+
};
|
|
79
|
+
type DropdownMenuScrollViewportProps = React.HTMLAttributes<HTMLDivElement>;
|
|
80
|
+
declare const DropdownMenuScrollViewport: {
|
|
81
|
+
({
|
|
82
|
+
className,
|
|
83
|
+
...rest
|
|
84
|
+
}: DropdownMenuScrollViewportProps): _$react_jsx_runtime0.JSX.Element;
|
|
85
|
+
displayName: string;
|
|
86
|
+
};
|
|
63
87
|
type DropdownMenuItemProps = React.ComponentProps<typeof Menu.Item> & {
|
|
64
88
|
danger?: boolean;
|
|
65
89
|
};
|
|
@@ -188,5 +212,5 @@ declare const DropdownMenuSwitchItem: {
|
|
|
188
212
|
displayName: string;
|
|
189
213
|
};
|
|
190
214
|
//#endregion
|
|
191
|
-
export { DropdownMenuCheckboxItemIndicator, DropdownMenuCheckboxItemPrimitive, DropdownMenuCheckboxItemProps, DropdownMenuGroup, DropdownMenuGroupLabel, DropdownMenuGroupLabelProps, DropdownMenuItem, DropdownMenuItemContent, DropdownMenuItemContentProps, DropdownMenuItemDesc, DropdownMenuItemDescProps, DropdownMenuItemExtra, DropdownMenuItemExtraProps, DropdownMenuItemIcon, DropdownMenuItemIconProps, DropdownMenuItemLabel, DropdownMenuItemLabelGroup, DropdownMenuItemLabelGroupProps, DropdownMenuItemLabelProps, DropdownMenuItemProps, DropdownMenuPopup, DropdownMenuPopupProps, DropdownMenuPortal, DropdownMenuPortalProps, DropdownMenuPositioner, DropdownMenuPositionerProps, DropdownMenuRoot, DropdownMenuSeparator, DropdownMenuSeparatorProps, DropdownMenuSubmenuArrow, DropdownMenuSubmenuArrowProps, DropdownMenuSubmenuRoot, DropdownMenuSubmenuTrigger, DropdownMenuSubmenuTriggerProps, DropdownMenuSwitchItem, DropdownMenuSwitchItemProps, DropdownMenuTrigger, DropdownMenuTriggerProps };
|
|
215
|
+
export { DropdownMenuCheckboxItemIndicator, DropdownMenuCheckboxItemPrimitive, DropdownMenuCheckboxItemProps, DropdownMenuFooter, DropdownMenuFooterProps, DropdownMenuGroup, DropdownMenuGroupLabel, DropdownMenuGroupLabelProps, DropdownMenuHeader, DropdownMenuHeaderProps, DropdownMenuItem, DropdownMenuItemContent, DropdownMenuItemContentProps, DropdownMenuItemDesc, DropdownMenuItemDescProps, DropdownMenuItemExtra, DropdownMenuItemExtraProps, DropdownMenuItemIcon, DropdownMenuItemIconProps, DropdownMenuItemLabel, DropdownMenuItemLabelGroup, DropdownMenuItemLabelGroupProps, DropdownMenuItemLabelProps, DropdownMenuItemProps, DropdownMenuPopup, DropdownMenuPopupProps, DropdownMenuPortal, DropdownMenuPortalProps, DropdownMenuPositioner, DropdownMenuPositionerProps, DropdownMenuRoot, DropdownMenuScrollViewport, DropdownMenuScrollViewportProps, DropdownMenuSeparator, DropdownMenuSeparatorProps, DropdownMenuSubmenuArrow, DropdownMenuSubmenuArrowProps, DropdownMenuSubmenuRoot, DropdownMenuSubmenuTrigger, DropdownMenuSubmenuTriggerProps, DropdownMenuSwitchItem, DropdownMenuSwitchItemProps, DropdownMenuTrigger, DropdownMenuTriggerProps };
|
|
192
216
|
//# sourceMappingURL=atoms.d.mts.map
|
|
@@ -105,6 +105,27 @@ const DropdownMenuPopup = ({ className, ...rest }) => {
|
|
|
105
105
|
});
|
|
106
106
|
};
|
|
107
107
|
DropdownMenuPopup.displayName = "DropdownMenuPopup";
|
|
108
|
+
const DropdownMenuHeader = ({ className, ...rest }) => {
|
|
109
|
+
return /* @__PURE__ */ jsx("div", {
|
|
110
|
+
...rest,
|
|
111
|
+
className: cx(styles.header, className)
|
|
112
|
+
});
|
|
113
|
+
};
|
|
114
|
+
DropdownMenuHeader.displayName = "DropdownMenuHeader";
|
|
115
|
+
const DropdownMenuFooter = ({ className, ...rest }) => {
|
|
116
|
+
return /* @__PURE__ */ jsx("div", {
|
|
117
|
+
...rest,
|
|
118
|
+
className: cx(styles.footer, className)
|
|
119
|
+
});
|
|
120
|
+
};
|
|
121
|
+
DropdownMenuFooter.displayName = "DropdownMenuFooter";
|
|
122
|
+
const DropdownMenuScrollViewport = ({ className, ...rest }) => {
|
|
123
|
+
return /* @__PURE__ */ jsx("div", {
|
|
124
|
+
...rest,
|
|
125
|
+
className: cx(styles.slotViewport, className)
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
DropdownMenuScrollViewport.displayName = "DropdownMenuScrollViewport";
|
|
108
129
|
const DropdownMenuItem = ({ className, danger, ...rest }) => {
|
|
109
130
|
return /* @__PURE__ */ jsx(Menu$1.Item, {
|
|
110
131
|
...rest,
|
|
@@ -226,6 +247,6 @@ const DropdownMenuSwitchItem = ({ checked: checkedProp, className, closeOnClick
|
|
|
226
247
|
};
|
|
227
248
|
DropdownMenuSwitchItem.displayName = "DropdownMenuSwitchItem";
|
|
228
249
|
//#endregion
|
|
229
|
-
export { DropdownMenuCheckboxItemIndicator, DropdownMenuCheckboxItemPrimitive, DropdownMenuGroup, DropdownMenuGroupLabel, DropdownMenuItem, DropdownMenuItemContent, DropdownMenuItemDesc, DropdownMenuItemExtra, DropdownMenuItemIcon, DropdownMenuItemLabel, DropdownMenuItemLabelGroup, DropdownMenuPopup, DropdownMenuPortal, DropdownMenuPositioner, DropdownMenuRoot, DropdownMenuSeparator, DropdownMenuSubmenuArrow, DropdownMenuSubmenuRoot, DropdownMenuSubmenuTrigger, DropdownMenuSwitchItem, DropdownMenuTrigger };
|
|
250
|
+
export { DropdownMenuCheckboxItemIndicator, DropdownMenuCheckboxItemPrimitive, DropdownMenuFooter, DropdownMenuGroup, DropdownMenuGroupLabel, DropdownMenuHeader, DropdownMenuItem, DropdownMenuItemContent, DropdownMenuItemDesc, DropdownMenuItemExtra, DropdownMenuItemIcon, DropdownMenuItemLabel, DropdownMenuItemLabelGroup, DropdownMenuPopup, DropdownMenuPortal, DropdownMenuPositioner, DropdownMenuRoot, DropdownMenuScrollViewport, DropdownMenuSeparator, DropdownMenuSubmenuArrow, DropdownMenuSubmenuRoot, DropdownMenuSubmenuTrigger, DropdownMenuSwitchItem, DropdownMenuTrigger };
|
|
230
251
|
|
|
231
252
|
//# sourceMappingURL=atoms.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"atoms.mjs","names":["Menu"],"sources":["../../../src/base-ui/DropdownMenu/atoms.tsx"],"sourcesContent":["'use client';\n\nimport { Menu } from '@base-ui/react/menu';\nimport { mergeProps } from '@base-ui/react/merge-props';\nimport { Switch } from 'antd';\nimport { cx } from 'antd-style';\nimport clsx from 'clsx';\nimport type React from 'react';\nimport { cloneElement, isValidElement, useCallback, useState } from 'react';\nimport { mergeRefs, useMergeRefs } from 'react-merge-refs';\n\nimport { FloatingLayerProvider } from '@/hooks/useFloatingLayer';\nimport { useNativeButton } from '@/hooks/useNativeButton';\nimport { styles } from '@/Menu/sharedStyle';\nimport { CLASSNAMES } from '@/styles/classNames';\nimport { useAppElement } from '@/ThemeProvider';\nimport { placementMap } from '@/utils/placement';\n\nimport { useLayerZIndex } from '../zIndex';\nimport { type DropdownMenuPlacement } from './type';\n\nexport const DropdownMenuRoot: typeof Menu.Root = (props) => <Menu.Root modal={false} {...props} />;\nexport const DropdownMenuSubmenuRoot = Menu.SubmenuRoot;\nexport const DropdownMenuCheckboxItemIndicator = Menu.CheckboxItemIndicator;\n\nconst mergeStateClassName = <TState,>(\n base: string,\n className: string | ((state: TState) => string | undefined) | undefined,\n) => {\n if (typeof className === 'function') return (state: TState) => cx(base, className(state));\n return cx(base, className);\n};\n\nexport type DropdownMenuTriggerProps = Omit<\n React.ComponentPropsWithRef<typeof Menu.Trigger>,\n 'children' | 'render'\n> & {\n children: React.ReactNode;\n};\n\nexport const DropdownMenuTrigger = ({\n children,\n className,\n nativeButton,\n ref: refProp,\n ...rest\n}: DropdownMenuTriggerProps) => {\n const { isNativeButtonTriggerElement, resolvedNativeButton } = useNativeButton({\n children,\n nativeButton,\n });\n\n const renderer = (props: any) => {\n // Base UI's trigger props include `type=\"button\"` by default.\n // If we render into a non-<button> element, that prop is invalid and can warn.\n const resolvedProps = (() => {\n if (isNativeButtonTriggerElement) return props as any;\n // eslint-disable-next-line unused-imports/no-unused-vars\n const { type, ...restProps } = props as any;\n return restProps;\n })();\n\n const mergedProps = mergeProps((children as any).props, resolvedProps);\n return cloneElement(children as any, {\n ...mergedProps,\n className: clsx(CLASSNAMES.DropdownMenuTrigger, className, mergedProps.className),\n ref: mergeRefs([(children as any).ref, (props as any).ref, refProp]),\n });\n };\n\n if (isValidElement(children)) {\n return <Menu.Trigger {...rest} nativeButton={resolvedNativeButton} render={renderer as any} />;\n }\n\n return (\n <Menu.Trigger\n {...rest}\n className={clsx(CLASSNAMES.DropdownMenuTrigger, className)}\n nativeButton={resolvedNativeButton}\n ref={refProp as any}\n >\n {children}\n </Menu.Trigger>\n );\n};\n\nDropdownMenuTrigger.displayName = 'DropdownMenuTrigger';\n\nexport type DropdownMenuPortalProps = React.ComponentProps<typeof Menu.Portal> & {\n /**\n * When `container` is not provided, it uses a shared container created by `usePortalContainer`.\n */\n container?: HTMLElement | null;\n};\n\nexport const DropdownMenuPortal = ({ container, ...rest }: DropdownMenuPortalProps) => {\n const appElement = useAppElement();\n return <Menu.Portal container={container ?? appElement ?? undefined} {...rest} />;\n};\n\nDropdownMenuPortal.displayName = 'DropdownMenuPortal';\n\nexport type DropdownMenuPositionerProps = React.ComponentProps<typeof Menu.Positioner> & {\n hoverTrigger?: boolean;\n placement?: DropdownMenuPlacement;\n};\n\nexport const DropdownMenuPositioner = ({\n className,\n placement,\n hoverTrigger,\n align,\n side,\n sideOffset,\n children,\n style,\n ...rest\n}: DropdownMenuPositionerProps) => {\n const placementConfig = placement ? placementMap[placement] : undefined;\n const [positionerNode, setPositionerNode] = useState<HTMLDivElement | null>(null);\n\n const explicitZIndex =\n typeof style !== 'function' && style?.zIndex != null && typeof style.zIndex === 'number'\n ? style.zIndex\n : undefined;\n const { zIndex, ref: zRef } = useLayerZIndex<HTMLDivElement>('floating', explicitZIndex);\n const composedRef = useMergeRefs([setPositionerNode, zRef]);\n\n const resolvedStyle =\n typeof style === 'function'\n ? (state: any) => ({ zIndex, ...style(state) })\n : { zIndex, ...style };\n\n return (\n <Menu.Positioner\n {...rest}\n align={align ?? placementConfig?.align}\n className={mergeStateClassName(styles.positioner, className as any) as any}\n data-hover-trigger={hoverTrigger || undefined}\n data-placement={placement}\n ref={composedRef as any}\n side={side ?? placementConfig?.side}\n sideOffset={sideOffset ?? (placementConfig ? 6 : undefined)}\n style={resolvedStyle}\n >\n <FloatingLayerProvider value={positionerNode}>{children}</FloatingLayerProvider>\n </Menu.Positioner>\n );\n};\n\nDropdownMenuPositioner.displayName = 'DropdownMenuPositioner';\n\nexport type DropdownMenuPopupProps = React.ComponentProps<typeof Menu.Popup>;\n\nexport const DropdownMenuPopup = ({ className, ...rest }: DropdownMenuPopupProps) => {\n return (\n <Menu.Popup {...rest} className={mergeStateClassName(styles.popup, className as any) as any} />\n );\n};\n\nDropdownMenuPopup.displayName = 'DropdownMenuPopup';\n\nexport type DropdownMenuItemProps = React.ComponentProps<typeof Menu.Item> & { danger?: boolean };\n\nexport const DropdownMenuItem = ({ className, danger, ...rest }: DropdownMenuItemProps) => {\n return (\n <Menu.Item\n {...rest}\n className={(state) =>\n cx(\n styles.item,\n danger && styles.danger,\n typeof className === 'function' ? className(state) : className,\n )\n }\n />\n );\n};\n\nDropdownMenuItem.displayName = 'DropdownMenuItem';\n\nexport type DropdownMenuCheckboxItemProps = React.ComponentProps<typeof Menu.CheckboxItem> & {\n danger?: boolean;\n};\n\nexport const DropdownMenuCheckboxItemPrimitive = ({\n className,\n danger,\n ...rest\n}: DropdownMenuCheckboxItemProps) => {\n return (\n <Menu.CheckboxItem\n {...rest}\n className={(state) =>\n cx(\n styles.item,\n danger && styles.danger,\n typeof className === 'function' ? className(state) : className,\n )\n }\n />\n );\n};\n\nDropdownMenuCheckboxItemPrimitive.displayName = 'DropdownMenuCheckboxItemPrimitive';\n\nexport type DropdownMenuSeparatorProps = React.ComponentProps<typeof Menu.Separator>;\n\nexport const DropdownMenuSeparator = ({ className, ...rest }: DropdownMenuSeparatorProps) => {\n return (\n <Menu.Separator\n {...rest}\n className={(state) =>\n cx(styles.separator, typeof className === 'function' ? className(state) : className)\n }\n />\n );\n};\n\nDropdownMenuSeparator.displayName = 'DropdownMenuSeparator';\n\nexport const DropdownMenuGroup = Menu.Group;\n\nexport type DropdownMenuGroupLabelProps = React.ComponentProps<typeof Menu.GroupLabel>;\n\nexport const DropdownMenuGroupLabel = ({ className, ...rest }: DropdownMenuGroupLabelProps) => {\n return (\n <Menu.GroupLabel\n {...rest}\n className={(state) =>\n cx(styles.groupLabel, typeof className === 'function' ? className(state) : className)\n }\n />\n );\n};\n\nDropdownMenuGroupLabel.displayName = 'DropdownMenuGroupLabel';\n\nexport type DropdownMenuSubmenuTriggerProps = React.ComponentProps<typeof Menu.SubmenuTrigger> & {\n danger?: boolean;\n};\n\nexport const DropdownMenuSubmenuTrigger = ({\n className,\n danger,\n ...rest\n}: DropdownMenuSubmenuTriggerProps) => {\n return (\n <Menu.SubmenuTrigger\n {...rest}\n className={(state) =>\n cx(\n styles.item,\n danger && styles.danger,\n typeof className === 'function' ? className(state) : className,\n )\n }\n />\n );\n};\n\nDropdownMenuSubmenuTrigger.displayName = 'DropdownMenuSubmenuTrigger';\n\nexport type DropdownMenuItemContentProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport const DropdownMenuItemContent = ({ className, ...rest }: DropdownMenuItemContentProps) => {\n return <div {...rest} className={cx(styles.itemContent, className)} />;\n};\n\nDropdownMenuItemContent.displayName = 'DropdownMenuItemContent';\n\nexport type DropdownMenuItemIconProps = React.HTMLAttributes<HTMLSpanElement>;\n\nexport const DropdownMenuItemIcon = ({ className, ...rest }: DropdownMenuItemIconProps) => {\n return <span {...rest} className={cx(styles.icon, className)} />;\n};\n\nDropdownMenuItemIcon.displayName = 'DropdownMenuItemIcon';\n\nexport type DropdownMenuItemLabelGroupProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport const DropdownMenuItemLabelGroup = ({\n className,\n ...rest\n}: DropdownMenuItemLabelGroupProps) => {\n return <div {...rest} className={cx(styles.labelGroup, className)} />;\n};\n\nDropdownMenuItemLabelGroup.displayName = 'DropdownMenuItemLabelGroup';\n\nexport type DropdownMenuItemLabelProps = React.HTMLAttributes<HTMLSpanElement>;\n\nexport const DropdownMenuItemLabel = ({ className, ...rest }: DropdownMenuItemLabelProps) => {\n return <span {...rest} className={cx(styles.label, className)} />;\n};\n\nDropdownMenuItemLabel.displayName = 'DropdownMenuItemLabel';\n\nexport type DropdownMenuItemDescProps = React.HTMLAttributes<HTMLSpanElement>;\n\nexport const DropdownMenuItemDesc = ({ className, ...rest }: DropdownMenuItemDescProps) => {\n return <span {...rest} className={cx(styles.desc, className)} />;\n};\n\nDropdownMenuItemDesc.displayName = 'DropdownMenuItemDesc';\n\nexport type DropdownMenuItemExtraProps = React.HTMLAttributes<HTMLSpanElement>;\n\nexport const DropdownMenuItemExtra = ({ className, ...rest }: DropdownMenuItemExtraProps) => {\n return <span {...rest} className={cx(styles.extra, className)} />;\n};\n\nDropdownMenuItemExtra.displayName = 'DropdownMenuItemExtra';\n\nexport type DropdownMenuSubmenuArrowProps = React.HTMLAttributes<HTMLSpanElement>;\n\nexport const DropdownMenuSubmenuArrow = ({ className, ...rest }: DropdownMenuSubmenuArrowProps) => {\n return <span {...rest} className={cx(styles.submenuArrow, className)} />;\n};\n\nDropdownMenuSubmenuArrow.displayName = 'DropdownMenuSubmenuArrow';\n\nexport type DropdownMenuSwitchItemProps = Omit<\n React.ComponentProps<typeof Menu.Item>,\n 'onClick'\n> & {\n checked?: boolean;\n closeOnClick?: boolean;\n danger?: boolean;\n defaultChecked?: boolean;\n onCheckedChange?: (checked: boolean) => void;\n};\n\nexport const DropdownMenuSwitchItem = ({\n checked: checkedProp,\n className,\n closeOnClick = false,\n danger,\n defaultChecked,\n disabled,\n onCheckedChange,\n children,\n ...rest\n}: DropdownMenuSwitchItemProps) => {\n const [internalChecked, setInternalChecked] = useState(defaultChecked ?? false);\n const isControlled = checkedProp !== undefined;\n const checked = isControlled ? checkedProp : internalChecked;\n\n const handleCheckedChange = useCallback(\n (newChecked: boolean) => {\n if (!isControlled) {\n setInternalChecked(newChecked);\n }\n onCheckedChange?.(newChecked);\n },\n [isControlled, onCheckedChange],\n );\n\n return (\n <Menu.Item\n {...rest}\n closeOnClick={closeOnClick}\n disabled={disabled}\n className={(state) =>\n cx(\n styles.item,\n danger && styles.danger,\n typeof className === 'function' ? className(state) : className,\n )\n }\n onClick={(e) => {\n e.preventDefault();\n if (!disabled) {\n handleCheckedChange(!checked);\n }\n }}\n >\n {children}\n <span\n style={{ display: 'inline-flex', marginInlineStart: 16 }}\n onFocus={(e) => e.stopPropagation()}\n >\n <Switch\n checked={checked}\n disabled={disabled}\n size=\"small\"\n tabIndex={-1}\n onChange={handleCheckedChange}\n onClick={(_, e) => e.stopPropagation()}\n />\n </span>\n </Menu.Item>\n );\n};\n\nDropdownMenuSwitchItem.displayName = 'DropdownMenuSwitchItem';\n"],"mappings":";;;;;;;;;;;;;;;;;AAqBA,MAAa,oBAAsC,UAAU,oBAACA,OAAK,MAAN;CAAW,OAAO;CAAO,GAAI;CAAS,CAAA;AACnG,MAAa,0BAA0BA,OAAK;AAC5C,MAAa,oCAAoCA,OAAK;AAEtD,MAAM,uBACJ,MACA,cACG;AACH,KAAI,OAAO,cAAc,WAAY,SAAQ,UAAkB,GAAG,MAAM,UAAU,MAAM,CAAC;AACzF,QAAO,GAAG,MAAM,UAAU;;AAU5B,MAAa,uBAAuB,EAClC,UACA,WACA,cACA,KAAK,SACL,GAAG,WAC2B;CAC9B,MAAM,EAAE,8BAA8B,yBAAyB,gBAAgB;EAC7E;EACA;EACD,CAAC;CAEF,MAAM,YAAY,UAAe;EAG/B,MAAM,uBAAuB;AAC3B,OAAI,6BAA8B,QAAO;GAEzC,MAAM,EAAE,MAAM,GAAG,cAAc;AAC/B,UAAO;MACL;EAEJ,MAAM,cAAc,WAAY,SAAiB,OAAO,cAAc;AACtE,SAAO,aAAa,UAAiB;GACnC,GAAG;GACH,WAAW,KAAK,WAAW,qBAAqB,WAAW,YAAY,UAAU;GACjF,KAAK,UAAU;IAAE,SAAiB;IAAM,MAAc;IAAK;IAAQ,CAAC;GACrE,CAAC;;AAGJ,KAAI,eAAe,SAAS,CAC1B,QAAO,oBAACA,OAAK,SAAN;EAAc,GAAI;EAAM,cAAc;EAAsB,QAAQ;EAAmB,CAAA;AAGhG,QACE,oBAACA,OAAK,SAAN;EACE,GAAI;EACJ,WAAW,KAAK,WAAW,qBAAqB,UAAU;EAC1D,cAAc;EACd,KAAK;EAEJ;EACY,CAAA;;AAInB,oBAAoB,cAAc;AASlC,MAAa,sBAAsB,EAAE,WAAW,GAAG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,MACP,UAAU,OAAO,QACjB,OAAO,cAAc,aAAa,UAAU,MAAM,GAAG,UACtD;EAEH,UAAU,MAAM;AACd,KAAE,gBAAgB;AAClB,OAAI,CAAC,SACH,qBAAoB,CAAC,QAAQ;;YAdnC,CAkBG,UACD,oBAAC,QAAD;GACE,OAAO;IAAE,SAAS;IAAe,mBAAmB;IAAI;GACxD,UAAU,MAAM,EAAE,iBAAiB;aAEnC,oBAAC,QAAD;IACW;IACC;IACV,MAAK;IACL,UAAU;IACV,UAAU;IACV,UAAU,GAAG,MAAM,EAAE,iBAAiB;IACtC,CAAA;GACG,CAAA,CACG;;;AAIhB,uBAAuB,cAAc"}
|
|
1
|
+
{"version":3,"file":"atoms.mjs","names":["Menu"],"sources":["../../../src/base-ui/DropdownMenu/atoms.tsx"],"sourcesContent":["'use client';\n\nimport { Menu } from '@base-ui/react/menu';\nimport { mergeProps } from '@base-ui/react/merge-props';\nimport { Switch } from 'antd';\nimport { cx } from 'antd-style';\nimport clsx from 'clsx';\nimport type React from 'react';\nimport { cloneElement, isValidElement, useCallback, useState } from 'react';\nimport { mergeRefs, useMergeRefs } from 'react-merge-refs';\n\nimport { FloatingLayerProvider } from '@/hooks/useFloatingLayer';\nimport { useNativeButton } from '@/hooks/useNativeButton';\nimport { styles } from '@/Menu/sharedStyle';\nimport { CLASSNAMES } from '@/styles/classNames';\nimport { useAppElement } from '@/ThemeProvider';\nimport { placementMap } from '@/utils/placement';\n\nimport { useLayerZIndex } from '../zIndex';\nimport { type DropdownMenuPlacement } from './type';\n\nexport const DropdownMenuRoot: typeof Menu.Root = (props) => <Menu.Root modal={false} {...props} />;\nexport const DropdownMenuSubmenuRoot = Menu.SubmenuRoot;\nexport const DropdownMenuCheckboxItemIndicator = Menu.CheckboxItemIndicator;\n\nconst mergeStateClassName = <TState,>(\n base: string,\n className: string | ((state: TState) => string | undefined) | undefined,\n) => {\n if (typeof className === 'function') return (state: TState) => cx(base, className(state));\n return cx(base, className);\n};\n\nexport type DropdownMenuTriggerProps = Omit<\n React.ComponentPropsWithRef<typeof Menu.Trigger>,\n 'children' | 'render'\n> & {\n children: React.ReactNode;\n};\n\nexport const DropdownMenuTrigger = ({\n children,\n className,\n nativeButton,\n ref: refProp,\n ...rest\n}: DropdownMenuTriggerProps) => {\n const { isNativeButtonTriggerElement, resolvedNativeButton } = useNativeButton({\n children,\n nativeButton,\n });\n\n const renderer = (props: any) => {\n // Base UI's trigger props include `type=\"button\"` by default.\n // If we render into a non-<button> element, that prop is invalid and can warn.\n const resolvedProps = (() => {\n if (isNativeButtonTriggerElement) return props as any;\n // eslint-disable-next-line unused-imports/no-unused-vars\n const { type, ...restProps } = props as any;\n return restProps;\n })();\n\n const mergedProps = mergeProps((children as any).props, resolvedProps);\n return cloneElement(children as any, {\n ...mergedProps,\n className: clsx(CLASSNAMES.DropdownMenuTrigger, className, mergedProps.className),\n ref: mergeRefs([(children as any).ref, (props as any).ref, refProp]),\n });\n };\n\n if (isValidElement(children)) {\n return <Menu.Trigger {...rest} nativeButton={resolvedNativeButton} render={renderer as any} />;\n }\n\n return (\n <Menu.Trigger\n {...rest}\n className={clsx(CLASSNAMES.DropdownMenuTrigger, className)}\n nativeButton={resolvedNativeButton}\n ref={refProp as any}\n >\n {children}\n </Menu.Trigger>\n );\n};\n\nDropdownMenuTrigger.displayName = 'DropdownMenuTrigger';\n\nexport type DropdownMenuPortalProps = React.ComponentProps<typeof Menu.Portal> & {\n /**\n * When `container` is not provided, it uses a shared container created by `usePortalContainer`.\n */\n container?: HTMLElement | null;\n};\n\nexport const DropdownMenuPortal = ({ container, ...rest }: DropdownMenuPortalProps) => {\n const appElement = useAppElement();\n return <Menu.Portal container={container ?? appElement ?? undefined} {...rest} />;\n};\n\nDropdownMenuPortal.displayName = 'DropdownMenuPortal';\n\nexport type DropdownMenuPositionerProps = React.ComponentProps<typeof Menu.Positioner> & {\n hoverTrigger?: boolean;\n placement?: DropdownMenuPlacement;\n};\n\nexport const DropdownMenuPositioner = ({\n className,\n placement,\n hoverTrigger,\n align,\n side,\n sideOffset,\n children,\n style,\n ...rest\n}: DropdownMenuPositionerProps) => {\n const placementConfig = placement ? placementMap[placement] : undefined;\n const [positionerNode, setPositionerNode] = useState<HTMLDivElement | null>(null);\n\n const explicitZIndex =\n typeof style !== 'function' && style?.zIndex != null && typeof style.zIndex === 'number'\n ? style.zIndex\n : undefined;\n const { zIndex, ref: zRef } = useLayerZIndex<HTMLDivElement>('floating', explicitZIndex);\n const composedRef = useMergeRefs([setPositionerNode, zRef]);\n\n const resolvedStyle =\n typeof style === 'function'\n ? (state: any) => ({ zIndex, ...style(state) })\n : { zIndex, ...style };\n\n return (\n <Menu.Positioner\n {...rest}\n align={align ?? placementConfig?.align}\n className={mergeStateClassName(styles.positioner, className as any) as any}\n data-hover-trigger={hoverTrigger || undefined}\n data-placement={placement}\n ref={composedRef as any}\n side={side ?? placementConfig?.side}\n sideOffset={sideOffset ?? (placementConfig ? 6 : undefined)}\n style={resolvedStyle}\n >\n <FloatingLayerProvider value={positionerNode}>{children}</FloatingLayerProvider>\n </Menu.Positioner>\n );\n};\n\nDropdownMenuPositioner.displayName = 'DropdownMenuPositioner';\n\nexport type DropdownMenuPopupProps = React.ComponentProps<typeof Menu.Popup>;\n\nexport const DropdownMenuPopup = ({ className, ...rest }: DropdownMenuPopupProps) => {\n return (\n <Menu.Popup {...rest} className={mergeStateClassName(styles.popup, className as any) as any} />\n );\n};\n\nDropdownMenuPopup.displayName = 'DropdownMenuPopup';\n\nexport type DropdownMenuHeaderProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport const DropdownMenuHeader = ({ className, ...rest }: DropdownMenuHeaderProps) => {\n return <div {...rest} className={cx(styles.header, className)} />;\n};\n\nDropdownMenuHeader.displayName = 'DropdownMenuHeader';\n\nexport type DropdownMenuFooterProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport const DropdownMenuFooter = ({ className, ...rest }: DropdownMenuFooterProps) => {\n return <div {...rest} className={cx(styles.footer, className)} />;\n};\n\nDropdownMenuFooter.displayName = 'DropdownMenuFooter';\n\nexport type DropdownMenuScrollViewportProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport const DropdownMenuScrollViewport = ({\n className,\n ...rest\n}: DropdownMenuScrollViewportProps) => {\n return <div {...rest} className={cx(styles.slotViewport, className)} />;\n};\n\nDropdownMenuScrollViewport.displayName = 'DropdownMenuScrollViewport';\n\nexport type DropdownMenuItemProps = React.ComponentProps<typeof Menu.Item> & { danger?: boolean };\n\nexport const DropdownMenuItem = ({ className, danger, ...rest }: DropdownMenuItemProps) => {\n return (\n <Menu.Item\n {...rest}\n className={(state) =>\n cx(\n styles.item,\n danger && styles.danger,\n typeof className === 'function' ? className(state) : className,\n )\n }\n />\n );\n};\n\nDropdownMenuItem.displayName = 'DropdownMenuItem';\n\nexport type DropdownMenuCheckboxItemProps = React.ComponentProps<typeof Menu.CheckboxItem> & {\n danger?: boolean;\n};\n\nexport const DropdownMenuCheckboxItemPrimitive = ({\n className,\n danger,\n ...rest\n}: DropdownMenuCheckboxItemProps) => {\n return (\n <Menu.CheckboxItem\n {...rest}\n className={(state) =>\n cx(\n styles.item,\n danger && styles.danger,\n typeof className === 'function' ? className(state) : className,\n )\n }\n />\n );\n};\n\nDropdownMenuCheckboxItemPrimitive.displayName = 'DropdownMenuCheckboxItemPrimitive';\n\nexport type DropdownMenuSeparatorProps = React.ComponentProps<typeof Menu.Separator>;\n\nexport const DropdownMenuSeparator = ({ className, ...rest }: DropdownMenuSeparatorProps) => {\n return (\n <Menu.Separator\n {...rest}\n className={(state) =>\n cx(styles.separator, typeof className === 'function' ? className(state) : className)\n }\n />\n );\n};\n\nDropdownMenuSeparator.displayName = 'DropdownMenuSeparator';\n\nexport const DropdownMenuGroup = Menu.Group;\n\nexport type DropdownMenuGroupLabelProps = React.ComponentProps<typeof Menu.GroupLabel>;\n\nexport const DropdownMenuGroupLabel = ({ className, ...rest }: DropdownMenuGroupLabelProps) => {\n return (\n <Menu.GroupLabel\n {...rest}\n className={(state) =>\n cx(styles.groupLabel, typeof className === 'function' ? className(state) : className)\n }\n />\n );\n};\n\nDropdownMenuGroupLabel.displayName = 'DropdownMenuGroupLabel';\n\nexport type DropdownMenuSubmenuTriggerProps = React.ComponentProps<typeof Menu.SubmenuTrigger> & {\n danger?: boolean;\n};\n\nexport const DropdownMenuSubmenuTrigger = ({\n className,\n danger,\n ...rest\n}: DropdownMenuSubmenuTriggerProps) => {\n return (\n <Menu.SubmenuTrigger\n {...rest}\n className={(state) =>\n cx(\n styles.item,\n danger && styles.danger,\n typeof className === 'function' ? className(state) : className,\n )\n }\n />\n );\n};\n\nDropdownMenuSubmenuTrigger.displayName = 'DropdownMenuSubmenuTrigger';\n\nexport type DropdownMenuItemContentProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport const DropdownMenuItemContent = ({ className, ...rest }: DropdownMenuItemContentProps) => {\n return <div {...rest} className={cx(styles.itemContent, className)} />;\n};\n\nDropdownMenuItemContent.displayName = 'DropdownMenuItemContent';\n\nexport type DropdownMenuItemIconProps = React.HTMLAttributes<HTMLSpanElement>;\n\nexport const DropdownMenuItemIcon = ({ className, ...rest }: DropdownMenuItemIconProps) => {\n return <span {...rest} className={cx(styles.icon, className)} />;\n};\n\nDropdownMenuItemIcon.displayName = 'DropdownMenuItemIcon';\n\nexport type DropdownMenuItemLabelGroupProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport const DropdownMenuItemLabelGroup = ({\n className,\n ...rest\n}: DropdownMenuItemLabelGroupProps) => {\n return <div {...rest} className={cx(styles.labelGroup, className)} />;\n};\n\nDropdownMenuItemLabelGroup.displayName = 'DropdownMenuItemLabelGroup';\n\nexport type DropdownMenuItemLabelProps = React.HTMLAttributes<HTMLSpanElement>;\n\nexport const DropdownMenuItemLabel = ({ className, ...rest }: DropdownMenuItemLabelProps) => {\n return <span {...rest} className={cx(styles.label, className)} />;\n};\n\nDropdownMenuItemLabel.displayName = 'DropdownMenuItemLabel';\n\nexport type DropdownMenuItemDescProps = React.HTMLAttributes<HTMLSpanElement>;\n\nexport const DropdownMenuItemDesc = ({ className, ...rest }: DropdownMenuItemDescProps) => {\n return <span {...rest} className={cx(styles.desc, className)} />;\n};\n\nDropdownMenuItemDesc.displayName = 'DropdownMenuItemDesc';\n\nexport type DropdownMenuItemExtraProps = React.HTMLAttributes<HTMLSpanElement>;\n\nexport const DropdownMenuItemExtra = ({ className, ...rest }: DropdownMenuItemExtraProps) => {\n return <span {...rest} className={cx(styles.extra, className)} />;\n};\n\nDropdownMenuItemExtra.displayName = 'DropdownMenuItemExtra';\n\nexport type DropdownMenuSubmenuArrowProps = React.HTMLAttributes<HTMLSpanElement>;\n\nexport const DropdownMenuSubmenuArrow = ({ className, ...rest }: DropdownMenuSubmenuArrowProps) => {\n return <span {...rest} className={cx(styles.submenuArrow, className)} />;\n};\n\nDropdownMenuSubmenuArrow.displayName = 'DropdownMenuSubmenuArrow';\n\nexport type DropdownMenuSwitchItemProps = Omit<\n React.ComponentProps<typeof Menu.Item>,\n 'onClick'\n> & {\n checked?: boolean;\n closeOnClick?: boolean;\n danger?: boolean;\n defaultChecked?: boolean;\n onCheckedChange?: (checked: boolean) => void;\n};\n\nexport const DropdownMenuSwitchItem = ({\n checked: checkedProp,\n className,\n closeOnClick = false,\n danger,\n defaultChecked,\n disabled,\n onCheckedChange,\n children,\n ...rest\n}: DropdownMenuSwitchItemProps) => {\n const [internalChecked, setInternalChecked] = useState(defaultChecked ?? false);\n const isControlled = checkedProp !== undefined;\n const checked = isControlled ? checkedProp : internalChecked;\n\n const handleCheckedChange = useCallback(\n (newChecked: boolean) => {\n if (!isControlled) {\n setInternalChecked(newChecked);\n }\n onCheckedChange?.(newChecked);\n },\n [isControlled, onCheckedChange],\n );\n\n return (\n <Menu.Item\n {...rest}\n closeOnClick={closeOnClick}\n disabled={disabled}\n className={(state) =>\n cx(\n styles.item,\n danger && styles.danger,\n typeof className === 'function' ? className(state) : className,\n )\n }\n onClick={(e) => {\n e.preventDefault();\n if (!disabled) {\n handleCheckedChange(!checked);\n }\n }}\n >\n {children}\n <span\n style={{ display: 'inline-flex', marginInlineStart: 16 }}\n onFocus={(e) => e.stopPropagation()}\n >\n <Switch\n checked={checked}\n disabled={disabled}\n size=\"small\"\n tabIndex={-1}\n onChange={handleCheckedChange}\n onClick={(_, e) => e.stopPropagation()}\n />\n </span>\n </Menu.Item>\n );\n};\n\nDropdownMenuSwitchItem.displayName = 'DropdownMenuSwitchItem';\n"],"mappings":";;;;;;;;;;;;;;;;;AAqBA,MAAa,oBAAsC,UAAU,oBAACA,OAAK,MAAN;CAAW,OAAO;CAAO,GAAI;CAAS,CAAA;AACnG,MAAa,0BAA0BA,OAAK;AAC5C,MAAa,oCAAoCA,OAAK;AAEtD,MAAM,uBACJ,MACA,cACG;AACH,KAAI,OAAO,cAAc,WAAY,SAAQ,UAAkB,GAAG,MAAM,UAAU,MAAM,CAAC;AACzF,QAAO,GAAG,MAAM,UAAU;;AAU5B,MAAa,uBAAuB,EAClC,UACA,WACA,cACA,KAAK,SACL,GAAG,WAC2B;CAC9B,MAAM,EAAE,8BAA8B,yBAAyB,gBAAgB;EAC7E;EACA;EACD,CAAC;CAEF,MAAM,YAAY,UAAe;EAG/B,MAAM,uBAAuB;AAC3B,OAAI,6BAA8B,QAAO;GAEzC,MAAM,EAAE,MAAM,GAAG,cAAc;AAC/B,UAAO;MACL;EAEJ,MAAM,cAAc,WAAY,SAAiB,OAAO,cAAc;AACtE,SAAO,aAAa,UAAiB;GACnC,GAAG;GACH,WAAW,KAAK,WAAW,qBAAqB,WAAW,YAAY,UAAU;GACjF,KAAK,UAAU;IAAE,SAAiB;IAAM,MAAc;IAAK;IAAQ,CAAC;GACrE,CAAC;;AAGJ,KAAI,eAAe,SAAS,CAC1B,QAAO,oBAACA,OAAK,SAAN;EAAc,GAAI;EAAM,cAAc;EAAsB,QAAQ;EAAmB,CAAA;AAGhG,QACE,oBAACA,OAAK,SAAN;EACE,GAAI;EACJ,WAAW,KAAK,WA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sBAAsB,cAAc;AAIpC,MAAa,4BAA4B,EAAE,WAAW,GAAG,WAA0C;AACjG,QAAO,oBAAC,QAAD;EAAM,GAAI;EAAM,WAAW,GAAG,OAAO,cAAc,UAAU;EAAI,CAAA;;AAG1E,yBAAyB,cAAc;AAavC,MAAa,0BAA0B,EACrC,SAAS,aACT,WACA,eAAe,OACf,QACA,gBACA,UACA,iBACA,UACA,GAAG,WAC8B;CACjC,MAAM,CAAC,iBAAiB,sBAAsB,SAAS,kBAAkB,MAAM;CAC/E,MAAM,eAAe,gBAAgB,KAAA;CACrC,MAAM,UAAU,eAAe,cAAc;CAE7C,MAAM,sBAAsB,aACzB,eAAwB;AACvB,MAAI,CAAC,aACH,oBAAmB,WAAW;AAEhC,oBAAkB,WAAW;IAE/B,CAAC,cAAc,gBAAgB,CAChC;AAED,QACE,qBAACA,OAAK,MAAN;EACE,GAAI;EACU;EACJ;EACV,YAAY,UACV,GACE,OAAO,MACP,UAAU,OAAO,QACjB,OAAO,cAAc,aAAa,UAAU,MAAM,GAAG,UACtD;EAEH,UAAU,MAAM;AACd,KAAE,gBAAgB;AAClB,OAAI,CAAC,SACH,qBAAoB,CAAC,QAAQ;;YAdnC,CAkBG,UACD,oBAAC,QAAD;GACE,OAAO;IAAE,SAAS;IAAe,mBAAmB;IAAI;GACxD,UAAU,MAAM,EAAE,iBAAiB;aAEnC,oBAAC,QAAD;IACW;IACC;IACV,MAAK;IACL,UAAU;IACV,UAAU;IACV,UAAU,GAAG,MAAM,EAAE,iBAAiB;IACtC,CAAA;GACG,CAAA,CACG;;;AAIhB,uBAAuB,cAAc"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IconSpaceMode } from "../../Menu/renderUtils.mjs";
|
|
2
2
|
import { renderDropdownMenuItems } from "./renderItems.mjs";
|
|
3
3
|
import { DropdownItem, DropdownMenuCheckboxItem, DropdownMenuPlacement, DropdownMenuProps, DropdownMenuSwitchItem } from "./type.mjs";
|
|
4
|
-
import { DropdownMenuCheckboxItemIndicator, DropdownMenuCheckboxItemPrimitive, DropdownMenuCheckboxItemProps, DropdownMenuGroup, DropdownMenuGroupLabel, DropdownMenuGroupLabelProps, DropdownMenuItem, DropdownMenuItemContent, DropdownMenuItemContentProps, DropdownMenuItemDesc, DropdownMenuItemDescProps, DropdownMenuItemExtra, DropdownMenuItemExtraProps, DropdownMenuItemIcon, DropdownMenuItemIconProps, DropdownMenuItemLabel, DropdownMenuItemLabelGroup, DropdownMenuItemLabelGroupProps, DropdownMenuItemLabelProps, DropdownMenuItemProps, DropdownMenuPopup, DropdownMenuPopupProps, DropdownMenuPortal, DropdownMenuPortalProps, DropdownMenuPositioner, DropdownMenuPositionerProps, DropdownMenuRoot, DropdownMenuSeparator, DropdownMenuSeparatorProps, DropdownMenuSubmenuArrow, DropdownMenuSubmenuArrowProps, DropdownMenuSubmenuRoot, DropdownMenuSubmenuTrigger, DropdownMenuSubmenuTriggerProps, DropdownMenuSwitchItem as DropdownMenuSwitchItem$1, DropdownMenuSwitchItemProps, DropdownMenuTrigger, DropdownMenuTriggerProps } from "./atoms.mjs";
|
|
4
|
+
import { DropdownMenuCheckboxItemIndicator, DropdownMenuCheckboxItemPrimitive, DropdownMenuCheckboxItemProps, DropdownMenuFooter, DropdownMenuFooterProps, DropdownMenuGroup, DropdownMenuGroupLabel, DropdownMenuGroupLabelProps, DropdownMenuHeader, DropdownMenuHeaderProps, DropdownMenuItem, DropdownMenuItemContent, DropdownMenuItemContentProps, DropdownMenuItemDesc, DropdownMenuItemDescProps, DropdownMenuItemExtra, DropdownMenuItemExtraProps, DropdownMenuItemIcon, DropdownMenuItemIconProps, DropdownMenuItemLabel, DropdownMenuItemLabelGroup, DropdownMenuItemLabelGroupProps, DropdownMenuItemLabelProps, DropdownMenuItemProps, DropdownMenuPopup, DropdownMenuPopupProps, DropdownMenuPortal, DropdownMenuPortalProps, DropdownMenuPositioner, DropdownMenuPositionerProps, DropdownMenuRoot, DropdownMenuScrollViewport, DropdownMenuScrollViewportProps, DropdownMenuSeparator, DropdownMenuSeparatorProps, DropdownMenuSubmenuArrow, DropdownMenuSubmenuArrowProps, DropdownMenuSubmenuRoot, DropdownMenuSubmenuTrigger, DropdownMenuSubmenuTriggerProps, DropdownMenuSwitchItem as DropdownMenuSwitchItem$1, DropdownMenuSwitchItemProps, DropdownMenuTrigger, DropdownMenuTriggerProps } from "./atoms.mjs";
|
|
5
5
|
import { DropdownMenu } from "./DropdownMenu.mjs";
|
|
@@ -14,6 +14,14 @@ type DropdownMenuSwitchItem = MenuSwitchItemType;
|
|
|
14
14
|
type DropdownItem = BaseMenuItemType;
|
|
15
15
|
interface DropdownMenuProps<Payload = unknown> extends Omit<MenuRootProps<Payload>, 'children'> {
|
|
16
16
|
children: ReactNode;
|
|
17
|
+
/**
|
|
18
|
+
* 底部固定插槽,渲染于可滚动的 items 区域下方,自带分隔边框
|
|
19
|
+
*/
|
|
20
|
+
footer?: ReactNode;
|
|
21
|
+
/**
|
|
22
|
+
* 顶部固定插槽,渲染于可滚动的 items 区域上方,自带分隔边框
|
|
23
|
+
*/
|
|
24
|
+
header?: ReactNode;
|
|
17
25
|
/**
|
|
18
26
|
* 图标与 label+desc 的垂直对齐方式
|
|
19
27
|
* - 'center': 图标垂直居中(默认)
|
package/es/base-ui/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IconSpaceMode } from "../Menu/renderUtils.mjs";
|
|
2
2
|
import { renderDropdownMenuItems } from "./DropdownMenu/renderItems.mjs";
|
|
3
3
|
import { DropdownItem, DropdownMenuCheckboxItem, DropdownMenuPlacement, DropdownMenuProps, DropdownMenuSwitchItem as DropdownMenuSwitchItem$1 } from "./DropdownMenu/type.mjs";
|
|
4
|
-
import { DropdownMenuCheckboxItemIndicator, DropdownMenuCheckboxItemPrimitive, DropdownMenuCheckboxItemProps, DropdownMenuGroup, DropdownMenuGroupLabel, DropdownMenuGroupLabelProps, DropdownMenuItem, DropdownMenuItemContent, DropdownMenuItemContentProps, DropdownMenuItemDesc, DropdownMenuItemDescProps, DropdownMenuItemExtra, DropdownMenuItemExtraProps, DropdownMenuItemIcon, DropdownMenuItemIconProps, DropdownMenuItemLabel, DropdownMenuItemLabelGroup, DropdownMenuItemLabelGroupProps, DropdownMenuItemLabelProps, DropdownMenuItemProps, DropdownMenuPopup, DropdownMenuPopupProps, DropdownMenuPortal, DropdownMenuPortalProps, DropdownMenuPositioner, DropdownMenuPositionerProps, DropdownMenuRoot, DropdownMenuSeparator, DropdownMenuSeparatorProps, DropdownMenuSubmenuArrow, DropdownMenuSubmenuArrowProps, DropdownMenuSubmenuRoot, DropdownMenuSubmenuTrigger, DropdownMenuSubmenuTriggerProps, DropdownMenuSwitchItem, DropdownMenuSwitchItemProps, DropdownMenuTrigger, DropdownMenuTriggerProps } from "./DropdownMenu/atoms.mjs";
|
|
4
|
+
import { DropdownMenuCheckboxItemIndicator, DropdownMenuCheckboxItemPrimitive, DropdownMenuCheckboxItemProps, DropdownMenuFooter, DropdownMenuFooterProps, DropdownMenuGroup, DropdownMenuGroupLabel, DropdownMenuGroupLabelProps, DropdownMenuHeader, DropdownMenuHeaderProps, DropdownMenuItem, DropdownMenuItemContent, DropdownMenuItemContentProps, DropdownMenuItemDesc, DropdownMenuItemDescProps, DropdownMenuItemExtra, DropdownMenuItemExtraProps, DropdownMenuItemIcon, DropdownMenuItemIconProps, DropdownMenuItemLabel, DropdownMenuItemLabelGroup, DropdownMenuItemLabelGroupProps, DropdownMenuItemLabelProps, DropdownMenuItemProps, DropdownMenuPopup, DropdownMenuPopupProps, DropdownMenuPortal, DropdownMenuPortalProps, DropdownMenuPositioner, DropdownMenuPositionerProps, DropdownMenuRoot, DropdownMenuScrollViewport, DropdownMenuScrollViewportProps, DropdownMenuSeparator, DropdownMenuSeparatorProps, DropdownMenuSubmenuArrow, DropdownMenuSubmenuArrowProps, DropdownMenuSubmenuRoot, DropdownMenuSubmenuTrigger, DropdownMenuSubmenuTriggerProps, DropdownMenuSwitchItem, DropdownMenuSwitchItemProps, DropdownMenuTrigger, DropdownMenuTriggerProps } from "./DropdownMenu/atoms.mjs";
|
|
5
5
|
import { DropdownMenu } from "./DropdownMenu/DropdownMenu.mjs";
|
|
6
6
|
import { ContextMenuCheckboxItem, ContextMenuItem } from "./ContextMenu/type.mjs";
|
|
7
7
|
import { ContextMenuTrigger } from "./ContextMenu/ContextMenuTrigger.mjs";
|
|
@@ -34,4 +34,4 @@ import { SwitchChangeEventHandler, SwitchClassNames, SwitchClickEventHandler, Sw
|
|
|
34
34
|
import { styles } from "./Switch/style.mjs";
|
|
35
35
|
import { SwitchIcon, SwitchRoot, SwitchThumb, useSwitchContext } from "./Switch/atoms.mjs";
|
|
36
36
|
import { Switch } from "./Switch/Switch.mjs";
|
|
37
|
-
export { BaseModalProps, type ContextMenuCheckboxItem, ContextMenuHost, type ContextMenuItem, ContextMenuTrigger, DropdownItem, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuCheckboxItemIndicator, DropdownMenuCheckboxItemPrimitive, DropdownMenuCheckboxItemProps, DropdownMenuGroup, DropdownMenuGroupLabel, DropdownMenuGroupLabelProps, DropdownMenuItem, DropdownMenuItemContent, DropdownMenuItemContentProps, DropdownMenuItemDesc, DropdownMenuItemDescProps, DropdownMenuItemExtra, DropdownMenuItemExtraProps, DropdownMenuItemIcon, DropdownMenuItemIconProps, DropdownMenuItemLabel, DropdownMenuItemLabelGroup, DropdownMenuItemLabelGroupProps, DropdownMenuItemLabelProps, DropdownMenuItemProps, DropdownMenuPlacement, DropdownMenuPopup, DropdownMenuPopupProps, DropdownMenuPortal, DropdownMenuPortalProps, DropdownMenuPositioner, DropdownMenuPositionerProps, DropdownMenuProps, DropdownMenuRoot, DropdownMenuSeparator, DropdownMenuSeparatorProps, DropdownMenuSubmenuArrow, DropdownMenuSubmenuArrowProps, DropdownMenuSubmenuRoot, DropdownMenuSubmenuTrigger, DropdownMenuSubmenuTriggerProps, DropdownMenuSwitchItem, DropdownMenuSwitchItemProps, DropdownMenuSwitchItem$1 as DropdownMenuSwitchItemType, DropdownMenuTrigger, DropdownMenuTriggerProps, FloatingSheet, FloatingSheetProps, IconSpaceMode, ImperativeModalProps, Modal, ModalBackdrop, ModalBackdropProps, ModalClose, ModalCloseProps, ModalComponentProps, ModalConfirmConfig, ModalContent, ModalContentProps, ModalContext, ModalContextValue, ModalDescription, ModalDescriptionProps, ModalFooter, ModalFooterProps, ModalHeader, ModalHeaderProps, ModalHost, ModalHostProps, ModalInstance, ModalPopup, ModalPopupProps, ModalPortal, ModalPortalProps, ModalRoot, ModalRootProps, ModalSystem, ModalTitle, ModalTitleProps, ModalTrigger, ModalTriggerProps, ModalViewport, ModalViewportProps, PopoverArrow, PopoverArrowAtomProps, PopoverArrowIcon, PopoverBackdrop, PopoverBackdropProps, PopoverContextValue, PopoverGroup, PopoverPlacement, PopoverPopup, PopoverPopupAtomProps, PopoverPopupProps, PopoverPortal, PopoverPortalAtomProps, PopoverPortalProps, PopoverPositioner, PopoverPositionerAtomProps, PopoverPositionerProps, PopoverProps, PopoverProvider, PopoverRoot, PopoverTrigger, PopoverTriggerComponentProps, PopoverTriggerElement, PopoverTriggerElementProps, PopoverViewport, PopoverViewportAtomProps, ScrollArea, ScrollAreaContent, ScrollAreaContentProps, ScrollAreaCorner, ScrollAreaCornerProps, ScrollAreaProps, ScrollAreaRoot, ScrollAreaRootProps, ScrollAreaScrollbar, ScrollAreaScrollbarProps, ScrollAreaThumb, ScrollAreaThumbProps, ScrollAreaViewport, ScrollAreaViewportProps, Select, SelectArrow, SelectArrowProps, SelectBackdrop, SelectBehaviorVariant, SelectClassNames, SelectGroup, SelectGroupLabel, SelectGroupLabelProps, SelectGroupProps, SelectIcon, SelectIconProps, SelectIndicatorVariant, SelectItem, SelectItemIndicator, SelectItemIndicatorProps, SelectItemProps, SelectItemText, SelectItemTextProps, SelectList, SelectListProps, SelectOption, SelectOptionGroup, SelectOptions, SelectPopup, SelectPopupProps, SelectPortal, SelectPortalProps, SelectPositioner, SelectPositionerProps, SelectProps, SelectRoot, SelectRootChangeEventDetails, SelectScrollDownArrow, SelectScrollDownArrowProps, SelectScrollUpArrow, SelectScrollUpArrowProps, SelectSeparator, SelectSize, SelectTrigger, SelectTriggerProps, SelectValue, SelectValueProps, SelectVariant, Switch, SwitchChangeEventHandler, SwitchClassNames, SwitchClickEventHandler, SwitchContextType, SwitchIcon, SwitchIconPosition, SwitchIconProps, SwitchProps, SwitchRoot, SwitchRootProps, SwitchSize, SwitchStyles, SwitchThumb, SwitchThumbProps, type ToastAPI, ToastHost, type ToastHostProps, type ToastInstance, type ToastOptions, type ToastPosition, type ToastPromiseOptions, type ToastProps, type ToastType, backdropTransition, closeContextMenu, confirmModal, createModal, createModalSystem, modalMotionConfig, parseTrigger, renderDropdownMenuItems, showContextMenu, styles as switchStyles, toast, updateContextMenuItems, useModalActions, useModalContext, useModalOpen, usePopoverContext, usePopoverPortalContainer, useSwitchContext, useToast };
|
|
37
|
+
export { BaseModalProps, type ContextMenuCheckboxItem, ContextMenuHost, type ContextMenuItem, ContextMenuTrigger, DropdownItem, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuCheckboxItemIndicator, DropdownMenuCheckboxItemPrimitive, DropdownMenuCheckboxItemProps, DropdownMenuFooter, DropdownMenuFooterProps, DropdownMenuGroup, DropdownMenuGroupLabel, DropdownMenuGroupLabelProps, DropdownMenuHeader, DropdownMenuHeaderProps, DropdownMenuItem, DropdownMenuItemContent, DropdownMenuItemContentProps, DropdownMenuItemDesc, DropdownMenuItemDescProps, DropdownMenuItemExtra, DropdownMenuItemExtraProps, DropdownMenuItemIcon, DropdownMenuItemIconProps, DropdownMenuItemLabel, DropdownMenuItemLabelGroup, DropdownMenuItemLabelGroupProps, DropdownMenuItemLabelProps, DropdownMenuItemProps, DropdownMenuPlacement, DropdownMenuPopup, DropdownMenuPopupProps, DropdownMenuPortal, DropdownMenuPortalProps, DropdownMenuPositioner, DropdownMenuPositionerProps, DropdownMenuProps, DropdownMenuRoot, DropdownMenuScrollViewport, DropdownMenuScrollViewportProps, DropdownMenuSeparator, DropdownMenuSeparatorProps, DropdownMenuSubmenuArrow, DropdownMenuSubmenuArrowProps, DropdownMenuSubmenuRoot, DropdownMenuSubmenuTrigger, DropdownMenuSubmenuTriggerProps, DropdownMenuSwitchItem, DropdownMenuSwitchItemProps, DropdownMenuSwitchItem$1 as DropdownMenuSwitchItemType, DropdownMenuTrigger, DropdownMenuTriggerProps, FloatingSheet, FloatingSheetProps, IconSpaceMode, ImperativeModalProps, Modal, ModalBackdrop, ModalBackdropProps, ModalClose, ModalCloseProps, ModalComponentProps, ModalConfirmConfig, ModalContent, ModalContentProps, ModalContext, ModalContextValue, ModalDescription, ModalDescriptionProps, ModalFooter, ModalFooterProps, ModalHeader, ModalHeaderProps, ModalHost, ModalHostProps, ModalInstance, ModalPopup, ModalPopupProps, ModalPortal, ModalPortalProps, ModalRoot, ModalRootProps, ModalSystem, ModalTitle, ModalTitleProps, ModalTrigger, ModalTriggerProps, ModalViewport, ModalViewportProps, PopoverArrow, PopoverArrowAtomProps, PopoverArrowIcon, PopoverBackdrop, PopoverBackdropProps, PopoverContextValue, PopoverGroup, PopoverPlacement, PopoverPopup, PopoverPopupAtomProps, PopoverPopupProps, PopoverPortal, PopoverPortalAtomProps, PopoverPortalProps, PopoverPositioner, PopoverPositionerAtomProps, PopoverPositionerProps, PopoverProps, PopoverProvider, PopoverRoot, PopoverTrigger, PopoverTriggerComponentProps, PopoverTriggerElement, PopoverTriggerElementProps, PopoverViewport, PopoverViewportAtomProps, ScrollArea, ScrollAreaContent, ScrollAreaContentProps, ScrollAreaCorner, ScrollAreaCornerProps, ScrollAreaProps, ScrollAreaRoot, ScrollAreaRootProps, ScrollAreaScrollbar, ScrollAreaScrollbarProps, ScrollAreaThumb, ScrollAreaThumbProps, ScrollAreaViewport, ScrollAreaViewportProps, Select, SelectArrow, SelectArrowProps, SelectBackdrop, SelectBehaviorVariant, SelectClassNames, SelectGroup, SelectGroupLabel, SelectGroupLabelProps, SelectGroupProps, SelectIcon, SelectIconProps, SelectIndicatorVariant, SelectItem, SelectItemIndicator, SelectItemIndicatorProps, SelectItemProps, SelectItemText, SelectItemTextProps, SelectList, SelectListProps, SelectOption, SelectOptionGroup, SelectOptions, SelectPopup, SelectPopupProps, SelectPortal, SelectPortalProps, SelectPositioner, SelectPositionerProps, SelectProps, SelectRoot, SelectRootChangeEventDetails, SelectScrollDownArrow, SelectScrollDownArrowProps, SelectScrollUpArrow, SelectScrollUpArrowProps, SelectSeparator, SelectSize, SelectTrigger, SelectTriggerProps, SelectValue, SelectValueProps, SelectVariant, Switch, SwitchChangeEventHandler, SwitchClassNames, SwitchClickEventHandler, SwitchContextType, SwitchIcon, SwitchIconPosition, SwitchIconProps, SwitchProps, SwitchRoot, SwitchRootProps, SwitchSize, SwitchStyles, SwitchThumb, SwitchThumbProps, type ToastAPI, ToastHost, type ToastHostProps, type ToastInstance, type ToastOptions, type ToastPosition, type ToastPromiseOptions, type ToastProps, type ToastType, backdropTransition, closeContextMenu, confirmModal, createModal, createModalSystem, modalMotionConfig, parseTrigger, renderDropdownMenuItems, showContextMenu, styles as switchStyles, toast, updateContextMenuItems, useModalActions, useModalContext, useModalOpen, usePopoverContext, usePopoverPortalContainer, useSwitchContext, useToast };
|
package/es/base-ui/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DropdownMenuCheckboxItemIndicator, DropdownMenuCheckboxItemPrimitive, DropdownMenuGroup, DropdownMenuGroupLabel, DropdownMenuItem, DropdownMenuItemContent, DropdownMenuItemDesc, DropdownMenuItemExtra, DropdownMenuItemIcon, DropdownMenuItemLabel, DropdownMenuItemLabelGroup, DropdownMenuPopup, DropdownMenuPortal, DropdownMenuPositioner, DropdownMenuRoot, DropdownMenuSeparator, DropdownMenuSubmenuArrow, DropdownMenuSubmenuRoot, DropdownMenuSubmenuTrigger, DropdownMenuSwitchItem, DropdownMenuTrigger } from "./DropdownMenu/atoms.mjs";
|
|
1
|
+
import { DropdownMenuCheckboxItemIndicator, DropdownMenuCheckboxItemPrimitive, DropdownMenuFooter, DropdownMenuGroup, DropdownMenuGroupLabel, DropdownMenuHeader, DropdownMenuItem, DropdownMenuItemContent, DropdownMenuItemDesc, DropdownMenuItemExtra, DropdownMenuItemIcon, DropdownMenuItemLabel, DropdownMenuItemLabelGroup, DropdownMenuPopup, DropdownMenuPortal, DropdownMenuPositioner, DropdownMenuRoot, DropdownMenuScrollViewport, DropdownMenuSeparator, DropdownMenuSubmenuArrow, DropdownMenuSubmenuRoot, DropdownMenuSubmenuTrigger, DropdownMenuSwitchItem, DropdownMenuTrigger } from "./DropdownMenu/atoms.mjs";
|
|
2
2
|
import { parseTrigger } from "../utils/parseTrigger.mjs";
|
|
3
3
|
import { renderDropdownMenuItems } from "./DropdownMenu/renderItems.mjs";
|
|
4
4
|
import DropdownMenu from "./DropdownMenu/DropdownMenu.mjs";
|
|
@@ -24,4 +24,4 @@ import Select from "./Select/Select.mjs";
|
|
|
24
24
|
import { styles } from "./Switch/style.mjs";
|
|
25
25
|
import { SwitchIcon, SwitchRoot, SwitchThumb, useSwitchContext } from "./Switch/atoms.mjs";
|
|
26
26
|
import Switch from "./Switch/Switch.mjs";
|
|
27
|
-
export { ContextMenuHost, ContextMenuTrigger, DropdownMenu, DropdownMenuCheckboxItemIndicator, DropdownMenuCheckboxItemPrimitive, DropdownMenuGroup, DropdownMenuGroupLabel, DropdownMenuItem, DropdownMenuItemContent, DropdownMenuItemDesc, DropdownMenuItemExtra, DropdownMenuItemIcon, DropdownMenuItemLabel, DropdownMenuItemLabelGroup, DropdownMenuPopup, DropdownMenuPortal, DropdownMenuPositioner, DropdownMenuRoot, DropdownMenuSeparator, DropdownMenuSubmenuArrow, DropdownMenuSubmenuRoot, DropdownMenuSubmenuTrigger, DropdownMenuSwitchItem, DropdownMenuTrigger, FloatingSheet, Modal, ModalBackdrop, ModalClose, ModalContent, ModalContext, ModalDescription, ModalFooter, ModalHeader, ModalHost, ModalPopup, ModalPortal, ModalRoot, ModalTitle, ModalTrigger, ModalViewport, PopoverArrow, PopoverArrowIcon, PopoverBackdrop, PopoverGroup, PopoverPopup, PopoverPortal, PopoverPositioner, PopoverProvider, PopoverRoot, PopoverTriggerElement, PopoverViewport, ScrollArea, ScrollAreaContent, ScrollAreaCorner, ScrollAreaRoot, ScrollAreaScrollbar, ScrollAreaThumb, ScrollAreaViewport, Select, SelectArrow, SelectBackdrop, SelectGroup, SelectGroupLabel, SelectIcon, SelectItem, SelectItemIndicator, SelectItemText, SelectList, SelectPopup, SelectPortal, SelectPositioner, SelectRoot, SelectScrollDownArrow, SelectScrollUpArrow, SelectSeparator, SelectTrigger, SelectValue, Switch, SwitchIcon, SwitchRoot, SwitchThumb, ToastHost, backdropTransition, closeContextMenu, confirmModal, createModal, createModalSystem, modalMotionConfig, parseTrigger, renderDropdownMenuItems, showContextMenu, styles as switchStyles, toast, updateContextMenuItems, useModalActions, useModalContext, useModalOpen, usePopoverContext, usePopoverPortalContainer, useSwitchContext, useToast };
|
|
27
|
+
export { ContextMenuHost, ContextMenuTrigger, DropdownMenu, DropdownMenuCheckboxItemIndicator, DropdownMenuCheckboxItemPrimitive, DropdownMenuFooter, DropdownMenuGroup, DropdownMenuGroupLabel, DropdownMenuHeader, DropdownMenuItem, DropdownMenuItemContent, DropdownMenuItemDesc, DropdownMenuItemExtra, DropdownMenuItemIcon, DropdownMenuItemLabel, DropdownMenuItemLabelGroup, DropdownMenuPopup, DropdownMenuPortal, DropdownMenuPositioner, DropdownMenuRoot, DropdownMenuScrollViewport, DropdownMenuSeparator, DropdownMenuSubmenuArrow, DropdownMenuSubmenuRoot, DropdownMenuSubmenuTrigger, DropdownMenuSwitchItem, DropdownMenuTrigger, FloatingSheet, Modal, ModalBackdrop, ModalClose, ModalContent, ModalContext, ModalDescription, ModalFooter, ModalHeader, ModalHost, ModalPopup, ModalPortal, ModalRoot, ModalTitle, ModalTrigger, ModalViewport, PopoverArrow, PopoverArrowIcon, PopoverBackdrop, PopoverGroup, PopoverPopup, PopoverPortal, PopoverPositioner, PopoverProvider, PopoverRoot, PopoverTriggerElement, PopoverViewport, ScrollArea, ScrollAreaContent, ScrollAreaCorner, ScrollAreaRoot, ScrollAreaScrollbar, ScrollAreaThumb, ScrollAreaViewport, Select, SelectArrow, SelectBackdrop, SelectGroup, SelectGroupLabel, SelectIcon, SelectItem, SelectItemIndicator, SelectItemText, SelectList, SelectPopup, SelectPortal, SelectPositioner, SelectRoot, SelectScrollDownArrow, SelectScrollUpArrow, SelectSeparator, SelectTrigger, SelectValue, Switch, SwitchIcon, SwitchRoot, SwitchThumb, ToastHost, backdropTransition, closeContextMenu, confirmModal, createModal, createModalSystem, modalMotionConfig, parseTrigger, renderDropdownMenuItems, showContextMenu, styles as switchStyles, toast, updateContextMenuItems, useModalActions, useModalContext, useModalOpen, usePopoverContext, usePopoverPortalContainer, useSwitchContext, useToast };
|
package/es/index.d.mts
CHANGED
|
@@ -29,7 +29,7 @@ import { BaseMenuItemType } from "./Menu/baseItem.mjs";
|
|
|
29
29
|
import { Menu } from "./Menu/Menu.mjs";
|
|
30
30
|
import { renderDropdownMenuItems } from "./base-ui/DropdownMenu/renderItems.mjs";
|
|
31
31
|
import { DropdownItem, DropdownMenuCheckboxItem, DropdownMenuPlacement, DropdownMenuProps } from "./base-ui/DropdownMenu/type.mjs";
|
|
32
|
-
import { DropdownMenuCheckboxItemIndicator, DropdownMenuCheckboxItemPrimitive, DropdownMenuGroup, DropdownMenuGroupLabel, DropdownMenuGroupLabelProps, DropdownMenuItem, DropdownMenuItemContent, DropdownMenuItemContentProps, DropdownMenuItemExtra, DropdownMenuItemExtraProps, DropdownMenuItemIcon, DropdownMenuItemIconProps, DropdownMenuItemLabel, DropdownMenuItemLabelProps, DropdownMenuItemProps, DropdownMenuPopup, DropdownMenuPopupProps, DropdownMenuPortal, DropdownMenuPortalProps, DropdownMenuPositioner, DropdownMenuPositionerProps, DropdownMenuRoot, DropdownMenuSeparator, DropdownMenuSeparatorProps, DropdownMenuSubmenuArrow, DropdownMenuSubmenuArrowProps, DropdownMenuSubmenuRoot, DropdownMenuSubmenuTrigger, DropdownMenuSubmenuTriggerProps, DropdownMenuTrigger, DropdownMenuTriggerProps } from "./base-ui/DropdownMenu/atoms.mjs";
|
|
32
|
+
import { DropdownMenuCheckboxItemIndicator, DropdownMenuCheckboxItemPrimitive, DropdownMenuFooter, DropdownMenuFooterProps, DropdownMenuGroup, DropdownMenuGroupLabel, DropdownMenuGroupLabelProps, DropdownMenuHeader, DropdownMenuHeaderProps, DropdownMenuItem, DropdownMenuItemContent, DropdownMenuItemContentProps, DropdownMenuItemExtra, DropdownMenuItemExtraProps, DropdownMenuItemIcon, DropdownMenuItemIconProps, DropdownMenuItemLabel, DropdownMenuItemLabelProps, DropdownMenuItemProps, DropdownMenuPopup, DropdownMenuPopupProps, DropdownMenuPortal, DropdownMenuPortalProps, DropdownMenuPositioner, DropdownMenuPositionerProps, DropdownMenuRoot, DropdownMenuScrollViewport, DropdownMenuScrollViewportProps, DropdownMenuSeparator, DropdownMenuSeparatorProps, DropdownMenuSubmenuArrow, DropdownMenuSubmenuArrowProps, DropdownMenuSubmenuRoot, DropdownMenuSubmenuTrigger, DropdownMenuSubmenuTriggerProps, DropdownMenuTrigger, DropdownMenuTriggerProps } from "./base-ui/DropdownMenu/atoms.mjs";
|
|
33
33
|
import { DropdownMenu } from "./base-ui/DropdownMenu/DropdownMenu.mjs";
|
|
34
34
|
import { ActionIconGroupEvent, ActionIconGroupProps } from "./ActionIconGroup/type.mjs";
|
|
35
35
|
import { ActionIconGroup } from "./ActionIconGroup/ActionIconGroup.mjs";
|
|
@@ -241,4 +241,4 @@ import { LayoutSidebarInner } from "./Layout/components/LayoutSidebarInner.mjs";
|
|
|
241
241
|
import { LayoutToc } from "./Layout/components/LayoutToc.mjs";
|
|
242
242
|
import Layout from "./Layout/index.mjs";
|
|
243
243
|
import { ErrorBoundary, ErrorBoundaryProps } from "react-error-boundary";
|
|
244
|
-
export { A, AProps, Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, ActionIcon, ActionIconGroup, type ActionIconGroupEvent, type MenuItemType as ActionIconGroupItemType, type ActionIconGroupProps, type ActionIconProps, type ActionIconSize, Alert, type AlertProps, AutoComplete, type AutoCompleteProps, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, type BaseMenuItemType, Block, type BlockProps, Burger, type BurgerProps, Button, type ButtonProps, type CDN, CLASSNAMES, Center, type CenterProps, Checkbox, CheckboxGroup, type CheckboxGroupOption, type CheckboxGroupProps, type CheckboxProps, CodeDiff, type CodeDiffProps, CodeEditor, type CodeEditorProps, Collapse, type CollapseItemType, type CollapseProps, ColorPalettes, ColorPalettesAlpha, ColorSwatches, type ColorSwatchesProps, ColorToken, type Config, ConfigProvider, type ContextMenuCheckboxItem, ContextMenuHost, type ContextMenuItem, ContextMenuTrigger, CopyButton, type CopyButtonProps, DatePicker, type DatePickerProps, type DiffViewMode, DivProps, DownloadButton, type DownloadButtonProps, DraggablePanel, DraggablePanelBody, type DraggablePanelBodyProps, DraggablePanelContainer, type DraggablePanelContainerProps, DraggablePanelFooter, type DraggablePanelFooterProps, DraggablePanelHeader, type DraggablePanelHeaderProps, type DraggablePanelProps, DraggableSideNav, type DraggableSideNavProps, Drawer, type DrawerProps, Dropdown, type DropdownItem, DropdownMenu, type DropdownMenuCheckboxItem, DropdownMenuCheckboxItemIndicator, DropdownMenuCheckboxItemPrimitive, DropdownMenuGroup, DropdownMenuGroupLabel, type DropdownMenuGroupLabelProps, DropdownMenuItem, DropdownMenuItemContent, type DropdownMenuItemContentProps, DropdownMenuItemExtra, type DropdownMenuItemExtraProps, DropdownMenuItemIcon, type DropdownMenuItemIconProps, DropdownMenuItemLabel, type DropdownMenuItemLabelProps, type DropdownMenuItemProps, type MenuItemType as DropdownMenuItemType, type DropdownMenuPlacement, DropdownMenuPopup, type DropdownMenuPopupProps, DropdownMenuPortal, type DropdownMenuPortalProps, DropdownMenuPositioner, type DropdownMenuPositionerProps, type DropdownMenuProps, DropdownMenuRoot, DropdownMenuSeparator, type DropdownMenuSeparatorProps, DropdownMenuSubmenuArrow, type DropdownMenuSubmenuArrowProps, DropdownMenuSubmenuRoot, DropdownMenuSubmenuTrigger, type DropdownMenuSubmenuTriggerProps, DropdownMenuTrigger, type DropdownMenuTriggerProps, type DropdownProps, EditableText, type EditableTextProps, EditorSlashMenu, type EditorSlashMenuGroup, type EditorSlashMenuItems, type EditorSlashMenuOption, EmojiPicker, type EmojiPickerProps, Empty, type EmptyProps, ErrorBoundary, type ErrorBoundaryProps, FileTypeIcon, type FileTypeIconProps, _default as FlexBasic, type FlexBasicProps, _default as Flexbox, type FlexboxProps, FluentEmoji, type FluentEmojiProps, FontLoader, type FontLoaderProps, Footer, type FooterProps, Form, FormGroup, type FormGroupItemType, type FormGroupProps, type FormInstance, FormItem, type FormItemProps, FormModal, type FormModalProps, type FormProps, FormSubmitFooter, type FormSubmitFooterProps, FormTitle, type FormTitleProps, Freeze, type FreezeProps, type GenericItemType, Grid, type GridProps, GroupAvatar, type GroupAvatarProps, GuideCard, type GuideCardProps, DEFAULT_HEIGHT as HTML_PREVIEW_DEFAULT_HEIGHT, DEFAULT_SANDBOX as HTML_PREVIEW_DEFAULT_SANDBOX, AUTO_HEIGHT_MESSAGE_TYPE as HTML_PREVIEW_RESIZE_MESSAGE, Header, type HeaderProps, Highlighter, type HighlighterProps, Hotkey, HotkeyInput, type HotkeyInputProps, type HotkeyProps, HtmlPreview, HtmlPreviewIframe, type HtmlPreviewIframeProps, type HtmlPreviewMode, type HtmlPreviewProps, type HtmlPreviewStreamingMode, I18nProvider, type I18nProviderProps, Icon, type IconProps, IconProvider, type IconSize, Image, type ImageProps, ImageSelect, type ImageSelectItem, type ImageSelectProps, ImgProps, type ImperativeModalProps, Input, InputNumber, type InputNumberProps, InputOPT, type InputOPTProps, InputPassword, type InputPasswordProps, type InputProps, type ItemType, KeyMapEnum, LOBE_THEME_APP_ID, Layout, LayoutFooter, type LayoutFooterProps, LayoutHeader, type LayoutHeaderProps, LayoutMain, type LayoutMainProps, type LayoutProps, LayoutSidebar, LayoutSidebarInner, type LayoutSidebarInnerProps, type LayoutSidebarProps, LayoutToc, type LayoutTocProps, List, ListItem, type ListItemProps, type ListProps, LobeCustomStylish, LobeCustomToken, I18nProvider as LobeUIProvider, Markdown, type MarkdownProps, MaskShadow, type MaskShadowProps, MaterialFileTypeIcon, type MaterialFileTypeIconProps, Menu, type MenuCheckboxItemType, type MenuInfo, type MenuItemType, type MenuProps, Mermaid, type MermaidProps, Meta, type MetaProps, Modal, ModalHost, type ModalHostProps, type ModalInstance, type ModalProps, ModalProvider, MotionComponent, type MotionComponentType, MotionProvider, NeuralNetworkLoading, type NeuralNetworkLoadingProps, NeutralColors, NeutralColorsObj, PatchDiff, type PatchDiffProps, type Placement, type PlacementConfig, Popover, PopoverArrow, type PopoverArrowAtomProps, PopoverArrowIcon, PopoverBackdrop, type PopoverContextValue, PopoverGroup, type PopoverPlacement, PopoverPopup, type PopoverPopupAtomProps, PopoverPortal, type PopoverPortalAtomProps, PopoverPositioner, type PopoverPositionerAtomProps, type PopoverProps, PopoverProvider, PopoverRoot, type PopoverTrigger, PopoverTriggerElement, type PopoverTriggerElementProps, PopoverViewport, type PopoverViewportAtomProps, PresetColorKey, PresetColorType, PresetSystemColorKey, PresetSystemColorType, PreviewGroup, type PreviewGroupProps, PrimaryColors, PrimaryColorsObj, type RawModalComponent, type RawModalComponentProps, type RawModalInstance, type RawModalKeyOptions, type RawModalOptions, ScrollArea, ScrollAreaContent, ScrollAreaContentProps, ScrollAreaCorner, ScrollAreaCornerProps, ScrollAreaProps, ScrollAreaRoot, ScrollAreaRootProps, ScrollAreaScrollbar, ScrollAreaScrollbarProps, ScrollAreaThumb, ScrollAreaThumbProps, ScrollAreaViewport, ScrollAreaViewportProps, ScrollShadow, type ScrollShadowProps, SearchBar, type SearchBarProps, SearchResultCards, type SearchResultCardsProps, Segmented, type SegmentedProps, Select, type SelectProps, _default$1 as ShikiLobeTheme, SideNav, type SideNavProps, Skeleton, SkeletonAvatar, type SkeletonAvatarProps, SkeletonBlock, type SkeletonBlockProps, SkeletonButton, type SkeletonButtonProps, SkeletonParagraph, type SkeletonParagraphProps, type SkeletonProps, SkeletonTags, type SkeletonTagsProps, SkeletonTitle, type SkeletonTitleProps, SliderWithInput, type SliderWithInputProps, Snippet, type SnippetProps, SortableList, type SortableListProps, SpanProps, SvgProps, SyntaxHighlighter, type SyntaxHighlighterProps, SyntaxMermaid, type SyntaxMermaidProps, SystemColorToken, Tabs, type TabsProps, Tag, type TagProps, Text, TextArea, type TextAreaProps, type TextProps, ThemeProvider, type ThemeProviderProps, ThemeSwitch, type ThemeSwitchProps, type ToastAPI, ToastHost, type ToastHostProps, type ToastInstance, type ToastOptions, type ToastPosition, type ToastPromiseOptions, type ToastProps, type ToastType, Toc, type TocProps, Tooltip, TooltipGroup, type TooltipProps, Trigger, Typography, type TypographyProps, Video, type VideoProps, closeContextMenu, combineKeys, copyToClipboard, createModal, createRawModal, findCustomThemeName, genCdnUrl, generateColorNeutralPalette, generateColorPalette, highlighterThemes, containsScript as htmlPreviewContainsScript, isFullHtmlDocument, isHtmlContentClosed, generateCustomStylish as lobeCustomStylish, generateCustomToken as lobeCustomToken, staticStylish as lobeStaticStylish, styles as menuSharedStyles, mermaidThemes, neutralColors, neutralColorsSwatches, placementMap, preprocessMarkdownContent, preventDefault, preventDefaultAndStopPropagation, primaryColors, primaryColorsSwatches, rehypeCustomFootnotes, rehypeKatexDir, rehypeStreamAnimated, remarkBr, remarkColor, remarkCustomFootnotes, remarkGfmPlus, remarkVideo, renderDropdownMenuItems, showContextMenu, stopPropagation, toFloatingUIPlacement, toast, updateContextMenuItems, useAppElement, useCdnFn, useModalContext, useMotionComponent, usePopoverContext, usePopoverPortalContainer, useToast, useTranslation };
|
|
244
|
+
export { A, AProps, Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, ActionIcon, ActionIconGroup, type ActionIconGroupEvent, type MenuItemType as ActionIconGroupItemType, type ActionIconGroupProps, type ActionIconProps, type ActionIconSize, Alert, type AlertProps, AutoComplete, type AutoCompleteProps, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, type BaseMenuItemType, Block, type BlockProps, Burger, type BurgerProps, Button, type ButtonProps, type CDN, CLASSNAMES, Center, type CenterProps, Checkbox, CheckboxGroup, type CheckboxGroupOption, type CheckboxGroupProps, type CheckboxProps, CodeDiff, type CodeDiffProps, CodeEditor, type CodeEditorProps, Collapse, type CollapseItemType, type CollapseProps, ColorPalettes, ColorPalettesAlpha, ColorSwatches, type ColorSwatchesProps, ColorToken, type Config, ConfigProvider, type ContextMenuCheckboxItem, ContextMenuHost, type ContextMenuItem, ContextMenuTrigger, CopyButton, type CopyButtonProps, DatePicker, type DatePickerProps, type DiffViewMode, DivProps, DownloadButton, type DownloadButtonProps, DraggablePanel, DraggablePanelBody, type DraggablePanelBodyProps, DraggablePanelContainer, type DraggablePanelContainerProps, DraggablePanelFooter, type DraggablePanelFooterProps, DraggablePanelHeader, type DraggablePanelHeaderProps, type DraggablePanelProps, DraggableSideNav, type DraggableSideNavProps, Drawer, type DrawerProps, Dropdown, type DropdownItem, DropdownMenu, type DropdownMenuCheckboxItem, DropdownMenuCheckboxItemIndicator, DropdownMenuCheckboxItemPrimitive, DropdownMenuFooter, type DropdownMenuFooterProps, DropdownMenuGroup, DropdownMenuGroupLabel, type DropdownMenuGroupLabelProps, DropdownMenuHeader, type DropdownMenuHeaderProps, DropdownMenuItem, DropdownMenuItemContent, type DropdownMenuItemContentProps, DropdownMenuItemExtra, type DropdownMenuItemExtraProps, DropdownMenuItemIcon, type DropdownMenuItemIconProps, DropdownMenuItemLabel, type DropdownMenuItemLabelProps, type DropdownMenuItemProps, type MenuItemType as DropdownMenuItemType, type DropdownMenuPlacement, DropdownMenuPopup, type DropdownMenuPopupProps, DropdownMenuPortal, type DropdownMenuPortalProps, DropdownMenuPositioner, type DropdownMenuPositionerProps, type DropdownMenuProps, DropdownMenuRoot, DropdownMenuScrollViewport, type DropdownMenuScrollViewportProps, DropdownMenuSeparator, type DropdownMenuSeparatorProps, DropdownMenuSubmenuArrow, type DropdownMenuSubmenuArrowProps, DropdownMenuSubmenuRoot, DropdownMenuSubmenuTrigger, type DropdownMenuSubmenuTriggerProps, DropdownMenuTrigger, type DropdownMenuTriggerProps, type DropdownProps, EditableText, type EditableTextProps, EditorSlashMenu, type EditorSlashMenuGroup, type EditorSlashMenuItems, type EditorSlashMenuOption, EmojiPicker, type EmojiPickerProps, Empty, type EmptyProps, ErrorBoundary, type ErrorBoundaryProps, FileTypeIcon, type FileTypeIconProps, _default as FlexBasic, type FlexBasicProps, _default as Flexbox, type FlexboxProps, FluentEmoji, type FluentEmojiProps, FontLoader, type FontLoaderProps, Footer, type FooterProps, Form, FormGroup, type FormGroupItemType, type FormGroupProps, type FormInstance, FormItem, type FormItemProps, FormModal, type FormModalProps, type FormProps, FormSubmitFooter, type FormSubmitFooterProps, FormTitle, type FormTitleProps, Freeze, type FreezeProps, type GenericItemType, Grid, type GridProps, GroupAvatar, type GroupAvatarProps, GuideCard, type GuideCardProps, DEFAULT_HEIGHT as HTML_PREVIEW_DEFAULT_HEIGHT, DEFAULT_SANDBOX as HTML_PREVIEW_DEFAULT_SANDBOX, AUTO_HEIGHT_MESSAGE_TYPE as HTML_PREVIEW_RESIZE_MESSAGE, Header, type HeaderProps, Highlighter, type HighlighterProps, Hotkey, HotkeyInput, type HotkeyInputProps, type HotkeyProps, HtmlPreview, HtmlPreviewIframe, type HtmlPreviewIframeProps, type HtmlPreviewMode, type HtmlPreviewProps, type HtmlPreviewStreamingMode, I18nProvider, type I18nProviderProps, Icon, type IconProps, IconProvider, type IconSize, Image, type ImageProps, ImageSelect, type ImageSelectItem, type ImageSelectProps, ImgProps, type ImperativeModalProps, Input, InputNumber, type InputNumberProps, InputOPT, type InputOPTProps, InputPassword, type InputPasswordProps, type InputProps, type ItemType, KeyMapEnum, LOBE_THEME_APP_ID, Layout, LayoutFooter, type LayoutFooterProps, LayoutHeader, type LayoutHeaderProps, LayoutMain, type LayoutMainProps, type LayoutProps, LayoutSidebar, LayoutSidebarInner, type LayoutSidebarInnerProps, type LayoutSidebarProps, LayoutToc, type LayoutTocProps, List, ListItem, type ListItemProps, type ListProps, LobeCustomStylish, LobeCustomToken, I18nProvider as LobeUIProvider, Markdown, type MarkdownProps, MaskShadow, type MaskShadowProps, MaterialFileTypeIcon, type MaterialFileTypeIconProps, Menu, type MenuCheckboxItemType, type MenuInfo, type MenuItemType, type MenuProps, Mermaid, type MermaidProps, Meta, type MetaProps, Modal, ModalHost, type ModalHostProps, type ModalInstance, type ModalProps, ModalProvider, MotionComponent, type MotionComponentType, MotionProvider, NeuralNetworkLoading, type NeuralNetworkLoadingProps, NeutralColors, NeutralColorsObj, PatchDiff, type PatchDiffProps, type Placement, type PlacementConfig, Popover, PopoverArrow, type PopoverArrowAtomProps, PopoverArrowIcon, PopoverBackdrop, type PopoverContextValue, PopoverGroup, type PopoverPlacement, PopoverPopup, type PopoverPopupAtomProps, PopoverPortal, type PopoverPortalAtomProps, PopoverPositioner, type PopoverPositionerAtomProps, type PopoverProps, PopoverProvider, PopoverRoot, type PopoverTrigger, PopoverTriggerElement, type PopoverTriggerElementProps, PopoverViewport, type PopoverViewportAtomProps, PresetColorKey, PresetColorType, PresetSystemColorKey, PresetSystemColorType, PreviewGroup, type PreviewGroupProps, PrimaryColors, PrimaryColorsObj, type RawModalComponent, type RawModalComponentProps, type RawModalInstance, type RawModalKeyOptions, type RawModalOptions, ScrollArea, ScrollAreaContent, ScrollAreaContentProps, ScrollAreaCorner, ScrollAreaCornerProps, ScrollAreaProps, ScrollAreaRoot, ScrollAreaRootProps, ScrollAreaScrollbar, ScrollAreaScrollbarProps, ScrollAreaThumb, ScrollAreaThumbProps, ScrollAreaViewport, ScrollAreaViewportProps, ScrollShadow, type ScrollShadowProps, SearchBar, type SearchBarProps, SearchResultCards, type SearchResultCardsProps, Segmented, type SegmentedProps, Select, type SelectProps, _default$1 as ShikiLobeTheme, SideNav, type SideNavProps, Skeleton, SkeletonAvatar, type SkeletonAvatarProps, SkeletonBlock, type SkeletonBlockProps, SkeletonButton, type SkeletonButtonProps, SkeletonParagraph, type SkeletonParagraphProps, type SkeletonProps, SkeletonTags, type SkeletonTagsProps, SkeletonTitle, type SkeletonTitleProps, SliderWithInput, type SliderWithInputProps, Snippet, type SnippetProps, SortableList, type SortableListProps, SpanProps, SvgProps, SyntaxHighlighter, type SyntaxHighlighterProps, SyntaxMermaid, type SyntaxMermaidProps, SystemColorToken, Tabs, type TabsProps, Tag, type TagProps, Text, TextArea, type TextAreaProps, type TextProps, ThemeProvider, type ThemeProviderProps, ThemeSwitch, type ThemeSwitchProps, type ToastAPI, ToastHost, type ToastHostProps, type ToastInstance, type ToastOptions, type ToastPosition, type ToastPromiseOptions, type ToastProps, type ToastType, Toc, type TocProps, Tooltip, TooltipGroup, type TooltipProps, Trigger, Typography, type TypographyProps, Video, type VideoProps, closeContextMenu, combineKeys, copyToClipboard, createModal, createRawModal, findCustomThemeName, genCdnUrl, generateColorNeutralPalette, generateColorPalette, highlighterThemes, containsScript as htmlPreviewContainsScript, isFullHtmlDocument, isHtmlContentClosed, generateCustomStylish as lobeCustomStylish, generateCustomToken as lobeCustomToken, staticStylish as lobeStaticStylish, styles as menuSharedStyles, mermaidThemes, neutralColors, neutralColorsSwatches, placementMap, preprocessMarkdownContent, preventDefault, preventDefaultAndStopPropagation, primaryColors, primaryColorsSwatches, rehypeCustomFootnotes, rehypeKatexDir, rehypeStreamAnimated, remarkBr, remarkColor, remarkCustomFootnotes, remarkGfmPlus, remarkVideo, renderDropdownMenuItems, showContextMenu, stopPropagation, toFloatingUIPlacement, toast, updateContextMenuItems, useAppElement, useCdnFn, useModalContext, useMotionComponent, usePopoverContext, usePopoverPortalContainer, useToast, useTranslation };
|
package/es/index.mjs
CHANGED
|
@@ -30,7 +30,7 @@ import { preventDefault, preventDefaultAndStopPropagation, stopPropagation } fro
|
|
|
30
30
|
import AccordionItem from "./Accordion/AccordionItem.mjs";
|
|
31
31
|
import ActionIcon from "./ActionIcon/ActionIcon.mjs";
|
|
32
32
|
import { styles } from "./Menu/sharedStyle.mjs";
|
|
33
|
-
import { DropdownMenuCheckboxItemIndicator, DropdownMenuCheckboxItemPrimitive, DropdownMenuGroup, DropdownMenuGroupLabel, DropdownMenuItem, DropdownMenuItemContent, DropdownMenuItemExtra, DropdownMenuItemIcon, DropdownMenuItemLabel, DropdownMenuPopup, DropdownMenuPortal, DropdownMenuPositioner, DropdownMenuRoot, DropdownMenuSeparator, DropdownMenuSubmenuArrow, DropdownMenuSubmenuRoot, DropdownMenuSubmenuTrigger, DropdownMenuTrigger } from "./base-ui/DropdownMenu/atoms.mjs";
|
|
33
|
+
import { DropdownMenuCheckboxItemIndicator, DropdownMenuCheckboxItemPrimitive, DropdownMenuFooter, DropdownMenuGroup, DropdownMenuGroupLabel, DropdownMenuHeader, DropdownMenuItem, DropdownMenuItemContent, DropdownMenuItemExtra, DropdownMenuItemIcon, DropdownMenuItemLabel, DropdownMenuPopup, DropdownMenuPortal, DropdownMenuPositioner, DropdownMenuRoot, DropdownMenuScrollViewport, DropdownMenuSeparator, DropdownMenuSubmenuArrow, DropdownMenuSubmenuRoot, DropdownMenuSubmenuTrigger, DropdownMenuTrigger } from "./base-ui/DropdownMenu/atoms.mjs";
|
|
34
34
|
import Menu from "./Menu/Menu.mjs";
|
|
35
35
|
import { renderDropdownMenuItems } from "./base-ui/DropdownMenu/renderItems.mjs";
|
|
36
36
|
import DropdownMenu from "./base-ui/DropdownMenu/DropdownMenu.mjs";
|
|
@@ -160,4 +160,4 @@ import ThemeSwitch from "./ThemeSwitch/ThemeSwitch.mjs";
|
|
|
160
160
|
import { ToastHost, toast, useToast } from "./base-ui/Toast/imperative.mjs";
|
|
161
161
|
import Toc from "./Toc/Toc.mjs";
|
|
162
162
|
import { ErrorBoundary } from "react-error-boundary";
|
|
163
|
-
export { A, Accordion, AccordionItem, ActionIcon, ActionIconGroup, Alert, AutoComplete, Avatar, AvatarGroup, Block, Burger, Button, CLASSNAMES, Center, Checkbox, CheckboxGroup, CodeDiff, CodeEditor, Collapse, ColorSwatches, ConfigProvider, ContextMenuHost, ContextMenuTrigger, CopyButton, DatePicker, DownloadButton, DraggablePanel, DraggablePanelBody, DraggablePanelContainer, DraggablePanelFooter, DraggablePanelHeader, DraggableSideNav, Drawer, Dropdown, DropdownMenu, DropdownMenuCheckboxItemIndicator, DropdownMenuCheckboxItemPrimitive, DropdownMenuGroup, DropdownMenuGroupLabel, DropdownMenuItem, DropdownMenuItemContent, DropdownMenuItemExtra, DropdownMenuItemIcon, DropdownMenuItemLabel, DropdownMenuPopup, DropdownMenuPortal, DropdownMenuPositioner, DropdownMenuRoot, DropdownMenuSeparator, DropdownMenuSubmenuArrow, DropdownMenuSubmenuRoot, DropdownMenuSubmenuTrigger, DropdownMenuTrigger, EditableText, EditorSlashMenu, EmojiPicker, Empty, ErrorBoundary, FileTypeIcon, FlexBasic_default as FlexBasic, FlexBasic_default as Flexbox, FluentEmoji, FontLoader, Footer, Form, FormGroup, FormItem, FormModal, FormSubmitFooter, FormTitle, Freeze, Grid, GroupAvatar, GuideCard, DEFAULT_HEIGHT as HTML_PREVIEW_DEFAULT_HEIGHT, DEFAULT_SANDBOX as HTML_PREVIEW_DEFAULT_SANDBOX, AUTO_HEIGHT_MESSAGE_TYPE as HTML_PREVIEW_RESIZE_MESSAGE, Header, Highlighter, Hotkey, HotkeyInput, HtmlPreview, HtmlPreviewIframe, I18nProvider, Icon, IconProvider, Image, ImageSelect, Input, InputNumber, InputOPT, InputPassword, KeyMapEnum, LOBE_THEME_APP_ID, Layout, LayoutFooter, LayoutHeader, LayoutMain, LayoutSidebar, LayoutSidebarInner, LayoutToc, List, ListItem, I18nProvider as LobeUIProvider, Markdown, MaskShadow, MaterialFileTypeIcon, Menu, Mermaid, Meta, Modal, ModalHost, ModalProvider, MotionComponent, MotionProvider, NeuralNetworkLoading, PatchDiff, Popover, PopoverArrow, PopoverArrowIcon, PopoverBackdrop, PopoverGroup, PopoverPopup, PopoverPortal, PopoverPositioner, PopoverProvider, PopoverRoot, PopoverTriggerElement, PopoverViewport, PreviewGroup, ScrollArea, ScrollAreaContent, ScrollAreaCorner, ScrollAreaRoot, ScrollAreaScrollbar, ScrollAreaThumb, ScrollAreaViewport, ScrollShadow, SearchBar, SearchResultCards, Segmented, Select, lobe_theme_default as ShikiLobeTheme, SideNav, Skeleton, SkeletonAvatar, SkeletonBlock, SkeletonButton, SkeletonParagraph, SkeletonTags, SkeletonTitle, SliderWithInput, Snippet, SortableList, SyntaxHighlighter, SyntaxMermaid, Tabs, Tag, Text, TextArea, ThemeProvider, ThemeSwitch, ToastHost, Toc, Tooltip, TooltipGroup, Typography, Video, closeContextMenu, combineKeys, copyToClipboard, createModal, createRawModal, findCustomThemeName, genCdnUrl, generateColorNeutralPalette, generateColorPalette, highlighterThemes, containsScript as htmlPreviewContainsScript, isFullHtmlDocument, isHtmlContentClosed, generateCustomStylish as lobeCustomStylish, generateCustomToken as lobeCustomToken, staticStylish as lobeStaticStylish, styles as menuSharedStyles, mermaidThemes, neutralColors, neutralColorsSwatches, placementMap, preprocessMarkdownContent, preventDefault, preventDefaultAndStopPropagation, primaryColors, primaryColorsSwatches, rehypeCustomFootnotes, rehypeKatexDir, rehypeStreamAnimated, remarkBr, remarkColor, remarkCustomFootnotes, remarkGfmPlus, remarkVideo, renderDropdownMenuItems, showContextMenu, stopPropagation, toFloatingUIPlacement, toast, updateContextMenuItems, useAppElement, useCdnFn, useModalContext, useMotionComponent, usePopoverContext, usePopoverPortalContainer, useToast, useTranslation };
|
|
163
|
+
export { A, Accordion, AccordionItem, ActionIcon, ActionIconGroup, Alert, AutoComplete, Avatar, AvatarGroup, Block, Burger, Button, CLASSNAMES, Center, Checkbox, CheckboxGroup, CodeDiff, CodeEditor, Collapse, ColorSwatches, ConfigProvider, ContextMenuHost, ContextMenuTrigger, CopyButton, DatePicker, DownloadButton, DraggablePanel, DraggablePanelBody, DraggablePanelContainer, DraggablePanelFooter, DraggablePanelHeader, DraggableSideNav, Drawer, Dropdown, DropdownMenu, DropdownMenuCheckboxItemIndicator, DropdownMenuCheckboxItemPrimitive, DropdownMenuFooter, DropdownMenuGroup, DropdownMenuGroupLabel, DropdownMenuHeader, DropdownMenuItem, DropdownMenuItemContent, DropdownMenuItemExtra, DropdownMenuItemIcon, DropdownMenuItemLabel, DropdownMenuPopup, DropdownMenuPortal, DropdownMenuPositioner, DropdownMenuRoot, DropdownMenuScrollViewport, DropdownMenuSeparator, DropdownMenuSubmenuArrow, DropdownMenuSubmenuRoot, DropdownMenuSubmenuTrigger, DropdownMenuTrigger, EditableText, EditorSlashMenu, EmojiPicker, Empty, ErrorBoundary, FileTypeIcon, FlexBasic_default as FlexBasic, FlexBasic_default as Flexbox, FluentEmoji, FontLoader, Footer, Form, FormGroup, FormItem, FormModal, FormSubmitFooter, FormTitle, Freeze, Grid, GroupAvatar, GuideCard, DEFAULT_HEIGHT as HTML_PREVIEW_DEFAULT_HEIGHT, DEFAULT_SANDBOX as HTML_PREVIEW_DEFAULT_SANDBOX, AUTO_HEIGHT_MESSAGE_TYPE as HTML_PREVIEW_RESIZE_MESSAGE, Header, Highlighter, Hotkey, HotkeyInput, HtmlPreview, HtmlPreviewIframe, I18nProvider, Icon, IconProvider, Image, ImageSelect, Input, InputNumber, InputOPT, InputPassword, KeyMapEnum, LOBE_THEME_APP_ID, Layout, LayoutFooter, LayoutHeader, LayoutMain, LayoutSidebar, LayoutSidebarInner, LayoutToc, List, ListItem, I18nProvider as LobeUIProvider, Markdown, MaskShadow, MaterialFileTypeIcon, Menu, Mermaid, Meta, Modal, ModalHost, ModalProvider, MotionComponent, MotionProvider, NeuralNetworkLoading, PatchDiff, Popover, PopoverArrow, PopoverArrowIcon, PopoverBackdrop, PopoverGroup, PopoverPopup, PopoverPortal, PopoverPositioner, PopoverProvider, PopoverRoot, PopoverTriggerElement, PopoverViewport, PreviewGroup, ScrollArea, ScrollAreaContent, ScrollAreaCorner, ScrollAreaRoot, ScrollAreaScrollbar, ScrollAreaThumb, ScrollAreaViewport, ScrollShadow, SearchBar, SearchResultCards, Segmented, Select, lobe_theme_default as ShikiLobeTheme, SideNav, Skeleton, SkeletonAvatar, SkeletonBlock, SkeletonButton, SkeletonParagraph, SkeletonTags, SkeletonTitle, SliderWithInput, Snippet, SortableList, SyntaxHighlighter, SyntaxMermaid, Tabs, Tag, Text, TextArea, ThemeProvider, ThemeSwitch, ToastHost, Toc, Tooltip, TooltipGroup, Typography, Video, closeContextMenu, combineKeys, copyToClipboard, createModal, createRawModal, findCustomThemeName, genCdnUrl, generateColorNeutralPalette, generateColorPalette, highlighterThemes, containsScript as htmlPreviewContainsScript, isFullHtmlDocument, isHtmlContentClosed, generateCustomStylish as lobeCustomStylish, generateCustomToken as lobeCustomToken, staticStylish as lobeStaticStylish, styles as menuSharedStyles, mermaidThemes, neutralColors, neutralColorsSwatches, placementMap, preprocessMarkdownContent, preventDefault, preventDefaultAndStopPropagation, primaryColors, primaryColorsSwatches, rehypeCustomFootnotes, rehypeKatexDir, rehypeStreamAnimated, remarkBr, remarkColor, remarkCustomFootnotes, remarkGfmPlus, remarkVideo, renderDropdownMenuItems, showContextMenu, stopPropagation, toFloatingUIPlacement, toast, updateContextMenuItems, useAppElement, useCdnFn, useModalContext, useMotionComponent, usePopoverContext, usePopoverPortalContainer, useToast, useTranslation };
|