@vesture/react 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Vesture Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,49 @@
1
+ # @vesture/react
2
+
3
+ React components for Vesture, styled with vanilla-extract and themed via
4
+ [`@vesture/tokens`](../tokens).
5
+
6
+ ## Setup
7
+
8
+ ```ts
9
+ import "@vesture/tokens/styles.css";
10
+ import "@vesture/react/styles.css";
11
+ import { defaultThemeClass } from "@vesture/react";
12
+
13
+ document.documentElement.classList.add(defaultThemeClass);
14
+ ```
15
+
16
+ ## Applying the theme class to `<html>`, not an inner `<div>`
17
+
18
+ Apply the theme class to `document.documentElement` (or `<body>`), **not** to
19
+ an inner wrapper `<div>` in your component tree. Several components —
20
+ `Modal`, `Tooltip`, `Popover`, `DropdownMenu`, and `Toast` — render their
21
+ content through a React portal into `document.body`, outside of wherever your
22
+ app's React tree happens to sit in the DOM.
23
+
24
+ CSS custom properties (the mechanism the token contract is built on) only
25
+ cascade down the DOM tree. If the theme class is applied to a `<div>` inside
26
+ your app rather than a true ancestor of `document.body`, portal-rendered
27
+ content falls outside that subtree and every `vars.*` reference resolves to
28
+ nothing — the overlay renders completely unstyled.
29
+
30
+ ```tsx
31
+ // Wrong — portals (Modal, Tooltip, Popover, DropdownMenu, Toast) won't
32
+ // inherit the theme, since document.body is a sibling of this div, not
33
+ // a descendant.
34
+ function App() {
35
+ return <div className={defaultThemeClass}>{/* ... */}</div>;
36
+ }
37
+ ```
38
+
39
+ ```ts
40
+ // Right — <html> is an ancestor of document.body, so every portal
41
+ // (which always mounts into document.body) inherits the theme correctly.
42
+ document.documentElement.classList.add(defaultThemeClass);
43
+ ```
44
+
45
+ If you need multiple simultaneous themes on one page (vanilla-extract
46
+ supports this), keep the theme class on each themed subtree's root `<div>`
47
+ as usual, but pass an explicit portal container to the overlay component
48
+ (e.g. `FloatingPortal`'s `root` prop) that lives inside that themed subtree
49
+ rather than relying on the `document.body` default.