@lobehub/ui 4.11.3 → 4.11.5

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 (156) 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.d.mts +2 -2
  24. package/es/CopyButton/CopyButton.d.mts +2 -2
  25. package/es/DatePicker/DatePicker.d.mts +2 -2
  26. package/es/DraggablePanel/DraggablePanel.mjs +2 -2
  27. package/es/DraggablePanel/DraggablePanel.mjs.map +1 -1
  28. package/es/DraggablePanel/components/DraggablePanelBody.d.mts +2 -2
  29. package/es/DraggablePanel/components/DraggablePanelContainer.d.mts +2 -2
  30. package/es/DraggablePanel/components/DraggablePanelFooter.d.mts +2 -2
  31. package/es/DraggablePanel/components/DraggablePanelHeader.d.mts +2 -2
  32. package/es/DraggablePanel/components/DraggablePanelHeader.mjs +2 -2
  33. package/es/DraggablePanel/components/DraggablePanelHeader.mjs.map +1 -1
  34. package/es/DraggableSideNav/DraggableSideNav.d.mts +2 -2
  35. package/es/DraggableSideNav/DraggableSideNav.mjs +2 -2
  36. package/es/DraggableSideNav/DraggableSideNav.mjs.map +1 -1
  37. package/es/Drawer/Drawer.d.mts +2 -2
  38. package/es/Dropdown/Dropdown.d.mts +2 -2
  39. package/es/DropdownMenu/DropdownMenu.d.mts +2 -2
  40. package/es/EditableText/EditableText.d.mts +2 -2
  41. package/es/EditableText/EditableText.mjs +2 -2
  42. package/es/EditableText/EditableText.mjs.map +1 -1
  43. package/es/EmojiPicker/EmojiPicker.d.mts +2 -2
  44. package/es/EmojiPicker/EmojiPicker.mjs +70 -69
  45. package/es/EmojiPicker/EmojiPicker.mjs.map +1 -1
  46. package/es/EmojiPicker/style.mjs +1 -5
  47. package/es/EmojiPicker/style.mjs.map +1 -1
  48. package/es/EmojiPicker/type.d.mts +7 -4
  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/index.d.mts +2 -2
  88. package/es/Modal/Modal.d.mts +2 -2
  89. package/es/Modal/ModalProvider.d.mts +2 -2
  90. package/es/Popover/context.d.mts +2 -2
  91. package/es/SearchBar/SearchBar.d.mts +2 -2
  92. package/es/SearchBar/SearchBar.mjs +2 -2
  93. package/es/SearchBar/SearchBar.mjs.map +1 -1
  94. package/es/Segmented/Segmented.d.mts +2 -2
  95. package/es/Select/Select.d.mts +2 -2
  96. package/es/SideNav/SideNav.d.mts +2 -2
  97. package/es/SliderWithInput/SliderWithInput.d.mts +2 -2
  98. package/es/SortableList/components/DragHandle.d.mts +2 -2
  99. package/es/SortableList/components/SortableItem.d.mts +2 -2
  100. package/es/ThemeProvider/ThemeProvider.d.mts +2 -2
  101. package/es/Toc/Toc.d.mts +2 -2
  102. package/es/Toc/TocMobile.mjs +2 -2
  103. package/es/Toc/TocMobile.mjs.map +1 -1
  104. package/es/awesome/AuroraBackground/AuroraBackground.d.mts +2 -2
  105. package/es/awesome/BottomGradientButton/BottomGradientButton.d.mts +2 -2
  106. package/es/awesome/Features/Features.d.mts +2 -2
  107. package/es/awesome/Giscus/Giscus.d.mts +2 -2
  108. package/es/awesome/GradientButton/GradientButton.d.mts +2 -2
  109. package/es/awesome/GridBackground/GridBackground.d.mts +2 -2
  110. package/es/awesome/GridBackground/GridShowcase.d.mts +2 -2
  111. package/es/awesome/Hero/Hero.d.mts +2 -2
  112. package/es/awesome/Spline/Spine.d.mts +2 -2
  113. package/es/awesome/Spotlight/Spotlight.d.mts +2 -2
  114. package/es/awesome/SpotlightCard/SpotlightCard.d.mts +2 -2
  115. package/es/awesome/TypewriterEffect/TypewriterEffect.d.mts +2 -2
  116. package/es/brand/LobeChat/index.d.mts +2 -2
  117. package/es/brand/LobeHub/index.d.mts +2 -2
  118. package/es/brand/LogoThree/LogoSpline.d.mts +2 -2
  119. package/es/brand/LogoThree/index.d.mts +2 -2
  120. package/es/chat/ChatList/ChatList.d.mts +2 -2
  121. package/es/chat/EditableMessage/EditableMessage.d.mts +2 -2
  122. package/es/chat/EditableMessage/EditableMessage.mjs +3 -3
  123. package/es/chat/EditableMessage/EditableMessage.mjs.map +1 -1
  124. package/es/chat/EditableMessageList/EditableMessageList.d.mts +2 -2
  125. package/es/chat/MessageInput/MessageInput.d.mts +2 -2
  126. package/es/chat/MessageModal/MessageModal.d.mts +2 -2
  127. package/es/chat/MessageModal/MessageModal.mjs +3 -3
  128. package/es/chat/MessageModal/MessageModal.mjs.map +1 -1
  129. package/es/color/ColorScales/index.d.mts +2 -2
  130. package/es/color/CssVar/index.d.mts +2 -2
  131. package/es/i18n/context.d.mts +2 -2
  132. package/es/icons/lucideExtra/BotPromptIcon.d.mts +3 -3
  133. package/es/icons/lucideExtra/CreateBotIcon.d.mts +3 -3
  134. package/es/icons/lucideExtra/DiscordIcon.d.mts +3 -3
  135. package/es/icons/lucideExtra/GlobeOffIcon.d.mts +3 -3
  136. package/es/icons/lucideExtra/GroupBotIcon.d.mts +3 -3
  137. package/es/icons/lucideExtra/GroupBotSquareIcon.d.mts +3 -3
  138. package/es/icons/lucideExtra/LeftClickIcon.d.mts +3 -3
  139. package/es/icons/lucideExtra/LeftDoubleClickIcon.d.mts +3 -3
  140. package/es/icons/lucideExtra/McpIcon.d.mts +2 -2
  141. package/es/icons/lucideExtra/ProviderIcon.d.mts +3 -3
  142. package/es/icons/lucideExtra/RightClickIcon.d.mts +2 -2
  143. package/es/icons/lucideExtra/RightDoubleClickIcon.d.mts +3 -3
  144. package/es/icons/lucideExtra/ShapesUploadIcon.d.mts +3 -3
  145. package/es/icons/lucideExtra/TreeDownRightIcon.d.mts +2 -2
  146. package/es/icons/lucideExtra/TreeUpDownRightIcon.d.mts +3 -3
  147. package/es/index.d.mts +5 -5
  148. package/es/index.mjs +3 -3
  149. package/es/mdx/Mdx/index.d.mts +2 -2
  150. package/es/mobile/ChatHeader/ChatHeaderTitle.d.mts +2 -2
  151. package/es/mobile/ChatInputArea/components/ChatSendButton.d.mts +2 -2
  152. package/es/mobile/TabBar/TabBar.d.mts +2 -2
  153. package/es/mobile/TabBar/TabBar.mjs +2 -2
  154. package/es/mobile/TabBar/TabBar.mjs.map +1 -1
  155. package/es/storybook/StoryBook/index.d.mts +2 -2
  156. package/package.json +1 -1
@@ -1,8 +1,8 @@
1
1
  import { AccordionProps } from "./type.mjs";
2
- import * as react27 from "react";
2
+ import * as react12 from "react";
3
3
 
4
4
  //#region src/Accordion/Accordion.d.ts
5
- declare const Accordion: react27.NamedExoticComponent<AccordionProps>;
5
+ declare const Accordion: react12.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 useControlledState from "use-merge-value";
10
+ import useMergeState 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] = useControlledState(defaultExpandedKeys ?? allItemKeys, {
16
+ const [expandedKeys, setExpandedKeys] = useMergeState(defaultExpandedKeys ?? allItemKeys, {
17
17
  onChange: onExpandedChange,
18
18
  value: expandedKeysProp
19
19
  });
@@ -1 +1 @@
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,mB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,"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,8 +1,8 @@
1
1
  import { AccordionItemProps } from "./type.mjs";
2
- import * as react28 from "react";
2
+ import * as react13 from "react";
3
3
 
4
4
  //#region src/Accordion/AccordionItem.d.ts
5
- declare const AccordionItem: react28.NamedExoticComponent<AccordionItemProps>;
5
+ declare const AccordionItem: react13.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 useControlledState from "use-merge-value";
15
+ import useMergeState 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] = useControlledState(defaultExpand ?? false, {
121
+ const [isExpandedStandalone, setIsExpandedStandalone] = useMergeState(defaultExpand ?? false, {
122
122
  onChange: onExpandChange,
123
123
  value: expand
124
124
  });
@@ -1 +1 @@
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\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,QACE,oBAAC;EAAe;EAAW,MAAK;EAAgB;YAC9C,oBAAC;GAAI,WAAW;GAAwB;IAAe;GACnD;EAGX;AAED,uBAAuB,cAAc;AAErC,MAAM,yBAAyB,MAC5B,EACC,oBACA,WACA,OACA,UACA,uBACA,QACA,2BACI;CACJ,MAAM,SAAS,oBAAoB;CAEnC,MAAM,cAAc,eACX;EACL,SAAS;EACT,MAAM;EACN,SAAS,uBAAuB,QAAQ;EACxC,UAAU;GACR,OAAO;IACL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,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","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;AA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;GACC;GACV;GACL,OAAO;IACL,YAAY;IACZ,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,8 +1,8 @@
1
1
  import { ActionIconProps } from "./type.mjs";
2
- import * as react18 from "react";
2
+ import * as react0 from "react";
3
3
 
4
4
  //#region src/ActionIcon/ActionIcon.d.ts
5
- declare const ActionIcon: react18.NamedExoticComponent<ActionIconProps>;
5
+ declare const ActionIcon: react0.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 react20 from "react";
2
+ import * as react67 from "react";
3
3
 
4
4
  //#region src/Alert/Alert.d.ts
5
- declare const Alert: react20.NamedExoticComponent<AlertProps>;
5
+ declare const Alert: react67.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 react15 from "react";
2
+ import * as react66 from "react";
3
3
 
4
4
  //#region src/AutoComplete/Select.d.ts
5
- declare const AutoComplete: react15.NamedExoticComponent<AutoCompleteProps>;
5
+ declare const AutoComplete: react66.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 react19 from "react";
2
+ import * as react65 from "react";
3
3
 
4
4
  //#region src/Avatar/AvatarGroup/index.d.ts
5
- declare const AvatarGroup: react19.NamedExoticComponent<AvatarGroupProps>;
5
+ declare const AvatarGroup: react65.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 react9 from "react";
2
+ import * as react64 from "react";
3
3
 
4
4
  //#region src/Burger/Burger.d.ts
5
- declare const Burger: react9.NamedExoticComponent<BurgerProps>;
5
+ declare const Burger: react64.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 useControlledState from "use-merge-value";
7
+ import useMergeState 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] = useControlledState(defaultChecked || false, {
12
+ const [value, setValue] = useMergeState(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>","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
+ {"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,QAAQ,cACR,QAAQ,UACR,UACA,eACA,GAAG,WACC;CACJ,MAAM,CAAC,OAAO,YAAY,cAAc,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 useControlledState from "use-merge-value";
4
+ import useMergeState 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] = useControlledState(defaultValue || [], {
8
+ const [selectedValues, setSelectedValues] = useMergeState(defaultValue || [], {
9
9
  defaultValue,
10
10
  onChange,
11
11
  value
@@ -1 +1 @@
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
+ {"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,8 +1,8 @@
1
1
  import { CodeEditorProps } from "./type.mjs";
2
- import * as react16 from "react";
2
+ import * as react63 from "react";
3
3
 
4
4
  //#region src/CodeEditor/CodeEditor.d.ts
5
- declare const CodeEditor: react16.NamedExoticComponent<CodeEditorProps>;
5
+ declare const CodeEditor: react63.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 useControlledState from "use-merge-value";
9
+ import useMergeState 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] = useControlledState(defaultValue, {
13
+ const [code, setCode] = useMergeState(defaultValue, {
14
14
  defaultValue,
15
15
  onChange: onValueChange,
16
16
  value
@@ -1 +1 @@
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
+ {"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,8 +1,8 @@
1
1
  import { CollapseProps } from "./type.mjs";
2
- import * as react7 from "react";
2
+ import * as react68 from "react";
3
3
 
4
4
  //#region src/Collapse/Collapse.d.ts
5
- declare const Collapse: react7.NamedExoticComponent<CollapseProps>;
5
+ declare const Collapse: react68.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 useControlledState from "use-merge-value";
13
+ import useMergeState 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] = useControlledState(defaultValue, {
21
+ const [active, setActive] = useMergeState(defaultValue, {
22
22
  defaultValue,
23
23
  onChange,
24
24
  value
@@ -1 +1 @@
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,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,aAAaC,mBAAc,cAAc;EACtD;EACA;EACA;EACD,CAAC;CAGF,MAAM,eAAe,eACZ,EACL,yBAAyB,GAAG,KAAK,KAClC,GACD,CAAC,KAAK,CACP;CAED,MAAM,iBAAiB,cACf,UAAU,WAAW,OAAO,gBAAgB,CAAC,OAAO,MAAM,MAAM,EAAE,UAAU,OAAO,EACzF,CAAC,QAAQ,OAAO,CACjB;AAED,QACE,qBAACC;EACC,KAAK;EACL;EACK;EACL,OAAO;GACL,GAAG;GACH,UAAU;GACV,GAAG;GACJ;EACD,GAAI;aAEH,uBACC,OAAO,KAAK,GAAG,MAAM;GACnB,MAAM,QAAQ,EA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4BAAe"}
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,GACD,CAAC,KAAK,CACP;CAED,MAAM,iBAAiB,cACf,UAAU,WAAW,OA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AAa,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 react70 from "react";
4
+ import * as react69 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: react70.NamedExoticComponent<ConfigProviderProps>;
22
+ declare const ConfigProvider: react69.NamedExoticComponent<ConfigProviderProps>;
23
23
  type CdnFn = ({
24
24
  pkg,
25
25
  version,
@@ -1,8 +1,8 @@
1
- import * as react82 from "react";
1
+ import * as react110 from "react";
2
2
  import * as react_jsx_runtime0 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/ContextMenu/ContextMenuHost.d.ts
5
- declare const ContextMenuHost: react82.MemoExoticComponent<() => react_jsx_runtime0.JSX.Element | null>;
5
+ declare const ContextMenuHost: react110.MemoExoticComponent<() => react_jsx_runtime0.JSX.Element | null>;
6
6
  //#endregion
7
7
  export { ContextMenuHost };
8
8
  //# sourceMappingURL=ContextMenuHost.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { CopyButtonProps } from "./type.mjs";
2
- import * as react8 from "react";
2
+ import * as react48 from "react";
3
3
 
4
4
  //#region src/CopyButton/CopyButton.d.ts
5
- declare const CopyButton: react8.NamedExoticComponent<CopyButtonProps>;
5
+ declare const CopyButton: react48.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 react51 from "react";
2
+ import * as react49 from "react";
3
3
 
4
4
  //#region src/DatePicker/DatePicker.d.ts
5
- declare const DatePicker: react51.NamedExoticComponent<DatePickerProps>;
5
+ declare const DatePicker: react49.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 useControlledState from "use-merge-value";
11
+ import useMergeState 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] = useControlledState(defaultExpand, {
60
+ const [isExpand, setIsExpand] = useMergeState(defaultExpand, {
61
61
  onChange: onExpandChange,
62
62
  value: expand
63
63
  });
@@ -1 +1 @@
1
- {"version":3,"file":"DraggablePanel.mjs","names":["defaultSize: Size","Center","Icon"],"sources":["../../src/DraggablePanel/DraggablePanel.tsx"],"sourcesContent":["'use client';\n\nimport { useHover } from 'ahooks';\nimport { ConfigProvider } from 'antd';\nimport { cx } from 'antd-style';\nimport isEqual from 'fast-deep-equal';\nimport { ChevronDown, ChevronLeft, ChevronRight, ChevronUp } from 'lucide-react';\nimport type { Enable, NumberSize, Size } from 're-resizable';\nimport { Resizable } from 're-resizable';\nimport {\n memo,\n use,\n useCallback,\n useEffect,\n useMemo,\n useReducer,\n useRef,\n useTransition,\n} from 'react';\nimport useControlledState from 'use-merge-value';\n\nimport { Center } from '@/Flex';\nimport Icon from '@/Icon';\n\nimport { handleVariants, panelVariants, styles, toggleVariants } from './style';\nimport type { DraggablePanelProps } from './type';\nimport { reversePlacement } from './utils';\n\n// Constants\nconst DEFAULT_HEIGHT = 180;\nconst DEFAULT_WIDTH = 280;\nconst DEFAULT_HEADER_HEIGHT = 0;\nconst DEFAULT_PIN = true;\nconst DEFAULT_MODE = 'fixed';\nconst DEFAULT_EXPANDABLE = true;\nconst DEFAULT_EXPAND = true;\nconst DEFAULT_SHOW_HANDLE_WIDE_AREA = true;\n\n// State reducer for better state management\ninterface DraggablePanelState {\n isResizing: boolean;\n showExpand: boolean;\n}\n\ntype DraggablePanelAction =\n | { type: 'START_RESIZE' }\n | { type: 'STOP_RESIZE' }\n | { payload: boolean; type: 'SET_SHOW_EXPAND' };\n\nfunction draggablePanelReducer(\n state: DraggablePanelState,\n action: DraggablePanelAction,\n): DraggablePanelState {\n switch (action.type) {\n case 'START_RESIZE': {\n return { ...state, isResizing: true, showExpand: false };\n }\n case 'STOP_RESIZE': {\n return { ...state, isResizing: false, showExpand: true };\n }\n case 'SET_SHOW_EXPAND': {\n return { ...state, showExpand: action.payload };\n }\n default: {\n return state;\n }\n }\n}\n\nconst DraggablePanel = memo<DraggablePanelProps>(\n ({\n headerHeight = DEFAULT_HEADER_HEIGHT,\n fullscreen,\n maxHeight,\n pin = DEFAULT_PIN,\n mode = DEFAULT_MODE,\n children,\n placement = 'right',\n resize,\n style,\n showBorder = true,\n showHandleHighlight = false,\n showHandleWideArea = DEFAULT_SHOW_HANDLE_WIDE_AREA,\n backgroundColor,\n size,\n defaultSize: customizeDefaultSize,\n minWidth,\n minHeight,\n maxWidth,\n onSizeChange,\n onSizeDragging,\n expandable = DEFAULT_EXPANDABLE,\n expand,\n defaultExpand = DEFAULT_EXPAND,\n onExpandChange,\n className,\n showHandleWhenCollapsed,\n destroyOnClose,\n styles: customStyles,\n classNames,\n dir,\n }) => {\n const ref = useRef<HTMLDivElement>(null);\n const isHovering = useHover(ref);\n const isVertical = placement === 'top' || placement === 'bottom';\n const [isPending, startTransition] = useTransition();\n\n // Use ref for hover timeout to avoid memory leaks\n const hoverTimeoutRef = useRef<any>(undefined);\n\n // inherit direction from Ant Design ConfigProvider\n const { direction: antdDirection } = use(ConfigProvider.ConfigContext);\n const direction = dir ?? antdDirection;\n\n // Handle RTL direction\n const internalPlacement = useMemo(() => {\n return direction === 'rtl' && ['left', 'right'].includes(placement)\n ? placement === 'left'\n ? 'right'\n : 'left'\n : placement;\n }, [direction, placement]);\n\n const cssVariables = useMemo<Record<string, string>>(\n () => ({\n '--draggable-panel-bg': backgroundColor || '',\n '--draggable-panel-header-height': `${headerHeight}px`,\n }),\n [backgroundColor, headerHeight],\n );\n\n const [isExpand, setIsExpand] = useControlledState(defaultExpand, {\n onChange: onExpandChange,\n value: expand,\n });\n\n // Initialize state with useReducer for better performance\n const initialState: DraggablePanelState = {\n isResizing: false,\n showExpand: true,\n };\n\n const [state, dispatch] = useReducer(draggablePanelReducer, initialState);\n\n // Auto-expand on hover if not pinned with optimized transition\n useEffect(() => {\n if (pin) return;\n\n // Clear previous timeout\n if (hoverTimeoutRef.current) {\n clearTimeout(hoverTimeoutRef.current);\n }\n\n if (isHovering && !isExpand) {\n startTransition(() => {\n setIsExpand(true);\n });\n } else if (!isHovering && isExpand) {\n // Add a small delay before collapsing to prevent flickering\n hoverTimeoutRef.current = setTimeout(() => {\n startTransition(() => {\n setIsExpand(false);\n });\n }, 150);\n }\n }, [pin, isHovering, isExpand, setIsExpand]);\n\n // Cleanup timeout on unmount\n useEffect(() => {\n return () => {\n if (hoverTimeoutRef.current) {\n clearTimeout(hoverTimeoutRef.current);\n }\n };\n }, []);\n\n const canResizing = resize !== false && isExpand;\n\n // Configure resizing handles\n const resizing = useMemo(\n () => ({\n bottom: false,\n bottomLeft: false,\n bottomRight: false,\n left: false,\n right: false,\n top: false,\n topLeft: false,\n topRight: false,\n [reversePlacement(internalPlacement)]: true,\n ...(resize as Enable),\n }),\n [internalPlacement, resize],\n );\n\n // Calculate default size based on orientation\n const defaultSize: Size = useMemo(() => {\n if (isVertical)\n return {\n height: DEFAULT_HEIGHT,\n width: '100%',\n ...customizeDefaultSize,\n };\n\n return {\n height: '100%',\n width: DEFAULT_WIDTH,\n ...customizeDefaultSize,\n };\n }, [isVertical, customizeDefaultSize]);\n\n // Determine appropriate size props based on expand state\n const sizeProps = useMemo(() => {\n if (!isExpand) {\n return isVertical\n ? { minHeight: 0, size: { height: 0 } }\n : { minWidth: 0, size: { width: 0 } };\n }\n\n return {\n defaultSize,\n maxHeight: typeof maxHeight === 'number' ? Math.max(maxHeight, 0) : maxHeight,\n maxWidth: typeof maxWidth === 'number' ? Math.max(maxWidth, 0) : maxWidth,\n minHeight: typeof minHeight === 'number' ? Math.max(minHeight, 0) : minHeight,\n minWidth: typeof minWidth === 'number' ? Math.max(minWidth, 0) : minWidth,\n size: size as Size,\n };\n }, [isExpand, isVertical, defaultSize, maxHeight, maxWidth, minHeight, minWidth, size]);\n\n // Determine the appropriate arrow icon based on placement\n const Arrow = useMemo(() => {\n switch (internalPlacement) {\n case 'top': {\n return ChevronDown;\n }\n case 'bottom': {\n return ChevronUp;\n }\n case 'right': {\n return ChevronLeft;\n }\n case 'left': {\n return ChevronRight;\n }\n default: {\n return ChevronLeft;\n }\n }\n }, [internalPlacement]);\n\n // Toggle expand state with transition for better performance\n const toggleExpand = useCallback(() => {\n if (!expandable) return;\n\n startTransition(() => {\n setIsExpand(!isExpand);\n });\n }, [expandable, isExpand, setIsExpand]);\n\n // Toggle handle component\n const handle = useMemo(\n () => (\n <Center\n className={toggleVariants({ placement: internalPlacement, showHandleWideArea })}\n style={{ opacity: isExpand ? (pin ? undefined : 0) : showHandleWhenCollapsed ? 1 : 0 }}\n >\n <Center\n className={classNames?.handle}\n onClick={toggleExpand}\n style={customStyles?.handle}\n >\n <Icon\n className={styles.handlerIcon}\n icon={Arrow}\n size={16}\n style={{\n marginBottom: internalPlacement === 'top' ? 4 : 0,\n marginLeft: internalPlacement === 'right' ? 4 : 0,\n marginRight: internalPlacement === 'left' ? 4 : 0,\n marginTop: internalPlacement === 'bottom' ? 4 : 0,\n transform: `rotate(${isExpand ? 180 : 0}deg)`,\n transition: 'transform 0.3s ease',\n }}\n />\n </Center>\n </Center>\n ),\n [\n toggleVariants,\n internalPlacement,\n isExpand,\n pin,\n showHandleWhenCollapsed,\n classNames?.handle,\n toggleExpand,\n customStyles?.handle,\n styles.handlerIcon,\n Arrow,\n ],\n );\n\n // Handle resize events with memoization\n const handleResize = useCallback(\n (_: unknown, _direction: unknown, reference_: HTMLElement, delta: NumberSize) => {\n onSizeDragging?.(delta, {\n height: reference_.style.height,\n width: reference_.style.width,\n });\n },\n [onSizeDragging],\n );\n\n const handleResizeStart = useCallback(() => {\n dispatch({ type: 'START_RESIZE' });\n }, []);\n\n const handleResizeStop = useCallback(\n (e: unknown, direction: unknown, reference_: HTMLElement, delta: NumberSize) => {\n dispatch({ type: 'STOP_RESIZE' });\n onSizeChange?.(delta, {\n height: reference_.style.height,\n width: reference_.style.width,\n });\n },\n [onSizeChange],\n );\n\n // Main panel content\n const inner = useMemo(\n () => (\n <Resizable\n {...sizeProps}\n className={cx(styles.panel, classNames?.content)}\n enable={canResizing ? (resizing as Enable) : undefined}\n handleClasses={\n canResizing\n ? {\n [reversePlacement(internalPlacement)]: cx(\n handleVariants({\n placement: reversePlacement(internalPlacement),\n }),\n showHandleHighlight && styles.handleHighlight,\n ),\n }\n : {}\n }\n onResize={handleResize}\n onResizeStart={handleResizeStart}\n onResizeStop={handleResizeStop}\n style={{\n ...cssVariables,\n opacity: isPending ? 0.95 : 1,\n transition: state.isResizing ? 'unset' : undefined,\n ...style,\n }}\n >\n {children}\n </Resizable>\n ),\n [\n sizeProps,\n styles.panel,\n classNames?.content,\n canResizing,\n resizing,\n internalPlacement,\n handleVariants,\n showHandleHighlight,\n styles.handleHighlight,\n handleResize,\n handleResizeStart,\n handleResizeStop,\n state.isResizing,\n isPending,\n style,\n children,\n cx,\n ],\n );\n\n // For fullscreen mode, return a simpler layout\n if (fullscreen) {\n return (\n <div className={cx(styles.fullscreen, className)} style={cssVariables}>\n {children}\n </div>\n );\n }\n\n return (\n <aside\n className={cx(\n panelVariants({\n isExpand,\n mode,\n placement: internalPlacement,\n showBorder,\n }),\n className,\n )}\n dir={dir}\n ref={ref}\n style={cssVariables}\n >\n {expandable && state.showExpand && handle}\n {destroyOnClose ? isExpand && inner : inner}\n </aside>\n );\n },\n isEqual,\n);\n\nDraggablePanel.displayName = 'DraggablePanel';\n\nexport default DraggablePanel;\n"],"mappings":";;;;;;;;;;;;;;;;;AA6BA,MAAM,iBAAiB;AACvB,MAAM,gBAAgB;AACtB,MAAM,wBAAwB;AAC9B,MAAM,cAAc;AACpB,MAAM,eAAe;AACrB,MAAM,qBAAqB;AAC3B,MAAM,iBAAiB;AACvB,MAAM,gCAAgC;AAatC,SAAS,sBACP,OACA,QACqB;AACrB,SAAQ,OAAO,MAAf;EACE,KAAK,eACH,QAAO;GAAE,GAAG;GAAO,YAAY;GAAM,YAAY;GAAO;EAE1D,KAAK,cACH,QAAO;GAAE,GAAG;GAAO,YAAY;GAAO,YAAY;GAAM;EAE1D,KAAK,kBACH,QAAO;GAAE,GAAG;GAAO,YAAY,OAAO;GAAS;EAEjD,QACE,QAAO;;;AAKb,MAAM,iBAAiB,MACpB,EACC,eAAe,uBACf,YACA,WACA,MAAM,aACN,OAAO,cACP,UACA,YAAY,SACZ,QACA,OACA,aAAa,MACb,sBAAsB,OACtB,qBAAqB,+BACrB,iBACA,MACA,aAAa,sBACb,UACA,WACA,UACA,cACA,gBACA,aAAa,oBACb,QACA,gBAAgB,gBAChB,gBACA,WACA,yBACA,gBACA,QAAQ,cAC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ACA,OAAO;EACP;EACA;EACA;EACA,MAAM;EACN;EACA;EACA;EACA;EACD,CACF;AAGD,KAAI,WACF,QACE,oBAAC;EAAI,WAAW,GAAG,OAAO,YAAY,UAAU;EAAE,OAAO;EACtD;GACG;AAIV,QACE,qBAAC;EACC,WAAW,GACT,cAAc;GACZ;GACA;GACA,WAAW;GACX;GACD,CAAC,EACF,UACD;EACI;EACA;EACL,OAAO;aAEN,cAAc,MAAM,cAAc,QAClC,iBAAiB,YAAY,QAAQ;GAChC;GAGZ,QACD;AAED,eAAe,cAAc;AAE7B,6BAAe"}
1
+ {"version":3,"file":"DraggablePanel.mjs","names":["useControlledState","defaultSize: Size","Center","Icon"],"sources":["../../src/DraggablePanel/DraggablePanel.tsx"],"sourcesContent":["'use client';\n\nimport { useHover } from 'ahooks';\nimport { ConfigProvider } from 'antd';\nimport { cx } from 'antd-style';\nimport isEqual from 'fast-deep-equal';\nimport { ChevronDown, ChevronLeft, ChevronRight, ChevronUp } from 'lucide-react';\nimport type { Enable, NumberSize, Size } from 're-resizable';\nimport { Resizable } from 're-resizable';\nimport {\n memo,\n use,\n useCallback,\n useEffect,\n useMemo,\n useReducer,\n useRef,\n useTransition,\n} from 'react';\nimport useControlledState from 'use-merge-value';\n\nimport { Center } from '@/Flex';\nimport Icon from '@/Icon';\n\nimport { handleVariants, panelVariants, styles, toggleVariants } from './style';\nimport type { DraggablePanelProps } from './type';\nimport { reversePlacement } from './utils';\n\n// Constants\nconst DEFAULT_HEIGHT = 180;\nconst DEFAULT_WIDTH = 280;\nconst DEFAULT_HEADER_HEIGHT = 0;\nconst DEFAULT_PIN = true;\nconst DEFAULT_MODE = 'fixed';\nconst DEFAULT_EXPANDABLE = true;\nconst DEFAULT_EXPAND = true;\nconst DEFAULT_SHOW_HANDLE_WIDE_AREA = true;\n\n// State reducer for better state management\ninterface DraggablePanelState {\n isResizing: boolean;\n showExpand: boolean;\n}\n\ntype DraggablePanelAction =\n | { type: 'START_RESIZE' }\n | { type: 'STOP_RESIZE' }\n | { payload: boolean; type: 'SET_SHOW_EXPAND' };\n\nfunction draggablePanelReducer(\n state: DraggablePanelState,\n action: DraggablePanelAction,\n): DraggablePanelState {\n switch (action.type) {\n case 'START_RESIZE': {\n return { ...state, isResizing: true, showExpand: false };\n }\n case 'STOP_RESIZE': {\n return { ...state, isResizing: false, showExpand: true };\n }\n case 'SET_SHOW_EXPAND': {\n return { ...state, showExpand: action.payload };\n }\n default: {\n return state;\n }\n }\n}\n\nconst DraggablePanel = memo<DraggablePanelProps>(\n ({\n headerHeight = DEFAULT_HEADER_HEIGHT,\n fullscreen,\n maxHeight,\n pin = DEFAULT_PIN,\n mode = DEFAULT_MODE,\n children,\n placement = 'right',\n resize,\n style,\n showBorder = true,\n showHandleHighlight = false,\n showHandleWideArea = DEFAULT_SHOW_HANDLE_WIDE_AREA,\n backgroundColor,\n size,\n defaultSize: customizeDefaultSize,\n minWidth,\n minHeight,\n maxWidth,\n onSizeChange,\n onSizeDragging,\n expandable = DEFAULT_EXPANDABLE,\n expand,\n defaultExpand = DEFAULT_EXPAND,\n onExpandChange,\n className,\n showHandleWhenCollapsed,\n destroyOnClose,\n styles: customStyles,\n classNames,\n dir,\n }) => {\n const ref = useRef<HTMLDivElement>(null);\n const isHovering = useHover(ref);\n const isVertical = placement === 'top' || placement === 'bottom';\n const [isPending, startTransition] = useTransition();\n\n // Use ref for hover timeout to avoid memory leaks\n const hoverTimeoutRef = useRef<any>(undefined);\n\n // inherit direction from Ant Design ConfigProvider\n const { direction: antdDirection } = use(ConfigProvider.ConfigContext);\n const direction = dir ?? antdDirection;\n\n // Handle RTL direction\n const internalPlacement = useMemo(() => {\n return direction === 'rtl' && ['left', 'right'].includes(placement)\n ? placement === 'left'\n ? 'right'\n : 'left'\n : placement;\n }, [direction, placement]);\n\n const cssVariables = useMemo<Record<string, string>>(\n () => ({\n '--draggable-panel-bg': backgroundColor || '',\n '--draggable-panel-header-height': `${headerHeight}px`,\n }),\n [backgroundColor, headerHeight],\n );\n\n const [isExpand, setIsExpand] = useControlledState(defaultExpand, {\n onChange: onExpandChange,\n value: expand,\n });\n\n // Initialize state with useReducer for better performance\n const initialState: DraggablePanelState = {\n isResizing: false,\n showExpand: true,\n };\n\n const [state, dispatch] = useReducer(draggablePanelReducer, initialState);\n\n // Auto-expand on hover if not pinned with optimized transition\n useEffect(() => {\n if (pin) return;\n\n // Clear previous timeout\n if (hoverTimeoutRef.current) {\n clearTimeout(hoverTimeoutRef.current);\n }\n\n if (isHovering && !isExpand) {\n startTransition(() => {\n setIsExpand(true);\n });\n } else if (!isHovering && isExpand) {\n // Add a small delay before collapsing to prevent flickering\n hoverTimeoutRef.current = setTimeout(() => {\n startTransition(() => {\n setIsExpand(false);\n });\n }, 150);\n }\n }, [pin, isHovering, isExpand, setIsExpand]);\n\n // Cleanup timeout on unmount\n useEffect(() => {\n return () => {\n if (hoverTimeoutRef.current) {\n clearTimeout(hoverTimeoutRef.current);\n }\n };\n }, []);\n\n const canResizing = resize !== false && isExpand;\n\n // Configure resizing handles\n const resizing = useMemo(\n () => ({\n bottom: false,\n bottomLeft: false,\n bottomRight: false,\n left: false,\n right: false,\n top: false,\n topLeft: false,\n topRight: false,\n [reversePlacement(internalPlacement)]: true,\n ...(resize as Enable),\n }),\n [internalPlacement, resize],\n );\n\n // Calculate default size based on orientation\n const defaultSize: Size = useMemo(() => {\n if (isVertical)\n return {\n height: DEFAULT_HEIGHT,\n width: '100%',\n ...customizeDefaultSize,\n };\n\n return {\n height: '100%',\n width: DEFAULT_WIDTH,\n ...customizeDefaultSize,\n };\n }, [isVertical, customizeDefaultSize]);\n\n // Determine appropriate size props based on expand state\n const sizeProps = useMemo(() => {\n if (!isExpand) {\n return isVertical\n ? { minHeight: 0, size: { height: 0 } }\n : { minWidth: 0, size: { width: 0 } };\n }\n\n return {\n defaultSize,\n maxHeight: typeof maxHeight === 'number' ? Math.max(maxHeight, 0) : maxHeight,\n maxWidth: typeof maxWidth === 'number' ? Math.max(maxWidth, 0) : maxWidth,\n minHeight: typeof minHeight === 'number' ? Math.max(minHeight, 0) : minHeight,\n minWidth: typeof minWidth === 'number' ? Math.max(minWidth, 0) : minWidth,\n size: size as Size,\n };\n }, [isExpand, isVertical, defaultSize, maxHeight, maxWidth, minHeight, minWidth, size]);\n\n // Determine the appropriate arrow icon based on placement\n const Arrow = useMemo(() => {\n switch (internalPlacement) {\n case 'top': {\n return ChevronDown;\n }\n case 'bottom': {\n return ChevronUp;\n }\n case 'right': {\n return ChevronLeft;\n }\n case 'left': {\n return ChevronRight;\n }\n default: {\n return ChevronLeft;\n }\n }\n }, [internalPlacement]);\n\n // Toggle expand state with transition for better performance\n const toggleExpand = useCallback(() => {\n if (!expandable) return;\n\n startTransition(() => {\n setIsExpand(!isExpand);\n });\n }, [expandable, isExpand, setIsExpand]);\n\n // Toggle handle component\n const handle = useMemo(\n () => (\n <Center\n className={toggleVariants({ placement: internalPlacement, showHandleWideArea })}\n style={{ opacity: isExpand ? (pin ? undefined : 0) : showHandleWhenCollapsed ? 1 : 0 }}\n >\n <Center\n className={classNames?.handle}\n onClick={toggleExpand}\n style={customStyles?.handle}\n >\n <Icon\n className={styles.handlerIcon}\n icon={Arrow}\n size={16}\n style={{\n marginBottom: internalPlacement === 'top' ? 4 : 0,\n marginLeft: internalPlacement === 'right' ? 4 : 0,\n marginRight: internalPlacement === 'left' ? 4 : 0,\n marginTop: internalPlacement === 'bottom' ? 4 : 0,\n transform: `rotate(${isExpand ? 180 : 0}deg)`,\n transition: 'transform 0.3s ease',\n }}\n />\n </Center>\n </Center>\n ),\n [\n toggleVariants,\n internalPlacement,\n isExpand,\n pin,\n showHandleWhenCollapsed,\n classNames?.handle,\n toggleExpand,\n customStyles?.handle,\n styles.handlerIcon,\n Arrow,\n ],\n );\n\n // Handle resize events with memoization\n const handleResize = useCallback(\n (_: unknown, _direction: unknown, reference_: HTMLElement, delta: NumberSize) => {\n onSizeDragging?.(delta, {\n height: reference_.style.height,\n width: reference_.style.width,\n });\n },\n [onSizeDragging],\n );\n\n const handleResizeStart = useCallback(() => {\n dispatch({ type: 'START_RESIZE' });\n }, []);\n\n const handleResizeStop = useCallback(\n (e: unknown, direction: unknown, reference_: HTMLElement, delta: NumberSize) => {\n dispatch({ type: 'STOP_RESIZE' });\n onSizeChange?.(delta, {\n height: reference_.style.height,\n width: reference_.style.width,\n });\n },\n [onSizeChange],\n );\n\n // Main panel content\n const inner = useMemo(\n () => (\n <Resizable\n {...sizeProps}\n className={cx(styles.panel, classNames?.content)}\n enable={canResizing ? (resizing as Enable) : undefined}\n handleClasses={\n canResizing\n ? {\n [reversePlacement(internalPlacement)]: cx(\n handleVariants({\n placement: reversePlacement(internalPlacement),\n }),\n showHandleHighlight && styles.handleHighlight,\n ),\n }\n : {}\n }\n onResize={handleResize}\n onResizeStart={handleResizeStart}\n onResizeStop={handleResizeStop}\n style={{\n ...cssVariables,\n opacity: isPending ? 0.95 : 1,\n transition: state.isResizing ? 'unset' : undefined,\n ...style,\n }}\n >\n {children}\n </Resizable>\n ),\n [\n sizeProps,\n styles.panel,\n classNames?.content,\n canResizing,\n resizing,\n internalPlacement,\n handleVariants,\n showHandleHighlight,\n styles.handleHighlight,\n handleResize,\n handleResizeStart,\n handleResizeStop,\n state.isResizing,\n isPending,\n style,\n children,\n cx,\n ],\n );\n\n // For fullscreen mode, return a simpler layout\n if (fullscreen) {\n return (\n <div className={cx(styles.fullscreen, className)} style={cssVariables}>\n {children}\n </div>\n );\n }\n\n return (\n <aside\n className={cx(\n panelVariants({\n isExpand,\n mode,\n placement: internalPlacement,\n showBorder,\n }),\n className,\n )}\n dir={dir}\n ref={ref}\n style={cssVariables}\n >\n {expandable && state.showExpand && handle}\n {destroyOnClose ? isExpand && inner : inner}\n </aside>\n );\n },\n isEqual,\n);\n\nDraggablePanel.displayName = 'DraggablePanel';\n\nexport default DraggablePanel;\n"],"mappings":";;;;;;;;;;;;;;;;;AA6BA,MAAM,iBAAiB;AACvB,MAAM,gBAAgB;AACtB,M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mBAAmB,aACtB,GAAY,aAAoB,YAAyB,UAAsB;AAC9E,WAAS,EAAE,MAAM,eAAe,CAAC;AACjC,iBAAe,OAAO;GACpB,QAAQ,WAAW,MAAM;GACzB,OAAO,WAAW,MAAM;GACzB,CAAC;IAEJ,CAAC,aAAa,CACf;CAGD,MAAM,QAAQ,cAEV,oBAAC;EACC,GAAI;EACJ,WAAW,GAAG,OAAO,OAAO,YAAY,QAAQ;EAChD,QAAQ,cAAe,WAAsB;EAC7C,eACE,cACI,GACG,iBAAiB,kBAAkB,GAAG,GACrC,eAAe,EACb,WAAW,iBAAiB,kBAAkB,EAC/C,CAAC,EACF,uBAAuB,OAAO,gBAC/B,EACF,GACD,EAAE;EAER,UAAU;EACV,eAAe;EACf,cAAc;EACd,OAAO;GACL,GAAG;GACH,SAAS,YAAY,MAAO;GAC5B,YAAY,MAAM,aAAa,UAAU;GACzC,GAAG;GACJ;EAEA;GACS,EAEd;EACE;EACA,OAAO;EACP,YAAY;EACZ;EACA;EACA;EACA;EACA;EACA,OAAO;EACP;EACA;EACA;EACA,MAAM;EACN;EACA;EACA;EACA;EACD,CACF;AAGD,KAAI,WACF,QACE,oBAAC;EAAI,WAAW,GAAG,OAAO,YAAY,UAAU;EAAE,OAAO;EACtD;GACG;AAIV,QACE,qBAAC;EACC,WAAW,GACT,cAAc;GACZ;GACA;GACA,WAAW;GACX;GACD,CAAC,EACF,UACD;EACI;EACA;EACL,OAAO;aAEN,cAAc,MAAM,cAAc,QAClC,iBAAiB,YAAY,QAAQ;GAChC;GAGZ,QACD;AAED,eAAe,cAAc;AAE7B,6BAAe"}
@@ -1,9 +1,9 @@
1
1
  import { DivProps } from "../../types/index.mjs";
2
- import * as react21 from "react";
2
+ import * as react44 from "react";
3
3
 
4
4
  //#region src/DraggablePanel/components/DraggablePanelBody.d.ts
5
5
  type DraggablePanelBodyProps = DivProps;
6
- declare const DraggablePanelBody: react21.NamedExoticComponent<DivProps>;
6
+ declare const DraggablePanelBody: react44.NamedExoticComponent<DivProps>;
7
7
  //#endregion
8
8
  export { DraggablePanelBody, DraggablePanelBodyProps };
9
9
  //# sourceMappingURL=DraggablePanelBody.d.mts.map