@code-sherpas/pharos-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 +21 -0
- package/README.md +65 -0
- package/RULES.md +90 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1708 -0
- package/dist/index.js.map +1 -0
- package/dist/styles.css +3 -0
- package/package.json +90 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Code Sherpas
|
|
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,65 @@
|
|
|
1
|
+
# @code-sherpas/pharos-react
|
|
2
|
+
|
|
3
|
+
React component library for Code Sherpas. Consumes
|
|
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.
|
|
6
|
+
|
|
7
|
+
## What's in this package
|
|
8
|
+
|
|
9
|
+
This package provides the **React component layer** of Code Sherpas's design
|
|
10
|
+
system. It does not define design values — those live in `pharos-tokens`.
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
pnpm add @code-sherpas/pharos-react @code-sherpas/pharos-tokens
|
|
16
|
+
# or npm / yarn
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
`@code-sherpas/pharos-tokens` is a peer dependency and must be installed
|
|
20
|
+
explicitly alongside this package.
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
// Root entry file (e.g. main.tsx, app/layout.tsx)
|
|
26
|
+
import '@code-sherpas/pharos-react/styles.css';
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
import { PharosHello } from '@code-sherpas/pharos-react';
|
|
31
|
+
|
|
32
|
+
export function Demo() {
|
|
33
|
+
return <PharosHello name="Alexandria" />;
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Rules for consumers
|
|
38
|
+
|
|
39
|
+
See [RULES.md](./RULES.md) — published with the package.
|
|
40
|
+
|
|
41
|
+
## Storybook
|
|
42
|
+
|
|
43
|
+
The live component reference runs on Storybook 10 + `@storybook/react-vite`.
|
|
44
|
+
|
|
45
|
+
- `pnpm storybook` — dev server on port 6006.
|
|
46
|
+
- `pnpm build-storybook` — static build to `storybook-static/`. The hosted
|
|
47
|
+
URL will be published once Render deployment is wired up (phase 1B.4 /
|
|
48
|
+
1B.5).
|
|
49
|
+
|
|
50
|
+
## Contributing
|
|
51
|
+
|
|
52
|
+
1. `pnpm install`
|
|
53
|
+
2. Implement the component under `src/components/<Name>.tsx`, export it from
|
|
54
|
+
`src/index.ts`.
|
|
55
|
+
3. Add a story alongside: `src/components/<Name>.stories.tsx`.
|
|
56
|
+
4. Add tests under `tests/` (Vitest + Testing Library).
|
|
57
|
+
5. `pnpm build` — verify the Vite library bundle compiles cleanly.
|
|
58
|
+
6. `pnpm build-storybook` — verify stories render.
|
|
59
|
+
7. `pnpm test` / `pnpm typecheck` / `pnpm lint` / `pnpm format:check`.
|
|
60
|
+
8. `pnpm changeset` — declare the type of change (patch / minor / major).
|
|
61
|
+
9. Open a PR.
|
|
62
|
+
|
|
63
|
+
## License
|
|
64
|
+
|
|
65
|
+
MIT. See [LICENSE](./LICENSE).
|
package/RULES.md
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Rules for consumers of `@code-sherpas/pharos-react`
|
|
2
|
+
|
|
3
|
+
This file ships with the package (`files` includes `RULES.md`). Every
|
|
4
|
+
consumer — `alexandria-web-application`, `alexandria-design`, and any future
|
|
5
|
+
app — must follow these rules.
|
|
6
|
+
|
|
7
|
+
## 1. Only Pharos components for UI
|
|
8
|
+
|
|
9
|
+
Forbidden:
|
|
10
|
+
|
|
11
|
+
- Hand-rolled `<button>` / `<input>` when `Button` / `Input` exists in
|
|
12
|
+
`@code-sherpas/pharos-react`.
|
|
13
|
+
- Importing primitives (`@radix-ui/*`, `@base-ui-components/*`, `antd`,
|
|
14
|
+
`@heroicons/*`, `@headlessui/*`) directly. Pharos wraps what it needs.
|
|
15
|
+
- Copy-pasting a Pharos component into the consumer and modifying it. If
|
|
16
|
+
Pharos is missing a variant, open an issue in this repo.
|
|
17
|
+
|
|
18
|
+
## 2. Use the canonical names
|
|
19
|
+
|
|
20
|
+
Pharos names follow shadcn/ui > Base UI > ARIA APG (tiebreaker: shorter
|
|
21
|
+
name). If you are migrating Alexandria, translate the old name to the Pharos
|
|
22
|
+
canonical one — do not alias.
|
|
23
|
+
|
|
24
|
+
| Alexandria-ish | Pharos canonical |
|
|
25
|
+
| -------------------------- | ------------------------ |
|
|
26
|
+
| `PrimaryButton` / `CtaBtn` | `<Button variant="…" />` |
|
|
27
|
+
| `Modal` / `Popup` | `Dialog` |
|
|
28
|
+
| `Drawer` / `SidePanel` | `Sheet` |
|
|
29
|
+
| `Toast` / `Notification` | `Toast` |
|
|
30
|
+
| `Chip` / `Pill` / `Tag` | `Badge` |
|
|
31
|
+
|
|
32
|
+
(Full list lives in `NAMING-decisions.md` once Phase 2 starts.)
|
|
33
|
+
|
|
34
|
+
## 3. Import the stylesheet once
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
// in your app's root entry file
|
|
38
|
+
import '@code-sherpas/pharos-react/styles.css';
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
This loads the compiled Tailwind v4 output plus the `@theme inline` mapping
|
|
42
|
+
to `--pharos-*`. Without it, components render unstyled.
|
|
43
|
+
|
|
44
|
+
## 4. `pharos-tokens` is a peer dependency
|
|
45
|
+
|
|
46
|
+
Consumers must install it explicitly. It is not transitively bundled to
|
|
47
|
+
avoid duplicate CSS var declarations:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
pnpm add @code-sherpas/pharos-react @code-sherpas/pharos-tokens
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Version compatibility is declared via `peerDependencies` in
|
|
54
|
+
`pharos-react/package.json`. Upgrade both together.
|
|
55
|
+
|
|
56
|
+
## 5. Respect the variants API
|
|
57
|
+
|
|
58
|
+
Pharos components expose their full variant axis (size, tone, intent, etc.)
|
|
59
|
+
via props. Forbidden:
|
|
60
|
+
|
|
61
|
+
- Overriding internal class names to "fake" a variant that does not exist.
|
|
62
|
+
- Passing `className` strings that conflict with the component's theme
|
|
63
|
+
(e.g. `className="bg-red-500"` on a `<Button>` to make it red — use
|
|
64
|
+
`intent="destructive"` or open an issue).
|
|
65
|
+
|
|
66
|
+
`className` is allowed for layout tweaks (margins, widths), not visual
|
|
67
|
+
identity.
|
|
68
|
+
|
|
69
|
+
## 6. Respect semver
|
|
70
|
+
|
|
71
|
+
- Breaking change in this repo → major bump → consumers upgrade explicitly.
|
|
72
|
+
- New component or variant → minor bump → consumers may adopt freely.
|
|
73
|
+
- Bugfix, visual tweak, or internal refactor → patch → consumers get it for
|
|
74
|
+
free.
|
|
75
|
+
|
|
76
|
+
Every PR that affects the public API includes a changeset. If your PR does
|
|
77
|
+
not, CI will fail.
|
|
78
|
+
|
|
79
|
+
## 7. Icons
|
|
80
|
+
|
|
81
|
+
Pharos uses **Lucide** (decision D4). When a component needs an icon you do
|
|
82
|
+
not pass, Pharos renders the Lucide default. If you need a custom icon,
|
|
83
|
+
open a PR to add it under `src/icons/` — do not ship icons from the
|
|
84
|
+
consumer that duplicate Lucide.
|
|
85
|
+
|
|
86
|
+
## 8. Extensions and forks
|
|
87
|
+
|
|
88
|
+
Do not publish `@yourorg/pharos-react-extended`. If a product needs its own
|
|
89
|
+
components, build them in the consumer under your own naming namespace and
|
|
90
|
+
document it. If the need is general, propose it in this repo.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { }
|