@lobehub/ui 4.8.0 → 4.9.0
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.
- package/es/Accordion/Accordion.d.mts +2 -2
- package/es/Accordion/AccordionItem.d.mts +2 -2
- package/es/ActionIcon/ActionIcon.d.mts +2 -2
- package/es/Alert/Alert.d.mts +2 -2
- package/es/AutoComplete/Select.d.mts +2 -2
- package/es/Avatar/AvatarGroup/index.d.mts +2 -2
- package/es/Burger/Burger.d.mts +2 -2
- package/es/CodeEditor/CodeEditor.d.mts +2 -2
- package/es/Collapse/Collapse.d.mts +2 -2
- package/es/ConfigProvider/index.d.mts +2 -2
- package/es/ContextMenu/ContextMenuHost.d.mts +2 -2
- package/es/ContextMenu/ContextMenuHost.mjs +7 -0
- package/es/ContextMenu/ContextMenuHost.mjs.map +1 -1
- package/es/ContextMenu/ContextMenuTrigger.d.mts +2 -3
- package/es/ContextMenu/ContextMenuTrigger.mjs.map +1 -1
- package/es/ContextMenu/imperative.d.mts +1 -1
- package/es/ContextMenu/index.d.mts +3 -2
- package/es/ContextMenu/index.mjs +2 -2
- package/es/ContextMenu/renderItems.mjs +30 -5
- package/es/ContextMenu/renderItems.mjs.map +1 -1
- package/es/ContextMenu/store.d.mts +8 -4
- package/es/ContextMenu/store.mjs +9 -1
- package/es/ContextMenu/store.mjs.map +1 -1
- package/es/ContextMenu/type.d.mts +10 -0
- package/es/CopyButton/CopyButton.d.mts +2 -2
- package/es/DatePicker/DatePicker.d.mts +2 -2
- package/es/DraggablePanel/components/DraggablePanelBody.d.mts +2 -2
- package/es/DraggablePanel/components/DraggablePanelContainer.d.mts +2 -2
- package/es/DraggablePanel/components/DraggablePanelFooter.d.mts +2 -2
- package/es/DraggablePanel/components/DraggablePanelHeader.d.mts +2 -2
- package/es/DraggableSideNav/DraggableSideNav.d.mts +2 -2
- package/es/Drawer/Drawer.d.mts +2 -2
- package/es/Dropdown/Dropdown.d.mts +2 -2
- package/es/DropdownMenu/DropdownMenu.d.mts +2 -2
- package/es/DropdownMenu/type.d.mts +5 -19
- package/es/EditableText/EditableText.d.mts +2 -2
- package/es/EmojiPicker/EmojiPicker.d.mts +2 -2
- package/es/Flex/FlexBasic.d.mts +2 -2
- package/es/FontLoader/index.d.mts +2 -2
- package/es/Footer/Footer.d.mts +2 -2
- package/es/Form/components/FormGroup.d.mts +2 -2
- package/es/Form/components/FormItem.d.mts +2 -2
- package/es/Form/components/FormSubmitFooter.d.mts +2 -2
- package/es/FormModal/FormModal.d.mts +2 -2
- package/es/GuideCard/GuideCard.d.mts +2 -2
- package/es/Header/Header.d.mts +2 -2
- package/es/Highlighter/Highlighter.d.mts +2 -2
- package/es/Highlighter/SyntaxHighlighter/index.d.mts +2 -2
- package/es/Hotkey/Hotkey.d.mts +2 -2
- package/es/HotkeyInput/HotkeyInput.d.mts +2 -2
- package/es/Icon/Icon.d.mts +2 -2
- package/es/Icon/components/IconProvider.d.mts +3 -3
- package/es/Image/PreviewGroup.d.mts +2 -2
- package/es/Input/Input.d.mts +2 -2
- package/es/Input/InputNumber.d.mts +2 -2
- package/es/Input/InputOPT.d.mts +2 -2
- package/es/Input/InputPassword.d.mts +2 -2
- package/es/Input/TextArea.d.mts +2 -2
- package/es/Layout/components/LayoutFooter.d.mts +2 -2
- package/es/Layout/components/LayoutHeader.d.mts +2 -2
- package/es/Layout/components/LayoutMain.d.mts +2 -2
- package/es/Layout/components/LayoutSidebar.d.mts +2 -2
- package/es/Layout/components/LayoutSidebarInner.d.mts +2 -2
- package/es/Layout/components/LayoutToc.d.mts +2 -2
- package/es/List/ListItem/index.d.mts +2 -2
- package/es/Markdown/Markdown.d.mts +2 -2
- package/es/Markdown/Typography.d.mts +2 -2
- package/es/Markdown/components/SearchResultCards/index.d.mts +2 -2
- package/es/MaskShadow/MaskShadow.d.mts +2 -2
- package/es/Menu/Menu.d.mts +2 -2
- package/es/Menu/baseItem.d.mts +15 -0
- package/es/Menu/checkboxItem.d.mts +27 -0
- package/es/Menu/index.d.mts +3 -1
- package/es/Mermaid/Mermaid.d.mts +2 -2
- package/es/Mermaid/SyntaxMermaid/index.d.mts +2 -2
- package/es/Modal/Modal.d.mts +2 -2
- package/es/Modal/ModalProvider.d.mts +2 -2
- package/es/Modal/imperative.mjs +8 -2
- package/es/Modal/imperative.mjs.map +1 -1
- package/es/MotionProvider/index.d.mts +2 -2
- package/es/SearchBar/SearchBar.d.mts +2 -2
- package/es/Segmented/Segmented.d.mts +2 -2
- package/es/Select/Select.d.mts +2 -2
- package/es/SideNav/SideNav.d.mts +2 -2
- package/es/SliderWithInput/SliderWithInput.d.mts +2 -2
- package/es/SortableList/components/DragHandle.d.mts +2 -2
- package/es/SortableList/components/SortableItem.d.mts +2 -2
- package/es/Tag/Tag.mjs +10 -15
- package/es/Tag/Tag.mjs.map +1 -1
- package/es/Tag/utils.mjs +9 -4
- package/es/Tag/utils.mjs.map +1 -1
- package/es/ThemeProvider/GlobalStyle/antdOverride.mjs +9 -15
- package/es/ThemeProvider/GlobalStyle/antdOverride.mjs.map +1 -1
- package/es/ThemeProvider/ThemeProvider.d.mts +2 -2
- package/es/ThemeProvider/ThemeProvider.mjs.map +1 -1
- package/es/Toc/Toc.d.mts +2 -2
- package/es/Tooltip/TooltipFloating.mjs +58 -36
- package/es/Tooltip/TooltipFloating.mjs.map +1 -1
- package/es/Tooltip/TooltipGroup.mjs +6 -0
- package/es/Tooltip/TooltipGroup.mjs.map +1 -1
- package/es/Tooltip/TooltipStandalone.mjs +1 -0
- package/es/Tooltip/TooltipStandalone.mjs.map +1 -1
- package/es/Tooltip/style.mjs +4 -1
- package/es/Tooltip/style.mjs.map +1 -1
- package/es/Video/index.d.mts +2 -2
- package/es/awesome/AuroraBackground/AuroraBackground.d.mts +2 -2
- package/es/awesome/BottomGradientButton/BottomGradientButton.d.mts +2 -2
- package/es/awesome/Features/Features.d.mts +2 -2
- package/es/awesome/Giscus/Giscus.d.mts +2 -2
- package/es/awesome/GradientButton/GradientButton.d.mts +2 -2
- package/es/awesome/GridBackground/GridBackground.d.mts +2 -2
- package/es/awesome/GridBackground/GridShowcase.d.mts +2 -2
- package/es/awesome/Hero/Hero.d.mts +2 -2
- package/es/awesome/Spline/Spine.d.mts +2 -2
- package/es/awesome/Spotlight/Spotlight.d.mts +2 -2
- package/es/awesome/SpotlightCard/SpotlightCard.d.mts +2 -2
- package/es/awesome/TypewriterEffect/TypewriterEffect.d.mts +2 -2
- package/es/brand/LobeChat/index.d.mts +2 -2
- package/es/brand/LobeHub/index.d.mts +2 -2
- package/es/brand/LogoThree/LogoSpline.d.mts +2 -2
- package/es/brand/LogoThree/index.d.mts +2 -2
- package/es/chat/BackBottom/BackBottom.d.mts +2 -2
- package/es/chat/ChatInputArea/components/ChatInputAreaInner.d.mts +2 -2
- package/es/chat/ChatItem/ChatItem.d.mts +2 -2
- package/es/chat/ChatList/ChatList.d.mts +2 -2
- package/es/chat/EditableMessage/EditableMessage.d.mts +2 -2
- package/es/chat/EditableMessageList/EditableMessageList.d.mts +2 -2
- package/es/chat/MessageInput/MessageInput.d.mts +2 -2
- package/es/chat/MessageModal/MessageModal.d.mts +2 -2
- package/es/color/ColorScales/index.d.mts +2 -2
- package/es/color/CssVar/index.d.mts +2 -2
- package/es/i18n/context.d.mts +2 -2
- package/es/icons/lucideExtra/BotPromptIcon.d.mts +2 -2
- package/es/icons/lucideExtra/CreateBotIcon.d.mts +2 -2
- package/es/icons/lucideExtra/DiscordIcon.d.mts +2 -2
- package/es/icons/lucideExtra/GlobeOffIcon.d.mts +2 -2
- package/es/icons/lucideExtra/GroupBotIcon.d.mts +2 -2
- package/es/icons/lucideExtra/GroupBotSquareIcon.d.mts +3 -3
- package/es/icons/lucideExtra/LeftClickIcon.d.mts +3 -3
- package/es/icons/lucideExtra/LeftDoubleClickIcon.d.mts +3 -3
- package/es/icons/lucideExtra/McpIcon.d.mts +3 -3
- package/es/icons/lucideExtra/ProviderIcon.d.mts +3 -3
- package/es/icons/lucideExtra/RightClickIcon.d.mts +3 -3
- package/es/icons/lucideExtra/RightDoubleClickIcon.d.mts +3 -3
- package/es/icons/lucideExtra/ShapesUploadIcon.d.mts +3 -3
- package/es/icons/lucideExtra/TreeDownRightIcon.d.mts +2 -2
- package/es/icons/lucideExtra/TreeUpDownRightIcon.d.mts +2 -2
- package/es/index.d.mts +5 -2
- package/es/index.mjs +2 -2
- package/es/mdx/Mdx/index.d.mts +2 -2
- package/es/mobile/ChatHeader/ChatHeaderTitle.d.mts +2 -2
- package/es/mobile/ChatInputArea/components/ChatSendButton.d.mts +2 -2
- package/es/mobile/TabBar/TabBar.d.mts +2 -2
- package/es/storybook/StoryBook/index.d.mts +2 -2
- package/es/utils/devSingleton.mjs +61 -0
- package/es/utils/devSingleton.mjs.map +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imperative.mjs","names":["modalStack: TModalStackItem[]","EMPTY_STACK: TModalStackItem[]"],"sources":["../../src/Modal/imperative.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode } from 'react';\nimport { memo, useState, useSyncExternalStore } from 'react';\nimport { createPortal } from 'react-dom';\n\nimport { useIsClient } from '@/hooks/useIsClient';\n\nimport { ModalStackItem } from './ModalStackItem';\nimport { RawModalStackItem } from './RawModalStackItem';\nimport type {\n ImperativeModalProps,\n ModalInstance,\n RawModalComponent,\n RawModalComponentProps,\n RawModalInstance,\n RawModalKeyOptions,\n RawModalOptions,\n} from './type';\n\ntype ModalStackItemBase = {\n id: string;\n};\n\ntype ModalStackItemModal = ModalStackItemBase & {\n kind: 'modal';\n props: ImperativeModalProps;\n};\n\ntype ModalStackItemRaw = ModalStackItemBase & {\n component: RawModalComponent;\n kind: 'raw';\n open: boolean;\n options?: RawModalOptions<PropertyKey, PropertyKey>;\n props: Record<string, unknown>;\n};\n\ntype TModalStackItem = ModalStackItemModal | ModalStackItemRaw;\n\ntype ModalStackProps = {\n stack: TModalStackItem[];\n};\n\nexport type ModalHostProps = {\n root?: HTMLElement | ShadowRoot | null;\n};\n\nconst MODAL_PORTAL_ATTR = 'data-lobe-ui-modal-portal';\n\n// Reuse one portal container per root (document.body by default).\nconst containerMap = new WeakMap<object, HTMLElement>();\n\nlet modalStack: TModalStackItem[] = [];\nlet modalSeed = 0;\nconst listeners = new Set<() => void>();\nconst rawDestroyTimers = new Map<string, number>();\n\nconst notify = () => {\n listeners.forEach((listener) => listener());\n};\n\nconst subscribe = (listener: () => void) => {\n listeners.add(listener);\n return () => listeners.delete(listener);\n};\n\nconst EMPTY_STACK: TModalStackItem[] = [];\nconst getSnapshot = () => modalStack;\nconst getServerSnapshot = () => EMPTY_STACK;\n\nconst getOrCreateContainer = (root: HTMLElement | ShadowRoot): HTMLElement => {\n const cached = containerMap.get(root);\n if (cached && cached.isConnected) return cached;\n\n const el = document.createElement('div');\n el.setAttribute(MODAL_PORTAL_ATTR, 'true');\n root.append(el);\n containerMap.set(root, el);\n return el;\n};\n\nconst resolveRoot = (root?: HTMLElement | ShadowRoot | null): HTMLElement | ShadowRoot | null => {\n if (root) return root;\n return document.body;\n};\n\nconst ModalPortal = ({\n children,\n root,\n}: {\n children: ReactNode;\n root?: HTMLElement | ShadowRoot | null;\n}) => {\n const [container, setContainer] = useState<HTMLElement | null>(() => {\n const resolved = resolveRoot(root);\n if (!resolved) return null;\n return getOrCreateContainer(resolved);\n });\n\n if (!container) {\n setContainer(getOrCreateContainer(document.body));\n }\n\n if (!container) return null;\n return createPortal(children, container);\n};\n\nconst updateModal = (id: string, nextProps: Partial<ImperativeModalProps>) => {\n let changed = false;\n modalStack = modalStack.map((item) => {\n if (item.id !== id) return item;\n if (item.kind !== 'modal') return item;\n changed = true;\n return {\n ...item,\n props: { ...item.props, ...nextProps },\n };\n });\n\n if (changed) notify();\n};\n\nconst updateRawProps = (id: string, nextProps: Record<string, unknown>) => {\n let changed = false;\n modalStack = modalStack.map((item) => {\n if (item.id !== id) return item;\n if (item.kind !== 'raw') return item;\n changed = true;\n return {\n ...item,\n props: { ...item.props, ...nextProps },\n };\n });\n\n if (changed) notify();\n};\n\nconst setRawOpen = (id: string, open: boolean) => {\n let changed = false;\n modalStack = modalStack.map((item) => {\n if (item.id !== id) return item;\n if (item.kind !== 'raw') return item;\n if (item.open === open) return item;\n changed = true;\n return { ...item, open };\n });\n\n if (open) {\n const timer = rawDestroyTimers.get(id);\n if (timer) {\n clearTimeout(timer);\n rawDestroyTimers.delete(id);\n }\n }\n\n if (changed) notify();\n};\n\nconst closeModal = (id: string) => {\n const target = modalStack.find((item) => item.id === id);\n if (!target) return;\n\n if (target.kind === 'modal') {\n updateModal(id, { open: false });\n return;\n }\n\n setRawOpen(id, false);\n\n const shouldDestroy = target.options?.destroyOnClose ?? true;\n if (!shouldDestroy) return;\n\n const delay = target.options?.destroyDelay ?? 200;\n const existing = rawDestroyTimers.get(id);\n if (existing) clearTimeout(existing);\n const timer = window.setTimeout(() => {\n rawDestroyTimers.delete(id);\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n destroyModal(id);\n }, delay);\n rawDestroyTimers.set(id, timer);\n};\n\nconst destroyModal = (id: string) => {\n const timer = rawDestroyTimers.get(id);\n if (timer) {\n clearTimeout(timer);\n rawDestroyTimers.delete(id);\n }\n const nextStack = modalStack.filter((item) => item.id !== id);\n if (nextStack.length === modalStack.length) return;\n modalStack = nextStack;\n notify();\n};\n\nconst ModalStack = memo(({ stack }: ModalStackProps) => {\n const isClient = useIsClient();\n if (!isClient) return null;\n return stack.map((item) => {\n if (item.kind === 'modal') {\n return (\n <ModalStackItem\n id={item.id}\n key={item.id}\n onClose={closeModal}\n onDestroy={destroyModal}\n onUpdate={updateModal}\n props={item.props}\n />\n );\n }\n\n return (\n <RawModalStackItem\n component={item.component}\n id={item.id}\n key={item.id}\n onClose={closeModal}\n onUpdate={updateRawProps}\n open={item.open}\n options={item.options}\n props={item.props}\n />\n );\n });\n});\n\nModalStack.displayName = 'ModalStack';\n\nexport const ModalHost = ({ root }: ModalHostProps) => {\n const stack = useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);\n const isClient = useIsClient();\n if (!isClient) return null;\n if (stack.length === 0) return null;\n\n return (\n <ModalPortal root={root}>\n <ModalStack stack={stack} />\n </ModalPortal>\n );\n};\n\nexport const createModal = (props: ImperativeModalProps): ModalInstance => {\n const id = `modal-${Date.now()}-${modalSeed++}`;\n modalStack = [\n ...modalStack,\n { id, kind: 'modal', props: { ...props, open: props.open ?? true } },\n ];\n notify();\n\n return {\n close: () => closeModal(id),\n destroy: () => destroyModal(id),\n setCanDismissByClickOutside: (value) => updateModal(id, { maskClosable: value }),\n update: (nextProps) => updateModal(id, nextProps),\n };\n};\n\nexport function createRawModal<P extends RawModalComponentProps>(\n component: RawModalComponent<P>,\n props: Omit<P, 'open' | 'onClose'>,\n options?: RawModalOptions,\n): RawModalInstance<P>;\n// eslint-disable-next-line no-redeclare\nexport function createRawModal<P, OpenKey extends keyof P, CloseKey extends keyof P>(\n component: RawModalComponent<P>,\n props: Omit<P, OpenKey | CloseKey>,\n options: RawModalKeyOptions<OpenKey, CloseKey>,\n): RawModalInstance<P, OpenKey, CloseKey>;\n// eslint-disable-next-line no-redeclare\nexport function createRawModal<P, OpenKey extends keyof P, CloseKey extends keyof P>(\n component: RawModalComponent<P>,\n props: Omit<P, OpenKey | CloseKey>,\n options?: RawModalOptions<OpenKey, CloseKey>,\n): RawModalInstance<P, OpenKey, CloseKey> {\n const id = `modal-${Date.now()}-${modalSeed++}`;\n modalStack = [\n ...modalStack,\n {\n component,\n id,\n kind: 'raw',\n open: true,\n options,\n props: props as Record<string, unknown>,\n },\n ];\n notify();\n\n return {\n close: () => closeModal(id),\n destroy: () => destroyModal(id),\n setCanDismissByClickOutside: (value) => updateRawProps(id, { maskClosable: value }),\n update: (nextProps) => updateRawProps(id, nextProps as Record<string, unknown>),\n };\n}\n"],"mappings":";;;;;;;;;;AA+CA,MAAM,oBAAoB;AAG1B,MAAM,+BAAe,IAAI,SAA8B;AAEvD,IAAIA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;EACO;EACR,CACF;AACD,SAAQ;AAER,QAAO;EACL,aAAa,WAAW,GAAG;EAC3B,eAAe,aAAa,GAAG;EAC/B,8BAA8B,UAAU,eAAe,IAAI,EAAE,cAAc,OAAO,CAAC;EACnF,SAAS,cAAc,eAAe,IAAI,UAAqC;EAChF"}
|
|
1
|
+
{"version":3,"file":"imperative.mjs","names":["modalStack: TModalStackItem[]","EMPTY_STACK: TModalStackItem[]"],"sources":["../../src/Modal/imperative.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode } from 'react';\nimport { memo, useEffect, useState, useSyncExternalStore } from 'react';\nimport { createPortal } from 'react-dom';\n\nimport { useIsClient } from '@/hooks/useIsClient';\nimport { registerDevSingleton } from '@/utils/devSingleton';\n\nimport { ModalStackItem } from './ModalStackItem';\nimport { RawModalStackItem } from './RawModalStackItem';\nimport type {\n ImperativeModalProps,\n ModalInstance,\n RawModalComponent,\n RawModalComponentProps,\n RawModalInstance,\n RawModalKeyOptions,\n RawModalOptions,\n} from './type';\n\ntype ModalStackItemBase = {\n id: string;\n};\n\ntype ModalStackItemModal = ModalStackItemBase & {\n kind: 'modal';\n props: ImperativeModalProps;\n};\n\ntype ModalStackItemRaw = ModalStackItemBase & {\n component: RawModalComponent;\n kind: 'raw';\n open: boolean;\n options?: RawModalOptions<PropertyKey, PropertyKey>;\n props: Record<string, unknown>;\n};\n\ntype TModalStackItem = ModalStackItemModal | ModalStackItemRaw;\n\ntype ModalStackProps = {\n stack: TModalStackItem[];\n};\n\nexport type ModalHostProps = {\n root?: HTMLElement | ShadowRoot | null;\n};\n\nconst MODAL_PORTAL_ATTR = 'data-lobe-ui-modal-portal';\n\n// Reuse one portal container per root (document.body by default).\nconst containerMap = new WeakMap<object, HTMLElement>();\n\nlet modalStack: TModalStackItem[] = [];\nlet modalSeed = 0;\nconst listeners = new Set<() => void>();\nconst rawDestroyTimers = new Map<string, number>();\n\nconst notify = () => {\n listeners.forEach((listener) => listener());\n};\n\nconst subscribe = (listener: () => void) => {\n listeners.add(listener);\n return () => listeners.delete(listener);\n};\n\nconst EMPTY_STACK: TModalStackItem[] = [];\nconst getSnapshot = () => modalStack;\nconst getServerSnapshot = () => EMPTY_STACK;\n\nconst getOrCreateContainer = (root: HTMLElement | ShadowRoot): HTMLElement => {\n const cached = containerMap.get(root);\n if (cached && cached.isConnected) return cached;\n\n const el = document.createElement('div');\n el.setAttribute(MODAL_PORTAL_ATTR, 'true');\n root.append(el);\n containerMap.set(root, el);\n return el;\n};\n\nconst resolveRoot = (root?: HTMLElement | ShadowRoot | null): HTMLElement | ShadowRoot | null => {\n if (root) return root;\n return document.body;\n};\n\nconst ModalPortal = ({\n children,\n root,\n}: {\n children: ReactNode;\n root?: HTMLElement | ShadowRoot | null;\n}) => {\n const [container, setContainer] = useState<HTMLElement | null>(() => {\n const resolved = resolveRoot(root);\n if (!resolved) return null;\n return getOrCreateContainer(resolved);\n });\n\n if (!container) {\n setContainer(getOrCreateContainer(document.body));\n }\n\n if (!container) return null;\n return createPortal(children, container);\n};\n\nconst updateModal = (id: string, nextProps: Partial<ImperativeModalProps>) => {\n let changed = false;\n modalStack = modalStack.map((item) => {\n if (item.id !== id) return item;\n if (item.kind !== 'modal') return item;\n changed = true;\n return {\n ...item,\n props: { ...item.props, ...nextProps },\n };\n });\n\n if (changed) notify();\n};\n\nconst updateRawProps = (id: string, nextProps: Record<string, unknown>) => {\n let changed = false;\n modalStack = modalStack.map((item) => {\n if (item.id !== id) return item;\n if (item.kind !== 'raw') return item;\n changed = true;\n return {\n ...item,\n props: { ...item.props, ...nextProps },\n };\n });\n\n if (changed) notify();\n};\n\nconst setRawOpen = (id: string, open: boolean) => {\n let changed = false;\n modalStack = modalStack.map((item) => {\n if (item.id !== id) return item;\n if (item.kind !== 'raw') return item;\n if (item.open === open) return item;\n changed = true;\n return { ...item, open };\n });\n\n if (open) {\n const timer = rawDestroyTimers.get(id);\n if (timer) {\n clearTimeout(timer);\n rawDestroyTimers.delete(id);\n }\n }\n\n if (changed) notify();\n};\n\nconst closeModal = (id: string) => {\n const target = modalStack.find((item) => item.id === id);\n if (!target) return;\n\n if (target.kind === 'modal') {\n updateModal(id, { open: false });\n return;\n }\n\n setRawOpen(id, false);\n\n const shouldDestroy = target.options?.destroyOnClose ?? true;\n if (!shouldDestroy) return;\n\n const delay = target.options?.destroyDelay ?? 200;\n const existing = rawDestroyTimers.get(id);\n if (existing) clearTimeout(existing);\n const timer = window.setTimeout(() => {\n rawDestroyTimers.delete(id);\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n destroyModal(id);\n }, delay);\n rawDestroyTimers.set(id, timer);\n};\n\nconst destroyModal = (id: string) => {\n const timer = rawDestroyTimers.get(id);\n if (timer) {\n clearTimeout(timer);\n rawDestroyTimers.delete(id);\n }\n const nextStack = modalStack.filter((item) => item.id !== id);\n if (nextStack.length === modalStack.length) return;\n modalStack = nextStack;\n notify();\n};\n\nconst ModalStack = memo(({ stack }: ModalStackProps) => {\n const isClient = useIsClient();\n if (!isClient) return null;\n return stack.map((item) => {\n if (item.kind === 'modal') {\n return (\n <ModalStackItem\n id={item.id}\n key={item.id}\n onClose={closeModal}\n onDestroy={destroyModal}\n onUpdate={updateModal}\n props={item.props}\n />\n );\n }\n\n return (\n <RawModalStackItem\n component={item.component}\n id={item.id}\n key={item.id}\n onClose={closeModal}\n onUpdate={updateRawProps}\n open={item.open}\n options={item.options}\n props={item.props}\n />\n );\n });\n});\n\nModalStack.displayName = 'ModalStack';\n\nexport const ModalHost = ({ root }: ModalHostProps) => {\n const stack = useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);\n const isClient = useIsClient();\n\n useEffect(() => {\n if (!isClient) return;\n // Enforce singleton per portal root (dev-only).\n const scope = root ?? document.body;\n return registerDevSingleton('ModalHost', scope);\n }, [isClient, root]);\n\n if (!isClient) return null;\n if (stack.length === 0) return null;\n\n return (\n <ModalPortal root={root}>\n <ModalStack stack={stack} />\n </ModalPortal>\n );\n};\n\nexport const createModal = (props: ImperativeModalProps): ModalInstance => {\n const id = `modal-${Date.now()}-${modalSeed++}`;\n modalStack = [\n ...modalStack,\n { id, kind: 'modal', props: { ...props, open: props.open ?? true } },\n ];\n notify();\n\n return {\n close: () => closeModal(id),\n destroy: () => destroyModal(id),\n setCanDismissByClickOutside: (value) => updateModal(id, { maskClosable: value }),\n update: (nextProps) => updateModal(id, nextProps),\n };\n};\n\nexport function createRawModal<P extends RawModalComponentProps>(\n component: RawModalComponent<P>,\n props: Omit<P, 'open' | 'onClose'>,\n options?: RawModalOptions,\n): RawModalInstance<P>;\n// eslint-disable-next-line no-redeclare\nexport function createRawModal<P, OpenKey extends keyof P, CloseKey extends keyof P>(\n component: RawModalComponent<P>,\n props: Omit<P, OpenKey | CloseKey>,\n options: RawModalKeyOptions<OpenKey, CloseKey>,\n): RawModalInstance<P, OpenKey, CloseKey>;\n// eslint-disable-next-line no-redeclare\nexport function createRawModal<P, OpenKey extends keyof P, CloseKey extends keyof P>(\n component: RawModalComponent<P>,\n props: Omit<P, OpenKey | CloseKey>,\n options?: RawModalOptions<OpenKey, CloseKey>,\n): RawModalInstance<P, OpenKey, CloseKey> {\n const id = `modal-${Date.now()}-${modalSeed++}`;\n modalStack = [\n ...modalStack,\n {\n component,\n id,\n kind: 'raw',\n open: true,\n options,\n props: props as Record<string, unknown>,\n },\n ];\n notify();\n\n return {\n close: () => closeModal(id),\n destroy: () => destroyModal(id),\n setCanDismissByClickOutside: (value) => updateRawProps(id, { maskClosable: value }),\n update: (nextProps) => updateRawProps(id, nextProps as Record<string, unknown>),\n };\n}\n"],"mappings":";;;;;;;;;;;AAgDA,MAAM,oBAAoB;AAG1B,MAAM,+BAAe,IAAI,SAA8B;AAEvD,IAAIA,aAAgC,EAAE;AACtC,IAAI,YAAY;AAChB,MAAM,4BAAY,IAAI,KAAiB;AACvC,MAAM,mCAAmB,IAAI,KAAqB;AAElD,MAAM,eAAe;AACnB,WAAU,SAAS,aAAa,UAAU,CAAC;;AAG7C,MAAM,aAAa,a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EACL,aAAa,WAAW,GAAG;EAC3B,eAAe,aAAa,GAAG;EAC/B,8BAA8B,UAAU,eAAe,IAAI,EAAE,cAAc,OAAO,CAAC;EACnF,SAAS,cAAc,eAAe,IAAI,UAAqC;EAChF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react69 from "react";
|
|
2
2
|
import { Context, ReactNode } from "react";
|
|
3
3
|
import * as motion_react0 from "motion/react";
|
|
4
4
|
import * as m from "motion/react-m";
|
|
@@ -6,7 +6,7 @@ import * as m from "motion/react-m";
|
|
|
6
6
|
//#region src/MotionProvider/index.d.ts
|
|
7
7
|
type MotionComponentType = typeof motion_react0.motion | typeof m;
|
|
8
8
|
declare const MotionComponent: Context<MotionComponentType>;
|
|
9
|
-
declare const MotionProvider:
|
|
9
|
+
declare const MotionProvider: react69.NamedExoticComponent<{
|
|
10
10
|
children: ReactNode;
|
|
11
11
|
motion: MotionComponentType;
|
|
12
12
|
}>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { SearchBarProps } from "./type.mjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react49 from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/SearchBar/SearchBar.d.ts
|
|
5
|
-
declare const SearchBar:
|
|
5
|
+
declare const SearchBar: react49.NamedExoticComponent<SearchBarProps>;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { SearchBar };
|
|
8
8
|
//# sourceMappingURL=SearchBar.d.mts.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { SegmentedProps } from "./type.mjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react14 from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/Segmented/Segmented.d.ts
|
|
5
|
-
declare const Segmented:
|
|
5
|
+
declare const Segmented: react14.NamedExoticComponent<SegmentedProps>;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { Segmented };
|
|
8
8
|
//# sourceMappingURL=Segmented.d.mts.map
|
package/es/Select/Select.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { SelectProps } from "./type.mjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react13 from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/Select/Select.d.ts
|
|
5
|
-
declare const Input:
|
|
5
|
+
declare const Input: react13.NamedExoticComponent<SelectProps>;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { Input };
|
|
8
8
|
//# sourceMappingURL=Select.d.mts.map
|
package/es/SideNav/SideNav.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { SideNavProps } from "./type.mjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react11 from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/SideNav/SideNav.d.ts
|
|
5
|
-
declare const SideNav:
|
|
5
|
+
declare const SideNav: react11.NamedExoticComponent<SideNavProps>;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { SideNav };
|
|
8
8
|
//# sourceMappingURL=SideNav.d.mts.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { SliderWithInputProps } from "./type.mjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react10 from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/SliderWithInput/SliderWithInput.d.ts
|
|
5
|
-
declare const SliderWithInput:
|
|
5
|
+
declare const SliderWithInput: react10.NamedExoticComponent<SliderWithInputProps>;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { SliderWithInput };
|
|
8
8
|
//# sourceMappingURL=SliderWithInput.d.mts.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ActionIconProps } from "../../ActionIcon/type.mjs";
|
|
2
2
|
import "../../ActionIcon/index.mjs";
|
|
3
|
-
import * as
|
|
3
|
+
import * as react106 from "react";
|
|
4
4
|
|
|
5
5
|
//#region src/SortableList/components/DragHandle.d.ts
|
|
6
|
-
declare const DragHandle:
|
|
6
|
+
declare const DragHandle: react106.NamedExoticComponent<ActionIconProps>;
|
|
7
7
|
//#endregion
|
|
8
8
|
export { DragHandle };
|
|
9
9
|
//# sourceMappingURL=DragHandle.d.mts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FlexboxProps } from "../../Flex/type.mjs";
|
|
2
2
|
import "../../Flex/index.mjs";
|
|
3
|
-
import * as
|
|
3
|
+
import * as react104 from "react";
|
|
4
4
|
import "@dnd-kit/core";
|
|
5
5
|
|
|
6
6
|
//#region src/SortableList/components/SortableItem.d.ts
|
|
@@ -9,7 +9,7 @@ interface SortableItemProps extends Omit<FlexboxProps, 'id'> {
|
|
|
9
9
|
id: string | number;
|
|
10
10
|
variant?: 'borderless' | 'filled' | 'outlined';
|
|
11
11
|
}
|
|
12
|
-
declare const SortableItem:
|
|
12
|
+
declare const SortableItem: react104.NamedExoticComponent<SortableItemProps>;
|
|
13
13
|
//#endregion
|
|
14
14
|
export { SortableItem };
|
|
15
15
|
//# sourceMappingURL=SortableItem.d.mts.map
|
package/es/Tag/Tag.mjs
CHANGED
|
@@ -5,13 +5,12 @@ import { variants } from "./styles.mjs";
|
|
|
5
5
|
import { useMemo } from "react";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
7
|
import { Tag } from "antd";
|
|
8
|
-
import {
|
|
8
|
+
import { cssVar, cx } from "antd-style";
|
|
9
9
|
|
|
10
10
|
//#region src/Tag/Tag.tsx
|
|
11
11
|
const Tag$1 = ({ className, ref, size = "middle", color, variant = "filled", children, onClick, style, ...rest }) => {
|
|
12
|
-
const theme = useTheme();
|
|
13
12
|
const colors = useMemo(() => {
|
|
14
|
-
let textColor =
|
|
13
|
+
let textColor = cssVar.colorTextSecondary;
|
|
15
14
|
let backgroundColor;
|
|
16
15
|
let borderColor;
|
|
17
16
|
const isBorderless = variant === "borderless";
|
|
@@ -20,17 +19,17 @@ const Tag$1 = ({ className, ref, size = "middle", color, variant = "filled", chi
|
|
|
20
19
|
const isPresetSystemColors = color && presetSystemColors.has(color);
|
|
21
20
|
const isHexColor = color && color.startsWith("#");
|
|
22
21
|
if (isPresetColor) {
|
|
23
|
-
textColor = colorsPreset(
|
|
24
|
-
backgroundColor = isBorderless ? "transparent" : colorsPreset(
|
|
25
|
-
borderColor = colorsPreset(
|
|
22
|
+
textColor = colorsPreset(color);
|
|
23
|
+
backgroundColor = isBorderless ? "transparent" : colorsPreset(color, "fillTertiary");
|
|
24
|
+
borderColor = colorsPreset(color, isFilled ? "fillQuaternary" : "fillTertiary");
|
|
26
25
|
}
|
|
27
26
|
if (isPresetSystemColors) {
|
|
28
|
-
textColor = colorsPresetSystem(
|
|
29
|
-
backgroundColor = isBorderless ? "transparent" : colorsPresetSystem(
|
|
30
|
-
borderColor = colorsPresetSystem(
|
|
27
|
+
textColor = colorsPresetSystem(color);
|
|
28
|
+
backgroundColor = isBorderless ? "transparent" : colorsPresetSystem(color, "fillTertiary");
|
|
29
|
+
borderColor = colorsPresetSystem(color, isFilled ? "fillQuaternary" : "fillTertiary");
|
|
31
30
|
}
|
|
32
31
|
if (isHexColor) {
|
|
33
|
-
textColor =
|
|
32
|
+
textColor = cssVar.colorBgLayout;
|
|
34
33
|
backgroundColor = isBorderless ? "transparent" : color;
|
|
35
34
|
}
|
|
36
35
|
return {
|
|
@@ -38,11 +37,7 @@ const Tag$1 = ({ className, ref, size = "middle", color, variant = "filled", chi
|
|
|
38
37
|
borderColor,
|
|
39
38
|
textColor
|
|
40
39
|
};
|
|
41
|
-
}, [
|
|
42
|
-
color,
|
|
43
|
-
theme,
|
|
44
|
-
variant
|
|
45
|
-
]);
|
|
40
|
+
}, [color, variant]);
|
|
46
41
|
return /* @__PURE__ */ jsx(Tag, {
|
|
47
42
|
className: cx(variants({
|
|
48
43
|
size,
|
package/es/Tag/Tag.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tag.mjs","names":["Tag: FC<TagProps>","AntTag","Tag"],"sources":["../../src/Tag/Tag.tsx"],"sourcesContent":["'use client';\n\nimport { Tag as AntTag } from 'antd';\nimport {
|
|
1
|
+
{"version":3,"file":"Tag.mjs","names":["Tag: FC<TagProps>","AntTag","Tag"],"sources":["../../src/Tag/Tag.tsx"],"sourcesContent":["'use client';\n\nimport { Tag as AntTag } from 'antd';\nimport { cssVar, cx } from 'antd-style';\nimport { type FC, useMemo } from 'react';\n\nimport { colorsPreset, colorsPresetSystem, presetColors, presetSystemColors } from '@/Tag/utils';\n\nimport { variants } from './styles';\nimport type { TagProps } from './type';\n\nconst Tag: FC<TagProps> = ({\n className,\n ref,\n size = 'middle',\n color,\n variant = 'filled',\n children,\n onClick,\n style,\n ...rest\n}) => {\n const colors = useMemo(() => {\n let textColor = cssVar.colorTextSecondary;\n let backgroundColor;\n let borderColor;\n const isBorderless = variant === 'borderless';\n const isFilled = variant === 'filled';\n const isPresetColor = color && presetColors.includes(color);\n const isPresetSystemColors = color && presetSystemColors.has(color);\n const isHexColor = color && color.startsWith('#');\n\n if (isPresetColor) {\n textColor = colorsPreset(color);\n backgroundColor = isBorderless ? 'transparent' : colorsPreset(color, 'fillTertiary');\n borderColor = colorsPreset(color, isFilled ? 'fillQuaternary' : 'fillTertiary');\n }\n if (isPresetSystemColors) {\n textColor = colorsPresetSystem(color);\n backgroundColor = isBorderless ? 'transparent' : colorsPresetSystem(color, 'fillTertiary');\n borderColor = colorsPresetSystem(color, isFilled ? 'fillQuaternary' : 'fillTertiary');\n }\n if (isHexColor) {\n textColor = cssVar.colorBgLayout;\n backgroundColor = isBorderless ? 'transparent' : color;\n }\n\n return {\n backgroundColor,\n borderColor,\n textColor,\n };\n }, [color, variant]);\n\n return (\n <AntTag\n className={cx(variants({ size, variant: variant as any }), className)}\n color={color}\n onClick={onClick}\n ref={ref}\n style={{\n background: colors?.backgroundColor,\n borderColor: colors?.borderColor,\n color: colors?.textColor,\n cursor: onClick ? 'pointer' : undefined,\n ...style,\n }}\n variant={variant === 'borderless' ? 'outlined' : variant}\n {...rest}\n >\n {children}\n </AntTag>\n );\n};\n\nTag.displayName = 'Tag';\n\nexport default Tag;\n"],"mappings":";;;;;;;;;;AAWA,MAAMA,SAAqB,EACzB,WACA,KACA,OAAO,UACP,OACA,UAAU,UACV,UACA,SACA,OACA,GAAG,WACC;CACJ,MAAM,SAAS,cAAc;EAC3B,IAAI,YAAY,OAAO;EACvB,IAAI;EACJ,IAAI;EACJ,MAAM,eAAe,YAAY;EACjC,MAAM,WAAW,YAAY;EAC7B,MAAM,gBAAgB,SAAS,aAAa,SAAS,MAAM;EAC3D,MAAM,uBAAuB,SAAS,mBAAmB,IAAI,MAAM;EACnE,MAAM,aAAa,SAAS,MAAM,WAAW,IAAI;AAEjD,MAAI,eAAe;AACjB,eAAY,aAAa,MAAM;AAC/B,qBAAkB,eAAe,gBAAgB,aAAa,OAAO,eAAe;AACpF,iBAAc,aAAa,OAAO,WAAW,mBAAmB,eAAe;;AAEjF,MAAI,sBAAsB;AACxB,eAAY,mBAAmB,MAAM;AACrC,qBAAkB,eAAe,gBAAgB,mBAAmB,OAAO,eAAe;AAC1F,iBAAc,mBAAmB,OAAO,WAAW,mBAAmB,eAAe;;AAEvF,MAAI,YAAY;AACd,eAAY,OAAO;AACnB,qBAAkB,eAAe,gBAAgB;;AAGnD,SAAO;GACL;GACA;GACA;GACD;IACA,CAAC,OAAO,QAAQ,CAAC;AAEpB,QACE,oBAACC;EACC,WAAW,GAAG,SAAS;GAAE;GAAe;GAAgB,CAAC,EAAE,UAAU;EAC9D;EACE;EACJ;EACL,OAAO;GACL,YAAY,QAAQ;GACpB,aAAa,QAAQ;GACrB,OAAO,QAAQ;GACf,QAAQ,UAAU,YAAY;GAC9B,GAAG;GACJ;EACD,SAAS,YAAY,eAAe,aAAa;EACjD,GAAI;EAEH;GACM;;AAIb,MAAI,cAAc;AAElB,kBAAeC"}
|
package/es/Tag/utils.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { cssVar } from "antd-style";
|
|
1
2
|
import { camelCase } from "es-toolkit/compat";
|
|
2
3
|
|
|
3
4
|
//#region src/Tag/utils.ts
|
|
@@ -23,13 +24,17 @@ const presetSystemColors = new Set([
|
|
|
23
24
|
"info",
|
|
24
25
|
"processing"
|
|
25
26
|
]);
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
return
|
|
27
|
+
const toKebabCase = (value) => value.replaceAll(/([a-z])([A-Z])/g, "$1-$2").replaceAll(/([a-z])(\d)/g, "$1-$2").replaceAll(/(\d)([A-Z])/g, "$1-$2").replaceAll(/([A-Z]+)([A-Z][a-z])/g, "$1-$2").toLowerCase();
|
|
28
|
+
const getCssVar = (tokenKey) => {
|
|
29
|
+
return cssVar[tokenKey] || `var(--ant-${toKebabCase(tokenKey)})`;
|
|
30
|
+
};
|
|
31
|
+
const colorsPreset = (type, ...keys) => getCssVar(camelCase([type, ...keys].join("-")));
|
|
32
|
+
const colorsPresetSystem = (type, ...keys) => {
|
|
33
|
+
return getCssVar(camelCase([
|
|
29
34
|
"color",
|
|
30
35
|
type === "processing" ? "info" : type,
|
|
31
36
|
...keys
|
|
32
|
-
].join("-"))
|
|
37
|
+
].join("-")));
|
|
33
38
|
};
|
|
34
39
|
|
|
35
40
|
//#endregion
|
package/es/Tag/utils.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.mjs","names":[],"sources":["../../src/Tag/utils.ts"],"sourcesContent":["import { camelCase } from 'es-toolkit/compat';\n\nexport const presetColors = [\n 'red',\n 'volcano',\n 'orange',\n 'gold',\n 'yellow',\n 'lime',\n 'green',\n 'cyan',\n 'blue',\n 'geekblue',\n 'purple',\n 'magenta',\n 'gray',\n];\n\nexport const presetSystemColors = new Set(['error', 'warning', 'success', 'info', 'processing']);\n\
|
|
1
|
+
{"version":3,"file":"utils.mjs","names":[],"sources":["../../src/Tag/utils.ts"],"sourcesContent":["import { cssVar } from 'antd-style';\nimport { camelCase } from 'es-toolkit/compat';\n\nexport const presetColors = [\n 'red',\n 'volcano',\n 'orange',\n 'gold',\n 'yellow',\n 'lime',\n 'green',\n 'cyan',\n 'blue',\n 'geekblue',\n 'purple',\n 'magenta',\n 'gray',\n];\n\nexport const presetSystemColors = new Set(['error', 'warning', 'success', 'info', 'processing']);\n\nconst toKebabCase = (value: string) =>\n value\n .replaceAll(/([a-z])([A-Z])/g, '$1-$2')\n .replaceAll(/([a-z])(\\d)/g, '$1-$2')\n .replaceAll(/(\\d)([A-Z])/g, '$1-$2')\n .replaceAll(/([A-Z]+)([A-Z][a-z])/g, '$1-$2')\n .toLowerCase();\n\nconst getCssVar = (tokenKey: string) => {\n const mapped = (cssVar as Record<string, string>)[tokenKey];\n return mapped || `var(--ant-${toKebabCase(tokenKey)})`;\n};\n\nexport const colorsPreset = (type: string, ...keys: string[]) =>\n getCssVar(camelCase([type, ...keys].join('-')));\n\nexport const colorsPresetSystem = (type: string, ...keys: string[]) => {\n const t = type === 'processing' ? 'info' : type;\n return getCssVar(camelCase(['color', t, ...keys].join('-')));\n};\n"],"mappings":";;;;AAGA,MAAa,eAAe;CAC1B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAa,qBAAqB,IAAI,IAAI;CAAC;CAAS;CAAW;CAAW;CAAQ;CAAa,CAAC;AAEhG,MAAM,eAAe,UACnB,MACG,WAAW,mBAAmB,QAAQ,CACtC,WAAW,gBAAgB,QAAQ,CACnC,WAAW,gBAAgB,QAAQ,CACnC,WAAW,yBAAyB,QAAQ,CAC5C,aAAa;AAElB,MAAM,aAAa,aAAqB;AAEtC,QADgB,OAAkC,aACjC,aAAa,YAAY,SAAS,CAAC;;AAGtD,MAAa,gBAAgB,MAAc,GAAG,SAC5C,UAAU,UAAU,CAAC,MAAM,GAAG,KAAK,CAAC,KAAK,IAAI,CAAC,CAAC;AAEjD,MAAa,sBAAsB,MAAc,GAAG,SAAmB;AAErE,QAAO,UAAU,UAAU;EAAC;EADlB,SAAS,eAAe,SAAS;EACH,GAAG;EAAK,CAAC,KAAK,IAAI,CAAC,CAAC"}
|
|
@@ -25,7 +25,14 @@ var antdOverride_default = (token) => {
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
.${token.prefixCls}-tooltip-
|
|
28
|
+
.${token.prefixCls}-tooltip-arrow::before,
|
|
29
|
+
.${token.prefixCls}-tooltip-arrow::after,
|
|
30
|
+
.${token.prefixCls}-tooltip-container {
|
|
31
|
+
color: ${token.colorBgLayout} !important;
|
|
32
|
+
background: ${token.colorText} !important;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.${token.prefixCls}-tooltip-container {
|
|
29
36
|
display: flex;
|
|
30
37
|
align-items: center;
|
|
31
38
|
justify-content: center;
|
|
@@ -34,17 +41,6 @@ var antdOverride_default = (token) => {
|
|
|
34
41
|
padding-block: 4px;
|
|
35
42
|
padding-inline: 8px;
|
|
36
43
|
border-radius: ${token.borderRadiusSM}px !important;
|
|
37
|
-
|
|
38
|
-
color: ${token.colorBgLayout} !important;
|
|
39
|
-
|
|
40
|
-
background-color: ${token.colorText} !important;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.${token.prefixCls}-tooltip-arrow {
|
|
44
|
-
&::before,
|
|
45
|
-
&::after {
|
|
46
|
-
background: ${token.colorText} !important;
|
|
47
|
-
}
|
|
48
44
|
}
|
|
49
45
|
|
|
50
46
|
.${token.prefixCls}-switch-handle::before {
|
|
@@ -69,9 +65,7 @@ var antdOverride_default = (token) => {
|
|
|
69
65
|
${token.stylish.blur};
|
|
70
66
|
}
|
|
71
67
|
|
|
72
|
-
.${token.prefixCls}-
|
|
73
|
-
.${token.prefixCls}-dropdown-menu,
|
|
74
|
-
.${token.prefixCls}-select-dropdown {
|
|
68
|
+
.${token.prefixCls}-dropdown-menu, .${token.prefixCls}-select-dropdown {
|
|
75
69
|
border-radius: ${token.borderRadius}px !important;
|
|
76
70
|
box-shadow:
|
|
77
71
|
0 0 15px 0 #00000008,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"antdOverride.mjs","names":[],"sources":["../../../src/ThemeProvider/GlobalStyle/antdOverride.ts"],"sourcesContent":["import { Theme, css } from 'antd-style';\nimport { readableColor, rgba } from 'polished';\n\nexport default (token: Theme) => {\n const readColor = readableColor(token.colorPrimary);\n return css`\n .${token.prefixCls}-checkbox-inner:after {\n border-color: ${readableColor(token.colorPrimary)} !important;\n }\n\n .${token.prefixCls}-btn {\n box-shadow: none;\n }\n\n .${token.prefixCls}-btn-primary:not(:disabled) {\n color: ${readColor} !important;\n\n &:hover {\n color: ${readColor} !important;\n }\n\n &:active {\n color: ${readColor} !important;\n }\n }\n\n .${token.prefixCls}-tooltip-
|
|
1
|
+
{"version":3,"file":"antdOverride.mjs","names":[],"sources":["../../../src/ThemeProvider/GlobalStyle/antdOverride.ts"],"sourcesContent":["import { Theme, css } from 'antd-style';\nimport { readableColor, rgba } from 'polished';\n\nexport default (token: Theme) => {\n const readColor = readableColor(token.colorPrimary);\n return css`\n .${token.prefixCls}-checkbox-inner:after {\n border-color: ${readableColor(token.colorPrimary)} !important;\n }\n\n .${token.prefixCls}-btn {\n box-shadow: none;\n }\n\n .${token.prefixCls}-btn-primary:not(:disabled) {\n color: ${readColor} !important;\n\n &:hover {\n color: ${readColor} !important;\n }\n\n &:active {\n color: ${readColor} !important;\n }\n }\n\n .${token.prefixCls}-tooltip-arrow::before,\n .${token.prefixCls}-tooltip-arrow::after,\n .${token.prefixCls}-tooltip-container {\n color: ${token.colorBgLayout} !important;\n background: ${token.colorText} !important;\n }\n\n .${token.prefixCls}-tooltip-container {\n display: flex;\n align-items: center;\n justify-content: center;\n\n min-height: unset;\n padding-block: 4px;\n padding-inline: 8px;\n border-radius: ${token.borderRadiusSM}px !important;\n }\n\n .${token.prefixCls}-switch-handle::before {\n background: ${token.colorBgContainer} !important;\n }\n\n .${token.prefixCls}-image-preview-close,\n .${token.prefixCls}-image-preview-switch-right,\n .${token.prefixCls}-image-preview-switch-left {\n display: flex;\n align-items: center;\n justify-content: center;\n\n width: 32px;\n height: 32px;\n padding: 0;\n\n background: ${rgba(token.colorBgMask, 0.1)};\n\n border-radius: ${token.borderRadiusLG}px;\n\n ${token.stylish.blur};\n }\n\n .${token.prefixCls}-dropdown-menu, .${token.prefixCls}-select-dropdown {\n border-radius: ${token.borderRadius}px !important;\n box-shadow:\n 0 0 15px 0 #00000008,\n 0 2px 30px 0 #00000014,\n 0 0 0 1px ${token.isDarkMode ? token.colorFillTertiary : token.colorBorder} inset !important;\n }\n\n .${token.prefixCls}-modal-content {\n border: 1px solid ${token.colorBorderSecondary} !important;\n }\n\n .${token.prefixCls}-radio-wrapper\n .${token.prefixCls}-radio-checked\n .${token.prefixCls}-radio-inner:after {\n background: ${readColor};\n }\n `;\n};\n"],"mappings":";;;;AAGA,4BAAgB,UAAiB;CAC/B,MAAM,YAAY,cAAc,MAAM,aAAa;AACnD,QAAO,GAAG;OACL,MAAM,UAAU;sBACD,cAAc,MAAM,aAAa,CAAC;;;OAGjD,MAAM,UAAU;;;;OAIhB,MAAM,UAAU;eACR,UAAU;;;iBAGR,UAAU;;;;iBAIV,UAAU;;;;OAIpB,MAAM,UAAU;SACd,MAAM,UAAU;SAChB,MAAM,UAAU;eACV,MAAM,cAAc;oBACf,MAAM,UAAU;;;OAG7B,MAAM,UAAU;;;;;;;;uBAQA,MAAM,eAAe;;;OAGrC,MAAM,UAAU;oBACH,MAAM,iBAAiB;;;OAGpC,MAAM,UAAU;SACd,MAAM,UAAU;SAChB,MAAM,UAAU;;;;;;;;;oBASL,KAAK,MAAM,aAAa,GAAI,CAAC;;uBAE1B,MAAM,eAAe;;QAEpC,MAAM,QAAQ,KAAK;;;OAGpB,MAAM,UAAU,mBAAmB,MAAM,UAAU;uBACnC,MAAM,aAAa;;;;oBAItB,MAAM,aAAa,MAAM,oBAAoB,MAAM,YAAY;;;OAG5E,MAAM,UAAU;0BACG,MAAM,qBAAqB;;;OAG9C,MAAM,UAAU;SACd,MAAM,UAAU;SAChB,MAAM,UAAU;oBACL,UAAU"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ThemeProviderProps } from "./type.mjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react9 from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/ThemeProvider/ThemeProvider.d.ts
|
|
5
|
-
declare const ThemeProvider:
|
|
5
|
+
declare const ThemeProvider: react9.NamedExoticComponent<ThemeProviderProps>;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { ThemeProvider };
|
|
8
8
|
//# sourceMappingURL=ThemeProvider.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeProvider.mjs","names":["ThemeProvider","lobeCustomStylish","theme","lobeCustomToken","FontLoader","AntdThemeProvider","AntdConfigProvider","GlobalStyle"],"sources":["../../src/ThemeProvider/ThemeProvider.tsx"],"sourcesContent":["'use client';\n\nimport { App } from 'antd';\nimport {\n ThemeProvider as AntdThemeProvider,\n CustomStylishParams,\n CustomTokenParams,\n GetAntdTheme,\n} from 'antd-style';\nimport { merge } from 'es-toolkit/compat';\nimport { memo, useCallback, useMemo } from 'react';\n\nimport { useCdnFn } from '@/ConfigProvider';\nimport FontLoader from '@/FontLoader';\nimport { lobeCustomStylish, lobeCustomToken } from '@/styles';\nimport { createLobeAntdTheme } from '@/styles/theme/antdTheme';\nimport { LobeCustomToken } from '@/types/customToken';\n\nimport AntdConfigProvider from './ConfigProvider';\nimport GlobalStyle from './GlobalStyle';\nimport { LOBE_THEME_APP_ID } from './constants';\nimport type { ThemeProviderProps } from './type';\n\nconst ThemeProvider = memo<ThemeProviderProps>(\n ({\n children,\n customStylish,\n customToken,\n enableCustomFonts = true,\n enableGlobalStyle = true,\n customFonts,\n customTheme = {},\n className,\n style,\n theme: antdTheme,\n ...rest\n }) => {\n const genCdnUrl = useCdnFn();\n\n const webfontUrls = useMemo(\n () =>\n customFonts || [\n genCdnUrl({ path: 'css/index.css', pkg: '@lobehub/webfont-mono' }),\n genCdnUrl({\n path: 'css/index.css',\n pkg: '@lobehub/webfont-harmony-sans',\n }),\n genCdnUrl({\n path: 'css/index.css',\n pkg: '@lobehub/webfont-harmony-sans-sc',\n }),\n genCdnUrl({ path: 'dist/katex.min.css', pkg: 'katex' }),\n ],\n [customFonts, genCdnUrl],\n );\n\n const stylish = useCallback(\n (theme: CustomStylishParams) => ({ ...lobeCustomStylish(theme), ...customStylish?.(theme) }),\n [customStylish],\n );\n\n const token = useCallback(\n (theme: CustomTokenParams) => ({ ...lobeCustomToken(theme), ...customToken?.(theme) }),\n [customToken],\n );\n\n const theme = useCallback<GetAntdTheme>(\n (appearance) => {\n const lobeTheme = createLobeAntdTheme({\n appearance,\n neutralColor: customTheme.neutralColor,\n primaryColor: customTheme.primaryColor,\n });\n return merge(lobeTheme, antdTheme);\n },\n [customTheme.primaryColor, customTheme.neutralColor, antdTheme],\n );\n\n return (\n <>\n {enableCustomFonts &&\n webfontUrls?.length > 0 &&\n webfontUrls.map((webfont) => <FontLoader key={webfont} url={webfont} />)}\n <AntdThemeProvider<LobeCustomToken>\n customStylish={stylish}\n customToken={token}\n theme={theme}\n {...rest}\n >\n <AntdConfigProvider>\n {enableGlobalStyle && <GlobalStyle />}\n <App className={className} style={{ minHeight: 'inherit', width: 'inherit', ...style }}>\n <div id={LOBE_THEME_APP_ID} style={{ display: 'contents' }}>\n {children}\n </div>\n </App>\n </AntdConfigProvider>\n </AntdThemeProvider>\n </>\n );\n },\n);\n\nThemeProvider.displayName = 'LobeThemeProvider';\n\nexport default ThemeProvider;\n"],"mappings":";;;;;;;;;;;;;;;;;AAuBA,MAAMA,kBAAgB,MACnB,EACC,UACA,eACA,aACA,oBAAoB,MACpB,oBAAoB,MACpB,aACA,cAAc,EAAE,EAChB,WACA,OACA,OAAO,WACP,GAAG,WACC;CACJ,MAAM,YAAY,UAAU;CAE5B,MAAM,cAAc,cAEhB,eAAe;EACb,UAAU;GAAE,MAAM;GAAiB,KAAK;GAAyB,CAAC;EAClE,UAAU;GACR,MAAM;GACN,KAAK;GACN,CAAC;EACF,UAAU;GACR,MAAM;GACN,KAAK;GACN,CAAC;EACF,UAAU;GAAE,MAAM;GAAsB,KAAK;GAAS,CAAC;EACxD,EACH,CAAC,aAAa,UAAU,CACzB;CAED,MAAM,UAAU,aACb,aAAgC;EAAE,GAAGC,sBAAkBC,QAAM;EAAE,GAAG,gBAAgBA,QAAM;EAAE,GAC3F,CAAC,cAAc,CAChB;CAED,MAAM,QAAQ,aACX,aAA8B;EAAE,GAAGC,oBAAgBD,QAAM;EAAE,GAAG,cAAcA,QAAM;EAAE,GACrF,CAAC,YAAY,CACd;CAED,MAAM,QAAQ,aACX,eAAe;AAMd,SAAO,MALW,oBAAoB;GACpC;GACA,cAAc,YAAY;GAC1B,cAAc,YAAY;GAC3B,CAAC,EACsB,UAAU;IAEpC;EAAC,YAAY;EAAc,YAAY;EAAc;EAAU,CAChE;AAED,QACE,8CACG,qBACC,aAAa,SAAS,KACtB,YAAY,KAAK,YAAY,oBAACE,sBAAyB,KAAK,WAAd,QAAyB,CAAC,EAC1E,oBAACC;EACC,eAAe;EACf,aAAa;EACN;EACP,GAAI;YAEJ,qBAACC,qCACE,qBAAqB,oBAACC,wBAAc,
|
|
1
|
+
{"version":3,"file":"ThemeProvider.mjs","names":["ThemeProvider","lobeCustomStylish","theme","lobeCustomToken","FontLoader","AntdThemeProvider","AntdConfigProvider","GlobalStyle"],"sources":["../../src/ThemeProvider/ThemeProvider.tsx"],"sourcesContent":["'use client';\n\nimport { App } from 'antd';\nimport {\n ThemeProvider as AntdThemeProvider,\n CustomStylishParams,\n CustomTokenParams,\n GetAntdTheme,\n} from 'antd-style';\nimport { merge } from 'es-toolkit/compat';\nimport { memo, useCallback, useMemo } from 'react';\n\nimport { useCdnFn } from '@/ConfigProvider';\nimport FontLoader from '@/FontLoader';\nimport { lobeCustomStylish, lobeCustomToken } from '@/styles';\nimport { createLobeAntdTheme } from '@/styles/theme/antdTheme';\nimport { LobeCustomToken } from '@/types/customToken';\n\nimport AntdConfigProvider from './ConfigProvider';\nimport GlobalStyle from './GlobalStyle';\nimport { LOBE_THEME_APP_ID } from './constants';\nimport type { ThemeProviderProps } from './type';\n\nconst ThemeProvider = memo<ThemeProviderProps>(\n ({\n children,\n customStylish,\n customToken,\n enableCustomFonts = true,\n enableGlobalStyle = true,\n customFonts,\n customTheme = {},\n className,\n style,\n theme: antdTheme,\n ...rest\n }) => {\n const genCdnUrl = useCdnFn();\n\n const webfontUrls = useMemo(\n () =>\n customFonts || [\n genCdnUrl({ path: 'css/index.css', pkg: '@lobehub/webfont-mono' }),\n genCdnUrl({\n path: 'css/index.css',\n pkg: '@lobehub/webfont-harmony-sans',\n }),\n genCdnUrl({\n path: 'css/index.css',\n pkg: '@lobehub/webfont-harmony-sans-sc',\n }),\n genCdnUrl({ path: 'dist/katex.min.css', pkg: 'katex' }),\n ],\n [customFonts, genCdnUrl],\n );\n\n const stylish = useCallback(\n (theme: CustomStylishParams) => ({ ...lobeCustomStylish(theme), ...customStylish?.(theme) }),\n [customStylish],\n );\n\n const token = useCallback(\n (theme: CustomTokenParams) => ({ ...lobeCustomToken(theme), ...customToken?.(theme) }),\n [customToken],\n );\n\n const theme = useCallback<GetAntdTheme>(\n (appearance) => {\n const lobeTheme = createLobeAntdTheme({\n appearance,\n neutralColor: customTheme.neutralColor,\n primaryColor: customTheme.primaryColor,\n });\n return merge(lobeTheme, antdTheme);\n },\n [customTheme.primaryColor, customTheme.neutralColor, antdTheme],\n );\n\n return (\n <>\n {enableCustomFonts &&\n webfontUrls?.length > 0 &&\n webfontUrls.map((webfont) => <FontLoader key={webfont} url={webfont} />)}\n <AntdThemeProvider<LobeCustomToken>\n customStylish={stylish}\n customToken={token}\n theme={theme}\n {...rest}\n >\n <AntdConfigProvider>\n {enableGlobalStyle && <GlobalStyle />}\n\n <App className={className} style={{ minHeight: 'inherit', width: 'inherit', ...style }}>\n <div id={LOBE_THEME_APP_ID} style={{ display: 'contents' }}>\n {children}\n </div>\n </App>\n </AntdConfigProvider>\n </AntdThemeProvider>\n </>\n );\n },\n);\n\nThemeProvider.displayName = 'LobeThemeProvider';\n\nexport default ThemeProvider;\n"],"mappings":";;;;;;;;;;;;;;;;;AAuBA,MAAMA,kBAAgB,MACnB,EACC,UACA,eACA,aACA,oBAAoB,MACpB,oBAAoB,MACpB,aACA,cAAc,EAAE,EAChB,WACA,OACA,OAAO,WACP,GAAG,WACC;CACJ,MAAM,YAAY,UAAU;CAE5B,MAAM,cAAc,cAEhB,eAAe;EACb,UAAU;GAAE,MAAM;GAAiB,KAAK;GAAyB,CAAC;EAClE,UAAU;GACR,MAAM;GACN,KAAK;GACN,CAAC;EACF,UAAU;GACR,MAAM;GACN,KAAK;GACN,CAAC;EACF,UAAU;GAAE,MAAM;GAAsB,KAAK;GAAS,CAAC;EACxD,EACH,CAAC,aAAa,UAAU,CACzB;CAED,MAAM,UAAU,aACb,aAAgC;EAAE,GAAGC,sBAAkBC,QAAM;EAAE,GAAG,gBAAgBA,QAAM;EAAE,GAC3F,CAAC,cAAc,CAChB;CAED,MAAM,QAAQ,aACX,aAA8B;EAAE,GAAGC,oBAAgBD,QAAM;EAAE,GAAG,cAAcA,QAAM;EAAE,GACrF,CAAC,YAAY,CACd;CAED,MAAM,QAAQ,aACX,eAAe;AAMd,SAAO,MALW,oBAAoB;GACpC;GACA,cAAc,YAAY;GAC1B,cAAc,YAAY;GAC3B,CAAC,EACsB,UAAU;IAEpC;EAAC,YAAY;EAAc,YAAY;EAAc;EAAU,CAChE;AAED,QACE,8CACG,qBACC,aAAa,SAAS,KACtB,YAAY,KAAK,YAAY,oBAACE,sBAAyB,KAAK,WAAd,QAAyB,CAAC,EAC1E,oBAACC;EACC,eAAe;EACf,aAAa;EACN;EACP,GAAI;YAEJ,qBAACC,qCACE,qBAAqB,oBAACC,wBAAc,EAErC,oBAAC;GAAe;GAAW,OAAO;IAAE,WAAW;IAAW,OAAO;IAAW,GAAG;IAAO;aACpF,oBAAC;IAAI,IAAI;IAAmB,OAAO,EAAE,SAAS,YAAY;IACvD;KACG;IACF,IACa;GACH,IACnB;EAGR;AAED,gBAAc,cAAc;AAE5B,4BAAeP"}
|
package/es/Toc/Toc.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { TocProps } from "./type.mjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react15 from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/Toc/Toc.d.ts
|
|
5
|
-
declare const Toc:
|
|
5
|
+
declare const Toc: react15.NamedExoticComponent<TocProps>;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { Toc };
|
|
8
8
|
//# sourceMappingURL=Toc.d.mts.map
|
|
@@ -4,7 +4,7 @@ import { useMotionComponent } from "../MotionProvider/index.mjs";
|
|
|
4
4
|
import FlexBasic_default from "../Flex/FlexBasic.mjs";
|
|
5
5
|
import Hotkey_default from "../Hotkey/Hotkey.mjs";
|
|
6
6
|
import { styles } from "./style.mjs";
|
|
7
|
-
import
|
|
7
|
+
import { useMemo } from "react";
|
|
8
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
import { cx } from "antd-style";
|
|
10
10
|
import { AnimatePresence } from "motion/react";
|
|
@@ -12,21 +12,61 @@ import { FloatingArrow } from "@floating-ui/react";
|
|
|
12
12
|
import { useDebounce } from "ahooks";
|
|
13
13
|
|
|
14
14
|
//#region src/Tooltip/TooltipFloating.tsx
|
|
15
|
-
const
|
|
15
|
+
const tooltipAnimateState = {
|
|
16
|
+
opacity: 1,
|
|
17
|
+
scale: 1,
|
|
18
|
+
y: 0
|
|
19
|
+
};
|
|
20
|
+
const tooltipExitState = {
|
|
21
|
+
opacity: 0,
|
|
22
|
+
scale: .98,
|
|
23
|
+
y: 4
|
|
24
|
+
};
|
|
25
|
+
const tooltipInitialState = {
|
|
26
|
+
opacity: 0,
|
|
27
|
+
scale: .96,
|
|
28
|
+
y: 6
|
|
29
|
+
};
|
|
30
|
+
const tooltipTransition = {
|
|
31
|
+
duration: .14,
|
|
32
|
+
ease: [
|
|
33
|
+
.4,
|
|
34
|
+
0,
|
|
35
|
+
.2,
|
|
36
|
+
1
|
|
37
|
+
]
|
|
38
|
+
};
|
|
39
|
+
const contentAnimateState = { opacity: 1 };
|
|
40
|
+
const contentExitState = { opacity: 0 };
|
|
41
|
+
const contentInitialState = { opacity: 0 };
|
|
42
|
+
const contentTransition = { duration: .3 };
|
|
43
|
+
const TooltipFloating = ({ open, title, placement, floatingStyles, setFloating, floatingProps, arrow: arrow$1, arrowRef, context, hotkey, hotkeyProps, isInitialShow, layoutAnimation = true, className, classNames, styles: styleProps, zIndex }) => {
|
|
44
|
+
const basePlacement = String(placement || "top").split("-")[0];
|
|
16
45
|
const transformOrigin = useMemo(() => {
|
|
17
|
-
switch (
|
|
46
|
+
switch (basePlacement) {
|
|
18
47
|
case "top": return "bottom center";
|
|
19
48
|
case "bottom": return "top center";
|
|
20
49
|
case "left": return "center right";
|
|
21
50
|
case "right": return "center left";
|
|
22
51
|
default: return "center";
|
|
23
52
|
}
|
|
24
|
-
}, [
|
|
53
|
+
}, [basePlacement]);
|
|
25
54
|
const hasTransform = useDebounce(Boolean(floatingStyles?.transform), {
|
|
26
55
|
leading: false,
|
|
27
56
|
wait: 16
|
|
28
57
|
});
|
|
29
58
|
const Motion = useMotionComponent();
|
|
59
|
+
const TooltipContent = hotkey ? /* @__PURE__ */ jsxs(FlexBasic_default, {
|
|
60
|
+
align: "center",
|
|
61
|
+
gap: 8,
|
|
62
|
+
horizontal: true,
|
|
63
|
+
justify: "space-between",
|
|
64
|
+
children: [/* @__PURE__ */ jsx("span", { children: title }), /* @__PURE__ */ jsx(Hotkey_default, {
|
|
65
|
+
inverseTheme: true,
|
|
66
|
+
keys: hotkey,
|
|
67
|
+
...hotkeyProps
|
|
68
|
+
})]
|
|
69
|
+
}) : title;
|
|
30
70
|
return /* @__PURE__ */ jsx(AnimatePresence, { children: open && title && /* @__PURE__ */ jsx("div", {
|
|
31
71
|
className: cx(styles.tooltip, layoutAnimation && hasTransform && styles.tooltipLayout, classNames?.container, classNames?.root, className),
|
|
32
72
|
ref: setFloating,
|
|
@@ -43,42 +83,24 @@ const TooltipFloating = ({ open, title, placement, floatingStyles, setFloating,
|
|
|
43
83
|
},
|
|
44
84
|
...floatingProps,
|
|
45
85
|
children: /* @__PURE__ */ jsxs(Motion.div, {
|
|
46
|
-
animate:
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
},
|
|
50
|
-
exit: {
|
|
51
|
-
opacity: 0,
|
|
52
|
-
scale: .98
|
|
53
|
-
},
|
|
54
|
-
initial: {
|
|
55
|
-
opacity: 0,
|
|
56
|
-
scale: .96
|
|
57
|
-
},
|
|
86
|
+
animate: tooltipAnimateState,
|
|
87
|
+
exit: tooltipExitState,
|
|
88
|
+
initial: tooltipInitialState,
|
|
58
89
|
style: { transformOrigin },
|
|
59
|
-
transition:
|
|
60
|
-
duration: .12,
|
|
61
|
-
ease: [
|
|
62
|
-
.4,
|
|
63
|
-
0,
|
|
64
|
-
.2,
|
|
65
|
-
1
|
|
66
|
-
]
|
|
67
|
-
},
|
|
90
|
+
transition: tooltipTransition,
|
|
68
91
|
children: [/* @__PURE__ */ jsx("div", {
|
|
69
92
|
className: cx(styles.content, classNames?.content),
|
|
70
93
|
style: styleProps?.content,
|
|
71
|
-
children:
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}) : title
|
|
94
|
+
children: layoutAnimation ? /* @__PURE__ */ jsx(AnimatePresence, {
|
|
95
|
+
mode: "popLayout",
|
|
96
|
+
children: /* @__PURE__ */ jsx(Motion.div, {
|
|
97
|
+
animate: contentAnimateState,
|
|
98
|
+
exit: contentExitState,
|
|
99
|
+
initial: isInitialShow ? false : contentInitialState,
|
|
100
|
+
transition: contentTransition,
|
|
101
|
+
children: TooltipContent
|
|
102
|
+
}, String(title))
|
|
103
|
+
}) : TooltipContent
|
|
82
104
|
}), arrow$1 && context && /* @__PURE__ */ jsx(FloatingArrow, {
|
|
83
105
|
className: cx(styles.arrow, classNames?.arrow),
|
|
84
106
|
context,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TooltipFloating.mjs","names":["Flexbox","Hotkey","arrow"],"sources":["../../src/Tooltip/TooltipFloating.tsx"],"sourcesContent":["'use client';\n\nimport type { FloatingContext, Placement } from '@floating-ui/react';\nimport { FloatingArrow } from '@floating-ui/react';\nimport { useDebounce } from 'ahooks';\nimport { cx } from 'antd-style';\nimport { AnimatePresence } from 'motion/react';\nimport type { CSSProperties, ReactNode, RefObject } from 'react';\nimport
|
|
1
|
+
{"version":3,"file":"TooltipFloating.mjs","names":["tooltipAnimateState: Target","tooltipExitState: Target","tooltipInitialState: Target","tooltipTransition: Transition","contentAnimateState: Target","contentExitState: Target","contentInitialState: Target","contentTransition: Transition","Flexbox","Hotkey","arrow"],"sources":["../../src/Tooltip/TooltipFloating.tsx"],"sourcesContent":["'use client';\n\nimport type { FloatingContext, Placement } from '@floating-ui/react';\nimport { FloatingArrow } from '@floating-ui/react';\nimport { useDebounce } from 'ahooks';\nimport { cx } from 'antd-style';\nimport { AnimatePresence, type Target, type Transition } from 'motion/react';\nimport type { CSSProperties, ReactNode, RefObject } from 'react';\nimport { useMemo } from 'react';\n\nimport { Flexbox } from '@/Flex';\nimport Hotkey from '@/Hotkey';\nimport { useMotionComponent } from '@/MotionProvider';\n\nimport { styles } from './style';\nimport type { TooltipProps } from './type';\n\n// Tooltip container animation\nconst tooltipAnimateState: Target = { opacity: 1, scale: 1, y: 0 };\nconst tooltipExitState: Target = { opacity: 0, scale: 0.98, y: 4 };\nconst tooltipInitialState: Target = { opacity: 0, scale: 0.96, y: 6 };\nconst tooltipTransition: Transition = { duration: 0.14, ease: [0.4, 0, 0.2, 1] };\n\n// Tooltip content animation (for switching between tooltips)\nconst contentAnimateState: Target = { opacity: 1 };\nconst contentExitState: Target = { opacity: 0 };\nconst contentInitialState: Target = { opacity: 0 };\nconst contentTransition: Transition = { duration: 0.3 };\n\ntype TooltipFloatingProps = {\n arrow?: boolean;\n arrowRef?: RefObject<SVGSVGElement | null>;\n\n className?: TooltipProps['className'];\n classNames?: TooltipProps['classNames'];\n context?: FloatingContext;\n\n floatingProps?: Record<string, any>;\n floatingStyles: CSSProperties;\n\n hotkey?: TooltipProps['hotkey'];\n\n hotkeyProps?: TooltipProps['hotkeyProps'];\n /**\n * @description Whether this is the initial show (first appearance, not switching between tooltips)\n */\n isInitialShow?: boolean;\n\n /**\n * @description Whether to enable layout animation when switching between tooltips\n * @default true\n */\n layoutAnimation?: boolean;\n open: boolean;\n placement?: Placement;\n\n setFloating: (node: HTMLElement | null) => void;\n styles?: TooltipProps['styles'];\n title?: ReactNode;\n zIndex?: TooltipProps['zIndex'];\n};\n\nconst TooltipFloating = ({\n open,\n title,\n placement,\n\n floatingStyles,\n setFloating,\n floatingProps,\n arrow,\n arrowRef,\n context,\n hotkey,\n hotkeyProps,\n isInitialShow,\n layoutAnimation = true,\n\n className,\n classNames,\n styles: styleProps,\n zIndex,\n}: TooltipFloatingProps) => {\n const basePlacement = String(placement || 'top').split('-')[0];\n\n const transformOrigin = useMemo(() => {\n switch (basePlacement) {\n case 'top': {\n return 'bottom center';\n }\n case 'bottom': {\n return 'top center';\n }\n case 'left': {\n return 'center right';\n }\n case 'right': {\n return 'center left';\n }\n default: {\n return 'center';\n }\n }\n }, [basePlacement]);\n\n const hasTransform = useDebounce(Boolean(floatingStyles?.transform), {\n leading: false,\n wait: 16,\n });\n\n const Motion = useMotionComponent();\n\n const TooltipContent = hotkey ? (\n <Flexbox align={'center'} gap={8} horizontal justify={'space-between'}>\n <span>{title}</span>\n <Hotkey inverseTheme keys={hotkey} {...hotkeyProps} />\n </Flexbox>\n ) : (\n title\n );\n return (\n <AnimatePresence>\n {open && title && (\n <div\n className={cx(\n styles.tooltip,\n layoutAnimation && hasTransform && styles.tooltipLayout,\n classNames?.container,\n classNames?.root,\n className,\n )}\n key=\"tooltip\"\n ref={setFloating as any}\n role=\"tooltip\"\n style={\n styleProps?.root\n ? {\n ...floatingStyles,\n zIndex,\n ...styleProps.container,\n ...styleProps.root,\n }\n : {\n ...floatingStyles,\n zIndex,\n ...styleProps?.container,\n }\n }\n {...floatingProps}\n >\n <Motion.div\n animate={tooltipAnimateState}\n exit={tooltipExitState}\n initial={tooltipInitialState}\n style={{ transformOrigin }}\n transition={tooltipTransition}\n >\n <div className={cx(styles.content, classNames?.content)} style={styleProps?.content}>\n {layoutAnimation ? (\n <AnimatePresence mode=\"popLayout\">\n <Motion.div\n animate={contentAnimateState}\n exit={contentExitState}\n initial={isInitialShow ? false : contentInitialState}\n key={String(title)}\n transition={contentTransition}\n >\n {TooltipContent}\n </Motion.div>\n </AnimatePresence>\n ) : (\n TooltipContent\n )}\n </div>\n {arrow && context && (\n <FloatingArrow\n className={cx(styles.arrow, classNames?.arrow)}\n context={context}\n height={6}\n ref={arrowRef as any}\n style={styleProps?.arrow}\n width={12}\n />\n )}\n </Motion.div>\n </div>\n )}\n </AnimatePresence>\n );\n};\n\nexport default TooltipFloating;\n"],"mappings":";;;;;;;;;;;;;;AAkBA,MAAMA,sBAA8B;CAAE,SAAS;CAAG,OAAO;CAAG,GAAG;CAAG;AAClE,MAAMC,mBAA2B;CAAE,SAAS;CAAG,OAAO;CAAM,GAAG;CAAG;AAClE,MAAMC,sBAA8B;CAAE,SAAS;CAAG,OAAO;CAAM,GAAG;CAAG;AACrE,MAAMC,oBAAgC;CAAE,UAAU;CAAM,MAAM;EAAC;EAAK;EAAG;EAAK;EAAE;CAAE;AAGhF,MAAMC,sBAA8B,EAAE,SAAS,GAAG;AAClD,MAAMC,mBAA2B,EAAE,SAAS,GAAG;AAC/C,MAAMC,sBAA8B,EAAE,SAAS,GAAG;AAClD,MAAMC,oBAAgC,EAAE,UAAU,IAAK;AAmCvD,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AIP;MACG,GAElB;KAEE,EACLC,WAAS,WACR,oBAAC;IACC,WAAW,GAAG,OAAO,OAAO,YAAY,MAAM;IACrC;IACT,QAAQ;IACR,KAAK;IACL,OAAO,YAAY;IACnB,OAAO;KACP;IAEO;IArDT,UAsDA,GAEQ;;AAItB,8BAAe"}
|
|
@@ -155,6 +155,11 @@ const TooltipGroup = ({ children, layoutAnimation = true, ...sharedProps }) => {
|
|
|
155
155
|
};
|
|
156
156
|
}, [clearTimers]);
|
|
157
157
|
const portalRoot = active?.item.getPopupContainer && active?.triggerEl ? active.item.getPopupContainer(active.triggerEl) : void 0;
|
|
158
|
+
const openRef = useRef(open);
|
|
159
|
+
useEffect(() => {
|
|
160
|
+
openRef.current = open;
|
|
161
|
+
}, [open]);
|
|
162
|
+
const isInitialShow = !openRef.current && open;
|
|
158
163
|
const floatingNode = /* @__PURE__ */ jsx(TooltipFloating_default, {
|
|
159
164
|
arrow: active?.item.arrow,
|
|
160
165
|
arrowRef,
|
|
@@ -164,6 +169,7 @@ const TooltipGroup = ({ children, layoutAnimation = true, ...sharedProps }) => {
|
|
|
164
169
|
floatingStyles,
|
|
165
170
|
hotkey: active?.item.hotkey,
|
|
166
171
|
hotkeyProps: active?.item.hotkeyProps,
|
|
172
|
+
isInitialShow,
|
|
167
173
|
layoutAnimation,
|
|
168
174
|
open,
|
|
169
175
|
placement: floatingPlacement,
|