@speles7172/controls 0.4.0 → 0.5.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/index.js CHANGED
@@ -61,12 +61,31 @@ export { EmptyState, Loading, Skeleton, Spinner, TableSkeleton, } from './states
61
61
  */
62
62
  export * from './icons.js';
63
63
  export { ValueInput } from './ValueInput.js';
64
+ export { DateRangeFilter, } from './DateRangeFilter.js';
65
+ export { Calendar } from './Calendar.js';
64
66
  export { KeyValueList, } from './KeyValueList.js';
65
67
  export { useOptionSelect, } from './useOptionSelect.js';
68
+ /**
69
+ * Exported for the same reason {@link useOptionSelect} is: an application with
70
+ * its own design system renders its own popover, and placing one so it is not
71
+ * clipped by whatever scrolls around it is the part that is fiddly rather than
72
+ * decorative.
73
+ */
74
+ export { useAnchoredPopover } from './useAnchoredPopover.js';
66
75
  /**
67
76
  * Re-exported from `@speles7172/controls-client/core` so a frontend that only
68
77
  * renders controls does not need a second dependency to type its options or to
69
78
  * filter a static list.
70
79
  */
71
80
  export { groupOptions, highlightParts, matchOptions, matchRanges, scoreOption, } from '@speles7172/controls-client/core';
81
+ /**
82
+ * The date range vocabulary, re-exported for the same reason.
83
+ *
84
+ * A screen holding a `<DateRangeFilter>` has to be able to *say* what its
85
+ * filter covers — in a heading, in a chip, in the query string it puts in the
86
+ * URL — and every one of those is a function here rather than a second copy of
87
+ * the arithmetic. What resolves the value into two instants deliberately stays
88
+ * one implementation shared with the endpoint; see `resolveDateRange`.
89
+ */
90
+ export { DATE_RANGE_PRESETS, MAX_RELATIVE_AMOUNT, dateRangeFromQuery, daysOfRange, describeDateRange, formatHebrewDate, formatHebrewMonth, hebrewFromCivil, hebrewNumeral, isEmptyDateRange, isRelativeDateRange, isSameDateRange, parseDateRange, presetsFor, resolveDateRange, serializeDateRange, } from '@speles7172/controls-client/core';
72
91
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,OAAO,EACL,qBAAqB,GAEtB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,gBAAgB,EAA8B,MAAM,uBAAuB,CAAC;AAErF,OAAO,EAAE,KAAK,EAAmB,MAAM,YAAY,CAAC;AAEpD,OAAO,EACL,SAAS,EACT,cAAc,GAIf,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,UAAU,EAAwB,MAAM,iBAAiB,CAAC;AAEnE,OAAO,EAAE,OAAO,EAAqB,MAAM,cAAc,CAAC;AAE1D,OAAO,EAAE,IAAI,EAA+B,MAAM,WAAW,CAAC;AAE9D,OAAO,EAAE,IAAI,EAAkB,MAAM,WAAW,CAAC;AAEjD,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,UAAU,EAA0D,MAAM,YAAY,CAAC;AAEpH,OAAO,EAAE,WAAW,EAAyB,MAAM,kBAAkB,CAAC;AAEtE,OAAO,EACL,UAAU,EACV,OAAO,EACP,QAAQ,EACR,OAAO,EACP,aAAa,GAMd,MAAM,aAAa,CAAC;AAErB;;;GAGG;AACH,cAAc,YAAY,CAAC;AAE3B,OAAO,EAAE,UAAU,EAA6C,MAAM,iBAAiB,CAAC;AAExF,OAAO,EACL,YAAY,GAIb,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,eAAe,GAGhB,MAAM,sBAAsB,CAAC;AAE9B;;;;GAIG;AACH,OAAO,EACL,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,WAAW,EACX,WAAW,GACZ,MAAM,kCAAkC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,OAAO,EACL,qBAAqB,GAEtB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,gBAAgB,EAA8B,MAAM,uBAAuB,CAAC;AAErF,OAAO,EAAE,KAAK,EAAmB,MAAM,YAAY,CAAC;AAEpD,OAAO,EACL,SAAS,EACT,cAAc,GAIf,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,UAAU,EAAwB,MAAM,iBAAiB,CAAC;AAEnE,OAAO,EAAE,OAAO,EAAqB,MAAM,cAAc,CAAC;AAE1D,OAAO,EAAE,IAAI,EAA+B,MAAM,WAAW,CAAC;AAE9D,OAAO,EAAE,IAAI,EAAkB,MAAM,WAAW,CAAC;AAEjD,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,UAAU,EAA0D,MAAM,YAAY,CAAC;AAEpH,OAAO,EAAE,WAAW,EAAyB,MAAM,kBAAkB,CAAC;AAEtE,OAAO,EACL,UAAU,EACV,OAAO,EACP,QAAQ,EACR,OAAO,EACP,aAAa,GAMd,MAAM,aAAa,CAAC;AAErB;;;GAGG;AACH,cAAc,YAAY,CAAC;AAE3B,OAAO,EAAE,UAAU,EAA6C,MAAM,iBAAiB,CAAC;AAExF,OAAO,EACL,eAAe,GAGhB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,QAAQ,EAAsB,MAAM,eAAe,CAAC;AAE7D,OAAO,EACL,YAAY,GAIb,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,eAAe,GAGhB,MAAM,sBAAsB,CAAC;AAE9B;;;;;GAKG;AACH,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D;;;;GAIG;AACH,OAAO,EACL,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,WAAW,EACX,WAAW,GACZ,MAAM,kCAAkC,CAAC;AAE1C;;;;;;;;GAQG;AACH,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,UAAU,EACV,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,kCAAkC,CAAC"}
package/dist/styles.css CHANGED
@@ -306,31 +306,46 @@
306
306
  /*
307
307
  * The popover.
308
308
  *
309
- * Absolutely positioned rather than portalled, which keeps the control a single
310
- * self-contained element with no z-index registry to coordinate — at the cost
311
- * of being clipped by an ancestor with `overflow: hidden`. If a host has one,
312
- * the fix is on that ancestor, not here.
309
+ * Fixed rather than absolute, and placed by `useAnchoredPopover` from the
310
+ * control's own rectangle — so `top`, `bottom`, `left`, `width` and
311
+ * `max-height` all arrive as inline styles and are deliberately absent here.
313
312
  *
314
- * This is not theoretical: `sql-console`'s `.sqlc-panel` clipped the database
315
- * picker's list partway down and made it unusable, and no jsdom test could see
316
- * it. A host putting this control inside a panel it clips has to stop clipping.
313
+ * It was `position: absolute; top: 100%`, which is the obvious way to write it
314
+ * and is wrong wherever anything between the control and the page scrolls or
315
+ * clips. `sql-console`'s `.sqlc-panel` clipped the database picker's list
316
+ * partway down; `<Modal>`'s own body — `overflow-y: auto`, because a dialog
317
+ * taller than the screen has to scroll internally — pushed the folder picker's
318
+ * options under the dialog footer, where they could only be reached by noticing
319
+ * a new scrollbar. The advice this comment used to give, that the host must
320
+ * stop clipping, is not advice a host can take when the clipping ancestor is
321
+ * this package's own dialog.
322
+ *
323
+ * Still not portalled: a console bridges its palette onto `--ctl-*` with a
324
+ * descendant selector, and a portal to `document.body` escapes it — so a dark
325
+ * console would open a light list. Fixed positioning leaves the element in the
326
+ * tree and steps out of the scroll container at the same time.
327
+ *
328
+ * `overflow: hidden` pairs with the inline `max-height`: the list scrolls
329
+ * inside, and this is what keeps a footer from spilling past a rounded corner
330
+ * in a window too short for the whole popover.
317
331
  */
318
332
  .ctl-popover {
319
- position: absolute;
320
- top: 100%;
333
+ position: fixed;
321
334
  z-index: 30;
322
335
  display: flex;
323
336
  flex-direction: column;
324
- width: 100%;
325
337
  min-width: 220px;
326
- margin-top: 4px;
338
+ overflow: hidden;
327
339
  background: var(--ctl-bg);
328
340
  border: 1px solid var(--ctl-border);
329
341
  border-radius: var(--ctl-radius);
330
342
  box-shadow: var(--ctl-shadow);
331
343
  }
332
344
 
345
+ /* Never squeezed: the search box is what makes a bounded popover usable at all,
346
+ so the list gives up its height and this does not. */
333
347
  .ctl-search {
348
+ flex-shrink: 0;
334
349
  padding: 6px;
335
350
  border-bottom: 1px solid var(--ctl-border);
336
351
  }
@@ -357,7 +372,11 @@
357
372
  list-style: none;
358
373
  }
359
374
 
375
+ /* `min-height: 0` so the list can shrink below its content when the popover is
376
+ bounded to the room available — a flex item defaults to `min-height: auto`,
377
+ which is what lets an overflowing child push a capped container open. */
360
378
  .ctl-list {
379
+ min-height: 0;
361
380
  max-height: 260px;
362
381
  overflow-y: auto;
363
382
  }
@@ -452,6 +471,7 @@
452
471
 
453
472
  .ctl-popover-footer:not(:empty) {
454
473
  display: flex;
474
+ flex-shrink: 0;
455
475
  gap: 10px;
456
476
  padding: 6px 8px;
457
477
  border-top: 1px solid var(--ctl-border);
@@ -1451,3 +1471,291 @@
1451
1471
  display: none;
1452
1472
  }
1453
1473
  }
1474
+
1475
+ /*
1476
+ * The date range filter, and the calendar it opens.
1477
+ *
1478
+ * Two rules do most of the work here and are worth naming. The grid is a real
1479
+ * `<table>`, so its cells are laid out by the table algorithm and every column
1480
+ * is the same width without a `grid-template` to keep in step with the seven
1481
+ * headings. And every direction is logical: the calendar is the one control
1482
+ * here most likely to be read right-to-left, and `text-align: left` on a
1483
+ * weekday heading is invisible in English and wrong in Hebrew.
1484
+ */
1485
+
1486
+ .ctl-daterange {
1487
+ display: flex;
1488
+ flex-direction: column;
1489
+ gap: var(--ctl-space-1);
1490
+ }
1491
+
1492
+ /* Inside the trigger, so the caret keeps its own corner. */
1493
+ .ctl-daterange-icon {
1494
+ display: inline-flex;
1495
+ flex-shrink: 0;
1496
+ color: var(--ctl-faint);
1497
+ }
1498
+
1499
+ /* The trigger is `space-between` and this one has three children rather than
1500
+ two, so without the slack going to the value it sits in the middle of the
1501
+ control — which reads as a heading rather than as what the field is set to. */
1502
+ .ctl-daterange .ctl-value {
1503
+ flex: 1;
1504
+ }
1505
+
1506
+ /*
1507
+ * Wider than the picker popover, because a calendar has seven columns and a
1508
+ * list of presets beside it. `max-width` in view units rather than a second
1509
+ * fixed number: `useAnchoredPopover` caps the width to the room there is, and
1510
+ * this keeps the two panels side by side until there is not room for them.
1511
+ */
1512
+ .ctl-daterange-popover {
1513
+ min-width: 280px;
1514
+ max-width: min(560px, 96vw);
1515
+ }
1516
+
1517
+ .ctl-daterange-panels {
1518
+ display: flex;
1519
+ gap: var(--ctl-space-3);
1520
+ min-height: 0;
1521
+ padding: var(--ctl-space-3);
1522
+ overflow-y: auto;
1523
+ }
1524
+
1525
+ .ctl-daterange-presets {
1526
+ flex-shrink: 0;
1527
+ min-width: 140px;
1528
+ }
1529
+
1530
+ .ctl-daterange-preset-list {
1531
+ display: flex;
1532
+ flex-direction: column;
1533
+ gap: 2px;
1534
+ padding: 0;
1535
+ margin: 0;
1536
+ list-style: none;
1537
+ }
1538
+
1539
+ .ctl-daterange-preset {
1540
+ display: block;
1541
+ width: 100%;
1542
+ padding: 6px var(--ctl-space-2);
1543
+ font: inherit;
1544
+ color: inherit;
1545
+ text-align: start;
1546
+ cursor: pointer;
1547
+ background: none;
1548
+ border: 0;
1549
+ border-radius: var(--ctl-radius-sm);
1550
+ }
1551
+
1552
+ .ctl-daterange-preset:hover {
1553
+ background: var(--ctl-hover);
1554
+ }
1555
+
1556
+ .ctl-daterange-preset[aria-pressed='true'] {
1557
+ font-weight: 500;
1558
+ color: var(--ctl-accent);
1559
+ background: var(--ctl-accent-soft);
1560
+ }
1561
+
1562
+ .ctl-daterange-detail {
1563
+ display: flex;
1564
+ flex: 1;
1565
+ flex-direction: column;
1566
+ gap: var(--ctl-space-3);
1567
+ min-width: 0;
1568
+ }
1569
+
1570
+ .ctl-daterange-row {
1571
+ display: flex;
1572
+ flex-wrap: wrap;
1573
+ gap: var(--ctl-space-2);
1574
+ align-items: flex-end;
1575
+ }
1576
+
1577
+ .ctl-daterange-relative {
1578
+ display: flex;
1579
+ flex-direction: column;
1580
+ gap: var(--ctl-space-1);
1581
+ }
1582
+
1583
+ .ctl-daterange-directions,
1584
+ .ctl-daterange-units {
1585
+ display: flex;
1586
+ flex-wrap: wrap;
1587
+ gap: 4px;
1588
+ }
1589
+
1590
+ /* A chip is a choice among a few: a unit, a direction, a calendar. Pill-shaped
1591
+ so it never reads as the button that applies something. */
1592
+ .ctl-daterange-chip {
1593
+ padding: 4px var(--ctl-space-2);
1594
+ font: inherit;
1595
+ font-size: var(--ctl-text-sm);
1596
+ color: var(--ctl-muted);
1597
+ cursor: pointer;
1598
+ background: var(--ctl-bg);
1599
+ border: 1px solid var(--ctl-border);
1600
+ border-radius: var(--ctl-radius-pill);
1601
+ }
1602
+
1603
+ .ctl-daterange-chip:hover {
1604
+ background: var(--ctl-hover);
1605
+ }
1606
+
1607
+ .ctl-daterange-chip[aria-pressed='true'] {
1608
+ color: var(--ctl-accent-text);
1609
+ background: var(--ctl-accent);
1610
+ border-color: var(--ctl-accent);
1611
+ }
1612
+
1613
+ .ctl-daterange-field {
1614
+ display: flex;
1615
+ flex: 1;
1616
+ flex-direction: column;
1617
+ gap: 2px;
1618
+ min-width: 120px;
1619
+ }
1620
+
1621
+ .ctl-daterange-amount {
1622
+ width: 72px;
1623
+ flex-shrink: 0;
1624
+ }
1625
+
1626
+ .ctl-cal {
1627
+ display: flex;
1628
+ flex-direction: column;
1629
+ gap: var(--ctl-space-1);
1630
+ }
1631
+
1632
+ .ctl-cal-head {
1633
+ display: flex;
1634
+ gap: var(--ctl-space-2);
1635
+ align-items: center;
1636
+ justify-content: space-between;
1637
+ }
1638
+
1639
+ .ctl-cal-title {
1640
+ font-size: var(--ctl-text-sm);
1641
+ font-weight: 500;
1642
+ color: var(--ctl-text);
1643
+ }
1644
+
1645
+ .ctl-cal-step {
1646
+ display: inline-flex;
1647
+ padding: 4px;
1648
+ color: var(--ctl-muted);
1649
+ cursor: pointer;
1650
+ background: none;
1651
+ border: 0;
1652
+ border-radius: var(--ctl-radius-sm);
1653
+ }
1654
+
1655
+ .ctl-cal-step:hover {
1656
+ color: var(--ctl-text);
1657
+ background: var(--ctl-hover);
1658
+ }
1659
+
1660
+ .ctl-cal-grid {
1661
+ width: 100%;
1662
+ border-collapse: collapse;
1663
+ }
1664
+
1665
+ .ctl-cal-weekday {
1666
+ padding: 2px 0;
1667
+ font-size: var(--ctl-text-xs);
1668
+ font-weight: 500;
1669
+ color: var(--ctl-faint);
1670
+ text-align: center;
1671
+ }
1672
+
1673
+ .ctl-cal-cell {
1674
+ padding: 1px;
1675
+ text-align: center;
1676
+ }
1677
+
1678
+ /* A day of another month. Kept as a cell rather than dropped, so the week it is
1679
+ in still has seven columns and the grid stays a grid to a screen reader. */
1680
+ .ctl-cal-blank {
1681
+ /* Nothing to draw, and nothing to announce. */
1682
+ visibility: hidden;
1683
+ }
1684
+
1685
+ .ctl-cal-day {
1686
+ width: 100%;
1687
+ min-width: 32px;
1688
+ padding: 6px 0;
1689
+ font: inherit;
1690
+ font-size: var(--ctl-text-sm);
1691
+ color: var(--ctl-text);
1692
+ cursor: pointer;
1693
+ background: none;
1694
+ border: 0;
1695
+ border-radius: var(--ctl-radius-sm);
1696
+ }
1697
+
1698
+ .ctl-cal-day:hover:not(:disabled) {
1699
+ background: var(--ctl-hover);
1700
+ }
1701
+
1702
+ .ctl-cal-day:disabled {
1703
+ color: var(--ctl-faint);
1704
+ cursor: default;
1705
+ opacity: 0.6;
1706
+ }
1707
+
1708
+ /* The wash between the two ends, and the two ends themselves. Drawn as a range
1709
+ while the pointer is over a candidate second end, so a range is something you
1710
+ see before you commit to it. */
1711
+ .ctl-cal-day-in-range {
1712
+ background: var(--ctl-selected);
1713
+ border-radius: 0;
1714
+ }
1715
+
1716
+ .ctl-cal-day-selected,
1717
+ .ctl-cal-day-selected.ctl-cal-day-in-range {
1718
+ color: var(--ctl-accent-text);
1719
+ background: var(--ctl-accent);
1720
+ border-radius: var(--ctl-radius-sm);
1721
+ }
1722
+
1723
+ /* Today is named by a ring rather than by a fill: a fill is what "selected"
1724
+ means two rules above, and one screen cannot spend the same signal twice. */
1725
+ .ctl-cal-day-today:not(.ctl-cal-day-selected) {
1726
+ box-shadow: inset 0 0 0 1px var(--ctl-accent);
1727
+ }
1728
+
1729
+ .ctl-cal-step:focus-visible,
1730
+ .ctl-cal-day:focus-visible,
1731
+ .ctl-daterange-preset:focus-visible,
1732
+ .ctl-daterange-chip:focus-visible {
1733
+ outline: 2px solid var(--ctl-accent);
1734
+ outline-offset: -1px;
1735
+ }
1736
+
1737
+ /*
1738
+ * Under about 480px the two panels stop fitting side by side — the calendar
1739
+ * alone wants seven columns of tappable squares. They stack, and the presets go
1740
+ * on top, because a named range is what most people came for.
1741
+ */
1742
+ @media (max-width: 480px) {
1743
+ .ctl-daterange-panels {
1744
+ flex-direction: column;
1745
+ }
1746
+
1747
+ .ctl-daterange-presets {
1748
+ min-width: 0;
1749
+ }
1750
+
1751
+ .ctl-daterange-preset-list {
1752
+ flex-direction: row;
1753
+ flex-wrap: wrap;
1754
+ }
1755
+
1756
+ .ctl-daterange-preset {
1757
+ width: auto;
1758
+ border: 1px solid var(--ctl-border);
1759
+ border-radius: var(--ctl-radius-pill);
1760
+ }
1761
+ }
@@ -0,0 +1,71 @@
1
+ import { type RefObject } from 'react';
2
+ /**
3
+ * Pin a popover to its anchor, in viewport coordinates.
4
+ *
5
+ * `.ctl-popover` was `position: absolute; top: 100%` against the control, which
6
+ * is the obvious way to write it and is wrong in the one place these controls
7
+ * are used most: inside a dialog. `<Modal>`'s body is `overflow-y: auto` — it
8
+ * has to be, or a tall dialog scrolls the backdrop and its close button ends up
9
+ * somewhere nobody can reach — so an absolutely positioned popover is part of
10
+ * that box's scrollable content. Opening the folder picker in
11
+ * `config-console`'s editor took the body's `scrollHeight` from 446 to 583
12
+ * against a `clientHeight` of 446: the options were *there*, under the footer,
13
+ * and the operator had to notice a new scrollbar and scroll to them. The same
14
+ * shape clipped `sql-console`'s database picker, and the stylesheet's answer at
15
+ * the time — that the host must stop clipping — is not one a host can take when
16
+ * the clipping ancestor is this package's own dialog.
17
+ *
18
+ * So the popover is `position: fixed` and placed here, from the anchor's own
19
+ * rectangle. Fixed rather than a portal for the reason `<Modal>` gives at
20
+ * length: a console bridges its palette onto `--ctl-*` with a descendant
21
+ * selector, and a portal to `document.body` escapes it, so a dark console would
22
+ * open a light list. Staying in the tree keeps the bridge and steps out of the
23
+ * scroll container at the same time.
24
+ *
25
+ * What it does beyond that:
26
+ *
27
+ * - **Flips up** when the list does not fit below and fits better above. The
28
+ * decision is made against the height the popover actually wants — measured
29
+ * with the cap off — rather than against a threshold, because a threshold
30
+ * gets both ends wrong: a fixed "160px is enough" leaves a full list
31
+ * squeezed into 169px with 475px going spare above it, and raising the
32
+ * number flips a list that was fitting perfectly well.
33
+ * - **Keeps the side it chose** while the list still fits on it. Re-deciding
34
+ * on every content change would make the list jump across the field as
35
+ * somebody types, since a search that matches two options wants a
36
+ * different amount of room from one that matches forty.
37
+ * - **Bounds its height** to the room actually available, so the list scrolls
38
+ * inside the popover rather than the popover overhanging the viewport, and
39
+ * its **width** to a window too narrow for it, since the popover hides its
40
+ * overflow and offers no way to scroll sideways to what is cut off.
41
+ * - **Follows the anchor** while any ancestor scrolls. A fixed element does
42
+ * not move with the box it was measured against, so without this the list
43
+ * detaches from its trigger the moment the dialog body scrolls.
44
+ * - **Places again when the content changes size**, which is what the
45
+ * `ResizeObserver` is for. A control over a transport opens saying
46
+ * "Searching…" and is two lines tall at the moment it is first placed — so
47
+ * a list that will want 300px is measured at 80, drops downwards into
48
+ * whatever was there, and is squeezed into it once the options land. That
49
+ * is the picker this whole hook was written for.
50
+ * - **Hides itself** while the anchor is scrolled out of sight. A fixed
51
+ * popover does not go with its trigger through the top of a dialog body:
52
+ * it stays where it was, over unrelated content, offered as though it
53
+ * belonged to whatever is now under it.
54
+ *
55
+ * The one thing that breaks it is an ancestor with `transform`, `filter` or
56
+ * `will-change`, which makes itself the containing block for fixed
57
+ * descendants — the same caveat `<Modal>` carries, and the fix for it is on the
58
+ * ancestor.
59
+ *
60
+ * Styles are written straight onto the node rather than held in state. Placing
61
+ * needs the size the browser settled on *after* the stylesheet's `min-width`
62
+ * and the list's own `max-height` applied, so the effect has to read the
63
+ * element back after writing to it — a render pass in between would be a second
64
+ * paint at the wrong size, and a `setState` on every scroll event besides.
65
+ *
66
+ * @param open Whether the popover is rendered. Placement stops when it is not.
67
+ * @param anchor The element the popover hangs off, normally the control's root.
68
+ * @returns The ref to put on the popover element.
69
+ */
70
+ export declare function useAnchoredPopover(open: boolean, anchor: RefObject<HTMLElement | null>): RefObject<HTMLDivElement | null>;
71
+ //# sourceMappingURL=useAnchoredPopover.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAnchoredPopover.d.ts","sourceRoot":"","sources":["../src/useAnchoredPopover.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAuB7E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmEG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,OAAO,EACb,MAAM,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,GACpC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CA6KlC"}