@lobehub/ui 4.9.3 → 4.10.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/Burger/Burger.d.mts +2 -2
- package/es/CodeEditor/CodeEditor.d.mts +2 -2
- package/es/Collapse/Collapse.d.mts +2 -2
- package/es/ContextMenu/ContextMenuHost.d.mts +2 -2
- 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/DraggablePanel/style.mjs +1 -1
- package/es/DraggablePanel/style.mjs.map +1 -1
- package/es/DraggableSideNav/DraggableSideNav.d.mts +2 -2
- package/es/Drawer/Drawer.d.mts +2 -2
- package/es/Dropdown/Dropdown.d.mts +9 -2
- package/es/Dropdown/Dropdown.mjs +6 -0
- package/es/Dropdown/Dropdown.mjs.map +1 -1
- package/es/DropdownMenu/DropdownMenu.d.mts +2 -2
- package/es/DropdownMenu/DropdownMenu.mjs +20 -36
- package/es/DropdownMenu/DropdownMenu.mjs.map +1 -1
- package/es/DropdownMenu/type.d.mts +2 -1
- 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/sharedStyle.mjs +56 -10
- package/es/Menu/sharedStyle.mjs.map +1 -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/MotionProvider/index.d.mts +2 -2
- package/es/Popover/ArrowIcon.mjs +22 -0
- package/es/Popover/ArrowIcon.mjs.map +1 -0
- package/es/Popover/Popover.d.mts +9 -0
- package/es/Popover/Popover.mjs +20 -0
- package/es/Popover/Popover.mjs.map +1 -0
- package/es/Popover/PopoverGroup.d.mts +11 -0
- package/es/Popover/PopoverGroup.mjs +96 -0
- package/es/Popover/PopoverGroup.mjs.map +1 -0
- package/es/Popover/PopoverInGroup.mjs +55 -0
- package/es/Popover/PopoverInGroup.mjs.map +1 -0
- package/es/Popover/PopoverPortal.mjs +45 -0
- package/es/Popover/PopoverPortal.mjs.map +1 -0
- package/es/Popover/PopoverStandalone.mjs +166 -0
- package/es/Popover/PopoverStandalone.mjs.map +1 -0
- package/es/Popover/groupContext.d.mts +14 -0
- package/es/Popover/groupContext.mjs +11 -0
- package/es/Popover/groupContext.mjs.map +1 -0
- package/es/Popover/index.d.mts +5 -0
- package/es/Popover/index.d.ts +1 -0
- package/es/Popover/index.js +1 -0
- package/es/Popover/index.mjs +5 -0
- package/es/Popover/parseTrigger.d.mts +14 -0
- package/es/Popover/parseTrigger.mjs +18 -0
- package/es/Popover/parseTrigger.mjs.map +1 -0
- package/es/Popover/style.mjs +218 -0
- package/es/Popover/style.mjs.map +1 -0
- package/es/Popover/type.d.mts +112 -0
- package/es/Popover/useMergedPopoverProps.mjs +88 -0
- package/es/Popover/useMergedPopoverProps.mjs.map +1 -0
- 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/ThemeProvider/ThemeProvider.d.mts +2 -2
- package/es/Toc/Toc.d.mts +2 -2
- package/es/Tooltip/TooltipGroup.mjs +2 -2
- package/es/Tooltip/TooltipGroup.mjs.map +1 -1
- package/es/Tooltip/type.d.mts +2 -2
- package/es/Tooltip/useTooltipFloating.mjs +2 -2
- package/es/Tooltip/useTooltipFloating.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/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/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 +2 -2
- package/es/icons/lucideExtra/LeftClickIcon.d.mts +2 -2
- 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 +2 -2
- package/es/icons/lucideExtra/RightClickIcon.d.mts +2 -2
- package/es/icons/lucideExtra/RightDoubleClickIcon.d.mts +3 -3
- package/es/icons/lucideExtra/ShapesUploadIcon.d.mts +2 -2
- package/es/icons/lucideExtra/TreeDownRightIcon.d.mts +2 -2
- package/es/icons/lucideExtra/TreeUpDownRightIcon.d.mts +3 -3
- package/es/index.d.mts +6 -1
- package/es/index.mjs +4 -1
- 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/placement.d.mts +31 -0
- package/es/utils/placement.mjs +100 -0
- package/es/utils/placement.mjs.map +1 -0
- package/package.json +1 -1
- package/es/Tooltip/antdPlacementToFloating.mjs +0 -27
- package/es/Tooltip/antdPlacementToFloating.mjs.map +0 -1
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { createStaticStyles } from "antd-style";
|
|
2
|
+
|
|
3
|
+
//#region src/Popover/style.ts
|
|
4
|
+
const styles = createStaticStyles(({ css: css$1, cssVar: cssVar$1 }) => ({
|
|
5
|
+
arrow: css$1`
|
|
6
|
+
--lobe-popover-arrow-offset-block: 5px;
|
|
7
|
+
--lobe-popover-arrow-offset-inline: 8px;
|
|
8
|
+
|
|
9
|
+
pointer-events: none;
|
|
10
|
+
|
|
11
|
+
position: absolute;
|
|
12
|
+
transform-origin: center;
|
|
13
|
+
|
|
14
|
+
display: flex;
|
|
15
|
+
|
|
16
|
+
width: 12px;
|
|
17
|
+
height: 6px;
|
|
18
|
+
|
|
19
|
+
transition: inset-inline-start var(--lobe-popover-animation-duration) var(--lobe-popover-animation-ease-out);
|
|
20
|
+
|
|
21
|
+
& > svg {
|
|
22
|
+
display: block;
|
|
23
|
+
width: 100%;
|
|
24
|
+
height: 100%;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
& [data-role='fill'] {
|
|
28
|
+
fill: ${cssVar$1.colorBgElevated};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
& [data-role='stroke'] {
|
|
32
|
+
fill: none;
|
|
33
|
+
stroke: ${cssVar$1.colorBorder};
|
|
34
|
+
stroke-width: 1px;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&[data-side='top'] {
|
|
38
|
+
inset-block-end: calc(var(--lobe-popover-arrow-offset-block) * -1);
|
|
39
|
+
transform: rotate(180deg);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&[data-side='left'] {
|
|
43
|
+
inset-inline-end: calc(var(--lobe-popover-arrow-offset-inline) * -1);
|
|
44
|
+
transform: rotate(90deg);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&[data-side='right'] {
|
|
48
|
+
inset-inline-start: calc(var(--lobe-popover-arrow-offset-inline) * -1);
|
|
49
|
+
transform: rotate(-90deg);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
&[data-side='bottom'] {
|
|
53
|
+
inset-block-start: calc(var(--lobe-popover-arrow-offset-block) * -1);
|
|
54
|
+
}
|
|
55
|
+
`,
|
|
56
|
+
popup: css$1`
|
|
57
|
+
position: relative;
|
|
58
|
+
transform-origin: var(--transform-origin);
|
|
59
|
+
|
|
60
|
+
width: var(--popup-width, auto);
|
|
61
|
+
min-width: 120px;
|
|
62
|
+
height: var(--popup-height, auto);
|
|
63
|
+
border-radius: ${cssVar$1.borderRadius};
|
|
64
|
+
|
|
65
|
+
color: ${cssVar$1.colorText};
|
|
66
|
+
|
|
67
|
+
background: ${cssVar$1.colorBgElevated};
|
|
68
|
+
outline: none;
|
|
69
|
+
box-shadow:
|
|
70
|
+
0 0 15px 0 #00000008,
|
|
71
|
+
0 2px 30px 0 #00000014,
|
|
72
|
+
0 0 0 1px ${cssVar$1.colorBorder} inset;
|
|
73
|
+
|
|
74
|
+
transition-timing-function: var(--lobe-popover-animation-ease-out);
|
|
75
|
+
transition-duration: var(--lobe-popover-animation-duration);
|
|
76
|
+
transition-property: width, height, opacity, transform;
|
|
77
|
+
|
|
78
|
+
&[data-starting-style],
|
|
79
|
+
&[data-ending-style] {
|
|
80
|
+
transform: translate3d(var(--lobe-popover-translate-x), var(--lobe-popover-translate-y), 0)
|
|
81
|
+
scale(var(--lobe-popover-animation-scale));
|
|
82
|
+
opacity: 0;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
&[data-ending-style] {
|
|
86
|
+
transition-timing-function: var(--lobe-popover-animation-ease-in);
|
|
87
|
+
transition-duration: var(--lobe-popover-animation-duration-exit);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
&[data-instant] {
|
|
91
|
+
transition: none;
|
|
92
|
+
}
|
|
93
|
+
`,
|
|
94
|
+
positioner: css$1`
|
|
95
|
+
--lobe-popover-animation-duration: 150ms;
|
|
96
|
+
--lobe-popover-animation-translate: 6px;
|
|
97
|
+
--lobe-popover-animation-scale: 0.96;
|
|
98
|
+
--lobe-popover-animation-ease-in: ease-in;
|
|
99
|
+
--lobe-popover-animation-duration-exit: 75ms;
|
|
100
|
+
--lobe-popover-animation-ease-out: ${cssVar$1.motionEaseOut};
|
|
101
|
+
--lobe-popover-translate-x: 0;
|
|
102
|
+
--lobe-popover-translate-y: calc(var(--lobe-popover-animation-translate) * -1);
|
|
103
|
+
|
|
104
|
+
z-index: 1100;
|
|
105
|
+
|
|
106
|
+
width: var(--positioner-width);
|
|
107
|
+
max-width: var(--available-width);
|
|
108
|
+
height: var(--positioner-height);
|
|
109
|
+
|
|
110
|
+
transition-timing-function: var(--lobe-popover-animation-ease-out);
|
|
111
|
+
transition-duration: var(--lobe-popover-animation-duration);
|
|
112
|
+
transition-property: inset-block-start, inset-inline-start, inset-inline-end, inset-block-end, transform;
|
|
113
|
+
|
|
114
|
+
&[data-instant] {
|
|
115
|
+
transition: none;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
&[data-placement='top'],
|
|
119
|
+
&[data-placement='topLeft'],
|
|
120
|
+
&[data-placement='topRight'] {
|
|
121
|
+
--lobe-popover-translate-x: 0;
|
|
122
|
+
--lobe-popover-translate-y: var(--lobe-popover-animation-translate);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
&[data-placement='bottom'],
|
|
126
|
+
&[data-placement='bottomLeft'],
|
|
127
|
+
&[data-placement='bottomRight'] {
|
|
128
|
+
--lobe-popover-translate-x: 0;
|
|
129
|
+
--lobe-popover-translate-y: calc(var(--lobe-popover-animation-translate) * -1);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
&[data-placement='left'],
|
|
133
|
+
&[data-placement='leftTop'],
|
|
134
|
+
&[data-placement='leftBottom'] {
|
|
135
|
+
--lobe-popover-translate-x: var(--lobe-popover-animation-translate);
|
|
136
|
+
--lobe-popover-translate-y: 0;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
&[data-placement='right'],
|
|
140
|
+
&[data-placement='rightTop'],
|
|
141
|
+
&[data-placement='rightBottom'] {
|
|
142
|
+
--lobe-popover-translate-x: calc(var(--lobe-popover-animation-translate) * -1);
|
|
143
|
+
--lobe-popover-translate-y: 0;
|
|
144
|
+
}
|
|
145
|
+
`,
|
|
146
|
+
root: css$1`
|
|
147
|
+
user-select: none;
|
|
148
|
+
position: relative;
|
|
149
|
+
filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 12%));
|
|
150
|
+
`,
|
|
151
|
+
viewport: css$1`
|
|
152
|
+
--lobe-popover-viewport-inline-padding: 12px;
|
|
153
|
+
|
|
154
|
+
position: relative;
|
|
155
|
+
|
|
156
|
+
overflow: clip;
|
|
157
|
+
|
|
158
|
+
width: 100%;
|
|
159
|
+
height: 100%;
|
|
160
|
+
padding-block: 12px;
|
|
161
|
+
padding-inline: var(--lobe-popover-viewport-inline-padding);
|
|
162
|
+
|
|
163
|
+
[data-previous],
|
|
164
|
+
[data-current] {
|
|
165
|
+
transform: translateX(0);
|
|
166
|
+
width: calc(var(--popup-width) - 2 * var(--lobe-popover-viewport-inline-padding));
|
|
167
|
+
opacity: 1;
|
|
168
|
+
transition:
|
|
169
|
+
transform var(--lobe-popover-animation-duration) var(--lobe-popover-animation-ease-out),
|
|
170
|
+
opacity calc(var(--lobe-popover-animation-duration) / 2)
|
|
171
|
+
var(--lobe-popover-animation-ease-out);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
&[data-activation-direction~='right'] [data-previous][data-ending-style] {
|
|
175
|
+
transform: translateX(-50%);
|
|
176
|
+
opacity: 0;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
&[data-activation-direction~='right'] [data-current][data-starting-style] {
|
|
180
|
+
transform: translateX(50%);
|
|
181
|
+
opacity: 0;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
&[data-activation-direction~='left'] [data-previous][data-ending-style] {
|
|
185
|
+
transform: translateX(50%);
|
|
186
|
+
opacity: 0;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
&[data-activation-direction~='left'] [data-current][data-starting-style] {
|
|
190
|
+
transform: translateX(-50%);
|
|
191
|
+
opacity: 0;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
&[data-activation-direction~='down'] [data-previous][data-ending-style] {
|
|
195
|
+
transform: translateY(-50%);
|
|
196
|
+
opacity: 0;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
&[data-activation-direction~='down'] [data-current][data-starting-style] {
|
|
200
|
+
transform: translateY(50%);
|
|
201
|
+
opacity: 0;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
&[data-activation-direction~='up'] [data-previous][data-ending-style] {
|
|
205
|
+
transform: translateY(50%);
|
|
206
|
+
opacity: 0;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
&[data-activation-direction~='up'] [data-current][data-starting-style] {
|
|
210
|
+
transform: translateY(-50%);
|
|
211
|
+
opacity: 0;
|
|
212
|
+
}
|
|
213
|
+
`
|
|
214
|
+
}));
|
|
215
|
+
|
|
216
|
+
//#endregion
|
|
217
|
+
export { styles };
|
|
218
|
+
//# sourceMappingURL=style.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.mjs","names":["cssVar"],"sources":["../../src/Popover/style.ts"],"sourcesContent":["import { createStaticStyles } from 'antd-style';\n\nexport const styles = createStaticStyles(({ css, cssVar }) => ({\n arrow: css`\n --lobe-popover-arrow-offset-block: 5px;\n --lobe-popover-arrow-offset-inline: 8px;\n\n pointer-events: none;\n\n position: absolute;\n transform-origin: center;\n\n display: flex;\n\n width: 12px;\n height: 6px;\n\n transition: inset-inline-start var(--lobe-popover-animation-duration) var(--lobe-popover-animation-ease-out);\n\n & > svg {\n display: block;\n width: 100%;\n height: 100%;\n }\n\n & [data-role='fill'] {\n fill: ${cssVar.colorBgElevated};\n }\n\n & [data-role='stroke'] {\n fill: none;\n stroke: ${cssVar.colorBorder};\n stroke-width: 1px;\n }\n\n &[data-side='top'] {\n inset-block-end: calc(var(--lobe-popover-arrow-offset-block) * -1);\n transform: rotate(180deg);\n }\n\n &[data-side='left'] {\n inset-inline-end: calc(var(--lobe-popover-arrow-offset-inline) * -1);\n transform: rotate(90deg);\n }\n\n &[data-side='right'] {\n inset-inline-start: calc(var(--lobe-popover-arrow-offset-inline) * -1);\n transform: rotate(-90deg);\n }\n\n &[data-side='bottom'] {\n inset-block-start: calc(var(--lobe-popover-arrow-offset-block) * -1);\n }\n `,\n\n popup: css`\n position: relative;\n transform-origin: var(--transform-origin);\n\n width: var(--popup-width, auto);\n min-width: 120px;\n height: var(--popup-height, auto);\n border-radius: ${cssVar.borderRadius};\n\n color: ${cssVar.colorText};\n\n background: ${cssVar.colorBgElevated};\n outline: none;\n box-shadow:\n 0 0 15px 0 #00000008,\n 0 2px 30px 0 #00000014,\n 0 0 0 1px ${cssVar.colorBorder} inset;\n\n transition-timing-function: var(--lobe-popover-animation-ease-out);\n transition-duration: var(--lobe-popover-animation-duration);\n transition-property: width, height, opacity, transform;\n\n &[data-starting-style],\n &[data-ending-style] {\n transform: translate3d(var(--lobe-popover-translate-x), var(--lobe-popover-translate-y), 0)\n scale(var(--lobe-popover-animation-scale));\n opacity: 0;\n }\n\n &[data-ending-style] {\n transition-timing-function: var(--lobe-popover-animation-ease-in);\n transition-duration: var(--lobe-popover-animation-duration-exit);\n }\n\n &[data-instant] {\n transition: none;\n }\n `,\n\n positioner: css`\n --lobe-popover-animation-duration: 150ms;\n --lobe-popover-animation-translate: 6px;\n --lobe-popover-animation-scale: 0.96;\n --lobe-popover-animation-ease-in: ease-in;\n --lobe-popover-animation-duration-exit: 75ms;\n --lobe-popover-animation-ease-out: ${cssVar.motionEaseOut};\n --lobe-popover-translate-x: 0;\n --lobe-popover-translate-y: calc(var(--lobe-popover-animation-translate) * -1);\n\n z-index: 1100;\n\n width: var(--positioner-width);\n max-width: var(--available-width);\n height: var(--positioner-height);\n\n transition-timing-function: var(--lobe-popover-animation-ease-out);\n transition-duration: var(--lobe-popover-animation-duration);\n transition-property: inset-block-start, inset-inline-start, inset-inline-end, inset-block-end, transform;\n\n &[data-instant] {\n transition: none;\n }\n\n &[data-placement='top'],\n &[data-placement='topLeft'],\n &[data-placement='topRight'] {\n --lobe-popover-translate-x: 0;\n --lobe-popover-translate-y: var(--lobe-popover-animation-translate);\n }\n\n &[data-placement='bottom'],\n &[data-placement='bottomLeft'],\n &[data-placement='bottomRight'] {\n --lobe-popover-translate-x: 0;\n --lobe-popover-translate-y: calc(var(--lobe-popover-animation-translate) * -1);\n }\n\n &[data-placement='left'],\n &[data-placement='leftTop'],\n &[data-placement='leftBottom'] {\n --lobe-popover-translate-x: var(--lobe-popover-animation-translate);\n --lobe-popover-translate-y: 0;\n }\n\n &[data-placement='right'],\n &[data-placement='rightTop'],\n &[data-placement='rightBottom'] {\n --lobe-popover-translate-x: calc(var(--lobe-popover-animation-translate) * -1);\n --lobe-popover-translate-y: 0;\n }\n `,\n\n root: css`\n user-select: none;\n position: relative;\n filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 12%));\n `,\n\n viewport: css`\n --lobe-popover-viewport-inline-padding: 12px;\n\n position: relative;\n\n overflow: clip;\n\n width: 100%;\n height: 100%;\n padding-block: 12px;\n padding-inline: var(--lobe-popover-viewport-inline-padding);\n\n [data-previous],\n [data-current] {\n transform: translateX(0);\n width: calc(var(--popup-width) - 2 * var(--lobe-popover-viewport-inline-padding));\n opacity: 1;\n transition:\n transform var(--lobe-popover-animation-duration) var(--lobe-popover-animation-ease-out),\n opacity calc(var(--lobe-popover-animation-duration) / 2)\n var(--lobe-popover-animation-ease-out);\n }\n\n &[data-activation-direction~='right'] [data-previous][data-ending-style] {\n transform: translateX(-50%);\n opacity: 0;\n }\n\n &[data-activation-direction~='right'] [data-current][data-starting-style] {\n transform: translateX(50%);\n opacity: 0;\n }\n\n &[data-activation-direction~='left'] [data-previous][data-ending-style] {\n transform: translateX(50%);\n opacity: 0;\n }\n\n &[data-activation-direction~='left'] [data-current][data-starting-style] {\n transform: translateX(-50%);\n opacity: 0;\n }\n\n &[data-activation-direction~='down'] [data-previous][data-ending-style] {\n transform: translateY(-50%);\n opacity: 0;\n }\n\n &[data-activation-direction~='down'] [data-current][data-starting-style] {\n transform: translateY(50%);\n opacity: 0;\n }\n\n &[data-activation-direction~='up'] [data-previous][data-ending-style] {\n transform: translateY(50%);\n opacity: 0;\n }\n\n &[data-activation-direction~='up'] [data-current][data-starting-style] {\n transform: translateY(-50%);\n opacity: 0;\n }\n `,\n}));\n"],"mappings":";;;AAEA,MAAa,SAAS,oBAAoB,EAAE,YAAK,wBAAc;CAC7D,OAAO,KAAG;;;;;;;;;;;;;;;;;;;;;;;cAuBEA,SAAO,gBAAgB;;;;;gBAKrBA,SAAO,YAAY;;;;;;;;;;;;;;;;;;;;;;;CAwBjC,OAAO,KAAG;;;;;;;qBAOSA,SAAO,aAAa;;aAE5BA,SAAO,UAAU;;kBAEZA,SAAO,gBAAgB;;;;;kBAKvBA,SAAO,YAAY;;;;;;;;;;;;;;;;;;;;;;CAuBnC,YAAY,KAAG;;;;;;yCAMwBA,SAAO,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+C5D,MAAM,KAAG;;;;;CAMT,UAAU,KAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+Dd,EAAE"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { Placement } from "../utils/placement.mjs";
|
|
2
|
+
import { CSSProperties, ReactElement, ReactNode, Ref } from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/Popover/type.d.ts
|
|
5
|
+
type PopoverPlacement = Placement;
|
|
6
|
+
type PopoverTrigger = 'hover' | 'click' | 'both' | ('hover' | 'click')[];
|
|
7
|
+
interface PopoverProps {
|
|
8
|
+
/**
|
|
9
|
+
* 是否显示箭头, 在 `inset` 下无法使用
|
|
10
|
+
* @default true
|
|
11
|
+
*/
|
|
12
|
+
arrow?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* 触发元素
|
|
15
|
+
*/
|
|
16
|
+
children: ReactElement | ReactNode;
|
|
17
|
+
/**
|
|
18
|
+
* 弹出容器类名
|
|
19
|
+
*/
|
|
20
|
+
className?: string;
|
|
21
|
+
/**
|
|
22
|
+
* 自定义类名
|
|
23
|
+
*/
|
|
24
|
+
classNames?: {
|
|
25
|
+
arrow?: string;
|
|
26
|
+
content?: string;
|
|
27
|
+
root?: string;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* 关闭延迟(毫秒),优先级高于 mouseLeaveDelay
|
|
31
|
+
*/
|
|
32
|
+
closeDelay?: number;
|
|
33
|
+
/**
|
|
34
|
+
* 弹出内容
|
|
35
|
+
*/
|
|
36
|
+
content: ReactNode;
|
|
37
|
+
/**
|
|
38
|
+
* 默认打开状态
|
|
39
|
+
* @default false
|
|
40
|
+
*/
|
|
41
|
+
defaultOpen?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* 是否禁用
|
|
44
|
+
* @default false
|
|
45
|
+
*/
|
|
46
|
+
disabled?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* 获取弹出容器
|
|
49
|
+
*/
|
|
50
|
+
getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement;
|
|
51
|
+
/**
|
|
52
|
+
* 是否嵌入 trigger 内部显示
|
|
53
|
+
* @default false
|
|
54
|
+
*/
|
|
55
|
+
inset?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* 鼠标移入延迟(秒)
|
|
58
|
+
* @default 0.1
|
|
59
|
+
*/
|
|
60
|
+
mouseEnterDelay?: number;
|
|
61
|
+
/**
|
|
62
|
+
* 鼠标移出延迟(秒)
|
|
63
|
+
* @default 0.1
|
|
64
|
+
*/
|
|
65
|
+
mouseLeaveDelay?: number;
|
|
66
|
+
/**
|
|
67
|
+
* 打开状态变化回调
|
|
68
|
+
*/
|
|
69
|
+
onOpenChange?: (open: boolean) => void;
|
|
70
|
+
/**
|
|
71
|
+
* 受控的打开状态
|
|
72
|
+
*/
|
|
73
|
+
open?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* 打开延迟(毫秒),优先级高于 mouseEnterDelay
|
|
76
|
+
*/
|
|
77
|
+
openDelay?: number;
|
|
78
|
+
/**
|
|
79
|
+
* 弹出位置
|
|
80
|
+
* @default 'top'
|
|
81
|
+
*/
|
|
82
|
+
placement?: PopoverPlacement;
|
|
83
|
+
/**
|
|
84
|
+
* 是否使用 Portal 渲染
|
|
85
|
+
* @default true
|
|
86
|
+
*/
|
|
87
|
+
portalled?: boolean;
|
|
88
|
+
/**
|
|
89
|
+
* ref
|
|
90
|
+
*/
|
|
91
|
+
ref?: Ref<HTMLElement>;
|
|
92
|
+
/**
|
|
93
|
+
* 自定义样式
|
|
94
|
+
*/
|
|
95
|
+
styles?: {
|
|
96
|
+
arrow?: CSSProperties;
|
|
97
|
+
content?: CSSProperties;
|
|
98
|
+
root?: CSSProperties;
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* 触发方式
|
|
102
|
+
* @default 'hover'
|
|
103
|
+
*/
|
|
104
|
+
trigger?: PopoverTrigger;
|
|
105
|
+
/**
|
|
106
|
+
* z-index
|
|
107
|
+
*/
|
|
108
|
+
zIndex?: number;
|
|
109
|
+
}
|
|
110
|
+
//#endregion
|
|
111
|
+
export { PopoverPlacement, PopoverProps, PopoverTrigger };
|
|
112
|
+
//# sourceMappingURL=type.d.mts.map
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { PopoverGroupPropsContext } from "./groupContext.mjs";
|
|
4
|
+
import { useContext, useMemo } from "react";
|
|
5
|
+
|
|
6
|
+
//#region src/Popover/useMergedPopoverProps.ts
|
|
7
|
+
const useMergedPopoverProps = (props) => {
|
|
8
|
+
const sharedProps = useContext(PopoverGroupPropsContext);
|
|
9
|
+
const { arrow, inset, trigger, placement, className, classNames, styles: styleProps, onOpenChange, content, closeDelay, disabled, getPopupContainer, mouseEnterDelay, mouseLeaveDelay, openDelay, portalled, zIndex } = props;
|
|
10
|
+
const mergedClassName = useMemo(() => {
|
|
11
|
+
if (!sharedProps?.className && !className) return void 0;
|
|
12
|
+
return [sharedProps?.className, className].filter(Boolean).join(" ");
|
|
13
|
+
}, [className, sharedProps?.className]);
|
|
14
|
+
const mergedClassNames = useMemo(() => {
|
|
15
|
+
if (!sharedProps?.classNames && !classNames) return void 0;
|
|
16
|
+
return {
|
|
17
|
+
...sharedProps?.classNames,
|
|
18
|
+
...classNames
|
|
19
|
+
};
|
|
20
|
+
}, [classNames, sharedProps?.classNames]);
|
|
21
|
+
const mergedStyles = useMemo(() => {
|
|
22
|
+
if (!sharedProps?.styles && !styleProps) return void 0;
|
|
23
|
+
return {
|
|
24
|
+
...sharedProps?.styles,
|
|
25
|
+
...styleProps
|
|
26
|
+
};
|
|
27
|
+
}, [sharedProps?.styles, styleProps]);
|
|
28
|
+
const mergedOnOpenChange = useMemo(() => {
|
|
29
|
+
if (!sharedProps?.onOpenChange && !onOpenChange) return void 0;
|
|
30
|
+
return (open) => {
|
|
31
|
+
sharedProps?.onOpenChange?.(open);
|
|
32
|
+
onOpenChange?.(open);
|
|
33
|
+
};
|
|
34
|
+
}, [onOpenChange, sharedProps?.onOpenChange]);
|
|
35
|
+
return useMemo(() => ({
|
|
36
|
+
arrow: arrow ?? sharedProps?.arrow ?? true,
|
|
37
|
+
className: mergedClassName,
|
|
38
|
+
classNames: mergedClassNames,
|
|
39
|
+
closeDelay: closeDelay ?? sharedProps?.closeDelay,
|
|
40
|
+
content,
|
|
41
|
+
disabled: disabled ?? sharedProps?.disabled,
|
|
42
|
+
getPopupContainer: getPopupContainer ?? sharedProps?.getPopupContainer,
|
|
43
|
+
inset: inset ?? sharedProps?.inset ?? false,
|
|
44
|
+
mouseEnterDelay: mouseEnterDelay ?? sharedProps?.mouseEnterDelay,
|
|
45
|
+
mouseLeaveDelay: mouseLeaveDelay ?? sharedProps?.mouseLeaveDelay,
|
|
46
|
+
onOpenChange: mergedOnOpenChange,
|
|
47
|
+
openDelay: openDelay ?? sharedProps?.openDelay,
|
|
48
|
+
placement: placement ?? sharedProps?.placement ?? "top",
|
|
49
|
+
portalled: portalled ?? sharedProps?.portalled,
|
|
50
|
+
styles: mergedStyles,
|
|
51
|
+
trigger: trigger ?? sharedProps?.trigger ?? "hover",
|
|
52
|
+
zIndex: zIndex ?? sharedProps?.zIndex
|
|
53
|
+
}), [
|
|
54
|
+
arrow,
|
|
55
|
+
closeDelay,
|
|
56
|
+
content,
|
|
57
|
+
disabled,
|
|
58
|
+
getPopupContainer,
|
|
59
|
+
inset,
|
|
60
|
+
mergedClassName,
|
|
61
|
+
mergedClassNames,
|
|
62
|
+
mergedOnOpenChange,
|
|
63
|
+
mergedStyles,
|
|
64
|
+
mouseEnterDelay,
|
|
65
|
+
mouseLeaveDelay,
|
|
66
|
+
openDelay,
|
|
67
|
+
placement,
|
|
68
|
+
portalled,
|
|
69
|
+
sharedProps?.arrow,
|
|
70
|
+
sharedProps?.closeDelay,
|
|
71
|
+
sharedProps?.disabled,
|
|
72
|
+
sharedProps?.getPopupContainer,
|
|
73
|
+
sharedProps?.inset,
|
|
74
|
+
sharedProps?.mouseEnterDelay,
|
|
75
|
+
sharedProps?.mouseLeaveDelay,
|
|
76
|
+
sharedProps?.openDelay,
|
|
77
|
+
sharedProps?.placement,
|
|
78
|
+
sharedProps?.portalled,
|
|
79
|
+
sharedProps?.trigger,
|
|
80
|
+
sharedProps?.zIndex,
|
|
81
|
+
trigger,
|
|
82
|
+
zIndex
|
|
83
|
+
]);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
//#endregion
|
|
87
|
+
export { useMergedPopoverProps };
|
|
88
|
+
//# sourceMappingURL=useMergedPopoverProps.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMergedPopoverProps.mjs","names":[],"sources":["../../src/Popover/useMergedPopoverProps.ts"],"sourcesContent":["'use client';\n\nimport { useContext, useMemo } from 'react';\n\nimport { type PopoverGroupItem, PopoverGroupPropsContext } from './groupContext';\nimport type { PopoverProps } from './type';\n\nexport const useMergedPopoverProps = (props: Partial<PopoverProps>): PopoverGroupItem => {\n const sharedProps = useContext(PopoverGroupPropsContext);\n\n const {\n arrow,\n inset,\n trigger,\n placement,\n className,\n classNames,\n styles: styleProps,\n onOpenChange,\n content,\n closeDelay,\n disabled,\n getPopupContainer,\n mouseEnterDelay,\n mouseLeaveDelay,\n openDelay,\n portalled,\n zIndex,\n } = props;\n\n const mergedClassName = useMemo(() => {\n if (!sharedProps?.className && !className) return undefined;\n return [sharedProps?.className, className].filter(Boolean).join(' ');\n }, [className, sharedProps?.className]);\n\n const mergedClassNames = useMemo(() => {\n if (!sharedProps?.classNames && !classNames) return undefined;\n return { ...sharedProps?.classNames, ...classNames };\n }, [classNames, sharedProps?.classNames]);\n\n const mergedStyles = useMemo(() => {\n if (!sharedProps?.styles && !styleProps) return undefined;\n return { ...sharedProps?.styles, ...styleProps };\n }, [sharedProps?.styles, styleProps]);\n\n const mergedOnOpenChange = useMemo(() => {\n if (!sharedProps?.onOpenChange && !onOpenChange) return undefined;\n return (open: boolean) => {\n sharedProps?.onOpenChange?.(open);\n onOpenChange?.(open);\n };\n }, [onOpenChange, sharedProps?.onOpenChange]);\n\n const item: PopoverGroupItem = useMemo(\n () => ({\n arrow: arrow ?? sharedProps?.arrow ?? true,\n className: mergedClassName,\n classNames: mergedClassNames,\n closeDelay: closeDelay ?? sharedProps?.closeDelay,\n content,\n disabled: disabled ?? sharedProps?.disabled,\n getPopupContainer: getPopupContainer ?? sharedProps?.getPopupContainer,\n inset: inset ?? sharedProps?.inset ?? false,\n mouseEnterDelay: mouseEnterDelay ?? sharedProps?.mouseEnterDelay,\n mouseLeaveDelay: mouseLeaveDelay ?? sharedProps?.mouseLeaveDelay,\n onOpenChange: mergedOnOpenChange,\n openDelay: openDelay ?? sharedProps?.openDelay,\n placement: placement ?? sharedProps?.placement ?? 'top',\n portalled: portalled ?? sharedProps?.portalled,\n styles: mergedStyles,\n trigger: trigger ?? sharedProps?.trigger ?? 'hover',\n zIndex: zIndex ?? sharedProps?.zIndex,\n }),\n [\n arrow,\n closeDelay,\n content,\n disabled,\n getPopupContainer,\n inset,\n mergedClassName,\n mergedClassNames,\n mergedOnOpenChange,\n mergedStyles,\n mouseEnterDelay,\n mouseLeaveDelay,\n openDelay,\n placement,\n portalled,\n sharedProps?.arrow,\n sharedProps?.closeDelay,\n sharedProps?.disabled,\n sharedProps?.getPopupContainer,\n sharedProps?.inset,\n sharedProps?.mouseEnterDelay,\n sharedProps?.mouseLeaveDelay,\n sharedProps?.openDelay,\n sharedProps?.placement,\n sharedProps?.portalled,\n sharedProps?.trigger,\n sharedProps?.zIndex,\n trigger,\n zIndex,\n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AAQ;EACR,SAAS,WAAW,aAAa,WAAW;EAC5C,QAAQ,UAAU,aAAa;EAChC,GACD;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,aAAa;EACb,aAAa;EACb,aAAa;EACb,aAAa;EACb,aAAa;EACb,aAAa;EACb,aAAa;EACb,aAAa;EACb,aAAa;EACb,aAAa;EACb,aAAa;EACb,aAAa;EACb;EACA;EACD,CACF"}
|
|
@@ -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 react48 from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/Segmented/Segmented.d.ts
|
|
5
|
-
declare const Segmented:
|
|
5
|
+
declare const Segmented: react48.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 react44 from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/Select/Select.d.ts
|
|
5
|
-
declare const Input:
|
|
5
|
+
declare const Input: react44.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 react47 from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/SideNav/SideNav.d.ts
|
|
5
|
-
declare const SideNav:
|
|
5
|
+
declare const SideNav: react47.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 react45 from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/SliderWithInput/SliderWithInput.d.ts
|
|
5
|
-
declare const SliderWithInput:
|
|
5
|
+
declare const SliderWithInput: react45.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 react109 from "react";
|
|
4
4
|
|
|
5
5
|
//#region src/SortableList/components/DragHandle.d.ts
|
|
6
|
-
declare const DragHandle:
|
|
6
|
+
declare const DragHandle: react109.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 react107 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: react107.NamedExoticComponent<SortableItemProps>;
|
|
13
13
|
//#endregion
|
|
14
14
|
export { SortableItem };
|
|
15
15
|
//# sourceMappingURL=SortableItem.d.mts.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ThemeProviderProps } from "./type.mjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react31 from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/ThemeProvider/ThemeProvider.d.ts
|
|
5
|
-
declare const ThemeProvider:
|
|
5
|
+
declare const ThemeProvider: react31.NamedExoticComponent<ThemeProviderProps>;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { ThemeProvider };
|
|
8
8
|
//# sourceMappingURL=ThemeProvider.d.mts.map
|
package/es/Toc/Toc.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { TocProps } from "./type.mjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react29 from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/Toc/Toc.d.ts
|
|
5
|
-
declare const Toc:
|
|
5
|
+
declare const Toc: react29.NamedExoticComponent<TocProps>;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { Toc };
|
|
8
8
|
//# sourceMappingURL=Toc.d.mts.map
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { TooltipGroupApiContext, TooltipGroupPropsContext } from "./groupContext.mjs";
|
|
4
4
|
import TooltipFloating_default from "./TooltipFloating.mjs";
|
|
5
5
|
import TooltipPortal_default from "./TooltipPortal.mjs";
|
|
6
|
-
import {
|
|
6
|
+
import { toFloatingUIPlacement } from "../utils/placement.mjs";
|
|
7
7
|
import { isElementHidden, observeElementVisibility } from "./utils.mjs";
|
|
8
8
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
9
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -20,7 +20,7 @@ const TooltipGroup = ({ children, layoutAnimation = true, ...sharedProps }) => {
|
|
|
20
20
|
useEffect(() => {
|
|
21
21
|
activeRef.current = active;
|
|
22
22
|
}, [active]);
|
|
23
|
-
const floatingPlacement = useMemo(() =>
|
|
23
|
+
const floatingPlacement = useMemo(() => toFloatingUIPlacement(active?.item.placement), [active?.item.placement]);
|
|
24
24
|
const { context, floatingStyles, refs } = useFloating({
|
|
25
25
|
middleware: useMemo(() => {
|
|
26
26
|
const base = [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TooltipGroup.mjs","names":["TooltipGroup: FC<TooltipGroupProps>","arrowMiddleware","TooltipFloating","TooltipPortal"],"sources":["../../src/Tooltip/TooltipGroup.tsx"],"sourcesContent":["'use client';\n\nimport {\n arrow as arrowMiddleware,\n autoUpdate,\n flip,\n offset,\n shift,\n useFloating,\n} from '@floating-ui/react';\nimport { type FC, type ReactNode, useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\nimport { antdPlacementToFloating } from '@/Tooltip/antdPlacementToFloating';\n\nimport TooltipFloating from './TooltipFloating';\nimport TooltipPortal from './TooltipPortal';\nimport {\n TooltipGroupApiContext,\n type TooltipGroupItem,\n TooltipGroupPropsContext,\n type TooltipGroupSharedProps,\n} from './groupContext';\nimport { isElementHidden, observeElementVisibility } from './utils';\n\ntype TooltipGroupProps = TooltipGroupSharedProps & {\n children: ReactNode;\n};\n\nconst TooltipGroup: FC<TooltipGroupProps> = ({\n children,\n layoutAnimation = true,\n ...sharedProps\n}) => {\n const arrowRef = useRef<SVGSVGElement | null>(null);\n const openTimerRef = useRef<number | null>(null);\n const closeTimerRef = useRef<number | null>(null);\n\n const [active, setActive] = useState<{\n item: TooltipGroupItem;\n triggerEl: HTMLElement;\n } | null>(null);\n const [open, setOpen] = useState(false);\n const activeRef = useRef<typeof active>(null);\n\n useEffect(() => {\n activeRef.current = active;\n }, [active]);\n\n const floatingPlacement = useMemo(\n () => antdPlacementToFloating(active?.item.placement),\n [active?.item.placement],\n );\n\n const middleware = useMemo(() => {\n const base = [offset(8), flip(), shift({ padding: 8 })];\n if (active?.item.arrow) base.push(arrowMiddleware({ element: arrowRef }));\n return base;\n }, [active?.item.arrow]);\n\n const { context, floatingStyles, refs } = useFloating({\n middleware,\n open,\n placement: floatingPlacement,\n whileElementsMounted: autoUpdate,\n });\n\n useEffect(() => {\n if (!active?.triggerEl) return;\n refs.setReference(active.triggerEl);\n }, [active?.triggerEl, refs]);\n\n const clearTimers = useCallback(() => {\n if (openTimerRef.current) window.clearTimeout(openTimerRef.current);\n if (closeTimerRef.current) window.clearTimeout(closeTimerRef.current);\n openTimerRef.current = null;\n closeTimerRef.current = null;\n }, []);\n\n const closeImmediately = useCallback(() => {\n clearTimers();\n setOpen(false);\n activeRef.current?.item.onOpenChange?.(false);\n }, [clearTimers]);\n\n const destroyActive = useCallback(() => {\n clearTimers();\n setOpen(false);\n activeRef.current?.item.onOpenChange?.(false);\n setActive(null);\n }, [clearTimers]);\n\n const isActiveTrigger = useCallback((triggerEl: HTMLElement) => {\n return Boolean(activeRef.current && activeRef.current.triggerEl === triggerEl);\n }, []);\n\n const closeFromTrigger = useCallback(\n (triggerEl: HTMLElement, item: TooltipGroupItem) => {\n if (!activeRef.current || activeRef.current.triggerEl !== triggerEl) return;\n\n clearTimers();\n\n const delayMs =\n item.closeDelay ?? (item.mouseLeaveDelay !== undefined ? item.mouseLeaveDelay * 1000 : 100);\n if (delayMs <= 0) {\n setOpen(false);\n item.onOpenChange?.(false);\n return;\n }\n\n closeTimerRef.current = window.setTimeout(() => {\n setOpen(false);\n item.onOpenChange?.(false);\n }, delayMs);\n },\n [clearTimers],\n );\n\n const openFromTrigger = useCallback(\n (triggerEl: HTMLElement, item: TooltipGroupItem) => {\n if (!triggerEl) return;\n if (!item.title) return;\n if (item.disabled) return;\n\n clearTimers();\n\n if (isElementHidden(triggerEl)) {\n if (isActiveTrigger(triggerEl)) destroyActive();\n return;\n }\n\n setActive({ item, triggerEl });\n\n const delayMs =\n item.openDelay ?? (item.mouseEnterDelay !== undefined ? item.mouseEnterDelay * 1000 : 400);\n if (delayMs <= 0) {\n if (isElementHidden(triggerEl)) {\n destroyActive();\n return;\n }\n setOpen(true);\n item.onOpenChange?.(true);\n return;\n }\n\n openTimerRef.current = window.setTimeout(() => {\n if (isElementHidden(triggerEl)) {\n destroyActive();\n return;\n }\n setOpen(true);\n item.onOpenChange?.(true);\n }, delayMs);\n },\n [clearTimers, destroyActive, isActiveTrigger],\n );\n\n const groupApi = useMemo(\n () => ({ closeFromTrigger, closeImmediately, isActiveTrigger, openFromTrigger }),\n [closeFromTrigger, closeImmediately, isActiveTrigger, openFromTrigger],\n );\n\n useEffect(() => {\n if (!open) return;\n const triggerEl = active?.triggerEl;\n if (!triggerEl) return;\n\n if (isElementHidden(triggerEl)) {\n destroyActive();\n return;\n }\n\n const stopVisibilityObserver = observeElementVisibility(triggerEl, (visible) => {\n if (!visible) destroyActive();\n });\n\n const root = triggerEl.getRootNode?.();\n const observeTarget =\n typeof ShadowRoot !== 'undefined' && root instanceof ShadowRoot\n ? root\n : (triggerEl.ownerDocument ?? document);\n\n const observer = new MutationObserver(() => {\n if (isElementHidden(triggerEl)) destroyActive();\n });\n\n observer.observe(observeTarget, { childList: true, subtree: true });\n\n return () => {\n observer.disconnect();\n stopVisibilityObserver?.();\n };\n }, [active?.triggerEl, destroyActive, open]);\n\n useEffect(() => {\n return () => {\n clearTimers();\n };\n }, [clearTimers]);\n\n const portalRoot =\n active?.item.getPopupContainer && active?.triggerEl\n ? active.item.getPopupContainer(active.triggerEl)\n : undefined;\n\n const openRef = useRef(open);\n useEffect(() => {\n openRef.current = open;\n }, [open]);\n\n const isInitialShow = !openRef.current && open;\n\n const floatingNode = (\n <TooltipFloating\n arrow={active?.item.arrow}\n arrowRef={arrowRef}\n className={active?.item.className}\n classNames={active?.item.classNames}\n context={context}\n floatingStyles={floatingStyles}\n hotkey={active?.item.hotkey}\n hotkeyProps={active?.item.hotkeyProps}\n isInitialShow={isInitialShow}\n layoutAnimation={layoutAnimation}\n open={open}\n placement={floatingPlacement}\n setFloating={refs.setFloating}\n styles={active?.item.styles}\n title={active?.item.title}\n zIndex={active?.item.zIndex}\n />\n );\n\n return (\n <TooltipGroupApiContext.Provider value={groupApi}>\n <TooltipGroupPropsContext.Provider value={sharedProps}>\n {children}\n {active?.item.title &&\n !active.item.disabled &&\n ((active.item.portalled ?? true) ? (\n <TooltipPortal root={portalRoot}>{floatingNode}</TooltipPortal>\n ) : (\n floatingNode\n ))}\n </TooltipGroupPropsContext.Provider>\n </TooltipGroupApiContext.Provider>\n );\n};\n\nexport default TooltipGroup;\n"],"mappings":";;;;;;;;;;;;AA4BA,MAAMA,gBAAuC,EAC3C,UACA,kBAAkB,MAClB,GAAG,kBACC;CACJ,MAAM,WAAW,OAA6B,KAAK;CACnD,MAAM,eAAe,OAAsB,KAAK;CAChD,MAAM,gBAAgB,OAAsB,KAAK;CAEjD,MAAM,CAAC,QAAQ,aAAa,SAGlB,KAAK;CACf,MAAM,CAAC,MAAM,WAAW,SAAS,MAAM;CACvC,MAAM,YAAY,OAAsB,KAAK;AAE7C,iBAAgB;AACd,YAAU,UAAU;IACnB,CAAC,OAAO,CAAC;CAEZ,MAAM,oBAAoB,cAClB,wBAAwB,QAAQ,KAAK,UAAU,EACrD,CAAC,QAAQ,KAAK,UAAU,CACzB;CAQD,MAAM,EAAE,SAAS,gBAAgB,SAAS,YAAY;EACpD,YAPiB,cAAc;GAC/B,MAAM,OAAO;IAAC,OAAO,EAAE;IAAE,MAAM;IAAE,MAAM,EAAE,SAAS,GAAG,CAAC;IAAC;AACvD,OAAI,QAAQ,KAAK,MAAO,MAAK,KAAKC,MAAgB,EAAE,SAAS,UAAU,CAAC,CAAC;AACzE,UAAO;KACN,CAAC,QAAQ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Q,KAAK,qBAAqB,QAAQ,YACtC,OAAO,KAAK,kBAAkB,OAAO,UAAU,GAC/C;CAEN,MAAM,UAAU,OAAO,KAAK;AAC5B,iBAAgB;AACd,UAAQ,UAAU;IACjB,CAAC,KAAK,CAAC;CAEV,MAAM,gBAAgB,CAAC,QAAQ,WAAW;CAE1C,MAAM,eACJ,oBAACC;EACC,OAAO,QAAQ,KAAK;EACV;EACV,WAAW,QAAQ,KAAK;EACxB,YAAY,QAAQ,KAAK;EAChB;EACO;EAChB,QAAQ,QAAQ,KAAK;EACrB,aAAa,QAAQ,KAAK;EACX;EACE;EACX;EACN,WAAW;EACX,aAAa,KAAK;EAClB,QAAQ,QAAQ,KAAK;EACrB,OAAO,QAAQ,KAAK;EACpB,QAAQ,QAAQ,KAAK;GACrB;AAGJ,QACE,oBAAC,uBAAuB;EAAS,OAAO;YACtC,qBAAC,yBAAyB;GAAS,OAAO;cACvC,UACA,QAAQ,KAAK,SACZ,CAAC,OAAO,KAAK,aACX,OAAO,KAAK,aAAa,OACzB,oBAACC;IAAc,MAAM;cAAa;KAA6B,GAE/D;IAE8B;GACJ;;AAItC,2BAAe"}
|
|
1
|
+
{"version":3,"file":"TooltipGroup.mjs","names":["TooltipGroup: FC<TooltipGroupProps>","arrowMiddleware","TooltipFloating","TooltipPortal"],"sources":["../../src/Tooltip/TooltipGroup.tsx"],"sourcesContent":["'use client';\n\nimport {\n arrow as arrowMiddleware,\n autoUpdate,\n flip,\n offset,\n shift,\n useFloating,\n} from '@floating-ui/react';\nimport { type FC, type ReactNode, useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\nimport { toFloatingUIPlacement } from '@/utils/placement';\n\nimport TooltipFloating from './TooltipFloating';\nimport TooltipPortal from './TooltipPortal';\nimport {\n TooltipGroupApiContext,\n type TooltipGroupItem,\n TooltipGroupPropsContext,\n type TooltipGroupSharedProps,\n} from './groupContext';\nimport { isElementHidden, observeElementVisibility } from './utils';\n\ntype TooltipGroupProps = TooltipGroupSharedProps & {\n children: ReactNode;\n};\n\nconst TooltipGroup: FC<TooltipGroupProps> = ({\n children,\n layoutAnimation = true,\n ...sharedProps\n}) => {\n const arrowRef = useRef<SVGSVGElement | null>(null);\n const openTimerRef = useRef<number | null>(null);\n const closeTimerRef = useRef<number | null>(null);\n\n const [active, setActive] = useState<{\n item: TooltipGroupItem;\n triggerEl: HTMLElement;\n } | null>(null);\n const [open, setOpen] = useState(false);\n const activeRef = useRef<typeof active>(null);\n\n useEffect(() => {\n activeRef.current = active;\n }, [active]);\n\n const floatingPlacement = useMemo(\n () => toFloatingUIPlacement(active?.item.placement),\n [active?.item.placement],\n );\n\n const middleware = useMemo(() => {\n const base = [offset(8), flip(), shift({ padding: 8 })];\n if (active?.item.arrow) base.push(arrowMiddleware({ element: arrowRef }));\n return base;\n }, [active?.item.arrow]);\n\n const { context, floatingStyles, refs } = useFloating({\n middleware,\n open,\n placement: floatingPlacement,\n whileElementsMounted: autoUpdate,\n });\n\n useEffect(() => {\n if (!active?.triggerEl) return;\n refs.setReference(active.triggerEl);\n }, [active?.triggerEl, refs]);\n\n const clearTimers = useCallback(() => {\n if (openTimerRef.current) window.clearTimeout(openTimerRef.current);\n if (closeTimerRef.current) window.clearTimeout(closeTimerRef.current);\n openTimerRef.current = null;\n closeTimerRef.current = null;\n }, []);\n\n const closeImmediately = useCallback(() => {\n clearTimers();\n setOpen(false);\n activeRef.current?.item.onOpenChange?.(false);\n }, [clearTimers]);\n\n const destroyActive = useCallback(() => {\n clearTimers();\n setOpen(false);\n activeRef.current?.item.onOpenChange?.(false);\n setActive(null);\n }, [clearTimers]);\n\n const isActiveTrigger = useCallback((triggerEl: HTMLElement) => {\n return Boolean(activeRef.current && activeRef.current.triggerEl === triggerEl);\n }, []);\n\n const closeFromTrigger = useCallback(\n (triggerEl: HTMLElement, item: TooltipGroupItem) => {\n if (!activeRef.current || activeRef.current.triggerEl !== triggerEl) return;\n\n clearTimers();\n\n const delayMs =\n item.closeDelay ?? (item.mouseLeaveDelay !== undefined ? item.mouseLeaveDelay * 1000 : 100);\n if (delayMs <= 0) {\n setOpen(false);\n item.onOpenChange?.(false);\n return;\n }\n\n closeTimerRef.current = window.setTimeout(() => {\n setOpen(false);\n item.onOpenChange?.(false);\n }, delayMs);\n },\n [clearTimers],\n );\n\n const openFromTrigger = useCallback(\n (triggerEl: HTMLElement, item: TooltipGroupItem) => {\n if (!triggerEl) return;\n if (!item.title) return;\n if (item.disabled) return;\n\n clearTimers();\n\n if (isElementHidden(triggerEl)) {\n if (isActiveTrigger(triggerEl)) destroyActive();\n return;\n }\n\n setActive({ item, triggerEl });\n\n const delayMs =\n item.openDelay ?? (item.mouseEnterDelay !== undefined ? item.mouseEnterDelay * 1000 : 400);\n if (delayMs <= 0) {\n if (isElementHidden(triggerEl)) {\n destroyActive();\n return;\n }\n setOpen(true);\n item.onOpenChange?.(true);\n return;\n }\n\n openTimerRef.current = window.setTimeout(() => {\n if (isElementHidden(triggerEl)) {\n destroyActive();\n return;\n }\n setOpen(true);\n item.onOpenChange?.(true);\n }, delayMs);\n },\n [clearTimers, destroyActive, isActiveTrigger],\n );\n\n const groupApi = useMemo(\n () => ({ closeFromTrigger, closeImmediately, isActiveTrigger, openFromTrigger }),\n [closeFromTrigger, closeImmediately, isActiveTrigger, openFromTrigger],\n );\n\n useEffect(() => {\n if (!open) return;\n const triggerEl = active?.triggerEl;\n if (!triggerEl) return;\n\n if (isElementHidden(triggerEl)) {\n destroyActive();\n return;\n }\n\n const stopVisibilityObserver = observeElementVisibility(triggerEl, (visible) => {\n if (!visible) destroyActive();\n });\n\n const root = triggerEl.getRootNode?.();\n const observeTarget =\n typeof ShadowRoot !== 'undefined' && root instanceof ShadowRoot\n ? root\n : (triggerEl.ownerDocument ?? document);\n\n const observer = new MutationObserver(() => {\n if (isElementHidden(triggerEl)) destroyActive();\n });\n\n observer.observe(observeTarget, { childList: true, subtree: true });\n\n return () => {\n observer.disconnect();\n stopVisibilityObserver?.();\n };\n }, [active?.triggerEl, destroyActive, open]);\n\n useEffect(() => {\n return () => {\n clearTimers();\n };\n }, [clearTimers]);\n\n const portalRoot =\n active?.item.getPopupContainer && active?.triggerEl\n ? active.item.getPopupContainer(active.triggerEl)\n : undefined;\n\n const openRef = useRef(open);\n useEffect(() => {\n openRef.current = open;\n }, [open]);\n\n const isInitialShow = !openRef.current && open;\n\n const floatingNode = (\n <TooltipFloating\n arrow={active?.item.arrow}\n arrowRef={arrowRef}\n className={active?.item.className}\n classNames={active?.item.classNames}\n context={context}\n floatingStyles={floatingStyles}\n hotkey={active?.item.hotkey}\n hotkeyProps={active?.item.hotkeyProps}\n isInitialShow={isInitialShow}\n layoutAnimation={layoutAnimation}\n open={open}\n placement={floatingPlacement}\n setFloating={refs.setFloating}\n styles={active?.item.styles}\n title={active?.item.title}\n zIndex={active?.item.zIndex}\n />\n );\n\n return (\n <TooltipGroupApiContext.Provider value={groupApi}>\n <TooltipGroupPropsContext.Provider value={sharedProps}>\n {children}\n {active?.item.title &&\n !active.item.disabled &&\n ((active.item.portalled ?? true) ? (\n <TooltipPortal root={portalRoot}>{floatingNode}</TooltipPortal>\n ) : (\n floatingNode\n ))}\n </TooltipGroupPropsContext.Provider>\n </TooltipGroupApiContext.Provider>\n );\n};\n\nexport default TooltipGroup;\n"],"mappings":";;;;;;;;;;;;AA4BA,MAAMA,gBAAuC,EAC3C,UACA,kBAAkB,MAClB,GAAG,kBACC;CACJ,MAAM,WAAW,OAA6B,KAAK;CACnD,MAAM,eAAe,OAAsB,KAAK;CAChD,MAAM,gBAAgB,OAAsB,KAAK;CAEjD,MAAM,CAAC,QAAQ,aAAa,SAGlB,KAAK;CACf,MAAM,CAAC,MAAM,WAAW,SAAS,MAAM;CACvC,MAAM,YAAY,OAAsB,KAAK;AAE7C,iBAAgB;AACd,YAAU,UAAU;IACnB,CAAC,OAAO,CAAC;CAEZ,MAAM,oBAAoB,cAClB,sBAAsB,QAAQ,KAAK,UAAU,EACnD,CAAC,QAAQ,KAAK,UAAU,CAC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gB,UAAU,CAAE,gBAAe;IAC/C;AAEF,WAAS,QAAQ,eAAe;GAAE,WAAW;GAAM,SAAS;GAAM,CAAC;AAEnE,eAAa;AACX,YAAS,YAAY;AACrB,6BAA0B;;IAE3B;EAAC,QAAQ;EAAW;EAAe;EAAK,CAAC;AAE5C,iBAAgB;AACd,eAAa;AACX,gBAAa;;IAEd,CAAC,YAAY,CAAC;CAEjB,MAAM,aACJ,QAAQ,KAAK,qBAAqB,QAAQ,YACtC,OAAO,KAAK,kBAAkB,OAAO,UAAU,GAC/C;CAEN,MAAM,UAAU,OAAO,KAAK;AAC5B,iBAAgB;AACd,UAAQ,UAAU;IACjB,CAAC,KAAK,CAAC;CAEV,MAAM,gBAAgB,CAAC,QAAQ,WAAW;CAE1C,MAAM,eACJ,oBAACC;EACC,OAAO,QAAQ,KAAK;EACV;EACV,WAAW,QAAQ,KAAK;EACxB,YAAY,QAAQ,KAAK;EAChB;EACO;EAChB,QAAQ,QAAQ,KAAK;EACrB,aAAa,QAAQ,KAAK;EACX;EACE;EACX;EACN,WAAW;EACX,aAAa,KAAK;EAClB,QAAQ,QAAQ,KAAK;EACrB,OAAO,QAAQ,KAAK;EACpB,QAAQ,QAAQ,KAAK;GACrB;AAGJ,QACE,oBAAC,uBAAuB;EAAS,OAAO;YACtC,qBAAC,yBAAyB;GAAS,OAAO;cACvC,UACA,QAAQ,KAAK,SACZ,CAAC,OAAO,KAAK,aACX,OAAO,KAAK,aAAa,OACzB,oBAACC;IAAc,MAAM;cAAa;KAA6B,GAE/D;IAE8B;GACJ;;AAItC,2BAAe"}
|
package/es/Tooltip/type.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { HotkeyProps } from "../Hotkey/type.mjs";
|
|
2
2
|
import "../Hotkey/index.mjs";
|
|
3
|
+
import { Placement } from "../utils/placement.mjs";
|
|
3
4
|
import { CSSProperties, ReactElement, ReactNode, Ref } from "react";
|
|
4
|
-
import { Placement } from "@floating-ui/react";
|
|
5
5
|
|
|
6
6
|
//#region src/Tooltip/type.d.ts
|
|
7
|
-
type TooltipPlacement = Placement
|
|
7
|
+
type TooltipPlacement = Placement;
|
|
8
8
|
type TooltipProps = {
|
|
9
9
|
/**
|
|
10
10
|
* Whether the tooltip has an arrow pointer.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { toFloatingUIPlacement } from "../utils/placement.mjs";
|
|
2
2
|
import { useMemo, useRef } from "react";
|
|
3
3
|
import { arrow, autoUpdate, flip, offset, shift, useDismiss, useFloating, useFocus, useHover, useInteractions, useRole } from "@floating-ui/react";
|
|
4
4
|
|
|
5
5
|
//#region src/Tooltip/useTooltipFloating.ts
|
|
6
6
|
const useTooltipFloating = ({ arrow: arrow$1, placement, openDelay, closeDelay, mouseEnterDelay, mouseLeaveDelay, disabled, open, onOpenChange }) => {
|
|
7
7
|
const arrowRef = useRef(null);
|
|
8
|
-
const floatingPlacement = useMemo(() =>
|
|
8
|
+
const floatingPlacement = useMemo(() => toFloatingUIPlacement(placement), [placement]);
|
|
9
9
|
const { context, floatingStyles, refs } = useFloating({
|
|
10
10
|
middleware: useMemo(() => {
|
|
11
11
|
const base = [
|