@lobehub/ui 4.0.0 → 4.1.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 (146) hide show
  1. package/README.md +1 -1
  2. package/es/Accordion/Accordion.d.mts +2 -2
  3. package/es/Accordion/AccordionItem.d.mts +2 -2
  4. package/es/Accordion/AccordionItem.mjs +4 -4
  5. package/es/Accordion/AccordionItem.mjs.map +1 -1
  6. package/es/ActionIcon/ActionIcon.d.mts +2 -2
  7. package/es/Alert/Alert.d.mts +2 -2
  8. package/es/AutoComplete/Select.d.mts +2 -2
  9. package/es/Avatar/AvatarGroup/index.d.mts +2 -2
  10. package/es/Burger/Burger.d.mts +2 -2
  11. package/es/CodeEditor/CodeEditor.d.mts +2 -2
  12. package/es/Collapse/Collapse.d.mts +2 -2
  13. package/es/ConfigProvider/index.d.mts +4 -4
  14. package/es/ConfigProvider/index.mjs +31 -5
  15. package/es/ConfigProvider/index.mjs.map +1 -1
  16. package/es/CopyButton/CopyButton.d.mts +2 -2
  17. package/es/DatePicker/DatePicker.d.mts +2 -2
  18. package/es/DraggablePanel/components/DraggablePanelBody.d.mts +2 -2
  19. package/es/DraggablePanel/components/DraggablePanelContainer.d.mts +2 -2
  20. package/es/DraggablePanel/components/DraggablePanelFooter.d.mts +2 -2
  21. package/es/DraggablePanel/components/DraggablePanelHeader.d.mts +2 -2
  22. package/es/DraggableSideNav/DraggableSideNav.d.mts +2 -2
  23. package/es/Drawer/Drawer.d.mts +2 -2
  24. package/es/Dropdown/Dropdown.d.mts +2 -2
  25. package/es/EditableText/EditableText.d.mts +2 -2
  26. package/es/EmojiPicker/EmojiPicker.d.mts +2 -2
  27. package/es/Flex/FlexBasic.d.mts +2 -2
  28. package/es/FontLoader/index.d.mts +2 -2
  29. package/es/Footer/Footer.d.mts +2 -2
  30. package/es/Form/components/FormGroup.d.mts +2 -2
  31. package/es/Form/components/FormItem.d.mts +2 -2
  32. package/es/Form/components/FormSubmitFooter.d.mts +2 -2
  33. package/es/Form/components/FormSubmitFooter.mjs +3 -3
  34. package/es/Form/components/FormSubmitFooter.mjs.map +1 -1
  35. package/es/FormModal/FormModal.d.mts +2 -2
  36. package/es/GuideCard/GuideCard.d.mts +2 -2
  37. package/es/Header/Header.d.mts +2 -2
  38. package/es/Highlighter/Highlighter.d.mts +2 -2
  39. package/es/Highlighter/SyntaxHighlighter/index.d.mts +2 -2
  40. package/es/Hotkey/Hotkey.d.mts +2 -2
  41. package/es/HotkeyInput/HotkeyInput.d.mts +2 -2
  42. package/es/Icon/Icon.d.mts +2 -2
  43. package/es/Icon/components/IconProvider.d.mts +3 -3
  44. package/es/Image/PreviewGroup.d.mts +2 -2
  45. package/es/ImageSelect/ImageSelect.d.mts +2 -2
  46. package/es/Input/Input.d.mts +2 -2
  47. package/es/Input/InputNumber.d.mts +2 -2
  48. package/es/Input/InputOPT.d.mts +2 -2
  49. package/es/Input/InputPassword.d.mts +2 -2
  50. package/es/Input/TextArea.d.mts +2 -2
  51. package/es/Layout/components/LayoutFooter.d.mts +2 -2
  52. package/es/Layout/components/LayoutHeader.d.mts +2 -2
  53. package/es/Layout/components/LayoutMain.d.mts +2 -2
  54. package/es/Layout/components/LayoutSidebar.d.mts +2 -2
  55. package/es/Layout/components/LayoutSidebarInner.d.mts +2 -2
  56. package/es/Layout/components/LayoutToc.d.mts +2 -2
  57. package/es/List/ListItem/index.d.mts +2 -2
  58. package/es/Markdown/Markdown.d.mts +2 -2
  59. package/es/Markdown/Typography.d.mts +2 -2
  60. package/es/Markdown/components/SearchResultCards/index.d.mts +2 -2
  61. package/es/MaskShadow/MaskShadow.d.mts +2 -2
  62. package/es/Menu/Menu.d.mts +2 -2
  63. package/es/Mermaid/Mermaid.d.mts +2 -2
  64. package/es/Mermaid/SyntaxMermaid/index.d.mts +2 -2
  65. package/es/Modal/Modal.d.mts +2 -2
  66. package/es/MotionProvider/index.d.mts +4 -3
  67. package/es/MotionProvider/index.mjs +2 -2
  68. package/es/MotionProvider/index.mjs.map +1 -1
  69. package/es/SearchBar/SearchBar.d.mts +2 -2
  70. package/es/Segmented/Segmented.d.mts +2 -2
  71. package/es/Select/Select.d.mts +2 -2
  72. package/es/SideNav/SideNav.d.mts +2 -2
  73. package/es/SliderWithInput/SliderWithInput.d.mts +2 -2
  74. package/es/SortableList/components/DragHandle.d.mts +2 -2
  75. package/es/SortableList/components/SortableItem.d.mts +2 -2
  76. package/es/ThemeProvider/ThemeProvider.d.mts +2 -2
  77. package/es/ThemeProvider/ThemeProvider.mjs +4 -11
  78. package/es/ThemeProvider/ThemeProvider.mjs.map +1 -1
  79. package/es/ThemeProvider/type.d.mts +0 -4
  80. package/es/Toc/Toc.d.mts +2 -2
  81. package/es/Tooltip/TooltipFloating.mjs +6 -5
  82. package/es/Tooltip/TooltipFloating.mjs.map +1 -1
  83. package/es/Video/index.d.mts +2 -2
  84. package/es/awesome/AuroraBackground/AuroraBackground.d.mts +2 -2
  85. package/es/awesome/BottomGradientButton/BottomGradientButton.d.mts +2 -2
  86. package/es/awesome/Features/Features.d.mts +2 -2
  87. package/es/awesome/Giscus/Giscus.d.mts +2 -2
  88. package/es/awesome/GradientButton/GradientButton.d.mts +2 -2
  89. package/es/awesome/GridBackground/GridBackground.d.mts +2 -2
  90. package/es/awesome/GridBackground/GridShowcase.d.mts +2 -2
  91. package/es/awesome/Hero/Hero.d.mts +2 -2
  92. package/es/awesome/Spotlight/Spotlight.d.mts +2 -2
  93. package/es/awesome/SpotlightCard/SpotlightCard.d.mts +2 -2
  94. package/es/awesome/TypewriterEffect/TypewriterEffect.d.mts +2 -2
  95. package/es/awesome/TypewriterEffect/TypewriterEffect.mjs +3 -3
  96. package/es/awesome/TypewriterEffect/TypewriterEffect.mjs.map +1 -1
  97. package/es/brand/BrandLoading/{style-Cof4dJBw.css → style-BpgFy1wc.css} +1 -1
  98. package/es/brand/BrandLoading/{style-Cof4dJBw.css.map → style-BpgFy1wc.css.map} +1 -1
  99. package/es/brand/LobeChat/index.d.mts +2 -2
  100. package/es/brand/LobeHub/index.d.mts +2 -2
  101. package/es/brand/LogoThree/LogoSpline.d.mts +2 -2
  102. package/es/brand/LogoThree/index.d.mts +2 -2
  103. package/es/chat/BackBottom/BackBottom.d.mts +2 -2
  104. package/es/chat/ChatInputArea/components/ChatInputAreaInner.d.mts +2 -2
  105. package/es/chat/ChatItem/ChatItem.d.mts +2 -2
  106. package/es/chat/ChatList/ChatList.d.mts +2 -2
  107. package/es/chat/EditableMessage/EditableMessage.d.mts +2 -2
  108. package/es/chat/EditableMessageList/EditableMessageList.d.mts +2 -2
  109. package/es/chat/MessageInput/MessageInput.d.mts +2 -2
  110. package/es/chat/MessageModal/MessageModal.d.mts +2 -2
  111. package/es/color/ColorScales/index.d.mts +2 -2
  112. package/es/i18n/context.d.mts +4 -4
  113. package/es/i18n/context.mjs.map +1 -1
  114. package/es/i18n/index.d.mts +2 -2
  115. package/es/i18n/types.d.mts +3 -1
  116. package/es/icons/lucideExtra/BotPromptIcon.d.mts +2 -2
  117. package/es/icons/lucideExtra/CreateBotIcon.d.mts +3 -3
  118. package/es/icons/lucideExtra/DiscordIcon.d.mts +3 -3
  119. package/es/icons/lucideExtra/GlobeOffIcon.d.mts +2 -2
  120. package/es/icons/lucideExtra/GroupBotIcon.d.mts +2 -2
  121. package/es/icons/lucideExtra/GroupBotSquareIcon.d.mts +3 -3
  122. package/es/icons/lucideExtra/LeftClickIcon.d.mts +3 -3
  123. package/es/icons/lucideExtra/LeftDoubleClickIcon.d.mts +3 -3
  124. package/es/icons/lucideExtra/McpIcon.d.mts +3 -3
  125. package/es/icons/lucideExtra/ProviderIcon.d.mts +3 -3
  126. package/es/icons/lucideExtra/RightClickIcon.d.mts +3 -3
  127. package/es/icons/lucideExtra/RightDoubleClickIcon.d.mts +3 -3
  128. package/es/icons/lucideExtra/ShapesUploadIcon.d.mts +2 -2
  129. package/es/icons/lucideExtra/TreeDownRightIcon.d.mts +2 -2
  130. package/es/icons/lucideExtra/TreeUpDownRightIcon.d.mts +3 -3
  131. package/es/mdx/Mdx/index.d.mts +2 -2
  132. package/es/mobile/ChatHeader/ChatHeaderTitle.d.mts +2 -2
  133. package/es/mobile/ChatInputArea/components/ChatSendButton.d.mts +2 -2
  134. package/es/mobile/TabBar/TabBar.d.mts +2 -2
  135. package/es/storybook/StoryBook/index.d.mts +2 -2
  136. package/package.json +1 -1
  137. package/es/motion/LazyMotion.d.mts +0 -20
  138. package/es/motion/LazyMotion.mjs +0 -20
  139. package/es/motion/LazyMotion.mjs.map +0 -1
  140. package/es/motion/index.d.mts +0 -4
  141. package/es/motion/index.d.ts +0 -1
  142. package/es/motion/index.js +0 -1
  143. package/es/motion/index.mjs +0 -5
  144. package/es/motion/loadFeatures.d.mts +0 -14
  145. package/es/motion/loadFeatures.mjs +0 -6
  146. package/es/motion/loadFeatures.mjs.map +0 -1
package/README.md CHANGED
@@ -119,7 +119,7 @@ import hotkeyMessages from '@lobehub/ui/i18n/resources/hotkey';
119
119
 
120
120
  ### ConfigProvider (Motion)
121
121
 
122
- You must pass a motion component via `ConfigProvider` (or `ThemeProvider`).
122
+ You must pass a motion component via `ConfigProvider`.
123
123
  If your app uses `LazyMotion`, pass `m`:
124
124
 
125
125
  ```tsx
@@ -1,8 +1,8 @@
1
1
  import { AccordionProps } from "./type.mjs";
2
- import * as react0 from "react";
2
+ import * as react63 from "react";
3
3
 
4
4
  //#region src/Accordion/Accordion.d.ts
5
- declare const Accordion: react0.NamedExoticComponent<AccordionProps & react0.RefAttributes<HTMLDivElement>>;
5
+ declare const Accordion: react63.NamedExoticComponent<AccordionProps & react63.RefAttributes<HTMLDivElement>>;
6
6
  //#endregion
7
7
  export { Accordion };
8
8
  //# sourceMappingURL=Accordion.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { AccordionItemProps } from "./type.mjs";
2
- import * as react2 from "react";
2
+ import * as react62 from "react";
3
3
 
4
4
  //#region src/Accordion/AccordionItem.d.ts
5
- declare const AccordionItem: react2.NamedExoticComponent<AccordionItemProps>;
5
+ declare const AccordionItem: react62.NamedExoticComponent<AccordionItemProps>;
6
6
  //#endregion
7
7
  export { AccordionItem };
8
8
  //# sourceMappingURL=AccordionItem.d.mts.map
@@ -1,13 +1,13 @@
1
1
  'use client';
2
2
 
3
- import { MotionComponent } from "../MotionProvider/index.mjs";
3
+ import { useMotionComponent } from "../MotionProvider/index.mjs";
4
4
  import { useAccordionContext } from "./context.mjs";
5
5
  import { useStyles } from "./style.mjs";
6
6
  import FlexBasic_default from "../Flex/FlexBasic.mjs";
7
7
  import Block_default from "../Block/Block.mjs";
8
8
  import Text_default from "../Text/Text.mjs";
9
9
  import ArrowIcon_default from "./ArrowIcon.mjs";
10
- import { memo, use, useCallback, useMemo } from "react";
10
+ import { memo, useCallback, useMemo } from "react";
11
11
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
12
12
 
13
13
  //#region src/Accordion/AccordionItem.tsx
@@ -103,7 +103,7 @@ const AccordionItem = memo(({ itemKey, title, children, action, disabled = false
103
103
  },
104
104
  ...contextMotionProps
105
105
  }), [isOpen, contextMotionProps]);
106
- const m = use(MotionComponent);
106
+ const Motion = useMotionComponent();
107
107
  const contentElement = useMemo(() => {
108
108
  if (disableAnimation || !keepContentMounted) {
109
109
  if (keepContentMounted) return /* @__PURE__ */ jsx("div", {
@@ -128,7 +128,7 @@ const AccordionItem = memo(({ itemKey, title, children, action, disabled = false
128
128
  })
129
129
  });
130
130
  }
131
- return /* @__PURE__ */ jsx(m.div, {
131
+ return /* @__PURE__ */ jsx(Motion.div, {
132
132
  ...motionProps,
133
133
  style: { overflow: "hidden" },
134
134
  children: /* @__PURE__ */ jsx("div", {
@@ -1 +1 @@
1
- {"version":3,"file":"AccordionItem.mjs","names":["ArrowIcon","Text","Flexbox","Block"],"sources":["../../src/Accordion/AccordionItem.tsx"],"sourcesContent":["'use client';\n\nimport { KeyboardEvent, memo, use, useCallback, useMemo } from 'react';\n\nimport Block from '@/Block';\nimport { Flexbox } from '@/Flex';\nimport { MotionComponent } from '@/MotionProvider';\nimport Text from '@/Text';\n\nimport ArrowIcon from './ArrowIcon';\nimport { useAccordionContext } from './context';\nimport { useStyles } from './style';\nimport type { AccordionItemProps } from './type';\n\nconst AccordionItem = memo<AccordionItemProps>(\n ({\n itemKey,\n title,\n children,\n action,\n disabled = false,\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 }) => {\n const { cx, styles } = useStyles();\n const context = useAccordionContext();\n\n const {\n isExpanded,\n onToggle,\n hideIndicator: contextHideIndicator,\n indicatorPlacement: contextIndicatorPlacement,\n keepContentMounted,\n disableAnimation,\n motionProps: contextMotionProps,\n variant = 'filled',\n } = context;\n\n const isOpen = isExpanded(itemKey);\n const hideIndicatorFinal = itemHideIndicator ?? contextHideIndicator ?? false;\n const indicatorPlacementFinal = itemIndicatorPlacement ?? contextIndicatorPlacement ?? 'start';\n\n const handleToggle = useCallback(() => {\n if (!disabled) {\n onToggle(itemKey);\n }\n }, [disabled, itemKey, onToggle]);\n\n const handleKeyDown = useCallback(\n (e: KeyboardEvent) => {\n if (disabled) return;\n\n switch (e.key) {\n case 'Enter':\n case ' ': {\n e.preventDefault();\n handleToggle();\n break;\n }\n }\n },\n [disabled, handleToggle],\n );\n\n // Build indicator\n const indicator = useMemo(() => {\n if (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 hideIndicatorFinal,\n customIndicator,\n disabled,\n isOpen,\n cx,\n styles,\n classNames,\n customStyles,\n ]);\n\n // Animation variants\n const motionProps = useMemo(\n () => ({\n animate: isOpen ? 'enter' : 'exit',\n exit: 'exit',\n initial: false,\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 [isOpen, contextMotionProps],\n );\n\n const m = use(MotionComponent);\n\n // Render content\n const contentElement = useMemo(() => {\n if (disableAnimation || !keepContentMounted) {\n if (keepContentMounted) {\n return (\n <div\n className={cx('accordion-content', styles.content, classNames?.content)}\n role=\"region\"\n style={{\n display: isOpen ? 'block' : 'none',\n ...customStyles?.content,\n }}\n >\n <div className={styles.contentInner}>{children}</div>\n </div>\n );\n }\n\n return (\n isOpen && (\n <div\n className={cx('accordion-content', styles.content, classNames?.content)}\n role=\"region\"\n style={customStyles?.content}\n >\n <div className={styles.contentInner}>{children}</div>\n </div>\n )\n );\n }\n\n return (\n <m.div {...motionProps} style={{ overflow: 'hidden' }}>\n <div\n className={cx('accordion-content', styles.content, classNames?.content)}\n role=\"region\"\n style={customStyles?.content}\n >\n <div className={styles.contentInner}>{children}</div>\n </div>\n </m.div>\n );\n }, [\n disableAnimation,\n keepContentMounted,\n isOpen,\n cx,\n styles,\n classNames,\n customStyles,\n children,\n motionProps,\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={(e) => e.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}\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' : 'pointer',\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 flex={1}\n gap={2}\n horizontal\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 flex={1}\n gap={2}\n horizontal\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 {contentElement}\n </div>\n );\n },\n);\n\nAccordionItem.displayName = 'AccordionItem';\n\nexport default AccordionItem;\n"],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AAED,cAAc,cAAc;AAE5B,4BAAe"}
1
+ {"version":3,"file":"AccordionItem.mjs","names":["ArrowIcon","Text","Flexbox","Block"],"sources":["../../src/Accordion/AccordionItem.tsx"],"sourcesContent":["'use client';\n\nimport { KeyboardEvent, memo, useCallback, useMemo } from 'react';\n\nimport Block from '@/Block';\nimport { Flexbox } from '@/Flex';\nimport { useMotionComponent } from '@/MotionProvider';\nimport Text from '@/Text';\n\nimport ArrowIcon from './ArrowIcon';\nimport { useAccordionContext } from './context';\nimport { useStyles } from './style';\nimport type { AccordionItemProps } from './type';\n\nconst AccordionItem = memo<AccordionItemProps>(\n ({\n itemKey,\n title,\n children,\n action,\n disabled = false,\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 }) => {\n const { cx, styles } = useStyles();\n const context = useAccordionContext();\n\n const {\n isExpanded,\n onToggle,\n hideIndicator: contextHideIndicator,\n indicatorPlacement: contextIndicatorPlacement,\n keepContentMounted,\n disableAnimation,\n motionProps: contextMotionProps,\n variant = 'filled',\n } = context;\n\n const isOpen = isExpanded(itemKey);\n const hideIndicatorFinal = itemHideIndicator ?? contextHideIndicator ?? false;\n const indicatorPlacementFinal = itemIndicatorPlacement ?? contextIndicatorPlacement ?? 'start';\n\n const handleToggle = useCallback(() => {\n if (!disabled) {\n onToggle(itemKey);\n }\n }, [disabled, itemKey, onToggle]);\n\n const handleKeyDown = useCallback(\n (e: KeyboardEvent) => {\n if (disabled) return;\n\n switch (e.key) {\n case 'Enter':\n case ' ': {\n e.preventDefault();\n handleToggle();\n break;\n }\n }\n },\n [disabled, handleToggle],\n );\n\n // Build indicator\n const indicator = useMemo(() => {\n if (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 hideIndicatorFinal,\n customIndicator,\n disabled,\n isOpen,\n cx,\n styles,\n classNames,\n customStyles,\n ]);\n\n // Animation variants\n const motionProps = useMemo(\n () => ({\n animate: isOpen ? 'enter' : 'exit',\n exit: 'exit',\n initial: false,\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 [isOpen, contextMotionProps],\n );\n\n const Motion = useMotionComponent();\n\n // Render content\n const contentElement = useMemo(() => {\n if (disableAnimation || !keepContentMounted) {\n if (keepContentMounted) {\n return (\n <div\n className={cx('accordion-content', styles.content, classNames?.content)}\n role=\"region\"\n style={{\n display: isOpen ? 'block' : 'none',\n ...customStyles?.content,\n }}\n >\n <div className={styles.contentInner}>{children}</div>\n </div>\n );\n }\n\n return (\n isOpen && (\n <div\n className={cx('accordion-content', styles.content, classNames?.content)}\n role=\"region\"\n style={customStyles?.content}\n >\n <div className={styles.contentInner}>{children}</div>\n </div>\n )\n );\n }\n\n return (\n <Motion.div {...motionProps} style={{ overflow: 'hidden' }}>\n <div\n className={cx('accordion-content', styles.content, classNames?.content)}\n role=\"region\"\n style={customStyles?.content}\n >\n <div className={styles.contentInner}>{children}</div>\n </div>\n </Motion.div>\n );\n }, [\n disableAnimation,\n keepContentMounted,\n isOpen,\n cx,\n styles,\n classNames,\n customStyles,\n children,\n motionProps,\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={(e) => e.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}\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' : 'pointer',\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 flex={1}\n gap={2}\n horizontal\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 flex={1}\n gap={2}\n horizontal\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 {contentElement}\n </div>\n );\n },\n);\n\nAccordionItem.displayName = 'AccordionItem';\n\nexport default AccordionItem;\n"],"mappings":";;;;;;;;;;;;;AAcA,MAAM,gBAAgB,MACnB,EACC,SACA,OACA,UACA,QACA,WAAW,OACX,eAAe,mBACf,oBAAoB,wBACpB,WAAW,iBACX,YACA,gBAAgB,IAChB,eAAe,GACf,SACA,KACA,SAAS,eACT,QAAQ,cACR,oBACI;CACJ,MAAM,EAAE,IAAI,WAAW,WAAW;CAGlC,MAAM,EACJ,YACA,UACA,eAAe,sBACf,oBAAoB,2BACpB,oBACA,kBACA,aAAa,oBACb,UAAU,aAVI,qBAAqB;CAarC,MAAM,SAAS,WAAW,QAAQ;CAClC,MAAM,qBAAqB,qBAAqB,wBAAwB;CACxE,MAAM,0BAA0B,0BAA0B,6BAA6B;CAEvF,MAAM,eAAe,kBAAkB;AACrC,MAAI,CAAC,SACH,UAAS,QAAQ;IAElB;EAAC;EAAU;EAAS;EAAS,CAAC;CAEjC,MAAM,gBAAgB,aACnB,MAAqB;AACpB,MAAI,SAAU;AAEd,UAAQ,EAAE,KAAV;GACE,KAAK;GACL,KAAK;AACH,MAAE,gBAAgB;AAClB,kBAAc;AACd;;IAIN,CAAC,UAAU,aAAa,CACzB;CAGD,MAAM,YAAY,cAAc;AAC9B,MAAI,mBAAoB,QAAO;AAE/B,MAAI,iBAAiB;AACnB,OAAI,OAAO,oBAAoB,WAC7B,QACE,oBAAC;IACC,eAAY;IACZ,WAAW,GAAG,OAAO,WAAW,YAAY,UAAU;IACtD,OAAO,cAAc;cAEpB,gBAAgB;KAAE,YAAY;KAAU;KAAQ,CAAC;KAC7C;AAGX,UACE,oBAAC;IACC,eAAY;IACZ,WAAW,GAAG,OAAO,WAAW,YAAY,UA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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,eACA;GACG;EAGX;AAED,cAAc,cAAc;AAE5B,4BAAe"}
@@ -1,8 +1,8 @@
1
1
  import { ActionIconProps } from "./type.mjs";
2
- import * as react30 from "react";
2
+ import * as react38 from "react";
3
3
 
4
4
  //#region src/ActionIcon/ActionIcon.d.ts
5
- declare const ActionIcon: react30.NamedExoticComponent<ActionIconProps>;
5
+ declare const ActionIcon: react38.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 react44 from "react";
2
+ import * as react67 from "react";
3
3
 
4
4
  //#region src/Alert/Alert.d.ts
5
- declare const Alert: react44.NamedExoticComponent<AlertProps>;
5
+ declare const Alert: react67.NamedExoticComponent<AlertProps>;
6
6
  //#endregion
7
7
  export { Alert };
8
8
  //# sourceMappingURL=Alert.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { AutoCompleteProps } from "./type.mjs";
2
- import * as react45 from "react";
2
+ import * as react53 from "react";
3
3
 
4
4
  //#region src/AutoComplete/Select.d.ts
5
- declare const AutoComplete: react45.NamedExoticComponent<AutoCompleteProps>;
5
+ declare const AutoComplete: react53.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 react43 from "react";
2
+ import * as react52 from "react";
3
3
 
4
4
  //#region src/Avatar/AvatarGroup/index.d.ts
5
- declare const AvatarGroup: react43.NamedExoticComponent<AvatarGroupProps>;
5
+ declare const AvatarGroup: react52.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 react28 from "react";
2
+ import * as react51 from "react";
3
3
 
4
4
  //#region src/Burger/Burger.d.ts
5
- declare const Burger: react28.NamedExoticComponent<BurgerProps>;
5
+ declare const Burger: react51.NamedExoticComponent<BurgerProps>;
6
6
  //#endregion
7
7
  export { Burger };
8
8
  //# sourceMappingURL=Burger.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { CodeEditorProps } from "./type.mjs";
2
- import * as react29 from "react";
2
+ import * as react50 from "react";
3
3
 
4
4
  //#region src/CodeEditor/CodeEditor.d.ts
5
- declare const CodeEditor: react29.NamedExoticComponent<CodeEditorProps>;
5
+ declare const CodeEditor: react50.NamedExoticComponent<CodeEditorProps>;
6
6
  //#endregion
7
7
  export { CodeEditor };
8
8
  //# sourceMappingURL=CodeEditor.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { CollapseProps } from "./type.mjs";
2
- import * as react27 from "react";
2
+ import * as react49 from "react";
3
3
 
4
4
  //#region src/Collapse/Collapse.d.ts
5
- declare const Collapse: react27.NamedExoticComponent<CollapseProps>;
5
+ declare const Collapse: react49.NamedExoticComponent<CollapseProps>;
6
6
  //#endregion
7
7
  export { Collapse };
8
8
  //# sourceMappingURL=Collapse.d.mts.map
@@ -1,7 +1,7 @@
1
1
  import { MotionComponentType } from "../MotionProvider/index.mjs";
2
- import { TranslationResources } from "../i18n/types.mjs";
2
+ import { TranslationResourcesInput } from "../i18n/types.mjs";
3
3
  import { CDN, CdnApi } from "../utils/genCdnUrl.mjs";
4
- import * as react66 from "react";
4
+ import * as react55 from "react";
5
5
  import { ElementType, ReactNode } from "react";
6
6
 
7
7
  //#region src/ConfigProvider/index.d.ts
@@ -17,9 +17,9 @@ interface ConfigProviderProps {
17
17
  config?: Config;
18
18
  locale?: string;
19
19
  motion: MotionComponentType;
20
- resources?: TranslationResources[] | Record<string, TranslationResources>;
20
+ resources?: TranslationResourcesInput;
21
21
  }
22
- declare const ConfigProvider: react66.NamedExoticComponent<ConfigProviderProps>;
22
+ declare const ConfigProvider: react55.NamedExoticComponent<ConfigProviderProps>;
23
23
  type CdnFn = ({
24
24
  pkg,
25
25
  version,
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { MotionComponent } from "../MotionProvider/index.mjs";
4
4
  import { genCdnUrl } from "../utils/genCdnUrl.mjs";
5
- import { createContext, memo, use, useMemo } from "react";
5
+ import { createContext, memo, use, useEffect, useMemo, useRef, useState } from "react";
6
6
  import { jsx } from "react/jsx-runtime";
7
7
 
8
8
  //#region src/ConfigProvider/index.tsx
@@ -11,19 +11,45 @@ const I18nContextInternal = createContext({
11
11
  locale: "en",
12
12
  t: (key) => key
13
13
  });
14
+ const isThenable = (value) => typeof value?.then === "function";
14
15
  const ConfigProvider = memo(({ children, config, locale, resources, motion }) => {
16
+ const fallbackLocale = locale ?? "en";
17
+ const [resolvedResources, setResolvedResources] = useState(() => resources && !isThenable(resources) ? resources : void 0);
18
+ const [resolvedLocale, setResolvedLocale] = useState(fallbackLocale);
19
+ const latestRequestId = useRef(0);
20
+ useEffect(() => {
21
+ const requestId = ++latestRequestId.current;
22
+ if (!resources) {
23
+ setResolvedResources(void 0);
24
+ setResolvedLocale(fallbackLocale);
25
+ return;
26
+ }
27
+ if (isThenable(resources)) {
28
+ const targetLocale = fallbackLocale;
29
+ resources.then((nextResources) => {
30
+ if (latestRequestId.current !== requestId) return;
31
+ setResolvedResources(nextResources);
32
+ setResolvedLocale(targetLocale);
33
+ }).catch(() => {
34
+ if (latestRequestId.current !== requestId) return;
35
+ });
36
+ return;
37
+ }
38
+ setResolvedResources(resources);
39
+ setResolvedLocale(fallbackLocale);
40
+ }, [fallbackLocale, resources]);
41
+ const currentResources = isThenable(resources) ? resolvedResources : resources;
42
+ const currentLocale = isThenable(resources) ? resolvedLocale : fallbackLocale;
15
43
  return /* @__PURE__ */ jsx(I18nContextInternal, {
16
44
  value: useMemo(() => {
17
- const currentLocale = locale || "en";
18
- const currentResources = resources || [];
19
- const resourceList = Array.isArray(currentResources) ? currentResources : Object.values(currentResources);
45
+ const resourceList = Array.isArray(currentResources) ? currentResources : currentResources ? Object.values(currentResources) : [];
20
46
  const mergedResources = Object.assign({}, ...resourceList);
21
47
  const t = (key) => mergedResources[key] || key;
22
48
  return {
23
49
  locale: currentLocale,
24
50
  t
25
51
  };
26
- }, [locale, resources]),
52
+ }, [currentLocale, currentResources]),
27
53
  children: /* @__PURE__ */ jsx(ConfigContext, {
28
54
  value: config ?? null,
29
55
  children: /* @__PURE__ */ jsx(MotionComponent, {
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["cdnFallback: CdnFn"],"sources":["../../src/ConfigProvider/index.tsx"],"sourcesContent":["'use client';\n\nimport { ElementType, ReactNode, createContext, memo, use, useMemo } from 'react';\n\nimport { MotionComponent, type MotionComponentType } from '@/MotionProvider';\nimport type { I18nContextValue, TranslationKey, TranslationResources } from '@/i18n/types';\nimport { CDN, CdnApi, genCdnUrl } from '@/utils/genCdnUrl';\n\nexport interface Config {\n aAs?: ElementType;\n customCdnFn?: CdnFn;\n imgAs?: ElementType;\n imgUnoptimized?: boolean;\n proxy?: CDN | 'custom';\n}\n\nexport const ConfigContext = createContext<Config | null>(null);\n\n// Internal i18n context\nconst I18nContextInternal = createContext<I18nContextValue>({\n locale: 'en',\n t: (key: TranslationKey) => key,\n});\n\nexport interface ConfigProviderProps {\n children: ReactNode;\n config?: Config;\n // i18n props - flattened at top level\n locale?: string;\n motion: MotionComponentType;\n resources?: TranslationResources[] | Record<string, TranslationResources>;\n}\n\nconst ConfigProvider = memo<ConfigProviderProps>(\n ({ children, config, locale, resources, motion }) => {\n const i18nValue = useMemo((): I18nContextValue => {\n const currentLocale = locale || 'en';\n const currentResources = resources || [];\n const resourceList = Array.isArray(currentResources)\n ? currentResources\n : Object.values(currentResources);\n const mergedResources = Object.assign({}, ...resourceList);\n const t = (key: TranslationKey): string => mergedResources[key] || key;\n return { locale: currentLocale, t };\n }, [locale, resources]);\n\n return (\n <I18nContextInternal value={i18nValue}>\n <ConfigContext value={config ?? null}>\n <MotionComponent value={motion}>{children}</MotionComponent>\n </ConfigContext>\n </I18nContextInternal>\n );\n },\n);\n\n// useCdnFn\nexport type CdnFn = ({ pkg, version, path }: CdnApi) => string;\n\nconst cdnFallback: CdnFn = ({ pkg, version, path }) =>\n genCdnUrl({ path, pkg, proxy: 'aliyun', version });\n\nexport const useCdnFn = (): CdnFn => {\n const config = use(ConfigContext);\n if (!config) return cdnFallback;\n if (config?.proxy !== 'custom')\n return ({ pkg, version, path }) =>\n genCdnUrl({ path, pkg, proxy: config.proxy as any, version });\n return config?.customCdnFn || cdnFallback;\n};\n\n// useI18n hook\nexport const useI18n = () => use(I18nContextInternal);\n\n// Export I18nContext for external reference\nexport { I18nContextInternal as I18nContext };\n\nexport default ConfigProvider;\n"],"mappings":";;;;;;;;AAgBA,MAAa,gBAAgB,cAA6B,KAAK;AAG/D,MAAM,sBAAsB,cAAgC;CAC1D,QAAQ;CACR,IAAI,QAAwB;CAC7B,CAAC;AAWF,MAAM,iBAAiB,MACpB,EAAE,UAAU,QAAQ,QAAQ,WAAW,aAAa;AAYnD,QACE,oBAAC;EAAoB,OAZL,cAAgC;GAChD,MAAM,gBAAgB,UAAU;GAChC,MAAM,mBAAmB,aAAa,EAAE;GACxC,MAAM,eAAe,MAAM,QAAQ,iBAAiB,GAChD,mBACA,OAAO,OAAO,iBAAiB;GACnC,MAAM,kBAAkB,OAAO,OAAO,EAAE,EAAE,GAAG,aAAa;GAC1D,MAAM,KAAK,QAAgC,gBAAgB,QAAQ;AACnE,UAAO;IAAE,QAAQ;IAAe;IAAG;KAClC,CAAC,QAAQ,UAAU,CAAC;YAInB,oBAAC;GAAc,OAAO,UAAU;aAC9B,oBAAC;IAAgB,OAAO;IAAS;KAA2B;IAC9C;GACI;EAG3B;AAKD,MAAMA,eAAsB,EAAE,KAAK,SAAS,WAC1C,UAAU;CAAE;CAAM;CAAK,OAAO;CAAU;CAAS,CAAC;AAEpD,MAAa,iBAAwB;CACnC,MAAM,SAAS,IAAI,cAAc;AACjC,KAAI,CAAC,OAAQ,QAAO;AACpB,KAAI,QAAQ,UAAU,SACpB,SAAQ,EAAE,KAAK,SAAS,WACtB,UAAU;EAAE;EAAM;EAAK,OAAO,OAAO;EAAc;EAAS,CAAC;AACjE,QAAO,QAAQ,eAAe;;AAIhC,MAAa,gBAAgB,IAAI,oBAAoB;AAKrD,6BAAe"}
1
+ {"version":3,"file":"index.mjs","names":["cdnFallback: CdnFn"],"sources":["../../src/ConfigProvider/index.tsx"],"sourcesContent":["'use client';\n\nimport {\n ElementType,\n ReactNode,\n createContext,\n memo,\n use,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport { MotionComponent, type MotionComponentType } from '@/MotionProvider';\nimport type {\n I18nContextValue,\n TranslationKey,\n TranslationResourcesInput,\n TranslationResourcesMap,\n} from '@/i18n/types';\nimport { CDN, CdnApi, genCdnUrl } from '@/utils/genCdnUrl';\n\nexport interface Config {\n aAs?: ElementType;\n customCdnFn?: CdnFn;\n imgAs?: ElementType;\n imgUnoptimized?: boolean;\n proxy?: CDN | 'custom';\n}\n\nexport const ConfigContext = createContext<Config | null>(null);\n\n// Internal i18n context\nconst I18nContextInternal = createContext<I18nContextValue>({\n locale: 'en',\n t: (key: TranslationKey) => key,\n});\n\nexport interface ConfigProviderProps {\n children: ReactNode;\n config?: Config;\n // i18n props - flattened at top level\n locale?: string;\n motion: MotionComponentType;\n resources?: TranslationResourcesInput;\n}\n\nconst isThenable = (value: unknown): value is Promise<TranslationResourcesMap> =>\n typeof (value as { then?: unknown })?.then === 'function';\n\nconst ConfigProvider = memo<ConfigProviderProps>(\n ({ children, config, locale, resources, motion }) => {\n const fallbackLocale = locale ?? 'en';\n const [resolvedResources, setResolvedResources] = useState<TranslationResourcesMap | undefined>(\n () => (resources && !isThenable(resources) ? resources : undefined),\n );\n const [resolvedLocale, setResolvedLocale] = useState(fallbackLocale);\n const latestRequestId = useRef(0);\n\n useEffect(() => {\n const requestId = ++latestRequestId.current;\n\n if (!resources) {\n setResolvedResources(undefined);\n setResolvedLocale(fallbackLocale);\n return;\n }\n\n if (isThenable(resources)) {\n const targetLocale = fallbackLocale;\n resources\n .then((nextResources) => {\n if (latestRequestId.current !== requestId) return;\n setResolvedResources(nextResources);\n setResolvedLocale(targetLocale);\n })\n .catch(() => {\n if (latestRequestId.current !== requestId) return;\n });\n return;\n }\n\n setResolvedResources(resources);\n setResolvedLocale(fallbackLocale);\n }, [fallbackLocale, resources]);\n\n const currentResources = isThenable(resources) ? resolvedResources : resources;\n const currentLocale = isThenable(resources) ? resolvedLocale : fallbackLocale;\n\n const i18nValue = useMemo((): I18nContextValue => {\n const resourceList = Array.isArray(currentResources)\n ? currentResources\n : currentResources\n ? Object.values(currentResources)\n : [];\n const mergedResources = Object.assign({}, ...resourceList);\n const t = (key: TranslationKey): string => mergedResources[key] || key;\n return { locale: currentLocale, t };\n }, [currentLocale, currentResources]);\n\n return (\n <I18nContextInternal value={i18nValue}>\n <ConfigContext value={config ?? null}>\n <MotionComponent value={motion}>{children}</MotionComponent>\n </ConfigContext>\n </I18nContextInternal>\n );\n },\n);\n\n// useCdnFn\nexport type CdnFn = ({ pkg, version, path }: CdnApi) => string;\n\nconst cdnFallback: CdnFn = ({ pkg, version, path }) =>\n genCdnUrl({ path, pkg, proxy: 'aliyun', version });\n\nexport const useCdnFn = (): CdnFn => {\n const config = use(ConfigContext);\n if (!config) return cdnFallback;\n if (config?.proxy !== 'custom')\n return ({ pkg, version, path }) =>\n genCdnUrl({ path, pkg, proxy: config.proxy as any, version });\n return config?.customCdnFn || cdnFallback;\n};\n\n// useI18n hook\nexport const useI18n = () => use(I18nContextInternal);\n\n// Export I18nContext for external reference\nexport {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;KAClC,CAAC,eAAe,iBAAiB,CAAC;YAIjC,oBAAC;GAAc,OAAO,UAAU;aAC9B,oBAAC;IAAgB,OAAO;IAAS;KAA2B;IAC9C;GACI;EAG3B;AAKD,MAAMA,eAAsB,EAAE,KAAK,SAAS,WAC1C,UAAU;CAAE;CAAM;CAAK,OAAO;CAAU;CAAS,CAAC;AAEpD,MAAa,iBAAwB;CACnC,MAAM,SAAS,IAAI,cAAc;AACjC,KAAI,CAAC,OAAQ,QAAO;AACpB,KAAI,QAAQ,UAAU,SACpB,SAAQ,EAAE,KAAK,SAAS,WACtB,UAAU;EAAE;EAAM;EAAK,OAAO,OAAO;EAAc;EAAS,CAAC;AACjE,QAAO,QAAQ,eAAe;;AAIhC,MAAa,gBAAgB,IAAI,oBAAoB;AAKrD,6BAAe"}
@@ -1,8 +1,8 @@
1
1
  import { CopyButtonProps } from "./type.mjs";
2
- import * as react0 from "react";
2
+ import * as react48 from "react";
3
3
 
4
4
  //#region src/CopyButton/CopyButton.d.ts
5
- declare const CopyButton: react0.NamedExoticComponent<CopyButtonProps>;
5
+ declare const CopyButton: react48.NamedExoticComponent<CopyButtonProps>;
6
6
  //#endregion
7
7
  export { CopyButton };
8
8
  //# sourceMappingURL=CopyButton.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { DatePickerProps } from "./type.mjs";
2
- import * as react42 from "react";
2
+ import * as react47 from "react";
3
3
 
4
4
  //#region src/DatePicker/DatePicker.d.ts
5
- declare const DatePicker: react42.NamedExoticComponent<DatePickerProps>;
5
+ declare const DatePicker: react47.NamedExoticComponent<DatePickerProps>;
6
6
  //#endregion
7
7
  export { DatePicker };
8
8
  //# sourceMappingURL=DatePicker.d.mts.map
@@ -1,9 +1,9 @@
1
1
  import { DivProps } from "../../types/index.mjs";
2
- import * as react37 from "react";
2
+ import * as react43 from "react";
3
3
 
4
4
  //#region src/DraggablePanel/components/DraggablePanelBody.d.ts
5
5
  type DraggablePanelBodyProps = DivProps;
6
- declare const DraggablePanelBody: react37.NamedExoticComponent<DivProps>;
6
+ declare const DraggablePanelBody: react43.NamedExoticComponent<DivProps>;
7
7
  //#endregion
8
8
  export { DraggablePanelBody, DraggablePanelBodyProps };
9
9
  //# sourceMappingURL=DraggablePanelBody.d.mts.map
@@ -1,9 +1,9 @@
1
1
  import { DivProps } from "../../types/index.mjs";
2
- import * as react38 from "react";
2
+ import * as react44 from "react";
3
3
 
4
4
  //#region src/DraggablePanel/components/DraggablePanelContainer.d.ts
5
5
  type DraggablePanelContainerProps = DivProps;
6
- declare const DraggablePanelContainer: react38.NamedExoticComponent<DivProps>;
6
+ declare const DraggablePanelContainer: react44.NamedExoticComponent<DivProps>;
7
7
  //#endregion
8
8
  export { DraggablePanelContainer, DraggablePanelContainerProps };
9
9
  //# sourceMappingURL=DraggablePanelContainer.d.mts.map
@@ -1,9 +1,9 @@
1
1
  import { DivProps } from "../../types/index.mjs";
2
- import * as react39 from "react";
2
+ import * as react45 from "react";
3
3
 
4
4
  //#region src/DraggablePanel/components/DraggablePanelFooter.d.ts
5
5
  type DraggablePanelFooterProps = DivProps;
6
- declare const DraggablePanelFooter: react39.NamedExoticComponent<DivProps>;
6
+ declare const DraggablePanelFooter: react45.NamedExoticComponent<DivProps>;
7
7
  //#endregion
8
8
  export { DraggablePanelFooter, DraggablePanelFooterProps };
9
9
  //# sourceMappingURL=DraggablePanelFooter.d.mts.map
@@ -1,5 +1,5 @@
1
1
  import { DivProps } from "../../types/index.mjs";
2
- import * as react40 from "react";
2
+ import * as react46 from "react";
3
3
 
4
4
  //#region src/DraggablePanel/components/DraggablePanelHeader.d.ts
5
5
  interface DraggablePanelHeaderProps extends Omit<DivProps, 'children'> {
@@ -9,7 +9,7 @@ interface DraggablePanelHeaderProps extends Omit<DivProps, 'children'> {
9
9
  setPin?: (pin: boolean) => void;
10
10
  title?: string;
11
11
  }
12
- declare const DraggablePanelHeader: react40.NamedExoticComponent<DraggablePanelHeaderProps>;
12
+ declare const DraggablePanelHeader: react46.NamedExoticComponent<DraggablePanelHeaderProps>;
13
13
  //#endregion
14
14
  export { DraggablePanelHeader, DraggablePanelHeaderProps };
15
15
  //# sourceMappingURL=DraggablePanelHeader.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { DraggableSideNavProps } from "./type.mjs";
2
- import * as react41 from "react";
2
+ import * as react42 from "react";
3
3
 
4
4
  //#region src/DraggableSideNav/DraggableSideNav.d.ts
5
- declare const DraggableSideNav: react41.NamedExoticComponent<DraggableSideNavProps>;
5
+ declare const DraggableSideNav: react42.NamedExoticComponent<DraggableSideNavProps>;
6
6
  //#endregion
7
7
  export { DraggableSideNav };
8
8
  //# sourceMappingURL=DraggableSideNav.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { DrawerProps } from "./type.mjs";
2
- import * as react36 from "react";
2
+ import * as react54 from "react";
3
3
 
4
4
  //#region src/Drawer/Drawer.d.ts
5
- declare const Drawer: react36.NamedExoticComponent<DrawerProps>;
5
+ declare const Drawer: react54.NamedExoticComponent<DrawerProps>;
6
6
  //#endregion
7
7
  export { Drawer };
8
8
  //# sourceMappingURL=Drawer.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { DropdownProps } from "./type.mjs";
2
- import * as react35 from "react";
2
+ import * as react65 from "react";
3
3
 
4
4
  //#region src/Dropdown/Dropdown.d.ts
5
- declare const Dropdown: react35.NamedExoticComponent<DropdownProps>;
5
+ declare const Dropdown: react65.NamedExoticComponent<DropdownProps>;
6
6
  //#endregion
7
7
  export { Dropdown };
8
8
  //# sourceMappingURL=Dropdown.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { EditableTextProps } from "./type.mjs";
2
- import * as react34 from "react";
2
+ import * as react41 from "react";
3
3
 
4
4
  //#region src/EditableText/EditableText.d.ts
5
- declare const EditableText: react34.NamedExoticComponent<EditableTextProps>;
5
+ declare const EditableText: react41.NamedExoticComponent<EditableTextProps>;
6
6
  //#endregion
7
7
  export { EditableText };
8
8
  //# sourceMappingURL=EditableText.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { EmojiPickerProps } from "./type.mjs";
2
- import * as react33 from "react";
2
+ import * as react40 from "react";
3
3
 
4
4
  //#region src/EmojiPicker/EmojiPicker.d.ts
5
- declare const EmojiPicker: react33.NamedExoticComponent<EmojiPickerProps>;
5
+ declare const EmojiPicker: react40.NamedExoticComponent<EmojiPickerProps>;
6
6
  //#endregion
7
7
  export { EmojiPicker };
8
8
  //# sourceMappingURL=EmojiPicker.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { FlexBasicProps } from "./type.mjs";
2
- import * as react25 from "react";
2
+ import * as react39 from "react";
3
3
 
4
4
  //#region src/Flex/FlexBasic.d.ts
5
- declare const _default: react25.NamedExoticComponent<FlexBasicProps>;
5
+ declare const _default: react39.NamedExoticComponent<FlexBasicProps>;
6
6
  //#endregion
7
7
  export { _default };
8
8
  //# sourceMappingURL=FlexBasic.d.mts.map
@@ -1,10 +1,10 @@
1
- import * as react65 from "react";
1
+ import * as react58 from "react";
2
2
 
3
3
  //#region src/FontLoader/index.d.ts
4
4
  interface FontLoaderProps {
5
5
  url: string;
6
6
  }
7
- declare const FontLoader: react65.NamedExoticComponent<FontLoaderProps>;
7
+ declare const FontLoader: react58.NamedExoticComponent<FontLoaderProps>;
8
8
  //#endregion
9
9
  export { FontLoader, FontLoaderProps };
10
10
  //# sourceMappingURL=index.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { FooterProps } from "./type.mjs";
2
- import * as react13 from "react";
2
+ import * as react37 from "react";
3
3
 
4
4
  //#region src/Footer/Footer.d.ts
5
- declare const Footer: react13.NamedExoticComponent<FooterProps>;
5
+ declare const Footer: react37.NamedExoticComponent<FooterProps>;
6
6
  //#endregion
7
7
  export { Footer };
8
8
  //# sourceMappingURL=Footer.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { FormGroupProps } from "../type.mjs";
2
- import * as react59 from "react";
2
+ import * as react33 from "react";
3
3
 
4
4
  //#region src/Form/components/FormGroup.d.ts
5
- declare const FormGroup: react59.NamedExoticComponent<FormGroupProps>;
5
+ declare const FormGroup: react33.NamedExoticComponent<FormGroupProps>;
6
6
  //#endregion
7
7
  export { FormGroup };
8
8
  //# sourceMappingURL=FormGroup.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { FormItemProps } from "../type.mjs";
2
- import * as react60 from "react";
2
+ import * as react32 from "react";
3
3
 
4
4
  //#region src/Form/components/FormItem.d.ts
5
- declare const FormItem: react60.NamedExoticComponent<FormItemProps>;
5
+ declare const FormItem: react32.NamedExoticComponent<FormItemProps>;
6
6
  //#endregion
7
7
  export { FormItem };
8
8
  //# sourceMappingURL=FormItem.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { FormSubmitFooterProps } from "../type.mjs";
2
- import * as react61 from "react";
2
+ import * as react31 from "react";
3
3
 
4
4
  //#region src/Form/components/FormSubmitFooter.d.ts
5
- declare const FormSubmitFooter: react61.NamedExoticComponent<FormSubmitFooterProps>;
5
+ declare const FormSubmitFooter: react31.NamedExoticComponent<FormSubmitFooterProps>;
6
6
  //#endregion
7
7
  export { FormSubmitFooter };
8
8
  //# sourceMappingURL=FormSubmitFooter.d.mts.map
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
 
3
- import { MotionComponent } from "../../MotionProvider/index.mjs";
3
+ import { useMotionComponent } from "../../MotionProvider/index.mjs";
4
4
  import FlexBasic_default from "../../Flex/FlexBasic.mjs";
5
5
  import Icon_default from "../../Icon/Icon.mjs";
6
6
  import Button_default from "../../Button/Button.mjs";
@@ -9,7 +9,7 @@ import { useSubmitFooterStyles } from "../style.mjs";
9
9
  import { useFormContext } from "./FormProvider.mjs";
10
10
  import form_default from "../../i18n/resources/en/form.mjs";
11
11
  import { merge, removeUndefined } from "./merge.mjs";
12
- import { memo, use, useEffect, useMemo, useState } from "react";
12
+ import { memo, useEffect, useMemo, useState } from "react";
13
13
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
14
14
  import { Form } from "antd";
15
15
  import { InfoIcon } from "lucide-react";
@@ -17,7 +17,7 @@ import isEqual from "fast-deep-equal";
17
17
 
18
18
  //#region src/Form/components/FormSubmitFooter.tsx
19
19
  const FormSubmitFooter = memo(({ enableReset = true, buttonProps, float, onReset, saveButtonProps, resetButtonProps, enableUnsavedWarning, children, texts, className, ...rest }) => {
20
- const Motion = use(MotionComponent);
20
+ const Motion = useMotionComponent();
21
21
  const { form, initialValues, submitLoading } = useFormContext();
22
22
  const [hasUnsavedChanges, setHasUnsavedChanges] = useState(false);
23
23
  const values = Form.useWatch([], form) || {};
@@ -1 +1 @@
1
- {"version":3,"file":"FormSubmitFooter.mjs","names":["formMessages","useStyles","Icon","Button","Flexbox"],"sources":["../../../src/Form/components/FormSubmitFooter.tsx"],"sourcesContent":["'use client';\n\nimport { Form } from 'antd';\nimport isEqual from 'fast-deep-equal';\nimport { InfoIcon } from 'lucide-react';\nimport { memo, use, useEffect, useMemo, useState } from 'react';\n\nimport Button from '@/Button';\nimport { Flexbox } from '@/Flex';\nimport Icon from '@/Icon';\nimport { MotionComponent } from '@/MotionProvider';\nimport formMessages from '@/i18n/resources/en/form';\nimport { useTranslation } from '@/i18n/useTranslation';\n\nimport { useSubmitFooterStyles as useStyles } from '../style';\nimport type { FormSubmitFooterProps } from '../type';\nimport { useFormContext } from './FormProvider';\nimport { merge, removeUndefined } from './merge';\n\nconst FormSubmitFooter = memo<FormSubmitFooterProps>(\n ({\n enableReset = true,\n buttonProps,\n float,\n onReset,\n saveButtonProps,\n resetButtonProps,\n enableUnsavedWarning,\n children,\n texts,\n className,\n ...rest\n }) => {\n const Motion = use(MotionComponent);\n const { form, initialValues, submitLoading } = useFormContext();\n const [hasUnsavedChanges, setHasUnsavedChanges] = useState(false);\n const values = Form.useWatch([], form) || {};\n const { t } = useTranslation(formMessages);\n\n const { cx, styles, theme } = useStyles();\n\n const v = useMemo(() => removeUndefined(values), [values]);\n\n const initialV = useMemo(() => removeUndefined(initialValues), [initialValues]);\n\n const mergedV = useMemo(() => merge(initialV, v), [v, initialV]);\n\n useEffect(() => {\n setHasUnsavedChanges(!isEqual(mergedV, initialV));\n }, [mergedV, initialV, submitLoading]);\n\n const unsavedWarningText = texts?.unSavedWarning ?? t('form.unsavedWarning');\n const unsavedText = texts?.unSaved ?? t('form.unsavedChanges');\n const resetText = texts?.reset ?? t('form.reset');\n const submitText = texts?.submit ?? t('form.submit');\n\n const fn = (e: BeforeUnloadEvent) => {\n if (hasUnsavedChanges) {\n e.returnValue = unsavedWarningText;\n } else {\n delete e.returnValue;\n }\n };\n\n useEffect(() => {\n if (!enableUnsavedWarning) return;\n if (typeof window === 'undefined' || !hasUnsavedChanges) return;\n // 添加离开页面的提示\n window.addEventListener('beforeunload', fn);\n return () => window.removeEventListener('beforeunload', fn);\n }, [enableUnsavedWarning, hasUnsavedChanges, unsavedWarningText]);\n\n const content = (\n <>\n {(float || hasUnsavedChanges) && (\n <>\n <Icon\n color={theme.colorTextDescription}\n icon={InfoIcon}\n size={12}\n style={{ marginLeft: 8 }}\n />\n <span\n style={{\n color: theme.colorTextDescription,\n flex: 'none',\n fontSize: 12,\n marginRight: float ? 16 : 4,\n }}\n >\n {unsavedText}\n </span>\n </>\n )}\n {children}\n {enableReset && (float || hasUnsavedChanges) && (\n <Button\n htmlType=\"button\"\n onClick={() => {\n onReset?.(v, initialV);\n form?.resetFields();\n }}\n shape={float ? 'round' : undefined}\n variant={'filled'}\n {...buttonProps}\n {...resetButtonProps}\n >\n {resetText}\n </Button>\n )}\n <Button\n htmlType=\"submit\"\n loading={submitLoading}\n shape={float ? 'round' : undefined}\n type=\"primary\"\n {...buttonProps}\n {...saveButtonProps}\n >\n {submitText}\n </Button>\n </>\n );\n\n if (!float)\n return (\n <Flexbox\n align={'center'}\n className={cx(styles.footer, className)}\n gap={8}\n horizontal\n justify={'flex-end'}\n {...rest}\n >\n {content}\n </Flexbox>\n );\n\n return (\n <Motion.div\n animate={hasUnsavedChanges ? 'visible' : 'hidden'}\n className={styles.floatFooter}\n initial={'hidden'}\n transition={{ duration: 0.1, ease: 'easeOut' }}\n variants={{\n hidden: {\n opacity: 0,\n x: '-50%',\n y: 20,\n },\n visible: {\n opacity: 1,\n x: '-50%',\n y: 0,\n },\n }}\n >\n <Flexbox\n align={'center'}\n className={className}\n gap={8}\n horizontal\n justify={'center'}\n {...rest}\n >\n {content}\n </Flexbox>\n </Motion.div>\n );\n },\n);\n\nFormSubmitFooter.displayName = 'FormSubmitFooter';\n\nexport default FormSubmitFooter;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAmBA,MAAM,mBAAmB,MACtB,EACC,cAAc,MACd,aACA,OACA,SACA,iBACA,kBACA,sBACA,UACA,OACA,WACA,GAAG,WACC;CACJ,MAAM,SAAS,IAAI,gBAAgB;CACnC,MAAM,EAAE,MAAM,eAAe,kBAAkB,gBAAgB;CAC/D,MAAM,CAAC,mBAAmB,wBAAwB,SAAS,MAAM;CACjE,MAAM,SAAS,KAAK,SAAS,EAAE,EAAE,KAAK,IAAI,EAAE;CAC5C,MAAM,EAAE,MAAM,eAAeA,aAAa;CAE1C,MAAM,EAAE,IAAI,QAAQ,UAAUC,uBAAW;CAEzC,MAAM,IAAI,cAAc,gBAAgB,OAAO,EAAE,CAAC,OAAO,CAAC;CAE1D,MAAM,WAAW,cAAc,gBAAgB,cAAc,EAAE,CAAC,cAAc,CAAC;CAE/E,MAAM,UAAU,cAAc,MAAM,UAAU,EAAE,EAAE,CAAC,GAAG,SAAS,CAAC;AAEhE,iBAAgB;AACd,uBAAqB,CAAC,QAAQ,SAAS,SAAS,CAAC;IAChD;EAAC;EAAS;EAAU;EAAc,CAAC;CAEtC,MAAM,qBAAqB,OAAO,kBAAkB,EAAE,sBAAsB;CAC5E,MAAM,cAAc,OAAO,WAAW,EAAE,sBAAsB;CAC9D,MAAM,YAAY,OAAO,SAAS,EAAE,aAAa;CACjD,MAAM,aAAa,OAAO,UAAU,EAAE,cAAc;CAEpD,MAAM,MAAM,MAAyB;AACnC,MAAI,kBACF,GAAE,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BAAe"}
1
+ {"version":3,"file":"FormSubmitFooter.mjs","names":["formMessages","useStyles","Icon","Button","Flexbox"],"sources":["../../../src/Form/components/FormSubmitFooter.tsx"],"sourcesContent":["'use client';\n\nimport { Form } from 'antd';\nimport isEqual from 'fast-deep-equal';\nimport { InfoIcon } from 'lucide-react';\nimport { memo, useEffect, useMemo, useState } from 'react';\n\nimport Button from '@/Button';\nimport { Flexbox } from '@/Flex';\nimport Icon from '@/Icon';\nimport { useMotionComponent } from '@/MotionProvider';\nimport formMessages from '@/i18n/resources/en/form';\nimport { useTranslation } from '@/i18n/useTranslation';\n\nimport { useSubmitFooterStyles as useStyles } from '../style';\nimport type { FormSubmitFooterProps } from '../type';\nimport { useFormContext } from './FormProvider';\nimport { merge, removeUndefined } from './merge';\n\nconst FormSubmitFooter = memo<FormSubmitFooterProps>(\n ({\n enableReset = true,\n buttonProps,\n float,\n onReset,\n saveButtonProps,\n resetButtonProps,\n enableUnsavedWarning,\n children,\n texts,\n className,\n ...rest\n }) => {\n const Motion = useMotionComponent();\n const { form, initialValues, submitLoading } = useFormContext();\n const [hasUnsavedChanges, setHasUnsavedChanges] = useState(false);\n const values = Form.useWatch([], form) || {};\n const { t } = useTranslation(formMessages);\n\n const { cx, styles, theme } = useStyles();\n\n const v = useMemo(() => removeUndefined(values), [values]);\n\n const initialV = useMemo(() => removeUndefined(initialValues), [initialValues]);\n\n const mergedV = useMemo(() => merge(initialV, v), [v, initialV]);\n\n useEffect(() => {\n setHasUnsavedChanges(!isEqual(mergedV, initialV));\n }, [mergedV, initialV, submitLoading]);\n\n const unsavedWarningText = texts?.unSavedWarning ?? t('form.unsavedWarning');\n const unsavedText = texts?.unSaved ?? t('form.unsavedChanges');\n const resetText = texts?.reset ?? t('form.reset');\n const submitText = texts?.submit ?? t('form.submit');\n\n const fn = (e: BeforeUnloadEvent) => {\n if (hasUnsavedChanges) {\n e.returnValue = unsavedWarningText;\n } else {\n delete e.returnValue;\n }\n };\n\n useEffect(() => {\n if (!enableUnsavedWarning) return;\n if (typeof window === 'undefined' || !hasUnsavedChanges) return;\n // 添加离开页面的提示\n window.addEventListener('beforeunload', fn);\n return () => window.removeEventListener('beforeunload', fn);\n }, [enableUnsavedWarning, hasUnsavedChanges, unsavedWarningText]);\n\n const content = (\n <>\n {(float || hasUnsavedChanges) && (\n <>\n <Icon\n color={theme.colorTextDescription}\n icon={InfoIcon}\n size={12}\n style={{ marginLeft: 8 }}\n />\n <span\n style={{\n color: theme.colorTextDescription,\n flex: 'none',\n fontSize: 12,\n marginRight: float ? 16 : 4,\n }}\n >\n {unsavedText}\n </span>\n </>\n )}\n {children}\n {enableReset && (float || hasUnsavedChanges) && (\n <Button\n htmlType=\"button\"\n onClick={() => {\n onReset?.(v, initialV);\n form?.resetFields();\n }}\n shape={float ? 'round' : undefined}\n variant={'filled'}\n {...buttonProps}\n {...resetButtonProps}\n >\n {resetText}\n </Button>\n )}\n <Button\n htmlType=\"submit\"\n loading={submitLoading}\n shape={float ? 'round' : undefined}\n type=\"primary\"\n {...buttonProps}\n {...saveButtonProps}\n >\n {submitText}\n </Button>\n </>\n );\n\n if (!float)\n return (\n <Flexbox\n align={'center'}\n className={cx(styles.footer, className)}\n gap={8}\n horizontal\n justify={'flex-end'}\n {...rest}\n >\n {content}\n </Flexbox>\n );\n\n return (\n <Motion.div\n animate={hasUnsavedChanges ? 'visible' : 'hidden'}\n className={styles.floatFooter}\n initial={'hidden'}\n transition={{ duration: 0.1, ease: 'easeOut' }}\n variants={{\n hidden: {\n opacity: 0,\n x: '-50%',\n y: 20,\n },\n visible: {\n opacity: 1,\n x: '-50%',\n y: 0,\n },\n }}\n >\n <Flexbox\n align={'center'}\n className={className}\n gap={8}\n horizontal\n justify={'center'}\n {...rest}\n >\n {content}\n </Flexbox>\n </Motion.div>\n );\n },\n);\n\nFormSubmitFooter.displayName = 'FormSubmitFooter';\n\nexport default FormSubmitFooter;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAmBA,MAAM,mBAAmB,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F,oBAAC;GACC,OAAO;IACL,OAAO,MAAM;IACb,MAAM;IACN,UAAU;IACV,aAAa,QAAQ,KAAK;IAC3B;aAEA;IACI,IACN;EAEJ;EACA,gBAAgB,SAAS,sBACxB,oBAACC;GACC,UAAS;GACT,eAAe;AACb,cAAU,GAAG,SAAS;AACtB,UAAM,aAAa;;GAErB,OAAO,QAAQ,UAAU;GACzB,SAAS;GACT,GAAI;GACJ,GAAI;aAEH;IACM;EAEX,oBAACA;GACC,UAAS;GACT,SAAS;GACT,OAAO,QAAQ,UAAU;GACzB,MAAK;GACL,GAAI;GACJ,GAAI;aAEH;IACM;KACR;AAGL,KAAI,CAAC,MACH,QACE,oBAACC;EACC,OAAO;EACP,WAAW,GAAG,OAAO,QAAQ,UAAU;EACvC,KAAK;EACL;EACA,SAAS;EACT,GAAI;YAEH;GACO;AAGd,QACE,oBAAC,OAAO;EACN,SAAS,oBAAoB,YAAY;EACzC,WAAW,OAAO;EAClB,SAAS;EACT,YAAY;GAAE,UAAU;GAAK,MAAM;GAAW;EAC9C,UAAU;GACR,QAAQ;IACN,SAAS;IACT,GAAG;IACH,GAAG;IACJ;GACD,SAAS;IACP,SAAS;IACT,GAAG;IACH,GAAG;IACJ;GACF;YAED,oBAACA;GACC,OAAO;GACI;GACX,KAAK;GACL;GACA,SAAS;GACT,GAAI;aAEH;IACO;GACC;EAGlB;AAED,iBAAiB,cAAc;AAE/B,+BAAe"}
@@ -1,8 +1,8 @@
1
1
  import { FormModalProps } from "./type.mjs";
2
- import * as react3 from "react";
2
+ import * as react34 from "react";
3
3
 
4
4
  //#region src/FormModal/FormModal.d.ts
5
- declare const FormModal: react3.NamedExoticComponent<FormModalProps>;
5
+ declare const FormModal: react34.NamedExoticComponent<FormModalProps>;
6
6
  //#endregion
7
7
  export { FormModal };
8
8
  //# sourceMappingURL=FormModal.d.mts.map