@lobehub/ui 4.32.2 → 4.33.1

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 (201) 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/CodeDiff/CodeDiff.d.mts +2 -2
  17. package/es/CodeDiff/PatchDiff.d.mts +2 -2
  18. package/es/CodeEditor/CodeEditor.d.mts +2 -2
  19. package/es/CodeEditor/CodeEditor.mjs +2 -2
  20. package/es/CodeEditor/CodeEditor.mjs.map +1 -1
  21. package/es/Collapse/Collapse.d.mts +2 -2
  22. package/es/ColorSwatches/ColorSwatches.mjs +2 -2
  23. package/es/ColorSwatches/ColorSwatches.mjs.map +1 -1
  24. package/es/ConfigProvider/index.d.mts +2 -2
  25. package/es/ContextMenu/ContextMenuHost.d.mts +3 -3
  26. package/es/ContextMenu/renderItems.mjs +1 -0
  27. package/es/ContextMenu/renderItems.mjs.map +1 -1
  28. package/es/CopyButton/CopyButton.d.mts +2 -2
  29. package/es/DatePicker/DatePicker.d.mts +2 -2
  30. package/es/DraggablePanel/DraggablePanel.mjs +2 -2
  31. package/es/DraggablePanel/DraggablePanel.mjs.map +1 -1
  32. package/es/DraggablePanel/components/DraggablePanelBody.d.mts +2 -2
  33. package/es/DraggablePanel/components/DraggablePanelContainer.d.mts +2 -2
  34. package/es/DraggablePanel/components/DraggablePanelFooter.d.mts +2 -2
  35. package/es/DraggablePanel/components/DraggablePanelHeader.d.mts +2 -2
  36. package/es/DraggablePanel/components/DraggablePanelHeader.mjs +2 -2
  37. package/es/DraggablePanel/components/DraggablePanelHeader.mjs.map +1 -1
  38. package/es/DraggableSideNav/DraggableSideNav.d.mts +2 -2
  39. package/es/DraggableSideNav/DraggableSideNav.mjs +2 -2
  40. package/es/DraggableSideNav/DraggableSideNav.mjs.map +1 -1
  41. package/es/Drawer/Drawer.d.mts +2 -2
  42. package/es/Dropdown/Dropdown.d.mts +2 -2
  43. package/es/DropdownMenu/DropdownMenu.d.mts +2 -2
  44. package/es/DropdownMenu/atoms.d.mts +16 -16
  45. package/es/DropdownMenu/renderItems.mjs +1 -0
  46. package/es/DropdownMenu/renderItems.mjs.map +1 -1
  47. package/es/EditableText/EditableText.d.mts +2 -2
  48. package/es/EditableText/EditableText.mjs +2 -2
  49. package/es/EditableText/EditableText.mjs.map +1 -1
  50. package/es/EditorSlashMenu/atoms.d.mts +12 -12
  51. package/es/EmojiPicker/EmojiPicker.d.mts +2 -2
  52. package/es/EmojiPicker/EmojiPicker.mjs +3 -3
  53. package/es/EmojiPicker/EmojiPicker.mjs.map +1 -1
  54. package/es/Flex/FlexBasic.d.mts +2 -2
  55. package/es/FontLoader/index.d.mts +2 -2
  56. package/es/Footer/Footer.d.mts +2 -2
  57. package/es/Form/components/FormGroup.d.mts +2 -2
  58. package/es/Form/components/FormItem.d.mts +2 -2
  59. package/es/Form/components/FormSubmitFooter.d.mts +2 -2
  60. package/es/FormModal/FormModal.d.mts +2 -2
  61. package/es/GuideCard/GuideCard.d.mts +2 -2
  62. package/es/Header/Header.d.mts +2 -2
  63. package/es/Highlighter/FullFeatured.mjs +1 -1
  64. package/es/Highlighter/Highlighter.d.mts +2 -2
  65. package/es/Highlighter/SyntaxHighlighter/index.d.mts +2 -2
  66. package/es/Highlighter/SyntaxHighlighter/style.mjs +4 -2
  67. package/es/Highlighter/SyntaxHighlighter/style.mjs.map +1 -1
  68. package/es/Hotkey/Hotkey.d.mts +2 -2
  69. package/es/Hotkey/Hotkey.mjs +6 -1
  70. package/es/Hotkey/Hotkey.mjs.map +1 -1
  71. package/es/Hotkey/const.d.mts +1 -0
  72. package/es/Hotkey/const.mjs +1 -0
  73. package/es/Hotkey/const.mjs.map +1 -1
  74. package/es/Hotkey/utils.mjs +1 -0
  75. package/es/Hotkey/utils.mjs.map +1 -1
  76. package/es/HotkeyInput/HotkeyInput.d.mts +2 -2
  77. package/es/HotkeyInput/HotkeyInput.mjs +2 -2
  78. package/es/HotkeyInput/HotkeyInput.mjs.map +1 -1
  79. package/es/Icon/Icon.d.mts +2 -2
  80. package/es/Icon/components/IconProvider.d.mts +3 -3
  81. package/es/Image/PreviewGroup.d.mts +2 -2
  82. package/es/ImageSelect/ImageSelect.d.mts +2 -2
  83. package/es/ImageSelect/ImageSelect.mjs +2 -2
  84. package/es/ImageSelect/ImageSelect.mjs.map +1 -1
  85. package/es/Input/Input.d.mts +2 -2
  86. package/es/Input/InputNumber.d.mts +2 -2
  87. package/es/Input/InputOPT.d.mts +2 -2
  88. package/es/Input/InputPassword.d.mts +2 -2
  89. package/es/Input/TextArea.d.mts +2 -2
  90. package/es/Layout/components/LayoutFooter.d.mts +2 -2
  91. package/es/Layout/components/LayoutHeader.d.mts +2 -2
  92. package/es/Layout/components/LayoutMain.d.mts +2 -2
  93. package/es/Layout/components/LayoutSidebar.d.mts +2 -2
  94. package/es/Layout/components/LayoutSidebarInner.d.mts +2 -2
  95. package/es/Layout/components/LayoutToc.d.mts +2 -2
  96. package/es/List/ListItem/index.d.mts +2 -2
  97. package/es/LobeSelect/LobeSelect.d.mts +2 -2
  98. package/es/LobeSelect/atoms.d.mts +19 -19
  99. package/es/LobeSwitch/LobeSwitch.d.mts +2 -2
  100. package/es/LobeSwitch/atoms.mjs +2 -2
  101. package/es/LobeSwitch/atoms.mjs.map +1 -1
  102. package/es/Markdown/Markdown.d.mts +2 -2
  103. package/es/Markdown/Typography.d.mts +2 -2
  104. package/es/Markdown/components/SearchResultCards/index.d.mts +2 -2
  105. package/es/MaskShadow/MaskShadow.d.mts +2 -2
  106. package/es/Menu/Menu.d.mts +2 -2
  107. package/es/Menu/sharedStyle.mjs +5 -0
  108. package/es/Menu/sharedStyle.mjs.map +1 -1
  109. package/es/Mermaid/FullFeatured.mjs +1 -1
  110. package/es/Mermaid/Mermaid.d.mts +2 -2
  111. package/es/Mermaid/SyntaxMermaid/index.d.mts +2 -2
  112. package/es/Modal/Modal.d.mts +2 -2
  113. package/es/Modal/ModalProvider.d.mts +2 -2
  114. package/es/Modal/imperative.d.mts +2 -2
  115. package/es/MotionProvider/index.d.mts +2 -2
  116. package/es/Popover/ArrowIcon.d.mts +2 -2
  117. package/es/Popover/atoms.d.mts +9 -9
  118. package/es/Popover/context.d.mts +2 -2
  119. package/es/ScrollArea/ScrollArea.d.mts +8 -0
  120. package/es/ScrollArea/ScrollArea.mjs +32 -0
  121. package/es/ScrollArea/ScrollArea.mjs.map +1 -0
  122. package/es/ScrollArea/atoms.d.mts +63 -0
  123. package/es/ScrollArea/atoms.mjs +59 -0
  124. package/es/ScrollArea/atoms.mjs.map +1 -0
  125. package/es/ScrollArea/globalStyle.mjs +29 -0
  126. package/es/ScrollArea/globalStyle.mjs.map +1 -0
  127. package/es/ScrollArea/index.d.mts +4 -0
  128. package/es/ScrollArea/index.d.ts +1 -0
  129. package/es/ScrollArea/index.js +1 -0
  130. package/es/ScrollArea/index.mjs +4 -0
  131. package/es/ScrollArea/style.mjs +172 -0
  132. package/es/ScrollArea/style.mjs.map +1 -0
  133. package/es/ScrollArea/type.d.mts +17 -0
  134. package/es/SearchBar/SearchBar.d.mts +2 -2
  135. package/es/SearchBar/SearchBar.mjs +2 -2
  136. package/es/SearchBar/SearchBar.mjs.map +1 -1
  137. package/es/Segmented/Segmented.d.mts +2 -2
  138. package/es/Select/Select.d.mts +2 -2
  139. package/es/SideNav/SideNav.d.mts +2 -2
  140. package/es/SliderWithInput/SliderWithInput.d.mts +2 -2
  141. package/es/SortableList/components/DragHandle.d.mts +2 -2
  142. package/es/SortableList/components/SortableItem.d.mts +2 -2
  143. package/es/ThemeProvider/ThemeProvider.d.mts +2 -2
  144. package/es/Toast/imperative.d.mts +3 -3
  145. package/es/Toc/Toc.d.mts +2 -2
  146. package/es/Toc/TocMobile.mjs +2 -2
  147. package/es/Toc/TocMobile.mjs.map +1 -1
  148. package/es/Video/index.d.mts +2 -2
  149. package/es/awesome/AuroraBackground/AuroraBackground.d.mts +2 -2
  150. package/es/awesome/BottomGradientButton/BottomGradientButton.d.mts +2 -2
  151. package/es/awesome/Features/Features.d.mts +2 -2
  152. package/es/awesome/Giscus/Giscus.d.mts +2 -2
  153. package/es/awesome/GradientButton/GradientButton.d.mts +2 -2
  154. package/es/awesome/GridBackground/GridBackground.d.mts +2 -2
  155. package/es/awesome/GridBackground/GridShowcase.d.mts +2 -2
  156. package/es/awesome/Hero/Hero.d.mts +2 -2
  157. package/es/awesome/Spline/Spine.d.mts +2 -2
  158. package/es/awesome/Spotlight/Spotlight.d.mts +2 -2
  159. package/es/awesome/SpotlightCard/SpotlightCard.d.mts +2 -2
  160. package/es/awesome/TypewriterEffect/TypewriterEffect.d.mts +2 -2
  161. package/es/brand/LobeChat/index.d.mts +2 -2
  162. package/es/brand/LobeHub/index.d.mts +2 -2
  163. package/es/brand/LogoThree/LogoSpline.d.mts +2 -2
  164. package/es/brand/LogoThree/index.d.mts +2 -2
  165. package/es/chat/BackBottom/BackBottom.d.mts +2 -2
  166. package/es/chat/ChatInputArea/components/ChatInputAreaInner.d.mts +2 -2
  167. package/es/chat/ChatItem/ChatItem.d.mts +2 -2
  168. package/es/chat/ChatList/ChatList.d.mts +2 -2
  169. package/es/chat/EditableMessage/EditableMessage.d.mts +2 -2
  170. package/es/chat/EditableMessage/EditableMessage.mjs +3 -3
  171. package/es/chat/EditableMessage/EditableMessage.mjs.map +1 -1
  172. package/es/chat/EditableMessageList/EditableMessageList.d.mts +2 -2
  173. package/es/chat/MessageInput/MessageInput.d.mts +2 -2
  174. package/es/chat/MessageModal/MessageModal.d.mts +2 -2
  175. package/es/chat/MessageModal/MessageModal.mjs +3 -3
  176. package/es/chat/MessageModal/MessageModal.mjs.map +1 -1
  177. package/es/color/ColorScales/index.d.mts +2 -2
  178. package/es/color/CssVar/index.d.mts +2 -2
  179. package/es/i18n/context.d.mts +2 -2
  180. package/es/icons/lucideExtra/BotPromptIcon.d.mts +2 -2
  181. package/es/icons/lucideExtra/CreateBotIcon.d.mts +3 -3
  182. package/es/icons/lucideExtra/DiscordIcon.d.mts +3 -3
  183. package/es/icons/lucideExtra/GlobeOffIcon.d.mts +3 -3
  184. package/es/icons/lucideExtra/GroupBotIcon.d.mts +2 -2
  185. package/es/icons/lucideExtra/GroupBotSquareIcon.d.mts +3 -3
  186. package/es/icons/lucideExtra/LeftClickIcon.d.mts +3 -3
  187. package/es/icons/lucideExtra/LeftDoubleClickIcon.d.mts +3 -3
  188. package/es/icons/lucideExtra/McpIcon.d.mts +2 -2
  189. package/es/icons/lucideExtra/ProviderIcon.d.mts +3 -3
  190. package/es/icons/lucideExtra/RightClickIcon.d.mts +3 -3
  191. package/es/icons/lucideExtra/RightDoubleClickIcon.d.mts +3 -3
  192. package/es/icons/lucideExtra/ShapesUploadIcon.d.mts +3 -3
  193. package/es/icons/lucideExtra/TreeDownRightIcon.d.mts +2 -2
  194. package/es/icons/lucideExtra/TreeUpDownRightIcon.d.mts +3 -3
  195. package/es/index.d.mts +9 -1
  196. package/es/index.mjs +7 -3
  197. package/es/mdx/Mdx/index.d.mts +2 -2
  198. package/es/mobile/TabBar/TabBar.mjs +2 -2
  199. package/es/mobile/TabBar/TabBar.mjs.map +1 -1
  200. package/es/storybook/StoryBook/index.d.mts +2 -2
  201. package/package.json +17 -17
@@ -1,8 +1,8 @@
1
1
  import { AccordionProps } from "./type.mjs";
2
- import * as react79 from "react";
2
+ import * as react76 from "react";
3
3
 
4
4
  //#region src/Accordion/Accordion.d.ts
5
- declare const Accordion: react79.NamedExoticComponent<AccordionProps>;
5
+ declare const Accordion: react76.NamedExoticComponent<AccordionProps>;
6
6
  //#endregion
7
7
  export { Accordion };
8
8
  //# sourceMappingURL=Accordion.d.mts.map
@@ -7,13 +7,13 @@ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
7
7
  import { Divider } from "antd";
8
8
  import { cx } from "antd-style";
9
9
  import { LayoutGroup } from "motion/react";
10
- import useMergeState from "use-merge-value";
10
+ import useControlledState from "use-merge-value";
11
11
 
12
12
  //#region src/Accordion/Accordion.tsx
13
13
  const Accordion = memo(({ children, className: userClassName, style: userStyle, accordion = false, defaultExpandedKeys, expandedKeys: expandedKeysProp, onExpandedChange, variant = "borderless", gap, showDivider = false, disableAnimation = false, hideIndicator = false, indicatorPlacement = "start", keepContentMounted = true, classNames, styles: customStyles, motionProps, ref, ...rest }) => {
14
14
  const validChildren = Children.toArray(children).filter(isValidElement);
15
15
  const allItemKeys = validChildren.map((child, index) => child.props.itemKey || index);
16
- const [expandedKeys, setExpandedKeys] = useMergeState(defaultExpandedKeys ?? allItemKeys, {
16
+ const [expandedKeys, setExpandedKeys] = useControlledState(defaultExpandedKeys ?? allItemKeys, {
17
17
  onChange: onExpandedChange,
18
18
  value: expandedKeysProp
19
19
  });
@@ -1 +1 @@
1
- {"version":3,"file":"Accordion.mjs","names":["newKeys: Key[]"],"sources":["../../src/Accordion/Accordion.tsx"],"sourcesContent":["'use client';\n\nimport { Divider } from 'antd';\nimport { cx } from 'antd-style';\nimport { LayoutGroup } from 'motion/react';\nimport { Children, Fragment, isValidElement, memo, useCallback } from 'react';\nimport type { Key } from 'react';\nimport useMergeState from 'use-merge-value';\n\nimport { AccordionContext } from './context';\nimport { styles } from './style';\nimport type { AccordionProps } from './type';\n\nconst Accordion = memo<AccordionProps>(\n ({\n children,\n className: userClassName,\n style: userStyle,\n accordion = false,\n defaultExpandedKeys,\n expandedKeys: expandedKeysProp,\n onExpandedChange,\n variant = 'borderless',\n gap,\n showDivider = false,\n disableAnimation = false,\n hideIndicator = false,\n indicatorPlacement = 'start',\n keepContentMounted = true,\n classNames,\n styles: customStyles,\n motionProps,\n ref,\n ...rest\n }) => {\n // Convert children to array and filter valid elements\n const validChildren = Children.toArray(children).filter(isValidElement);\n\n // Collect all item keys\n const allItemKeys = validChildren.map((child, index) => (child.props as any).itemKey || index);\n\n // If defaultExpandedKeys or expandedKeys is undefined, expand all items by default\n const initialExpandedKeys = defaultExpandedKeys ?? allItemKeys;\n\n const [expandedKeys, setExpandedKeys] = useMergeState<Key[]>(initialExpandedKeys, {\n onChange: onExpandedChange,\n value: expandedKeysProp,\n });\n\n const toggleExpand = useCallback(\n (key: Key) => {\n const prev = expandedKeys;\n let newKeys: Key[];\n\n if (accordion) {\n newKeys = prev.includes(key) ? [] : [key];\n } else {\n newKeys = prev.includes(key) ? prev.filter((k: Key) => k !== key) : [...prev, key];\n }\n\n setExpandedKeys(newKeys);\n },\n [accordion, expandedKeys, setExpandedKeys],\n );\n\n const isExpanded = useCallback(\n (key: Key) => {\n return expandedKeys.includes(key);\n },\n [expandedKeys],\n );\n\n const contextValue = {\n disableAnimation,\n expandedKeys,\n hideIndicator,\n indicatorPlacement,\n isExpanded,\n keepContentMounted,\n motionProps,\n onToggle: toggleExpand,\n showDivider,\n variant,\n };\n\n const content = (\n <>\n {validChildren.map((child, index) => {\n // Extract itemKey from child props to use as React key\n const childKey = (child.props as any).itemKey || index;\n return (\n <Fragment key={childKey}>\n {child}\n {showDivider && index < validChildren.length - 1 && (\n <Divider className={styles.divider} />\n )}\n </Fragment>\n );\n })}\n </>\n );\n\n return (\n <AccordionContext.Provider value={contextValue}>\n <div\n className={cx(styles.base, classNames?.base, userClassName)}\n ref={ref}\n style={{\n gap: gap,\n ...customStyles?.base,\n ...userStyle,\n }}\n {...rest}\n >\n {disableAnimation ? content : <LayoutGroup>{content}</LayoutGroup>}\n </div>\n </AccordionContext.Provider>\n );\n },\n);\n\nAccordion.displayName = 'Accordion';\n\nexport default Accordion;\n"],"mappings":";;;;;;;;;;;;AAaA,MAAM,YAAY,MACf,EACC,UACA,WAAW,eACX,OAAO,WACP,YAAY,OACZ,qBACA,cAAc,kBACd,kBACA,UAAU,cACV,KACA,cAAc,OACd,mBAAmB,OACnB,gBAAgB,OAChB,qBAAqB,SACrB,qBAAqB,MACrB,YACA,QAAQ,cACR,aACA,KACA,GAAG,WACC;CAEJ,MAAM,gBAAgB,SAAS,QAAQ,SAAS,CAAC,OAAO,eAAe;CAGvE,MAAM,cAAc,cAAc,KAAK,OAAO,UAAW,MAAM,MAAc,WAAW,MAAM;CAK9F,MAAM,CAAC,cAAc,mBAAmB,cAFZ,uBAAuB,aAE+B;EAChF,UAAU;EACV,OAAO;EACR,CAAC;CAEF,MAAM,eAAe,aAClB,QAAa;EACZ,MAAM,OAAO;EACb,IAAIA;AAEJ,MAAI,UACF,WAAU,KAAK,SAAS,IAAI,GAAG,EAAE,GAAG,CAAC,IAAI;MAEzC,WAAU,KAAK,SAAS,IAAI,GAAG,KAAK,QAAQ,MAAW,MAAM,IAAI,GAAG,CAAC,GAAG,MAAM,IAAI;AAGpF,kBAAgB,QAAQ;IAE1B;EAAC;EAAW;EAAc;EAAgB,CAC3C;CASD,MAAM,eAAe;EACnB;EACA;EACA;EACA;EACA,YAZiB,aAChB,QAAa;AACZ,UAAO,aAAa,SAAS,IAAI;KAEnC,CAAC,aAAa,CACf;EAQC;EACA;EACA,UAAU;EACV;EACA;EACD;CAED,MAAM,UACJ,4CACG,cAAc,KAAK,OAAO,UAAU;EAEnC,MAAM,WAAY,MAAM,MAAc,WAAW;AACjD,SACE,qBAAC,uBACE,OACA,eAAe,QAAQ,cAAc,SAAS,KAC7C,oBAAC,WAAQ,WAAW,OAAO,UAAW,KAH3B,SAKJ;GAEb,GACD;AAGL,QACE,oBAAC,iBAAiB;EAAS,OAAO;YAChC,oBAAC;GACC,WAAW,GAAG,OAAO,MAAM,YAAY,MAAM,cAAc;GACtD;GACL,OAAO;IACA;IACL,GAAG,cAAc;IACjB,GAAG;IACJ;GACD,GAAI;aAEH,mBAAmB,UAAU,oBAAC,yBAAa,UAAsB;IAC9D;GACoB;EAGjC;AAED,UAAU,cAAc;AAExB,wBAAe"}
1
+ {"version":3,"file":"Accordion.mjs","names":["useMergeState","newKeys: Key[]"],"sources":["../../src/Accordion/Accordion.tsx"],"sourcesContent":["'use client';\n\nimport { Divider } from 'antd';\nimport { cx } from 'antd-style';\nimport { LayoutGroup } from 'motion/react';\nimport { Children, Fragment, isValidElement, memo, useCallback } from 'react';\nimport type { Key } from 'react';\nimport useMergeState from 'use-merge-value';\n\nimport { AccordionContext } from './context';\nimport { styles } from './style';\nimport type { AccordionProps } from './type';\n\nconst Accordion = memo<AccordionProps>(\n ({\n children,\n className: userClassName,\n style: userStyle,\n accordion = false,\n defaultExpandedKeys,\n expandedKeys: expandedKeysProp,\n onExpandedChange,\n variant = 'borderless',\n gap,\n showDivider = false,\n disableAnimation = false,\n hideIndicator = false,\n indicatorPlacement = 'start',\n keepContentMounted = true,\n classNames,\n styles: customStyles,\n motionProps,\n ref,\n ...rest\n }) => {\n // Convert children to array and filter valid elements\n const validChildren = Children.toArray(children).filter(isValidElement);\n\n // Collect all item keys\n const allItemKeys = validChildren.map((child, index) => (child.props as any).itemKey || index);\n\n // If defaultExpandedKeys or expandedKeys is undefined, expand all items by default\n const initialExpandedKeys = defaultExpandedKeys ?? allItemKeys;\n\n const [expandedKeys, setExpandedKeys] = useMergeState<Key[]>(initialExpandedKeys, {\n onChange: onExpandedChange,\n value: expandedKeysProp,\n });\n\n const toggleExpand = useCallback(\n (key: Key) => {\n const prev = expandedKeys;\n let newKeys: Key[];\n\n if (accordion) {\n newKeys = prev.includes(key) ? [] : [key];\n } else {\n newKeys = prev.includes(key) ? prev.filter((k: Key) => k !== key) : [...prev, key];\n }\n\n setExpandedKeys(newKeys);\n },\n [accordion, expandedKeys, setExpandedKeys],\n );\n\n const isExpanded = useCallback(\n (key: Key) => {\n return expandedKeys.includes(key);\n },\n [expandedKeys],\n );\n\n const contextValue = {\n disableAnimation,\n expandedKeys,\n hideIndicator,\n indicatorPlacement,\n isExpanded,\n keepContentMounted,\n motionProps,\n onToggle: toggleExpand,\n showDivider,\n variant,\n };\n\n const content = (\n <>\n {validChildren.map((child, index) => {\n // Extract itemKey from child props to use as React key\n const childKey = (child.props as any).itemKey || index;\n return (\n <Fragment key={childKey}>\n {child}\n {showDivider && index < validChildren.length - 1 && (\n <Divider className={styles.divider} />\n )}\n </Fragment>\n );\n })}\n </>\n );\n\n return (\n <AccordionContext.Provider value={contextValue}>\n <div\n className={cx(styles.base, classNames?.base, userClassName)}\n ref={ref}\n style={{\n gap: gap,\n ...customStyles?.base,\n ...userStyle,\n }}\n {...rest}\n >\n {disableAnimation ? content : <LayoutGroup>{content}</LayoutGroup>}\n </div>\n </AccordionContext.Provider>\n );\n },\n);\n\nAccordion.displayName = 'Accordion';\n\nexport default Accordion;\n"],"mappings":";;;;;;;;;;;;AAaA,MAAM,YAAY,MACf,EACC,UACA,WAAW,eACX,OAAO,WACP,YAAY,OACZ,qBACA,cAAc,kBACd,kBACA,UAAU,cACV,KACA,cAAc,OACd,mBAAmB,OACnB,gBAAgB,OAChB,qBAAqB,SACrB,qBAAqB,MACrB,YACA,QAAQ,cACR,aACA,KACA,GAAG,WACC;CAEJ,MAAM,gBAAgB,SAAS,QAAQ,SAAS,CAAC,OAAO,eAAe;CAGvE,MAAM,cAAc,cAAc,KAAK,OAAO,UAAW,MAAM,MAAc,WAAW,MAAM;CAK9F,MAAM,CAAC,cAAc,mBAAmBA,mBAFZ,uBAAuB,aAE+B;EAChF,UAAU;EACV,OAAO;EACR,CAAC;CAEF,MAAM,eAAe,aAClB,QAAa;EACZ,MAAM,OAAO;EACb,IAAIC;AAEJ,MAAI,UACF,WAAU,KAAK,SAAS,IAAI,GAAG,EAAE,GAAG,CAAC,IAAI;MAEzC,WAAU,KAAK,SAAS,IAAI,GAAG,KAAK,QAAQ,MAAW,MAAM,IAAI,GAAG,CAAC,GAAG,MAAM,IAAI;AAGpF,kBAAgB,QAAQ;IAE1B;EAAC;EAAW;EAAc;EAAgB,CAC3C;CASD,MAAM,eAAe;EACnB;EACA;EACA;EACA;EACA,YAZiB,aAChB,QAAa;AACZ,UAAO,aAAa,SAAS,IAAI;KAEnC,CAAC,aAAa,CACf;EAQC;EACA;EACA,UAAU;EACV;EACA;EACD;CAED,MAAM,UACJ,4CACG,cAAc,KAAK,OAAO,UAAU;EAEnC,MAAM,WAAY,MAAM,MAAc,WAAW;AACjD,SACE,qBAAC,uBACE,OACA,eAAe,QAAQ,cAAc,SAAS,KAC7C,oBAAC,WAAQ,WAAW,OAAO,UAAW,KAH3B,SAKJ;GAEb,GACD;AAGL,QACE,oBAAC,iBAAiB;EAAS,OAAO;YAChC,oBAAC;GACC,WAAW,GAAG,OAAO,MAAM,YAAY,MAAM,cAAc;GACtD;GACL,OAAO;IACA;IACL,GAAG,cAAc;IACjB,GAAG;IACJ;GACD,GAAI;aAEH,mBAAmB,UAAU,oBAAC,yBAAa,UAAsB;IAC9D;GACoB;EAGjC;AAED,UAAU,cAAc;AAExB,wBAAe"}
@@ -1,8 +1,8 @@
1
1
  import { AccordionItemProps } from "./type.mjs";
2
- import * as react80 from "react";
2
+ import * as react75 from "react";
3
3
 
4
4
  //#region src/Accordion/AccordionItem.d.ts
5
- declare const AccordionItem: react80.NamedExoticComponent<AccordionItemProps>;
5
+ declare const AccordionItem: react75.NamedExoticComponent<AccordionItemProps>;
6
6
  //#endregion
7
7
  export { AccordionItem };
8
8
  //# sourceMappingURL=AccordionItem.d.mts.map
@@ -12,7 +12,7 @@ import { memo, useCallback, useEffect, useMemo, useRef } from "react";
12
12
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
13
13
  import { cx } from "antd-style";
14
14
  import { AnimatePresence } from "motion/react";
15
- import useMergeState from "use-merge-value";
15
+ import useControlledState from "use-merge-value";
16
16
 
17
17
  //#region src/Accordion/AccordionItem.tsx
18
18
  const motionContainerStyle = { overflow: "hidden" };
@@ -118,7 +118,7 @@ AccordionItemContent.displayName = "AccordionItemContent";
118
118
  const AccordionItem = memo(({ itemKey, title, children, action, disabled = false, allowExpand = true, hideIndicator: itemHideIndicator, indicatorPlacement: itemIndicatorPlacement, indicator: customIndicator, classNames, paddingInline = 16, paddingBlock = 8, padding, ref, variant: customVariant, styles: customStyles, headerWrapper, defaultExpand, expand, onExpandChange }) => {
119
119
  const context = useAccordionContext();
120
120
  const isStandalone = expand !== void 0 || defaultExpand !== void 0;
121
- const [isExpandedStandalone, setIsExpandedStandalone] = useMergeState(defaultExpand ?? false, {
121
+ const [isExpandedStandalone, setIsExpandedStandalone] = useControlledState(defaultExpand ?? false, {
122
122
  onChange: onExpandChange,
123
123
  value: expand
124
124
  });
@@ -1 +1 @@
1
- {"version":3,"file":"AccordionItem.mjs","names":["motionContainerStyle: CSSProperties","ArrowIcon","Text","Flexbox","Block"],"sources":["../../src/Accordion/AccordionItem.tsx"],"sourcesContent":["'use client';\n\nimport { cx } from 'antd-style';\nimport { AnimatePresence } from 'motion/react';\nimport type { CSSProperties, ComponentPropsWithoutRef, ReactNode } from 'react';\nimport { KeyboardEvent, memo, useCallback, useEffect, useMemo, useRef } from 'react';\nimport useMergeState from 'use-merge-value';\n\nimport Block from '@/Block';\nimport { Flexbox } from '@/Flex';\nimport { type MotionComponentType, useMotionComponent } from '@/MotionProvider';\nimport Text from '@/Text';\nimport { stopPropagation } from '@/utils/dom';\n\nimport ArrowIcon from './ArrowIcon';\nimport { useAccordionContext } from './context';\nimport { styles } from './style';\nimport type { AccordionItemProps } from './type';\n\ntype AccordionContentBaseProps = {\n children?: ReactNode;\n className?: string;\n contentInnerClassName: string;\n style?: CSSProperties;\n};\n\ntype AccordionStaticContentProps = AccordionContentBaseProps & {\n isOpen: boolean;\n keepContentMounted: boolean;\n};\n\ntype MotionDivProps = ComponentPropsWithoutRef<MotionComponentType['div']>;\n\ntype AccordionMotionContentProps = AccordionContentBaseProps & {\n contextMotionProps?: MotionDivProps;\n isOpen: boolean;\n skipInitialAnimation: boolean;\n};\n\ntype AccordionItemContentProps = AccordionContentBaseProps & {\n contextMotionProps?: MotionDivProps;\n disableAnimation: boolean;\n isOpen: boolean;\n keepContentMounted: boolean;\n skipInitialAnimation: boolean;\n};\n\nconst motionContainerStyle: CSSProperties = { overflow: 'hidden' };\n\nconst AccordionStaticContent = memo<AccordionStaticContentProps>(\n ({ className, style, children, contentInnerClassName, isOpen, keepContentMounted }) => {\n if (keepContentMounted) {\n return (\n <div\n className={className}\n role=\"region\"\n style={{\n display: isOpen ? 'block' : 'none',\n ...style,\n }}\n >\n <div className={contentInnerClassName}>{children}</div>\n </div>\n );\n }\n\n if (!isOpen) return null;\n\n return (\n <div className={className} role=\"region\" style={style}>\n <div className={contentInnerClassName}>{children}</div>\n </div>\n );\n },\n);\n\nAccordionStaticContent.displayName = 'AccordionStaticContent';\n\nconst AccordionMotionContent = memo<AccordionMotionContentProps>(\n ({\n contextMotionProps,\n className,\n style,\n children,\n contentInnerClassName,\n isOpen,\n skipInitialAnimation,\n }) => {\n const Motion = useMotionComponent();\n\n const motionProps = useMemo(\n () => ({\n animate: 'enter',\n exit: 'exit',\n initial: skipInitialAnimation ? false : 'exit',\n variants: {\n enter: {\n height: 'auto',\n opacity: 1,\n transition: {\n duration: 0.2,\n ease: [0.4, 0, 0.2, 1],\n },\n },\n exit: {\n height: 0,\n opacity: 0,\n transition: {\n duration: 0.2,\n ease: [0.4, 0, 0.2, 1],\n },\n },\n },\n ...contextMotionProps,\n }),\n [contextMotionProps, skipInitialAnimation],\n );\n\n return (\n <AnimatePresence initial={false}>\n {isOpen ? (\n <Motion.div {...(motionProps as any)} style={motionContainerStyle}>\n <div className={className} role=\"region\" style={style}>\n <div className={contentInnerClassName}>{children}</div>\n </div>\n </Motion.div>\n ) : null}\n </AnimatePresence>\n );\n },\n);\n\nAccordionMotionContent.displayName = 'AccordionMotionContent';\n\nconst AccordionItemContent = memo<AccordionItemContentProps>(\n ({\n disableAnimation,\n isOpen,\n keepContentMounted,\n className,\n style,\n children,\n contentInnerClassName,\n contextMotionProps,\n skipInitialAnimation,\n }) => {\n if (disableAnimation || !keepContentMounted) {\n return (\n <AccordionStaticContent\n className={className}\n contentInnerClassName={contentInnerClassName}\n isOpen={isOpen}\n keepContentMounted={keepContentMounted}\n style={style}\n >\n {children}\n </AccordionStaticContent>\n );\n }\n\n return (\n <AccordionMotionContent\n className={className}\n contentInnerClassName={contentInnerClassName}\n contextMotionProps={contextMotionProps}\n isOpen={isOpen}\n skipInitialAnimation={skipInitialAnimation}\n style={style}\n >\n {children}\n </AccordionMotionContent>\n );\n },\n);\n\nAccordionItemContent.displayName = 'AccordionItemContent';\n\nconst AccordionItem = memo<AccordionItemProps>(\n ({\n itemKey,\n title,\n children,\n action,\n disabled = false,\n allowExpand = true,\n hideIndicator: itemHideIndicator,\n indicatorPlacement: itemIndicatorPlacement,\n indicator: customIndicator,\n classNames,\n paddingInline = 16,\n paddingBlock = 8,\n padding,\n ref,\n variant: customVariant,\n styles: customStyles,\n headerWrapper,\n defaultExpand,\n expand,\n onExpandChange,\n }) => {\n const context = useAccordionContext();\n\n // Determine if using standalone mode (has expand or defaultExpand props)\n const isStandalone = expand !== undefined || defaultExpand !== undefined;\n\n // Standalone state management\n const [isExpandedStandalone, setIsExpandedStandalone] = useMergeState<boolean>(\n defaultExpand ?? false,\n {\n onChange: onExpandChange,\n value: expand,\n },\n );\n\n // Context values (may be null if used standalone)\n const contextIsExpanded = context?.isExpanded;\n const contextOnToggle = context?.onToggle;\n const contextHideIndicator = context?.hideIndicator;\n const contextIndicatorPlacement = context?.indicatorPlacement;\n const contextKeepContentMounted = context?.keepContentMounted;\n const contextDisableAnimation = context?.disableAnimation;\n const contextMotionProps = context?.motionProps;\n const contextVariant = context?.variant ?? 'borderless';\n\n const isInitialRenderRef = useRef(true);\n\n useEffect(() => {\n isInitialRenderRef.current = false;\n }, []);\n\n // Determine expanded state\n const isOpen = isStandalone\n ? isExpandedStandalone\n : contextIsExpanded\n ? contextIsExpanded(itemKey)\n : false;\n\n // Determine other props with fallbacks\n const hideIndicatorFinal = itemHideIndicator ?? contextHideIndicator ?? false;\n const indicatorPlacementFinal = itemIndicatorPlacement ?? contextIndicatorPlacement ?? 'start';\n const keepContentMounted = contextKeepContentMounted ?? true;\n const disableAnimation = contextDisableAnimation ?? false;\n const variant = customVariant || contextVariant;\n\n const handleToggle = useCallback(() => {\n // If allowExpand is false, only allow controlled expansion via expand prop\n if (!allowExpand) return;\n\n if (!disabled) {\n if (isStandalone) {\n setIsExpandedStandalone(!isExpandedStandalone);\n } else if (contextOnToggle) {\n contextOnToggle(itemKey);\n }\n }\n }, [\n allowExpand,\n disabled,\n isStandalone,\n setIsExpandedStandalone,\n isExpandedStandalone,\n contextOnToggle,\n itemKey,\n ]);\n\n const handleKeyDown = useCallback(\n (e: KeyboardEvent) => {\n // If allowExpand is false, disable keyboard toggle\n if (!allowExpand || disabled) return;\n\n switch (e.key) {\n case 'Enter':\n case ' ': {\n e.preventDefault();\n handleToggle();\n break;\n }\n }\n },\n [allowExpand, disabled, handleToggle],\n );\n\n const preventTitleTextSelection = useCallback((e: any) => {\n // Prevent browser from creating a selection range on double/multi click,\n // which can accidentally select the content region.\n if (e?.detail > 1) e.preventDefault();\n }, []);\n\n // Build indicator\n const indicator = useMemo(() => {\n if (!allowExpand || hideIndicatorFinal) return null;\n\n if (customIndicator) {\n if (typeof customIndicator === 'function') {\n return (\n <span\n aria-hidden=\"true\"\n className={cx(styles.indicator, classNames?.indicator)}\n style={customStyles?.indicator}\n >\n {customIndicator({ isDisabled: disabled, isOpen })}\n </span>\n );\n }\n return (\n <span\n aria-hidden=\"true\"\n className={cx(styles.indicator, classNames?.indicator)}\n style={customStyles?.indicator}\n >\n {customIndicator}\n </span>\n );\n }\n\n return (\n <span\n aria-hidden=\"true\"\n className={cx(styles.indicator, classNames?.indicator)}\n style={customStyles?.indicator}\n >\n <ArrowIcon className={cx(styles.icon, isOpen && styles.iconRotate)} />\n </span>\n );\n }, [\n allowExpand,\n hideIndicatorFinal,\n customIndicator,\n disabled,\n isOpen,\n cx,\n styles,\n classNames,\n customStyles,\n ]);\n\n const skipInitialAnimation = isInitialRenderRef.current && isOpen;\n\n const contentClassName = useMemo(\n () => cx('accordion-content', styles.content, classNames?.content),\n [cx, styles, classNames?.content],\n );\n\n const titleNode = useMemo(\n () =>\n typeof title === 'string' ? (\n <Text className={classNames?.title} ellipsis style={customStyles?.title}>\n {title}\n </Text>\n ) : (\n title\n ),\n [title, classNames?.title, customStyles?.title],\n );\n\n const actionNode = useMemo(\n () =>\n action && (\n <Flexbox\n align={'center'}\n className={cx('accordion-action', styles.action, classNames?.action)}\n flex={'none'}\n gap={4}\n horizontal\n onClick={stopPropagation}\n style={customStyles?.action}\n >\n {action}\n </Flexbox>\n ),\n [action, cx, styles, classNames?.action, customStyles?.action],\n );\n\n const headerElement = useMemo(() => {\n const header = (\n <Block\n className={cx('accordion-header', styles.header, classNames?.header)}\n clickable={!disabled && allowExpand}\n gap={4}\n horizontal\n justify={'space-between'}\n onClick={handleToggle}\n onKeyDown={handleKeyDown}\n padding={padding}\n paddingBlock={paddingBlock}\n paddingInline={paddingInline}\n ref={ref}\n style={{\n alignItems: 'center',\n cursor: disabled ? 'not-allowed' : allowExpand ? 'pointer' : 'default',\n opacity: disabled ? 0.5 : undefined,\n overflow: 'hidden',\n width: '100%',\n ...customStyles?.header,\n }}\n variant={customVariant || variant}\n >\n {indicatorPlacementFinal === 'start' ? (\n <>\n <Flexbox\n align={'center'}\n className={styles.titleWrapper}\n flex={1}\n gap={2}\n horizontal\n onDoubleClick={preventTitleTextSelection}\n onMouseDown={preventTitleTextSelection}\n style={{\n overflow: 'hidden',\n }}\n >\n {titleNode}\n {indicator}\n </Flexbox>\n <Flexbox align={'center'} flex={'none'} gap={4} horizontal>\n {actionNode}\n </Flexbox>\n </>\n ) : (\n <>\n <Flexbox\n align={'center'}\n className={styles.titleWrapper}\n flex={1}\n gap={2}\n horizontal\n onDoubleClick={preventTitleTextSelection}\n onMouseDown={preventTitleTextSelection}\n style={{\n overflow: 'hidden',\n }}\n >\n {titleNode}\n </Flexbox>\n <Flexbox align={'center'} flex={'none'} gap={4} horizontal>\n {actionNode}\n {indicator}\n </Flexbox>\n </>\n )}\n </Block>\n );\n if (headerWrapper) {\n return headerWrapper(header);\n }\n return header;\n }, [\n cx,\n styles,\n classNames,\n disabled,\n handleToggle,\n handleKeyDown,\n padding,\n paddingBlock,\n paddingInline,\n ref,\n customVariant,\n variant,\n indicatorPlacementFinal,\n titleNode,\n indicator,\n actionNode,\n headerWrapper,\n ]);\n\n return (\n <div\n className={cx('accordion-item', styles.item, classNames?.base)}\n style={customStyles?.base}\n >\n {headerElement}\n <AccordionItemContent\n className={contentClassName}\n contentInnerClassName={styles.contentInner}\n contextMotionProps={contextMotionProps}\n disableAnimation={!!disableAnimation}\n isOpen={isOpen}\n keepContentMounted={!!keepContentMounted}\n skipInitialAnimation={skipInitialAnimation}\n style={customStyles?.content}\n >\n {children}\n </AccordionItemContent>\n </div>\n );\n },\n);\n\nAccordionItem.displayName = 'AccordionItem';\n\nexport default AccordionItem;\n"],"mappings":";;;;;;;;;;;;;;;;;AA+CA,MAAMA,uBAAsC,EAAE,UAAU,UAAU;AAElE,MAAM,yBAAyB,MAC5B,EAAE,WAAW,OAAO,UAAU,uBAAuB,QAAQ,yBAAyB;AACrF,KAAI,mBACF,QACE,oBAAC;EACY;EACX,MAAK;EACL,OAAO;GACL,SAAS,SAAS,UAAU;GAC5B,GAAG;GACJ;YAED,oBAAC;GAAI,WAAW;GAAwB;IAAe;GACnD;AAIV,KAAI,CAAC,OAAQ,QAAO;AAEpB,QACE,o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Q,WAAW,gBAAgB,cAAc,YAAY;IAC7D,SAAS,WAAW,KAAM;IAC1B,UAAU;IACV,OAAO;IACP,GAAG,cAAc;IAClB;GACD,SAAS,iBAAiB;aAEzB,4BAA4B,UAC3B,8CACE,qBAACD;IACC,OAAO;IACP,WAAW,OAAO;IAClB,MAAM;IACN,KAAK;IACL;IACA,eAAe;IACf,aAAa;IACb,OAAO,EACL,UAAU,UACX;eAEA,WACA;KACO,EACV,oBAACA;IAAQ,OAAO;IAAU,MAAM;IAAQ,KAAK;IAAG;cAC7C;KACO,IACT,GAEH,8CACE,oBAACA;IACC,OAAO;IACP,WAAW,OAAO;IAClB,MAAM;IACN,KAAK;IACL;IACA,eAAe;IACf,aAAa;IACb,OAAO,EACL,UAAU,UACX;cAEA;KACO,EACV,qBAACA;IAAQ,OAAO;IAAU,MAAM;IAAQ,KAAK;IAAG;eAC7C,YACA;KACO,IACT;IAEC;AAEV,MAAI,cACF,QAAO,cAAc,OAAO;AAE9B,SAAO;IACN;EACD;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CAAC;AAEF,QACE,qBAAC;EACC,WAAW,GAAG,kBAAkB,OAAO,MAAM,YAAY,KAAK;EAC9D,OAAO,cAAc;aAEpB,eACD,oBAAC;GACC,WAAW;GACX,uBAAuB,OAAO;GACV;GACpB,kBAAkB,CAAC,CAAC;GACZ;GACR,oBAAoB,CAAC,CAAC;GACA;GACtB,OAAO,cAAc;GAEpB;IACoB;GACnB;EAGX;AAED,cAAc,cAAc;AAE5B,4BAAe"}
1
+ {"version":3,"file":"AccordionItem.mjs","names":["motionContainerStyle: CSSProperties","useMergeState","ArrowIcon","Text","Flexbox","Block"],"sources":["../../src/Accordion/AccordionItem.tsx"],"sourcesContent":["'use client';\n\nimport { cx } from 'antd-style';\nimport { AnimatePresence } from 'motion/react';\nimport type { CSSProperties, ComponentPropsWithoutRef, ReactNode } from 'react';\nimport { KeyboardEvent, memo, useCallback, useEffect, useMemo, useRef } from 'react';\nimport useMergeState from 'use-merge-value';\n\nimport Block from '@/Block';\nimport { Flexbox } from '@/Flex';\nimport { type MotionComponentType, useMotionComponent } from '@/MotionProvider';\nimport Text from '@/Text';\nimport { stopPropagation } from '@/utils/dom';\n\nimport ArrowIcon from './ArrowIcon';\nimport { useAccordionContext } from './context';\nimport { styles } from './style';\nimport type { AccordionItemProps } from './type';\n\ntype AccordionContentBaseProps = {\n children?: ReactNode;\n className?: string;\n contentInnerClassName: string;\n style?: CSSProperties;\n};\n\ntype AccordionStaticContentProps = AccordionContentBaseProps & {\n isOpen: boolean;\n keepContentMounted: boolean;\n};\n\ntype MotionDivProps = ComponentPropsWithoutRef<MotionComponentType['div']>;\n\ntype AccordionMotionContentProps = AccordionContentBaseProps & {\n contextMotionProps?: MotionDivProps;\n isOpen: boolean;\n skipInitialAnimation: boolean;\n};\n\ntype AccordionItemContentProps = AccordionContentBaseProps & {\n contextMotionProps?: MotionDivProps;\n disableAnimation: boolean;\n isOpen: boolean;\n keepContentMounted: boolean;\n skipInitialAnimation: boolean;\n};\n\nconst motionContainerStyle: CSSProperties = { overflow: 'hidden' };\n\nconst AccordionStaticContent = memo<AccordionStaticContentProps>(\n ({ className, style, children, contentInnerClassName, isOpen, keepContentMounted }) => {\n if (keepContentMounted) {\n return (\n <div\n className={className}\n role=\"region\"\n style={{\n display: isOpen ? 'block' : 'none',\n ...style,\n }}\n >\n <div className={contentInnerClassName}>{children}</div>\n </div>\n );\n }\n\n if (!isOpen) return null;\n\n return (\n <div className={className} role=\"region\" style={style}>\n <div className={contentInnerClassName}>{children}</div>\n </div>\n );\n },\n);\n\nAccordionStaticContent.displayName = 'AccordionStaticContent';\n\nconst AccordionMotionContent = memo<AccordionMotionContentProps>(\n ({\n contextMotionProps,\n className,\n style,\n children,\n contentInnerClassName,\n isOpen,\n skipInitialAnimation,\n }) => {\n const Motion = useMotionComponent();\n\n const motionProps = useMemo(\n () => ({\n animate: 'enter',\n exit: 'exit',\n initial: skipInitialAnimation ? false : 'exit',\n variants: {\n enter: {\n height: 'auto',\n opacity: 1,\n transition: {\n duration: 0.2,\n ease: [0.4, 0, 0.2, 1],\n },\n },\n exit: {\n height: 0,\n opacity: 0,\n transition: {\n duration: 0.2,\n ease: [0.4, 0, 0.2, 1],\n },\n },\n },\n ...contextMotionProps,\n }),\n [contextMotionProps, skipInitialAnimation],\n );\n\n return (\n <AnimatePresence initial={false}>\n {isOpen ? (\n <Motion.div {...(motionProps as any)} style={motionContainerStyle}>\n <div className={className} role=\"region\" style={style}>\n <div className={contentInnerClassName}>{children}</div>\n </div>\n </Motion.div>\n ) : null}\n </AnimatePresence>\n );\n },\n);\n\nAccordionMotionContent.displayName = 'AccordionMotionContent';\n\nconst AccordionItemContent = memo<AccordionItemContentProps>(\n ({\n disableAnimation,\n isOpen,\n keepContentMounted,\n className,\n style,\n children,\n contentInnerClassName,\n contextMotionProps,\n skipInitialAnimation,\n }) => {\n if (disableAnimation || !keepContentMounted) {\n return (\n <AccordionStaticContent\n className={className}\n contentInnerClassName={contentInnerClassName}\n isOpen={isOpen}\n keepContentMounted={keepContentMounted}\n style={style}\n >\n {children}\n </AccordionStaticContent>\n );\n }\n\n return (\n <AccordionMotionContent\n className={className}\n contentInnerClassName={contentInnerClassName}\n contextMotionProps={contextMotionProps}\n isOpen={isOpen}\n skipInitialAnimation={skipInitialAnimation}\n style={style}\n >\n {children}\n </AccordionMotionContent>\n );\n },\n);\n\nAccordionItemContent.displayName = 'AccordionItemContent';\n\nconst AccordionItem = memo<AccordionItemProps>(\n ({\n itemKey,\n title,\n children,\n action,\n disabled = false,\n allowExpand = true,\n hideIndicator: itemHideIndicator,\n indicatorPlacement: itemIndicatorPlacement,\n indicator: customIndicator,\n classNames,\n paddingInline = 16,\n paddingBlock = 8,\n padding,\n ref,\n variant: customVariant,\n styles: customStyles,\n headerWrapper,\n defaultExpand,\n expand,\n onExpandChange,\n }) => {\n const context = useAccordionContext();\n\n // Determine if using standalone mode (has expand or defaultExpand props)\n const isStandalone = expand !== undefined || defaultExpand !== undefined;\n\n // Standalone state management\n const [isExpandedStandalone, setIsExpandedStandalone] = useMergeState<boolean>(\n defaultExpand ?? false,\n {\n onChange: onExpandChange,\n value: expand,\n },\n );\n\n // Context values (may be null if used standalone)\n const contextIsExpanded = context?.isExpanded;\n const contextOnToggle = context?.onToggle;\n const contextHideIndicator = context?.hideIndicator;\n const contextIndicatorPlacement = context?.indicatorPlacement;\n const contextKeepContentMounted = context?.keepContentMounted;\n const contextDisableAnimation = context?.disableAnimation;\n const contextMotionProps = context?.motionProps;\n const contextVariant = context?.variant ?? 'borderless';\n\n const isInitialRenderRef = useRef(true);\n\n useEffect(() => {\n isInitialRenderRef.current = false;\n }, []);\n\n // Determine expanded state\n const isOpen = isStandalone\n ? isExpandedStandalone\n : contextIsExpanded\n ? contextIsExpanded(itemKey)\n : false;\n\n // Determine other props with fallbacks\n const hideIndicatorFinal = itemHideIndicator ?? contextHideIndicator ?? false;\n const indicatorPlacementFinal = itemIndicatorPlacement ?? contextIndicatorPlacement ?? 'start';\n const keepContentMounted = contextKeepContentMounted ?? true;\n const disableAnimation = contextDisableAnimation ?? false;\n const variant = customVariant || contextVariant;\n\n const handleToggle = useCallback(() => {\n // If allowExpand is false, only allow controlled expansion via expand prop\n if (!allowExpand) return;\n\n if (!disabled) {\n if (isStandalone) {\n setIsExpandedStandalone(!isExpandedStandalone);\n } else if (contextOnToggle) {\n contextOnToggle(itemKey);\n }\n }\n }, [\n allowExpand,\n disabled,\n isStandalone,\n setIsExpandedStandalone,\n isExpandedStandalone,\n contextOnToggle,\n itemKey,\n ]);\n\n const handleKeyDown = useCallback(\n (e: KeyboardEvent) => {\n // If allowExpand is false, disable keyboard toggle\n if (!allowExpand || disabled) return;\n\n switch (e.key) {\n case 'Enter':\n case ' ': {\n e.preventDefault();\n handleToggle();\n break;\n }\n }\n },\n [allowExpand, disabled, handleToggle],\n );\n\n const preventTitleTextSelection = useCallback((e: any) => {\n // Prevent browser from creating a selection range on double/multi click,\n // which can accidentally select the content region.\n if (e?.detail > 1) e.preventDefault();\n }, []);\n\n // Build indicator\n const indicator = useMemo(() => {\n if (!allowExpand || hideIndicatorFinal) return null;\n\n if (customIndicator) {\n if (typeof customIndicator === 'function') {\n return (\n <span\n aria-hidden=\"true\"\n className={cx(styles.indicator, classNames?.indicator)}\n style={customStyles?.indicator}\n >\n {customIndicator({ isDisabled: disabled, isOpen })}\n </span>\n );\n }\n return (\n <span\n aria-hidden=\"true\"\n className={cx(styles.indicator, classNames?.indicator)}\n style={customStyles?.indicator}\n >\n {customIndicator}\n </span>\n );\n }\n\n return (\n <span\n aria-hidden=\"true\"\n className={cx(styles.indicator, classNames?.indicator)}\n style={customStyles?.indicator}\n >\n <ArrowIcon className={cx(styles.icon, isOpen && styles.iconRotate)} />\n </span>\n );\n }, [\n allowExpand,\n hideIndicatorFinal,\n customIndicator,\n disabled,\n isOpen,\n cx,\n styles,\n classNames,\n customStyles,\n ]);\n\n const skipInitialAnimation = isInitialRenderRef.current && isOpen;\n\n const contentClassName = useMemo(\n () => cx('accordion-content', styles.content, classNames?.content),\n [cx, styles, classNames?.content],\n );\n\n const titleNode = useMemo(\n () =>\n typeof title === 'string' ? (\n <Text className={classNames?.title} ellipsis style={customStyles?.title}>\n {title}\n </Text>\n ) : (\n title\n ),\n [title, classNames?.title, customStyles?.title],\n );\n\n const actionNode = useMemo(\n () =>\n action && (\n <Flexbox\n align={'center'}\n className={cx('accordion-action', styles.action, classNames?.action)}\n flex={'none'}\n gap={4}\n horizontal\n onClick={stopPropagation}\n style={customStyles?.action}\n >\n {action}\n </Flexbox>\n ),\n [action, cx, styles, classNames?.action, customStyles?.action],\n );\n\n const headerElement = useMemo(() => {\n const header = (\n <Block\n className={cx('accordion-header', styles.header, classNames?.header)}\n clickable={!disabled && allowExpand}\n gap={4}\n horizontal\n justify={'space-between'}\n onClick={handleToggle}\n onKeyDown={handleKeyDown}\n padding={padding}\n paddingBlock={paddingBlock}\n paddingInline={paddingInline}\n ref={ref}\n style={{\n alignItems: 'center',\n cursor: disabled ? 'not-allowed' : allowExpand ? 'pointer' : 'default',\n opacity: disabled ? 0.5 : undefined,\n overflow: 'hidden',\n width: '100%',\n ...customStyles?.header,\n }}\n variant={customVariant || variant}\n >\n {indicatorPlacementFinal === 'start' ? (\n <>\n <Flexbox\n align={'center'}\n className={styles.titleWrapper}\n flex={1}\n gap={2}\n horizontal\n onDoubleClick={preventTitleTextSelection}\n onMouseDown={preventTitleTextSelection}\n style={{\n overflow: 'hidden',\n }}\n >\n {titleNode}\n {indicator}\n </Flexbox>\n <Flexbox align={'center'} flex={'none'} gap={4} horizontal>\n {actionNode}\n </Flexbox>\n </>\n ) : (\n <>\n <Flexbox\n align={'center'}\n className={styles.titleWrapper}\n flex={1}\n gap={2}\n horizontal\n onDoubleClick={preventTitleTextSelection}\n onMouseDown={preventTitleTextSelection}\n style={{\n overflow: 'hidden',\n }}\n >\n {titleNode}\n </Flexbox>\n <Flexbox align={'center'} flex={'none'} gap={4} horizontal>\n {actionNode}\n {indicator}\n </Flexbox>\n </>\n )}\n </Block>\n );\n if (headerWrapper) {\n return headerWrapper(header);\n }\n return header;\n }, [\n cx,\n styles,\n classNames,\n disabled,\n handleToggle,\n handleKeyDown,\n padding,\n paddingBlock,\n paddingInline,\n ref,\n customVariant,\n variant,\n indicatorPlacementFinal,\n titleNode,\n indicator,\n actionNode,\n headerWrapper,\n ]);\n\n return (\n <div\n className={cx('accordion-item', styles.item, classNames?.base)}\n style={customStyles?.base}\n >\n {headerElement}\n <AccordionItemContent\n className={contentClassName}\n contentInnerClassName={styles.contentInner}\n contextMotionProps={contextMotionProps}\n disableAnimation={!!disableAnimation}\n isOpen={isOpen}\n keepContentMounted={!!keepContentMounted}\n skipInitialAnimation={skipInitialAnimation}\n style={customStyles?.content}\n >\n {children}\n </AccordionItemContent>\n </div>\n );\n },\n);\n\nAccordionItem.displayName = 'AccordionItem';\n\nexport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;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 react3 from "react";
2
+ import * as react41 from "react";
3
3
 
4
4
  //#region src/ActionIcon/ActionIcon.d.ts
5
- declare const ActionIcon: react3.NamedExoticComponent<ActionIconProps>;
5
+ declare const ActionIcon: react41.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 react48 from "react";
2
+ import * as react34 from "react";
3
3
 
4
4
  //#region src/Alert/Alert.d.ts
5
- declare const Alert: react48.NamedExoticComponent<AlertProps>;
5
+ declare const Alert: react34.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 react47 from "react";
2
+ import * as react24 from "react";
3
3
 
4
4
  //#region src/AutoComplete/Select.d.ts
5
- declare const AutoComplete: react47.NamedExoticComponent<AutoCompleteProps>;
5
+ declare const AutoComplete: react24.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 react46 from "react";
2
+ import * as react66 from "react";
3
3
 
4
4
  //#region src/Avatar/AvatarGroup/index.d.ts
5
- declare const AvatarGroup: react46.NamedExoticComponent<AvatarGroupProps>;
5
+ declare const AvatarGroup: react66.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 react45 from "react";
2
+ import * as react65 from "react";
3
3
 
4
4
  //#region src/Burger/Burger.d.ts
5
- declare const Burger: react45.NamedExoticComponent<BurgerProps>;
5
+ declare const Burger: react65.NamedExoticComponent<BurgerProps>;
6
6
  //#endregion
7
7
  export { Burger };
8
8
  //# sourceMappingURL=Burger.d.mts.map
@@ -4,12 +4,12 @@ import Text_default from "../Text/Text.mjs";
4
4
  import { styles } from "./style.mjs";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
6
  import { cx } from "antd-style";
7
- import useMergeState from "use-merge-value";
7
+ import useControlledState from "use-merge-value";
8
8
  import { CheckIcon, Minus } from "lucide-react";
9
9
 
10
10
  //#region src/Checkbox/Checkbox.tsx
11
11
  const Checkbox = ({ checked, defaultChecked, onChange, size = 16, className, style, children, textProps, backgroundColor, classNames, styles: customStyles, shape = "square", disabled, indeterminate, ...rest }) => {
12
- const [value, setValue] = useMergeState(defaultChecked || false, {
12
+ const [value, setValue] = useControlledState(defaultChecked || false, {
13
13
  defaultValue: defaultChecked,
14
14
  onChange,
15
15
  value: checked
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.mjs","names":["Checkbox: FC<CheckboxProps>","checkboxStyles: CSSProperties","Block","Flexbox","Text"],"sources":["../../src/Checkbox/Checkbox.tsx"],"sourcesContent":["import { cx } from 'antd-style';\nimport { CheckIcon, Minus } from 'lucide-react';\nimport type { CSSProperties, FC, MouseEvent } from 'react';\nimport useMergeState from 'use-merge-value';\n\nimport Block from '@/Block';\nimport { Flexbox } from '@/Flex';\nimport Text from '@/Text';\n\nimport { styles } from './style';\nimport type { CheckboxProps } from './type';\n\nconst Checkbox: FC<CheckboxProps> = ({\n checked,\n defaultChecked,\n onChange,\n size = 16,\n className,\n style,\n children,\n textProps,\n backgroundColor,\n classNames,\n styles: customStyles,\n shape = 'square',\n disabled,\n indeterminate,\n ...rest\n}) => {\n const [value, setValue] = useMergeState(defaultChecked || false, {\n defaultValue: defaultChecked,\n onChange,\n value: checked,\n });\n\n const checkboxStyles: CSSProperties = {\n borderRadius: shape === 'square' ? `max(4px, ${Math.round(size / 4)}px)` : '50%',\n ...style,\n ...customStyles?.checkbox,\n };\n\n const handleClick = (e?: MouseEvent) => {\n if (!disabled) {\n e?.preventDefault();\n setValue(!value);\n }\n };\n\n const isIndeterminate = indeterminate;\n const isChecked = !isIndeterminate && value;\n\n const checkIcon = (\n <Block\n align={'center'}\n className={cx(\n styles.root,\n isChecked && styles.checked,\n isIndeterminate && styles.indeterminate,\n disabled && styles.disabled,\n className,\n classNames?.checkbox,\n )}\n flex={'none'}\n height={size}\n justify={'center'}\n onClick={handleClick}\n style={\n backgroundColor && (isChecked || isIndeterminate)\n ? { backgroundColor, borderColor: backgroundColor, ...checkboxStyles }\n : { ...checkboxStyles }\n }\n variant={'outlined'}\n width={size}\n {...rest}\n >\n {isIndeterminate ? (\n <Minus\n size={size}\n strokeWidth={3}\n style={{\n transform: `scale(${shape === 'square' ? 0.75 : 0.66})`,\n }}\n />\n ) : isChecked ? (\n <CheckIcon\n size={size}\n strokeWidth={3}\n style={{\n transform: `scale(${shape === 'square' ? 0.75 : 0.66})`,\n }}\n />\n ) : null}\n </Block>\n );\n\n if (!children) return checkIcon;\n\n return (\n <Flexbox\n align={'center'}\n className={classNames?.wrapper}\n gap={Math.floor(size / 2)}\n horizontal\n onClick={handleClick}\n style={{\n cursor: disabled ? 'not-allowed' : 'pointer',\n userSelect: 'none',\n ...customStyles?.wrapper,\n }}\n >\n {checkIcon}\n <Text\n as={'span'}\n className={cx(classNames?.text)}\n style={customStyles?.text}\n {...textProps}\n type={disabled ? 'secondary' : textProps?.type}\n >\n {children}\n </Text>\n </Flexbox>\n );\n};\n\nCheckbox.displayName = 'Checkbox';\n\nexport default Checkbox;\n"],"mappings":";;;;;;;;;;AAYA,MAAMA,YAA+B,EACnC,SACA,gBACA,UACA,OAAO,IACP,WACA,OACA,UACA,WACA,iBACA,YACA,QAAQ,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c,WAAW;GAEzC;IACI;GACC;;AAId,SAAS,cAAc;AAEvB,uBAAe"}
1
+ {"version":3,"file":"Checkbox.mjs","names":["Checkbox: FC<CheckboxProps>","useMergeState","checkboxStyles: CSSProperties","Block","Flexbox","Text"],"sources":["../../src/Checkbox/Checkbox.tsx"],"sourcesContent":["import { cx } from 'antd-style';\nimport { CheckIcon, Minus } from 'lucide-react';\nimport type { CSSProperties, FC, MouseEvent } from 'react';\nimport useMergeState from 'use-merge-value';\n\nimport Block from '@/Block';\nimport { Flexbox } from '@/Flex';\nimport Text from '@/Text';\n\nimport { styles } from './style';\nimport type { CheckboxProps } from './type';\n\nconst Checkbox: FC<CheckboxProps> = ({\n checked,\n defaultChecked,\n onChange,\n size = 16,\n className,\n style,\n children,\n textProps,\n backgroundColor,\n classNames,\n styles: customStyles,\n shape = 'square',\n disabled,\n indeterminate,\n ...rest\n}) => {\n const [value, setValue] = useMergeState(defaultChecked || false, {\n defaultValue: defaultChecked,\n onChange,\n value: checked,\n });\n\n const checkboxStyles: CSSProperties = {\n borderRadius: shape === 'square' ? `max(4px, ${Math.round(size / 4)}px)` : '50%',\n ...style,\n ...customStyles?.checkbox,\n };\n\n const handleClick = (e?: MouseEvent) => {\n if (!disabled) {\n e?.preventDefault();\n setValue(!value);\n }\n };\n\n const isIndeterminate = indeterminate;\n const isChecked = !isIndeterminate && value;\n\n const checkIcon = (\n <Block\n align={'center'}\n className={cx(\n styles.root,\n isChecked && styles.checked,\n isIndeterminate && styles.indeterminate,\n disabled && styles.disabled,\n className,\n classNames?.checkbox,\n )}\n flex={'none'}\n height={size}\n justify={'center'}\n onClick={handleClick}\n style={\n backgroundColor && (isChecked || isIndeterminate)\n ? { backgroundColor, borderColor: backgroundColor, ...checkboxStyles }\n : { ...checkboxStyles }\n }\n variant={'outlined'}\n width={size}\n {...rest}\n >\n {isIndeterminate ? (\n <Minus\n size={size}\n strokeWidth={3}\n style={{\n transform: `scale(${shape === 'square' ? 0.75 : 0.66})`,\n }}\n />\n ) : isChecked ? (\n <CheckIcon\n size={size}\n strokeWidth={3}\n style={{\n transform: `scale(${shape === 'square' ? 0.75 : 0.66})`,\n }}\n />\n ) : null}\n </Block>\n );\n\n if (!children) return checkIcon;\n\n return (\n <Flexbox\n align={'center'}\n className={classNames?.wrapper}\n gap={Math.floor(size / 2)}\n horizontal\n onClick={handleClick}\n style={{\n cursor: disabled ? 'not-allowed' : 'pointer',\n userSelect: 'none',\n ...customStyles?.wrapper,\n }}\n >\n {checkIcon}\n <Text\n as={'span'}\n className={cx(classNames?.text)}\n style={customStyles?.text}\n {...textProps}\n type={disabled ? 'secondary' : textProps?.type}\n >\n {children}\n </Text>\n </Flexbox>\n );\n};\n\nCheckbox.displayName = 'Checkbox';\n\nexport default Checkbox;\n"],"mappings":";;;;;;;;;;AAYA,MAAMA,YAA+B,EACnC,SACA,gBACA,UACA,OAAO,IACP,WACA,OACA,UACA,WACA,iBACA,YACA,QAAQ,cACR,QAAQ,UACR,UACA,eACA,GAAG,WACC;CACJ,MAAM,CAAC,OAAO,YAAYC,mBAAc,kBAAkB,OAAO;EAC/D,cAAc;EACd;EACA,OAAO;EACR,CAAC;CAEF,MAAMC,iBAAgC;EACpC,cAAc,UAAU,WAAW,YAAY,KAAK,MAAM,OAAO,EAAE,CAAC,OAAO;EAC3E,GAAG;EACH,GAAG,cAAc;EAClB;CAED,MAAM,eAAe,MAAmB;AACtC,MAAI,CAAC,UAAU;AACb,MAAG,gBAAgB;AACnB,YAAS,CAAC,MAAM;;;CAIpB,MAAM,kBAAkB;CACxB,MAAM,YAAY,CAAC,mBAAmB;CAEtC,MAAM,YACJ,oBAACC;EACC,OAAO;EACP,WAAW,GACT,OAAO,MACP,aAAa,OAAO,SACpB,mBAAmB,OAAO,eAC1B,YAAY,OAAO,UACnB,WACA,YAAY,SACb;EACD,MAAM;EACN,QAAQ;EACR,SAAS;EACT,SAAS;EACT,OACE,oBAAoB,aAAa,mBAC7B;GAAE;GAAiB,aAAa;GAAiB,GAAG;GAAgB,GACpE,EAAE,GAAG,gBAAgB;EAE3B,SAAS;EACT,OAAO;EACP,GAAI;YAEH,kBACC,oBAAC;GACO;GACN,aAAa;GACb,OAAO,EACL,WAAW,SAAS,UAAU,WAAW,MAAO,IAAK,IACtD;IACD,GACA,YACF,oBAAC;GACO;GACN,aAAa;GACb,OAAO,EACL,WAAW,SAAS,UAAU,WAAW,MAAO,IAAK,IACtD;IACD,GACA;GACE;AAGV,KAAI,CAAC,SAAU,QAAO;AAEtB,QACE,qBAACC;EACC,OAAO;EACP,WAAW,YAAY;EACvB,KAAK,KAAK,MAAM,OAAO,EAAE;EACzB;EACA,SAAS;EACT,OAAO;GACL,QAAQ,WAAW,gBAAgB;GACnC,YAAY;GACZ,GAAG,cAAc;GAClB;aAEA,WACD,oBAACC;GACC,IAAI;GACJ,WAAW,GAAG,YAAY,KAAK;GAC/B,OAAO,cAAc;GACrB,GAAI;GACJ,MAAM,WAAW,cAAc,WAAW;GAEzC;IACI;GACC;;AAId,SAAS,cAAc;AAEvB,uBAAe"}
@@ -1,11 +1,11 @@
1
1
  import FlexBasic_default from "../Flex/FlexBasic.mjs";
2
2
  import Checkbox_default from "./Checkbox.mjs";
3
3
  import { jsx } from "react/jsx-runtime";
4
- import useMergeState from "use-merge-value";
4
+ import useControlledState from "use-merge-value";
5
5
 
6
6
  //#region src/Checkbox/CheckboxGroup.tsx
7
7
  const CheckboxGroup = ({ defaultValue, disabled, onChange, options, textProps, value, shape, size, ...rest }) => {
8
- const [selectedValues, setSelectedValues] = useMergeState(defaultValue || [], {
8
+ const [selectedValues, setSelectedValues] = useControlledState(defaultValue || [], {
9
9
  defaultValue,
10
10
  onChange,
11
11
  value
@@ -1 +1 @@
1
- {"version":3,"file":"CheckboxGroup.mjs","names":["CheckboxGroup: FC<CheckboxGroupProps>","Flexbox","Checkbox"],"sources":["../../src/Checkbox/CheckboxGroup.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport useMergeState from 'use-merge-value';\n\nimport { Flexbox } from '@/Flex';\n\nimport Checkbox from './Checkbox';\nimport type { CheckboxGroupProps } from './type';\n\nconst CheckboxGroup: FC<CheckboxGroupProps> = ({\n defaultValue,\n disabled,\n onChange,\n options,\n textProps,\n value,\n shape,\n size,\n ...rest\n}) => {\n const [selectedValues, setSelectedValues] = useMergeState<string[]>(defaultValue || [], {\n defaultValue,\n onChange,\n value,\n });\n\n const handleChange = (optionValue: string, checked: boolean) => {\n const newValues = checked\n ? [...selectedValues, optionValue]\n : selectedValues.filter((v) => v !== optionValue);\n\n setSelectedValues(newValues);\n };\n\n const normalizedOptions = options.map((option) => {\n if (typeof option === 'string') {\n return {\n disabled: false,\n label: option,\n value: option,\n };\n }\n return option;\n });\n\n return (\n <Flexbox align={'center'} gap={16} horizontal wrap={'wrap'} {...rest}>\n {normalizedOptions.map((option) => {\n const isChecked = selectedValues.includes(option.value);\n const isDisabled = disabled || option.disabled;\n\n return (\n <Checkbox\n checked={isChecked}\n disabled={isDisabled}\n key={String(option.value)}\n onChange={(checked) => handleChange(option.value, checked)}\n shape={shape}\n size={size}\n textProps={textProps}\n >\n {option.label}\n </Checkbox>\n );\n })}\n </Flexbox>\n );\n};\n\nCheckboxGroup.displayName = 'CheckboxGroup';\n\nexport default CheckboxGroup;\n"],"mappings":";;;;;;AAQA,MAAMA,iBAAyC,EAC7C,cACA,UACA,UACA,SACA,WACA,OACA,OACA,MACA,GAAG,WACC;CACJ,MAAM,CAAC,gBAAgB,qBAAqB,cAAwB,gBAAgB,EAAE,EAAE;EACtF;EACA;EACA;EACD,CAAC;CAEF,MAAM,gBAAgB,aAAqB,YAAqB;AAK9D,oBAJkB,UACd,CAAC,GAAG,gBAAgB,YAAY,GAChC,eAAe,QAAQ,MAAM,MAAM,YAAY,CAEvB;;CAG9B,MAAM,oBAAoB,QAAQ,KAAK,WAAW;AAChD,MAAI,OAAO,WAAW,SACpB,QAAO;GACL,UAAU;GACV,OAAO;GACP,OAAO;GACR;AAEH,SAAO;GACP;AAEF,QACE,oBAACC;EAAQ,OAAO;EAAU,KAAK;EAAI;EAAW,MAAM;EAAQ,GAAI;YAC7D,kBAAkB,KAAK,WAAW;AAIjC,UACE,oBAACC;IACC,SALc,eAAe,SAAS,OAAO,MAAM;IAMnD,UALe,YAAY,OAAO;IAOlC,WAAW,YAAY,aAAa,OAAO,OAAO,QAAQ;IACnD;IACD;IACK;cAEV,OAAO;MANH,OAAO,OAAO,MAAM,CAOhB;IAEb;GACM;;AAId,cAAc,cAAc;AAE5B,4BAAe"}
1
+ {"version":3,"file":"CheckboxGroup.mjs","names":["CheckboxGroup: FC<CheckboxGroupProps>","useMergeState","Flexbox","Checkbox"],"sources":["../../src/Checkbox/CheckboxGroup.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport useMergeState from 'use-merge-value';\n\nimport { Flexbox } from '@/Flex';\n\nimport Checkbox from './Checkbox';\nimport type { CheckboxGroupProps } from './type';\n\nconst CheckboxGroup: FC<CheckboxGroupProps> = ({\n defaultValue,\n disabled,\n onChange,\n options,\n textProps,\n value,\n shape,\n size,\n ...rest\n}) => {\n const [selectedValues, setSelectedValues] = useMergeState<string[]>(defaultValue || [], {\n defaultValue,\n onChange,\n value,\n });\n\n const handleChange = (optionValue: string, checked: boolean) => {\n const newValues = checked\n ? [...selectedValues, optionValue]\n : selectedValues.filter((v) => v !== optionValue);\n\n setSelectedValues(newValues);\n };\n\n const normalizedOptions = options.map((option) => {\n if (typeof option === 'string') {\n return {\n disabled: false,\n label: option,\n value: option,\n };\n }\n return option;\n });\n\n return (\n <Flexbox align={'center'} gap={16} horizontal wrap={'wrap'} {...rest}>\n {normalizedOptions.map((option) => {\n const isChecked = selectedValues.includes(option.value);\n const isDisabled = disabled || option.disabled;\n\n return (\n <Checkbox\n checked={isChecked}\n disabled={isDisabled}\n key={String(option.value)}\n onChange={(checked) => handleChange(option.value, checked)}\n shape={shape}\n size={size}\n textProps={textProps}\n >\n {option.label}\n </Checkbox>\n );\n })}\n </Flexbox>\n );\n};\n\nCheckboxGroup.displayName = 'CheckboxGroup';\n\nexport default CheckboxGroup;\n"],"mappings":";;;;;;AAQA,MAAMA,iBAAyC,EAC7C,cACA,UACA,UACA,SACA,WACA,OACA,OACA,MACA,GAAG,WACC;CACJ,MAAM,CAAC,gBAAgB,qBAAqBC,mBAAwB,gBAAgB,EAAE,EAAE;EACtF;EACA;EACA;EACD,CAAC;CAEF,MAAM,gBAAgB,aAAqB,YAAqB;AAK9D,oBAJkB,UACd,CAAC,GAAG,gBAAgB,YAAY,GAChC,eAAe,QAAQ,MAAM,MAAM,YAAY,CAEvB;;CAG9B,MAAM,oBAAoB,QAAQ,KAAK,WAAW;AAChD,MAAI,OAAO,WAAW,SACpB,QAAO;GACL,UAAU;GACV,OAAO;GACP,OAAO;GACR;AAEH,SAAO;GACP;AAEF,QACE,oBAACC;EAAQ,OAAO;EAAU,KAAK;EAAI;EAAW,MAAM;EAAQ,GAAI;YAC7D,kBAAkB,KAAK,WAAW;AAIjC,UACE,oBAACC;IACC,SALc,eAAe,SAAS,OAAO,MAAM;IAMnD,UALe,YAAY,OAAO;IAOlC,WAAW,YAAY,aAAa,OAAO,OAAO,QAAQ;IACnD;IACD;IACK;cAEV,OAAO;MANH,OAAO,OAAO,MAAM,CAOhB;IAEb;GACM;;AAId,cAAc,cAAc;AAE5B,4BAAe"}
@@ -1,8 +1,8 @@
1
1
  import { CodeDiffProps } from "./type.mjs";
2
- import * as react43 from "react";
2
+ import * as react63 from "react";
3
3
 
4
4
  //#region src/CodeDiff/CodeDiff.d.ts
5
- declare const CodeDiff: react43.NamedExoticComponent<CodeDiffProps>;
5
+ declare const CodeDiff: react63.NamedExoticComponent<CodeDiffProps>;
6
6
  //#endregion
7
7
  export { CodeDiff };
8
8
  //# sourceMappingURL=CodeDiff.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { PatchDiffProps } from "./type.mjs";
2
- import * as react44 from "react";
2
+ import * as react64 from "react";
3
3
 
4
4
  //#region src/CodeDiff/PatchDiff.d.ts
5
- declare const PatchDiff: react44.NamedExoticComponent<PatchDiffProps>;
5
+ declare const PatchDiff: react64.NamedExoticComponent<PatchDiffProps>;
6
6
  //#endregion
7
7
  export { PatchDiff };
8
8
  //# sourceMappingURL=PatchDiff.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { CodeEditorProps } from "./type.mjs";
2
- import * as react42 from "react";
2
+ import * as react62 from "react";
3
3
 
4
4
  //#region src/CodeEditor/CodeEditor.d.ts
5
- declare const CodeEditor: react42.NamedExoticComponent<CodeEditorProps>;
5
+ declare const CodeEditor: react62.NamedExoticComponent<CodeEditorProps>;
6
6
  //#endregion
7
7
  export { CodeEditor };
8
8
  //# sourceMappingURL=CodeEditor.d.mts.map
@@ -6,11 +6,11 @@ import SyntaxHighlighter_default from "../Highlighter/SyntaxHighlighter/index.mj
6
6
  import { memo } from "react";
7
7
  import { jsx, jsxs } from "react/jsx-runtime";
8
8
  import { cssVar, cx } from "antd-style";
9
- import useMergeState from "use-merge-value";
9
+ import useControlledState from "use-merge-value";
10
10
 
11
11
  //#region src/CodeEditor/CodeEditor.tsx
12
12
  const CodeEditor = memo(({ autoFocus, classNames, styles: customStyles, defaultValue = "", onChange, placeholder = "", style, className, onValueChange, value, language = "markdown", variant = "borderless", width, height, flex, ref, ...rest }) => {
13
- const [code, setCode] = useMergeState(defaultValue, {
13
+ const [code, setCode] = useControlledState(defaultValue, {
14
14
  defaultValue,
15
15
  onChange: onValueChange,
16
16
  value
@@ -1 +1 @@
1
- {"version":3,"file":"CodeEditor.mjs","names":["Flexbox","SyntaxHighlighter"],"sources":["../../src/CodeEditor/CodeEditor.tsx"],"sourcesContent":["'use client';\n\nimport { cssVar, cx } from 'antd-style';\nimport { memo } from 'react';\nimport useMergeState from 'use-merge-value';\n\nimport { styles, variants } from '@/CodeEditor/style';\nimport { Flexbox } from '@/Flex';\nimport SyntaxHighlighter from '@/Highlighter/SyntaxHighlighter';\n\nimport { CodeEditorProps } from './type';\n\nconst CodeEditor = memo<CodeEditorProps>(\n ({\n autoFocus,\n classNames,\n styles: customStyles,\n defaultValue = '',\n onChange,\n placeholder = '',\n style,\n className,\n onValueChange,\n value,\n language = 'markdown',\n variant = 'borderless',\n width,\n height,\n flex,\n ref,\n ...rest\n }) => {\n const [code, setCode] = useMergeState(defaultValue, {\n defaultValue,\n onChange: onValueChange,\n value,\n });\n\n return (\n <Flexbox\n className={cx(variants({ variant }), className)}\n flex={flex}\n height={height}\n style={style}\n width={width}\n >\n {value ? (\n <SyntaxHighlighter\n className={cx(styles.highlight, classNames?.highlight)}\n language={language}\n style={customStyles?.highlight}\n variant={variant}\n >\n {value}\n </SyntaxHighlighter>\n ) : (\n <pre\n className={cx(styles.highlight, classNames?.highlight)}\n style={{\n color: cssVar.colorTextDescription,\n }}\n >\n {placeholder || ' '}\n </pre>\n )}\n\n <textarea\n autoCapitalize=\"off\"\n autoComplete=\"off\"\n autoCorrect=\"off\"\n autoFocus={autoFocus}\n className={cx(styles.textarea, classNames?.textarea)}\n data-gramm={false}\n onChange={(e) => {\n onChange?.(e);\n setCode(e.target.value);\n }}\n ref={ref}\n style={customStyles?.textarea}\n value={code}\n {...rest}\n />\n </Flexbox>\n );\n },\n);\n\nCodeEditor.displayName = 'CodeEditor';\n\nexport default CodeEditor;\n"],"mappings":";;;;;;;;;;;AAYA,MAAM,aAAa,MAChB,EACC,WACA,YACA,QAAQ,cACR,eAAe,IACf,UACA,cAAc,IACd,OACA,WACA,eACA,OACA,WAAW,YACX,UAAU,cACV,OACA,QACA,MACA,KACA,GAAG,WACC;CACJ,MAAM,CAAC,MAAM,WAAW,cAAc,cAAc;EAClD;EACA,UAAU;EACV;EACD,CAAC;AAEF,QACE,qBAACA;EACC,WAAW,GAAG,SAAS,EAAE,SAAS,CAAC,EAAE,UAAU;EACzC;EACE;EACD;EACA;aAEN,QACC,oBAACC;GACC,WAAW,GAAG,OAAO,WAAW,YAAY,UAAU;GAC5C;GACV,OAAO,cAAc;GACZ;aAER;IACiB,GAEpB,oBAAC;GACC,WAAW,GAAG,OAAO,WAAW,YAAY,UAAU;GACtD,OAAO,EACL,OAAO,OAAO,sBACf;aAEA,eAAe;IACZ,EAGR,oBAAC;GACC,gBAAe;GACf,cAAa;GACb,aAAY;GACD;GACX,WAAW,GAAG,OAAO,UAAU,YAAY,SAAS;GACpD,cAAY;GACZ,WAAW,MAAM;AACf,eAAW,EAAE;AACb,YAAQ,EAAE,OAAO,MAAM;;GAEpB;GACL,OAAO,cAAc;GACrB,OAAO;GACP,GAAI;IACJ;GACM;EAGf;AAED,WAAW,cAAc;AAEzB,yBAAe"}
1
+ {"version":3,"file":"CodeEditor.mjs","names":["useMergeState","Flexbox","SyntaxHighlighter"],"sources":["../../src/CodeEditor/CodeEditor.tsx"],"sourcesContent":["'use client';\n\nimport { cssVar, cx } from 'antd-style';\nimport { memo } from 'react';\nimport useMergeState from 'use-merge-value';\n\nimport { styles, variants } from '@/CodeEditor/style';\nimport { Flexbox } from '@/Flex';\nimport SyntaxHighlighter from '@/Highlighter/SyntaxHighlighter';\n\nimport { CodeEditorProps } from './type';\n\nconst CodeEditor = memo<CodeEditorProps>(\n ({\n autoFocus,\n classNames,\n styles: customStyles,\n defaultValue = '',\n onChange,\n placeholder = '',\n style,\n className,\n onValueChange,\n value,\n language = 'markdown',\n variant = 'borderless',\n width,\n height,\n flex,\n ref,\n ...rest\n }) => {\n const [code, setCode] = useMergeState(defaultValue, {\n defaultValue,\n onChange: onValueChange,\n value,\n });\n\n return (\n <Flexbox\n className={cx(variants({ variant }), className)}\n flex={flex}\n height={height}\n style={style}\n width={width}\n >\n {value ? (\n <SyntaxHighlighter\n className={cx(styles.highlight, classNames?.highlight)}\n language={language}\n style={customStyles?.highlight}\n variant={variant}\n >\n {value}\n </SyntaxHighlighter>\n ) : (\n <pre\n className={cx(styles.highlight, classNames?.highlight)}\n style={{\n color: cssVar.colorTextDescription,\n }}\n >\n {placeholder || ' '}\n </pre>\n )}\n\n <textarea\n autoCapitalize=\"off\"\n autoComplete=\"off\"\n autoCorrect=\"off\"\n autoFocus={autoFocus}\n className={cx(styles.textarea, classNames?.textarea)}\n data-gramm={false}\n onChange={(e) => {\n onChange?.(e);\n setCode(e.target.value);\n }}\n ref={ref}\n style={customStyles?.textarea}\n value={code}\n {...rest}\n />\n </Flexbox>\n );\n },\n);\n\nCodeEditor.displayName = 'CodeEditor';\n\nexport default CodeEditor;\n"],"mappings":";;;;;;;;;;;AAYA,MAAM,aAAa,MAChB,EACC,WACA,YACA,QAAQ,cACR,eAAe,IACf,UACA,cAAc,IACd,OACA,WACA,eACA,OACA,WAAW,YACX,UAAU,cACV,OACA,QACA,MACA,KACA,GAAG,WACC;CACJ,MAAM,CAAC,MAAM,WAAWA,mBAAc,cAAc;EAClD;EACA,UAAU;EACV;EACD,CAAC;AAEF,QACE,qBAACC;EACC,WAAW,GAAG,SAAS,EAAE,SAAS,CAAC,EAAE,UAAU;EACzC;EACE;EACD;EACA;aAEN,QACC,oBAACC;GACC,WAAW,GAAG,OAAO,WAAW,YAAY,UAAU;GAC5C;GACV,OAAO,cAAc;GACZ;aAER;IACiB,GAEpB,oBAAC;GACC,WAAW,GAAG,OAAO,WAAW,YAAY,UAAU;GACtD,OAAO,EACL,OAAO,OAAO,sBACf;aAEA,eAAe;IACZ,EAGR,oBAAC;GACC,gBAAe;GACf,cAAa;GACb,aAAY;GACD;GACX,WAAW,GAAG,OAAO,UAAU,YAAY,SAAS;GACpD,cAAY;GACZ,WAAW,MAAM;AACf,eAAW,EAAE;AACb,YAAQ,EAAE,OAAO,MAAM;;GAEpB;GACL,OAAO,cAAc;GACrB,OAAO;GACP,GAAI;IACJ;GACM;EAGf;AAED,WAAW,cAAc;AAEzB,yBAAe"}
@@ -1,8 +1,8 @@
1
1
  import { CollapseProps } from "./type.mjs";
2
- import * as react6 from "react";
2
+ import * as react61 from "react";
3
3
 
4
4
  //#region src/Collapse/Collapse.d.ts
5
- declare const Collapse: react6.NamedExoticComponent<CollapseProps>;
5
+ declare const Collapse: react61.NamedExoticComponent<CollapseProps>;
6
6
  //#endregion
7
7
  export { Collapse };
8
8
  //# sourceMappingURL=Collapse.d.mts.map
@@ -10,14 +10,14 @@ import { useMemo } from "react";
10
10
  import { jsx, jsxs } from "react/jsx-runtime";
11
11
  import { ColorPicker } from "antd";
12
12
  import { cssVar, cx } from "antd-style";
13
- import useMergeState from "use-merge-value";
13
+ import useControlledState from "use-merge-value";
14
14
  import { rgba } from "polished";
15
15
  import { CheckIcon } from "lucide-react";
16
16
  import chroma from "chroma-js";
17
17
 
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
- const [active, setActive] = useMergeState(defaultValue, {
20
+ const [active, setActive] = useControlledState(defaultValue, {
21
21
  defaultValue,
22
22
  onChange,
23
23
  value
@@ -1 +1 @@
1
- {"version":3,"file":"ColorSwatches.mjs","names":["ColorSwatches: FC<ColorSwatchesProps>","Flexbox","Tooltip","Center","Icon"],"sources":["../../src/ColorSwatches/ColorSwatches.tsx"],"sourcesContent":["'use client';\n\nimport { ColorPicker } from 'antd';\nimport { cssVar, cx } 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 [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 || cssVar.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(') ? cssVar.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,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,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,EAAE,SAAS,OAAO;GAChC,MAAM,WAAY,CAAC,UAAU,CAAC,EAAE,SAAU,UAAU;GAEpD,MAAM,gBACJ,EAAE,UAAU,iBACX,EAAE,SACD,CAAC,EAAE,MAAM,WAAW,OAAO,WACpB;AACL,QAAI;AACF,YAAO,OAAO,EAAE,MAAM,CAAC,OAAO,KAAK;YAC7B;AACN,YAAO;;OAEP;GAER,MAAM,yBAAyB,EAAE,OAAO,WAAW,OAAO,GAAG,OAAO,eAAe;AACnF,UACE,oBAACC;IAA0B,OAAO,EAAE;cAClC,oBAACC;KACC,WAAW,GACT,OAAO,WACP,iBAAiB,OAAO,aACxB,YAAY,OAAO,OACpB;KACD,eAAe,UAAU,EAAE,SAAS,OAAU;KAC9C,OAAO;MACL,YAAY,gBAAgB,SAAY;MACxC,cAAc,UAAU,WAAW,QAAQ,OAAO;MACnD;eAEA,YACC,oBAACC;MACC,OAAO,KAAK,kBAAkB,uBAAuB,EAAE,IAAK;MAC5D,MAAM;MACN,MAAM;OAAE,MAAM;OAAI,aAAa;OAAG;MAClC,OAAO,EACL,eAAe,QAChB;OACD;MAEG;MAvBG,GAAG,OAAO,EAwBd;IAEZ,EACH,qBACC,oBAACF;GAAQ,OAAO,OAAO,UAAU;aAC/B,oBAAC;IACC,OAAO;IACP,WAAW,GACT,OAAO,QACP,uBAAuB,OAAO,OAC9B,kBAAkB,OAAO,OAC1B;IACD,cAAc,OAAO;IACrB;IACA,QAAQ;IACR,mBAAmB,MAAM;AACvB,SAAI,EAAE,aAAa,KAAK,OAAO,aAC7B,WAAU,GAAG;SAEb,WAAU,EAAE,aAAa,CAAC;;IAG9B,SACE,sBACI,SACA,CACE;KACE,QAAQ,OAAO,KAAK,MAAM,EAAE,MAAM;KAClC,OAAO,OAAO,WAAW;KAC1B,CACF;IAEP,OAAO,EACL,cAAc,UAAU,WAAW,QAAQ,OAAO,cACnD;IACD,OAAO,sBAAsB,SAAY;KACzC;IACM;GAEJ;;AAId,cAAc,cAAc;AAE5B,4BAAe"}
1
+ {"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 } 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 [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 || cssVar.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(') ? cssVar.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,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,EAAE,SAAS,OAAO;GAChC,MAAM,WAAY,CAAC,UAAU,CAAC,EAAE,SAAU,UAAU;GAEpD,MAAM,gBACJ,EAAE,UAAU,iBACX,EAAE,SACD,CAAC,EAAE,MAAM,WAAW,OAAO,WACpB;AACL,QAAI;AACF,YAAO,OAAO,EAAE,MAAM,CAAC,OAAO,KAAK;YAC7B;AACN,YAAO;;OAEP;GAER,MAAM,yBAAyB,EAAE,OAAO,WAAW,OAAO,GAAG,OAAO,eAAe;AACnF,UACE,oBAACC;IAA0B,OAAO,EAAE;cAClC,oBAACC;KACC,WAAW,GACT,OAAO,WACP,iBAAiB,OAAO,aACxB,YAAY,OAAO,OACpB;KACD,eAAe,UAAU,EAAE,SAAS,OAAU;KAC9C,OAAO;MACL,YAAY,gBAAgB,SAAY;MACxC,cAAc,UAAU,WAAW,QAAQ,OAAO;MACnD;eAEA,YACC,oBAACC;MACC,OAAO,KAAK,kBAAkB,uBAAuB,EAAE,IAAK;MAC5D,MAAM;MACN,MAAM;OAAE,MAAM;OAAI,aAAa;OAAG;MAClC,OAAO,EACL,eAAe,QAChB;OACD;MAEG;MAvBG,GAAG,OAAO,EAwBd;IAEZ,EACH,qBACC,oBAACF;GAAQ,OAAO,OAAO,UAAU;aAC/B,oBAAC;IACC,OAAO;IACP,WAAW,GACT,OAAO,QACP,uBAAuB,OAAO,OAC9B,kBAAkB,OAAO,OAC1B;IACD,cAAc,OAAO;IACrB;IACA,QAAQ;IACR,mBAAmB,MAAM;AACvB,SAAI,EAAE,aAAa,KAAK,OAAO,aAC7B,WAAU,GAAG;SAEb,WAAU,EAAE,aAAa,CAAC;;IAG9B,SACE,sBACI,SACA,CACE;KACE,QAAQ,OAAO,KAAK,MAAM,EAAE,MAAM;KAClC,OAAO,OAAO,WAAW;KAC1B,CACF;IAEP,OAAO,EACL,cAAc,UAAU,WAAW,QAAQ,OAAO,cACnD;IACD,OAAO,sBAAsB,SAAY;KACzC;IACM;GAEJ;;AAId,cAAc,cAAc;AAE5B,4BAAe"}
@@ -1,7 +1,7 @@
1
1
  import { MotionComponentType } from "../MotionProvider/index.mjs";
2
2
  import { TranslationResourcesInput } from "../i18n/types.mjs";
3
3
  import { CDN, CdnApi } from "../utils/genCdnUrl.mjs";
4
- import * as react49 from "react";
4
+ import * as react68 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: react49.NamedExoticComponent<ConfigProviderProps>;
22
+ declare const ConfigProvider: react68.NamedExoticComponent<ConfigProviderProps>;
23
23
  type CdnFn = ({
24
24
  pkg,
25
25
  version,
@@ -1,8 +1,8 @@
1
- import * as react89 from "react";
2
- import * as react_jsx_runtime51 from "react/jsx-runtime";
1
+ import * as react124 from "react";
2
+ import * as react_jsx_runtime57 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/ContextMenu/ContextMenuHost.d.ts
5
- declare const ContextMenuHost: react89.MemoExoticComponent<() => react_jsx_runtime51.JSX.Element | null>;
5
+ declare const ContextMenuHost: react124.MemoExoticComponent<() => react_jsx_runtime57.JSX.Element | null>;
6
6
  //#endregion
7
7
  export { ContextMenuHost };
8
8
  //# sourceMappingURL=ContextMenuHost.d.mts.map
@@ -173,6 +173,7 @@ const renderContextMenuItems = (items, keyPath = [], options) => {
173
173
  }), /* @__PURE__ */ jsx(ContextMenu.Portal, { children: /* @__PURE__ */ jsx(ContextMenu.Positioner, {
174
174
  alignOffset: -4,
175
175
  className: styles.positioner,
176
+ "data-submenu": "",
176
177
  onContextMenu: preventDefaultAndStopPropagation,
177
178
  sideOffset: -1,
178
179
  children: /* @__PURE__ */ jsx(ContextMenu.Popup, {
@@ -1 +1 @@
1
- {"version":3,"file":"renderItems.mjs","names":["common","info: MenuInfo","label","labelText","isDanger","Icon"],"sources":["../../src/ContextMenu/renderItems.tsx"],"sourcesContent":["import { ContextMenu } from '@base-ui/react/context-menu';\nimport { Switch } from 'antd';\nimport { cx } from 'antd-style';\nimport { Check, ChevronRight } from 'lucide-react';\nimport type { MenuInfo } from 'rc-menu/es/interface';\nimport type {\n KeyboardEvent as ReactKeyboardEvent,\n MouseEvent as ReactMouseEvent,\n ReactNode,\n} from 'react';\nimport { memo, useCallback, useState } from 'react';\n\nimport Icon from '@/Icon';\nimport {\n type MenuDividerType,\n type MenuItemGroupType,\n type MenuItemType,\n type RenderItemContentOptions,\n type RenderOptions,\n type SubMenuType,\n getItemKey,\n getItemLabel,\n hasAnyIcon,\n hasCheckboxAndIcon,\n renderIcon,\n} from '@/Menu';\nimport common from '@/i18n/resources/en/common';\nimport { useTranslation } from '@/i18n/useTranslation';\nimport { preventDefaultAndStopPropagation } from '@/utils/dom';\n\nimport { styles } from './style';\nimport type { ContextMenuCheckboxItem, ContextMenuItem, ContextMenuSwitchItem } from './type';\n\nexport type { IconSpaceMode } from '@/Menu';\n\nconst EmptyMenuItem = memo(() => {\n const { t } = useTranslation(common);\n return (\n <ContextMenu.Item className={cx(styles.item, styles.empty)} disabled>\n <div className={styles.itemContent}>\n <span className={styles.label}>{t('common.empty')}</span>\n </div>\n </ContextMenu.Item>\n );\n});\n\nEmptyMenuItem.displayName = 'EmptyMenuItem';\n\ninterface ContextMenuSwitchItemInternalProps {\n checked?: boolean;\n children: ReactNode;\n closeOnClick?: boolean;\n danger?: boolean;\n defaultChecked?: boolean;\n disabled?: boolean;\n label?: string;\n onCheckedChange?: (checked: boolean) => void;\n}\n\nconst ContextMenuSwitchItemInternal = ({\n checked: checkedProp,\n children,\n closeOnClick = false,\n danger,\n defaultChecked,\n disabled,\n label,\n onCheckedChange,\n}: ContextMenuSwitchItemInternalProps) => {\n const [internalChecked, setInternalChecked] = useState(defaultChecked ?? false);\n const isControlled = checkedProp !== undefined;\n const checked = isControlled ? checkedProp : internalChecked;\n\n const handleCheckedChange = useCallback(\n (newChecked: boolean) => {\n if (!isControlled) {\n setInternalChecked(newChecked);\n }\n onCheckedChange?.(newChecked);\n },\n [isControlled, onCheckedChange],\n );\n\n return (\n <ContextMenu.Item\n className={cx(styles.item, danger && styles.danger)}\n closeOnClick={closeOnClick}\n disabled={disabled}\n label={label}\n onClick={(e) => {\n e.preventDefault();\n if (!disabled) {\n handleCheckedChange(!checked);\n }\n }}\n >\n {children}\n <Switch\n checked={checked}\n disabled={disabled}\n onChange={handleCheckedChange}\n onClick={(_, e) => e.stopPropagation()}\n size=\"small\"\n style={{ marginInlineStart: 16 }}\n />\n </ContextMenu.Item>\n );\n};\n\nconst renderItemContent = (\n item: MenuItemType | SubMenuType | ContextMenuCheckboxItem | ContextMenuSwitchItem,\n options?: RenderItemContentOptions,\n iconNode?: ReactNode,\n) => {\n const label = getItemLabel(item);\n const extra = 'extra' in item ? item.extra : undefined;\n const indicatorOnRight = options?.indicatorOnRight;\n const hasCustomIcon = iconNode !== undefined && !indicatorOnRight;\n const hasIcon = hasCustomIcon ? Boolean(iconNode) : Boolean(item.icon);\n const shouldRenderIcon = hasCustomIcon\n ? Boolean(options?.reserveIconSpace || iconNode)\n : Boolean(hasIcon || options?.reserveIconSpace);\n\n return (\n <div className={styles.itemContent}>\n {shouldRenderIcon ? (\n <span aria-hidden={!hasIcon} className={styles.icon}>\n {hasCustomIcon ? iconNode : hasIcon ? renderIcon(item.icon, 'small') : null}\n </span>\n ) : null}\n <span className={styles.label}>{label}</span>\n {extra ? <span className={styles.extra}>{extra}</span> : null}\n {indicatorOnRight && iconNode ? iconNode : null}\n {options?.submenu ? (\n <span className={styles.submenuArrow}>\n <ChevronRight size={16} />\n </span>\n ) : null}\n </div>\n );\n};\n\nconst invokeItemClick = (\n item: MenuItemType,\n keyPath: string[],\n event: ReactMouseEvent<HTMLElement> | ReactKeyboardEvent<HTMLElement>,\n) => {\n if (!item.onClick) return;\n const key = item.key ?? keyPath.at(-1) ?? '';\n const info: MenuInfo = {\n domEvent: event,\n item: event.currentTarget as MenuInfo['item'],\n key: String(key),\n keyPath,\n };\n item.onClick(info);\n};\n\nexport const renderContextMenuItems = (\n items: ContextMenuItem[],\n keyPath: string[] = [],\n options?: RenderOptions,\n): ReactNode[] => {\n const iconSpaceMode = options?.iconSpaceMode ?? 'global';\n const reserveIconSpace =\n options?.reserveIconSpace ?? hasAnyIcon(items, iconSpaceMode === 'global');\n const indicatorOnRight = options?.indicatorOnRight ?? hasCheckboxAndIcon(items);\n\n return items.map((item, index) => {\n if (!item) return null;\n\n const fallbackKey = `${keyPath.join('-') || 'root'}-${index}`;\n const itemKey = getItemKey(item, fallbackKey);\n const nextKeyPath = [...keyPath, String(itemKey)];\n\n if ((item as ContextMenuCheckboxItem).type === 'checkbox') {\n const checkboxItem = item as ContextMenuCheckboxItem;\n const label = getItemLabel(checkboxItem);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = Boolean(checkboxItem.danger);\n const indicator = (\n <ContextMenu.CheckboxItemIndicator>\n <Icon icon={Check} size={'small'} />\n </ContextMenu.CheckboxItemIndicator>\n );\n\n return (\n <ContextMenu.CheckboxItem\n checked={checkboxItem.checked}\n className={cx(styles.item, isDanger && styles.danger)}\n closeOnClick={checkboxItem.closeOnClick}\n defaultChecked={checkboxItem.defaultChecked}\n disabled={checkboxItem.disabled}\n key={itemKey}\n label={labelText}\n onCheckedChange={(checked) => checkboxItem.onCheckedChange?.(checked)}\n >\n {renderItemContent(checkboxItem, { indicatorOnRight, reserveIconSpace }, indicator)}\n </ContextMenu.CheckboxItem>\n );\n }\n\n if ((item as ContextMenuSwitchItem).type === 'switch') {\n const switchItem = item as ContextMenuSwitchItem;\n const label = getItemLabel(switchItem);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = Boolean(switchItem.danger);\n\n return (\n <ContextMenuSwitchItemInternal\n checked={switchItem.checked}\n closeOnClick={switchItem.closeOnClick}\n danger={isDanger}\n defaultChecked={switchItem.defaultChecked}\n disabled={switchItem.disabled}\n key={itemKey}\n label={labelText}\n onCheckedChange={switchItem.onCheckedChange}\n >\n {renderItemContent(switchItem, { reserveIconSpace })}\n </ContextMenuSwitchItemInternal>\n );\n }\n\n if ((item as MenuDividerType).type === 'divider') {\n return <ContextMenu.Separator className={styles.separator} key={itemKey} />;\n }\n\n if ((item as MenuItemGroupType).type === 'group') {\n const group = item as MenuItemGroupType;\n const groupReserveIconSpace =\n iconSpaceMode === 'group'\n ? group.children\n ? hasAnyIcon(group.children)\n : false\n : reserveIconSpace;\n const groupIndicatorOnRight = group.children ? hasCheckboxAndIcon(group.children) : false;\n return (\n <ContextMenu.Group key={itemKey}>\n {group.label ? (\n <ContextMenu.GroupLabel className={styles.groupLabel}>\n {group.label}\n </ContextMenu.GroupLabel>\n ) : null}\n {group.children\n ? renderContextMenuItems(group.children, nextKeyPath, {\n iconSpaceMode,\n indicatorOnRight: groupIndicatorOnRight,\n reserveIconSpace: groupReserveIconSpace,\n })\n : null}\n </ContextMenu.Group>\n );\n }\n\n if (\n (item as SubMenuType).type === 'submenu' ||\n ('children' in item && (item as SubMenuType).children)\n ) {\n const submenu = item as SubMenuType;\n const label = getItemLabel(submenu);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = 'danger' in submenu && Boolean(submenu.danger);\n\n return (\n <ContextMenu.SubmenuRoot key={itemKey}>\n <ContextMenu.SubmenuTrigger\n className={cx(styles.item, isDanger && styles.danger)}\n disabled={submenu.disabled}\n label={labelText}\n >\n {renderItemContent(submenu, {\n reserveIconSpace,\n submenu: true,\n })}\n </ContextMenu.SubmenuTrigger>\n <ContextMenu.Portal>\n <ContextMenu.Positioner\n alignOffset={-4}\n className={styles.positioner}\n onContextMenu={preventDefaultAndStopPropagation}\n sideOffset={-1}\n >\n <ContextMenu.Popup className={styles.popup}>\n {submenu.children && submenu.children.length > 0 ? (\n renderContextMenuItems(submenu.children, nextKeyPath, { iconSpaceMode })\n ) : (\n <EmptyMenuItem />\n )}\n </ContextMenu.Popup>\n </ContextMenu.Positioner>\n </ContextMenu.Portal>\n </ContextMenu.SubmenuRoot>\n );\n }\n\n const menuItem = item as MenuItemType;\n const label = getItemLabel(menuItem);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = 'danger' in menuItem && Boolean(menuItem.danger);\n\n return (\n <ContextMenu.Item\n className={cx(styles.item, isDanger && styles.danger)}\n closeOnClick={menuItem.closeOnClick}\n disabled={menuItem.disabled}\n key={itemKey}\n label={labelText}\n onClick={(event) => invokeItemClick(menuItem, nextKeyPath, event)}\n >\n {renderItemContent(menuItem, { reserveIconSpace })}\n </ContextMenu.Item>\n );\n });\n};\n"],"mappings":";;;;;;;;;;;;;;AAmCA,MAAM,gBAAgB,WAAW;CAC/B,MAAM,EAAE,MAAM,eAAeA,eAAO;AACpC,QACE,oBAAC,YAAY;EAAK,WAAW,GAAG,OAAO,MAAM,OAAO,MAAM;EAAE;YAC1D,oBAAC;GAAI,WAAW,OAAO;aACrB,oBAAC;IAAK,WAAW,OAAO;cAAQ,EAAE,eAAe;KAAQ;IACrD;GACW;EAErB;AAEF,cAAc,cAAc;AAa5B,MAAM,iCAAiC,EACrC,SAAS,aACT,UACA,eAAe,OACf,QACA,gBACA,UACA,OACA,sBACwC;CACxC,MAAM,CAAC,iBAAiB,sBAAsB,SAAS,kBAAkB,MAAM;CAC/E,MAAM,eAAe,gBAAgB;CACrC,MAAM,UAAU,eAAe,cAAc;CAE7C,MAAM,sBAAsB,aACzB,eAAwB;AACvB,MAAI,CAAC,aACH,oBAAmB,WAAW;AAEhC,oBAAkB,WAAW;IAE/B,CAAC,cAAc,gBAAgB,CAChC;AAED,QACE,qBAAC,YAAY;EACX,WAAW,GAAG,OAAO,MAAM,UAAU,OAAO,OAAO;EACrC;EACJ;EACH;EACP,UAAU,MAAM;AACd,KAAE,gBAAgB;AAClB,OAAI,CAAC,SACH,qBAAoB,CAAC,QAAQ;;aAIhC,UACD,oBAAC;GACU;GACC;GACV,UAAU;GACV,UAAU,GAAG,MAAM,EAAE,iBAAiB;GACtC,MAAK;GACL,OAAO,EAAE,mBAAmB,IAAI;IAChC;GACe;;AAIvB,MAAM,qBACJ,MACA,SACA,aACG;CACH,MAAM,QAAQ,aAAa,KAAK;CAChC,MAAM,QAAQ,WAAW,OAAO,KAAK,QAAQ;CAC7C,MAAM,mBAAmB,SAAS;CAClC,MAAM,gBAAgB,aAAa,UAAa,CAAC;CACjD,MAAM,UAAU,gBAAgB,QAAQ,SA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,CAAC,GACF,SAZkB,QAaJ;;AAIxB,MACG,KAAqB,SAAS,aAC9B,cAAc,QAAS,KAAqB,UAC7C;GACA,MAAM,UAAU;GAChB,MAAMD,UAAQ,aAAa,QAAQ;GACnC,MAAMC,cAAY,OAAOD,YAAU,WAAWA,UAAQ;GACtD,MAAME,aAAW,YAAY,WAAW,QAAQ,QAAQ,OAAO;AAE/D,UACE,qBAAC,YAAY,0BACX,oBAAC,YAAY;IACX,WAAW,GAAG,OAAO,MAAMA,cAAY,OAAO,OAAO;IACrD,UAAU,QAAQ;IAClB,OAAOD;cAEN,kBAAkB,SAAS;KAC1B;KACA,SAAS;KACV,CAAC;KACyB,EAC7B,oBAAC,YAAY,oBACX,oBAAC,YAAY;IACX,aAAa;IACb,WAAW,OAAO;IAClB,eAAe;IACf,YAAY;cAEZ,oBAAC,YAAY;KAAM,WAAW,OAAO;eAClC,QAAQ,YAAY,QAAQ,SAAS,SAAS,IAC7C,uBAAuB,QAAQ,UAAU,aAAa,EAAE,eAAe,CAAC,GAExE,oBAAC,kBAAgB;MAED;KACG,GACN,KA1BO,QA2BJ;;EAI9B,MAAM,WAAW;EACjB,MAAM,QAAQ,aAAa,SAAS;EACpC,MAAM,YAAY,OAAO,UAAU,WAAW,QAAQ;EACtD,MAAM,WAAW,YAAY,YAAY,QAAQ,SAAS,OAAO;AAEjE,SACE,oBAAC,YAAY;GACX,WAAW,GAAG,OAAO,MAAM,YAAY,OAAO,OAAO;GACrD,cAAc,SAAS;GACvB,UAAU,SAAS;GAEnB,OAAO;GACP,UAAU,UAAU,gBAAgB,UAAU,aAAa,MAAM;aAEhE,kBAAkB,UAAU,EAAE,kBAAkB,CAAC;KAJ7C,QAKY;GAErB"}
1
+ {"version":3,"file":"renderItems.mjs","names":["common","info: MenuInfo","label","labelText","isDanger","Icon"],"sources":["../../src/ContextMenu/renderItems.tsx"],"sourcesContent":["import { ContextMenu } from '@base-ui/react/context-menu';\nimport { Switch } from 'antd';\nimport { cx } from 'antd-style';\nimport { Check, ChevronRight } from 'lucide-react';\nimport type { MenuInfo } from 'rc-menu/es/interface';\nimport type {\n KeyboardEvent as ReactKeyboardEvent,\n MouseEvent as ReactMouseEvent,\n ReactNode,\n} from 'react';\nimport { memo, useCallback, useState } from 'react';\n\nimport Icon from '@/Icon';\nimport {\n type MenuDividerType,\n type MenuItemGroupType,\n type MenuItemType,\n type RenderItemContentOptions,\n type RenderOptions,\n type SubMenuType,\n getItemKey,\n getItemLabel,\n hasAnyIcon,\n hasCheckboxAndIcon,\n renderIcon,\n} from '@/Menu';\nimport common from '@/i18n/resources/en/common';\nimport { useTranslation } from '@/i18n/useTranslation';\nimport { preventDefaultAndStopPropagation } from '@/utils/dom';\n\nimport { styles } from './style';\nimport type { ContextMenuCheckboxItem, ContextMenuItem, ContextMenuSwitchItem } from './type';\n\nexport type { IconSpaceMode } from '@/Menu';\n\nconst EmptyMenuItem = memo(() => {\n const { t } = useTranslation(common);\n return (\n <ContextMenu.Item className={cx(styles.item, styles.empty)} disabled>\n <div className={styles.itemContent}>\n <span className={styles.label}>{t('common.empty')}</span>\n </div>\n </ContextMenu.Item>\n );\n});\n\nEmptyMenuItem.displayName = 'EmptyMenuItem';\n\ninterface ContextMenuSwitchItemInternalProps {\n checked?: boolean;\n children: ReactNode;\n closeOnClick?: boolean;\n danger?: boolean;\n defaultChecked?: boolean;\n disabled?: boolean;\n label?: string;\n onCheckedChange?: (checked: boolean) => void;\n}\n\nconst ContextMenuSwitchItemInternal = ({\n checked: checkedProp,\n children,\n closeOnClick = false,\n danger,\n defaultChecked,\n disabled,\n label,\n onCheckedChange,\n}: ContextMenuSwitchItemInternalProps) => {\n const [internalChecked, setInternalChecked] = useState(defaultChecked ?? false);\n const isControlled = checkedProp !== undefined;\n const checked = isControlled ? checkedProp : internalChecked;\n\n const handleCheckedChange = useCallback(\n (newChecked: boolean) => {\n if (!isControlled) {\n setInternalChecked(newChecked);\n }\n onCheckedChange?.(newChecked);\n },\n [isControlled, onCheckedChange],\n );\n\n return (\n <ContextMenu.Item\n className={cx(styles.item, danger && styles.danger)}\n closeOnClick={closeOnClick}\n disabled={disabled}\n label={label}\n onClick={(e) => {\n e.preventDefault();\n if (!disabled) {\n handleCheckedChange(!checked);\n }\n }}\n >\n {children}\n <Switch\n checked={checked}\n disabled={disabled}\n onChange={handleCheckedChange}\n onClick={(_, e) => e.stopPropagation()}\n size=\"small\"\n style={{ marginInlineStart: 16 }}\n />\n </ContextMenu.Item>\n );\n};\n\nconst renderItemContent = (\n item: MenuItemType | SubMenuType | ContextMenuCheckboxItem | ContextMenuSwitchItem,\n options?: RenderItemContentOptions,\n iconNode?: ReactNode,\n) => {\n const label = getItemLabel(item);\n const extra = 'extra' in item ? item.extra : undefined;\n const indicatorOnRight = options?.indicatorOnRight;\n const hasCustomIcon = iconNode !== undefined && !indicatorOnRight;\n const hasIcon = hasCustomIcon ? Boolean(iconNode) : Boolean(item.icon);\n const shouldRenderIcon = hasCustomIcon\n ? Boolean(options?.reserveIconSpace || iconNode)\n : Boolean(hasIcon || options?.reserveIconSpace);\n\n return (\n <div className={styles.itemContent}>\n {shouldRenderIcon ? (\n <span aria-hidden={!hasIcon} className={styles.icon}>\n {hasCustomIcon ? iconNode : hasIcon ? renderIcon(item.icon, 'small') : null}\n </span>\n ) : null}\n <span className={styles.label}>{label}</span>\n {extra ? <span className={styles.extra}>{extra}</span> : null}\n {indicatorOnRight && iconNode ? iconNode : null}\n {options?.submenu ? (\n <span className={styles.submenuArrow}>\n <ChevronRight size={16} />\n </span>\n ) : null}\n </div>\n );\n};\n\nconst invokeItemClick = (\n item: MenuItemType,\n keyPath: string[],\n event: ReactMouseEvent<HTMLElement> | ReactKeyboardEvent<HTMLElement>,\n) => {\n if (!item.onClick) return;\n const key = item.key ?? keyPath.at(-1) ?? '';\n const info: MenuInfo = {\n domEvent: event,\n item: event.currentTarget as MenuInfo['item'],\n key: String(key),\n keyPath,\n };\n item.onClick(info);\n};\n\nexport const renderContextMenuItems = (\n items: ContextMenuItem[],\n keyPath: string[] = [],\n options?: RenderOptions,\n): ReactNode[] => {\n const iconSpaceMode = options?.iconSpaceMode ?? 'global';\n const reserveIconSpace =\n options?.reserveIconSpace ?? hasAnyIcon(items, iconSpaceMode === 'global');\n const indicatorOnRight = options?.indicatorOnRight ?? hasCheckboxAndIcon(items);\n\n return items.map((item, index) => {\n if (!item) return null;\n\n const fallbackKey = `${keyPath.join('-') || 'root'}-${index}`;\n const itemKey = getItemKey(item, fallbackKey);\n const nextKeyPath = [...keyPath, String(itemKey)];\n\n if ((item as ContextMenuCheckboxItem).type === 'checkbox') {\n const checkboxItem = item as ContextMenuCheckboxItem;\n const label = getItemLabel(checkboxItem);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = Boolean(checkboxItem.danger);\n const indicator = (\n <ContextMenu.CheckboxItemIndicator>\n <Icon icon={Check} size={'small'} />\n </ContextMenu.CheckboxItemIndicator>\n );\n\n return (\n <ContextMenu.CheckboxItem\n checked={checkboxItem.checked}\n className={cx(styles.item, isDanger && styles.danger)}\n closeOnClick={checkboxItem.closeOnClick}\n defaultChecked={checkboxItem.defaultChecked}\n disabled={checkboxItem.disabled}\n key={itemKey}\n label={labelText}\n onCheckedChange={(checked) => checkboxItem.onCheckedChange?.(checked)}\n >\n {renderItemContent(checkboxItem, { indicatorOnRight, reserveIconSpace }, indicator)}\n </ContextMenu.CheckboxItem>\n );\n }\n\n if ((item as ContextMenuSwitchItem).type === 'switch') {\n const switchItem = item as ContextMenuSwitchItem;\n const label = getItemLabel(switchItem);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = Boolean(switchItem.danger);\n\n return (\n <ContextMenuSwitchItemInternal\n checked={switchItem.checked}\n closeOnClick={switchItem.closeOnClick}\n danger={isDanger}\n defaultChecked={switchItem.defaultChecked}\n disabled={switchItem.disabled}\n key={itemKey}\n label={labelText}\n onCheckedChange={switchItem.onCheckedChange}\n >\n {renderItemContent(switchItem, { reserveIconSpace })}\n </ContextMenuSwitchItemInternal>\n );\n }\n\n if ((item as MenuDividerType).type === 'divider') {\n return <ContextMenu.Separator className={styles.separator} key={itemKey} />;\n }\n\n if ((item as MenuItemGroupType).type === 'group') {\n const group = item as MenuItemGroupType;\n const groupReserveIconSpace =\n iconSpaceMode === 'group'\n ? group.children\n ? hasAnyIcon(group.children)\n : false\n : reserveIconSpace;\n const groupIndicatorOnRight = group.children ? hasCheckboxAndIcon(group.children) : false;\n return (\n <ContextMenu.Group key={itemKey}>\n {group.label ? (\n <ContextMenu.GroupLabel className={styles.groupLabel}>\n {group.label}\n </ContextMenu.GroupLabel>\n ) : null}\n {group.children\n ? renderContextMenuItems(group.children, nextKeyPath, {\n iconSpaceMode,\n indicatorOnRight: groupIndicatorOnRight,\n reserveIconSpace: groupReserveIconSpace,\n })\n : null}\n </ContextMenu.Group>\n );\n }\n\n if (\n (item as SubMenuType).type === 'submenu' ||\n ('children' in item && (item as SubMenuType).children)\n ) {\n const submenu = item as SubMenuType;\n const label = getItemLabel(submenu);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = 'danger' in submenu && Boolean(submenu.danger);\n\n return (\n <ContextMenu.SubmenuRoot key={itemKey}>\n <ContextMenu.SubmenuTrigger\n className={cx(styles.item, isDanger && styles.danger)}\n disabled={submenu.disabled}\n label={labelText}\n >\n {renderItemContent(submenu, {\n reserveIconSpace,\n submenu: true,\n })}\n </ContextMenu.SubmenuTrigger>\n <ContextMenu.Portal>\n <ContextMenu.Positioner\n alignOffset={-4}\n className={styles.positioner}\n data-submenu=\"\"\n onContextMenu={preventDefaultAndStopPropagation}\n sideOffset={-1}\n >\n <ContextMenu.Popup className={styles.popup}>\n {submenu.children && submenu.children.length > 0 ? (\n renderContextMenuItems(submenu.children, nextKeyPath, { iconSpaceMode })\n ) : (\n <EmptyMenuItem />\n )}\n </ContextMenu.Popup>\n </ContextMenu.Positioner>\n </ContextMenu.Portal>\n </ContextMenu.SubmenuRoot>\n );\n }\n\n const menuItem = item as MenuItemType;\n const label = getItemLabel(menuItem);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = 'danger' in menuItem && Boolean(menuItem.danger);\n\n return (\n <ContextMenu.Item\n className={cx(styles.item, isDanger && styles.danger)}\n closeOnClick={menuItem.closeOnClick}\n disabled={menuItem.disabled}\n key={itemKey}\n label={labelText}\n onClick={(event) => invokeItemClick(menuItem, nextKeyPath, event)}\n >\n {renderItemContent(menuItem, { reserveIconSpace })}\n </ContextMenu.Item>\n );\n });\n};\n"],"mappings":";;;;;;;;;;;;;;AAmCA,MAAM,gBAAgB,WAAW;CAC/B,MAAM,EAAE,MAAM,eAAeA,eAAO;AACpC,QACE,oBAAC,YAAY;EAAK,WAAW,GAAG,OAAO,MAAM,OAAO,MAAM;EAAE;YAC1D,oBAAC;GAAI,WAAW,OAAO;aACrB,oBAAC;IAAK,WAAW,OAAO;cAAQ,EAAE,eAAe;KAAQ;IACrD;GACW;EAErB;AAEF,cAAc,cAAc;AAa5B,MAAM,iCAAiC,EACrC,SAAS,aACT,UACA,eAAe,OACf,QACA,gBACA,UACA,OACA,sBACwC;CACxC,MAAM,CAAC,iBAAiB,sBAAsB,SAAS,kBAAkB,MAAM;CAC/E,MAAM,eAAe,gBAAgB;CACrC,MAAM,UAAU,eAAe,cAAc;CAE7C,MAAM,sBAAsB,aACzB,eAAwB;AACvB,MAAI,CAAC,aACH,oBAAmB,WAAW;AAEhC,oBAAkB,WAAW;IAE/B,CAAC,cAAc,gBAAgB,CAChC;AAED,QACE,qBAAC,YAAY;EACX,WAAW,GAAG,OAAO,MAAM,UAAU,OAAO,OAAO;EACrC;EACJ;EACH;EACP,UAAU,MAAM;AACd,KAAE,gBAAgB;AAClB,OAAI,CAAC,SACH,qBAAoB,CAAC,QAAQ;;aAIhC,UACD,oBAAC;GACU;GACC;GACV,UAAU;GACV,UAAU,GAAG,MAAM,EAAE,iBAAiB;GACtC,MAAK;GACL,OAAO,EAAE,mBAAmB,IAAI;IAChC;GACe;;AAIvB,MAAM,qBACJ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AAkB,CAAC;KAJ7C,QAKY;GAErB"}
@@ -1,8 +1,8 @@
1
1
  import { CopyButtonProps } from "./type.mjs";
2
- import * as react41 from "react";
2
+ import * as react55 from "react";
3
3
 
4
4
  //#region src/CopyButton/CopyButton.d.ts
5
- declare const CopyButton: react41.NamedExoticComponent<CopyButtonProps>;
5
+ declare const CopyButton: react55.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 react40 from "react";
2
+ import * as react60 from "react";
3
3
 
4
4
  //#region src/DatePicker/DatePicker.d.ts
5
- declare const DatePicker: react40.NamedExoticComponent<DatePickerProps>;
5
+ declare const DatePicker: react60.NamedExoticComponent<DatePickerProps>;
6
6
  //#endregion
7
7
  export { DatePicker };
8
8
  //# sourceMappingURL=DatePicker.d.mts.map