@lobehub/ui 4.11.1 → 4.11.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 (162) hide show
  1. package/es/Accordion/Accordion.d.mts +2 -2
  2. package/es/Accordion/Accordion.mjs +2 -2
  3. package/es/Accordion/Accordion.mjs.map +1 -1
  4. package/es/Accordion/AccordionItem.d.mts +2 -2
  5. package/es/Accordion/AccordionItem.mjs +2 -2
  6. package/es/Accordion/AccordionItem.mjs.map +1 -1
  7. package/es/ActionIcon/ActionIcon.d.mts +2 -2
  8. package/es/Alert/Alert.d.mts +2 -2
  9. package/es/AutoComplete/Select.d.mts +2 -2
  10. package/es/Avatar/AvatarGroup/index.d.mts +2 -2
  11. package/es/Burger/Burger.d.mts +2 -2
  12. package/es/Checkbox/Checkbox.mjs +2 -2
  13. package/es/Checkbox/Checkbox.mjs.map +1 -1
  14. package/es/Checkbox/CheckboxGroup.mjs +2 -2
  15. package/es/Checkbox/CheckboxGroup.mjs.map +1 -1
  16. package/es/CodeEditor/CodeEditor.d.mts +2 -2
  17. package/es/CodeEditor/CodeEditor.mjs +2 -2
  18. package/es/CodeEditor/CodeEditor.mjs.map +1 -1
  19. package/es/Collapse/Collapse.d.mts +2 -2
  20. package/es/ColorSwatches/ColorSwatches.mjs +2 -2
  21. package/es/ColorSwatches/ColorSwatches.mjs.map +1 -1
  22. package/es/ConfigProvider/index.d.mts +2 -2
  23. package/es/ContextMenu/ContextMenuHost.mjs +7 -12
  24. package/es/ContextMenu/ContextMenuHost.mjs.map +1 -1
  25. package/es/CopyButton/CopyButton.d.mts +2 -2
  26. package/es/DatePicker/DatePicker.d.mts +2 -2
  27. package/es/DraggablePanel/DraggablePanel.mjs +2 -2
  28. package/es/DraggablePanel/DraggablePanel.mjs.map +1 -1
  29. package/es/DraggablePanel/components/DraggablePanelBody.d.mts +2 -2
  30. package/es/DraggablePanel/components/DraggablePanelContainer.d.mts +2 -2
  31. package/es/DraggablePanel/components/DraggablePanelFooter.d.mts +2 -2
  32. package/es/DraggablePanel/components/DraggablePanelHeader.d.mts +2 -2
  33. package/es/DraggablePanel/components/DraggablePanelHeader.mjs +2 -2
  34. package/es/DraggablePanel/components/DraggablePanelHeader.mjs.map +1 -1
  35. package/es/DraggableSideNav/DraggableSideNav.d.mts +2 -2
  36. package/es/DraggableSideNav/DraggableSideNav.mjs +2 -2
  37. package/es/DraggableSideNav/DraggableSideNav.mjs.map +1 -1
  38. package/es/Drawer/Drawer.d.mts +2 -2
  39. package/es/Dropdown/Dropdown.d.mts +2 -2
  40. package/es/DropdownMenu/DropdownMenu.d.mts +2 -2
  41. package/es/DropdownMenu/DropdownMenu.mjs +3 -12
  42. package/es/DropdownMenu/DropdownMenu.mjs.map +1 -1
  43. package/es/EditableText/EditableText.d.mts +2 -2
  44. package/es/EditableText/EditableText.mjs +2 -2
  45. package/es/EditableText/EditableText.mjs.map +1 -1
  46. package/es/EmojiPicker/EmojiPicker.d.mts +2 -2
  47. package/es/EmojiPicker/EmojiPicker.mjs +3 -3
  48. package/es/EmojiPicker/EmojiPicker.mjs.map +1 -1
  49. package/es/Flex/FlexBasic.d.mts +2 -2
  50. package/es/FontLoader/index.d.mts +2 -2
  51. package/es/Footer/Footer.d.mts +2 -2
  52. package/es/Form/components/FormGroup.d.mts +2 -2
  53. package/es/Form/components/FormItem.d.mts +2 -2
  54. package/es/Form/components/FormSubmitFooter.d.mts +2 -2
  55. package/es/FormModal/FormModal.d.mts +2 -2
  56. package/es/GuideCard/GuideCard.d.mts +2 -2
  57. package/es/Header/Header.d.mts +2 -2
  58. package/es/Highlighter/Highlighter.d.mts +2 -2
  59. package/es/Highlighter/SyntaxHighlighter/index.d.mts +2 -2
  60. package/es/Hotkey/Hotkey.d.mts +2 -2
  61. package/es/HotkeyInput/HotkeyInput.d.mts +2 -2
  62. package/es/HotkeyInput/HotkeyInput.mjs +2 -2
  63. package/es/HotkeyInput/HotkeyInput.mjs.map +1 -1
  64. package/es/Icon/Icon.d.mts +2 -2
  65. package/es/Icon/components/IconProvider.d.mts +3 -3
  66. package/es/Image/PreviewGroup.d.mts +2 -2
  67. package/es/ImageSelect/ImageSelect.d.mts +2 -2
  68. package/es/ImageSelect/ImageSelect.mjs +2 -2
  69. package/es/ImageSelect/ImageSelect.mjs.map +1 -1
  70. package/es/Input/Input.d.mts +2 -2
  71. package/es/Input/InputNumber.d.mts +2 -2
  72. package/es/Input/InputOPT.d.mts +2 -2
  73. package/es/Input/InputPassword.d.mts +2 -2
  74. package/es/Input/TextArea.d.mts +2 -2
  75. package/es/Layout/components/LayoutFooter.d.mts +2 -2
  76. package/es/Layout/components/LayoutHeader.d.mts +2 -2
  77. package/es/Layout/components/LayoutMain.d.mts +2 -2
  78. package/es/Layout/components/LayoutSidebar.d.mts +2 -2
  79. package/es/Layout/components/LayoutSidebarInner.d.mts +2 -2
  80. package/es/Layout/components/LayoutToc.d.mts +2 -2
  81. package/es/List/ListItem/index.d.mts +2 -2
  82. package/es/Markdown/Markdown.d.mts +2 -2
  83. package/es/Markdown/Typography.d.mts +2 -2
  84. package/es/MaskShadow/MaskShadow.d.mts +2 -2
  85. package/es/Menu/Menu.d.mts +2 -2
  86. package/es/Mermaid/Mermaid.d.mts +2 -2
  87. package/es/Mermaid/SyntaxMermaid/StreamMermaid.mjs +2 -10
  88. package/es/Mermaid/SyntaxMermaid/StreamMermaid.mjs.map +1 -1
  89. package/es/Mermaid/SyntaxMermaid/index.d.mts +2 -2
  90. package/es/Modal/Modal.d.mts +2 -2
  91. package/es/Modal/ModalProvider.d.mts +2 -2
  92. package/es/Popover/PopoverStandalone.mjs +1 -1
  93. package/es/Popover/context.d.mts +2 -2
  94. package/es/SearchBar/SearchBar.d.mts +2 -2
  95. package/es/SearchBar/SearchBar.mjs +2 -2
  96. package/es/SearchBar/SearchBar.mjs.map +1 -1
  97. package/es/Segmented/Segmented.d.mts +2 -2
  98. package/es/Select/Select.d.mts +2 -2
  99. package/es/SideNav/SideNav.d.mts +2 -2
  100. package/es/SliderWithInput/SliderWithInput.d.mts +2 -2
  101. package/es/ThemeProvider/ThemeProvider.d.mts +2 -2
  102. package/es/Toc/Toc.d.mts +2 -2
  103. package/es/Toc/TocMobile.mjs +2 -2
  104. package/es/Toc/TocMobile.mjs.map +1 -1
  105. package/es/Tooltip/TooltipPortal.mjs +1 -1
  106. package/es/Tooltip/TooltipPortal.mjs.map +1 -1
  107. package/es/awesome/AuroraBackground/AuroraBackground.d.mts +2 -2
  108. package/es/awesome/BottomGradientButton/BottomGradientButton.d.mts +2 -2
  109. package/es/awesome/Features/Features.d.mts +2 -2
  110. package/es/awesome/Giscus/Giscus.d.mts +2 -2
  111. package/es/awesome/GradientButton/GradientButton.d.mts +2 -2
  112. package/es/awesome/GridBackground/GridBackground.d.mts +2 -2
  113. package/es/awesome/GridBackground/GridShowcase.d.mts +2 -2
  114. package/es/awesome/Hero/Hero.d.mts +2 -2
  115. package/es/awesome/Spline/Spine.d.mts +2 -2
  116. package/es/awesome/Spotlight/Spotlight.d.mts +2 -2
  117. package/es/awesome/SpotlightCard/SpotlightCard.d.mts +2 -2
  118. package/es/awesome/TypewriterEffect/TypewriterEffect.d.mts +2 -2
  119. package/es/brand/LobeChat/index.d.mts +2 -2
  120. package/es/brand/LobeHub/index.d.mts +2 -2
  121. package/es/brand/LogoThree/LogoSpline.d.mts +2 -2
  122. package/es/brand/LogoThree/index.d.mts +2 -2
  123. package/es/chat/BackBottom/BackBottom.d.mts +2 -2
  124. package/es/chat/ChatInputArea/components/ChatInputAreaInner.d.mts +2 -2
  125. package/es/chat/ChatItem/ChatItem.d.mts +2 -2
  126. package/es/chat/ChatList/ChatList.d.mts +2 -2
  127. package/es/chat/EditableMessage/EditableMessage.d.mts +2 -2
  128. package/es/chat/EditableMessage/EditableMessage.mjs +3 -3
  129. package/es/chat/EditableMessage/EditableMessage.mjs.map +1 -1
  130. package/es/chat/EditableMessageList/EditableMessageList.d.mts +2 -2
  131. package/es/chat/MessageInput/MessageInput.d.mts +2 -2
  132. package/es/chat/MessageModal/MessageModal.d.mts +2 -2
  133. package/es/chat/MessageModal/MessageModal.mjs +3 -3
  134. package/es/chat/MessageModal/MessageModal.mjs.map +1 -1
  135. package/es/color/ColorScales/index.d.mts +2 -2
  136. package/es/color/CssVar/index.d.mts +2 -2
  137. package/es/hooks/usePortalContainer.mjs +24 -0
  138. package/es/hooks/usePortalContainer.mjs.map +1 -0
  139. package/es/i18n/context.d.mts +2 -2
  140. package/es/icons/lucideExtra/BotPromptIcon.d.mts +3 -3
  141. package/es/icons/lucideExtra/CreateBotIcon.d.mts +3 -3
  142. package/es/icons/lucideExtra/DiscordIcon.d.mts +3 -3
  143. package/es/icons/lucideExtra/GlobeOffIcon.d.mts +3 -3
  144. package/es/icons/lucideExtra/GroupBotIcon.d.mts +3 -3
  145. package/es/icons/lucideExtra/GroupBotSquareIcon.d.mts +3 -3
  146. package/es/icons/lucideExtra/LeftClickIcon.d.mts +3 -3
  147. package/es/icons/lucideExtra/LeftDoubleClickIcon.d.mts +3 -3
  148. package/es/icons/lucideExtra/McpIcon.d.mts +3 -3
  149. package/es/icons/lucideExtra/ProviderIcon.d.mts +3 -3
  150. package/es/icons/lucideExtra/RightClickIcon.d.mts +2 -2
  151. package/es/icons/lucideExtra/RightDoubleClickIcon.d.mts +3 -3
  152. package/es/icons/lucideExtra/ShapesUploadIcon.d.mts +3 -3
  153. package/es/icons/lucideExtra/TreeDownRightIcon.d.mts +3 -3
  154. package/es/icons/lucideExtra/TreeUpDownRightIcon.d.mts +2 -2
  155. package/es/mdx/Mdx/index.d.mts +2 -2
  156. package/es/mobile/ChatHeader/ChatHeaderTitle.d.mts +2 -2
  157. package/es/mobile/ChatInputArea/components/ChatSendButton.d.mts +2 -2
  158. package/es/mobile/TabBar/TabBar.d.mts +2 -2
  159. package/es/mobile/TabBar/TabBar.mjs +2 -2
  160. package/es/mobile/TabBar/TabBar.mjs.map +1 -1
  161. package/es/storybook/StoryBook/index.d.mts +2 -2
  162. package/package.json +1 -1
@@ -1,8 +1,8 @@
1
1
  import { AccordionProps } from "./type.mjs";
2
- import * as react47 from "react";
2
+ import * as react27 from "react";
3
3
 
4
4
  //#region src/Accordion/Accordion.d.ts
5
- declare const Accordion: react47.NamedExoticComponent<AccordionProps>;
5
+ declare const Accordion: react27.NamedExoticComponent<AccordionProps>;
6
6
  //#endregion
7
7
  export { Accordion };
8
8
  //# sourceMappingURL=Accordion.d.mts.map
@@ -7,13 +7,13 @@ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
7
7
  import { Divider } from "antd";
8
8
  import { cx } from "antd-style";
9
9
  import { LayoutGroup } from "motion/react";
10
- import useMergeState from "use-merge-value";
10
+ import useControlledState from "use-merge-value";
11
11
 
12
12
  //#region src/Accordion/Accordion.tsx
13
13
  const Accordion = memo(({ children, className: userClassName, style: userStyle, accordion = false, defaultExpandedKeys, expandedKeys: expandedKeysProp, onExpandedChange, variant = "borderless", gap, showDivider = false, disableAnimation = false, hideIndicator = false, indicatorPlacement = "start", keepContentMounted = true, classNames, styles: customStyles, motionProps, ref, ...rest }) => {
14
14
  const validChildren = Children.toArray(children).filter(isValidElement);
15
15
  const allItemKeys = validChildren.map((child, index) => child.props.itemKey || index);
16
- const [expandedKeys, setExpandedKeys] = useMergeState(defaultExpandedKeys ?? allItemKeys, {
16
+ const [expandedKeys, setExpandedKeys] = useControlledState(defaultExpandedKeys ?? allItemKeys, {
17
17
  onChange: onExpandedChange,
18
18
  value: expandedKeysProp
19
19
  });
@@ -1 +1 @@
1
- {"version":3,"file":"Accordion.mjs","names":["newKeys: Key[]"],"sources":["../../src/Accordion/Accordion.tsx"],"sourcesContent":["'use client';\n\nimport { Divider } from 'antd';\nimport { cx } from 'antd-style';\nimport { LayoutGroup } from 'motion/react';\nimport { Children, Fragment, isValidElement, memo, useCallback } from 'react';\nimport type { Key } from 'react';\nimport useMergeState from 'use-merge-value';\n\nimport { AccordionContext } from './context';\nimport { styles } from './style';\nimport type { AccordionProps } from './type';\n\nconst Accordion = memo<AccordionProps>(\n ({\n children,\n className: userClassName,\n style: userStyle,\n accordion = false,\n defaultExpandedKeys,\n expandedKeys: expandedKeysProp,\n onExpandedChange,\n variant = 'borderless',\n gap,\n showDivider = false,\n disableAnimation = false,\n hideIndicator = false,\n indicatorPlacement = 'start',\n keepContentMounted = true,\n classNames,\n styles: customStyles,\n motionProps,\n ref,\n ...rest\n }) => {\n // Convert children to array and filter valid elements\n const validChildren = Children.toArray(children).filter(isValidElement);\n\n // Collect all item keys\n const allItemKeys = validChildren.map((child, index) => (child.props as any).itemKey || index);\n\n // If defaultExpandedKeys or expandedKeys is undefined, expand all items by default\n const initialExpandedKeys = defaultExpandedKeys ?? allItemKeys;\n\n const [expandedKeys, setExpandedKeys] = useMergeState<Key[]>(initialExpandedKeys, {\n onChange: onExpandedChange,\n value: expandedKeysProp,\n });\n\n const toggleExpand = useCallback(\n (key: Key) => {\n const prev = expandedKeys;\n let newKeys: Key[];\n\n if (accordion) {\n newKeys = prev.includes(key) ? [] : [key];\n } else {\n newKeys = prev.includes(key) ? prev.filter((k: Key) => k !== key) : [...prev, key];\n }\n\n setExpandedKeys(newKeys);\n },\n [accordion, expandedKeys, setExpandedKeys],\n );\n\n const isExpanded = useCallback(\n (key: Key) => {\n return expandedKeys.includes(key);\n },\n [expandedKeys],\n );\n\n const contextValue = {\n disableAnimation,\n expandedKeys,\n hideIndicator,\n indicatorPlacement,\n isExpanded,\n keepContentMounted,\n motionProps,\n onToggle: toggleExpand,\n showDivider,\n variant,\n };\n\n const content = (\n <>\n {validChildren.map((child, index) => {\n // Extract itemKey from child props to use as React key\n const childKey = (child.props as any).itemKey || index;\n return (\n <Fragment key={childKey}>\n {child}\n {showDivider && index < validChildren.length - 1 && (\n <Divider className={styles.divider} />\n )}\n </Fragment>\n );\n })}\n </>\n );\n\n return (\n <AccordionContext.Provider value={contextValue}>\n <div\n className={cx(styles.base, classNames?.base, userClassName)}\n ref={ref}\n style={{\n gap: gap,\n ...customStyles?.base,\n ...userStyle,\n }}\n {...rest}\n >\n {disableAnimation ? content : <LayoutGroup>{content}</LayoutGroup>}\n </div>\n </AccordionContext.Provider>\n );\n },\n);\n\nAccordion.displayName = 'Accordion';\n\nexport default Accordion;\n"],"mappings":";;;;;;;;;;;;AAaA,MAAM,YAAY,MACf,EACC,UACA,WAAW,eACX,OAAO,WACP,YAAY,OACZ,qBACA,cAAc,kBACd,kBACA,UAAU,cACV,KACA,cAAc,OACd,mBAAmB,OACnB,gBAAgB,OAChB,qBAAqB,SACrB,qBAAqB,MACrB,YACA,QAAQ,cACR,aACA,KACA,GAAG,WACC;CAEJ,MAAM,gBAAgB,SAAS,QAAQ,SAAS,CAAC,OAAO,eAAe;CAGvE,MAAM,cAAc,cAAc,KAAK,OAAO,UAAW,MAAM,MAAc,WAAW,MAAM;CAK9F,MAAM,CAAC,cAAc,mBAAmB,cAFZ,uBAAuB,aAE+B;EAChF,UAAU;EACV,OAAO;EACR,CAAC;CAEF,MAAM,eAAe,aAClB,QAAa;EACZ,MAAM,OAAO;EACb,IAAIA;AAEJ,MAAI,UACF,WAAU,KAAK,SAAS,IAAI,GAAG,EAAE,GAAG,CAAC,IAAI;MAEzC,WAAU,KAAK,SAAS,IAAI,GAAG,KAAK,QAAQ,MAAW,MAAM,IAAI,GAAG,CAAC,GAAG,MAAM,IAAI;AAGpF,kBAAgB,QAAQ;IAE1B;EAAC;EAAW;EAAc;EAAgB,CAC3C;CASD,MAAM,eAAe;EACnB;EACA;EACA;EACA;EACA,YAZiB,aAChB,QAAa;AACZ,UAAO,aAAa,SAAS,IAAI;KAEnC,CAAC,aAAa,CACf;EAQC;EACA;EACA,UAAU;EACV;EACA;EACD;CAED,MAAM,UACJ,4CACG,cAAc,KAAK,OAAO,UAAU;EAEnC,MAAM,WAAY,MAAM,MAAc,WAAW;AACjD,SACE,qBAAC,uBACE,OACA,eAAe,QAAQ,cAAc,SAAS,KAC7C,oBAAC,WAAQ,WAAW,OAAO,UAAW,KAH3B,SAKJ;GAEb,GACD;AAGL,QACE,oBAAC,iBAAiB;EAAS,OAAO;YAChC,oBAAC;GACC,WAAW,GAAG,OAAO,MAAM,YAAY,MAAM,cAAc;GACtD;GACL,OAAO;IACA;IACL,GAAG,cAAc;IACjB,GAAG;IACJ;GACD,GAAI;aAEH,mBAAmB,UAAU,oBAAC,yBAAa,UAAsB;IAC9D;GACoB;EAGjC;AAED,UAAU,cAAc;AAExB,wBAAe"}
1
+ {"version":3,"file":"Accordion.mjs","names":["useMergeState","newKeys: Key[]"],"sources":["../../src/Accordion/Accordion.tsx"],"sourcesContent":["'use client';\n\nimport { Divider } from 'antd';\nimport { cx } from 'antd-style';\nimport { LayoutGroup } from 'motion/react';\nimport { Children, Fragment, isValidElement, memo, useCallback } from 'react';\nimport type { Key } from 'react';\nimport useMergeState from 'use-merge-value';\n\nimport { AccordionContext } from './context';\nimport { styles } from './style';\nimport type { AccordionProps } from './type';\n\nconst Accordion = memo<AccordionProps>(\n ({\n children,\n className: userClassName,\n style: userStyle,\n accordion = false,\n defaultExpandedKeys,\n expandedKeys: expandedKeysProp,\n onExpandedChange,\n variant = 'borderless',\n gap,\n showDivider = false,\n disableAnimation = false,\n hideIndicator = false,\n indicatorPlacement = 'start',\n keepContentMounted = true,\n classNames,\n styles: customStyles,\n motionProps,\n ref,\n ...rest\n }) => {\n // Convert children to array and filter valid elements\n const validChildren = Children.toArray(children).filter(isValidElement);\n\n // Collect all item keys\n const allItemKeys = validChildren.map((child, index) => (child.props as any).itemKey || index);\n\n // If defaultExpandedKeys or expandedKeys is undefined, expand all items by default\n const initialExpandedKeys = defaultExpandedKeys ?? allItemKeys;\n\n const [expandedKeys, setExpandedKeys] = useMergeState<Key[]>(initialExpandedKeys, {\n onChange: onExpandedChange,\n value: expandedKeysProp,\n });\n\n const toggleExpand = useCallback(\n (key: Key) => {\n const prev = expandedKeys;\n let newKeys: Key[];\n\n if (accordion) {\n newKeys = prev.includes(key) ? [] : [key];\n } else {\n newKeys = prev.includes(key) ? prev.filter((k: Key) => k !== key) : [...prev, key];\n }\n\n setExpandedKeys(newKeys);\n },\n [accordion, expandedKeys, setExpandedKeys],\n );\n\n const isExpanded = useCallback(\n (key: Key) => {\n return expandedKeys.includes(key);\n },\n [expandedKeys],\n );\n\n const contextValue = {\n disableAnimation,\n expandedKeys,\n hideIndicator,\n indicatorPlacement,\n isExpanded,\n keepContentMounted,\n motionProps,\n onToggle: toggleExpand,\n showDivider,\n variant,\n };\n\n const content = (\n <>\n {validChildren.map((child, index) => {\n // Extract itemKey from child props to use as React key\n const childKey = (child.props as any).itemKey || index;\n return (\n <Fragment key={childKey}>\n {child}\n {showDivider && index < validChildren.length - 1 && (\n <Divider className={styles.divider} />\n )}\n </Fragment>\n );\n })}\n </>\n );\n\n return (\n <AccordionContext.Provider value={contextValue}>\n <div\n className={cx(styles.base, classNames?.base, userClassName)}\n ref={ref}\n style={{\n gap: gap,\n ...customStyles?.base,\n ...userStyle,\n }}\n {...rest}\n >\n {disableAnimation ? content : <LayoutGroup>{content}</LayoutGroup>}\n </div>\n </AccordionContext.Provider>\n );\n },\n);\n\nAccordion.displayName = 'Accordion';\n\nexport default Accordion;\n"],"mappings":";;;;;;;;;;;;AAaA,MAAM,YAAY,MACf,EACC,UACA,WAAW,eACX,OAAO,WACP,YAAY,OACZ,qBACA,cAAc,kBACd,kBACA,UAAU,cACV,KACA,cAAc,OACd,mBAAmB,OACnB,gBAAgB,OAChB,qBAAqB,SACrB,qBAAqB,MACrB,YACA,QAAQ,cACR,aACA,KACA,GAAG,WACC;CAEJ,MAAM,gBAAgB,SAAS,QAAQ,SAAS,CAAC,OAAO,eAAe;CAGvE,MAAM,cAAc,cAAc,KAAK,OAAO,UAAW,MAAM,MAAc,WAAW,MAAM;CAK9F,MAAM,CAAC,cAAc,mBAAmBA,mBAFZ,uBAAuB,aAE+B;EAChF,UAAU;EACV,OAAO;EACR,CAAC;CAEF,MAAM,eAAe,aAClB,QAAa;EACZ,MAAM,OAAO;EACb,IAAIC;AAEJ,MAAI,UACF,WAAU,KAAK,SAAS,IAAI,GAAG,EAAE,GAAG,CAAC,IAAI;MAEzC,WAAU,KAAK,SAAS,IAAI,GAAG,KAAK,QAAQ,MAAW,MAAM,IAAI,GAAG,CAAC,GAAG,MAAM,IAAI;AAGpF,kBAAgB,QAAQ;IAE1B;EAAC;EAAW;EAAc;EAAgB,CAC3C;CASD,MAAM,eAAe;EACnB;EACA;EACA;EACA;EACA,YAZiB,aAChB,QAAa;AACZ,UAAO,aAAa,SAAS,IAAI;KAEnC,CAAC,aAAa,CACf;EAQC;EACA;EACA,UAAU;EACV;EACA;EACD;CAED,MAAM,UACJ,4CACG,cAAc,KAAK,OAAO,UAAU;EAEnC,MAAM,WAAY,MAAM,MAAc,WAAW;AACjD,SACE,qBAAC,uBACE,OACA,eAAe,QAAQ,cAAc,SAAS,KAC7C,oBAAC,WAAQ,WAAW,OAAO,UAAW,KAH3B,SAKJ;GAEb,GACD;AAGL,QACE,oBAAC,iBAAiB;EAAS,OAAO;YAChC,oBAAC;GACC,WAAW,GAAG,OAAO,MAAM,YAAY,MAAM,cAAc;GACtD;GACL,OAAO;IACA;IACL,GAAG,cAAc;IACjB,GAAG;IACJ;GACD,GAAI;aAEH,mBAAmB,UAAU,oBAAC,yBAAa,UAAsB;IAC9D;GACoB;EAGjC;AAED,UAAU,cAAc;AAExB,wBAAe"}
@@ -1,8 +1,8 @@
1
1
  import { AccordionItemProps } from "./type.mjs";
2
- import * as react48 from "react";
2
+ import * as react28 from "react";
3
3
 
4
4
  //#region src/Accordion/AccordionItem.d.ts
5
- declare const AccordionItem: react48.NamedExoticComponent<AccordionItemProps>;
5
+ declare const AccordionItem: react28.NamedExoticComponent<AccordionItemProps>;
6
6
  //#endregion
7
7
  export { AccordionItem };
8
8
  //# sourceMappingURL=AccordionItem.d.mts.map
@@ -12,7 +12,7 @@ import { memo, useCallback, useEffect, useMemo, useRef } from "react";
12
12
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
13
13
  import { cx } from "antd-style";
14
14
  import { AnimatePresence } from "motion/react";
15
- import useMergeState from "use-merge-value";
15
+ import useControlledState from "use-merge-value";
16
16
 
17
17
  //#region src/Accordion/AccordionItem.tsx
18
18
  const motionContainerStyle = { overflow: "hidden" };
@@ -118,7 +118,7 @@ AccordionItemContent.displayName = "AccordionItemContent";
118
118
  const AccordionItem = memo(({ itemKey, title, children, action, disabled = false, allowExpand = true, hideIndicator: itemHideIndicator, indicatorPlacement: itemIndicatorPlacement, indicator: customIndicator, classNames, paddingInline = 16, paddingBlock = 8, padding, ref, variant: customVariant, styles: customStyles, headerWrapper, defaultExpand, expand, onExpandChange }) => {
119
119
  const context = useAccordionContext();
120
120
  const isStandalone = expand !== void 0 || defaultExpand !== void 0;
121
- const [isExpandedStandalone, setIsExpandedStandalone] = useMergeState(defaultExpand ?? false, {
121
+ const [isExpandedStandalone, setIsExpandedStandalone] = useControlledState(defaultExpand ?? false, {
122
122
  onChange: onExpandChange,
123
123
  value: expand
124
124
  });
@@ -1 +1 @@
1
- {"version":3,"file":"AccordionItem.mjs","names":["motionContainerStyle: CSSProperties","ArrowIcon","Text","Flexbox","Block"],"sources":["../../src/Accordion/AccordionItem.tsx"],"sourcesContent":["'use client';\n\nimport { cx } from 'antd-style';\nimport { AnimatePresence } from 'motion/react';\nimport type { CSSProperties, ComponentPropsWithoutRef, ReactNode } from 'react';\nimport { KeyboardEvent, memo, useCallback, useEffect, useMemo, useRef } from 'react';\nimport useMergeState from 'use-merge-value';\n\nimport Block from '@/Block';\nimport { Flexbox } from '@/Flex';\nimport { type MotionComponentType, useMotionComponent } from '@/MotionProvider';\nimport Text from '@/Text';\nimport { stopPropagation } from '@/utils/dom';\n\nimport ArrowIcon from './ArrowIcon';\nimport { useAccordionContext } from './context';\nimport { styles } from './style';\nimport type { AccordionItemProps } from './type';\n\ntype AccordionContentBaseProps = {\n children?: ReactNode;\n className?: string;\n contentInnerClassName: string;\n style?: CSSProperties;\n};\n\ntype AccordionStaticContentProps = AccordionContentBaseProps & {\n isOpen: boolean;\n keepContentMounted: boolean;\n};\n\ntype MotionDivProps = ComponentPropsWithoutRef<MotionComponentType['div']>;\n\ntype AccordionMotionContentProps = AccordionContentBaseProps & {\n contextMotionProps?: MotionDivProps;\n isOpen: boolean;\n skipInitialAnimation: boolean;\n};\n\ntype AccordionItemContentProps = AccordionContentBaseProps & {\n contextMotionProps?: MotionDivProps;\n disableAnimation: boolean;\n isOpen: boolean;\n keepContentMounted: boolean;\n skipInitialAnimation: boolean;\n};\n\nconst motionContainerStyle: CSSProperties = { overflow: 'hidden' };\n\nconst AccordionStaticContent = memo<AccordionStaticContentProps>(\n ({ className, style, children, contentInnerClassName, isOpen, keepContentMounted }) => {\n if (keepContentMounted) {\n return (\n <div\n className={className}\n role=\"region\"\n style={{\n display: isOpen ? 'block' : 'none',\n ...style,\n }}\n >\n <div className={contentInnerClassName}>{children}</div>\n </div>\n );\n }\n\n if (!isOpen) return null;\n\n return (\n <div className={className} role=\"region\" style={style}>\n <div className={contentInnerClassName}>{children}</div>\n </div>\n );\n },\n);\n\nAccordionStaticContent.displayName = 'AccordionStaticContent';\n\nconst AccordionMotionContent = memo<AccordionMotionContentProps>(\n ({\n contextMotionProps,\n className,\n style,\n children,\n contentInnerClassName,\n isOpen,\n skipInitialAnimation,\n }) => {\n const Motion = useMotionComponent();\n\n const motionProps = useMemo(\n () => ({\n animate: 'enter',\n exit: 'exit',\n initial: skipInitialAnimation ? false : 'exit',\n variants: {\n enter: {\n height: 'auto',\n opacity: 1,\n transition: {\n duration: 0.2,\n ease: [0.4, 0, 0.2, 1],\n },\n },\n exit: {\n height: 0,\n opacity: 0,\n transition: {\n duration: 0.2,\n ease: [0.4, 0, 0.2, 1],\n },\n },\n },\n ...contextMotionProps,\n }),\n [contextMotionProps, skipInitialAnimation],\n );\n\n return (\n <AnimatePresence initial={false}>\n {isOpen ? (\n <Motion.div {...(motionProps as any)} style={motionContainerStyle}>\n <div className={className} role=\"region\" style={style}>\n <div className={contentInnerClassName}>{children}</div>\n </div>\n </Motion.div>\n ) : null}\n </AnimatePresence>\n );\n },\n);\n\nAccordionMotionContent.displayName = 'AccordionMotionContent';\n\nconst AccordionItemContent = memo<AccordionItemContentProps>(\n ({\n disableAnimation,\n isOpen,\n keepContentMounted,\n className,\n style,\n children,\n contentInnerClassName,\n contextMotionProps,\n skipInitialAnimation,\n }) => {\n if (disableAnimation || !keepContentMounted) {\n return (\n <AccordionStaticContent\n className={className}\n contentInnerClassName={contentInnerClassName}\n isOpen={isOpen}\n keepContentMounted={keepContentMounted}\n style={style}\n >\n {children}\n </AccordionStaticContent>\n );\n }\n\n return (\n <AccordionMotionContent\n className={className}\n contentInnerClassName={contentInnerClassName}\n contextMotionProps={contextMotionProps}\n isOpen={isOpen}\n skipInitialAnimation={skipInitialAnimation}\n style={style}\n >\n {children}\n </AccordionMotionContent>\n );\n },\n);\n\nAccordionItemContent.displayName = 'AccordionItemContent';\n\nconst AccordionItem = memo<AccordionItemProps>(\n ({\n itemKey,\n title,\n children,\n action,\n disabled = false,\n allowExpand = true,\n hideIndicator: itemHideIndicator,\n indicatorPlacement: itemIndicatorPlacement,\n indicator: customIndicator,\n classNames,\n paddingInline = 16,\n paddingBlock = 8,\n padding,\n ref,\n variant: customVariant,\n styles: customStyles,\n headerWrapper,\n defaultExpand,\n expand,\n onExpandChange,\n }) => {\n const context = useAccordionContext();\n\n // Determine if using standalone mode (has expand or defaultExpand props)\n const isStandalone = expand !== undefined || defaultExpand !== undefined;\n\n // Standalone state management\n const [isExpandedStandalone, setIsExpandedStandalone] = useMergeState<boolean>(\n defaultExpand ?? false,\n {\n onChange: onExpandChange,\n value: expand,\n },\n );\n\n // Context values (may be null if used standalone)\n const contextIsExpanded = context?.isExpanded;\n const contextOnToggle = context?.onToggle;\n const contextHideIndicator = context?.hideIndicator;\n const contextIndicatorPlacement = context?.indicatorPlacement;\n const contextKeepContentMounted = context?.keepContentMounted;\n const contextDisableAnimation = context?.disableAnimation;\n const contextMotionProps = context?.motionProps;\n const contextVariant = context?.variant ?? 'borderless';\n\n const isInitialRenderRef = useRef(true);\n\n useEffect(() => {\n isInitialRenderRef.current = false;\n }, []);\n\n // Determine expanded state\n const isOpen = isStandalone\n ? isExpandedStandalone\n : contextIsExpanded\n ? contextIsExpanded(itemKey)\n : false;\n\n // Determine other props with fallbacks\n const hideIndicatorFinal = itemHideIndicator ?? contextHideIndicator ?? false;\n const indicatorPlacementFinal = itemIndicatorPlacement ?? contextIndicatorPlacement ?? 'start';\n const keepContentMounted = contextKeepContentMounted ?? true;\n const disableAnimation = contextDisableAnimation ?? false;\n const variant = customVariant || contextVariant;\n\n const handleToggle = useCallback(() => {\n // If allowExpand is false, only allow controlled expansion via expand prop\n if (!allowExpand) return;\n\n if (!disabled) {\n if (isStandalone) {\n setIsExpandedStandalone(!isExpandedStandalone);\n } else if (contextOnToggle) {\n contextOnToggle(itemKey);\n }\n }\n }, [\n allowExpand,\n disabled,\n isStandalone,\n setIsExpandedStandalone,\n isExpandedStandalone,\n contextOnToggle,\n itemKey,\n ]);\n\n const handleKeyDown = useCallback(\n (e: KeyboardEvent) => {\n // If allowExpand is false, disable keyboard toggle\n if (!allowExpand || disabled) return;\n\n switch (e.key) {\n case 'Enter':\n case ' ': {\n e.preventDefault();\n handleToggle();\n break;\n }\n }\n },\n [allowExpand, disabled, handleToggle],\n );\n\n const preventTitleTextSelection = useCallback((e: any) => {\n // Prevent browser from creating a selection range on double/multi click,\n // which can accidentally select the content region.\n if (e?.detail > 1) e.preventDefault();\n }, []);\n\n // Build indicator\n const indicator = useMemo(() => {\n if (!allowExpand || hideIndicatorFinal) return null;\n\n if (customIndicator) {\n if (typeof customIndicator === 'function') {\n return (\n <span\n aria-hidden=\"true\"\n className={cx(styles.indicator, classNames?.indicator)}\n style={customStyles?.indicator}\n >\n {customIndicator({ isDisabled: disabled, isOpen })}\n </span>\n );\n }\n return (\n <span\n aria-hidden=\"true\"\n className={cx(styles.indicator, classNames?.indicator)}\n style={customStyles?.indicator}\n >\n {customIndicator}\n </span>\n );\n }\n\n return (\n <span\n aria-hidden=\"true\"\n className={cx(styles.indicator, classNames?.indicator)}\n style={customStyles?.indicator}\n >\n <ArrowIcon className={cx(styles.icon, isOpen && styles.iconRotate)} />\n </span>\n );\n }, [\n allowExpand,\n hideIndicatorFinal,\n customIndicator,\n disabled,\n isOpen,\n cx,\n styles,\n classNames,\n customStyles,\n ]);\n\n const skipInitialAnimation = isInitialRenderRef.current && isOpen;\n\n const contentClassName = useMemo(\n () => cx('accordion-content', styles.content, classNames?.content),\n [cx, styles, classNames?.content],\n );\n\n const titleNode = useMemo(\n () =>\n typeof title === 'string' ? (\n <Text className={classNames?.title} ellipsis style={customStyles?.title}>\n {title}\n </Text>\n ) : (\n title\n ),\n [title, classNames?.title, customStyles?.title],\n );\n\n const actionNode = useMemo(\n () =>\n action && (\n <Flexbox\n align={'center'}\n className={cx('accordion-action', styles.action, classNames?.action)}\n flex={'none'}\n gap={4}\n horizontal\n onClick={stopPropagation}\n style={customStyles?.action}\n >\n {action}\n </Flexbox>\n ),\n [action, cx, styles, classNames?.action, customStyles?.action],\n );\n\n const headerElement = useMemo(() => {\n const header = (\n <Block\n className={cx('accordion-header', styles.header, classNames?.header)}\n clickable={!disabled && allowExpand}\n gap={4}\n horizontal\n justify={'space-between'}\n onClick={handleToggle}\n onKeyDown={handleKeyDown}\n padding={padding}\n paddingBlock={paddingBlock}\n paddingInline={paddingInline}\n ref={ref}\n style={{\n alignItems: 'center',\n cursor: disabled ? 'not-allowed' : allowExpand ? 'pointer' : 'default',\n opacity: disabled ? 0.5 : undefined,\n overflow: 'hidden',\n width: '100%',\n ...customStyles?.header,\n }}\n variant={customVariant || variant}\n >\n {indicatorPlacementFinal === 'start' ? (\n <>\n <Flexbox\n align={'center'}\n className={styles.titleWrapper}\n flex={1}\n gap={2}\n horizontal\n onDoubleClick={preventTitleTextSelection}\n onMouseDown={preventTitleTextSelection}\n style={{\n overflow: 'hidden',\n }}\n >\n {titleNode}\n {indicator}\n </Flexbox>\n <Flexbox align={'center'} flex={'none'} gap={4} horizontal>\n {actionNode}\n </Flexbox>\n </>\n ) : (\n <>\n <Flexbox\n align={'center'}\n className={styles.titleWrapper}\n flex={1}\n gap={2}\n horizontal\n onDoubleClick={preventTitleTextSelection}\n onMouseDown={preventTitleTextSelection}\n style={{\n overflow: 'hidden',\n }}\n >\n {titleNode}\n </Flexbox>\n <Flexbox align={'center'} flex={'none'} gap={4} horizontal>\n {actionNode}\n {indicator}\n </Flexbox>\n </>\n )}\n </Block>\n );\n if (headerWrapper) {\n return headerWrapper(header);\n }\n return header;\n }, [\n cx,\n styles,\n classNames,\n disabled,\n handleToggle,\n handleKeyDown,\n padding,\n paddingBlock,\n paddingInline,\n ref,\n customVariant,\n variant,\n indicatorPlacementFinal,\n titleNode,\n indicator,\n actionNode,\n headerWrapper,\n ]);\n\n return (\n <div\n className={cx('accordion-item', styles.item, classNames?.base)}\n style={customStyles?.base}\n >\n {headerElement}\n <AccordionItemContent\n className={contentClassName}\n contentInnerClassName={styles.contentInner}\n contextMotionProps={contextMotionProps}\n disableAnimation={!!disableAnimation}\n isOpen={isOpen}\n keepContentMounted={!!keepContentMounted}\n skipInitialAnimation={skipInitialAnimation}\n style={customStyles?.content}\n >\n {children}\n </AccordionItemContent>\n </div>\n );\n },\n);\n\nAccordionItem.displayName = 'AccordionItem';\n\nexport default AccordionItem;\n"],"mappings":";;;;;;;;;;;;;;;;;AA+CA,MAAMA,uBAAsC,EAAE,UAAU,UAAU;AAElE,MAAM,yBAAyB,MAC5B,EAAE,WAAW,OAAO,UAAU,uBAAuB,QAAQ,yBAAyB;AACrF,KAAI,mBACF,QACE,oBAAC;EACY;EACX,MAAK;EACL,OAAO;GACL,SAAS,SAAS,UAAU;GAC5B,GAAG;GACJ;YAED,oBAAC;GAAI,WAAW;GAAwB;IAAe;GACnD;AAIV,KAAI,CAAC,OAAQ,QAAO;AAEpB,Q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,QAAQ,WAAW,gBAAgB,cAAc,YAAY;IAC7D,SAAS,WAAW,KAAM;IAC1B,UAAU;IACV,OAAO;IACP,GAAG,cAAc;IAClB;GACD,SAAS,iBAAiB;aAEzB,4BAA4B,UAC3B,8CACE,qBAACD;IACC,OAAO;IACP,WAAW,OAAO;IAClB,MAAM;IACN,KAAK;IACL;IACA,eAAe;IACf,aAAa;IACb,OAAO,EACL,UAAU,UACX;eAEA,WACA;KACO,EACV,oBAACA;IAAQ,OAAO;IAAU,MAAM;IAAQ,KAAK;IAAG;cAC7C;KACO,IACT,GAEH,8CACE,oBAACA;IACC,OAAO;IACP,WAAW,OAAO;IAClB,MAAM;IACN,KAAK;IACL;IACA,eAAe;IACf,aAAa;IACb,OAAO,EACL,UAAU,UACX;cAEA;KACO,EACV,qBAACA;IAAQ,OAAO;IAAU,MAAM;IAAQ,KAAK;IAAG;eAC7C,YACA;KACO,IACT;IAEC;AAEV,MAAI,cACF,QAAO,cAAc,OAAO;AAE9B,SAAO;IACN;EACD;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CAAC;AAEF,QACE,qBAAC;EACC,WAAW,GAAG,kBAAkB,OAAO,MAAM,YAAY,KAAK;EAC9D,OAAO,cAAc;aAEpB,eACD,oBAAC;GACC,WAAW;GACX,uBAAuB,OAAO;GACV;GACpB,kBAAkB,CAAC,CAAC;GACZ;GACR,oBAAoB,CAAC,CAAC;GACA;GACtB,OAAO,cAAc;GAEpB;IACoB;GACnB;EAGX;AAED,cAAc,cAAc;AAE5B,4BAAe"}
1
+ {"version":3,"file":"AccordionItem.mjs","names":["motionContainerStyle: CSSProperties","useMergeState","ArrowIcon","Text","Flexbox","Block"],"sources":["../../src/Accordion/AccordionItem.tsx"],"sourcesContent":["'use client';\n\nimport { cx } from 'antd-style';\nimport { AnimatePresence } from 'motion/react';\nimport type { CSSProperties, ComponentPropsWithoutRef, ReactNode } from 'react';\nimport { KeyboardEvent, memo, useCallback, useEffect, useMemo, useRef } from 'react';\nimport useMergeState from 'use-merge-value';\n\nimport Block from '@/Block';\nimport { Flexbox } from '@/Flex';\nimport { type MotionComponentType, useMotionComponent } from '@/MotionProvider';\nimport Text from '@/Text';\nimport { stopPropagation } from '@/utils/dom';\n\nimport ArrowIcon from './ArrowIcon';\nimport { useAccordionContext } from './context';\nimport { styles } from './style';\nimport type { AccordionItemProps } from './type';\n\ntype AccordionContentBaseProps = {\n children?: ReactNode;\n className?: string;\n contentInnerClassName: string;\n style?: CSSProperties;\n};\n\ntype AccordionStaticContentProps = AccordionContentBaseProps & {\n isOpen: boolean;\n keepContentMounted: boolean;\n};\n\ntype MotionDivProps = ComponentPropsWithoutRef<MotionComponentType['div']>;\n\ntype AccordionMotionContentProps = AccordionContentBaseProps & {\n contextMotionProps?: MotionDivProps;\n isOpen: boolean;\n skipInitialAnimation: boolean;\n};\n\ntype AccordionItemContentProps = AccordionContentBaseProps & {\n contextMotionProps?: MotionDivProps;\n disableAnimation: boolean;\n isOpen: boolean;\n keepContentMounted: boolean;\n skipInitialAnimation: boolean;\n};\n\nconst motionContainerStyle: CSSProperties = { overflow: 'hidden' };\n\nconst AccordionStaticContent = memo<AccordionStaticContentProps>(\n ({ className, style, children, contentInnerClassName, isOpen, keepContentMounted }) => {\n if (keepContentMounted) {\n return (\n <div\n className={className}\n role=\"region\"\n style={{\n display: isOpen ? 'block' : 'none',\n ...style,\n }}\n >\n <div className={contentInnerClassName}>{children}</div>\n </div>\n );\n }\n\n if (!isOpen) return null;\n\n return (\n <div className={className} role=\"region\" style={style}>\n <div className={contentInnerClassName}>{children}</div>\n </div>\n );\n },\n);\n\nAccordionStaticContent.displayName = 'AccordionStaticContent';\n\nconst AccordionMotionContent = memo<AccordionMotionContentProps>(\n ({\n contextMotionProps,\n className,\n style,\n children,\n contentInnerClassName,\n isOpen,\n skipInitialAnimation,\n }) => {\n const Motion = useMotionComponent();\n\n const motionProps = useMemo(\n () => ({\n animate: 'enter',\n exit: 'exit',\n initial: skipInitialAnimation ? false : 'exit',\n variants: {\n enter: {\n height: 'auto',\n opacity: 1,\n transition: {\n duration: 0.2,\n ease: [0.4, 0, 0.2, 1],\n },\n },\n exit: {\n height: 0,\n opacity: 0,\n transition: {\n duration: 0.2,\n ease: [0.4, 0, 0.2, 1],\n },\n },\n },\n ...contextMotionProps,\n }),\n [contextMotionProps, skipInitialAnimation],\n );\n\n return (\n <AnimatePresence initial={false}>\n {isOpen ? (\n <Motion.div {...(motionProps as any)} style={motionContainerStyle}>\n <div className={className} role=\"region\" style={style}>\n <div className={contentInnerClassName}>{children}</div>\n </div>\n </Motion.div>\n ) : null}\n </AnimatePresence>\n );\n },\n);\n\nAccordionMotionContent.displayName = 'AccordionMotionContent';\n\nconst AccordionItemContent = memo<AccordionItemContentProps>(\n ({\n disableAnimation,\n isOpen,\n keepContentMounted,\n className,\n style,\n children,\n contentInnerClassName,\n contextMotionProps,\n skipInitialAnimation,\n }) => {\n if (disableAnimation || !keepContentMounted) {\n return (\n <AccordionStaticContent\n className={className}\n contentInnerClassName={contentInnerClassName}\n isOpen={isOpen}\n keepContentMounted={keepContentMounted}\n style={style}\n >\n {children}\n </AccordionStaticContent>\n );\n }\n\n return (\n <AccordionMotionContent\n className={className}\n contentInnerClassName={contentInnerClassName}\n contextMotionProps={contextMotionProps}\n isOpen={isOpen}\n skipInitialAnimation={skipInitialAnimation}\n style={style}\n >\n {children}\n </AccordionMotionContent>\n );\n },\n);\n\nAccordionItemContent.displayName = 'AccordionItemContent';\n\nconst AccordionItem = memo<AccordionItemProps>(\n ({\n itemKey,\n title,\n children,\n action,\n disabled = false,\n allowExpand = true,\n hideIndicator: itemHideIndicator,\n indicatorPlacement: itemIndicatorPlacement,\n indicator: customIndicator,\n classNames,\n paddingInline = 16,\n paddingBlock = 8,\n padding,\n ref,\n variant: customVariant,\n styles: customStyles,\n headerWrapper,\n defaultExpand,\n expand,\n onExpandChange,\n }) => {\n const context = useAccordionContext();\n\n // Determine if using standalone mode (has expand or defaultExpand props)\n const isStandalone = expand !== undefined || defaultExpand !== undefined;\n\n // Standalone state management\n const [isExpandedStandalone, setIsExpandedStandalone] = useMergeState<boolean>(\n defaultExpand ?? false,\n {\n onChange: onExpandChange,\n value: expand,\n },\n );\n\n // Context values (may be null if used standalone)\n const contextIsExpanded = context?.isExpanded;\n const contextOnToggle = context?.onToggle;\n const contextHideIndicator = context?.hideIndicator;\n const contextIndicatorPlacement = context?.indicatorPlacement;\n const contextKeepContentMounted = context?.keepContentMounted;\n const contextDisableAnimation = context?.disableAnimation;\n const contextMotionProps = context?.motionProps;\n const contextVariant = context?.variant ?? 'borderless';\n\n const isInitialRenderRef = useRef(true);\n\n useEffect(() => {\n isInitialRenderRef.current = false;\n }, []);\n\n // Determine expanded state\n const isOpen = isStandalone\n ? isExpandedStandalone\n : contextIsExpanded\n ? contextIsExpanded(itemKey)\n : false;\n\n // Determine other props with fallbacks\n const hideIndicatorFinal = itemHideIndicator ?? contextHideIndicator ?? false;\n const indicatorPlacementFinal = itemIndicatorPlacement ?? contextIndicatorPlacement ?? 'start';\n const keepContentMounted = contextKeepContentMounted ?? true;\n const disableAnimation = contextDisableAnimation ?? false;\n const variant = customVariant || contextVariant;\n\n const handleToggle = useCallback(() => {\n // If allowExpand is false, only allow controlled expansion via expand prop\n if (!allowExpand) return;\n\n if (!disabled) {\n if (isStandalone) {\n setIsExpandedStandalone(!isExpandedStandalone);\n } else if (contextOnToggle) {\n contextOnToggle(itemKey);\n }\n }\n }, [\n allowExpand,\n disabled,\n isStandalone,\n setIsExpandedStandalone,\n isExpandedStandalone,\n contextOnToggle,\n itemKey,\n ]);\n\n const handleKeyDown = useCallback(\n (e: KeyboardEvent) => {\n // If allowExpand is false, disable keyboard toggle\n if (!allowExpand || disabled) return;\n\n switch (e.key) {\n case 'Enter':\n case ' ': {\n e.preventDefault();\n handleToggle();\n break;\n }\n }\n },\n [allowExpand, disabled, handleToggle],\n );\n\n const preventTitleTextSelection = useCallback((e: any) => {\n // Prevent browser from creating a selection range on double/multi click,\n // which can accidentally select the content region.\n if (e?.detail > 1) e.preventDefault();\n }, []);\n\n // Build indicator\n const indicator = useMemo(() => {\n if (!allowExpand || hideIndicatorFinal) return null;\n\n if (customIndicator) {\n if (typeof customIndicator === 'function') {\n return (\n <span\n aria-hidden=\"true\"\n className={cx(styles.indicator, classNames?.indicator)}\n style={customStyles?.indicator}\n >\n {customIndicator({ isDisabled: disabled, isOpen })}\n </span>\n );\n }\n return (\n <span\n aria-hidden=\"true\"\n className={cx(styles.indicator, classNames?.indicator)}\n style={customStyles?.indicator}\n >\n {customIndicator}\n </span>\n );\n }\n\n return (\n <span\n aria-hidden=\"true\"\n className={cx(styles.indicator, classNames?.indicator)}\n style={customStyles?.indicator}\n >\n <ArrowIcon className={cx(styles.icon, isOpen && styles.iconRotate)} />\n </span>\n );\n }, [\n allowExpand,\n hideIndicatorFinal,\n customIndicator,\n disabled,\n isOpen,\n cx,\n styles,\n classNames,\n customStyles,\n ]);\n\n const skipInitialAnimation = isInitialRenderRef.current && isOpen;\n\n const contentClassName = useMemo(\n () => cx('accordion-content', styles.content, classNames?.content),\n [cx, styles, classNames?.content],\n );\n\n const titleNode = useMemo(\n () =>\n typeof title === 'string' ? (\n <Text className={classNames?.title} ellipsis style={customStyles?.title}>\n {title}\n </Text>\n ) : (\n title\n ),\n [title, classNames?.title, customStyles?.title],\n );\n\n const actionNode = useMemo(\n () =>\n action && (\n <Flexbox\n align={'center'}\n className={cx('accordion-action', styles.action, classNames?.action)}\n flex={'none'}\n gap={4}\n horizontal\n onClick={stopPropagation}\n style={customStyles?.action}\n >\n {action}\n </Flexbox>\n ),\n [action, cx, styles, classNames?.action, customStyles?.action],\n );\n\n const headerElement = useMemo(() => {\n const header = (\n <Block\n className={cx('accordion-header', styles.header, classNames?.header)}\n clickable={!disabled && allowExpand}\n gap={4}\n horizontal\n justify={'space-between'}\n onClick={handleToggle}\n onKeyDown={handleKeyDown}\n padding={padding}\n paddingBlock={paddingBlock}\n paddingInline={paddingInline}\n ref={ref}\n style={{\n alignItems: 'center',\n cursor: disabled ? 'not-allowed' : allowExpand ? 'pointer' : 'default',\n opacity: disabled ? 0.5 : undefined,\n overflow: 'hidden',\n width: '100%',\n ...customStyles?.header,\n }}\n variant={customVariant || variant}\n >\n {indicatorPlacementFinal === 'start' ? (\n <>\n <Flexbox\n align={'center'}\n className={styles.titleWrapper}\n flex={1}\n gap={2}\n horizontal\n onDoubleClick={preventTitleTextSelection}\n onMouseDown={preventTitleTextSelection}\n style={{\n overflow: 'hidden',\n }}\n >\n {titleNode}\n {indicator}\n </Flexbox>\n <Flexbox align={'center'} flex={'none'} gap={4} horizontal>\n {actionNode}\n </Flexbox>\n </>\n ) : (\n <>\n <Flexbox\n align={'center'}\n className={styles.titleWrapper}\n flex={1}\n gap={2}\n horizontal\n onDoubleClick={preventTitleTextSelection}\n onMouseDown={preventTitleTextSelection}\n style={{\n overflow: 'hidden',\n }}\n >\n {titleNode}\n </Flexbox>\n <Flexbox align={'center'} flex={'none'} gap={4} horizontal>\n {actionNode}\n {indicator}\n </Flexbox>\n </>\n )}\n </Block>\n );\n if (headerWrapper) {\n return headerWrapper(header);\n }\n return header;\n }, [\n cx,\n styles,\n classNames,\n disabled,\n handleToggle,\n handleKeyDown,\n padding,\n paddingBlock,\n paddingInline,\n ref,\n customVariant,\n variant,\n indicatorPlacementFinal,\n titleNode,\n indicator,\n actionNode,\n headerWrapper,\n ]);\n\n return (\n <div\n className={cx('accordion-item', styles.item, classNames?.base)}\n style={customStyles?.base}\n >\n {headerElement}\n <AccordionItemContent\n className={contentClassName}\n contentInnerClassName={styles.contentInner}\n contextMotionProps={contextMotionProps}\n disableAnimation={!!disableAnimation}\n isOpen={isOpen}\n keepContentMounted={!!keepContentMounted}\n skipInitialAnimation={skipInitialAnimation}\n style={customStyles?.content}\n >\n {children}\n </AccordionItemContent>\n </div>\n );\n },\n);\n\nAccordionItem.displayName = 'AccordionItem';\n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GACZ;GACR,oBAAoB,CAAC,CAAC;GACA;GACtB,OAAO,cAAc;GAEpB;IACoB;GACnB;EAGX;AAED,cAAc,cAAc;AAE5B,4BAAe"}
@@ -1,8 +1,8 @@
1
1
  import { ActionIconProps } from "./type.mjs";
2
- import * as react10 from "react";
2
+ import * as react18 from "react";
3
3
 
4
4
  //#region src/ActionIcon/ActionIcon.d.ts
5
- declare const ActionIcon: react10.NamedExoticComponent<ActionIconProps>;
5
+ declare const ActionIcon: react18.NamedExoticComponent<ActionIconProps>;
6
6
  //#endregion
7
7
  export { ActionIcon };
8
8
  //# sourceMappingURL=ActionIcon.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { AlertProps } from "./type.mjs";
2
- import * as react46 from "react";
2
+ import * as react20 from "react";
3
3
 
4
4
  //#region src/Alert/Alert.d.ts
5
- declare const Alert: react46.NamedExoticComponent<AlertProps>;
5
+ declare const Alert: react20.NamedExoticComponent<AlertProps>;
6
6
  //#endregion
7
7
  export { Alert };
8
8
  //# sourceMappingURL=Alert.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { AutoCompleteProps } from "./type.mjs";
2
- import * as react49 from "react";
2
+ import * as react15 from "react";
3
3
 
4
4
  //#region src/AutoComplete/Select.d.ts
5
- declare const AutoComplete: react49.NamedExoticComponent<AutoCompleteProps>;
5
+ declare const AutoComplete: react15.NamedExoticComponent<AutoCompleteProps>;
6
6
  //#endregion
7
7
  export { AutoComplete };
8
8
  //# sourceMappingURL=Select.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { AvatarGroupProps } from "../type.mjs";
2
- import * as react44 from "react";
2
+ import * as react19 from "react";
3
3
 
4
4
  //#region src/Avatar/AvatarGroup/index.d.ts
5
- declare const AvatarGroup: react44.NamedExoticComponent<AvatarGroupProps>;
5
+ declare const AvatarGroup: react19.NamedExoticComponent<AvatarGroupProps>;
6
6
  //#endregion
7
7
  export { AvatarGroup };
8
8
  //# sourceMappingURL=index.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { BurgerProps } from "./type.mjs";
2
- import * as react43 from "react";
2
+ import * as react9 from "react";
3
3
 
4
4
  //#region src/Burger/Burger.d.ts
5
- declare const Burger: react43.NamedExoticComponent<BurgerProps>;
5
+ declare const Burger: react9.NamedExoticComponent<BurgerProps>;
6
6
  //#endregion
7
7
  export { Burger };
8
8
  //# sourceMappingURL=Burger.d.mts.map
@@ -4,12 +4,12 @@ import Text_default from "../Text/Text.mjs";
4
4
  import { styles } from "./style.mjs";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
6
  import { cx } from "antd-style";
7
- import useMergeState from "use-merge-value";
7
+ import useControlledState from "use-merge-value";
8
8
  import { CheckIcon, Minus } from "lucide-react";
9
9
 
10
10
  //#region src/Checkbox/Checkbox.tsx
11
11
  const Checkbox = ({ checked, defaultChecked, onChange, size = 16, className, style, children, textProps, backgroundColor, classNames, styles: customStyles, shape = "square", disabled, indeterminate, ...rest }) => {
12
- const [value, setValue] = useMergeState(defaultChecked || false, {
12
+ const [value, setValue] = useControlledState(defaultChecked || false, {
13
13
  defaultValue: defaultChecked,
14
14
  onChange,
15
15
  value: checked
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.mjs","names":["Checkbox: FC<CheckboxProps>","checkboxStyles: CSSProperties","Block","Flexbox","Text"],"sources":["../../src/Checkbox/Checkbox.tsx"],"sourcesContent":["import { cx } from 'antd-style';\nimport { CheckIcon, Minus } from 'lucide-react';\nimport type { CSSProperties, FC, MouseEvent } from 'react';\nimport useMergeState from 'use-merge-value';\n\nimport Block from '@/Block';\nimport { Flexbox } from '@/Flex';\nimport Text from '@/Text';\n\nimport { styles } from './style';\nimport type { CheckboxProps } from './type';\n\nconst Checkbox: FC<CheckboxProps> = ({\n checked,\n defaultChecked,\n onChange,\n size = 16,\n className,\n style,\n children,\n textProps,\n backgroundColor,\n classNames,\n styles: customStyles,\n shape = 'square',\n disabled,\n indeterminate,\n ...rest\n}) => {\n const [value, setValue] = useMergeState(defaultChecked || false, {\n defaultValue: defaultChecked,\n onChange,\n value: checked,\n });\n\n const checkboxStyles: CSSProperties = {\n borderRadius: shape === 'square' ? `max(4px, ${Math.round(size / 4)}px)` : '50%',\n ...style,\n ...customStyles?.checkbox,\n };\n\n const handleClick = (e?: MouseEvent) => {\n if (!disabled) {\n e?.preventDefault();\n setValue(!value);\n }\n };\n\n const isIndeterminate = indeterminate;\n const isChecked = !isIndeterminate && value;\n\n const checkIcon = (\n <Block\n align={'center'}\n className={cx(\n styles.root,\n isChecked && styles.checked,\n isIndeterminate && styles.indeterminate,\n disabled && styles.disabled,\n className,\n classNames?.checkbox,\n )}\n flex={'none'}\n height={size}\n justify={'center'}\n onClick={handleClick}\n style={\n backgroundColor && (isChecked || isIndeterminate)\n ? { backgroundColor, borderColor: backgroundColor, ...checkboxStyles }\n : { ...checkboxStyles }\n }\n variant={'outlined'}\n width={size}\n {...rest}\n >\n {isIndeterminate ? (\n <Minus\n size={size}\n strokeWidth={3}\n style={{\n transform: `scale(${shape === 'square' ? 0.75 : 0.66})`,\n }}\n />\n ) : isChecked ? (\n <CheckIcon\n size={size}\n strokeWidth={3}\n style={{\n transform: `scale(${shape === 'square' ? 0.75 : 0.66})`,\n }}\n />\n ) : null}\n </Block>\n );\n\n if (!children) return checkIcon;\n\n return (\n <Flexbox\n align={'center'}\n className={classNames?.wrapper}\n gap={Math.floor(size / 2)}\n horizontal\n onClick={handleClick}\n style={{\n cursor: disabled ? 'not-allowed' : 'pointer',\n userSelect: 'none',\n ...customStyles?.wrapper,\n }}\n >\n {checkIcon}\n <Text\n as={'span'}\n className={cx(classNames?.text)}\n style={customStyles?.text}\n {...textProps}\n type={disabled ? 'secondary' : textProps?.type}\n >\n {children}\n </Text>\n </Flexbox>\n );\n};\n\nCheckbox.displayName = 'Checkbox';\n\nexport default Checkbox;\n"],"mappings":";;;;;;;;;;AAYA,MAAMA,YAA+B,EACnC,SACA,gBACA,UACA,OAAO,IACP,WACA,OACA,UACA,WACA,iBACA,YACA,QA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,cAAc,WAAW;GAEzC;IACI;GACC;;AAId,SAAS,cAAc;AAEvB,uBAAe"}
1
+ {"version":3,"file":"Checkbox.mjs","names":["Checkbox: FC<CheckboxProps>","useMergeState","checkboxStyles: CSSProperties","Block","Flexbox","Text"],"sources":["../../src/Checkbox/Checkbox.tsx"],"sourcesContent":["import { cx } from 'antd-style';\nimport { CheckIcon, Minus } from 'lucide-react';\nimport type { CSSProperties, FC, MouseEvent } from 'react';\nimport useMergeState from 'use-merge-value';\n\nimport Block from '@/Block';\nimport { Flexbox } from '@/Flex';\nimport Text from '@/Text';\n\nimport { styles } from './style';\nimport type { CheckboxProps } from './type';\n\nconst Checkbox: FC<CheckboxProps> = ({\n checked,\n defaultChecked,\n onChange,\n size = 16,\n className,\n style,\n children,\n textProps,\n backgroundColor,\n classNames,\n styles: customStyles,\n shape = 'square',\n disabled,\n indeterminate,\n ...rest\n}) => {\n const [value, setValue] = useMergeState(defaultChecked || false, {\n defaultValue: defaultChecked,\n onChange,\n value: checked,\n });\n\n const checkboxStyles: CSSProperties = {\n borderRadius: shape === 'square' ? `max(4px, ${Math.round(size / 4)}px)` : '50%',\n ...style,\n ...customStyles?.checkbox,\n };\n\n const handleClick = (e?: MouseEvent) => {\n if (!disabled) {\n e?.preventDefault();\n setValue(!value);\n }\n };\n\n const isIndeterminate = indeterminate;\n const isChecked = !isIndeterminate && value;\n\n const checkIcon = (\n <Block\n align={'center'}\n className={cx(\n styles.root,\n isChecked && styles.checked,\n isIndeterminate && styles.indeterminate,\n disabled && styles.disabled,\n className,\n classNames?.checkbox,\n )}\n flex={'none'}\n height={size}\n justify={'center'}\n onClick={handleClick}\n style={\n backgroundColor && (isChecked || isIndeterminate)\n ? { backgroundColor, borderColor: backgroundColor, ...checkboxStyles }\n : { ...checkboxStyles }\n }\n variant={'outlined'}\n width={size}\n {...rest}\n >\n {isIndeterminate ? (\n <Minus\n size={size}\n strokeWidth={3}\n style={{\n transform: `scale(${shape === 'square' ? 0.75 : 0.66})`,\n }}\n />\n ) : isChecked ? (\n <CheckIcon\n size={size}\n strokeWidth={3}\n style={{\n transform: `scale(${shape === 'square' ? 0.75 : 0.66})`,\n }}\n />\n ) : null}\n </Block>\n );\n\n if (!children) return checkIcon;\n\n return (\n <Flexbox\n align={'center'}\n className={classNames?.wrapper}\n gap={Math.floor(size / 2)}\n horizontal\n onClick={handleClick}\n style={{\n cursor: disabled ? 'not-allowed' : 'pointer',\n userSelect: 'none',\n ...customStyles?.wrapper,\n }}\n >\n {checkIcon}\n <Text\n as={'span'}\n className={cx(classNames?.text)}\n style={customStyles?.text}\n {...textProps}\n type={disabled ? 'secondary' : textProps?.type}\n >\n {children}\n </Text>\n </Flexbox>\n );\n};\n\nCheckbox.displayName = 'Checkbox';\n\nexport default Checkbox;\n"],"mappings":";;;;;;;;;;AAYA,MAAMA,YAA+B,EACnC,SACA,gBACA,UACA,OAAO,IACP,WACA,OACA,UACA,WACA,iBACA,YACA,QAAQ,cACR,QAAQ,UACR,UACA,eACA,GAAG,WACC;CACJ,MAAM,CAAC,OAAO,YAAYC,mBAAc,kBAAkB,OAAO;EAC/D,cAAc;EACd;EACA,OAAO;EACR,CAAC;CAEF,MAAMC,iBAAgC;EACpC,cAAc,UAAU,WAAW,YAAY,KAAK,MAAM,OAAO,EAAE,CAAC,OAAO;EAC3E,GAAG;EACH,GAAG,cAAc;EAClB;CAED,MAAM,eAAe,MAAmB;AACtC,MAAI,CAAC,UAAU;AACb,MAAG,gBAAgB;AACnB,YAAS,CAAC,MAAM;;;CAIpB,MAAM,kBAAkB;CACxB,MAAM,YAAY,CAAC,mBAAmB;CAEtC,MAAM,YACJ,oBAACC;EACC,OAAO;EACP,WAAW,GACT,OAAO,MACP,aAAa,OAAO,SACpB,mBAAmB,OAAO,eAC1B,YAAY,OAAO,UACnB,WACA,YAAY,SACb;EACD,MAAM;EACN,QAAQ;EACR,SAAS;EACT,SAAS;EACT,OACE,oBAAoB,aAAa,mBAC7B;GAAE;GAAiB,aAAa;GAAiB,GAAG;GAAgB,GACpE,EAAE,GAAG,gBAAgB;EAE3B,SAAS;EACT,OAAO;EACP,GAAI;YAEH,kBACC,oBAAC;GACO;GACN,aAAa;GACb,OAAO,EACL,WAAW,SAAS,UAAU,WAAW,MAAO,IAAK,IACtD;IACD,GACA,YACF,oBAAC;GACO;GACN,aAAa;GACb,OAAO,EACL,WAAW,SAAS,UAAU,WAAW,MAAO,IAAK,IACtD;IACD,GACA;GACE;AAGV,KAAI,CAAC,SAAU,QAAO;AAEtB,QACE,qBAACC;EACC,OAAO;EACP,WAAW,YAAY;EACvB,KAAK,KAAK,MAAM,OAAO,EAAE;EACzB;EACA,SAAS;EACT,OAAO;GACL,QAAQ,WAAW,gBAAgB;GACnC,YAAY;GACZ,GAAG,cAAc;GAClB;aAEA,WACD,oBAACC;GACC,IAAI;GACJ,WAAW,GAAG,YAAY,KAAK;GAC/B,OAAO,cAAc;GACrB,GAAI;GACJ,MAAM,WAAW,cAAc,WAAW;GAEzC;IACI;GACC;;AAId,SAAS,cAAc;AAEvB,uBAAe"}
@@ -1,11 +1,11 @@
1
1
  import FlexBasic_default from "../Flex/FlexBasic.mjs";
2
2
  import Checkbox_default from "./Checkbox.mjs";
3
3
  import { jsx } from "react/jsx-runtime";
4
- import useMergeState from "use-merge-value";
4
+ import useControlledState from "use-merge-value";
5
5
 
6
6
  //#region src/Checkbox/CheckboxGroup.tsx
7
7
  const CheckboxGroup = ({ defaultValue, disabled, onChange, options, textProps, value, shape, size, ...rest }) => {
8
- const [selectedValues, setSelectedValues] = useMergeState(defaultValue || [], {
8
+ const [selectedValues, setSelectedValues] = useControlledState(defaultValue || [], {
9
9
  defaultValue,
10
10
  onChange,
11
11
  value
@@ -1 +1 @@
1
- {"version":3,"file":"CheckboxGroup.mjs","names":["CheckboxGroup: FC<CheckboxGroupProps>","Flexbox","Checkbox"],"sources":["../../src/Checkbox/CheckboxGroup.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport useMergeState from 'use-merge-value';\n\nimport { Flexbox } from '@/Flex';\n\nimport Checkbox from './Checkbox';\nimport type { CheckboxGroupProps } from './type';\n\nconst CheckboxGroup: FC<CheckboxGroupProps> = ({\n defaultValue,\n disabled,\n onChange,\n options,\n textProps,\n value,\n shape,\n size,\n ...rest\n}) => {\n const [selectedValues, setSelectedValues] = useMergeState<string[]>(defaultValue || [], {\n defaultValue,\n onChange,\n value,\n });\n\n const handleChange = (optionValue: string, checked: boolean) => {\n const newValues = checked\n ? [...selectedValues, optionValue]\n : selectedValues.filter((v) => v !== optionValue);\n\n setSelectedValues(newValues);\n };\n\n const normalizedOptions = options.map((option) => {\n if (typeof option === 'string') {\n return {\n disabled: false,\n label: option,\n value: option,\n };\n }\n return option;\n });\n\n return (\n <Flexbox align={'center'} gap={16} horizontal wrap={'wrap'} {...rest}>\n {normalizedOptions.map((option) => {\n const isChecked = selectedValues.includes(option.value);\n const isDisabled = disabled || option.disabled;\n\n return (\n <Checkbox\n checked={isChecked}\n disabled={isDisabled}\n key={String(option.value)}\n onChange={(checked) => handleChange(option.value, checked)}\n shape={shape}\n size={size}\n textProps={textProps}\n >\n {option.label}\n </Checkbox>\n );\n })}\n </Flexbox>\n );\n};\n\nCheckboxGroup.displayName = 'CheckboxGroup';\n\nexport default CheckboxGroup;\n"],"mappings":";;;;;;AAQA,MAAMA,iBAAyC,EAC7C,cACA,UACA,UACA,SACA,WACA,OACA,OACA,MACA,GAAG,WACC;CACJ,MAAM,CAAC,gBAAgB,qBAAqB,cAAwB,gBAAgB,EAAE,EAAE;EACtF;EACA;EACA;EACD,CAAC;CAEF,MAAM,gBAAgB,aAAqB,YAAqB;AAK9D,oBAJkB,UACd,CAAC,GAAG,gBAAgB,YAAY,GAChC,eAAe,QAAQ,MAAM,MAAM,YAAY,CAEvB;;CAG9B,MAAM,oBAAoB,QAAQ,KAAK,WAAW;AAChD,MAAI,OAAO,WAAW,SACpB,QAAO;GACL,UAAU;GACV,OAAO;GACP,OAAO;GACR;AAEH,SAAO;GACP;AAEF,QACE,oBAACC;EAAQ,OAAO;EAAU,KAAK;EAAI;EAAW,MAAM;EAAQ,GAAI;YAC7D,kBAAkB,KAAK,WAAW;AAIjC,UACE,oBAACC;IACC,SALc,eAAe,SAAS,OAAO,MAAM;IAMnD,UALe,YAAY,OAAO;IAOlC,WAAW,YAAY,aAAa,OAAO,OAAO,QAAQ;IACnD;IACD;IACK;cAEV,OAAO;MANH,OAAO,OAAO,MAAM,CAOhB;IAEb;GACM;;AAId,cAAc,cAAc;AAE5B,4BAAe"}
1
+ {"version":3,"file":"CheckboxGroup.mjs","names":["CheckboxGroup: FC<CheckboxGroupProps>","useMergeState","Flexbox","Checkbox"],"sources":["../../src/Checkbox/CheckboxGroup.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport useMergeState from 'use-merge-value';\n\nimport { Flexbox } from '@/Flex';\n\nimport Checkbox from './Checkbox';\nimport type { CheckboxGroupProps } from './type';\n\nconst CheckboxGroup: FC<CheckboxGroupProps> = ({\n defaultValue,\n disabled,\n onChange,\n options,\n textProps,\n value,\n shape,\n size,\n ...rest\n}) => {\n const [selectedValues, setSelectedValues] = useMergeState<string[]>(defaultValue || [], {\n defaultValue,\n onChange,\n value,\n });\n\n const handleChange = (optionValue: string, checked: boolean) => {\n const newValues = checked\n ? [...selectedValues, optionValue]\n : selectedValues.filter((v) => v !== optionValue);\n\n setSelectedValues(newValues);\n };\n\n const normalizedOptions = options.map((option) => {\n if (typeof option === 'string') {\n return {\n disabled: false,\n label: option,\n value: option,\n };\n }\n return option;\n });\n\n return (\n <Flexbox align={'center'} gap={16} horizontal wrap={'wrap'} {...rest}>\n {normalizedOptions.map((option) => {\n const isChecked = selectedValues.includes(option.value);\n const isDisabled = disabled || option.disabled;\n\n return (\n <Checkbox\n checked={isChecked}\n disabled={isDisabled}\n key={String(option.value)}\n onChange={(checked) => handleChange(option.value, checked)}\n shape={shape}\n size={size}\n textProps={textProps}\n >\n {option.label}\n </Checkbox>\n );\n })}\n </Flexbox>\n );\n};\n\nCheckboxGroup.displayName = 'CheckboxGroup';\n\nexport default CheckboxGroup;\n"],"mappings":";;;;;;AAQA,MAAMA,iBAAyC,EAC7C,cACA,UACA,UACA,SACA,WACA,OACA,OACA,MACA,GAAG,WACC;CACJ,MAAM,CAAC,gBAAgB,qBAAqBC,mBAAwB,gBAAgB,EAAE,EAAE;EACtF;EACA;EACA;EACD,CAAC;CAEF,MAAM,gBAAgB,aAAqB,YAAqB;AAK9D,oBAJkB,UACd,CAAC,GAAG,gBAAgB,YAAY,GAChC,eAAe,QAAQ,MAAM,MAAM,YAAY,CAEvB;;CAG9B,MAAM,oBAAoB,QAAQ,KAAK,WAAW;AAChD,MAAI,OAAO,WAAW,SACpB,QAAO;GACL,UAAU;GACV,OAAO;GACP,OAAO;GACR;AAEH,SAAO;GACP;AAEF,QACE,oBAACC;EAAQ,OAAO;EAAU,KAAK;EAAI;EAAW,MAAM;EAAQ,GAAI;YAC7D,kBAAkB,KAAK,WAAW;AAIjC,UACE,oBAACC;IACC,SALc,eAAe,SAAS,OAAO,MAAM;IAMnD,UALe,YAAY,OAAO;IAOlC,WAAW,YAAY,aAAa,OAAO,OAAO,QAAQ;IACnD;IACD;IACK;cAEV,OAAO;MANH,OAAO,OAAO,MAAM,CAOhB;IAEb;GACM;;AAId,cAAc,cAAc;AAE5B,4BAAe"}
@@ -1,8 +1,8 @@
1
1
  import { CodeEditorProps } from "./type.mjs";
2
- import * as react42 from "react";
2
+ import * as react16 from "react";
3
3
 
4
4
  //#region src/CodeEditor/CodeEditor.d.ts
5
- declare const CodeEditor: react42.NamedExoticComponent<CodeEditorProps>;
5
+ declare const CodeEditor: react16.NamedExoticComponent<CodeEditorProps>;
6
6
  //#endregion
7
7
  export { CodeEditor };
8
8
  //# sourceMappingURL=CodeEditor.d.mts.map
@@ -6,11 +6,11 @@ import SyntaxHighlighter_default from "../Highlighter/SyntaxHighlighter/index.mj
6
6
  import { memo } from "react";
7
7
  import { jsx, jsxs } from "react/jsx-runtime";
8
8
  import { cssVar, cx } from "antd-style";
9
- import useMergeState from "use-merge-value";
9
+ import useControlledState from "use-merge-value";
10
10
 
11
11
  //#region src/CodeEditor/CodeEditor.tsx
12
12
  const CodeEditor = memo(({ autoFocus, classNames, styles: customStyles, defaultValue = "", onChange, placeholder = "", style, className, onValueChange, value, language = "markdown", variant = "borderless", width, height, flex, ref, ...rest }) => {
13
- const [code, setCode] = useMergeState(defaultValue, {
13
+ const [code, setCode] = useControlledState(defaultValue, {
14
14
  defaultValue,
15
15
  onChange: onValueChange,
16
16
  value
@@ -1 +1 @@
1
- {"version":3,"file":"CodeEditor.mjs","names":["Flexbox","SyntaxHighlighter"],"sources":["../../src/CodeEditor/CodeEditor.tsx"],"sourcesContent":["'use client';\n\nimport { cssVar, cx } from 'antd-style';\nimport { memo } from 'react';\nimport useMergeState from 'use-merge-value';\n\nimport { styles, variants } from '@/CodeEditor/style';\nimport { Flexbox } from '@/Flex';\nimport SyntaxHighlighter from '@/Highlighter/SyntaxHighlighter';\n\nimport { CodeEditorProps } from './type';\n\nconst CodeEditor = memo<CodeEditorProps>(\n ({\n autoFocus,\n classNames,\n styles: customStyles,\n defaultValue = '',\n onChange,\n placeholder = '',\n style,\n className,\n onValueChange,\n value,\n language = 'markdown',\n variant = 'borderless',\n width,\n height,\n flex,\n ref,\n ...rest\n }) => {\n const [code, setCode] = useMergeState(defaultValue, {\n defaultValue,\n onChange: onValueChange,\n value,\n });\n\n return (\n <Flexbox\n className={cx(variants({ variant }), className)}\n flex={flex}\n height={height}\n style={style}\n width={width}\n >\n {value ? (\n <SyntaxHighlighter\n className={cx(styles.highlight, classNames?.highlight)}\n language={language}\n style={customStyles?.highlight}\n variant={variant}\n >\n {value}\n </SyntaxHighlighter>\n ) : (\n <pre\n className={cx(styles.highlight, classNames?.highlight)}\n style={{\n color: cssVar.colorTextDescription,\n }}\n >\n {placeholder || ' '}\n </pre>\n )}\n\n <textarea\n autoCapitalize=\"off\"\n autoComplete=\"off\"\n autoCorrect=\"off\"\n autoFocus={autoFocus}\n className={cx(styles.textarea, classNames?.textarea)}\n data-gramm={false}\n onChange={(e) => {\n onChange?.(e);\n setCode(e.target.value);\n }}\n ref={ref}\n style={customStyles?.textarea}\n value={code}\n {...rest}\n />\n </Flexbox>\n );\n },\n);\n\nCodeEditor.displayName = 'CodeEditor';\n\nexport default CodeEditor;\n"],"mappings":";;;;;;;;;;;AAYA,MAAM,aAAa,MAChB,EACC,WACA,YACA,QAAQ,cACR,eAAe,IACf,UACA,cAAc,IACd,OACA,WACA,eACA,OACA,WAAW,YACX,UAAU,cACV,OACA,QACA,MACA,KACA,GAAG,WACC;CACJ,MAAM,CAAC,MAAM,WAAW,cAAc,cAAc;EAClD;EACA,UAAU;EACV;EACD,CAAC;AAEF,QACE,qBAACA;EACC,WAAW,GAAG,SAAS,EAAE,SAAS,CAAC,EAAE,UAAU;EACzC;EACE;EACD;EACA;aAEN,QACC,oBAACC;GACC,WAAW,GAAG,OAAO,WAAW,YAAY,UAAU;GAC5C;GACV,OAAO,cAAc;GACZ;aAER;IACiB,GAEpB,oBAAC;GACC,WAAW,GAAG,OAAO,WAAW,YAAY,UAAU;GACtD,OAAO,EACL,OAAO,OAAO,sBACf;aAEA,eAAe;IACZ,EAGR,oBAAC;GACC,gBAAe;GACf,cAAa;GACb,aAAY;GACD;GACX,WAAW,GAAG,OAAO,UAAU,YAAY,SAAS;GACpD,cAAY;GACZ,WAAW,MAAM;AACf,eAAW,EAAE;AACb,YAAQ,EAAE,OAAO,MAAM;;GAEpB;GACL,OAAO,cAAc;GACrB,OAAO;GACP,GAAI;IACJ;GACM;EAGf;AAED,WAAW,cAAc;AAEzB,yBAAe"}
1
+ {"version":3,"file":"CodeEditor.mjs","names":["useMergeState","Flexbox","SyntaxHighlighter"],"sources":["../../src/CodeEditor/CodeEditor.tsx"],"sourcesContent":["'use client';\n\nimport { cssVar, cx } from 'antd-style';\nimport { memo } from 'react';\nimport useMergeState from 'use-merge-value';\n\nimport { styles, variants } from '@/CodeEditor/style';\nimport { Flexbox } from '@/Flex';\nimport SyntaxHighlighter from '@/Highlighter/SyntaxHighlighter';\n\nimport { CodeEditorProps } from './type';\n\nconst CodeEditor = memo<CodeEditorProps>(\n ({\n autoFocus,\n classNames,\n styles: customStyles,\n defaultValue = '',\n onChange,\n placeholder = '',\n style,\n className,\n onValueChange,\n value,\n language = 'markdown',\n variant = 'borderless',\n width,\n height,\n flex,\n ref,\n ...rest\n }) => {\n const [code, setCode] = useMergeState(defaultValue, {\n defaultValue,\n onChange: onValueChange,\n value,\n });\n\n return (\n <Flexbox\n className={cx(variants({ variant }), className)}\n flex={flex}\n height={height}\n style={style}\n width={width}\n >\n {value ? (\n <SyntaxHighlighter\n className={cx(styles.highlight, classNames?.highlight)}\n language={language}\n style={customStyles?.highlight}\n variant={variant}\n >\n {value}\n </SyntaxHighlighter>\n ) : (\n <pre\n className={cx(styles.highlight, classNames?.highlight)}\n style={{\n color: cssVar.colorTextDescription,\n }}\n >\n {placeholder || ' '}\n </pre>\n )}\n\n <textarea\n autoCapitalize=\"off\"\n autoComplete=\"off\"\n autoCorrect=\"off\"\n autoFocus={autoFocus}\n className={cx(styles.textarea, classNames?.textarea)}\n data-gramm={false}\n onChange={(e) => {\n onChange?.(e);\n setCode(e.target.value);\n }}\n ref={ref}\n style={customStyles?.textarea}\n value={code}\n {...rest}\n />\n </Flexbox>\n );\n },\n);\n\nCodeEditor.displayName = 'CodeEditor';\n\nexport default CodeEditor;\n"],"mappings":";;;;;;;;;;;AAYA,MAAM,aAAa,MAChB,EACC,WACA,YACA,QAAQ,cACR,eAAe,IACf,UACA,cAAc,IACd,OACA,WACA,eACA,OACA,WAAW,YACX,UAAU,cACV,OACA,QACA,MACA,KACA,GAAG,WACC;CACJ,MAAM,CAAC,MAAM,WAAWA,mBAAc,cAAc;EAClD;EACA,UAAU;EACV;EACD,CAAC;AAEF,QACE,qBAACC;EACC,WAAW,GAAG,SAAS,EAAE,SAAS,CAAC,EAAE,UAAU;EACzC;EACE;EACD;EACA;aAEN,QACC,oBAACC;GACC,WAAW,GAAG,OAAO,WAAW,YAAY,UAAU;GAC5C;GACV,OAAO,cAAc;GACZ;aAER;IACiB,GAEpB,oBAAC;GACC,WAAW,GAAG,OAAO,WAAW,YAAY,UAAU;GACtD,OAAO,EACL,OAAO,OAAO,sBACf;aAEA,eAAe;IACZ,EAGR,oBAAC;GACC,gBAAe;GACf,cAAa;GACb,aAAY;GACD;GACX,WAAW,GAAG,OAAO,UAAU,YAAY,SAAS;GACpD,cAAY;GACZ,WAAW,MAAM;AACf,eAAW,EAAE;AACb,YAAQ,EAAE,OAAO,MAAM;;GAEpB;GACL,OAAO,cAAc;GACrB,OAAO;GACP,GAAI;IACJ;GACM;EAGf;AAED,WAAW,cAAc;AAEzB,yBAAe"}
@@ -1,8 +1,8 @@
1
1
  import { CollapseProps } from "./type.mjs";
2
- import * as react67 from "react";
2
+ import * as react7 from "react";
3
3
 
4
4
  //#region src/Collapse/Collapse.d.ts
5
- declare const Collapse: react67.NamedExoticComponent<CollapseProps>;
5
+ declare const Collapse: react7.NamedExoticComponent<CollapseProps>;
6
6
  //#endregion
7
7
  export { Collapse };
8
8
  //# sourceMappingURL=Collapse.d.mts.map
@@ -10,7 +10,7 @@ import { useMemo } from "react";
10
10
  import { jsx, jsxs } from "react/jsx-runtime";
11
11
  import { ColorPicker } from "antd";
12
12
  import { cssVar, cx, useTheme } from "antd-style";
13
- import useMergeState from "use-merge-value";
13
+ import useControlledState from "use-merge-value";
14
14
  import { rgba } from "polished";
15
15
  import { CheckIcon } from "lucide-react";
16
16
  import chroma from "chroma-js";
@@ -18,7 +18,7 @@ import chroma from "chroma-js";
18
18
  //#region src/ColorSwatches/ColorSwatches.tsx
19
19
  const ColorSwatches = ({ enableColorPicker, enableColorSwatches = true, defaultValue, value, style, colors, onChange, size = 24, shape = "circle", texts, ref, ...rest }) => {
20
20
  const theme = useTheme();
21
- const [active, setActive] = useMergeState(defaultValue, {
21
+ const [active, setActive] = useControlledState(defaultValue, {
22
22
  defaultValue,
23
23
  onChange,
24
24
  value
@@ -1 +1 @@
1
- {"version":3,"file":"ColorSwatches.mjs","names":["ColorSwatches: FC<ColorSwatchesProps>","Flexbox","Tooltip","Center","Icon"],"sources":["../../src/ColorSwatches/ColorSwatches.tsx"],"sourcesContent":["'use client';\n\nimport { ColorPicker } from 'antd';\nimport { cssVar, cx, useTheme } from 'antd-style';\nimport chroma from 'chroma-js';\nimport { CheckIcon } from 'lucide-react';\nimport { rgba } from 'polished';\nimport { type FC, useMemo } from 'react';\nimport useMergeState from 'use-merge-value';\n\nimport { Center, Flexbox } from '@/Flex';\nimport Icon from '@/Icon';\nimport Tooltip from '@/Tooltip';\nimport { safeReadableColor } from '@/utils/safeReadableColor';\n\nimport { styles } from './style';\nimport type { ColorSwatchesProps } from './type';\n\nconst ColorSwatches: FC<ColorSwatchesProps> = ({\n enableColorPicker,\n enableColorSwatches = true,\n defaultValue,\n value,\n style,\n colors,\n onChange,\n size = 24,\n shape = 'circle',\n texts,\n ref,\n ...rest\n}) => {\n const theme = useTheme();\n const [active, setActive] = useMergeState(defaultValue, {\n defaultValue,\n onChange,\n value,\n });\n\n // Convert size prop to CSS variable\n const cssVariables = useMemo<Record<string, string>>(\n () => ({\n '--color-swatches-size': `${size}px`,\n }),\n [size],\n );\n\n const isCustomActive = useMemo(\n () => active && active !== cssVar.colorPrimary && !colors.some((c) => c.color === active),\n [active, colors],\n );\n\n return (\n <Flexbox\n gap={6}\n horizontal\n ref={ref}\n style={{\n ...cssVariables,\n flexWrap: 'wrap',\n ...style,\n }}\n {...rest}\n >\n {enableColorSwatches &&\n colors.map((c, i) => {\n const color = c.color || theme.colorPrimary;\n const isActive = (!active && !c.color) || color === active;\n // Check if color is transparent or CSS variable (which chroma can't parse)\n const isTransparent =\n c.color === 'transparent' ||\n (c.color &&\n !c.color.startsWith('var(') &&\n (() => {\n try {\n return chroma(c.color).alpha() === 0;\n } catch {\n return false;\n }\n })());\n // Get actual color value for readableColor (CSS variables can't be parsed)\n const actualColorForReadable = c.color?.startsWith('var(') ? theme.colorPrimary : color;\n return (\n <Tooltip key={c?.key || i} title={c.title}>\n <Center\n className={cx(\n styles.container,\n isTransparent && styles.transparent,\n isActive && styles.active,\n )}\n onClick={() => setActive(c.color || undefined)}\n style={{\n background: isTransparent ? undefined : color,\n borderRadius: shape === 'circle' ? '50%' : cssVar.borderRadius,\n }}\n >\n {isActive && (\n <Icon\n color={rgba(safeReadableColor(actualColorForReadable), 0.33)}\n icon={CheckIcon}\n size={{ size: 14, strokeWidth: 4 }}\n style={{\n pointerEvents: 'none',\n }}\n />\n )}\n </Center>\n </Tooltip>\n );\n })}\n {enableColorPicker && (\n <Tooltip title={texts?.custom || 'Custom'}>\n <ColorPicker\n arrow={false}\n className={cx(\n styles.picker,\n enableColorSwatches && styles.conic,\n isCustomActive && styles.active,\n )}\n defaultValue={cssVar.colorPrimary}\n disabledAlpha\n format={'hex'}\n onChangeComplete={(c) => {\n if (c.toHexString() === cssVar.colorPrimary) {\n setActive('');\n } else {\n setActive(c.toHexString());\n }\n }}\n presets={\n enableColorSwatches\n ? undefined\n : [\n {\n colors: colors.map((c) => c.color),\n label: texts?.presets || 'Presets',\n },\n ]\n }\n style={{\n borderRadius: shape === 'circle' ? '50%' : cssVar.borderRadius,\n }}\n value={enableColorSwatches ? undefined : active}\n />\n </Tooltip>\n )}\n </Flexbox>\n );\n};\n\nColorSwatches.displayName = 'ColorSwatches';\n\nexport default ColorSwatches;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,MAAMA,iBAAyC,EAC7C,mBACA,sBAAsB,MACtB,cACA,OACA,OACA,QACA,UACA,OAAO,IACP,QAAQ,UACR,OACA,KACA,GAAG,WACC;CACJ,MAAM,QAAQ,UAAU;CACxB,MAAM,CAAC,QAAQ,aAAa,cAAc,cAAc;EACtD;EACA;EACA;EACD,CAAC;CAGF,MAAM,eAAe,eACZ,EACL,yBAAyB,GAAG,KAAK,KAClC,G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E,aAAa,KAAK,OAAO,aAC7B,WAAU,GAAG;SAEb,WAAU,EAAE,aAAa,CAAC;;IAG9B,SACE,sBACI,SACA,CACE;KACE,QAAQ,OAAO,KAAK,MAAM,EAAE,MAAM;KAClC,OAAO,OAAO,WAAW;KAC1B,CACF;IAEP,OAAO,EACL,cAAc,UAAU,WAAW,QAAQ,OAAO,cACnD;IACD,OAAO,sBAAsB,SAAY;KACzC;IACM;GAEJ;;AAId,cAAc,cAAc;AAE5B,4BAAe"}
1
+ {"version":3,"file":"ColorSwatches.mjs","names":["ColorSwatches: FC<ColorSwatchesProps>","useMergeState","Flexbox","Tooltip","Center","Icon"],"sources":["../../src/ColorSwatches/ColorSwatches.tsx"],"sourcesContent":["'use client';\n\nimport { ColorPicker } from 'antd';\nimport { cssVar, cx, useTheme } from 'antd-style';\nimport chroma from 'chroma-js';\nimport { CheckIcon } from 'lucide-react';\nimport { rgba } from 'polished';\nimport { type FC, useMemo } from 'react';\nimport useMergeState from 'use-merge-value';\n\nimport { Center, Flexbox } from '@/Flex';\nimport Icon from '@/Icon';\nimport Tooltip from '@/Tooltip';\nimport { safeReadableColor } from '@/utils/safeReadableColor';\n\nimport { styles } from './style';\nimport type { ColorSwatchesProps } from './type';\n\nconst ColorSwatches: FC<ColorSwatchesProps> = ({\n enableColorPicker,\n enableColorSwatches = true,\n defaultValue,\n value,\n style,\n colors,\n onChange,\n size = 24,\n shape = 'circle',\n texts,\n ref,\n ...rest\n}) => {\n const theme = useTheme();\n const [active, setActive] = useMergeState(defaultValue, {\n defaultValue,\n onChange,\n value,\n });\n\n // Convert size prop to CSS variable\n const cssVariables = useMemo<Record<string, string>>(\n () => ({\n '--color-swatches-size': `${size}px`,\n }),\n [size],\n );\n\n const isCustomActive = useMemo(\n () => active && active !== cssVar.colorPrimary && !colors.some((c) => c.color === active),\n [active, colors],\n );\n\n return (\n <Flexbox\n gap={6}\n horizontal\n ref={ref}\n style={{\n ...cssVariables,\n flexWrap: 'wrap',\n ...style,\n }}\n {...rest}\n >\n {enableColorSwatches &&\n colors.map((c, i) => {\n const color = c.color || theme.colorPrimary;\n const isActive = (!active && !c.color) || color === active;\n // Check if color is transparent or CSS variable (which chroma can't parse)\n const isTransparent =\n c.color === 'transparent' ||\n (c.color &&\n !c.color.startsWith('var(') &&\n (() => {\n try {\n return chroma(c.color).alpha() === 0;\n } catch {\n return false;\n }\n })());\n // Get actual color value for readableColor (CSS variables can't be parsed)\n const actualColorForReadable = c.color?.startsWith('var(') ? theme.colorPrimary : color;\n return (\n <Tooltip key={c?.key || i} title={c.title}>\n <Center\n className={cx(\n styles.container,\n isTransparent && styles.transparent,\n isActive && styles.active,\n )}\n onClick={() => setActive(c.color || undefined)}\n style={{\n background: isTransparent ? undefined : color,\n borderRadius: shape === 'circle' ? '50%' : cssVar.borderRadius,\n }}\n >\n {isActive && (\n <Icon\n color={rgba(safeReadableColor(actualColorForReadable), 0.33)}\n icon={CheckIcon}\n size={{ size: 14, strokeWidth: 4 }}\n style={{\n pointerEvents: 'none',\n }}\n />\n )}\n </Center>\n </Tooltip>\n );\n })}\n {enableColorPicker && (\n <Tooltip title={texts?.custom || 'Custom'}>\n <ColorPicker\n arrow={false}\n className={cx(\n styles.picker,\n enableColorSwatches && styles.conic,\n isCustomActive && styles.active,\n )}\n defaultValue={cssVar.colorPrimary}\n disabledAlpha\n format={'hex'}\n onChangeComplete={(c) => {\n if (c.toHexString() === cssVar.colorPrimary) {\n setActive('');\n } else {\n setActive(c.toHexString());\n }\n }}\n presets={\n enableColorSwatches\n ? undefined\n : [\n {\n colors: colors.map((c) => c.color),\n label: texts?.presets || 'Presets',\n },\n ]\n }\n style={{\n borderRadius: shape === 'circle' ? '50%' : cssVar.borderRadius,\n }}\n value={enableColorSwatches ? undefined : active}\n />\n </Tooltip>\n )}\n </Flexbox>\n );\n};\n\nColorSwatches.displayName = 'ColorSwatches';\n\nexport default ColorSwatches;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,MAAMA,iBAAyC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D;MAEG;MAvBG,GAAG,OAAO,EAwBd;IAEZ,EACH,qBACC,oBAACF;GAAQ,OAAO,OAAO,UAAU;aAC/B,oBAAC;IACC,OAAO;IACP,WAAW,GACT,OAAO,QACP,uBAAuB,OAAO,OAC9B,kBAAkB,OAAO,OAC1B;IACD,cAAc,OAAO;IACrB;IACA,QAAQ;IACR,mBAAmB,MAAM;AACvB,SAAI,EAAE,aAAa,KAAK,OAAO,aAC7B,WAAU,GAAG;SAEb,WAAU,EAAE,aAAa,CAAC;;IAG9B,SACE,sBACI,SACA,CACE;KACE,QAAQ,OAAO,KAAK,MAAM,EAAE,MAAM;KAClC,OAAO,OAAO,WAAW;KAC1B,CACF;IAEP,OAAO,EACL,cAAc,UAAU,WAAW,QAAQ,OAAO,cACnD;IACD,OAAO,sBAAsB,SAAY;KACzC;IACM;GAEJ;;AAId,cAAc,cAAc;AAE5B,4BAAe"}
@@ -1,7 +1,7 @@
1
1
  import { MotionComponentType } from "../MotionProvider/index.mjs";
2
2
  import { TranslationResourcesInput } from "../i18n/types.mjs";
3
3
  import { CDN, CdnApi } from "../utils/genCdnUrl.mjs";
4
- import * as react69 from "react";
4
+ import * as react70 from "react";
5
5
  import { ElementType, ReactNode } from "react";
6
6
 
7
7
  //#region src/ConfigProvider/index.d.ts
@@ -19,7 +19,7 @@ interface ConfigProviderProps {
19
19
  motion: MotionComponentType;
20
20
  resources?: TranslationResourcesInput;
21
21
  }
22
- declare const ConfigProvider: react69.NamedExoticComponent<ConfigProviderProps>;
22
+ declare const ConfigProvider: react70.NamedExoticComponent<ConfigProviderProps>;
23
23
  type CdnFn = ({
24
24
  pkg,
25
25
  version,
@@ -1,10 +1,10 @@
1
1
  'use client';
2
2
 
3
3
  import { LOBE_THEME_APP_ID } from "../ThemeProvider/constants.mjs";
4
- import { TOOLTIP_CONTAINER_ATTR } from "../Tooltip/TooltipPortal.mjs";
5
4
  import { preventDefaultAndStopPropagation } from "../utils/dom.mjs";
6
5
  import { styles } from "../Menu/sharedStyle.mjs";
7
6
  import { useIsClient } from "../hooks/useIsClient.mjs";
7
+ import { usePortalContainer } from "../hooks/usePortalContainer.mjs";
8
8
  import { registerDevSingleton } from "../utils/devSingleton.mjs";
9
9
  import { renderContextMenuItems } from "./renderItems.mjs";
10
10
  import { closeContextMenu, getServerSnapshot, getSnapshot, setContextMenuState, subscribe, updateLastPointer } from "./store.mjs";
@@ -13,14 +13,16 @@ import { jsx } from "react/jsx-runtime";
13
13
  import { ContextMenu } from "@base-ui/react/context-menu";
14
14
 
15
15
  //#region src/ContextMenu/ContextMenuHost.tsx
16
+ const CONTEXT_MENU_CONTAINER_ATTR = "data-lobe-ui-context-menu-container";
16
17
  const ContextMenuHost = memo(() => {
17
18
  const isClient = useIsClient();
18
19
  const state = useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
19
20
  useEffect(() => {
20
- if (!isClient) return;
21
+ const DEV = process.env.NODE_ENV === "development";
22
+ if (!isClient || !DEV) return;
21
23
  const themeApp = document.querySelector(`#${LOBE_THEME_APP_ID}`);
22
- const tooltipContainer = document.querySelector(`[${TOOLTIP_CONTAINER_ATTR}="true"]`);
23
- return registerDevSingleton("ContextMenuHost", themeApp ?? tooltipContainer ?? document.body);
24
+ const contextMenuContainer = document.querySelector(`[${CONTEXT_MENU_CONTAINER_ATTR}="true"]`);
25
+ return registerDevSingleton("ContextMenuHost", themeApp ?? contextMenuContainer ?? document.body);
24
26
  }, [isClient]);
25
27
  useEffect(() => {
26
28
  const handler = (event) => updateLastPointer(event);
@@ -32,14 +34,7 @@ const ContextMenuHost = memo(() => {
32
34
  };
33
35
  }, []);
34
36
  const menuItems = useMemo(() => renderContextMenuItems(state.items), [state.items]);
35
- const portalContainer = useMemo(() => {
36
- if (!isClient) return null;
37
- const themeApp = document.querySelector(`#${LOBE_THEME_APP_ID}`);
38
- if (themeApp) return themeApp;
39
- const tooltipContainer = document.querySelector(`[${TOOLTIP_CONTAINER_ATTR}="true"]`);
40
- if (tooltipContainer) return tooltipContainer;
41
- return document.body;
42
- }, [isClient]);
37
+ const portalContainer = usePortalContainer(CONTEXT_MENU_CONTAINER_ATTR);
43
38
  if (!isClient) return null;
44
39
  if (!state.open && state.items.length === 0) return null;
45
40
  if (!portalContainer) return null;
@@ -1 +1 @@
1
- {"version":3,"file":"ContextMenuHost.mjs","names":[],"sources":["../../src/ContextMenu/ContextMenuHost.tsx"],"sourcesContent":["'use client';\n\nimport { ContextMenu } from '@base-ui/react/context-menu';\nimport { memo, useEffect, useMemo, useSyncExternalStore } from 'react';\n\nimport { LOBE_THEME_APP_ID } from '@/ThemeProvider';\nimport { TOOLTIP_CONTAINER_ATTR } from '@/Tooltip/TooltipPortal';\nimport { useIsClient } from '@/hooks/useIsClient';\nimport { registerDevSingleton } from '@/utils/devSingleton';\nimport { preventDefaultAndStopPropagation } from '@/utils/dom';\n\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\nexport const ContextMenuHost = memo(() => {\n const isClient = useIsClient();\n const state = useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);\n\n useEffect(() => {\n if (!isClient) return;\n // Enforce singleton per portal container (dev-only).\n const themeApp = document.querySelector<HTMLElement>(`#${LOBE_THEME_APP_ID}`);\n const tooltipContainer = document.querySelector<HTMLElement>(\n `[${TOOLTIP_CONTAINER_ATTR}=\"true\"]`,\n );\n const scope = themeApp ?? tooltipContainer ?? document.body;\n return registerDevSingleton('ContextMenuHost', scope);\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(() => renderContextMenuItems(state.items), [state.items]);\n const portalContainer = useMemo(() => {\n if (!isClient) return null;\n\n const themeApp = document.querySelector<HTMLElement>(`#${LOBE_THEME_APP_ID}`);\n if (themeApp) return themeApp;\n\n const tooltipContainer = document.querySelector<HTMLElement>(\n `[${TOOLTIP_CONTAINER_ATTR}=\"true\"]`,\n );\n if (tooltipContainer) return tooltipContainer;\n\n return document.body;\n }, [isClient]);\n\n if (!isClient) return null;\n if (!state.open && state.items.length === 0) return null;\n if (!portalContainer) return null;\n\n return (\n <ContextMenu.Root\n onOpenChange={(open) => {\n if (open) {\n setContextMenuState({ open });\n return;\n }\n closeContextMenu();\n }}\n open={state.open}\n >\n <ContextMenu.Portal container={portalContainer}>\n <ContextMenu.Positioner\n anchor={state.anchor ?? undefined}\n className={styles.positioner}\n sideOffset={6}\n >\n <ContextMenu.Popup\n className={styles.popup}\n onContextMenu={preventDefaultAndStopPropagation}\n >\n {menuItems}\n </ContextMenu.Popup>\n </ContextMenu.Positioner>\n </ContextMenu.Portal>\n </ContextMenu.Root>\n );\n});\n\nContextMenuHost.displayName = 'ContextMenuHost';\n"],"mappings":";;;;;;;;;;;;;;;AAsBA,MAAa,kBAAkB,WAAW;CACxC,MAAM,WAAW,aAAa;CAC9B,MAAM,QAAQ,qBAAqB,WAAW,aAAa,kBAAkB;AAE7E,iBAAgB;AACd,MAAI,CAAC,SAAU;EAEf,MAAM,WAAW,SAAS,cAA2B,IAAI,oBAAoB;EAC7E,MAAM,mBAAmB,SAAS,cAChC,IAAI,uBAAuB,UAC5B;AAED,SAAO,qBAAqB,mBADd,YAAY,oBAAoB,SAAS,KACF;IACpD,CAAC,SAAS,CAAC;AAEd,iBAAgB;EACd,MAAM,WAAW,UAAqC,kBAAkB,MAAM;AAC9E,SAAO,iBAAiB,eAAe,SAAS,KAAK;AACrD,SAAO,iBAAiB,eAAe,SAAS,KAAK;AACrD,eAAa;AACX,UAAO,oBAAoB,eAAe,SAAS,KAAK;AACxD,UAAO,oBAAoB,eAAe,SAAS,KAAK;;IAEzD,EAAE,CAAC;CAEN,MAAM,YAAY,cAAc,uBAAuB,MAAM,MAAM,EAAE,CAAC,MAAM,MAAM,CAAC;CACnF,MAAM,kBAAkB,cAAc;AACpC,MAAI,CAAC,SAAU,QAAO;EAEtB,MAAM,WAAW,SAAS,cAA2B,IAAI,oBAAoB;AAC7E,MAAI,SAAU,QAAO;EAErB,MAAM,mBAAmB,SAAS,cAChC,IAAI,uBAAuB,UAC5B;AACD,MAAI,iBAAkB,QAAO;AAE7B,SAAO,SAAS;IACf,CAAC,SAAS,CAAC;AAEd,KAAI,CAAC,SAAU,QAAO;AACtB,KAAI,CAAC,MAAM,QAAQ,MAAM,MAAM,WAAW,EAAG,QAAO;AACpD,KAAI,CAAC,gBAAiB,QAAO;AAE7B,QACE,oBAAC,YAAY;EACX,eAAe,SAAS;AACtB,OAAI,MAAM;AACR,wBAAoB,EAAE,MAAM,CAAC;AAC7B;;AAEF,qBAAkB;;EAEpB,MAAM,MAAM;YAEZ,oBAAC,YAAY;GAAO,WAAW;aAC7B,oBAAC,YAAY;IACX,QAAQ,MAAM,UAAU;IACxB,WAAW,OAAO;IAClB,YAAY;cAEZ,oBAAC,YAAY;KACX,WAAW,OAAO;KAClB,eAAe;eAEd;MACiB;KACG;IACN;GACJ;EAErB;AAEF,gBAAgB,cAAc"}
1
+ {"version":3,"file":"ContextMenuHost.mjs","names":[],"sources":["../../src/ContextMenu/ContextMenuHost.tsx"],"sourcesContent":["'use client';\n\nimport { ContextMenu } from '@base-ui/react/context-menu';\nimport { memo, useEffect, useMemo, useSyncExternalStore } from 'react';\n\nimport { LOBE_THEME_APP_ID } from '@/ThemeProvider';\nimport { useIsClient } from '@/hooks/useIsClient';\nimport { usePortalContainer } from '@/hooks/usePortalContainer';\nimport { registerDevSingleton } from '@/utils/devSingleton';\nimport { preventDefaultAndStopPropagation } from '@/utils/dom';\n\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 CONTEXT_MENU_CONTAINER_ATTR = 'data-lobe-ui-context-menu-container';\n\nexport const ContextMenuHost = memo(() => {\n const isClient = useIsClient();\n const state = useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);\n\n useEffect(() => {\n const DEV = process.env.NODE_ENV === 'development';\n if (!isClient || !DEV) return;\n // Enforce singleton per portal container (dev-only).\n const themeApp = document.querySelector<HTMLElement>(`#${LOBE_THEME_APP_ID}`);\n const contextMenuContainer = document.querySelector<HTMLElement>(\n `[${CONTEXT_MENU_CONTAINER_ATTR}=\"true\"]`,\n );\n const scope = themeApp ?? contextMenuContainer ?? document.body;\n return registerDevSingleton('ContextMenuHost', scope);\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(() => renderContextMenuItems(state.items), [state.items]);\n const portalContainer = usePortalContainer(CONTEXT_MENU_CONTAINER_ATTR);\n\n if (!isClient) return null;\n if (!state.open && state.items.length === 0) return null;\n if (!portalContainer) return null;\n\n return (\n <ContextMenu.Root\n onOpenChange={(open) => {\n if (open) {\n setContextMenuState({ open });\n return;\n }\n closeContextMenu();\n }}\n open={state.open}\n >\n <ContextMenu.Portal container={portalContainer}>\n <ContextMenu.Positioner\n anchor={state.anchor ?? undefined}\n className={styles.positioner}\n sideOffset={6}\n >\n <ContextMenu.Popup\n className={styles.popup}\n onContextMenu={preventDefaultAndStopPropagation}\n >\n {menuItems}\n </ContextMenu.Popup>\n </ContextMenu.Positioner>\n </ContextMenu.Portal>\n </ContextMenu.Root>\n );\n});\n\nContextMenuHost.displayName = 'ContextMenuHost';\n"],"mappings":";;;;;;;;;;;;;;;AAsBA,MAAM,8BAA8B;AAEpC,MAAa,kBAAkB,WAA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
+ import * as react8 from "react";
3
3
 
4
4
  //#region src/CopyButton/CopyButton.d.ts
5
- declare const CopyButton: react41.NamedExoticComponent<CopyButtonProps>;
5
+ declare const CopyButton: react8.NamedExoticComponent<CopyButtonProps>;
6
6
  //#endregion
7
7
  export { CopyButton };
8
8
  //# sourceMappingURL=CopyButton.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { DatePickerProps } from "./type.mjs";
2
- import * as react45 from "react";
2
+ import * as react51 from "react";
3
3
 
4
4
  //#region src/DatePicker/DatePicker.d.ts
5
- declare const DatePicker: react45.NamedExoticComponent<DatePickerProps>;
5
+ declare const DatePicker: react51.NamedExoticComponent<DatePickerProps>;
6
6
  //#endregion
7
7
  export { DatePicker };
8
8
  //# sourceMappingURL=DatePicker.d.mts.map
@@ -8,7 +8,7 @@ import { memo, use, useCallback, useEffect, useMemo, useReducer, useRef, useTran
8
8
  import { jsx, jsxs } from "react/jsx-runtime";
9
9
  import { ConfigProvider } from "antd";
10
10
  import { cx } from "antd-style";
11
- import useMergeState from "use-merge-value";
11
+ import useControlledState from "use-merge-value";
12
12
  import { useHover } from "ahooks";
13
13
  import { ChevronDown, ChevronLeft, ChevronRight, ChevronUp } from "lucide-react";
14
14
  import isEqual from "fast-deep-equal";
@@ -57,7 +57,7 @@ const DraggablePanel = memo(({ headerHeight = DEFAULT_HEADER_HEIGHT, fullscreen,
57
57
  "--draggable-panel-bg": backgroundColor || "",
58
58
  "--draggable-panel-header-height": `${headerHeight}px`
59
59
  }), [backgroundColor, headerHeight]);
60
- const [isExpand, setIsExpand] = useMergeState(defaultExpand, {
60
+ const [isExpand, setIsExpand] = useControlledState(defaultExpand, {
61
61
  onChange: onExpandChange,
62
62
  value: expand
63
63
  });