@lobehub/ui 5.40.1 → 5.40.3

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.
Files changed (72) hide show
  1. package/es/CodeEditor/style.mjs +22 -0
  2. package/es/CodeEditor/style.mjs.map +1 -1
  3. package/es/base-ui/AutoComplete/AutoComplete.mjs +2 -0
  4. package/es/base-ui/AutoComplete/AutoComplete.mjs.map +1 -1
  5. package/es/base-ui/ContextMenu/ContextMenuHost.mjs +2 -0
  6. package/es/base-ui/ContextMenu/ContextMenuHost.mjs.map +1 -1
  7. package/es/base-ui/ContextMenu/renderItems.mjs +3 -1
  8. package/es/base-ui/ContextMenu/renderItems.mjs.map +1 -1
  9. package/es/base-ui/DropdownMenu/atoms.d.mts +1 -1
  10. package/es/base-ui/DropdownMenu/atoms.mjs +3 -1
  11. package/es/base-ui/DropdownMenu/atoms.mjs.map +1 -1
  12. package/es/base-ui/Popover/PopoverGroup.mjs +4 -3
  13. package/es/base-ui/Popover/PopoverGroup.mjs.map +1 -1
  14. package/es/base-ui/Popover/atoms.d.mts +1 -1
  15. package/es/base-ui/Popover/atoms.mjs +3 -1
  16. package/es/base-ui/Popover/atoms.mjs.map +1 -1
  17. package/es/base-ui/Select/Select.mjs +0 -1
  18. package/es/base-ui/Select/Select.mjs.map +1 -1
  19. package/es/base-ui/Select/atoms.d.mts +2 -2
  20. package/es/base-ui/Select/atoms.mjs +3 -1
  21. package/es/base-ui/Select/atoms.mjs.map +1 -1
  22. package/es/base-ui/Select/style.mjs +2 -1
  23. package/es/base-ui/Select/style.mjs.map +1 -1
  24. package/es/base-ui/Tooltip/TooltipGroup.mjs +6 -3
  25. package/es/base-ui/Tooltip/TooltipGroup.mjs.map +1 -1
  26. package/es/base-ui/Tooltip/TooltipStandalone.mjs +2 -0
  27. package/es/base-ui/Tooltip/TooltipStandalone.mjs.map +1 -1
  28. package/es/base-ui/floating/collisionPadding.d.mts +7 -0
  29. package/es/base-ui/floating/collisionPadding.mjs +17 -0
  30. package/es/base-ui/floating/collisionPadding.mjs.map +1 -0
  31. package/es/base-ui/index.d.mts +2 -1
  32. package/es/base-ui/index.mjs +2 -1
  33. package/es/icons/lucideExtra/AndroidIcon.d.mts +1 -1
  34. package/es/icons/lucideExtra/AppleIcon.d.mts +1 -1
  35. package/es/icons/lucideExtra/AppstoreIcon.d.mts +1 -1
  36. package/es/icons/lucideExtra/BotPromptIcon.d.mts +1 -1
  37. package/es/icons/lucideExtra/BrainOffIcon.d.mts +1 -1
  38. package/es/icons/lucideExtra/ChromeIcon.d.mts +1 -1
  39. package/es/icons/lucideExtra/CodepenIcon.d.mts +1 -1
  40. package/es/icons/lucideExtra/CodesandboxIcon.d.mts +1 -1
  41. package/es/icons/lucideExtra/CreateBotIcon.d.mts +1 -1
  42. package/es/icons/lucideExtra/DiscordIcon.d.mts +1 -1
  43. package/es/icons/lucideExtra/FacebookIcon.d.mts +1 -1
  44. package/es/icons/lucideExtra/FigmaIcon.d.mts +1 -1
  45. package/es/icons/lucideExtra/FramerIcon.d.mts +1 -1
  46. package/es/icons/lucideExtra/GithubIcon.d.mts +1 -1
  47. package/es/icons/lucideExtra/GitlabIcon.d.mts +1 -1
  48. package/es/icons/lucideExtra/GlobeOffIcon.d.mts +1 -1
  49. package/es/icons/lucideExtra/GooglePlayIcon.d.mts +1 -1
  50. package/es/icons/lucideExtra/GroupBotIcon.d.mts +1 -1
  51. package/es/icons/lucideExtra/GroupBotSquareIcon.d.mts +1 -1
  52. package/es/icons/lucideExtra/InstagramIcon.d.mts +1 -1
  53. package/es/icons/lucideExtra/LeftClickIcon.d.mts +1 -1
  54. package/es/icons/lucideExtra/LeftDoubleClickIcon.d.mts +1 -1
  55. package/es/icons/lucideExtra/LinkedinIcon.d.mts +1 -1
  56. package/es/icons/lucideExtra/McpIcon.d.mts +1 -1
  57. package/es/icons/lucideExtra/NotionIcon.d.mts +1 -1
  58. package/es/icons/lucideExtra/PocketIcon.d.mts +1 -1
  59. package/es/icons/lucideExtra/ProviderIcon.d.mts +1 -1
  60. package/es/icons/lucideExtra/RailSymbolIcon.d.mts +1 -1
  61. package/es/icons/lucideExtra/RedditIcon.d.mts +1 -1
  62. package/es/icons/lucideExtra/RightClickIcon.d.mts +1 -1
  63. package/es/icons/lucideExtra/RightDoubleClickIcon.d.mts +1 -1
  64. package/es/icons/lucideExtra/ShapesUploadIcon.d.mts +1 -1
  65. package/es/icons/lucideExtra/SkillsIcon.d.mts +1 -1
  66. package/es/icons/lucideExtra/SlackIcon.d.mts +1 -1
  67. package/es/icons/lucideExtra/ThinkIcon.d.mts +1 -1
  68. package/es/icons/lucideExtra/TreeDownRightIcon.d.mts +1 -1
  69. package/es/icons/lucideExtra/TreeUpDownRightIcon.d.mts +1 -1
  70. package/es/utils/destroyOnInvalidActiveTriggerElement.mjs +8 -2
  71. package/es/utils/destroyOnInvalidActiveTriggerElement.mjs.map +1 -1
  72. package/package.json +2 -2
@@ -15,6 +15,28 @@ const styles = createStaticStyles(({ css, cssVar }) => {
15
15
  filled: staticStylish.variantFilledWithoutHover,
16
16
  highlight: css`
17
17
  pointer-events: none;
18
+
19
+ /* Mirror the textarea's text flow instead of the highlighter's flex rows. */
20
+ pre code {
21
+ display: block;
22
+
23
+ /* Keep the final empty line measurable after a trailing newline. */
24
+ &::after {
25
+ content: '\\200b';
26
+ }
27
+
28
+ .line {
29
+ display: inline;
30
+ margin: 0;
31
+ padding: 0;
32
+ }
33
+
34
+ /* Token emphasis must not change glyph metrics relative to the textarea. */
35
+ span {
36
+ font-weight: inherit !important;
37
+ font-style: inherit !important;
38
+ }
39
+ }
18
40
  `,
19
41
  outlined: staticStylish.variantOutlinedWithoutHover,
20
42
  root: css`
@@ -1 +1 @@
1
- {"version":3,"file":"style.mjs","names":["lobeStaticStylish"],"sources":["../../src/CodeEditor/style.ts"],"sourcesContent":["import { createStaticStyles, cx } from 'antd-style';\nimport { cva } from 'class-variance-authority';\n\nimport { lobeStaticStylish } from '@/styles';\n\nexport const styles = createStaticStyles(({ css, cssVar }) => {\n return {\n borderless: cx(\n lobeStaticStylish.variantBorderlessWithoutHover,\n css`\n border-radius: 0;\n\n pre,\n textarea {\n padding: 0;\n }\n `,\n ),\n filled: lobeStaticStylish.variantFilledWithoutHover,\n highlight: css`\n pointer-events: none;\n `,\n outlined: lobeStaticStylish.variantOutlinedWithoutHover,\n root: css`\n position: relative;\n\n overflow: hidden auto;\n\n width: 100%;\n height: fit-content;\n border-radius: ${cssVar.borderRadius};\n\n font-size: 12px;\n\n pre,\n textarea {\n margin: 0;\n padding: 16px;\n }\n\n textarea,\n pre,\n code {\n overflow: hidden;\n\n font-family: ${cssVar.fontFamilyCode};\n font-size: inherit;\n line-height: inherit;\n word-break: inherit;\n word-wrap: break-word;\n white-space: pre-wrap;\n }\n `,\n textarea: css`\n resize: none;\n\n position: absolute;\n inset-block-start: 0;\n inset-inline-start: 0;\n\n overflow: hidden;\n\n box-sizing: border-box;\n width: 100%;\n height: 100%;\n padding: 0;\n border: none;\n\n color: transparent;\n text-align: start;\n\n background: transparent;\n outline: none;\n caret-color: ${cssVar.colorText};\n\n &::placeholder {\n color: ${cssVar.colorTextQuaternary};\n }\n\n &:focus {\n border: none;\n outline: none;\n box-shadow: none;\n }\n `,\n };\n});\n\nexport const variants = cva(styles.root, {\n defaultVariants: {\n variant: 'borderless',\n },\n\n variants: {\n variant: {\n filled: styles.filled,\n outlined: styles.outlined,\n borderless: styles.borderless,\n },\n },\n});\n"],"mappings":";;;;AAKA,MAAa,SAAS,oBAAoB,EAAE,KAAK,aAAa;CAC5D,OAAO;EACL,YAAY,GACVA,cAAkB,+BAClB,GAAG;;;;;;;OAQL;EACA,QAAQA,cAAkB;EAC1B,WAAW,GAAG;;;EAGd,UAAUA,cAAkB;EAC5B,MAAM,GAAG;;;;;;;uBAOU,OAAO,aAAa;;;;;;;;;;;;;;;uBAepB,OAAO,eAAe;;;;;;;;EAQzC,UAAU,GAAG;;;;;;;;;;;;;;;;;;;;qBAoBI,OAAO,UAAU;;;iBAGrB,OAAO,oBAAoB;;;;;;;;;CAS1C;AACF,CAAC;AAED,MAAa,WAAW,IAAI,OAAO,MAAM;CACvC,iBAAiB,EACf,SAAS,aACX;CAEA,UAAU,EACR,SAAS;EACP,QAAQ,OAAO;EACf,UAAU,OAAO;EACjB,YAAY,OAAO;CACrB,EACF;AACF,CAAC"}
1
+ {"version":3,"file":"style.mjs","names":["lobeStaticStylish"],"sources":["../../src/CodeEditor/style.ts"],"sourcesContent":["import { createStaticStyles, cx } from 'antd-style';\nimport { cva } from 'class-variance-authority';\n\nimport { lobeStaticStylish } from '@/styles';\n\nexport const styles = createStaticStyles(({ css, cssVar }) => {\n return {\n borderless: cx(\n lobeStaticStylish.variantBorderlessWithoutHover,\n css`\n border-radius: 0;\n\n pre,\n textarea {\n padding: 0;\n }\n `,\n ),\n filled: lobeStaticStylish.variantFilledWithoutHover,\n highlight: css`\n pointer-events: none;\n\n /* Mirror the textarea's text flow instead of the highlighter's flex rows. */\n pre code {\n display: block;\n\n /* Keep the final empty line measurable after a trailing newline. */\n &::after {\n content: '\\\\200b';\n }\n\n .line {\n display: inline;\n margin: 0;\n padding: 0;\n }\n\n /* Token emphasis must not change glyph metrics relative to the textarea. */\n span {\n font-weight: inherit !important;\n font-style: inherit !important;\n }\n }\n `,\n outlined: lobeStaticStylish.variantOutlinedWithoutHover,\n root: css`\n position: relative;\n\n overflow: hidden auto;\n\n width: 100%;\n height: fit-content;\n border-radius: ${cssVar.borderRadius};\n\n font-size: 12px;\n\n pre,\n textarea {\n margin: 0;\n padding: 16px;\n }\n\n textarea,\n pre,\n code {\n overflow: hidden;\n\n font-family: ${cssVar.fontFamilyCode};\n font-size: inherit;\n line-height: inherit;\n word-break: inherit;\n word-wrap: break-word;\n white-space: pre-wrap;\n }\n `,\n textarea: css`\n resize: none;\n\n position: absolute;\n inset-block-start: 0;\n inset-inline-start: 0;\n\n overflow: hidden;\n\n box-sizing: border-box;\n width: 100%;\n height: 100%;\n padding: 0;\n border: none;\n\n color: transparent;\n text-align: start;\n\n background: transparent;\n outline: none;\n caret-color: ${cssVar.colorText};\n\n &::placeholder {\n color: ${cssVar.colorTextQuaternary};\n }\n\n &:focus {\n border: none;\n outline: none;\n box-shadow: none;\n }\n `,\n };\n});\n\nexport const variants = cva(styles.root, {\n defaultVariants: {\n variant: 'borderless',\n },\n\n variants: {\n variant: {\n filled: styles.filled,\n outlined: styles.outlined,\n borderless: styles.borderless,\n },\n },\n});\n"],"mappings":";;;;AAKA,MAAa,SAAS,oBAAoB,EAAE,KAAK,aAAa;CAC5D,OAAO;EACL,YAAY,GACVA,cAAkB,+BAClB,GAAG;;;;;;;OAQL;EACA,QAAQA,cAAkB;EAC1B,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;EAyBd,UAAUA,cAAkB;EAC5B,MAAM,GAAG;;;;;;;uBAOU,OAAO,aAAa;;;;;;;;;;;;;;;uBAepB,OAAO,eAAe;;;;;;;;EAQzC,UAAU,GAAG;;;;;;;;;;;;;;;;;;;;qBAoBI,OAAO,UAAU;;;iBAGrB,OAAO,oBAAoB;;;;;;;;;CAS1C;AACF,CAAC;AAED,MAAa,WAAW,IAAI,OAAO,MAAM;CACvC,iBAAiB,EACf,SAAS,aACX;CAEA,UAAU,EACR,SAAS;EACP,QAAQ,OAAO;EACf,UAAU,OAAO;EACjB,YAAY,OAAO;CACrB,EACF;AACF,CAAC"}
@@ -1,4 +1,5 @@
1
1
  "use client";
2
+ import { getFloatingCollisionPadding } from "../floating/collisionPadding.mjs";
2
3
  import { useAppElement } from "../../ThemeProvider/AppElementContext.mjs";
3
4
  import Icon from "../../Icon/Icon.mjs";
4
5
  import { useLayerZIndex } from "../zIndex/useLayerZIndex.mjs";
@@ -64,6 +65,7 @@ const AutoComplete = memo(({ className, classNames, styles: customStyles, style,
64
65
  children: /* @__PURE__ */ jsx(Autocomplete.Positioner, {
65
66
  anchor: anchorRef,
66
67
  className: styles$1.positioner,
68
+ collisionPadding: getFloatingCollisionPadding(),
67
69
  ref: positionerRef,
68
70
  sideOffset: 4,
69
71
  style: zIndex === void 0 ? void 0 : { zIndex },
@@ -1 +1 @@
1
- {"version":3,"file":"AutoComplete.mjs","names":["inputVariants","inputStyles","styles"],"sources":["../../../src/base-ui/AutoComplete/AutoComplete.tsx"],"sourcesContent":["'use client';\n\nimport { Autocomplete } from '@base-ui/react/autocomplete';\nimport { cx, useThemeMode } from 'antd-style';\nimport { XIcon } from 'lucide-react';\nimport { memo, useMemo, useRef } from 'react';\n\nimport { inputStyles, inputVariants } from '@/base-ui/Input';\nimport { useLayerZIndex } from '@/base-ui/zIndex';\nimport Icon from '@/Icon';\nimport { useAppElement } from '@/ThemeProvider';\n\nimport { styles } from './style';\nimport type { AutoCompleteOption, AutoCompleteProps } from './type';\n\nconst AutoComplete = memo<AutoCompleteProps>(\n ({\n className,\n classNames,\n styles: customStyles,\n style,\n variant,\n shadow,\n size = 'middle',\n options = [],\n onChange,\n onSearch,\n allowClear,\n disabled,\n placeholder,\n prefix,\n suffix,\n emptyText,\n ...rest\n }) => {\n const { isDarkMode } = useThemeMode();\n const appElement = useAppElement();\n const anchorRef = useRef<HTMLDivElement>(null);\n const { ref: positionerRef, zIndex } = useLayerZIndex<HTMLDivElement>('floating');\n const mergedVariant = variant || (isDarkMode ? 'filled' : 'outlined');\n\n const items = useMemo<AutoCompleteOption[]>(\n () => options.map((option) => (typeof option === 'string' ? { value: option } : option)),\n [options],\n );\n\n return (\n <Autocomplete.Root\n openOnInputClick\n disabled={disabled}\n itemToStringValue={(item) => (item as AutoCompleteOption).value}\n items={items}\n onValueChange={(value) => {\n onChange?.(value);\n onSearch?.(value);\n }}\n {...rest}\n >\n <div\n className={cx(inputVariants({ shadow, size, variant: mergedVariant }), className)}\n data-disabled={disabled ? '' : undefined}\n ref={anchorRef}\n style={style}\n >\n {prefix && <span className={inputStyles.slot}>{prefix}</span>}\n <Autocomplete.Input\n className={cx(inputStyles.input, classNames?.input)}\n placeholder={placeholder}\n style={customStyles?.input}\n />\n {allowClear && (\n <Autocomplete.Clear aria-label={'Clear'} className={styles.clear}>\n <Icon icon={XIcon} size={14} />\n </Autocomplete.Clear>\n )}\n {suffix && <span className={inputStyles.slot}>{suffix}</span>}\n </div>\n <Autocomplete.Portal container={appElement ?? undefined}>\n <Autocomplete.Positioner\n anchor={anchorRef}\n className={styles.positioner}\n ref={positionerRef}\n sideOffset={4}\n style={zIndex === undefined ? undefined : { zIndex }}\n >\n <Autocomplete.Popup\n className={cx(styles.popup, classNames?.popup)}\n style={customStyles?.popup}\n >\n {emptyText && (\n <Autocomplete.Empty className={styles.empty}>{emptyText}</Autocomplete.Empty>\n )}\n <Autocomplete.List className={styles.list}>\n {(item: AutoCompleteOption) => (\n <Autocomplete.Item\n className={cx(styles.item, classNames?.item)}\n disabled={item.disabled}\n key={item.value}\n style={customStyles?.item}\n value={item}\n >\n {item.label ?? item.value}\n </Autocomplete.Item>\n )}\n </Autocomplete.List>\n </Autocomplete.Popup>\n </Autocomplete.Positioner>\n </Autocomplete.Portal>\n </Autocomplete.Root>\n );\n },\n);\n\nAutoComplete.displayName = 'AutoComplete';\n\nexport default AutoComplete;\n"],"mappings":";;;;;;;;;;;;AAeA,MAAM,eAAe,MAClB,EACC,WACA,YACA,QAAQ,cACR,OACA,SACA,QACA,OAAO,UACP,UAAU,CAAC,GACX,UACA,UACA,YACA,UACA,aACA,QACA,QACA,WACA,GAAG,WACC;CACJ,MAAM,EAAE,eAAe,aAAa;CACpC,MAAM,aAAa,cAAc;CACjC,MAAM,YAAY,OAAuB,IAAI;CAC7C,MAAM,EAAE,KAAK,eAAe,WAAW,eAA+B,UAAU;CAChF,MAAM,gBAAgB,YAAY,aAAa,WAAW;CAE1D,MAAM,QAAQ,cACN,QAAQ,KAAK,WAAY,OAAO,WAAW,WAAW,EAAE,OAAO,OAAO,IAAI,MAAO,GACvF,CAAC,OAAO,CACV;CAEA,OACE,qBAAC,aAAa,MAAd;EACE,kBAAA;EACU;EAC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KAAK;MACH,GALZ,KAAK,KAKO;KAEJ,CAAA,CACD;;GACG,CAAA;EACN,CAAA,CACJ;;AAEvB,CACF;AAEA,aAAa,cAAc"}
1
+ {"version":3,"file":"AutoComplete.mjs","names":["inputVariants","inputStyles","styles"],"sources":["../../../src/base-ui/AutoComplete/AutoComplete.tsx"],"sourcesContent":["'use client';\n\nimport { Autocomplete } from '@base-ui/react/autocomplete';\nimport { cx, useThemeMode } from 'antd-style';\nimport { XIcon } from 'lucide-react';\nimport { memo, useMemo, useRef } from 'react';\n\nimport { getFloatingCollisionPadding } from '@/base-ui/floating';\nimport { inputStyles, inputVariants } from '@/base-ui/Input';\nimport { useLayerZIndex } from '@/base-ui/zIndex';\nimport Icon from '@/Icon';\nimport { useAppElement } from '@/ThemeProvider';\n\nimport { styles } from './style';\nimport type { AutoCompleteOption, AutoCompleteProps } from './type';\n\nconst AutoComplete = memo<AutoCompleteProps>(\n ({\n className,\n classNames,\n styles: customStyles,\n style,\n variant,\n shadow,\n size = 'middle',\n options = [],\n onChange,\n onSearch,\n allowClear,\n disabled,\n placeholder,\n prefix,\n suffix,\n emptyText,\n ...rest\n }) => {\n const { isDarkMode } = useThemeMode();\n const appElement = useAppElement();\n const anchorRef = useRef<HTMLDivElement>(null);\n const { ref: positionerRef, zIndex } = useLayerZIndex<HTMLDivElement>('floating');\n const mergedVariant = variant || (isDarkMode ? 'filled' : 'outlined');\n\n const items = useMemo<AutoCompleteOption[]>(\n () => options.map((option) => (typeof option === 'string' ? { value: option } : option)),\n [options],\n );\n\n return (\n <Autocomplete.Root\n openOnInputClick\n disabled={disabled}\n itemToStringValue={(item) => (item as AutoCompleteOption).value}\n items={items}\n onValueChange={(value) => {\n onChange?.(value);\n onSearch?.(value);\n }}\n {...rest}\n >\n <div\n className={cx(inputVariants({ shadow, size, variant: mergedVariant }), className)}\n data-disabled={disabled ? '' : undefined}\n ref={anchorRef}\n style={style}\n >\n {prefix && <span className={inputStyles.slot}>{prefix}</span>}\n <Autocomplete.Input\n className={cx(inputStyles.input, classNames?.input)}\n placeholder={placeholder}\n style={customStyles?.input}\n />\n {allowClear && (\n <Autocomplete.Clear aria-label={'Clear'} className={styles.clear}>\n <Icon icon={XIcon} size={14} />\n </Autocomplete.Clear>\n )}\n {suffix && <span className={inputStyles.slot}>{suffix}</span>}\n </div>\n <Autocomplete.Portal container={appElement ?? undefined}>\n <Autocomplete.Positioner\n anchor={anchorRef}\n className={styles.positioner}\n collisionPadding={getFloatingCollisionPadding()}\n ref={positionerRef}\n sideOffset={4}\n style={zIndex === undefined ? undefined : { zIndex }}\n >\n <Autocomplete.Popup\n className={cx(styles.popup, classNames?.popup)}\n style={customStyles?.popup}\n >\n {emptyText && (\n <Autocomplete.Empty className={styles.empty}>{emptyText}</Autocomplete.Empty>\n )}\n <Autocomplete.List className={styles.list}>\n {(item: AutoCompleteOption) => (\n <Autocomplete.Item\n className={cx(styles.item, classNames?.item)}\n disabled={item.disabled}\n key={item.value}\n style={customStyles?.item}\n value={item}\n >\n {item.label ?? item.value}\n </Autocomplete.Item>\n )}\n </Autocomplete.List>\n </Autocomplete.Popup>\n </Autocomplete.Positioner>\n </Autocomplete.Portal>\n </Autocomplete.Root>\n );\n },\n);\n\nAutoComplete.displayName = 'AutoComplete';\n\nexport default AutoComplete;\n"],"mappings":";;;;;;;;;;;;;AAgBA,MAAM,eAAe,MAClB,EACC,WACA,YACA,QAAQ,cACR,OACA,SACA,QACA,OAAO,UACP,UAAU,CAAC,GACX,UACA,UACA,YACA,UACA,aACA,QACA,QACA,WACA,GAAG,WACC;CACJ,MAAM,EAAE,eAAe,aAAa;CACpC,MAAM,aAAa,cAAc;CACjC,MAAM,YAAY,OAAuB,IAAI;CAC7C,MAAM,EAAE,KAAK,eAAe,WAAW,eAA+B,UAAU;CAChF,MAAM,gBAAgB,YAAY,aAAa,WAAW;CAE1D,MAAM,QAAQ,cACN,QAAQ,KAAK,WAAY,OAAO,WAAW,WAAW,EAAE,OAAO,OAAO,IAAI,MAA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,SAAO,MAAM,YAAY,IAAI;OAC3C,UAAU,KAAK;OAEf,OAAO,cAAc;OACrB,OAAO;OAEN,UAAA,KAAK,SAAS,KAAK;MACH,GALZ,KAAK,KAKO;KAEJ,CAAA,CACD;;GACG,CAAA;EACN,CAAA,CACJ;;AAEvB,CACF;AAEA,aAAa,cAAc"}
@@ -1,4 +1,5 @@
1
1
  "use client";
2
+ import { getFloatingCollisionPadding } from "../floating/collisionPadding.mjs";
2
3
  import { useIsClient } from "../../hooks/useIsClient.mjs";
3
4
  import { useAppElement } from "../../ThemeProvider/AppElementContext.mjs";
4
5
  import { preventDefaultAndStopPropagation } from "../../utils/dom.mjs";
@@ -57,6 +58,7 @@ const ContextMenuHost = memo(() => {
57
58
  children: /* @__PURE__ */ jsx(ContextMenu.Positioner, {
58
59
  anchor: state.anchor ?? void 0,
59
60
  className: styles.positioner,
61
+ collisionPadding: getFloatingCollisionPadding(),
60
62
  ref: zRef,
61
63
  sideOffset: 6,
62
64
  style: {
@@ -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 { 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 data-has-footer={state.footer == null ? undefined : ''}\n data-has-header={state.header == null ? undefined : ''}\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,MAAM;AA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AAY,OAAb;KACE,WAAW,GAAG,OAAO,OAAO,YAAY,OAAO,cAAc;KAC7D,mBAAiB,MAAM,UAAU,OAAO,KAAA,IAAY;KACpD,mBAAiB,MAAM,UAAU,OAAO,KAAA,IAAY;KACpD,eAAe;KAJjB,UAAA;MAMG,MAAM,UAAU,OAAO,OAAO,oBAAC,OAAD;OAAK,WAAW,OAAO;OAAS,UAAA,MAAM;MAAY,CAAA;MAChF,WAAW,oBAAC,OAAD;OAAK,WAAW,OAAO;OAAe,UAAA;MAAe,CAAA,IAAI;MACpE,MAAM,UAAU,OAAO,OAAO,oBAAC,OAAD;OAAK,WAAW,OAAO;OAAS,UAAA,MAAM;MAAY,CAAA;KAChE;;GACG,CAAA;EACN,CAAA;CACJ,CAAA;AAEtB,CAAC;AAED,gBAAgB,cAAc"}
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 { getFloatingCollisionPadding } from '@/base-ui/floating';\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 collisionPadding={getFloatingCollisionPadding()}\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 data-has-footer={state.footer == null ? undefined : ''}\n data-has-header={state.header == null ? undefined : ''}\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":";;;;;;;;;;;;;;;AAwBA,MAAM,oBAAoB,EAAE,sCAAsC,MAAM;AAExE,MAAa,kBAAkB,WAAW;CACxC,MAAM,WAAW,YAAY;CAC7B,MA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OAAO,YAAY,OAAO,cAAc;KAC7D,mBAAiB,MAAM,UAAU,OAAO,KAAA,IAAY;KACpD,mBAAiB,MAAM,UAAU,OAAO,KAAA,IAAY;KACpD,eAAe;KAJjB,UAAA;MAMG,MAAM,UAAU,OAAO,OAAO,oBAAC,OAAD;OAAK,WAAW,OAAO;OAAS,UAAA,MAAM;MAAY,CAAA;MAChF,WAAW,oBAAC,OAAD;OAAK,WAAW,OAAO;OAAe,UAAA;MAAe,CAAA,IAAI;MACpE,MAAM,UAAU,OAAO,OAAO,oBAAC,OAAD;OAAK,WAAW,OAAO;OAAS,UAAA,MAAM;MAAY,CAAA;KAChE;;GACG,CAAA;EACN,CAAA;CACJ,CAAA;AAEtB,CAAC;AAED,gBAAgB,cAAc"}
@@ -1,3 +1,4 @@
1
+ import { getFloatingCollisionPadding } from "../floating/collisionPadding.mjs";
1
2
  import Icon from "../../Icon/Icon.mjs";
2
3
  import { preventDefaultAndStopPropagation } from "../../utils/dom.mjs";
3
4
  import Switch from "../Switch/Switch.mjs";
@@ -18,7 +19,7 @@ import { ContextMenu } from "@base-ui/react/context-menu";
18
19
  * their own layer z-index (same pattern as DropdownMenu) rather than relying on
19
20
  * the fixed CSS fallback that can fall behind after repeated root openings (#608).
20
21
  */
21
- const ContextMenuSubmenuPositioner = memo(({ style, ...rest }) => {
22
+ const ContextMenuSubmenuPositioner = memo(({ collisionPadding, style, ...rest }) => {
22
23
  const explicitZIndex = typeof style !== "function" && style?.zIndex != null && typeof style.zIndex === "number" ? style.zIndex : void 0;
23
24
  const { zIndex, ref: zRef } = useLayerZIndex("floating", explicitZIndex);
24
25
  const resolvedStyle = typeof style === "function" ? (state) => ({
@@ -30,6 +31,7 @@ const ContextMenuSubmenuPositioner = memo(({ style, ...rest }) => {
30
31
  };
31
32
  return /* @__PURE__ */ jsx(ContextMenu.Positioner, {
32
33
  ...rest,
34
+ collisionPadding: collisionPadding ?? getFloatingCollisionPadding(),
33
35
  ref: zRef,
34
36
  style: resolvedStyle
35
37
  });
@@ -1 +1 @@
1
- {"version":3,"file":"renderItems.mjs","names":["common"],"sources":["../../../src/base-ui/ContextMenu/renderItems.tsx"],"sourcesContent":["import { ContextMenu } from '@base-ui/react/context-menu';\nimport { cx } from 'antd-style';\nimport { Check } from 'lucide-react';\nimport { type MenuInfo } from 'rc-menu/es/interface';\nimport {\n type ComponentProps,\n type KeyboardEvent as ReactKeyboardEvent,\n type MouseEvent as ReactMouseEvent,\n type ReactNode,\n} from 'react';\nimport { memo, useCallback, useState } from 'react';\n\nimport { styles } from '@/base-ui/DropdownMenu/sharedStyle';\nimport { SubmenuArrowIcon } from '@/base-ui/SubmenuArrowIcon';\nimport Switch from '@/base-ui/Switch';\nimport common from '@/i18n/resources/en/common';\nimport { useTranslation } from '@/i18n/useTranslation';\nimport Icon from '@/Icon';\nimport {\n type BaseMenuItemGroupType,\n type BaseSubMenuType,\n getItemKey,\n getItemLabel,\n hasAnyIcon,\n hasCheckboxAndIcon,\n type MenuDividerType,\n type MenuItemType,\n renderIcon,\n type RenderItemContentOptions,\n type RenderOptions,\n} from '@/Menu';\nimport { preventDefaultAndStopPropagation } from '@/utils/dom';\n\nimport { useLayerZIndex } from '../zIndex';\nimport {\n type ContextMenuCheckboxItem,\n type ContextMenuItem,\n type ContextMenuSwitchItem,\n} from './type';\n\ntype ContextMenuPositionerProps = ComponentProps<typeof ContextMenu.Positioner>;\n\n/**\n * Submenu positioners are portaled outside the root menu, so they must allocate\n * their own layer z-index (same pattern as DropdownMenu) rather than relying on\n * the fixed CSS fallback that can fall behind after repeated root openings (#608).\n */\nconst ContextMenuSubmenuPositioner = memo(({ style, ...rest }: ContextMenuPositionerProps) => {\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\n const resolvedStyle =\n typeof style === 'function'\n ? (state: any) => ({ zIndex, ...style(state) })\n : { zIndex, ...style };\n\n return <ContextMenu.Positioner {...rest} ref={zRef as any} style={resolvedStyle} />;\n});\n\nContextMenuSubmenuPositioner.displayName = 'ContextMenuSubmenuPositioner';\n\nexport type { IconAlign, IconSpaceMode } from '@/Menu';\n\nconst EmptyMenuItem = memo(() => {\n const { t } = useTranslation(common);\n return (\n <ContextMenu.Item disabled className={cx(styles.item, styles.empty)}>\n <div className={styles.itemContent}>\n <span className={styles.label}>{t('common.empty')}</span>\n </div>\n </ContextMenu.Item>\n );\n});\n\nEmptyMenuItem.displayName = 'EmptyMenuItem';\n\ninterface ContextMenuSwitchItemInternalProps {\n checked?: boolean;\n children: ReactNode;\n closeOnClick?: boolean;\n danger?: boolean;\n defaultChecked?: boolean;\n disabled?: boolean;\n label?: string;\n onCheckedChange?: (checked: boolean) => void;\n}\n\nconst ContextMenuSwitchItemInternal = ({\n checked: checkedProp,\n children,\n closeOnClick = false,\n danger,\n defaultChecked,\n disabled,\n label,\n onCheckedChange,\n}: ContextMenuSwitchItemInternalProps) => {\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 <ContextMenu.Item\n className={cx(styles.item, danger && styles.danger)}\n closeOnClick={closeOnClick}\n disabled={disabled}\n label={label}\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 </ContextMenu.Item>\n );\n};\n\nconst renderItemContent = (\n item: MenuItemType | BaseSubMenuType | ContextMenuCheckboxItem | ContextMenuSwitchItem,\n options?: RenderItemContentOptions,\n iconNode?: ReactNode,\n) => {\n const label = getItemLabel(item);\n const desc = 'desc' in item ? item.desc : undefined;\n const extra = 'extra' in item ? item.extra : undefined;\n const indicatorOnRight = options?.indicatorOnRight;\n const alignStart = Boolean(desc) && options?.iconAlign === 'start';\n const hasCustomIcon = iconNode !== undefined && !indicatorOnRight;\n const hasIcon = hasCustomIcon ? Boolean(iconNode) : Boolean(item.icon);\n const shouldRenderIcon = hasCustomIcon\n ? Boolean(options?.reserveIconSpace || iconNode)\n : Boolean(hasIcon || options?.reserveIconSpace);\n\n const labelNode = desc ? (\n <div className={styles.labelGroup}>\n <span className={styles.label}>{label}</span>\n <span className={styles.desc}>{desc}</span>\n </div>\n ) : (\n <span className={styles.label}>{label}</span>\n );\n\n return (\n <div className={cx(styles.itemContent, alignStart && styles.itemContentAlignStart)}>\n {shouldRenderIcon ? (\n <span\n aria-hidden={!hasIcon}\n className={cx(styles.icon, alignStart && styles.iconAlignStart)}\n >\n {hasCustomIcon ? iconNode : hasIcon ? renderIcon(item.icon, 'small') : null}\n </span>\n ) : null}\n {labelNode}\n {extra ? <span className={styles.extra}>{extra}</span> : null}\n {indicatorOnRight && iconNode ? iconNode : null}\n {options?.submenu ? (\n <span className={styles.submenuArrow}>\n <SubmenuArrowIcon />\n </span>\n ) : null}\n </div>\n );\n};\n\nconst invokeItemClick = (\n item: MenuItemType,\n keyPath: string[],\n event: ReactMouseEvent<HTMLElement> | ReactKeyboardEvent<HTMLElement>,\n) => {\n if (!item.onClick) return;\n const key = item.key ?? keyPath.at(-1) ?? '';\n const info: MenuInfo = {\n domEvent: event,\n item: event.currentTarget as MenuInfo['item'],\n key: String(key),\n keyPath,\n };\n item.onClick(info);\n};\n\nexport const renderContextMenuItems = (\n items: ContextMenuItem[],\n keyPath: string[] = [],\n options?: RenderOptions,\n): ReactNode[] => {\n const iconAlign = options?.iconAlign;\n const iconSpaceMode = options?.iconSpaceMode ?? 'global';\n const reserveIconSpace =\n options?.reserveIconSpace ?? hasAnyIcon(items, iconSpaceMode === 'global');\n const indicatorOnRight = options?.indicatorOnRight ?? hasCheckboxAndIcon(items);\n\n return items.map((item, index) => {\n if (!item) return null;\n\n const fallbackKey = `${keyPath.join('-') || 'root'}-${index}`;\n const itemKey = getItemKey(item, fallbackKey);\n const nextKeyPath = [...keyPath, String(itemKey)];\n\n if ((item as ContextMenuCheckboxItem).type === 'checkbox') {\n const checkboxItem = item as ContextMenuCheckboxItem;\n const label = getItemLabel(checkboxItem);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = Boolean(checkboxItem.danger);\n const indicator = (\n <ContextMenu.CheckboxItemIndicator>\n <Icon icon={Check} size={'small'} />\n </ContextMenu.CheckboxItemIndicator>\n );\n\n return (\n <ContextMenu.CheckboxItem\n checked={checkboxItem.checked}\n className={cx(styles.item, isDanger && styles.danger)}\n closeOnClick={checkboxItem.closeOnClick}\n defaultChecked={checkboxItem.defaultChecked}\n disabled={checkboxItem.disabled}\n key={itemKey}\n label={labelText}\n onCheckedChange={(checked) => checkboxItem.onCheckedChange?.(checked)}\n >\n {renderItemContent(\n checkboxItem,\n { iconAlign, indicatorOnRight, reserveIconSpace },\n indicator,\n )}\n </ContextMenu.CheckboxItem>\n );\n }\n\n if ((item as ContextMenuSwitchItem).type === 'switch') {\n const switchItem = item as ContextMenuSwitchItem;\n const label = getItemLabel(switchItem);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = Boolean(switchItem.danger);\n\n return (\n <ContextMenuSwitchItemInternal\n checked={switchItem.checked}\n closeOnClick={switchItem.closeOnClick}\n danger={isDanger}\n defaultChecked={switchItem.defaultChecked}\n disabled={switchItem.disabled}\n key={itemKey}\n label={labelText}\n onCheckedChange={switchItem.onCheckedChange}\n >\n {renderItemContent(switchItem, { iconAlign, reserveIconSpace })}\n </ContextMenuSwitchItemInternal>\n );\n }\n\n if ((item as MenuDividerType).type === 'divider') {\n return <ContextMenu.Separator className={styles.separator} key={itemKey} />;\n }\n\n if ((item as BaseMenuItemGroupType).type === 'group') {\n const group = item as BaseMenuItemGroupType;\n const groupReserveIconSpace =\n iconSpaceMode === 'group'\n ? group.children\n ? hasAnyIcon(group.children)\n : false\n : reserveIconSpace;\n const groupIndicatorOnRight = group.children ? hasCheckboxAndIcon(group.children) : false;\n return (\n <ContextMenu.Group key={itemKey}>\n {group.label ? (\n <ContextMenu.GroupLabel className={styles.groupLabel}>\n {group.label}\n </ContextMenu.GroupLabel>\n ) : null}\n {group.children\n ? renderContextMenuItems(group.children, nextKeyPath, {\n iconAlign,\n iconSpaceMode,\n indicatorOnRight: groupIndicatorOnRight,\n reserveIconSpace: groupReserveIconSpace,\n })\n : null}\n </ContextMenu.Group>\n );\n }\n\n if (\n (item as BaseSubMenuType).type === 'submenu' ||\n ('children' in item && (item as BaseSubMenuType).children)\n ) {\n const submenu = item as BaseSubMenuType;\n const label = getItemLabel(submenu);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = 'danger' in submenu && Boolean(submenu.danger);\n const submenuHasSlots = submenu.header != null || submenu.footer != null;\n const submenuBody =\n submenu.children && submenu.children.length > 0 ? (\n renderContextMenuItems(submenu.children, nextKeyPath, {\n iconAlign,\n iconSpaceMode,\n })\n ) : (\n <EmptyMenuItem />\n );\n\n return (\n <ContextMenu.SubmenuRoot\n defaultOpen={submenu.defaultOpen}\n key={itemKey}\n open={submenu.open}\n onOpenChange={submenu.onOpenChange}\n >\n <ContextMenu.SubmenuTrigger\n {...submenu.triggerProps}\n className={cx(styles.item, isDanger && styles.danger)}\n closeDelay={submenu.closeDelay}\n delay={submenu.delay}\n disabled={submenu.disabled}\n label={labelText}\n openOnHover={submenu.openOnHover}\n onClick={submenu.onClick}\n >\n {renderItemContent(submenu, {\n iconAlign,\n reserveIconSpace,\n submenu: true,\n })}\n </ContextMenu.SubmenuTrigger>\n <ContextMenu.Portal>\n <ContextMenuSubmenuPositioner\n alignOffset={-4}\n className={styles.positioner}\n data-submenu=\"\"\n sideOffset={-1}\n onContextMenu={preventDefaultAndStopPropagation}\n >\n <ContextMenu.Popup\n className={submenuHasSlots ? cx(styles.popup, styles.popupWithSlots) : styles.popup}\n >\n {submenu.header == null ? null : (\n <div className={styles.header}>{submenu.header}</div>\n )}\n {submenuHasSlots ? (\n <div className={styles.slotViewport}>{submenuBody}</div>\n ) : (\n submenuBody\n )}\n {submenu.footer == null ? null : (\n <div className={styles.footer}>{submenu.footer}</div>\n )}\n </ContextMenu.Popup>\n </ContextMenuSubmenuPositioner>\n </ContextMenu.Portal>\n </ContextMenu.SubmenuRoot>\n );\n }\n\n const menuItem = item as MenuItemType;\n const label = getItemLabel(menuItem);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = 'danger' in menuItem && Boolean(menuItem.danger);\n\n return (\n <ContextMenu.Item\n className={cx(styles.item, isDanger && styles.danger)}\n closeOnClick={menuItem.closeOnClick}\n disabled={menuItem.disabled}\n key={itemKey}\n label={labelText}\n onClick={(event) => invokeItemClick(menuItem, nextKeyPath, event)}\n >\n {renderItemContent(menuItem, { iconAlign, reserveIconSpace })}\n </ContextMenu.Item>\n );\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA+CA,MAAM,+BAA+B,MAAM,EAAE,OAAO,GAAG,WAAuC;CAC5F,MAAM,iBACJ,OAAO,UAAU,cAAc,OAAO,UAAU,QAAQ,OAAO,MAAM,WAAW,WAC5E,MAAM,SACN,KAAA;CACN,MAAM,EAAE,QAAQ,KAAK,SAAS,eAA+B,YAAY,cAAc;CAEvF,MAAM,gBACJ,OAAO,UAAU,cACZ,WAAgB;EAAE;EAAQ,GAAG,MAAM,KAAK;CAAE,KAC3C;EAAE;EAAQ,GAAG;CAAM;CAEzB,OAAO,oBAAC,YAAY,YAAb;EAAwB,GAAI;EAAM,KAAK;EAAa,OAAO;CAAgB,CAAA;AACpF,CAAC;AAED,6BAA6B,cAAc;AAI3C,MAAM,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AEtB,CAAC;AACH"}
1
+ {"version":3,"file":"renderItems.mjs","names":["common"],"sources":["../../../src/base-ui/ContextMenu/renderItems.tsx"],"sourcesContent":["import { ContextMenu } from '@base-ui/react/context-menu';\nimport { cx } from 'antd-style';\nimport { Check } from 'lucide-react';\nimport { type MenuInfo } from 'rc-menu/es/interface';\nimport {\n type ComponentProps,\n type KeyboardEvent as ReactKeyboardEvent,\n type MouseEvent as ReactMouseEvent,\n type ReactNode,\n} from 'react';\nimport { memo, useCallback, useState } from 'react';\n\nimport { styles } from '@/base-ui/DropdownMenu/sharedStyle';\nimport { getFloatingCollisionPadding } from '@/base-ui/floating';\nimport { SubmenuArrowIcon } from '@/base-ui/SubmenuArrowIcon';\nimport Switch from '@/base-ui/Switch';\nimport common from '@/i18n/resources/en/common';\nimport { useTranslation } from '@/i18n/useTranslation';\nimport Icon from '@/Icon';\nimport {\n type BaseMenuItemGroupType,\n type BaseSubMenuType,\n getItemKey,\n getItemLabel,\n hasAnyIcon,\n hasCheckboxAndIcon,\n type MenuDividerType,\n type MenuItemType,\n renderIcon,\n type RenderItemContentOptions,\n type RenderOptions,\n} from '@/Menu';\nimport { preventDefaultAndStopPropagation } from '@/utils/dom';\n\nimport { useLayerZIndex } from '../zIndex';\nimport {\n type ContextMenuCheckboxItem,\n type ContextMenuItem,\n type ContextMenuSwitchItem,\n} from './type';\n\ntype ContextMenuPositionerProps = ComponentProps<typeof ContextMenu.Positioner>;\n\n/**\n * Submenu positioners are portaled outside the root menu, so they must allocate\n * their own layer z-index (same pattern as DropdownMenu) rather than relying on\n * the fixed CSS fallback that can fall behind after repeated root openings (#608).\n */\nconst ContextMenuSubmenuPositioner = memo(\n ({ collisionPadding, style, ...rest }: ContextMenuPositionerProps) => {\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\n const resolvedStyle =\n typeof style === 'function'\n ? (state: any) => ({ zIndex, ...style(state) })\n : { zIndex, ...style };\n\n return (\n <ContextMenu.Positioner\n {...rest}\n collisionPadding={collisionPadding ?? getFloatingCollisionPadding()}\n ref={zRef as any}\n style={resolvedStyle}\n />\n );\n },\n);\n\nContextMenuSubmenuPositioner.displayName = 'ContextMenuSubmenuPositioner';\n\nexport type { IconAlign, IconSpaceMode } from '@/Menu';\n\nconst EmptyMenuItem = memo(() => {\n const { t } = useTranslation(common);\n return (\n <ContextMenu.Item disabled className={cx(styles.item, styles.empty)}>\n <div className={styles.itemContent}>\n <span className={styles.label}>{t('common.empty')}</span>\n </div>\n </ContextMenu.Item>\n );\n});\n\nEmptyMenuItem.displayName = 'EmptyMenuItem';\n\ninterface ContextMenuSwitchItemInternalProps {\n checked?: boolean;\n children: ReactNode;\n closeOnClick?: boolean;\n danger?: boolean;\n defaultChecked?: boolean;\n disabled?: boolean;\n label?: string;\n onCheckedChange?: (checked: boolean) => void;\n}\n\nconst ContextMenuSwitchItemInternal = ({\n checked: checkedProp,\n children,\n closeOnClick = false,\n danger,\n defaultChecked,\n disabled,\n label,\n onCheckedChange,\n}: ContextMenuSwitchItemInternalProps) => {\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 <ContextMenu.Item\n className={cx(styles.item, danger && styles.danger)}\n closeOnClick={closeOnClick}\n disabled={disabled}\n label={label}\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 </ContextMenu.Item>\n );\n};\n\nconst renderItemContent = (\n item: MenuItemType | BaseSubMenuType | ContextMenuCheckboxItem | ContextMenuSwitchItem,\n options?: RenderItemContentOptions,\n iconNode?: ReactNode,\n) => {\n const label = getItemLabel(item);\n const desc = 'desc' in item ? item.desc : undefined;\n const extra = 'extra' in item ? item.extra : undefined;\n const indicatorOnRight = options?.indicatorOnRight;\n const alignStart = Boolean(desc) && options?.iconAlign === 'start';\n const hasCustomIcon = iconNode !== undefined && !indicatorOnRight;\n const hasIcon = hasCustomIcon ? Boolean(iconNode) : Boolean(item.icon);\n const shouldRenderIcon = hasCustomIcon\n ? Boolean(options?.reserveIconSpace || iconNode)\n : Boolean(hasIcon || options?.reserveIconSpace);\n\n const labelNode = desc ? (\n <div className={styles.labelGroup}>\n <span className={styles.label}>{label}</span>\n <span className={styles.desc}>{desc}</span>\n </div>\n ) : (\n <span className={styles.label}>{label}</span>\n );\n\n return (\n <div className={cx(styles.itemContent, alignStart && styles.itemContentAlignStart)}>\n {shouldRenderIcon ? (\n <span\n aria-hidden={!hasIcon}\n className={cx(styles.icon, alignStart && styles.iconAlignStart)}\n >\n {hasCustomIcon ? iconNode : hasIcon ? renderIcon(item.icon, 'small') : null}\n </span>\n ) : null}\n {labelNode}\n {extra ? <span className={styles.extra}>{extra}</span> : null}\n {indicatorOnRight && iconNode ? iconNode : null}\n {options?.submenu ? (\n <span className={styles.submenuArrow}>\n <SubmenuArrowIcon />\n </span>\n ) : null}\n </div>\n );\n};\n\nconst invokeItemClick = (\n item: MenuItemType,\n keyPath: string[],\n event: ReactMouseEvent<HTMLElement> | ReactKeyboardEvent<HTMLElement>,\n) => {\n if (!item.onClick) return;\n const key = item.key ?? keyPath.at(-1) ?? '';\n const info: MenuInfo = {\n domEvent: event,\n item: event.currentTarget as MenuInfo['item'],\n key: String(key),\n keyPath,\n };\n item.onClick(info);\n};\n\nexport const renderContextMenuItems = (\n items: ContextMenuItem[],\n keyPath: string[] = [],\n options?: RenderOptions,\n): ReactNode[] => {\n const iconAlign = options?.iconAlign;\n const iconSpaceMode = options?.iconSpaceMode ?? 'global';\n const reserveIconSpace =\n options?.reserveIconSpace ?? hasAnyIcon(items, iconSpaceMode === 'global');\n const indicatorOnRight = options?.indicatorOnRight ?? hasCheckboxAndIcon(items);\n\n return items.map((item, index) => {\n if (!item) return null;\n\n const fallbackKey = `${keyPath.join('-') || 'root'}-${index}`;\n const itemKey = getItemKey(item, fallbackKey);\n const nextKeyPath = [...keyPath, String(itemKey)];\n\n if ((item as ContextMenuCheckboxItem).type === 'checkbox') {\n const checkboxItem = item as ContextMenuCheckboxItem;\n const label = getItemLabel(checkboxItem);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = Boolean(checkboxItem.danger);\n const indicator = (\n <ContextMenu.CheckboxItemIndicator>\n <Icon icon={Check} size={'small'} />\n </ContextMenu.CheckboxItemIndicator>\n );\n\n return (\n <ContextMenu.CheckboxItem\n checked={checkboxItem.checked}\n className={cx(styles.item, isDanger && styles.danger)}\n closeOnClick={checkboxItem.closeOnClick}\n defaultChecked={checkboxItem.defaultChecked}\n disabled={checkboxItem.disabled}\n key={itemKey}\n label={labelText}\n onCheckedChange={(checked) => checkboxItem.onCheckedChange?.(checked)}\n >\n {renderItemContent(\n checkboxItem,\n { iconAlign, indicatorOnRight, reserveIconSpace },\n indicator,\n )}\n </ContextMenu.CheckboxItem>\n );\n }\n\n if ((item as ContextMenuSwitchItem).type === 'switch') {\n const switchItem = item as ContextMenuSwitchItem;\n const label = getItemLabel(switchItem);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = Boolean(switchItem.danger);\n\n return (\n <ContextMenuSwitchItemInternal\n checked={switchItem.checked}\n closeOnClick={switchItem.closeOnClick}\n danger={isDanger}\n defaultChecked={switchItem.defaultChecked}\n disabled={switchItem.disabled}\n key={itemKey}\n label={labelText}\n onCheckedChange={switchItem.onCheckedChange}\n >\n {renderItemContent(switchItem, { iconAlign, reserveIconSpace })}\n </ContextMenuSwitchItemInternal>\n );\n }\n\n if ((item as MenuDividerType).type === 'divider') {\n return <ContextMenu.Separator className={styles.separator} key={itemKey} />;\n }\n\n if ((item as BaseMenuItemGroupType).type === 'group') {\n const group = item as BaseMenuItemGroupType;\n const groupReserveIconSpace =\n iconSpaceMode === 'group'\n ? group.children\n ? hasAnyIcon(group.children)\n : false\n : reserveIconSpace;\n const groupIndicatorOnRight = group.children ? hasCheckboxAndIcon(group.children) : false;\n return (\n <ContextMenu.Group key={itemKey}>\n {group.label ? (\n <ContextMenu.GroupLabel className={styles.groupLabel}>\n {group.label}\n </ContextMenu.GroupLabel>\n ) : null}\n {group.children\n ? renderContextMenuItems(group.children, nextKeyPath, {\n iconAlign,\n iconSpaceMode,\n indicatorOnRight: groupIndicatorOnRight,\n reserveIconSpace: groupReserveIconSpace,\n })\n : null}\n </ContextMenu.Group>\n );\n }\n\n if (\n (item as BaseSubMenuType).type === 'submenu' ||\n ('children' in item && (item as BaseSubMenuType).children)\n ) {\n const submenu = item as BaseSubMenuType;\n const label = getItemLabel(submenu);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = 'danger' in submenu && Boolean(submenu.danger);\n const submenuHasSlots = submenu.header != null || submenu.footer != null;\n const submenuBody =\n submenu.children && submenu.children.length > 0 ? (\n renderContextMenuItems(submenu.children, nextKeyPath, {\n iconAlign,\n iconSpaceMode,\n })\n ) : (\n <EmptyMenuItem />\n );\n\n return (\n <ContextMenu.SubmenuRoot\n defaultOpen={submenu.defaultOpen}\n key={itemKey}\n open={submenu.open}\n onOpenChange={submenu.onOpenChange}\n >\n <ContextMenu.SubmenuTrigger\n {...submenu.triggerProps}\n className={cx(styles.item, isDanger && styles.danger)}\n closeDelay={submenu.closeDelay}\n delay={submenu.delay}\n disabled={submenu.disabled}\n label={labelText}\n openOnHover={submenu.openOnHover}\n onClick={submenu.onClick}\n >\n {renderItemContent(submenu, {\n iconAlign,\n reserveIconSpace,\n submenu: true,\n })}\n </ContextMenu.SubmenuTrigger>\n <ContextMenu.Portal>\n <ContextMenuSubmenuPositioner\n alignOffset={-4}\n className={styles.positioner}\n data-submenu=\"\"\n sideOffset={-1}\n onContextMenu={preventDefaultAndStopPropagation}\n >\n <ContextMenu.Popup\n className={submenuHasSlots ? cx(styles.popup, styles.popupWithSlots) : styles.popup}\n >\n {submenu.header == null ? null : (\n <div className={styles.header}>{submenu.header}</div>\n )}\n {submenuHasSlots ? (\n <div className={styles.slotViewport}>{submenuBody}</div>\n ) : (\n submenuBody\n )}\n {submenu.footer == null ? null : (\n <div className={styles.footer}>{submenu.footer}</div>\n )}\n </ContextMenu.Popup>\n </ContextMenuSubmenuPositioner>\n </ContextMenu.Portal>\n </ContextMenu.SubmenuRoot>\n );\n }\n\n const menuItem = item as MenuItemType;\n const label = getItemLabel(menuItem);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = 'danger' in menuItem && Boolean(menuItem.danger);\n\n return (\n <ContextMenu.Item\n className={cx(styles.item, isDanger && styles.danger)}\n closeOnClick={menuItem.closeOnClick}\n disabled={menuItem.disabled}\n key={itemKey}\n label={labelText}\n onClick={(event) => invokeItemClick(menuItem, nextKeyPath, event)}\n >\n {renderItemContent(menuItem, { iconAlign, reserveIconSpace })}\n </ContextMenu.Item>\n );\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAgDA,MAAM,+BAA+B,MAClC,EAAE,kBAAkB,OAAO,GAAG,WAAuC;CACpE,MAAM,iBACJ,OAAO,UAAU,cAAc,OAAO,UAAU,QAAQ,OAAO,MAAM,WAAW,WAC5E,MAAM,SACN,KAAA;CACN,MAAM,EAAE,QAAQ,KAAK,SAAS,eAA+B,YAAY,cAAc;CAEvF,MAAM,gBACJ,OAAO,UAAU,cACZ,WAAgB;EAAE;EAAQ,GAAG,MAAM,KAAK;CAAE,KAC3C;EAAE;EAAQ,GAAG;CAAM;CAEzB,OACE,oBAAC,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AS;GAEnB,OAAO;GACP,UAAU,UAAU,gBAAgB,UAAU,aAAa,KAAK;GAE/D,UAAA,kBAAkB,UAAU;IAAE;IAAW;GAAiB,CAAC;EAC5C,GALX,OAKW;CAEtB,CAAC;AACH"}
@@ -27,7 +27,7 @@ type DropdownMenuPositionerProps = React.ComponentProps<typeof Menu.Positioner>
27
27
  placement?: DropdownMenuPlacement;
28
28
  };
29
29
  declare const DropdownMenuPositioner: {
30
- ({ className, placement, hoverTrigger, align, side, sideOffset, children, style, ...rest }: DropdownMenuPositionerProps): React.JSX.Element;
30
+ ({ className, collisionPadding, placement, hoverTrigger, align, side, sideOffset, children, style, ...rest }: DropdownMenuPositionerProps): React.JSX.Element;
31
31
  displayName: string;
32
32
  };
33
33
  type DropdownMenuPopupProps = React.ComponentProps<typeof Menu.Popup>;
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import { useNativeButton } from "../../hooks/useNativeButton.mjs";
3
+ import { getFloatingCollisionPadding } from "../floating/collisionPadding.mjs";
3
4
  import { FloatingLayerProvider } from "../../hooks/useFloatingLayer.mjs";
4
5
  import { useAppElement } from "../../ThemeProvider/AppElementContext.mjs";
5
6
  import { CLASSNAMES } from "../../styles/classNames.mjs";
@@ -69,7 +70,7 @@ const DropdownMenuPortal = ({ container, ...rest }) => {
69
70
  });
70
71
  };
71
72
  DropdownMenuPortal.displayName = "DropdownMenuPortal";
72
- const DropdownMenuPositioner = ({ className, placement, hoverTrigger, align, side, sideOffset, children, style, ...rest }) => {
73
+ const DropdownMenuPositioner = ({ className, collisionPadding, placement, hoverTrigger, align, side, sideOffset, children, style, ...rest }) => {
73
74
  const placementConfig = placement ? placementMap[placement] : void 0;
74
75
  const [positionerNode, setPositionerNode] = useState(null);
75
76
  const explicitZIndex = typeof style !== "function" && style?.zIndex != null && typeof style.zIndex === "number" ? style.zIndex : void 0;
@@ -86,6 +87,7 @@ const DropdownMenuPositioner = ({ className, placement, hoverTrigger, align, sid
86
87
  ...rest,
87
88
  align: align ?? placementConfig?.align,
88
89
  className: mergeStateClassName(styles.positioner, className),
90
+ collisionPadding: collisionPadding ?? getFloatingCollisionPadding(),
89
91
  "data-hover-trigger": hoverTrigger || void 0,
90
92
  "data-placement": placement,
91
93
  ref: composedRef,
@@ -1 +1 @@
1
- {"version":3,"file":"atoms.mjs","names":[],"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 { 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 Switch from '@/base-ui/Switch';\nimport { FloatingLayerProvider } from '@/hooks/useFloatingLayer';\nimport { useNativeButton } from '@/hooks/useNativeButton';\nimport { CLASSNAMES } from '@/styles/classNames';\nimport { useAppElement } from '@/ThemeProvider';\nimport { placementMap } from '@/utils/placement';\n\nimport { useLayerZIndex } from '../zIndex';\nimport { styles } from './sharedStyle';\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\nDropdownMenu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;AACzE;AAEA,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,KAAK;CAC9E,MAAM,eAAe,gBAAgB,KAAA;CACrC,MAAM,UAAU,eAAe,cAAc;CAE7C,MAAM,sBAAsB,aACzB,eAAwB;EACvB,IAAI,CAAC,cACH,mBAAmB,UAAU;EAE/B,kBAAkB,UAAU;CAC9B,GACA,CAAC,cAAc,eAAe,CAChC;CAEA,OACE,qBAAC,KAAK,MAAN;EACE,GAAI;EACU;EACJ;EACV,YAAY,UACV,GACE,OAAO,MACP,UAAU,OAAO,QACjB,OAAO,cAAc,aAAa,UAAU,KAAK,IAAI,SACvD;EAEF,UAAU,MAAM;GACd,EAAE,eAAe;GACjB,IAAI,CAAC,UACH,oBAAoB,CAAC,OAAO;EAEhC;EAhBF,UAAA,CAkBG,UACD,oBAAC,QAAD;GACE,OAAO;IAAE,SAAS;IAAe,mBAAmB;GAAG;GACvD,UAAU,MAAM,EAAE,gBAAgB;GAElC,UAAA,oBAAC,QAAD;IACW;IACC;IACV,MAAK;IACL,UAAU;IACV,UAAU;IACV,UAAU,GAAG,MAAM,EAAE,gBAAgB;GACtC,CAAA;EACG,CAAA,CACG;;AAEf;AAEA,uBAAuB,cAAc"}
1
+ {"version":3,"file":"atoms.mjs","names":[],"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 { 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 { getFloatingCollisionPadding } from '@/base-ui/floating';\nimport Switch from '@/base-ui/Switch';\nimport { FloatingLayerProvider } from '@/hooks/useFloatingLayer';\nimport { useNativeButton } from '@/hooks/useNativeButton';\nimport { CLASSNAMES } from '@/styles/classNames';\nimport { useAppElement } from '@/ThemeProvider';\nimport { placementMap } from '@/utils/placement';\n\nimport { useLayerZIndex } from '../zIndex';\nimport { styles } from './sharedStyle';\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 collisionPadding,\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 collisionPadding={collisionPadding ?? getFloatingCollisionPadding()}\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":";;;;;;;;;;;;;;;;;;AAsBA,MAAa,oBAAsC,UAAU,oBAAC,KAAK,MAAN;CAAW,OAAO;CAAO,GAAI;AAAQ,CAAA;AAClG,MAAa,0BAA0B,KAAK;AAC5C,MAAa,oCAAoC,KAAK;AAEtD,MAAM,uBACJ,MACA,cACG;CACH,IAAI,OAAO,cAAc,YAAY,QAAQ,UAAkB,GAAG,MAAM,UAAU,KAAK,CAAC;CACxF,OAAO,GAAG,MAAM,SAAS;AAC3B;AASA,MAAa,uBAAuB,EAClC,UACA,WACA,cACA,KAAK,SACL,GAAG,WAC2B;CAC9B,MAAM,EAAE,8BAA8B,yBAAyB,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AAI;EACU;EACJ;EACV,YAAY,UACV,GACE,OAAO,MACP,UAAU,OAAO,QACjB,OAAO,cAAc,aAAa,UAAU,KAAK,IAAI,SACvD;EAEF,UAAU,MAAM;GACd,EAAE,eAAe;GACjB,IAAI,CAAC,UACH,oBAAoB,CAAC,OAAO;EAEhC;EAhBF,UAAA,CAkBG,UACD,oBAAC,QAAD;GACE,OAAO;IAAE,SAAS;IAAe,mBAAmB;GAAG;GACvD,UAAU,MAAM,EAAE,gBAAgB;GAElC,UAAA,oBAAC,QAAD;IACW;IACC;IACV,MAAK;IACL,UAAU;IACV,UAAU;IACV,UAAU,GAAG,MAAM,EAAE,gBAAgB;GACtC,CAAA;EACG,CAAA,CACG;;AAEf;AAEA,uBAAuB,cAAc"}
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { placementMap } from "../../utils/placement.mjs";
3
- import { useDestroyOnInvalidActiveTriggerElement, useHidePopupWhenPositionerAtOrigin } from "../../utils/destroyOnInvalidActiveTriggerElement.mjs";
3
+ import { useDestroyOnInvalidActiveTriggerElement, useHidePopupWhenPositionerAtOrigin, usePopupHandleStore } from "../../utils/destroyOnInvalidActiveTriggerElement.mjs";
4
4
  import { parseTrigger } from "../../utils/parseTrigger.mjs";
5
5
  import { PopoverArrowIcon } from "./ArrowIcon.mjs";
6
6
  import { usePopoverPortalContainer } from "./PopoverPortal.mjs";
@@ -39,8 +39,9 @@ const PopoverGroup = ({ children, contentLayoutAnimation = false, disableDestroy
39
39
  }
40
40
  item?.onOpenChange?.(nextOpen);
41
41
  }, []);
42
- useDestroyOnInvalidActiveTriggerElement(handle.store, destroy, { enabled: !disableDestroyOnInvalidTrigger });
43
- useHidePopupWhenPositionerAtOrigin(handle.store, { enabled: !disableZeroOriginGuard });
42
+ const store = usePopupHandleStore(handle);
43
+ useDestroyOnInvalidActiveTriggerElement(store, destroy, { enabled: !disableDestroyOnInvalidTrigger });
44
+ useHidePopupWhenPositionerAtOrigin(store, { enabled: !disableZeroOriginGuard });
44
45
  const portalContainer = usePopoverPortalContainer();
45
46
  return /* @__PURE__ */ jsx(PopoverGroupHandleContext, {
46
47
  value: handle,
@@ -1 +1 @@
1
- {"version":3,"file":"PopoverGroup.mjs","names":["BasePopover"],"sources":["../../../src/base-ui/Popover/PopoverGroup.tsx"],"sourcesContent":["'use client';\n\nimport { Popover as BasePopover } from '@base-ui/react/popover';\nimport { type FC, type ReactNode, useCallback, useMemo, useRef, useState } from 'react';\n\nimport {\n useDestroyOnInvalidActiveTriggerElement,\n useHidePopupWhenPositionerAtOrigin,\n} from '@/utils/destroyOnInvalidActiveTriggerElement';\nimport { parseTrigger } from '@/utils/parseTrigger';\nimport { placementMap } from '@/utils/placement';\n\nimport { PopoverArrowIcon } from './ArrowIcon';\nimport {\n PopoverArrow,\n PopoverPopup,\n PopoverPortal,\n PopoverPositioner,\n PopoverViewport,\n} from './atoms';\nimport { PopoverProvider } from './context';\nimport {\n PopoverGroupHandleContext,\n type PopoverGroupItem,\n PopoverGroupPropsContext,\n type PopoverGroupSharedProps,\n} from './groupContext';\nimport { isHoverOnlyTriggerElement, shouldCancelHoverOnlyPressOpen } from './hoverOnlyPress';\nimport { usePopoverPortalContainer } from './PopoverPortal';\n\ntype PopoverGroupProps = PopoverGroupSharedProps & {\n children: ReactNode;\n};\n\nconst PopoverGroup: FC<PopoverGroupProps> = ({\n children,\n contentLayoutAnimation = false,\n disableDestroyOnInvalidTrigger = false,\n disableZeroOriginGuard = false,\n ...sharedProps\n}) => {\n const [{ handle, key }, setHandleState] = useState(() => ({\n handle: BasePopover.createHandle<PopoverGroupItem>(),\n key: 0,\n }));\n const activeItemRef = useRef<PopoverGroupItem | null>(null);\n const destroy = useCallback(() => {\n activeItemRef.current = null;\n setHandleState(({ key }) => ({\n handle: BasePopover.createHandle<PopoverGroupItem>(),\n key: key + 1,\n }));\n }, []);\n const close = useCallback(() => {\n handle.close();\n }, [handle]);\n const contextValue = useMemo(() => ({ close }), [close]);\n\n const handleOpenChange = useCallback(\n (\n nextOpen: boolean,\n eventDetails?: { cancel?: () => void; reason?: string; trigger?: unknown },\n ) => {\n const item = activeItemRef.current;\n // The press belongs to the trigger that fired it, which is not necessarily\n // the member currently showing — judging by `activeItemRef` cancels every\n // click member's first press, since the active one is a hover member (or\n // none, which also reads as hover-only).\n const hoverOnlyTrigger = isHoverOnlyTriggerElement(eventDetails?.trigger);\n const openOnClick =\n hoverOnlyTrigger === null\n ? parseTrigger(item?.trigger ?? 'hover').openOnClick\n : !hoverOnlyTrigger;\n\n if (shouldCancelHoverOnlyPressOpen(openOnClick, nextOpen, eventDetails?.reason)) {\n eventDetails?.cancel?.();\n return;\n }\n\n item?.onOpenChange?.(nextOpen);\n },\n [],\n );\n\n useDestroyOnInvalidActiveTriggerElement(handle.store, destroy, {\n enabled: !disableDestroyOnInvalidTrigger,\n });\n useHidePopupWhenPositionerAtOrigin(handle.store, { enabled: !disableZeroOriginGuard });\n\n const portalContainer = usePopoverPortalContainer();\n\n return (\n <PopoverGroupHandleContext value={handle}>\n <PopoverGroupPropsContext value={sharedProps}>\n {children}\n <BasePopover.Root handle={handle} key={key} onOpenChange={handleOpenChange}>\n {({ payload }) => {\n const item = (payload as PopoverGroupItem | null) ?? null;\n activeItemRef.current = item;\n\n if (!item?.content) return null;\n\n const arrow = item.arrow ?? false;\n const placement = item.placement ?? 'top';\n const { openOnHover } = parseTrigger(item.trigger ?? 'hover');\n\n const placementConfig = placementMap[placement] ?? placementMap.top;\n const resolvedSideOffset = arrow ? 10 : 6;\n\n const resolvedClassNames = {\n arrow: item.classNames?.arrow,\n popup: item.className,\n positioner: item.classNames?.root,\n viewport: item.classNames?.content,\n };\n\n const resolvedStyles = {\n arrow: item.styles?.arrow,\n positioner: {\n ...item.styles?.root,\n ...(item.zIndex !== undefined ? { zIndex: item.zIndex } : {}),\n },\n viewport: item.styles?.content,\n };\n\n const contentNode = (\n <PopoverProvider value={contextValue}>{item.content}</PopoverProvider>\n );\n\n const popup = (\n <PopoverPositioner\n align={placementConfig.align}\n className={resolvedClassNames.positioner}\n data-layout-animation={contentLayoutAnimation || undefined}\n hoverTrigger={openOnHover}\n placement={placement}\n side={placementConfig.side}\n sideOffset={resolvedSideOffset}\n style={resolvedStyles.positioner}\n {...item.positionerProps}\n >\n <PopoverPopup\n className={resolvedClassNames.popup}\n data-layout-animation={contentLayoutAnimation || undefined}\n {...item.popupProps}\n >\n {arrow && (\n <PopoverArrow className={resolvedClassNames.arrow} style={resolvedStyles.arrow}>\n {PopoverArrowIcon}\n </PopoverArrow>\n )}\n <PopoverViewport\n className={resolvedClassNames.viewport}\n style={resolvedStyles.viewport}\n >\n {contentNode}\n </PopoverViewport>\n </PopoverPopup>\n </PopoverPositioner>\n );\n\n return portalContainer ? (\n <PopoverPortal container={portalContainer}>{popup}</PopoverPortal>\n ) : null;\n }}\n </BasePopover.Root>\n </PopoverGroupPropsContext>\n </PopoverGroupHandleContext>\n );\n};\n\nPopoverGroup.displayName = 'PopoverGroup';\n\nexport default PopoverGroup;\n"],"mappings":";;;;;;;;;;;;;;AAkCA,MAAM,gBAAuC,EAC3C,UACA,yBAAyB,OACzB,iCAAiC,OACjC,yBAAyB,OACzB,GAAG,kBACC;CACJ,MAAM,CAAC,EAAE,QAAQ,OAAO,kBAAkB,gBAAgB;EACxD,QAAQA,QAAY,aAA+B;EACnD,KAAK;CACP,EAAE;CACF,MAAM,gBAAgB,OAAgC,IAAI;CAC1D,MAAM,UAAU,kBAAkB;EAChC,cAAc,UAAU;EACxB,gBAAgB,EAAE,WAAW;GAC3B,QAAQA,QAAY,aAA+B;GACnD,KAAK,MAAM;EACb,EAAE;CACJ,GAAG,CAAC,CAAC;CACL,MAAM,QAAQ,kBAAkB;EAC9B,OAAO,MAAM;CACf,GAAG,CAAC,MAAM,CAAC;CACX,MAAM,eAAe,eAAe,EAAE,MAAM,IAAI,CAAC,KAAK,CAAC;CAEvD,MAAM,mBAAmB,aAErB,UACA,iBACG;EACH,MAAM,OAAO,cAAc;EAK3B,MAA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,oBAAC,mBAAD;MACE,OAAO,gBAAgB;MACvB,WAAW,mBAAmB;MAC9B,yBAAuB,0BAA0B,KAAA;MACjD,cAAc;MACH;MACX,MAAM,gBAAgB;MACtB,YAAY;MACZ,OAAO,eAAe;MACtB,GAAI,KAAK;MAET,UAAA,qBAAC,cAAD;OACE,WAAW,mBAAmB;OAC9B,yBAAuB,0BAA0B,KAAA;OACjD,GAAI,KAAK;OAHX,UAAA,CAKG,SACC,oBAAC,cAAD;QAAc,WAAW,mBAAmB;QAAO,OAAO,eAAe;QACtE,UAAA;OACW,CAAA,GAEhB,oBAAC,iBAAD;QACE,WAAW,mBAAmB;QAC9B,OAAO,eAAe;QAErB,UAAA;OACc,CAAA,CACL;;KACG,CAAA;KAGrB,OAAO,kBACL,oBAAC,eAAD;MAAe,WAAW;MAAkB,UAAA;KAAqB,CAAA,IAC/D;IACN;GACgB,GAtEqB,GAsErB,CACM;;CACD,CAAA;AAE/B;AAEA,aAAa,cAAc"}
1
+ {"version":3,"file":"PopoverGroup.mjs","names":["BasePopover"],"sources":["../../../src/base-ui/Popover/PopoverGroup.tsx"],"sourcesContent":["'use client';\n\nimport { Popover as BasePopover } from '@base-ui/react/popover';\nimport { type FC, type ReactNode, useCallback, useMemo, useRef, useState } from 'react';\n\nimport {\n useDestroyOnInvalidActiveTriggerElement,\n useHidePopupWhenPositionerAtOrigin,\n usePopupHandleStore,\n} from '@/utils/destroyOnInvalidActiveTriggerElement';\nimport { parseTrigger } from '@/utils/parseTrigger';\nimport { placementMap } from '@/utils/placement';\n\nimport { PopoverArrowIcon } from './ArrowIcon';\nimport {\n PopoverArrow,\n PopoverPopup,\n PopoverPortal,\n PopoverPositioner,\n PopoverViewport,\n} from './atoms';\nimport { PopoverProvider } from './context';\nimport {\n PopoverGroupHandleContext,\n type PopoverGroupItem,\n PopoverGroupPropsContext,\n type PopoverGroupSharedProps,\n} from './groupContext';\nimport { isHoverOnlyTriggerElement, shouldCancelHoverOnlyPressOpen } from './hoverOnlyPress';\nimport { usePopoverPortalContainer } from './PopoverPortal';\n\ntype PopoverGroupProps = PopoverGroupSharedProps & {\n children: ReactNode;\n};\n\nconst PopoverGroup: FC<PopoverGroupProps> = ({\n children,\n contentLayoutAnimation = false,\n disableDestroyOnInvalidTrigger = false,\n disableZeroOriginGuard = false,\n ...sharedProps\n}) => {\n const [{ handle, key }, setHandleState] = useState(() => ({\n handle: BasePopover.createHandle<PopoverGroupItem>(),\n key: 0,\n }));\n const activeItemRef = useRef<PopoverGroupItem | null>(null);\n const destroy = useCallback(() => {\n activeItemRef.current = null;\n setHandleState(({ key }) => ({\n handle: BasePopover.createHandle<PopoverGroupItem>(),\n key: key + 1,\n }));\n }, []);\n const close = useCallback(() => {\n handle.close();\n }, [handle]);\n const contextValue = useMemo(() => ({ close }), [close]);\n\n const handleOpenChange = useCallback(\n (\n nextOpen: boolean,\n eventDetails?: { cancel?: () => void; reason?: string; trigger?: unknown },\n ) => {\n const item = activeItemRef.current;\n // The press belongs to the trigger that fired it, which is not necessarily\n // the member currently showing — judging by `activeItemRef` cancels every\n // click member's first press, since the active one is a hover member (or\n // none, which also reads as hover-only).\n const hoverOnlyTrigger = isHoverOnlyTriggerElement(eventDetails?.trigger);\n const openOnClick =\n hoverOnlyTrigger === null\n ? parseTrigger(item?.trigger ?? 'hover').openOnClick\n : !hoverOnlyTrigger;\n\n if (shouldCancelHoverOnlyPressOpen(openOnClick, nextOpen, eventDetails?.reason)) {\n eventDetails?.cancel?.();\n return;\n }\n\n item?.onOpenChange?.(nextOpen);\n },\n [],\n );\n\n const store = usePopupHandleStore(handle);\n useDestroyOnInvalidActiveTriggerElement(store, destroy, {\n enabled: !disableDestroyOnInvalidTrigger,\n });\n useHidePopupWhenPositionerAtOrigin(store, { enabled: !disableZeroOriginGuard });\n\n const portalContainer = usePopoverPortalContainer();\n\n return (\n <PopoverGroupHandleContext value={handle}>\n <PopoverGroupPropsContext value={sharedProps}>\n {children}\n <BasePopover.Root handle={handle} key={key} onOpenChange={handleOpenChange}>\n {({ payload }) => {\n const item = (payload as PopoverGroupItem | null) ?? null;\n activeItemRef.current = item;\n\n if (!item?.content) return null;\n\n const arrow = item.arrow ?? false;\n const placement = item.placement ?? 'top';\n const { openOnHover } = parseTrigger(item.trigger ?? 'hover');\n\n const placementConfig = placementMap[placement] ?? placementMap.top;\n const resolvedSideOffset = arrow ? 10 : 6;\n\n const resolvedClassNames = {\n arrow: item.classNames?.arrow,\n popup: item.className,\n positioner: item.classNames?.root,\n viewport: item.classNames?.content,\n };\n\n const resolvedStyles = {\n arrow: item.styles?.arrow,\n positioner: {\n ...item.styles?.root,\n ...(item.zIndex !== undefined ? { zIndex: item.zIndex } : {}),\n },\n viewport: item.styles?.content,\n };\n\n const contentNode = (\n <PopoverProvider value={contextValue}>{item.content}</PopoverProvider>\n );\n\n const popup = (\n <PopoverPositioner\n align={placementConfig.align}\n className={resolvedClassNames.positioner}\n data-layout-animation={contentLayoutAnimation || undefined}\n hoverTrigger={openOnHover}\n placement={placement}\n side={placementConfig.side}\n sideOffset={resolvedSideOffset}\n style={resolvedStyles.positioner}\n {...item.positionerProps}\n >\n <PopoverPopup\n className={resolvedClassNames.popup}\n data-layout-animation={contentLayoutAnimation || undefined}\n {...item.popupProps}\n >\n {arrow && (\n <PopoverArrow className={resolvedClassNames.arrow} style={resolvedStyles.arrow}>\n {PopoverArrowIcon}\n </PopoverArrow>\n )}\n <PopoverViewport\n className={resolvedClassNames.viewport}\n style={resolvedStyles.viewport}\n >\n {contentNode}\n </PopoverViewport>\n </PopoverPopup>\n </PopoverPositioner>\n );\n\n return portalContainer ? (\n <PopoverPortal container={portalContainer}>{popup}</PopoverPortal>\n ) : null;\n }}\n </BasePopover.Root>\n </PopoverGroupPropsContext>\n </PopoverGroupHandleContext>\n );\n};\n\nPopoverGroup.displayName = 'PopoverGroup';\n\nexport default PopoverGroup;\n"],"mappings":";;;;;;;;;;;;;;AAmCA,MAAM,gBAAuC,EAC3C,UACA,yBAAyB,OACzB,i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  placement?: PopoverPlacement;
31
31
  };
32
32
  declare const PopoverPositioner: {
33
- ({ children, className, hoverTrigger, placement, align, side, sideOffset, style, ...rest }: PopoverPositionerAtomProps): import("react").JSX.Element;
33
+ ({ children, className, collisionPadding, hoverTrigger, placement, align, side, sideOffset, style, ...rest }: PopoverPositionerAtomProps): import("react").JSX.Element;
34
34
  displayName: string;
35
35
  };
36
36
  type PopoverPopupAtomProps = ComponentProps<typeof Popover.Popup>;
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import { useNativeButton } from "../../hooks/useNativeButton.mjs";
3
+ import { getFloatingCollisionPadding } from "../floating/collisionPadding.mjs";
3
4
  import { FloatingLayerProvider } from "../../hooks/useFloatingLayer.mjs";
4
5
  import { placementMap } from "../../utils/placement.mjs";
5
6
  import { useLayerZIndex } from "../zIndex/useLayerZIndex.mjs";
@@ -63,7 +64,7 @@ const PopoverPortal = ({ container, root, children, ...rest }) => {
63
64
  });
64
65
  };
65
66
  PopoverPortal.displayName = "PopoverPortal";
66
- const PopoverPositioner = ({ children, className, hoverTrigger, placement, align, side, sideOffset, style, ...rest }) => {
67
+ const PopoverPositioner = ({ children, className, collisionPadding, hoverTrigger, placement, align, side, sideOffset, style, ...rest }) => {
67
68
  const placementConfig = placement ? placementMap[placement] : void 0;
68
69
  const [positionerNode, setPositionerNode] = useState(null);
69
70
  const explicitZIndex = typeof style !== "function" && style?.zIndex != null && typeof style.zIndex === "number" ? style.zIndex : void 0;
@@ -78,6 +79,7 @@ const PopoverPositioner = ({ children, className, hoverTrigger, placement, align
78
79
  };
79
80
  return /* @__PURE__ */ jsx(Popover.Positioner, {
80
81
  align: align ?? placementConfig?.align ?? "center",
82
+ collisionPadding: collisionPadding ?? getFloatingCollisionPadding(),
81
83
  "data-hover-trigger": hoverTrigger || void 0,
82
84
  "data-placement": placement,
83
85
  ref: composedRef,
@@ -1 +1 @@
1
- {"version":3,"file":"atoms.mjs","names":["BasePopover"],"sources":["../../../src/base-ui/Popover/atoms.tsx"],"sourcesContent":["'use client';\n\nimport { mergeProps } from '@base-ui/react/merge-props';\nimport { Popover as BasePopover } from '@base-ui/react/popover';\nimport { cx } from 'antd-style';\nimport {\n cloneElement,\n type ComponentProps,\n type ComponentPropsWithRef,\n isValidElement,\n useState,\n} from 'react';\nimport { mergeRefs, useMergeRefs } from 'react-merge-refs';\n\nimport { FloatingLayerProvider } from '@/hooks/useFloatingLayer';\nimport { useNativeButton } from '@/hooks/useNativeButton';\nimport { placementMap } from '@/utils/placement';\n\nimport { useLayerZIndex } from '../zIndex';\nimport { PopoverArrowIcon } from './ArrowIcon';\nimport { usePopoverPortalContainer } from './PopoverPortal';\nimport { styles } from './style';\nimport { type PopoverPlacement } from './type';\n\nexport const PopoverRoot = BasePopover.Root;\nexport const PopoverBackdrop = BasePopover.Backdrop;\n\nexport type PopoverTriggerElementProps = Omit<\n ComponentPropsWithRef<typeof BasePopover.Trigger>,\n 'children' | 'render'\n> & {\n children: ComponentProps<typeof BasePopover.Trigger>['children'];\n};\n\nexport const PopoverTriggerElement = ({\n children,\n className,\n nativeButton,\n ref: refProp,\n ...rest\n}: PopoverTriggerElementProps) => {\n const { isNativeButtonTriggerElement, resolvedNativeButton } = useNativeButton({\n children,\n nativeButton,\n });\n\n if (isValidElement(children)) {\n return (\n <BasePopover.Trigger\n {...rest}\n nativeButton={resolvedNativeButton}\n render={(props, state) => {\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, ...restProps } = props as any;\n return restProps;\n })();\n\n const mergedProps = mergeProps((children as any).props, resolvedProps);\n const baseClassName =\n typeof (mergedProps as any).className === 'function'\n ? (mergedProps as any).className(state)\n : (mergedProps as any).className;\n const extraClassName =\n typeof (className as any) === 'function' ? (className as any)(state) : className;\n\n return cloneElement(children as any, {\n ...mergedProps,\n className: cx(baseClassName, extraClassName),\n ref: mergeRefs([(children as any).ref, (props as any).ref, refProp]),\n });\n }}\n />\n );\n }\n\n return (\n <BasePopover.Trigger\n {...rest}\n className={className}\n nativeButton={resolvedNativeButton}\n ref={refProp}\n >\n {children}\n </BasePopover.Trigger>\n );\n};\n\nPopoverTriggerElement.displayName = 'PopoverTriggerElement';\n\nexport type PopoverPortalAtomProps = Omit<\n ComponentProps<typeof BasePopover.Portal>,\n 'container'\n> & {\n /**\n * Portal container. When not provided, it uses the shared container created by `usePopoverPortalContainer`.\n */\n container?: HTMLElement | null;\n /**\n * Root element used by `usePopoverPortalContainer` to create the default container.\n */\n root?: HTMLElement | ShadowRoot | null;\n};\n\nexport const PopoverPortal = ({ container, root, children, ...rest }: PopoverPortalAtomProps) => {\n const defaultContainer = usePopoverPortalContainer(root);\n const resolvedContainer = container ?? defaultContainer;\n\n if (!resolvedContainer) return null;\n\n return (\n <BasePopover.Portal container={resolvedContainer} {...rest}>\n {children}\n </BasePopover.Portal>\n );\n};\n\nPopoverPortal.displayName = 'PopoverPortal';\n\nexport type PopoverPositionerAtomProps = ComponentProps<typeof BasePopover.Positioner> & {\n hoverTrigger?: boolean;\n placement?: PopoverPlacement;\n};\n\nexport const PopoverPositioner = ({\n children,\n className,\n hoverTrigger,\n placement,\n align,\n side,\n sideOffset,\n style,\n ...rest\n}: PopoverPositionerAtomProps) => {\n const placementConfig = placement ? placementMap[placement] : undefined;\n const [positionerNode, setPositionerNode] = useState<HTMLDivElement | null>(null);\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 <BasePopover.Positioner\n align={align ?? placementConfig?.align ?? 'center'}\n data-hover-trigger={hoverTrigger || undefined}\n data-placement={placement}\n ref={composedRef as any}\n side={side ?? placementConfig?.side ?? 'bottom'}\n sideOffset={sideOffset ?? 6}\n style={resolvedStyle}\n className={(state) =>\n cx(styles.positioner, typeof className === 'function' ? className(state) : className)\n }\n {...rest}\n >\n <FloatingLayerProvider value={positionerNode}>{children}</FloatingLayerProvider>\n </BasePopover.Positioner>\n );\n};\n\nPopoverPositioner.displayName = 'PopoverPositioner';\n\nexport type PopoverPopupAtomProps = ComponentProps<typeof BasePopover.Popup>;\n\nexport const PopoverPopup = ({ className, ...rest }: PopoverPopupAtomProps) => {\n return (\n <BasePopover.Popup\n className={(state) =>\n cx(styles.popup, typeof className === 'function' ? className(state) : className)\n }\n {...rest}\n />\n );\n};\n\nPopoverPopup.displayName = 'PopoverPopup';\n\nexport type PopoverArrowAtomProps = ComponentProps<typeof BasePopover.Arrow>;\n\nexport const PopoverArrow = ({ className, children, ...rest }: PopoverArrowAtomProps) => {\n return (\n <BasePopover.Arrow\n className={(state) =>\n cx(styles.arrow, typeof className === 'function' ? className(state) : className)\n }\n {...rest}\n >\n {children ?? PopoverArrowIcon}\n </BasePopover.Arrow>\n );\n};\n\nPopoverArrow.displayName = 'PopoverArrow';\n\nexport type PopoverViewportAtomProps = ComponentProps<typeof BasePopover.Viewport>;\n\nexport const PopoverViewport = ({ className, ...rest }: PopoverViewportAtomProps) => {\n return (\n <BasePopover.Viewport\n className={(state) =>\n cx(styles.viewport, typeof className === 'function' ? className(state) : className)\n }\n {...rest}\n />\n );\n};\n\nPopoverViewport.displayName = 'PopoverViewport';\n"],"mappings":";;;;;;;;;;;;;;;AAwBA,MAAa,cAAcA,QAAY;AACvC,MAAa,kBAAkBA,QAAY;AAS3C,MAAa,yBAAyB,EACpC,UACA,WACA,cACA,KAAK,SACL,GAAG,WAC6B;CAChC,MAAM,EAAE,8BAA8B,yBAAyB,gBAAgB;EAC7E;EACA;CACF,CAAC;CAED,IAAI,eAAe,QAAQ,GACzB,OACE,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/atoms.tsx"],"sourcesContent":["'use client';\n\nimport { mergeProps } from '@base-ui/react/merge-props';\nimport { Popover as BasePopover } from '@base-ui/react/popover';\nimport { cx } from 'antd-style';\nimport {\n cloneElement,\n type ComponentProps,\n type ComponentPropsWithRef,\n isValidElement,\n useState,\n} from 'react';\nimport { mergeRefs, useMergeRefs } from 'react-merge-refs';\n\nimport { getFloatingCollisionPadding } from '@/base-ui/floating';\nimport { FloatingLayerProvider } from '@/hooks/useFloatingLayer';\nimport { useNativeButton } from '@/hooks/useNativeButton';\nimport { placementMap } from '@/utils/placement';\n\nimport { useLayerZIndex } from '../zIndex';\nimport { PopoverArrowIcon } from './ArrowIcon';\nimport { usePopoverPortalContainer } from './PopoverPortal';\nimport { styles } from './style';\nimport { type PopoverPlacement } from './type';\n\nexport const PopoverRoot = BasePopover.Root;\nexport const PopoverBackdrop = BasePopover.Backdrop;\n\nexport type PopoverTriggerElementProps = Omit<\n ComponentPropsWithRef<typeof BasePopover.Trigger>,\n 'children' | 'render'\n> & {\n children: ComponentProps<typeof BasePopover.Trigger>['children'];\n};\n\nexport const PopoverTriggerElement = ({\n children,\n className,\n nativeButton,\n ref: refProp,\n ...rest\n}: PopoverTriggerElementProps) => {\n const { isNativeButtonTriggerElement, resolvedNativeButton } = useNativeButton({\n children,\n nativeButton,\n });\n\n if (isValidElement(children)) {\n return (\n <BasePopover.Trigger\n {...rest}\n nativeButton={resolvedNativeButton}\n render={(props, state) => {\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, ...restProps } = props as any;\n return restProps;\n })();\n\n const mergedProps = mergeProps((children as any).props, resolvedProps);\n const baseClassName =\n typeof (mergedProps as any).className === 'function'\n ? (mergedProps as any).className(state)\n : (mergedProps as any).className;\n const extraClassName =\n typeof (className as any) === 'function' ? (className as any)(state) : className;\n\n return cloneElement(children as any, {\n ...mergedProps,\n className: cx(baseClassName, extraClassName),\n ref: mergeRefs([(children as any).ref, (props as any).ref, refProp]),\n });\n }}\n />\n );\n }\n\n return (\n <BasePopover.Trigger\n {...rest}\n className={className}\n nativeButton={resolvedNativeButton}\n ref={refProp}\n >\n {children}\n </BasePopover.Trigger>\n );\n};\n\nPopoverTriggerElement.displayName = 'PopoverTriggerElement';\n\nexport type PopoverPortalAtomProps = Omit<\n ComponentProps<typeof BasePopover.Portal>,\n 'container'\n> & {\n /**\n * Portal container. When not provided, it uses the shared container created by `usePopoverPortalContainer`.\n */\n container?: HTMLElement | null;\n /**\n * Root element used by `usePopoverPortalContainer` to create the default container.\n */\n root?: HTMLElement | ShadowRoot | null;\n};\n\nexport const PopoverPortal = ({ container, root, children, ...rest }: PopoverPortalAtomProps) => {\n const defaultContainer = usePopoverPortalContainer(root);\n const resolvedContainer = container ?? defaultContainer;\n\n if (!resolvedContainer) return null;\n\n return (\n <BasePopover.Portal container={resolvedContainer} {...rest}>\n {children}\n </BasePopover.Portal>\n );\n};\n\nPopoverPortal.displayName = 'PopoverPortal';\n\nexport type PopoverPositionerAtomProps = ComponentProps<typeof BasePopover.Positioner> & {\n hoverTrigger?: boolean;\n placement?: PopoverPlacement;\n};\n\nexport const PopoverPositioner = ({\n children,\n className,\n collisionPadding,\n hoverTrigger,\n placement,\n align,\n side,\n sideOffset,\n style,\n ...rest\n}: PopoverPositionerAtomProps) => {\n const placementConfig = placement ? placementMap[placement] : undefined;\n const [positionerNode, setPositionerNode] = useState<HTMLDivElement | null>(null);\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 <BasePopover.Positioner\n align={align ?? placementConfig?.align ?? 'center'}\n collisionPadding={collisionPadding ?? getFloatingCollisionPadding()}\n data-hover-trigger={hoverTrigger || undefined}\n data-placement={placement}\n ref={composedRef as any}\n side={side ?? placementConfig?.side ?? 'bottom'}\n sideOffset={sideOffset ?? 6}\n style={resolvedStyle}\n className={(state) =>\n cx(styles.positioner, typeof className === 'function' ? className(state) : className)\n }\n {...rest}\n >\n <FloatingLayerProvider value={positionerNode}>{children}</FloatingLayerProvider>\n </BasePopover.Positioner>\n );\n};\n\nPopoverPositioner.displayName = 'PopoverPositioner';\n\nexport type PopoverPopupAtomProps = ComponentProps<typeof BasePopover.Popup>;\n\nexport const PopoverPopup = ({ className, ...rest }: PopoverPopupAtomProps) => {\n return (\n <BasePopover.Popup\n className={(state) =>\n cx(styles.popup, typeof className === 'function' ? className(state) : className)\n }\n {...rest}\n />\n );\n};\n\nPopoverPopup.displayName = 'PopoverPopup';\n\nexport type PopoverArrowAtomProps = ComponentProps<typeof BasePopover.Arrow>;\n\nexport const PopoverArrow = ({ className, children, ...rest }: PopoverArrowAtomProps) => {\n return (\n <BasePopover.Arrow\n className={(state) =>\n cx(styles.arrow, typeof className === 'function' ? className(state) : className)\n }\n {...rest}\n >\n {children ?? PopoverArrowIcon}\n </BasePopover.Arrow>\n );\n};\n\nPopoverArrow.displayName = 'PopoverArrow';\n\nexport type PopoverViewportAtomProps = ComponentProps<typeof BasePopover.Viewport>;\n\nexport const PopoverViewport = ({ className, ...rest }: PopoverViewportAtomProps) => {\n return (\n <BasePopover.Viewport\n className={(state) =>\n cx(styles.viewport, typeof className === 'function' ? className(state) : className)\n }\n {...rest}\n />\n );\n};\n\nPopoverViewport.displayName = 'PopoverViewport';\n"],"mappings":";;;;;;;;;;;;;;;;AAyBA,MAAa,cAAcA,QAAY;AACvC,MAAa,kBAAkBA,QAAY;AAS3C,MAAa,yBAAyB,EACpC,UACA,WACA,cACA,KAAK,SACL,GAAG,WAC6B;CAChC,M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KAAK,IAAI,SAAS;EAEpF,GAAI;CACL,CAAA;AAEL;AAEA,gBAAgB,cAAc"}
@@ -95,7 +95,6 @@ const Select$1 = memo(({ allowClear, autoFocus, className, classNames, defaultOp
95
95
  const popupStyle = useMemo(() => {
96
96
  const maxHeight = isItemAligned ? "80vh" : `${listHeight}px`;
97
97
  const baseStyle = {
98
- maxHeight,
99
98
  maxWidth: "var(--available-width)",
100
99
  minWidth: "var(--anchor-width)",
101
100
  ["--lobe-select-popup-max-height"]: maxHeight