@speles7172/controls 0.4.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,314 @@
1
+ import { useCallback, useLayoutEffect, useRef } from 'react';
2
+ /**
3
+ * The gap between the anchor and the popover.
4
+ *
5
+ * In script rather than in the stylesheet because the placement arithmetic
6
+ * needs the number: a value only CSS knew would have to be read back off the
7
+ * element, and a `margin-top` under a flipped popover pushes it the wrong way.
8
+ */
9
+ const GAP = 4;
10
+ /** How close to a viewport edge the popover is allowed to come. */
11
+ const MARGIN = 8;
12
+ /**
13
+ * The height the popover is given even where there is no room for it.
14
+ *
15
+ * A viewport shorter than this is a phone in landscape with a keyboard up, and
16
+ * there the choice is between a popover that overhangs the edge by a few pixels
17
+ * and one with no visible options at all.
18
+ */
19
+ const MIN_HEIGHT = 120;
20
+ /**
21
+ * Pin a popover to its anchor, in viewport coordinates.
22
+ *
23
+ * `.ctl-popover` was `position: absolute; top: 100%` against the control, which
24
+ * is the obvious way to write it and is wrong in the one place these controls
25
+ * are used most: inside a dialog. `<Modal>`'s body is `overflow-y: auto` — it
26
+ * has to be, or a tall dialog scrolls the backdrop and its close button ends up
27
+ * somewhere nobody can reach — so an absolutely positioned popover is part of
28
+ * that box's scrollable content. Opening the folder picker in
29
+ * `config-console`'s editor took the body's `scrollHeight` from 446 to 583
30
+ * against a `clientHeight` of 446: the options were *there*, under the footer,
31
+ * and the operator had to notice a new scrollbar and scroll to them. The same
32
+ * shape clipped `sql-console`'s database picker, and the stylesheet's answer at
33
+ * the time — that the host must stop clipping — is not one a host can take when
34
+ * the clipping ancestor is this package's own dialog.
35
+ *
36
+ * So the popover is `position: fixed` and placed here, from the anchor's own
37
+ * rectangle. Fixed rather than a portal for the reason `<Modal>` gives at
38
+ * length: a console bridges its palette onto `--ctl-*` with a descendant
39
+ * selector, and a portal to `document.body` escapes it, so a dark console would
40
+ * open a light list. Staying in the tree keeps the bridge and steps out of the
41
+ * scroll container at the same time.
42
+ *
43
+ * What it does beyond that:
44
+ *
45
+ * - **Flips up** when the list does not fit below and fits better above. The
46
+ * decision is made against the height the popover actually wants — measured
47
+ * with the cap off — rather than against a threshold, because a threshold
48
+ * gets both ends wrong: a fixed "160px is enough" leaves a full list
49
+ * squeezed into 169px with 475px going spare above it, and raising the
50
+ * number flips a list that was fitting perfectly well.
51
+ * - **Keeps the side it chose** while the list still fits on it. Re-deciding
52
+ * on every content change would make the list jump across the field as
53
+ * somebody types, since a search that matches two options wants a
54
+ * different amount of room from one that matches forty.
55
+ * - **Bounds its height** to the room actually available, so the list scrolls
56
+ * inside the popover rather than the popover overhanging the viewport, and
57
+ * its **width** to a window too narrow for it, since the popover hides its
58
+ * overflow and offers no way to scroll sideways to what is cut off.
59
+ * - **Follows the anchor** while any ancestor scrolls. A fixed element does
60
+ * not move with the box it was measured against, so without this the list
61
+ * detaches from its trigger the moment the dialog body scrolls.
62
+ * - **Places again when the content changes size**, which is what the
63
+ * `ResizeObserver` is for. A control over a transport opens saying
64
+ * "Searching…" and is two lines tall at the moment it is first placed — so
65
+ * a list that will want 300px is measured at 80, drops downwards into
66
+ * whatever was there, and is squeezed into it once the options land. That
67
+ * is the picker this whole hook was written for.
68
+ * - **Hides itself** while the anchor is scrolled out of sight. A fixed
69
+ * popover does not go with its trigger through the top of a dialog body:
70
+ * it stays where it was, over unrelated content, offered as though it
71
+ * belonged to whatever is now under it.
72
+ *
73
+ * The one thing that breaks it is an ancestor with `transform`, `filter` or
74
+ * `will-change`, which makes itself the containing block for fixed
75
+ * descendants — the same caveat `<Modal>` carries, and the fix for it is on the
76
+ * ancestor.
77
+ *
78
+ * Styles are written straight onto the node rather than held in state. Placing
79
+ * needs the size the browser settled on *after* the stylesheet's `min-width`
80
+ * and the list's own `max-height` applied, so the effect has to read the
81
+ * element back after writing to it — a render pass in between would be a second
82
+ * paint at the wrong size, and a `setState` on every scroll event besides.
83
+ *
84
+ * @param open Whether the popover is rendered. Placement stops when it is not.
85
+ * @param anchor The element the popover hangs off, normally the control's root.
86
+ * @returns The ref to put on the popover element.
87
+ */
88
+ export function useAnchoredPopover(open, anchor) {
89
+ const popover = useRef(null);
90
+ /** The side last chosen, or null while the popover has never been placed. */
91
+ const dropUpRef = useRef(null);
92
+ /**
93
+ * The ancestors that cut the anchor off, found once when the popover opens.
94
+ *
95
+ * Cached because finding them means a `getComputedStyle` per ancestor and
96
+ * this runs on every scroll event, and because the answer cannot change while
97
+ * the popover is open: what may change is where those boxes *are*, which is
98
+ * read fresh each time.
99
+ */
100
+ const clipsRef = useRef([]);
101
+ const place = useCallback(() => {
102
+ const element = popover.current;
103
+ const host = anchor.current;
104
+ if (element === null || host === null)
105
+ return;
106
+ const rect = host.getBoundingClientRect();
107
+ const viewportHeight = window.innerHeight;
108
+ const viewportWidth = window.innerWidth;
109
+ if (!inView(rect, clipsRef.current, viewportWidth, viewportHeight)) {
110
+ // `visibility` rather than unmounting: the search term somebody has typed
111
+ // and the page of options behind it both survive a scroll that goes too
112
+ // far and comes back. `pointerEvents` with it, or the invisible list is
113
+ // still what a click over that part of the dialog lands on.
114
+ element.style.visibility = 'hidden';
115
+ element.style.pointerEvents = 'none';
116
+ return;
117
+ }
118
+ element.style.visibility = '';
119
+ element.style.pointerEvents = '';
120
+ // Cleared before anything is measured, so each placement is taken against
121
+ // the popover's own size rather than against the last placement's ceiling —
122
+ // otherwise a popover that once opened into a corner could never open
123
+ // anywhere else.
124
+ element.style.minWidth = '';
125
+ element.style.maxWidth = '';
126
+ element.style.maxHeight = '';
127
+ // Width first, then read back: `min-width` lives in the stylesheet, so the
128
+ // number the browser settles on is the only one the arithmetic below can
129
+ // honestly work from. It has to be settled before the height is measured
130
+ // besides, or a label wrapping at the wrong width answers the wrong
131
+ // question.
132
+ element.style.width = `${rect.width}px`;
133
+ let width = element.offsetWidth;
134
+ const room = viewportWidth - MARGIN * 2;
135
+ if (width > room) {
136
+ // `min-width` beats `max-width` in the cascade, so a window narrower than
137
+ // the stylesheet's minimum has to have that minimum lifted rather than
138
+ // out-argued. Left alone otherwise: the minimum is there so a filter bar
139
+ // laying its fields out with `flex` cannot squash the list to the width
140
+ // of the word "All".
141
+ element.style.minWidth = '0';
142
+ element.style.maxWidth = `${room}px`;
143
+ width = element.offsetWidth;
144
+ }
145
+ // How tall the popover would be with nothing stopping it — which is the
146
+ // list's own `max-height` plus the search box, until the list is shorter
147
+ // than that.
148
+ const wanted = element.offsetHeight;
149
+ const below = viewportHeight - rect.bottom - GAP - MARGIN;
150
+ const above = rect.top - GAP - MARGIN;
151
+ // Sticky while it still fits: a placement is only re-decided when the side
152
+ // it is on has stopped holding the list. Deciding afresh every time would
153
+ // be right in isolation and wrong in use — the list would cross the search
154
+ // box as its own results narrowed under the cursor.
155
+ const settled = dropUpRef.current;
156
+ const dropUp = settled !== null && wanted <= (settled ? above : below)
157
+ ? settled
158
+ : wanted > below && above > below;
159
+ dropUpRef.current = dropUp;
160
+ if (dropUp) {
161
+ // Anchored by its *bottom* edge, so the popover grows upwards as options
162
+ // load. Setting `top` instead would need its height, which is not known
163
+ // until after it has been laid out at the wrong place once.
164
+ element.style.top = '';
165
+ element.style.bottom = `${viewportHeight - rect.top + GAP}px`;
166
+ }
167
+ else {
168
+ element.style.bottom = '';
169
+ element.style.top = `${rect.bottom + GAP}px`;
170
+ }
171
+ element.style.maxHeight = `${Math.max(dropUp ? above : below, MIN_HEIGHT)}px`;
172
+ // A physical `left`, from a physical rectangle, deliberately — this is the
173
+ // one place in these packages where that is right rather than a bug. Client
174
+ // coordinates have no direction: the anchor's own box is already where the
175
+ // page put it, so the same arithmetic sits the popover under the trigger in
176
+ // Hebrew and in English alike. `inset-inline-start` here would mean the
177
+ // measured edge and the styled edge were opposite ones in a right-to-left
178
+ // page.
179
+ const start = Math.min(Math.max(rect.left, MARGIN),
180
+ // `Math.max` again so a popover the window cannot hold even at its
181
+ // narrowest starts at the margin rather than at a negative offset.
182
+ Math.max(viewportWidth - width - MARGIN, MARGIN));
183
+ element.style.left = `${start}px`;
184
+ }, [anchor]);
185
+ useLayoutEffect(() => {
186
+ if (!open) {
187
+ // Nothing is holding a side while the popover is closed, so the next open
188
+ // measures from scratch. Without this the control would remember the
189
+ // corner it was opened in on a page that has since scrolled.
190
+ dropUpRef.current = null;
191
+ return;
192
+ }
193
+ const host = anchor.current;
194
+ clipsRef.current = host === null ? [] : clippingAncestors(host);
195
+ // Before paint, so the popover is never seen at the top-left corner of the
196
+ // viewport on the frame it opens.
197
+ place();
198
+ const onScroll = (event) => {
199
+ // The list inside the popover scrolls too, and a capturing listener on
200
+ // `window` hears that as readily as it hears the dialog body. Re-placing
201
+ // for it is a layout read per wheel notch that can only ever compute the
202
+ // same numbers.
203
+ if (event.target instanceof Node && popover.current?.contains(event.target) === true)
204
+ return;
205
+ place();
206
+ };
207
+ // Capture, because a scroll event does not bubble: without it a scroll of
208
+ // the dialog body — which is the whole reason this hook exists — would
209
+ // never reach a listener on `window`.
210
+ window.addEventListener('scroll', onScroll, true);
211
+ window.addEventListener('resize', place);
212
+ /*
213
+ * And the content's own size, which nothing above would notice.
214
+ *
215
+ * It is what the popover is measured against, and it changes underneath a
216
+ * placement in more ways than a caller could describe: a transport's first
217
+ * page landing, a search narrowing forty options to two, a label long
218
+ * enough to wrap. Asking the element rather than being told keeps all of
219
+ * them, including the ones that leave the option count unchanged.
220
+ *
221
+ * `place()` is a fixed point — the same rectangle and the same content give
222
+ * the same styles — so the writes it makes here settle rather than feed
223
+ * back into another notification.
224
+ *
225
+ * Guarded because jsdom does not implement it, and every consumer of these
226
+ * controls renders them in a jsdom test. There is no layout there for it to
227
+ * report on, so nothing is lost by its absence.
228
+ */
229
+ const resize = typeof ResizeObserver === 'function' && popover.current !== null
230
+ ? new ResizeObserver(() => place())
231
+ : null;
232
+ if (resize !== null && popover.current !== null)
233
+ resize.observe(popover.current);
234
+ return () => {
235
+ window.removeEventListener('scroll', onScroll, true);
236
+ window.removeEventListener('resize', place);
237
+ resize?.disconnect();
238
+ clipsRef.current = [];
239
+ };
240
+ }, [open, place, anchor]);
241
+ return popover;
242
+ }
243
+ /**
244
+ * The values of `overflow` that cut a box off.
245
+ *
246
+ * Named rather than tested as "anything but `visible`", which is the same set
247
+ * in a browser and a different one everywhere else: jsdom reports an unset
248
+ * `overflow` as the empty string, so the negative form makes *every* ancestor a
249
+ * clipping ancestor — and since every rectangle there is zero, their
250
+ * intersection is empty and the popover judges itself permanently scrolled out
251
+ * of sight. That is a control that renders nothing in every consumer's test
252
+ * suite, from a line whose only job is an edge case.
253
+ */
254
+ const CLIPPING = new Set(['auto', 'scroll', 'hidden', 'clip', 'overlay']);
255
+ /**
256
+ * The ancestors that cut a box off.
257
+ *
258
+ * A scroll container is only the most common of them — `hidden` and `clip` cut
259
+ * with no way to scroll to what was cut at all. The walk collects every one
260
+ * rather than stopping at the first, because a dialog body inside a drawer
261
+ * inside a page clips three times and only the intersection is the truth.
262
+ *
263
+ * It does stop at a `position: fixed` ancestor, and that is load-bearing rather
264
+ * than an optimisation. `<Modal>` locks the page by putting `overflow: hidden`
265
+ * on `<body>`, and a page whose only content is a fixed overlay has a `<body>`
266
+ * nought pixels tall — so counting it as a clipping ancestor intersects
267
+ * everything down to an empty box and the popover judges itself permanently
268
+ * scrolled out of sight. It renders nothing, in the exact case this hook exists
269
+ * for. And the reasoning is the same reasoning that makes it wrong: a fixed box
270
+ * is laid out against the viewport, so nothing above it can scroll it away or
271
+ * cut it off.
272
+ */
273
+ function clippingAncestors(host) {
274
+ const found = [];
275
+ // The anchor's own position counts: a control that is itself fixed has no
276
+ // clipping ancestors at all.
277
+ if (getComputedStyle(host).position === 'fixed')
278
+ return found;
279
+ for (let element = host.parentElement; element !== null; element = element.parentElement) {
280
+ const style = getComputedStyle(element);
281
+ if (CLIPPING.has(style.overflowX) || CLIPPING.has(style.overflowY))
282
+ found.push(element);
283
+ if (style.position === 'fixed')
284
+ break;
285
+ }
286
+ return found;
287
+ }
288
+ /**
289
+ * Whether any part of the anchor is still on screen.
290
+ *
291
+ * The viewport intersected with every clipping ancestor, which is what a
292
+ * scrolled-away trigger falls outside of — and the viewport alone is not
293
+ * enough, since the case this exists for is a trigger scrolled through the top
294
+ * of a dialog body while the dialog itself has not moved at all.
295
+ *
296
+ * Inclusive on every edge deliberately: a control flush against the edge of the
297
+ * box holding it is visible, and a zero-sized rectangle — which is every
298
+ * rectangle in jsdom — is treated as present rather than as scrolled away.
299
+ */
300
+ function inView(rect, clips, viewportWidth, viewportHeight) {
301
+ let top = 0;
302
+ let left = 0;
303
+ let right = viewportWidth;
304
+ let bottom = viewportHeight;
305
+ for (const clip of clips) {
306
+ const box = clip.getBoundingClientRect();
307
+ top = Math.max(top, box.top);
308
+ left = Math.max(left, box.left);
309
+ right = Math.min(right, box.right);
310
+ bottom = Math.min(bottom, box.bottom);
311
+ }
312
+ return rect.bottom >= top && rect.top <= bottom && rect.right >= left && rect.left <= right;
313
+ }
314
+ //# sourceMappingURL=useAnchoredPopover.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAnchoredPopover.js","sourceRoot":"","sources":["../src/useAnchoredPopover.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,EAAkB,MAAM,OAAO,CAAC;AAE7E;;;;;;GAMG;AACH,MAAM,GAAG,GAAG,CAAC,CAAC;AAEd,mEAAmE;AACnE,MAAM,MAAM,GAAG,CAAC,CAAC;AAEjB;;;;;;GAMG;AACH,MAAM,UAAU,GAAG,GAAG,CAAC;AAEvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmEG;AACH,MAAM,UAAU,kBAAkB,CAChC,IAAa,EACb,MAAqC;IAErC,MAAM,OAAO,GAAG,MAAM,CAAwB,IAAI,CAAC,CAAC;IACpD,6EAA6E;IAC7E,MAAM,SAAS,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAC/C;;;;;;;OAOG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AK,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;QACnC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;IAED,OAAO,IAAI,CAAC,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,GAAG,IAAI,MAAM,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,IAAI,IAAI,CAAC,IAAI,IAAI,KAAK,CAAC;AAC9F,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@speles7172/controls",
3
- "version": "0.4.0",
4
- "description": "Reusable React building blocks — a data table, searchable selects, a modal, badges and the loading and empty states — over static options or a transport you supply.",
3
+ "version": "0.5.1",
4
+ "description": "Reusable React building blocks — a data table, searchable selects, a date range filter with a Gregorian and Hebrew calendar, a modal, badges and the loading and empty states — over static options or a transport you supply.",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "main": "./dist/index.js",
@@ -33,7 +33,7 @@
33
33
  "prepublishOnly": "npm run build"
34
34
  },
35
35
  "dependencies": {
36
- "@speles7172/controls-client": "^0.1.0",
36
+ "@speles7172/controls-client": "^0.2.0",
37
37
  "lucide-react": "^1.33.0"
38
38
  },
39
39
  "peerDependencies": {