getjacked-components
v0.3.6
Published
Production-ready React UI primitives with theming and tree-shakeable ESM/CJS builds.
Maintainers
Readme
getjacked-components
Production-ready React UI primitives: Button, Card, Modal, Input, and Badge. Ships as ESM + CJS with TypeScript types, CSS Modules bundled to a single style.css, optional theming via ThemeProvider and CSS variables, and tree-shakeable named exports.
Requirements
- React 18 or 19
react-dom18 or 19
Install
npm install getjacked-componentsQuick start
import { ThemeProvider, Button, Card, CardBody, CardHeader, CardTitle } from 'getjacked-components';
export function App() {
return (
<ThemeProvider defaultMode="system">
<Card>
<CardHeader>
<CardTitle>Hello</CardTitle>
</CardHeader>
<CardBody>
<Button variant="primary">Action</Button>
</CardBody>
</Card>
</ThemeProvider>
);
}- Styles:
dist/index.mjsanddist/index.cjsstart with a side-effectimport/requireof./style.css, so Vite, webpack, and similar bundlers usually loadgetjacked-components/style.cssautomatically when you import from the package. If your setup ignores CSS innode_modules, addimport 'getjacked-components/style.css'once in your app entry. Tokens live on:root/[data-gj-theme]. - Wrap your app (or a subtree) with
ThemeProviderfor light / dark / system anddata-gj-themeon the provider root.
Scripts (library repo)
| Script | Description |
| ------------------- | ------------------------------------ |
| npm run dev | vite build --watch for local linking |
| npm run build | Typecheck + library bundle + .d.ts |
| npm run test | Vitest |
| npm run lint | ESLint |
| npm run storybook | Component docs at localhost:6006 |
Publishing to npm
- Login:
npm login - Version (pick one):
npm version patch— bug fixesnpm version minor— new features, backwards compatiblenpm version major— breaking changes
This updatespackage.json/package-lock.jsonand creates a git tag if the repo is initialized.
- Publish:
npm publish --access publicprepackrunsnpm run build(sodist/exists in the tarball).prepublishOnlyrunsnpm run test.
Scoped name example: rename name in package.json to @your-scope/getjacked-components and publish with --access public for a public scope.
Consuming from a local folder
In your app:
"dependencies": {
"getjacked-components": "file:../path/to/getjacked-components"
}Installing from file: runs prepack in this package, which runs npm run build so dist/ is included. If you ever pack without scripts (or use an old npm), run npm run build in the library once, then npm install in the app.
If node_modules/getjacked-components only has package.json: the published/packed tarball had no dist/ folder. This repo’s files field only ships dist and README.md — there is no source on npm. Fix: ensure prepack runs (normal npm install / npm publish), or run npm run build manually before packing.
Git URL installs (github:...): npm clones the repo and installs dependencies; prepack runs when the dependency is packed. You need a lockfile/install that actually executes lifecycle scripts (and devDependencies available for the build).
See examples/consumer-app for a minimal Vite + React consumer.
Theming
- Override CSS variables (e.g.
--gj-color-primary) on:rootor on a wrapper with[data-gj-theme='light']/[data-gj-theme='dark']. - Use
ThemeProvidermode/defaultMode:'light' | 'dark' | 'system', anduseTheme()forresolved,setMode, andtoggle.
Tailwind (optional)
This package uses CSS Modules + variables so it stays framework-agnostic. In a Tailwind app, you can still pass className on components to layer utility classes.
License
MIT
