@canonical/react-ds-global 0.48.0 → 0.50.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/dist/esm/lib/_work_in_progress/Announcement/styles.css +4 -4
- package/dist/esm/lib/_work_in_progress/Label/styles.css +1 -7
- package/dist/esm/lib/component/Accordion/common/Item/styles.css +5 -6
- package/dist/esm/lib/component/Accordion/styles.css +3 -9
- package/dist/esm/lib/component/Breadcrumbs/common/Item/styles.css +6 -14
- package/dist/esm/lib/component/Breadcrumbs/styles.css +2 -9
- package/dist/esm/lib/component/Button/Button.js +28 -12
- package/dist/esm/lib/component/Button/Button.js.map +1 -1
- package/dist/esm/lib/component/Button/styles.css +48 -18
- package/dist/esm/lib/component/Card/common/Content/styles.css +4 -5
- package/dist/esm/lib/component/Card/common/Header/styles.css +1 -2
- package/dist/esm/lib/component/Card/styles.css +1 -2
- package/dist/esm/lib/component/ContextualMenu/common/Item/styles.css +6 -9
- package/dist/esm/lib/component/ContextualMenu/styles.css +6 -7
- package/dist/esm/lib/component/Icon/styles.css +3 -7
- package/dist/esm/lib/component/InlineCode/styles.css +2 -3
- package/dist/esm/lib/component/KeyboardKey/styles.css +6 -8
- package/dist/esm/lib/component/Tabs/common/Item/styles.css +1 -1
- package/dist/esm/lib/component/Tabs/styles.css +4 -8
- package/dist/esm/lib/component/Tile/common/Content/styles.css +2 -5
- package/dist/esm/lib/component/Tile/common/Header/styles.css +3 -6
- package/dist/esm/lib/component/Tile/styles.css +1 -5
- package/dist/esm/lib/component/Tooltip/Tooltip.js.map +1 -1
- package/dist/esm/lib/component/Tooltip/TooltipEngine.js +91 -15
- package/dist/esm/lib/component/Tooltip/TooltipEngine.js.map +1 -1
- package/dist/esm/lib/component/Tooltip/hooks/useTooltipState.js +89 -0
- package/dist/esm/lib/component/Tooltip/hooks/useTooltipState.js.map +1 -0
- package/dist/esm/lib/component/Tooltip/styles.css +151 -80
- package/dist/esm/lib/component/Tooltip/withTooltip.js +3 -3
- package/dist/esm/lib/group/KeyboardKeys/styles.css +1 -1
- package/dist/esm/lib/hooks/useWindowFitment/useWindowFitment.js +172 -173
- package/dist/esm/lib/hooks/useWindowFitment/useWindowFitment.js.map +1 -1
- package/dist/esm/lib/pattern/Modal/common/Content/styles.css +3 -6
- package/dist/esm/lib/pattern/Modal/common/Footer/styles.css +1 -1
- package/dist/esm/lib/pattern/Modal/common/Header/styles.css +3 -9
- package/dist/esm/lib/pattern/Modal/styles.css +14 -20
- package/dist/esm/lib/pattern/Timeline/common/Content/styles.css +1 -4
- package/dist/esm/lib/pattern/Timeline/common/Event/styles.css +6 -13
- package/dist/esm/lib/pattern/Timeline/styles.css +1 -4
- package/dist/types/lib/component/Button/Button.d.ts +4 -1
- package/dist/types/lib/component/Button/Button.d.ts.map +1 -1
- package/dist/types/lib/component/Button/types.d.ts +15 -4
- package/dist/types/lib/component/Button/types.d.ts.map +1 -1
- package/dist/types/lib/component/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/types/lib/component/Tooltip/TooltipEngine.d.ts +6 -4
- package/dist/types/lib/component/Tooltip/TooltipEngine.d.ts.map +1 -1
- package/dist/types/lib/component/Tooltip/hooks/useTooltipState.d.ts +17 -0
- package/dist/types/lib/component/Tooltip/hooks/useTooltipState.d.ts.map +1 -0
- package/dist/types/lib/component/Tooltip/types.d.ts +27 -2
- package/dist/types/lib/component/Tooltip/types.d.ts.map +1 -1
- package/dist/types/lib/component/Tooltip/withTooltip.d.ts +3 -3
- package/dist/types/lib/hooks/useWindowFitment/useWindowFitment.d.ts +22 -1
- package/dist/types/lib/hooks/useWindowFitment/useWindowFitment.d.ts.map +1 -1
- package/package.json +23 -14
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useEffect, useLayoutEffect, useMemo, useRef, useState, } from "react";
|
|
2
2
|
import { useResizeObserver } from "../useResizeObserver/index.js";
|
|
3
3
|
import { useWindowDimensions } from "../useWindowDimensions/index.js";
|
|
4
4
|
/** Coerce a bare logical side or a placement into a full logical placement. */
|
|
@@ -102,6 +102,172 @@ popupPosition = {
|
|
|
102
102
|
const clampedOffset = Math.max(-halfExtent, Math.min(halfExtent, rawOffset));
|
|
103
103
|
return { axis, offset: clampedOffset };
|
|
104
104
|
};
|
|
105
|
+
/**
|
|
106
|
+
* Calculate the relative position of the popup when oriented in a given direction.
|
|
107
|
+
* @param direction The side of the target element to position the popup on.
|
|
108
|
+
* @param align Where the popup sits along that side's cross-axis.
|
|
109
|
+
* @param targetRect The bounding client rect of the target element.
|
|
110
|
+
* @param popupRect The bounding client rect of the popup element.
|
|
111
|
+
* @param distance The distance, in pixels, between the target and the popup.
|
|
112
|
+
* @returns The calculated relative position of the popup.
|
|
113
|
+
*/
|
|
114
|
+
const calculateRelativePosition = (direction, align, targetRect, popupRect, distance) => {
|
|
115
|
+
let left = 0;
|
|
116
|
+
let top = 0;
|
|
117
|
+
/*
|
|
118
|
+
We use left and top offsets to position the popup relative to the target element.
|
|
119
|
+
Then, we apply a margin on the opposite side of the popup to create a buffer zone between the target and the popup, to prevent a mouseleave event when moving from the target to the popup.
|
|
120
|
+
The fake margin is already included in `targetRect` dimensions, as it is rendered hidden at least once before the popup is shown.
|
|
121
|
+
In cases where `targetRect` is not included in the calculation, we add `distance` to account for the fake margin.
|
|
122
|
+
*/
|
|
123
|
+
// Cross-axis offset along a side's cross-axis:
|
|
124
|
+
// start → target's leading edge (offset 0)
|
|
125
|
+
// end → target's trailing edge
|
|
126
|
+
// center → centred
|
|
127
|
+
const computeCrossAxisOffset = (targetExtent, popupExtent) => {
|
|
128
|
+
switch (align) {
|
|
129
|
+
case "start":
|
|
130
|
+
return 0;
|
|
131
|
+
case "end":
|
|
132
|
+
return targetExtent - popupExtent;
|
|
133
|
+
default:
|
|
134
|
+
return (targetExtent - popupExtent) / 2;
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
// horizontal offset
|
|
138
|
+
switch (direction) {
|
|
139
|
+
case "top":
|
|
140
|
+
case "bottom":
|
|
141
|
+
// horizontal is the CROSS axis here → align applies
|
|
142
|
+
left = computeCrossAxisOffset(targetRect.width, popupRect.width);
|
|
143
|
+
break;
|
|
144
|
+
case "right":
|
|
145
|
+
left = targetRect.width;
|
|
146
|
+
break;
|
|
147
|
+
case "left":
|
|
148
|
+
left = -(popupRect.width + distance);
|
|
149
|
+
break;
|
|
150
|
+
}
|
|
151
|
+
// vertical offset
|
|
152
|
+
switch (direction) {
|
|
153
|
+
case "top":
|
|
154
|
+
top = -(popupRect.height + distance);
|
|
155
|
+
break;
|
|
156
|
+
case "bottom":
|
|
157
|
+
top = targetRect.height;
|
|
158
|
+
break;
|
|
159
|
+
case "right":
|
|
160
|
+
case "left":
|
|
161
|
+
// vertical is the CROSS axis here → align applies
|
|
162
|
+
top = computeCrossAxisOffset(targetRect.height, popupRect.height);
|
|
163
|
+
break;
|
|
164
|
+
}
|
|
165
|
+
return { left, top };
|
|
166
|
+
};
|
|
167
|
+
/**
|
|
168
|
+
* Check if the popup fits within the bounds.
|
|
169
|
+
* @param candidatePosition The absolute position of the popup
|
|
170
|
+
* @param popupRect The bounding client rect of the popup element.
|
|
171
|
+
* @param bounds The usable bounds of the window.
|
|
172
|
+
* @returns Whether the popup fits within the window.
|
|
173
|
+
*/
|
|
174
|
+
const fitsInWindow = (candidatePosition, popupRect, bounds) => {
|
|
175
|
+
// Absolute position of the popup's vertices, relative to the viewport
|
|
176
|
+
const vertices = {
|
|
177
|
+
top: candidatePosition.top,
|
|
178
|
+
right: candidatePosition.left + popupRect.width,
|
|
179
|
+
bottom: candidatePosition.top + popupRect.height,
|
|
180
|
+
left: candidatePosition.left,
|
|
181
|
+
};
|
|
182
|
+
return (vertices.top >= bounds.top &&
|
|
183
|
+
vertices.right <= bounds.right &&
|
|
184
|
+
vertices.bottom <= bounds.bottom &&
|
|
185
|
+
vertices.left >= bounds.left);
|
|
186
|
+
};
|
|
187
|
+
/**
|
|
188
|
+
* Find the best position for the popup based on the preferred directions.
|
|
189
|
+
* @param targetRect The bounding client rect of the target element.
|
|
190
|
+
* @param popupRect The bounding client rect of the popup element.
|
|
191
|
+
* @param placements The physical placements to try, in order.
|
|
192
|
+
* @param options The distance, the usable bounds, and whether to auto-fit.
|
|
193
|
+
* @returns The best absolute position for the popup.
|
|
194
|
+
* @throws When `placements` is empty.
|
|
195
|
+
*/
|
|
196
|
+
export const findBestPosition = (targetRect, popupRect, placements, { distance, bounds, autoFit, }) => {
|
|
197
|
+
const [firstPlacement, ...otherPlacements] = placements;
|
|
198
|
+
if (!firstPlacement) {
|
|
199
|
+
throw new Error("Preferred directions must not be empty.");
|
|
200
|
+
}
|
|
201
|
+
/** Resolve one placement into a candidate position. */
|
|
202
|
+
const evaluate = ({ direction, align }) => {
|
|
203
|
+
const relativePosition = calculateRelativePosition(direction, align, targetRect, popupRect, distance);
|
|
204
|
+
// The natural (unclamped) placement for this side.
|
|
205
|
+
const naturalPosition = {
|
|
206
|
+
top: targetRect.top + relativePosition.top,
|
|
207
|
+
left: targetRect.left + relativePosition.left,
|
|
208
|
+
};
|
|
209
|
+
// Whether this side fits WITHOUT auto-fit clamping. This must be tested
|
|
210
|
+
// on the natural position — testing a clamped position would always
|
|
211
|
+
// report `fits: true`, so the search would keep the first placement and
|
|
212
|
+
// never flip to a side that actually has room.
|
|
213
|
+
if (fitsInWindow(naturalPosition, popupRect, bounds)) {
|
|
214
|
+
return {
|
|
215
|
+
positionName: direction,
|
|
216
|
+
align,
|
|
217
|
+
position: naturalPosition,
|
|
218
|
+
fits: true,
|
|
219
|
+
autoFitOffset: { top: 0, left: 0 },
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
// Auto-fit produces a clamped variant (nudged back into bounds) used
|
|
223
|
+
// only as the fallback when no side fits naturally.
|
|
224
|
+
const absolutePosition = { ...naturalPosition };
|
|
225
|
+
const autoFitOffset = { top: 0, left: 0 };
|
|
226
|
+
if (autoFit) {
|
|
227
|
+
if (absolutePosition.top < bounds.top) {
|
|
228
|
+
autoFitOffset.top = bounds.top - absolutePosition.top;
|
|
229
|
+
absolutePosition.top = bounds.top;
|
|
230
|
+
}
|
|
231
|
+
else if (absolutePosition.top + popupRect.height > bounds.bottom) {
|
|
232
|
+
autoFitOffset.top =
|
|
233
|
+
bounds.bottom - (absolutePosition.top + popupRect.height);
|
|
234
|
+
absolutePosition.top = bounds.bottom - popupRect.height;
|
|
235
|
+
}
|
|
236
|
+
if (absolutePosition.left < bounds.left) {
|
|
237
|
+
autoFitOffset.left = -1 * (bounds.left - absolutePosition.left);
|
|
238
|
+
absolutePosition.left = bounds.left;
|
|
239
|
+
}
|
|
240
|
+
else if (absolutePosition.left + popupRect.width > bounds.right) {
|
|
241
|
+
autoFitOffset.left =
|
|
242
|
+
-1 * (bounds.right - (absolutePosition.left + popupRect.width));
|
|
243
|
+
absolutePosition.left = bounds.right - popupRect.width;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
return {
|
|
247
|
+
positionName: direction,
|
|
248
|
+
align,
|
|
249
|
+
position: absolutePosition,
|
|
250
|
+
fits: false,
|
|
251
|
+
autoFitOffset,
|
|
252
|
+
};
|
|
253
|
+
};
|
|
254
|
+
/** The total distance auto-fit moved a candidate to keep it in bounds. */
|
|
255
|
+
const clampCost = ({ autoFitOffset }) => Math.abs(autoFitOffset.top) + Math.abs(autoFitOffset.left);
|
|
256
|
+
// The first side that naturally fits wins, at its exact position. Until one
|
|
257
|
+
// does, keep the LEAST-clamped candidate (smallest total auto-fit offset),
|
|
258
|
+
// the earlier one on a tie: the placement that overflows the viewport least
|
|
259
|
+
// sits closest to its ideal spot.
|
|
260
|
+
let best = evaluate(firstPlacement);
|
|
261
|
+
for (const placement of otherPlacements) {
|
|
262
|
+
if (best.fits)
|
|
263
|
+
break;
|
|
264
|
+
const candidate = evaluate(placement);
|
|
265
|
+
if (candidate.fits || clampCost(candidate) < clampCost(best)) {
|
|
266
|
+
best = candidate;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
return best;
|
|
270
|
+
};
|
|
105
271
|
const useIsomorphicLayoutEffect = typeof window === "undefined" ? useEffect : useLayoutEffect;
|
|
106
272
|
const DEFAULT_PREFERRED_DIRECTIONS = ["block-start", "block-end", "inline-start", "inline-end"];
|
|
107
273
|
const useWindowFitment = ({ preferredDirections = DEFAULT_PREFERRED_DIRECTIONS, distance = "0px", gutter = "0px", maxWidth = "350px", resizeDelay = 150, scrollDelay = 150, isOpen, onBestPositionChange, autoFit = false, direction: directionProp, }) => {
|
|
@@ -151,182 +317,13 @@ const useWindowFitment = ({ preferredDirections = DEFAULT_PREFERRED_DIRECTIONS,
|
|
|
151
317
|
bottom: windowDimensions.windowHeight - bottomGutter,
|
|
152
318
|
};
|
|
153
319
|
}, [gutter, windowDimensions, isServer]);
|
|
154
|
-
/**
|
|
155
|
-
* Calculate the relative position of the popup when oriented in a given direction.
|
|
156
|
-
* @param direction The side of the target element to position the popup on.
|
|
157
|
-
* @param targetRect The bounding client rect of the target element.
|
|
158
|
-
* @param popupRect The bounding client rect of the popup element.
|
|
159
|
-
* @returns The calculated relative position of the popup.
|
|
160
|
-
*/
|
|
161
|
-
const calculateRelativePosition = useCallback((direction, align, targetRect, popupRect) => {
|
|
162
|
-
let left = 0;
|
|
163
|
-
let top = 0;
|
|
164
|
-
if (isServer) {
|
|
165
|
-
return {
|
|
166
|
-
left,
|
|
167
|
-
top,
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
/*
|
|
171
|
-
We use left and top offsets to position the popup relative to the target element.
|
|
172
|
-
Then, we apply a margin on the opposite side of the popup to create a buffer zone between the target and the popup, to prevent a mouseleave event when moving from the target to the popup.
|
|
173
|
-
The fake margin is already included in `targetRect` dimensions, as it is rendered hidden at least once before the popup is shown.
|
|
174
|
-
In cases where `targetRect` is not included in the calculation, we add `distanceAsPixelsNumber` to account for the fake margin.
|
|
175
|
-
*/
|
|
176
|
-
// Cross-axis offset along a side's cross-axis:
|
|
177
|
-
// start → target's leading edge (offset 0)
|
|
178
|
-
// end → target's trailing edge
|
|
179
|
-
// center → centred (legacy; identical to the pre-align formula)
|
|
180
|
-
const crossAxisOffset = (targetExtent, popupExtent) => {
|
|
181
|
-
switch (align) {
|
|
182
|
-
case "start":
|
|
183
|
-
return 0;
|
|
184
|
-
case "end":
|
|
185
|
-
return targetExtent - popupExtent;
|
|
186
|
-
default:
|
|
187
|
-
return (targetExtent - popupExtent) / 2;
|
|
188
|
-
}
|
|
189
|
-
};
|
|
190
|
-
// horizontal offset
|
|
191
|
-
switch (direction) {
|
|
192
|
-
case "top":
|
|
193
|
-
case "bottom":
|
|
194
|
-
// horizontal is the CROSS axis here → align applies
|
|
195
|
-
left = crossAxisOffset(targetRect.width, popupRect.width);
|
|
196
|
-
break;
|
|
197
|
-
case "right":
|
|
198
|
-
left = targetRect.width;
|
|
199
|
-
break;
|
|
200
|
-
case "left":
|
|
201
|
-
left = -(popupRect.width + distanceAsPixelsNumber);
|
|
202
|
-
break;
|
|
203
|
-
}
|
|
204
|
-
// vertical offset
|
|
205
|
-
switch (direction) {
|
|
206
|
-
case "top":
|
|
207
|
-
top = -(popupRect.height + distanceAsPixelsNumber);
|
|
208
|
-
break;
|
|
209
|
-
case "bottom":
|
|
210
|
-
top = targetRect.height;
|
|
211
|
-
break;
|
|
212
|
-
case "right":
|
|
213
|
-
case "left":
|
|
214
|
-
// vertical is the CROSS axis here → align applies
|
|
215
|
-
top = crossAxisOffset(targetRect.height, popupRect.height);
|
|
216
|
-
break;
|
|
217
|
-
}
|
|
218
|
-
return { left, top };
|
|
219
|
-
}, [distanceAsPixelsNumber, isServer]);
|
|
220
|
-
/**
|
|
221
|
-
* Check if the popup fits within the window. Accounts for `gutter` prop.
|
|
222
|
-
* @param candidatePosition The absolute position of the popup
|
|
223
|
-
* @param popupRect The bounding client rect of the popup element.
|
|
224
|
-
* @returns Whether the popup fits within the window.
|
|
225
|
-
*/
|
|
226
|
-
const fitsInWindow = useCallback((candidatePosition, popupRect) => {
|
|
227
|
-
if (isServer || !bounds)
|
|
228
|
-
return false;
|
|
229
|
-
// Absolute position of the popup's vertices, relative to the viewport
|
|
230
|
-
const vertices = {
|
|
231
|
-
top: candidatePosition.top,
|
|
232
|
-
right: candidatePosition.left + popupRect.width,
|
|
233
|
-
bottom: candidatePosition.top + popupRect.height,
|
|
234
|
-
left: candidatePosition.left,
|
|
235
|
-
};
|
|
236
|
-
return (vertices.top >= bounds.top &&
|
|
237
|
-
vertices.right <= bounds.right &&
|
|
238
|
-
vertices.bottom <= bounds.bottom &&
|
|
239
|
-
vertices.left >= bounds.left);
|
|
240
|
-
}, [bounds, isServer]);
|
|
241
|
-
/**
|
|
242
|
-
* Find the best position for the popup based on the preferred directions.
|
|
243
|
-
* @param targetRect The bounding client rect of the target element.
|
|
244
|
-
* @param popupRect The bounding client rect of the popup element.
|
|
245
|
-
* @returns The best absolute position for the popup.
|
|
246
|
-
*/
|
|
247
|
-
const findBestPosition = useCallback((targetRect, popupRect, placements) => {
|
|
248
|
-
if (isServer)
|
|
249
|
-
return;
|
|
250
|
-
let fallbackPosition;
|
|
251
|
-
let fallbackScore = Number.POSITIVE_INFINITY;
|
|
252
|
-
if (!placements.length) {
|
|
253
|
-
throw new Error("Preferred directions must not be empty.");
|
|
254
|
-
}
|
|
255
|
-
for (const { direction, align } of placements) {
|
|
256
|
-
const relativePosition = calculateRelativePosition(direction, align, targetRect, popupRect);
|
|
257
|
-
// The natural (unclamped) placement for this side.
|
|
258
|
-
const naturalPosition = {
|
|
259
|
-
top: targetRect.top + relativePosition.top,
|
|
260
|
-
left: targetRect.left + relativePosition.left,
|
|
261
|
-
};
|
|
262
|
-
// Whether this side fits WITHOUT auto-fit clamping. This must be tested
|
|
263
|
-
// on the natural position — testing a clamped position would always
|
|
264
|
-
// report `fits: true`, so the loop would return the first placement and
|
|
265
|
-
// never flip to a side that actually has room.
|
|
266
|
-
const naturallyFits = fitsInWindow(naturalPosition, popupRect);
|
|
267
|
-
// Auto-fit produces a clamped variant (nudged back into bounds) used
|
|
268
|
-
// only as the fallback when no side fits naturally.
|
|
269
|
-
const absolutePosition = { ...naturalPosition };
|
|
270
|
-
const autoFitOffset = { top: 0, left: 0 };
|
|
271
|
-
if (autoFit && bounds) {
|
|
272
|
-
if (absolutePosition.top < bounds.top) {
|
|
273
|
-
autoFitOffset.top = bounds.top - absolutePosition.top;
|
|
274
|
-
absolutePosition.top = bounds.top;
|
|
275
|
-
}
|
|
276
|
-
else if (absolutePosition.top + popupRect.height > bounds.bottom) {
|
|
277
|
-
autoFitOffset.top =
|
|
278
|
-
bounds.bottom - (absolutePosition.top + popupRect.height);
|
|
279
|
-
absolutePosition.top = bounds.bottom - popupRect.height;
|
|
280
|
-
}
|
|
281
|
-
if (absolutePosition.left < bounds.left) {
|
|
282
|
-
autoFitOffset.left = -1 * (bounds.left - absolutePosition.left);
|
|
283
|
-
absolutePosition.left = bounds.left;
|
|
284
|
-
}
|
|
285
|
-
else if (absolutePosition.left + popupRect.width > bounds.right) {
|
|
286
|
-
autoFitOffset.left =
|
|
287
|
-
-1 * (bounds.right - (absolutePosition.left + popupRect.width));
|
|
288
|
-
absolutePosition.left = bounds.right - popupRect.width;
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
// A side that naturally fits wins immediately, at its exact position.
|
|
292
|
-
if (naturallyFits) {
|
|
293
|
-
return {
|
|
294
|
-
positionName: direction,
|
|
295
|
-
align,
|
|
296
|
-
position: naturalPosition,
|
|
297
|
-
fits: true,
|
|
298
|
-
autoFitOffset: { top: 0, left: 0 },
|
|
299
|
-
};
|
|
300
|
-
}
|
|
301
|
-
// No side fits naturally → this placement is a fallback candidate. Keep
|
|
302
|
-
// the LEAST-clamped one (smallest total auto-fit offset) rather than
|
|
303
|
-
// always taking the first: the placement that overflows the viewport
|
|
304
|
-
// least sits closest to its ideal spot. (Note: this is the only useful
|
|
305
|
-
// per-candidate signal here — the popup's own dimensions are the same for
|
|
306
|
-
// every candidate in one pass, so a wide-vs-tall metric would be constant
|
|
307
|
-
// and cannot break ties.)
|
|
308
|
-
const candidate = {
|
|
309
|
-
positionName: direction,
|
|
310
|
-
align,
|
|
311
|
-
position: absolutePosition,
|
|
312
|
-
fits: false,
|
|
313
|
-
autoFitOffset,
|
|
314
|
-
};
|
|
315
|
-
const clampCost = Math.abs(candidate.autoFitOffset.top) +
|
|
316
|
-
Math.abs(candidate.autoFitOffset.left);
|
|
317
|
-
if (!fallbackPosition || clampCost < fallbackScore) {
|
|
318
|
-
fallbackPosition = candidate;
|
|
319
|
-
fallbackScore = clampCost;
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
return fallbackPosition;
|
|
323
|
-
}, [calculateRelativePosition, fitsInWindow, isServer, autoFit, bounds]);
|
|
324
320
|
/** Normalise the mixed side/placement list once (bare side → centred). */
|
|
325
321
|
const placements = useMemo(() => preferredDirections.map(toPlacement), [preferredDirections]);
|
|
326
322
|
/** The best possible position for the popup. */
|
|
327
323
|
// biome-ignore lint/correctness/useExhaustiveDependencies: dirVersion and isOpen are deliberate re-resolution triggers — the memo reads document.documentElement.dir and live DOM rects (not tracked by React).
|
|
328
324
|
const bestPosition = useMemo(() => {
|
|
329
325
|
if (!isServer &&
|
|
326
|
+
bounds &&
|
|
330
327
|
targetElement &&
|
|
331
328
|
popupElement &&
|
|
332
329
|
windowDimensions &&
|
|
@@ -339,11 +336,13 @@ const useWindowFitment = ({ preferredDirections = DEFAULT_PREFERRED_DIRECTIONS,
|
|
|
339
336
|
// isOpen), and on an <html dir> flip (dirVersion, from the observer below).
|
|
340
337
|
const dir = directionProp ?? readHtmlDirection();
|
|
341
338
|
const physical = placements.map((p) => resolveLogicalPlacement(p, dir));
|
|
342
|
-
return findBestPosition(targetElement.getBoundingClientRect(), popupElement.getBoundingClientRect(), physical);
|
|
339
|
+
return findBestPosition(targetElement.getBoundingClientRect(), popupElement.getBoundingClientRect(), physical, { distance: distanceAsPixelsNumber, bounds, autoFit });
|
|
343
340
|
}
|
|
344
341
|
}, [
|
|
345
|
-
findBestPosition,
|
|
346
342
|
placements,
|
|
343
|
+
distanceAsPixelsNumber,
|
|
344
|
+
bounds,
|
|
345
|
+
autoFit,
|
|
347
346
|
windowDimensions,
|
|
348
347
|
popupSize,
|
|
349
348
|
targetSize,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWindowFitment.js","sourceRoot":"","sources":["../../../../../src/lib/hooks/useWindowFitment/useWindowFitment.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,WAAW,EACX,SAAS,EACT,eAAe,EACf,OAAO,EACP,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAmBtE,+EAA+E;AAC/E,MAAM,CAAC,MAAM,WAAW,GAAG,CACzB,KAAiD,EACzB,EAAE,CAC1B,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;AAEvE;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,SAAiC,EACjC,GAAkB,EACC,EAAE;IACrB,IAAI,SAAiC,CAAC;IACtC,0EAA0E;IAC1E,yCAAyC;IACzC,IAAI,iBAA0B,CAAC;IAC/B,QAAQ,SAAS,CAAC,IAAI,EAAE,CAAC;QACvB,KAAK,cAAc;YACjB,SAAS,GAAG,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;YAC7C,iBAAiB,GAAG,KAAK,CAAC;YAC1B,MAAM;QACR,KAAK,YAAY;YACf,SAAS,GAAG,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;YAC7C,iBAAiB,GA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R,IAAI,GAAG,QAAQ,CAAC;gBAChB,MAAM;YACR,KAAK,QAAQ;gBACX,IAAI,GAAG,KAAK,CAAC;gBACb,MAAM;YACR,KAAK,MAAM;gBACT,IAAI,GAAG,OAAO,CAAC;gBACf,MAAM;YACR,KAAK,OAAO;gBACV,IAAI,GAAG,MAAM,CAAC;gBACd,MAAM;QACV,CAAC;QACD,OAAO;YACL,CAAC,SAAS,IAAI,EAAE,CAAC,EAAE,GAAG,sBAAsB,IAAI;SACjD,CAAC;IACJ,CAAC,EAAE,CAAC,YAAY,EAAE,sBAAsB,CAAC,CAAC,CAAC;IAE3C,2DAA2D;IAC3D,MAAM,kBAAkB,GAAkB,OAAO,CAC/C,GAAG,EAAE,CAAC,CAAC;QACL,QAAQ,EAAE,QAAQ;QAClB,GAAG,EAAE,YAAY,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;QACrC,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,IAAI,IAAI,CAAC;QACvC,uGAAuG;QACvG,GAAG,UAAU;KACd,CAAC,EACF,CAAC,YAAY,EAAE,QAAQ,EAAE,UAAU,CAAC,CACrC,CAAC;IAEF,8EAA8E;IAC9E,4EAA4E;IAC5E,kEAAkE;IAClE,iKAAiK;IACjK,MAAM,SAAS,GAAG,OAAO,CACvB,GAAG,EAAE,CAAC,aAAa,IAAI,iBAAiB,EAAE,EAC1C,CAAC,aAAa,EAAE,UAAU,CAAC,CAC5B,CAAC;IAEF,OAAO;QACL,SAAS;QACT,QAAQ;QACR,YAAY;QACZ,kBAAkB;QAClB,WAAW;QACX,SAAS;KACV,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"useWindowFitment.js","sourceRoot":"","sources":["../../../../../src/lib/hooks/useWindowFitment/useWindowFitment.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,SAAS,EACT,eAAe,EACf,OAAO,EACP,MAAM,EACN,QAAQ,GACT,MAAM,OAA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AAQ;QAClB,GAAG,EAAE,YAAY,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;QACrC,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,IAAI,IAAI,CAAC;QACvC,uGAAuG;QACvG,GAAG,UAAU;KACd,CAAC,EACF,CAAC,YAAY,EAAE,QAAQ,EAAE,UAAU,CAAC,CACrC,CAAC;IAEF,8EAA8E;IAC9E,4EAA4E;IAC5E,kEAAkE;IAClE,iKAAiK;IACjK,MAAM,SAAS,GAAG,OAAO,CACvB,GAAG,EAAE,CAAC,aAAa,IAAI,iBAAiB,EAAE,EAC1C,CAAC,aAAa,EAAE,UAAU,CAAC,CAC5B,CAAC;IAEF,OAAO;QACL,SAAS;QACT,QAAQ;QACR,YAAY;QACZ,kBAAkB;QAClB,WAAW;QACX,SAAS;KACV,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -5,10 +5,8 @@
|
|
|
5
5
|
* Modal.Content styles
|
|
6
6
|
* @implements ds:global.subcomponent.modal-content
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* - layout.overflow: scroll -> overflow: auto (scrollbars only when needed)
|
|
11
|
-
* - spacing.internal: spacing/large -> padding-block / padding-inline
|
|
8
|
+
* Takes the space the header and footer leave and scrolls, with scrollbars
|
|
9
|
+
* only when needed.
|
|
12
10
|
*/
|
|
13
11
|
|
|
14
12
|
/* Component tokens — sourced from @canonical/design-tokens */
|
|
@@ -18,14 +16,13 @@
|
|
|
18
16
|
}
|
|
19
17
|
|
|
20
18
|
.ds.modal-content {
|
|
21
|
-
/*
|
|
19
|
+
/* Takes the space the header and footer leave. */
|
|
22
20
|
flex: 1 1 auto;
|
|
23
21
|
/*
|
|
24
22
|
A flex item's automatic minimum size is its content, which would push the
|
|
25
23
|
dialog past its max-block-size instead of scrolling. Zero lets it shrink.
|
|
26
24
|
*/
|
|
27
25
|
min-block-size: 0;
|
|
28
|
-
/* layout.overflow: scroll */
|
|
29
26
|
overflow: auto;
|
|
30
27
|
/*
|
|
31
28
|
The inline padding is shared with the header and footer so the content aligns
|
|
@@ -5,14 +5,9 @@
|
|
|
5
5
|
* Modal.Header styles
|
|
6
6
|
* @implements ds:global.subcomponent.modal-header
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* - layout.justify: space-between -> justify-content: space-between
|
|
12
|
-
* - spacing.internal: spacing/medium -> padding-block / padding-inline
|
|
13
|
-
* - appearance.border.bottom: border/style/divider -> an inset ::after rule,
|
|
14
|
-
* not a border (a border would span the full dialog width; the design insets
|
|
15
|
-
* the rule to the inline padding)
|
|
8
|
+
* A centred row with its items spread to both ends. The divider below it is
|
|
9
|
+
* an inset ::after rule, not a border: a border would span the full dialog
|
|
10
|
+
* width, and the rule stops at the inline padding.
|
|
16
11
|
*/
|
|
17
12
|
|
|
18
13
|
:root {
|
|
@@ -54,7 +49,6 @@
|
|
|
54
49
|
)
|
|
55
50
|
);
|
|
56
51
|
|
|
57
|
-
/* layout.type: flow, direction horizontal, align center, justify space-between */
|
|
58
52
|
display: flex;
|
|
59
53
|
flex-direction: row;
|
|
60
54
|
align-items: center;
|
|
@@ -5,22 +5,18 @@
|
|
|
5
5
|
* Modal styles
|
|
6
6
|
* @implements ds:global.pattern.modal
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* - layout.type: stack, direction vertical -> display: flex; flex-direction: column
|
|
12
|
-
* - layout.overflow: hidden -> overflow: hidden
|
|
13
|
-
* - appearance.background: color/surface/overlay -> --surface-color-background,
|
|
14
|
-
* supplied by the `.modal` surface class in @canonical/design-tokens'
|
|
15
|
-
* modifiers.surfaces.css. That class is matched by this component's own
|
|
16
|
-
* `ds modal` className, so renaming the component class would silently drop
|
|
17
|
-
* the surface reset and the modal would inherit the page's layer depth.
|
|
8
|
+
* The backdrop is the native top layer's ::backdrop, with no DOM node of its
|
|
9
|
+
* own. The <dialog> itself is a vertical stack that clips its overflow, with
|
|
10
|
+
* a bounded inline and block size and its own radius.
|
|
18
11
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
12
|
+
* Its background is --surface-color-background, supplied by the `.modal`
|
|
13
|
+
* surface class in @canonical/design-tokens' modifiers.surfaces.css. That
|
|
14
|
+
* class is matched by this component's own `ds modal` className, so renaming
|
|
15
|
+
* the component class would silently drop the surface reset and the modal
|
|
16
|
+
* would inherit the page's layer depth.
|
|
17
|
+
*
|
|
18
|
+
* There is no shadow token at design-tokens 0.8.1 and the panel has no
|
|
19
|
+
* outline, so the overlay alone separates the modal from the page.
|
|
24
20
|
*/
|
|
25
21
|
|
|
26
22
|
/* Component tokens — sourced from @canonical/design-tokens */
|
|
@@ -66,7 +62,7 @@
|
|
|
66
62
|
landing on the dialog box itself can only be a backdrop click.
|
|
67
63
|
*/
|
|
68
64
|
padding: 0;
|
|
69
|
-
/*
|
|
65
|
+
/* The content pane is the only scroller. */
|
|
70
66
|
overflow: hidden;
|
|
71
67
|
|
|
72
68
|
inline-size: var(--modal-inline-size);
|
|
@@ -77,8 +73,7 @@
|
|
|
77
73
|
Read the surface channels on the element itself. The token layer defines a
|
|
78
74
|
`.modal` surface (identical to top-level `.surface`), matched by this
|
|
79
75
|
component's own `ds modal` className, so the dialog paints at base surface
|
|
80
|
-
depth even when opened from a nested `.surface
|
|
81
|
-
`color/surface/overlay`.
|
|
76
|
+
depth even when opened from a nested `.surface`.
|
|
82
77
|
|
|
83
78
|
The background channel is always emitted on the `.modal` surface, so it is
|
|
84
79
|
read bare. The text channel is different: the surface family emits
|
|
@@ -105,12 +100,11 @@
|
|
|
105
100
|
visible, so the stack layout is scoped to the open state.
|
|
106
101
|
*/
|
|
107
102
|
&[open] {
|
|
108
|
-
/* layout.type: stack, layout.direction: vertical */
|
|
109
103
|
display: flex;
|
|
110
104
|
flex-direction: column;
|
|
111
105
|
}
|
|
112
106
|
|
|
113
|
-
/*
|
|
107
|
+
/* The backdrop mutes the page while the modal is active. */
|
|
114
108
|
&::backdrop {
|
|
115
109
|
background-color: var(--modal-color-backdrop);
|
|
116
110
|
backdrop-filter: blur(var(--modal-backdrop-blur));
|
|
@@ -5,12 +5,9 @@
|
|
|
5
5
|
* Timeline.Content styles
|
|
6
6
|
* @implements ds:global.subcomponent.timeline-content
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
* - layout.type: stack -> display: flex; flex-direction: column
|
|
10
|
-
* - layout.direction: vertical -> flex-direction: column
|
|
8
|
+
* Stacks the events vertically, in order.
|
|
11
9
|
*/
|
|
12
10
|
.ds.timeline-content {
|
|
13
|
-
/* layout.type: stack, layout.direction: vertical */
|
|
14
11
|
display: flex;
|
|
15
12
|
flex-direction: column;
|
|
16
13
|
}
|
|
@@ -5,12 +5,9 @@
|
|
|
5
5
|
* Timeline.Event styles
|
|
6
6
|
* @implements ds:global.subcomponent.timeline-event
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
* - layout.type: flow -> display: flex
|
|
10
|
-
* - layout.direction: horizontal -> flex-direction: row
|
|
8
|
+
* Places the marker beside the event content.
|
|
11
9
|
*/
|
|
12
10
|
.ds.timeline-event {
|
|
13
|
-
/* layout.type: flow, layout.direction: horizontal */
|
|
14
11
|
display: flex;
|
|
15
12
|
flex-direction: row;
|
|
16
13
|
gap: var(--timeline-event-gap, var(--spacing-medium, 1rem));
|
|
@@ -68,15 +65,14 @@
|
|
|
68
65
|
|
|
69
66
|
/**
|
|
70
67
|
* Event content container
|
|
71
|
-
*
|
|
72
|
-
* The edges (actor, datetime, payload) flow horizontally per DSL spec
|
|
68
|
+
* The actor, datetime and payload flow horizontally, in that order.
|
|
73
69
|
*/
|
|
74
70
|
.ds.timeline-event > .content {
|
|
75
71
|
flex: 1;
|
|
76
72
|
min-width: 0;
|
|
77
73
|
padding-bottom: var(--timeline-event-spacing, var(--spacing-large, 1.5rem));
|
|
78
74
|
|
|
79
|
-
/*
|
|
75
|
+
/* Actor, then datetime, then payload */
|
|
80
76
|
display: flex;
|
|
81
77
|
flex-direction: row;
|
|
82
78
|
flex-wrap: wrap;
|
|
@@ -85,8 +81,7 @@
|
|
|
85
81
|
}
|
|
86
82
|
|
|
87
83
|
/**
|
|
88
|
-
* Actor element
|
|
89
|
-
* DSL: role: actor (cardinality: 0..1)
|
|
84
|
+
* Actor element, optional
|
|
90
85
|
*/
|
|
91
86
|
.ds.timeline-event > .content > .actor {
|
|
92
87
|
font-weight: var(
|
|
@@ -97,8 +92,7 @@
|
|
|
97
92
|
}
|
|
98
93
|
|
|
99
94
|
/**
|
|
100
|
-
* Datetime element
|
|
101
|
-
* DSL: role: datetime (cardinality: 0..1)
|
|
95
|
+
* Datetime element, optional
|
|
102
96
|
*/
|
|
103
97
|
.ds.timeline-event > .content > .datetime {
|
|
104
98
|
font-size: var(
|
|
@@ -109,8 +103,7 @@
|
|
|
109
103
|
}
|
|
110
104
|
|
|
111
105
|
/**
|
|
112
|
-
* Payload element
|
|
113
|
-
* DSL: role: payload (cardinality: 1, slotName: default)
|
|
106
|
+
* Payload element, always present: the event's children
|
|
114
107
|
*/
|
|
115
108
|
.ds.timeline-event > .content > .payload {
|
|
116
109
|
color: var(--timeline-payload-color, var(--color-text-primary, inherit));
|
|
@@ -5,12 +5,9 @@
|
|
|
5
5
|
* Timeline styles
|
|
6
6
|
* @implements ds:global.pattern.timeline
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
* - layout.type: stack -> display: flex; flex-direction: column
|
|
10
|
-
* - layout.direction: vertical -> flex-direction: column
|
|
8
|
+
* Stacks its content vertically.
|
|
11
9
|
*/
|
|
12
10
|
.ds.timeline {
|
|
13
|
-
/* layout.type: stack, layout.direction: vertical */
|
|
14
11
|
display: flex;
|
|
15
12
|
flex-direction: column;
|
|
16
13
|
}
|