@code-sherpas/pharos-react 0.2.2 → 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
@@ -2,7 +2,9 @@
2
2
 
3
3
  React component library for Code Sherpas. Consumes
4
4
  [`@code-sherpas/pharos-tokens`](https://github.com/code-sherpas/pharos-tokens)
5
- as a peer dependency. Built with Vite library mode, React 19, Tailwind v4.
5
+ as a peer dependency. Built with Vite library mode, React 19 and CSS Modules.
6
+ The published bundle ships zero Tailwind, zero PostCSS preflight and zero
7
+ global resets — see Decision D9 in `PLAN-pharos-alexandria.md`.
6
8
 
7
9
  ## What's in this package
8
10
 
@@ -22,15 +24,16 @@ explicitly alongside this package.
22
24
  ## Usage
23
25
 
24
26
  ```ts
25
- // Root entry file (e.g. main.tsx, app/layout.tsx)
26
- import '@code-sherpas/pharos-react/styles.css';
27
+ // Root entry file (e.g. main.tsx, app/layout.tsx). Import once.
28
+ import '@code-sherpas/pharos-tokens/css'; // CSS variables for the design tokens
29
+ import '@code-sherpas/pharos-react/styles.css'; // hashed component styles
27
30
  ```
28
31
 
29
32
  ```tsx
30
- import { PharosHello } from '@code-sherpas/pharos-react';
33
+ import { Button } from '@code-sherpas/pharos-react';
31
34
 
32
35
  export function Demo() {
33
- return <PharosHello name="Alexandria" />;
36
+ return <Button intent="primary">Save changes</Button>;
34
37
  }
35
38
  ```
36
39
 
@@ -50,7 +53,8 @@ The live component reference runs on Storybook 10 + `@storybook/react-vite`.
50
53
  ## Contributing
51
54
 
52
55
  1. `pnpm install`
53
- 2. Implement the component under `src/components/<Name>.tsx`, export it from
56
+ 2. Implement the component under `src/components/<Name>.tsx` plus its
57
+ sibling `src/components/<Name>.module.css` (Decision D9). Export it from
54
58
  `src/index.ts`.
55
59
  3. Add a story alongside: `src/components/<Name>.stories.tsx`.
56
60
  4. Add tests under `tests/` (Vitest + Testing Library).
package/RULES.md CHANGED
@@ -38,8 +38,16 @@ canonical one — do not alias.
38
38
  import '@code-sherpas/pharos-react/styles.css';
39
39
  ```
40
40
 
41
- This loads the compiled Tailwind v4 output plus the `@theme inline` mapping
42
- to `--pharos-*`. Without it, components render unstyled.
41
+ This loads the compiled CSS Modules output of every component (hashed class
42
+ names that the React components reference at runtime). Without it,
43
+ components render unstyled.
44
+
45
+ **You do not need Tailwind, PostCSS, or any other CSS framework to consume
46
+ pharos-react** (Decision D9). The published bundle is pure CSS — no
47
+ `@layer` directives, no preflight, no global resets, no class-name
48
+ collisions with your own utilities. It works the same in Next.js + Tailwind
49
+ v3, Next.js + Tailwind v4, Vite + plain CSS, Astro, Remix, or any other
50
+ React stack.
43
51
 
44
52
  ## 4. `pharos-tokens` is a peer dependency
45
53
 
@@ -1,5 +1,13 @@
1
1
  import { useRender } from '@base-ui/react/use-render';
2
2
  import { VariantProps } from 'class-variance-authority';
3
+ /**
4
+ * Maps the two public variant axes (`intent`, `size`) to the per-class names
5
+ * inside `Button.module.css`. CVA stays as the typed-variants mechanism
6
+ * (Decision D9 keeps the authoring DX) but each value points at a hashed
7
+ * CSS Modules class instead of a Tailwind utility string. The base class
8
+ * carries layout, typography and the focus-visible ring — every variant
9
+ * stacks on top of it.
10
+ */
3
11
  declare const buttonVariants: (props?: ({
4
12
  intent?: "primary" | "secondary" | "ghost" | "destructive" | null | undefined;
5
13
  size?: "sm" | "md" | "lg" | null | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../src/components/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAGlE,QAAA,MAAM,cAAc;;;8EAsDnB,CAAC;AAEF,KAAK,kBAAkB,GAAG,YAAY,CAAC,OAAO,cAAc,CAAC,CAAC;AAE9D;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,WAAY,SAAQ,SAAS,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,kBAAkB;CAAG;AAE9F,wBAAgB,MAAM,CAAC,EACrB,MAAM,EACN,SAAS,EACT,MAAM,EACN,IAAI,EACJ,IAAe,EACf,GAAG,EACH,GAAG,IAAI,EACR,EAAE,WAAW,8FAWb;yBAnBe,MAAM;;;AAuBtB,OAAO,EAAE,cAAc,EAAE,CAAC"}
1
+ {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../src/components/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAIlE;;;;;;;GAOG;AACH,QAAA,MAAM,cAAc;;;8EAwBlB,CAAC;AAEH,KAAK,kBAAkB,GAAG,YAAY,CAAC,OAAO,cAAc,CAAC,CAAC;AAE9D;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,WAAY,SAAQ,SAAS,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,kBAAkB;CAAG;AAE9F,wBAAgB,MAAM,CAAC,EACrB,MAAM,EACN,SAAS,EACT,MAAM,EACN,IAAI,EACJ,IAAe,EACf,GAAG,EACH,GAAG,IAAI,EACR,EAAE,WAAW,8FAmBb;yBA3Be,MAAM;;;AA+BtB,OAAO,EAAE,cAAc,EAAE,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,4 @@
1
1
  export { Button, buttonVariants } from './components/Button';
2
2
  export type { ButtonProps } from './components/Button';
3
- export { PharosHello } from './components/PharosHello';
4
- export type { PharosHelloProps } from './components/PharosHello';
5
3
  export { cn } from './lib/cn';
6
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,CAAC;AAE5B,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC7D,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,YAAY,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC7D,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC"}