@leta-io/components 0.2.0 → 0.4.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 CHANGED
@@ -25,6 +25,42 @@ attribute. Import `@leta-io/design-tokens/dark-elevation.css` **after** the base
25
25
  tokens — dark shadows need a hairline ring to read against a near-black surface,
26
26
  and load order decides the winner.
27
27
 
28
+ ## Overlays
29
+
30
+ `Popover`, `MenuPanel`, `MenuDivider`, `MenuFlyout` and `DialogOverlay` are the
31
+ same overlay primitives the LETA platform uses, published since 0.3.0 so you
32
+ don't have to rebuild them. Use them rather than hand-rolling a popover — they
33
+ carry behaviour that is easy to get wrong and hard to notice:
34
+
35
+ - **One popover open at a time**, platform-wide — opening one closes the last.
36
+ - **Escape closes only the topmost overlay**, then the next press closes the one
37
+ beneath it.
38
+ - **Focus returns to the trigger** when a popover closes.
39
+ - **A closing popover stops blocking clicks immediately**, not when its exit
40
+ animation ends — so a stalled animation can never leave an invisible layer
41
+ swallowing every click on the page.
42
+ - **`MenuFlyout`** opens a cascading submenu beside a menu row without closing
43
+ the parent menu.
44
+
45
+ ```tsx
46
+ import { Popover, MenuPanel, DialogOverlay } from '@leta-io/components';
47
+
48
+ <Popover anchorRect={rect} onClose={close} placement="bottom-end">
49
+ <MenuPanel width={220}>{/* DesktopMenuOptions rows */}</MenuPanel>
50
+ </Popover>
51
+
52
+ <DialogOverlay onClose={close}>
53
+ {({ close }) => <ModalDialog onCancel={close} /* … */ />}
54
+ </DialogOverlay>
55
+ ```
56
+
57
+ **Stacking.** `DialogOverlay`'s `tier` is the scrim's z-index (the panel sits
58
+ one above), defaulting to `DIALOG_OVERLAY_DEFAULT_TIER`. A dialog opened from
59
+ *inside* another overlay — a drawer, say — must pass a tier above it, or it
60
+ renders underneath. Keep a named tier map in your app rather than scattering bare
61
+ numbers; the design system deliberately doesn't ship one, because it can't know
62
+ how your surfaces stack.
63
+
28
64
  ## Peer dependencies
29
65
 
30
66
  React 18 or 19. `leaflet` and `lottie-web` are required only if you use the map
Binary file
Binary file