@ship-it-ui/ui 0.0.1

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 ship-it-ops
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,62 @@
1
+ # @ship-it-ui/ui
2
+
3
+ The React component library for the Ship-It design system.
4
+
5
+ ## Architecture
6
+
7
+ ```
8
+ src/
9
+ ├── components/ Atomic primitives (Button, Input, Avatar, Dialog, …)
10
+ │ └── Button/
11
+ │ ├── Button.tsx Component + cva variant definitions
12
+ │ ├── Button.stories.tsx Storybook stories (also serve as autodocs)
13
+ │ ├── Button.test.tsx Vitest + Testing Library + vitest-axe
14
+ │ └── index.ts Re-exports the component + types
15
+ ├── patterns/ Composites of primitives (Tabs, Combobox, DataTable, …)
16
+ ├── hooks/ useEscape, useOutsideClick, useTheme, useDisclosure,
17
+ │ useControllableState, useKeyboardList
18
+ ├── primitives/ Thin wrappers over Radix when we want a Ship-It-flavored API
19
+ ├── utils/
20
+ │ └── cn.ts clsx + tailwind-merge
21
+ ├── styles/
22
+ │ ├── globals.css Tailwind v4 entrypoint + token CSS-var bridge
23
+ │ └── animations.css Keyframes (spin, pulse, indeterminate, dialogIn, …)
24
+ ├── test/
25
+ │ └── setup.ts Vitest global setup (jsdom polyfills + vitest-axe)
26
+ └── index.ts Public API barrel — only re-exports
27
+ ```
28
+
29
+ ## Component anatomy
30
+
31
+ Every component follows the same shape — open `Button/` to see the canonical example:
32
+
33
+ | File | What it contains |
34
+ | --------------- | ------------------------------------------------------------- |
35
+ | `Component.tsx` | The implementation. Variants via `cva`. Tokens via Tailwind. |
36
+ | `*.stories.tsx` | One story per variant + a "Sizes" / "States" composite story. |
37
+ | `*.test.tsx` | Render, interaction, and `axe` a11y tests. |
38
+ | `index.ts` | Re-exports the component and any related types. |
39
+
40
+ ## Adding a new component
41
+
42
+ See [`docs/adding-a-component.md`](../../docs/adding-a-component.md) for the
43
+ step-by-step guide. In short:
44
+
45
+ 1. Copy `src/components/Button/` and rename to your component.
46
+ 2. Replace the implementation, story, and tests.
47
+ 3. Add a re-export line to `src/index.ts`.
48
+ 4. `pnpm --filter @ship-it-ui/ui test` — make sure tests pass and axe is clean.
49
+ 5. Run Storybook (`pnpm dev`) and visually verify.
50
+ 6. `pnpm changeset` — describe the new component as a `minor` bump.
51
+
52
+ ## Conventions
53
+
54
+ - **Always consume semantic tokens**, never primitive ones. `bg-brand`, not `bg-indigo-600`.
55
+ - **Forward refs**. Every component uses `forwardRef` so consumers can attach refs and
56
+ Radix integrations can wire focus management.
57
+ - **`asChild` polymorphism**. Use `@radix-ui/react-slot` for components that should be
58
+ able to render as a different element (e.g., a `Link`).
59
+ - **A11y is non-negotiable**. Tests assert `axe` violations === 0. Use
60
+ `@testing-library/user-event` (not `fireEvent`) so interactions match real user input.
61
+ - **Styling**: Tailwind classes consuming token CSS variables. Keep all variant logic
62
+ inside `cva` — no inline conditional classNames in JSX.