haze-ui 1.22.0 → 1.24.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/README.md +7 -0
- package/dist/components/BottomSheet/BottomSheet.js +33 -16
- package/dist/components/Collapsible/Collapsible.js +34 -27
- package/dist/components/Combobox/Combobox.js +2 -1
- package/dist/components/ConfirmDialog/ConfirmDialog.js +60 -42
- package/dist/components/ContextMenu/ContextMenu.js +2 -1
- package/dist/components/ContextMenu/ContextMenuContent.js +33 -23
- package/dist/components/Datepicker/DatepickerCore.js +2 -1
- package/dist/components/Dialog/Dialog.js +40 -21
- package/dist/components/Drawer/Drawer.js +37 -18
- package/dist/components/DropdownMenu/DropdownMenu.js +27 -25
- package/dist/components/DropdownMenu/DropdownMenuContent.js +2 -2
- package/dist/components/Menu/Menu.js +43 -35
- package/dist/components/Popover/Popover.js +27 -25
- package/dist/components/Toast/Toast.js +25 -20
- package/dist/components/Toast/ToastContainer.js +31 -24
- package/dist/components/Tooltip/Tooltip.js +37 -34
- package/dist/css/alert.css +1 -1
- package/dist/css/approval-card.css +1 -1
- package/dist/css/async-section.css +1 -1
- package/dist/css/badge.css +1 -1
- package/dist/css/banner.css +1 -1
- package/dist/css/bottom-sheet.css +1 -1
- package/dist/css/chat-message.css +1 -1
- package/dist/css/code-block.css +1 -1
- package/dist/css/collapsible.css +1 -1
- package/dist/css/combobox.css +1 -1
- package/dist/css/confirm-dialog.css +1 -1
- package/dist/css/context-menu.css +2 -2
- package/dist/css/conversation-list.css +1 -1
- package/dist/css/datepicker.css +1 -1
- package/dist/css/dialog.css +1 -1
- package/dist/css/diff-viewer.css +1 -1
- package/dist/css/drawer.css +1 -1
- package/dist/css/dropdown-menu.css +2 -2
- package/dist/css/inline-edit.css +1 -1
- package/dist/css/log-viewer.css +1 -1
- package/dist/css/markdown-renderer.css +1 -1
- package/dist/css/menu.css +1 -1
- package/dist/css/navigation-bar.css +1 -1
- package/dist/css/popover.css +1 -1
- package/dist/css/step-timeline.css +1 -1
- package/dist/css/tag-group.css +1 -1
- package/dist/css/tag-input.css +1 -1
- package/dist/css/tag.css +1 -1
- package/dist/css/toast.css +1 -1
- package/dist/css/token-counter.css +1 -1
- package/dist/css/tokens.css +2 -1
- package/dist/css/tool-call-card.css +1 -1
- package/dist/css/tooltip.css +1 -1
- package/dist/haze-ui.css +36 -35
- package/dist/tokens/index.js +4 -1
- package/dist/tokens/motion.js +6 -0
- package/dist/tokens/oklch.js +117 -0
- package/dist/tokens/palette.js +327 -0
- package/dist/tokens/registry.js +154 -145
- package/dist/types/components/BottomSheet/BottomSheet.d.ts +3 -3
- package/dist/types/components/Collapsible/Collapsible.d.ts +1 -1
- package/dist/types/components/ConfirmDialog/ConfirmDialog.d.ts +3 -3
- package/dist/types/components/DropdownMenu/DropdownMenu.d.ts +7 -1
- package/dist/types/components/Popover/Popover.d.ts +7 -1
- package/dist/types/components/Toast/Toast.d.ts +3 -3
- package/dist/types/components/Tooltip/Tooltip.d.ts +4 -1
- package/dist/types/tokens/index.d.ts +5 -0
- package/dist/types/tokens/motion.d.ts +1 -0
- package/dist/types/tokens/oklch.d.ts +35 -0
- package/dist/types/tokens/palette.d.ts +28 -0
- package/dist/types/utils/collision.d.ts +62 -0
- package/dist/types/utils/floating.d.ts +95 -19
- package/dist/types/utils/focus-scope.d.ts +25 -0
- package/dist/types/utils/focus.d.ts +23 -0
- package/dist/types/utils/presence.d.ts +22 -0
- package/dist/utils/collision.js +73 -0
- package/dist/utils/floating.js +195 -150
- package/dist/utils/focus-scope.js +63 -0
- package/dist/utils/focus.js +34 -0
- package/dist/utils/presence.js +72 -0
- package/package.json +4 -2
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ComponentProps, CSSProperties, Dispatch, ReactNode, RefObject, SetStateAction } from 'react';
|
|
2
|
+
import type { CollisionStrategy } from './collision';
|
|
2
3
|
/** Lazy feature detection so tests can flip between native and fallback. */
|
|
3
4
|
export declare function supportsNativePopover(): boolean;
|
|
4
5
|
/**
|
|
@@ -7,6 +8,20 @@ export declare function supportsNativePopover(): boolean;
|
|
|
7
8
|
* be trusted on its own.
|
|
8
9
|
*/
|
|
9
10
|
export declare function supportsAnchorPositioning(): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Fallback path: panel visually hidden while closed. Exported so tests
|
|
13
|
+
* can assert the (animated-delayed) hidden handover like any consumer.
|
|
14
|
+
*/
|
|
15
|
+
export declare const floatingHidden: import("@linaria/core").LinariaClassName;
|
|
16
|
+
/**
|
|
17
|
+
* Animated panels fade in/out through `data-state` — opacity only.
|
|
18
|
+
* Transform is banned on floating panels: both JS-positioned tiers
|
|
19
|
+
* measure the panel's rect, and getBoundingClientRect includes
|
|
20
|
+
* transforms, so a translating/scaling panel would poison placement.
|
|
21
|
+
* `forwards` keeps a finished fade-out at opacity 0 until the hidden
|
|
22
|
+
* handover lands (a one-frame flash-back would otherwise show).
|
|
23
|
+
*/
|
|
24
|
+
export declare const floatingAnimated: import("@linaria/core").LinariaClassName;
|
|
10
25
|
declare const anchoredPlacements: {
|
|
11
26
|
readonly bottom: import("@linaria/core").LinariaClassName;
|
|
12
27
|
readonly 'bottom-span': import("@linaria/core").LinariaClassName;
|
|
@@ -29,6 +44,19 @@ type UseFloatingOptions = {
|
|
|
29
44
|
triggerRef: RefObject<HTMLElement | null>;
|
|
30
45
|
/** The floating panel element. */
|
|
31
46
|
panelRef: RefObject<HTMLElement | null>;
|
|
47
|
+
/**
|
|
48
|
+
* Fade the panel in/out via `data-state` (opacity only) and keep it
|
|
49
|
+
* visible until its exit animation settles, instead of hiding the
|
|
50
|
+
* instant `open` flips false. Enables `dataState`/`exited` below; in
|
|
51
|
+
* jsdom (no CSS durations) the exit settles within two frames, so
|
|
52
|
+
* tests observe the handover with waitFor.
|
|
53
|
+
*/
|
|
54
|
+
animated?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Collision knobs consumed by useFloatingPosition on the JS-positioned
|
|
57
|
+
* tiers (the tier-2 flip/shift and the tier-1 cross-axis nudge).
|
|
58
|
+
*/
|
|
59
|
+
collision?: CollisionStrategy;
|
|
32
60
|
};
|
|
33
61
|
export type FloatingBehavior = {
|
|
34
62
|
open: boolean;
|
|
@@ -44,6 +72,23 @@ export type FloatingBehavior = {
|
|
|
44
72
|
* display:none element and is silently dropped (Chromium).
|
|
45
73
|
*/
|
|
46
74
|
shown: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Panel lifecycle phase for CSS: 'open' while `open` is true (enter
|
|
77
|
+
* animation), 'closed' the moment it flips false (exit animation runs
|
|
78
|
+
* while the panel is still visible). `undefined` when not animated.
|
|
79
|
+
* Render as the panel's `data-state` attribute.
|
|
80
|
+
*/
|
|
81
|
+
dataState: 'open' | 'closed' | undefined;
|
|
82
|
+
/**
|
|
83
|
+
* True when the panel is fully closed — nothing visible, nothing
|
|
84
|
+
* animating. Animated: false from the moment `open` flips true until
|
|
85
|
+
* the exit settles, then true again (and true before the first open).
|
|
86
|
+
* Non-animated: mirrors `!open`. Consumers that unmount panel content
|
|
87
|
+
* gate on `!open && exited`.
|
|
88
|
+
*/
|
|
89
|
+
exited: boolean;
|
|
90
|
+
/** Collision strategy FloatingPanel forwards to useFloatingPosition. */
|
|
91
|
+
collision: CollisionStrategy | undefined;
|
|
47
92
|
/** Unique CSS anchor name for this instance (anchored path). */
|
|
48
93
|
anchorName: string;
|
|
49
94
|
/** Inline style for the trigger: declares `anchor-name`. */
|
|
@@ -57,35 +102,60 @@ export type FloatingBehavior = {
|
|
|
57
102
|
popover: 'auto' | undefined;
|
|
58
103
|
style: CSSProperties | undefined;
|
|
59
104
|
};
|
|
60
|
-
/**
|
|
105
|
+
/**
|
|
106
|
+
* Positioning-skeleton entries for the panel's x-class array. With
|
|
107
|
+
* `animated`, the fallback hidden class is only applied once the exit
|
|
108
|
+
* settled (`exited`), keeping the panel measurable/visible through its
|
|
109
|
+
* fade-out.
|
|
110
|
+
*/
|
|
61
111
|
panelClasses: (string | false)[];
|
|
62
112
|
triggerRef: RefObject<HTMLElement | null>;
|
|
63
113
|
panelRef: RefObject<HTMLElement | null>;
|
|
64
114
|
};
|
|
65
|
-
export declare function useFloating({ open, setOpen, triggerRef, panelRef, }: UseFloatingOptions): FloatingBehavior;
|
|
115
|
+
export declare function useFloating({ open, setOpen, triggerRef, panelRef, animated, collision, }: UseFloatingOptions): FloatingBehavior;
|
|
66
116
|
/** x-class entries placing the panel relative to the trigger, per tier. */
|
|
67
117
|
export declare function floatingPlacementClasses(behavior: Pick<FloatingBehavior, 'native' | 'anchored'>, placement: FloatingPlacement): (string | false)[];
|
|
68
118
|
/**
|
|
69
119
|
* Place a fixed panel from the trigger's rect (tier 2). Centers compute
|
|
70
|
-
* from the panel's own rect, so this needs
|
|
71
|
-
* and unreachable in jsdom where the
|
|
120
|
+
* from the panel's own rect, so this needs the panel to be laid out —
|
|
121
|
+
* fine in real engines once shown, and unreachable in jsdom where the
|
|
122
|
+
* fallback tier renders instead.
|
|
72
123
|
*
|
|
73
|
-
*
|
|
74
|
-
* viewport edge flips to the opposite side when that
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
124
|
+
* Collision handling: a placement that would push the panel past the
|
|
125
|
+
* (optionally padded) viewport edge flips to the opposite side when that
|
|
126
|
+
* side has room, slides along the cross axis, and finally clamps into
|
|
127
|
+
* view when neither side fits — all in computeFloatingPosition. With no
|
|
128
|
+
* `collision` the output is pixel-identical to the legacy inline math
|
|
129
|
+
* (the parity cases in collision.test.ts and the tier-2 regression
|
|
130
|
+
* cases in Popover.test.tsx guard this). Exported for direct testing
|
|
131
|
+
* like `supportsNativePopover` above.
|
|
79
132
|
*/
|
|
80
|
-
export declare function placeFloatingPanel(panel: HTMLElement, trigger: HTMLElement, placement: FloatingPlacement): void;
|
|
133
|
+
export declare function placeFloatingPanel(panel: HTMLElement, trigger: HTMLElement, placement: FloatingPlacement, collision?: CollisionStrategy): void;
|
|
81
134
|
/**
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
135
|
+
* JS-assisted positioning:
|
|
136
|
+
*
|
|
137
|
+
* - Tier 2 (popover API, no anchor positioning): place the panel from
|
|
138
|
+
* the trigger's rect and re-place on scroll/resize while shown.
|
|
139
|
+
* - Tier 1 (anchored): `position-area` + `position-try-fallbacks` handle
|
|
140
|
+
* the primary axis declaratively; the cross axis is measured here and
|
|
141
|
+
* nudged back into the padded viewport via `translate`, re-measured on
|
|
142
|
+
* scroll/resize. Collision padding applies to the cross axis only —
|
|
143
|
+
* the primary-axis flip is the browser's and cannot see padding
|
|
144
|
+
* (position-try has no padding concept), a documented limitation.
|
|
145
|
+
*
|
|
146
|
+
* Both tiers gate on actual visibility (`shown`), not `open`: child
|
|
147
|
+
* effects run before the behavior effect that calls showPopover(), and a
|
|
148
|
+
* native popover is `display: none` until then — placing on the `open`
|
|
149
|
+
* commit would measure a zero-size rect and mis-center/mis-align the
|
|
150
|
+
* panel on first open in real engines (jsdom's permissive mocks hide
|
|
151
|
+
* it). The extra render pass after the toggle event is the price for
|
|
152
|
+
* correct geometry.
|
|
85
153
|
*/
|
|
86
|
-
export declare function useFloatingPosition({ behavior, placement, }: {
|
|
154
|
+
export declare function useFloatingPosition({ behavior, placement, collision, }: {
|
|
87
155
|
behavior: FloatingBehavior;
|
|
88
156
|
placement: FloatingPlacement;
|
|
157
|
+
/** Collision knobs; defaults to the behavior's own strategy. */
|
|
158
|
+
collision?: CollisionStrategy;
|
|
89
159
|
}): void;
|
|
90
160
|
type FloatingPanelProps = {
|
|
91
161
|
/** Behavior record produced by `useFloating` at the floating root. */
|
|
@@ -95,6 +165,11 @@ type FloatingPanelProps = {
|
|
|
95
165
|
* consumer positions the panel itself, e.g. ContextMenu at the pointer.
|
|
96
166
|
*/
|
|
97
167
|
placement?: FloatingPlacement;
|
|
168
|
+
/**
|
|
169
|
+
* Collision strategy for the JS-assisted tiers (tier-2 flip/shift,
|
|
170
|
+
* tier-1 cross-axis nudge); defaults to the behavior's own strategy.
|
|
171
|
+
*/
|
|
172
|
+
collision?: CollisionStrategy;
|
|
98
173
|
/** Consumer visual skin: border, background, shadow, padding. */
|
|
99
174
|
visualClass?: string;
|
|
100
175
|
className?: string;
|
|
@@ -104,9 +179,10 @@ type FloatingPanelProps = {
|
|
|
104
179
|
} & Omit<ComponentProps<'div'>, 'className' | 'children' | 'style'>;
|
|
105
180
|
/**
|
|
106
181
|
* The panel element of a floating pair: applies the popover attribute,
|
|
107
|
-
* the anchor custom property and the tier/placement classes,
|
|
108
|
-
*
|
|
109
|
-
* passed through to
|
|
182
|
+
* the anchor custom property and the tier/placement classes, mirrors the
|
|
183
|
+
* animated lifecycle as `data-state`, and runs the JS-assisted position
|
|
184
|
+
* effect. Everything else (id, role, handlers, ref) is passed through to
|
|
185
|
+
* the underlying div.
|
|
110
186
|
*/
|
|
111
|
-
export declare function FloatingPanel({ behavior, placement, visualClass, className, style, children, ...rest }: FloatingPanelProps): import("react").JSX.Element;
|
|
187
|
+
export declare function FloatingPanel({ behavior, placement, collision, visualClass, className, style, children, ...rest }: FloatingPanelProps): import("react").JSX.Element;
|
|
112
188
|
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 焦点域 hook(Radix FocusScope 的简化版,headless:返回 ref 回调,
|
|
3
|
+
* 由消费方挂到容器元素上)。负责弹层的初始聚焦 / 焦点归还 / 可选困焦,
|
|
4
|
+
* 无 CSS 依赖,不进 src/lib/index.ts barrel。
|
|
5
|
+
*/
|
|
6
|
+
export type FocusScopeOptions = {
|
|
7
|
+
/**
|
|
8
|
+
* true=激活(挂载语义:记录归还目标、派发 hazefocusmount、自动聚焦、
|
|
9
|
+
* 可选困焦);false=停用(卸载语义:派发 hazefocusunmount、归还焦点)。
|
|
10
|
+
* effect 依赖只有 enabled —— 其余选项经 optionsRef 读取最新值,
|
|
11
|
+
* 内联箭头函数 props 不会触发重新激活。
|
|
12
|
+
*/
|
|
13
|
+
enabled: boolean;
|
|
14
|
+
/** Tab 循环锁定在容器内(document 级 Tab 拦截 + focusout 拉回),默认 false */
|
|
15
|
+
trapped?: boolean;
|
|
16
|
+
/** enabled 翻 true 时聚焦首个 tabbable(无则容器自身),默认 true */
|
|
17
|
+
autoFocus?: boolean;
|
|
18
|
+
/** enabled 翻 false 时归还焦点到激活前的元素,默认 true */
|
|
19
|
+
returnFocus?: boolean;
|
|
20
|
+
/** 挂载事件回调;在事件上 preventDefault 可阻止默认聚焦 */
|
|
21
|
+
onMountAutoFocus?: (event: Event) => void;
|
|
22
|
+
/** 卸载事件回调;在事件上 preventDefault 可阻止默认归还 */
|
|
23
|
+
onUnmountAutoFocus?: (event: Event) => void;
|
|
24
|
+
};
|
|
25
|
+
export declare function useFocusScope(options: FocusScopeOptions): (node: HTMLElement | null) => void;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 纯焦点工具:tabbable 元素查询与首个聚焦目标计算。
|
|
3
|
+
*
|
|
4
|
+
* 无 React、无 CSS 依赖,可在任意 DOM 环境(含 jsdom)直接复用。
|
|
5
|
+
* 与 floating.tsx 一样属于内部原语,不进 src/lib/index.ts barrel。
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Tab 序候选元素选择器。仅做结构性筛选;disabled / hidden /
|
|
9
|
+
* tabindex="-1" / 可见性等运行时状态由 isTabbable 二次过滤
|
|
10
|
+
* (选择器里的 :not([disabled]) 分支只覆盖各自的元素形态)。
|
|
11
|
+
*/
|
|
12
|
+
export declare const TABBABLE_SELECTOR: string;
|
|
13
|
+
/** 元素是否在 Tab 序内(选择器命中 + 非 disabled + 非 hidden + 可见)。 */
|
|
14
|
+
export declare function isTabbable(el: Element): el is HTMLElement;
|
|
15
|
+
/** 容器内按 DOM 顺序排列的全部 tabbable 元素(不含容器自身)。 */
|
|
16
|
+
export declare function getTabbables(container: ParentNode | null | undefined): HTMLElement[];
|
|
17
|
+
/**
|
|
18
|
+
* 聚焦容器内第一个 tabbable 元素;无 tabbable 时聚焦容器自身
|
|
19
|
+
* (容器需 tabIndex=-1 才可编程聚焦,未显式设置时补设)。
|
|
20
|
+
* 返回是否聚焦成功 —— 以 activeElement 实际转移为准,兜住
|
|
21
|
+
* disabled / 脱离文档等 focus() 静默失效的场景。
|
|
22
|
+
*/
|
|
23
|
+
export declare function focusFirst(container: HTMLElement): boolean;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ReactElement, Ref } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Wait for `el`'s exit animation/transition to finish. Resolves immediately
|
|
4
|
+
* when no positive duration is declared. Returns `null` for an element
|
|
5
|
+
* outside the document (nothing visible to wait for), and the in-flight
|
|
6
|
+
* promise for a repeated call — settles are not re-entrant per element.
|
|
7
|
+
*/
|
|
8
|
+
export declare function whenExitSettles(el: HTMLElement): Promise<void> | null;
|
|
9
|
+
type PresenceChildProps = {
|
|
10
|
+
'data-state'?: string;
|
|
11
|
+
ref?: Ref<HTMLElement>;
|
|
12
|
+
};
|
|
13
|
+
export type PresenceProps = {
|
|
14
|
+
/** While true the child is mounted with `data-state="open"`. */
|
|
15
|
+
present: boolean;
|
|
16
|
+
/** Single element child; receives `data-state` and a merged ref. */
|
|
17
|
+
children: ReactElement;
|
|
18
|
+
/** Called when the exit has settled and the child is about to unmount. */
|
|
19
|
+
onExited?: () => void;
|
|
20
|
+
};
|
|
21
|
+
export declare function Presence({ present, children, onExited }: PresenceProps): ReactElement<PresenceChildProps, string | import("react").JSXElementConstructor<any>> | null;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
//#region src/lib/utils/collision.ts
|
|
2
|
+
function e(e) {
|
|
3
|
+
return typeof e == "number" ? {
|
|
4
|
+
top: e,
|
|
5
|
+
right: e,
|
|
6
|
+
bottom: e,
|
|
7
|
+
left: e
|
|
8
|
+
} : {
|
|
9
|
+
top: e?.top ?? 0,
|
|
10
|
+
right: e?.right ?? 0,
|
|
11
|
+
bottom: e?.bottom ?? 0,
|
|
12
|
+
left: e?.left ?? 0
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function t(e, t, n) {
|
|
16
|
+
return Math.min(Math.max(e, t), Math.max(t, n));
|
|
17
|
+
}
|
|
18
|
+
var n = {
|
|
19
|
+
bottom: {
|
|
20
|
+
side: "bottom",
|
|
21
|
+
align: "start"
|
|
22
|
+
},
|
|
23
|
+
"bottom-span": {
|
|
24
|
+
side: "bottom",
|
|
25
|
+
align: "start"
|
|
26
|
+
},
|
|
27
|
+
"bottom-center": {
|
|
28
|
+
side: "bottom",
|
|
29
|
+
align: "center"
|
|
30
|
+
},
|
|
31
|
+
"bottom-end": {
|
|
32
|
+
side: "bottom",
|
|
33
|
+
align: "end"
|
|
34
|
+
},
|
|
35
|
+
top: {
|
|
36
|
+
side: "top",
|
|
37
|
+
align: "center"
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
function r({ trigger: e, panel: r, viewport: i, placement: a, gap: o, strategy: s }) {
|
|
41
|
+
let { flip: c, shift: l, padding: u } = s, d = {
|
|
42
|
+
top: u.top,
|
|
43
|
+
bottom: i.height - u.bottom,
|
|
44
|
+
left: u.left,
|
|
45
|
+
right: i.width - u.right
|
|
46
|
+
}, f = e.left + e.width / 2 - r.width / 2, p = e.top + e.height / 2 - r.height / 2, m = (t, n) => ({
|
|
47
|
+
top: t === "bottom" ? e.bottom + o.below : e.top - r.height - o.above,
|
|
48
|
+
left: n === "start" ? e.left : n === "end" ? e.right - r.width : f
|
|
49
|
+
}), h = (t) => ({
|
|
50
|
+
top: p,
|
|
51
|
+
left: t === "right" ? e.right + o.after : e.left - r.width - o.before
|
|
52
|
+
}), g = a === "left" || a === "right", { top: _, left: v } = g ? h(a) : m(n[a].side, n[a].align), y = g ? a : n[a].side;
|
|
53
|
+
if (g) {
|
|
54
|
+
let t = a === "right" ? v + r.width > d.right : v < d.left, n = a === "right" ? e.left - r.width - o.before >= d.left : e.right + r.width + o.after <= d.right;
|
|
55
|
+
if (c && t && n) {
|
|
56
|
+
let e = a === "right" ? "left" : "right";
|
|
57
|
+
({top: _, left: v} = h(e)), y = e;
|
|
58
|
+
}
|
|
59
|
+
} else {
|
|
60
|
+
let { side: t, align: i } = n[a], s = t === "bottom" ? _ + r.height > d.bottom : _ < d.top, l = t === "bottom" ? e.top - r.height - o.above >= d.top : e.bottom + r.height + o.below <= d.bottom;
|
|
61
|
+
if (c && s && l) {
|
|
62
|
+
let e = t === "bottom" ? "top" : "bottom";
|
|
63
|
+
({top: _, left: v} = m(e, i)), y = e;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return l && (g ? _ = t(_, d.top, d.bottom - r.height) : v = t(v, d.left, d.right - r.width)), g ? v = t(v, d.left, d.right - r.width) : _ = t(_, d.top, d.bottom - r.height), {
|
|
67
|
+
top: _,
|
|
68
|
+
left: v,
|
|
69
|
+
placement: y
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
//#endregion
|
|
73
|
+
export { r as computeFloatingPosition, e as resolvePadding };
|