@cascivo/react 0.8.0 → 0.9.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.
@@ -4,34 +4,34 @@ import e from "./toggle.module.js";
4
4
  import { cn as t, createMachine as n, useMachine as r, useSignals as i } from "@cascivo/core";
5
5
  import { jsx as a, jsxs as o } from "react/jsx-runtime";
6
6
  //#region ../components/src/toggle/toggle.tsx
7
- function s({ checked: s, defaultChecked: c = !1, onChange: l, label: u, size: d = "md", className: f, disabled: p, ...m }) {
7
+ function s({ checked: s, defaultChecked: c = !1, onValueChange: l, onChange: u, label: d, size: f = "md", className: p, disabled: m, ...h }) {
8
8
  i();
9
- let [h, g] = r(n({
9
+ let [g, _] = r(n({
10
10
  initial: c ? "on" : "off",
11
11
  states: {
12
12
  off: { on: { TOGGLE: "on" } },
13
13
  on: { on: { TOGGLE: "off" } }
14
14
  }
15
- })), _ = s !== void 0, v = _ ? s : h.value === "on";
15
+ })), v = s !== void 0, y = v ? s : g.value === "on";
16
16
  return /* @__PURE__ */ o("button", {
17
17
  type: "button",
18
18
  role: "switch",
19
- "aria-checked": v,
20
- "data-state": v ? "on" : "off",
21
- "data-size": d,
22
- disabled: p,
23
- className: t(e.toggle, f),
19
+ "aria-checked": y,
20
+ "data-state": y ? "on" : "off",
21
+ "data-size": f,
22
+ disabled: m,
23
+ className: t(e.toggle, p),
24
24
  onClick: () => {
25
- _ || g("TOGGLE"), l?.(!v);
25
+ v || _("TOGGLE"), (l ?? u)?.(!y);
26
26
  },
27
- ...m,
27
+ ...h,
28
28
  children: [/* @__PURE__ */ a("span", {
29
29
  className: e.track,
30
30
  "aria-hidden": "true",
31
31
  children: /* @__PURE__ */ a("span", { className: e.thumb })
32
- }), u && /* @__PURE__ */ a("span", {
32
+ }), d && /* @__PURE__ */ a("span", {
33
33
  className: e.label,
34
- children: u
34
+ children: d
35
35
  })]
36
36
  });
37
37
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cascivo/react",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "private": false,
5
5
  "description": "Prebuilt cascivo design system components — use without copying source",
6
6
  "keywords": [
@@ -33,8 +33,8 @@
33
33
  "exports": {
34
34
  ".": {
35
35
  "types": "./dist/index.d.ts",
36
- "import": "./dist/react/src/index.js",
37
- "default": "./dist/react/src/index.js"
36
+ "import": "./dist/index.js",
37
+ "default": "./dist/index.js"
38
38
  },
39
39
  "./styles.css": "./dist/styles.css",
40
40
  "./package.json": "./package.json"
@@ -44,8 +44,8 @@
44
44
  "provenance": true
45
45
  },
46
46
  "dependencies": {
47
- "@cascivo/core": "^0.4.1",
48
- "@cascivo/i18n": "^0.2.8"
47
+ "@cascivo/core": "^0.5.0",
48
+ "@cascivo/i18n": "^0.2.9"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@testing-library/jest-dom": "^6.9.1",
@@ -61,7 +61,7 @@
61
61
  "@cascivo/components": "0.0.0"
62
62
  },
63
63
  "peerDependencies": {
64
- "@preact/signals-react": ">=2.0.0",
64
+ "@preact/signals-react": ">=3.0.0",
65
65
  "react": ">=18.0.0",
66
66
  "react-dom": ">=18.0.0"
67
67
  },
package/readme.body.md CHANGED
@@ -18,6 +18,11 @@ supplies the tokens and themes the components read.
18
18
  Charts live in a separate package — add [`@cascivo/charts`](https://github.com/cascivo/cascivo/tree/main/packages/charts)
19
19
  for `LineChart`, `AreaChart`, `BarChart`, `Sparkline`, and more.
20
20
 
21
+ > **Types are the reference.** The shipped `dist/index.d.ts` is a self-contained, flat
22
+ > rollup — every component's `…Props` interface is real, documentation-grade API. Reading
23
+ > it (or the per-component [`/llms/<name>.md`](https://cascivo.com/llms.txt)) is the fastest
24
+ > way to learn a component's props with no web access.
25
+
21
26
  ### Framework setup (Next.js App Router)
22
27
 
23
28
  In a Server Component file (e.g. `app/layout.tsx`), import the themes once:
@@ -40,12 +45,20 @@ RSC without any extra wrapper.
40
45
  > only if you prefer one explicit stylesheet over per-component tree-shaking, or
41
46
  > for Vite SSR (below), where it is required.
42
47
 
43
- > **Vite SSR / TanStack Start / Remix / workerd?** Those per-component `.css`
44
- > imports need a bundler to resolve them; a bare server-side ESM loader throws
45
- > `Unknown file extension ".css"`. Add `ssr: { noExternal: [/^@cascivo\//] }` (or
46
- > the `cascivoSsr()` plugin from `@cascivo/vite-plugin`) and import
47
- > `@cascivo/react/styles.css` once in your root entry. Full recipe:
48
- > [USING-WITH-VITE-SSR.md](https://github.com/cascivo/cascivo/blob/main/docs/USING-WITH-VITE-SSR.md).
48
+ > **Vite SSR / TanStack Start / Remix / workerd?** The 4-line SSR checklist (full
49
+ > recipe: [USING-WITH-VITE-SSR.md](https://github.com/cascivo/cascivo/blob/main/docs/USING-WITH-VITE-SSR.md)):
50
+ >
51
+ > 1. **`ssr: { noExternal: [/^@cascivo\//] }`** in `vite.config` (or the
52
+ > `cascivoSsr()` plugin from `@cascivo/vite-plugin`). Without it a bare
53
+ > server-side ESM loader can't resolve the per-component `.css` side-effect
54
+ > imports and throws `Unknown file extension ".css"`.
55
+ > 2. **`@preact/signals-react` 3.x** — on React 19 the 2.x line fails to load. The
56
+ > peer range enforces `>=3`.
57
+ > 3. **Import the CSS once** in your root entry: `@cascivo/react/styles.css` +
58
+ > `@cascivo/themes/all` (+ `@cascivo/charts/styles.css` if you use charts).
59
+ > 4. **Theme without a mismatch:** inline `themePreloadScript()` in `<head>` and add
60
+ > `suppressHydrationWarning` to `<html>`, or hard-code `data-theme` for a fixed theme.
61
+ >
49
62
  > Next.js App Router needs none of this.
50
63
 
51
64
  ## Use