.
This commit is contained in:
parent
416f1367aa
commit
08b2ecaf78
9
.vscode/settings.json
vendored
9
.vscode/settings.json
vendored
@ -5,12 +5,17 @@
|
||||
}
|
||||
],
|
||||
|
||||
"typescript.preferences.importModuleSpecifier": "shortest",
|
||||
"javascript.preferences.importModuleSpecifier": "shortest",
|
||||
// Javascript and TypeScript settings
|
||||
"javascript.suggest.enabled": true,
|
||||
"javascript.suggest.autoImports": true,
|
||||
"javascript.preferences.importModuleSpecifier": "shortest",
|
||||
|
||||
"typescript.suggest.enabled": true,
|
||||
"typescript.suggest.autoImports": true,
|
||||
"typescript.suggest.completeFunctionCalls": true,
|
||||
"typescript.suggest.includeAutomaticOptionalChainCompletions": true,
|
||||
"typescript.suggestionActions.enabled": true,
|
||||
"typescript.preferences.importModuleSpecifier": "shortest",
|
||||
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.organizeImports": "explicit",
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import config from "@repo/eslint-config/index.js";
|
||||
import config from "@repo/eslint-config/server.js";
|
||||
|
||||
/** @type {import("eslint").Linter.FlatConfig} */
|
||||
export default [
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
import { viteConfig } from "@repo/eslint-config/vite";
|
||||
|
||||
/** @type {import("eslint").Linter.Config} */
|
||||
module.exports = {
|
||||
root: true,
|
||||
extends: ["@repo/eslint-config/vite.js"],
|
||||
};
|
||||
export default viteConfig;
|
||||
|
||||
@ -1,13 +1,19 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Vite + React</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/main.tsx"></script>
|
||||
</body>
|
||||
</html>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="robots" content="noindex, nofollow" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<link href="https://fonts.upset.dev/css2?family=Poppins&display=swap" rel="stylesheet" />
|
||||
<title>FactuGES 2025</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
<div id="factuges"></div>
|
||||
<script type="module" src="/src/main.tsx"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@ -4,10 +4,11 @@
|
||||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev-disabled": "vite --clearScreen false",
|
||||
"build-disabled": "tsc && vite build",
|
||||
"dev": "vite --clearScreen false",
|
||||
"build": "tsc && vite build",
|
||||
"preview": "vite preview",
|
||||
"lint": "eslint \"src/**/*.ts\""
|
||||
"lint": "eslint \"src/**/*.ts\"",
|
||||
"clean": "rm -rf dist && rm -rf node_modules"
|
||||
},
|
||||
"dependencies": {
|
||||
"@repo/ui": "workspace:*",
|
||||
@ -18,10 +19,11 @@
|
||||
"@repo/eslint-config": "workspace:*",
|
||||
"@repo/typescript-config": "workspace:*",
|
||||
"@types/react": "^19.1.2",
|
||||
"@types/react-dom": "^19.1.2",
|
||||
"@types/react-dom": "^19.1.3",
|
||||
"@vitejs/plugin-react": "^4.4.1",
|
||||
"eslint": "^9.25.1",
|
||||
"typescript": "5.8.3",
|
||||
"vite": "^6.3.3"
|
||||
"globals": "^16.0.0",
|
||||
"typescript": "~5.8.3",
|
||||
"typescript-eslint": "^8.31.1",
|
||||
"vite": "^6.3.4"
|
||||
}
|
||||
}
|
||||
|
||||
1
apps/web/postcss.config.mjs
Normal file
1
apps/web/postcss.config.mjs
Normal file
@ -0,0 +1 @@
|
||||
export { default } from "@repo/ui/postcss.config";
|
||||
20
apps/web/src/App.tsx
Normal file
20
apps/web/src/App.tsx
Normal file
@ -0,0 +1,20 @@
|
||||
import { Button } from "@repo/ui/components/button";
|
||||
import { useState } from "react";
|
||||
|
||||
import "@repo/ui/globals.css";
|
||||
|
||||
function App() {
|
||||
const [count, setCount] = useState(0);
|
||||
|
||||
return (
|
||||
<div className='container mx-auto p-4'>
|
||||
<h1 className='text-xl font-bold mb-2'>This is a Vite application</h1>
|
||||
<p className='mb-4'>
|
||||
This shadcn/ui button is shared between Vite, NextJS and any other application.
|
||||
</p>
|
||||
<Button onClick={() => setCount((count) => count + 1)}>Count is {count}</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default App;
|
||||
2
apps/web/src/main.d.ts
vendored
2
apps/web/src/main.d.ts
vendored
@ -1,2 +0,0 @@
|
||||
import "./style.css";
|
||||
//# sourceMappingURL=main.d.ts.map
|
||||
@ -1 +0,0 @@
|
||||
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["main.tsx"],"names":[],"mappings":"AACA,OAAO,aAAa,CAAC"}
|
||||
@ -1,7 +0,0 @@
|
||||
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import "./style.css";
|
||||
import typescriptLogo from "/typescript.svg";
|
||||
import { Header, Counter } from "@repo/ui";
|
||||
var App = function () { return (_jsxs("div", { children: [_jsx("a", { href: "https://vitejs.dev", target: "_blank", children: _jsx("img", { src: "/vite.svg", className: "logo", alt: "Vite logo" }) }), _jsx("a", { href: "https://www.typescriptlang.org/", target: "_blank", children: _jsx("img", { src: typescriptLogo, className: "logo vanilla", alt: "TypeScript logo" }) }), _jsx(Header, { title: "Web" }), _jsx("div", { className: "card", children: _jsx(Counter, {}) })] })); };
|
||||
createRoot(document.getElementById("app")).render(_jsx(App, {}));
|
||||
@ -1,25 +1,9 @@
|
||||
import { StrictMode } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import "./style.css";
|
||||
import typescriptLogo from "/typescript.svg";
|
||||
import { Header, Counter } from "@repo/ui";
|
||||
import App from "./App.tsx";
|
||||
|
||||
const App = () => (
|
||||
<div>
|
||||
<a href="https://vitejs.dev" target="_blank">
|
||||
<img src="/vite.svg" className="logo" alt="Vite logo" />
|
||||
</a>
|
||||
<a href="https://www.typescriptlang.org/" target="_blank">
|
||||
<img
|
||||
src={typescriptLogo}
|
||||
className="logo vanilla"
|
||||
alt="TypeScript logo"
|
||||
/>
|
||||
</a>
|
||||
<Header title="Web" />
|
||||
<div className="card">
|
||||
<Counter />
|
||||
</div>
|
||||
</div>
|
||||
createRoot(document.getElementById("factuges")!).render(
|
||||
<StrictMode>
|
||||
<App />
|
||||
</StrictMode>
|
||||
);
|
||||
|
||||
createRoot(document.getElementById("app")!).render(<App />);
|
||||
|
||||
@ -1,97 +0,0 @@
|
||||
:root {
|
||||
font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
|
||||
font-size: 16px;
|
||||
line-height: 24px;
|
||||
font-weight: 400;
|
||||
|
||||
color-scheme: light dark;
|
||||
color: rgba(255, 255, 255, 0.87);
|
||||
background-color: #242424;
|
||||
|
||||
font-synthesis: none;
|
||||
text-rendering: optimizeLegibility;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
-webkit-text-size-adjust: 100%;
|
||||
}
|
||||
|
||||
a {
|
||||
font-weight: 500;
|
||||
color: #646cff;
|
||||
text-decoration: inherit;
|
||||
}
|
||||
a:hover {
|
||||
color: #535bf2;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
display: flex;
|
||||
place-items: center;
|
||||
min-width: 320px;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 3.2em;
|
||||
line-height: 1.1;
|
||||
}
|
||||
|
||||
#app {
|
||||
max-width: 1280px;
|
||||
margin: 0 auto;
|
||||
padding: 2rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.logo {
|
||||
height: 6em;
|
||||
padding: 1.5em;
|
||||
will-change: filter;
|
||||
}
|
||||
.logo:hover {
|
||||
filter: drop-shadow(0 0 2em #646cffaa);
|
||||
}
|
||||
.logo.vanilla:hover {
|
||||
filter: drop-shadow(0 0 2em #f7df1eaa);
|
||||
}
|
||||
|
||||
.card {
|
||||
padding: 2em;
|
||||
}
|
||||
|
||||
.read-the-docs {
|
||||
color: #888;
|
||||
}
|
||||
|
||||
button {
|
||||
border-radius: 8px;
|
||||
border: 1px solid transparent;
|
||||
padding: 0.6em 1.2em;
|
||||
font-size: 1em;
|
||||
font-weight: 500;
|
||||
font-family: inherit;
|
||||
background-color: #1a1a1a;
|
||||
cursor: pointer;
|
||||
transition: border-color 0.25s;
|
||||
}
|
||||
button:hover {
|
||||
border-color: #646cff;
|
||||
}
|
||||
button:focus,
|
||||
button:focus-visible {
|
||||
outline: 4px auto -webkit-focus-ring-color;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: light) {
|
||||
:root {
|
||||
color: #213547;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
a:hover {
|
||||
color: #747bff;
|
||||
}
|
||||
button {
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
}
|
||||
93
apps/web/tailwind.config.js
Normal file
93
apps/web/tailwind.config.js
Normal file
@ -0,0 +1,93 @@
|
||||
/** @type {import('tailwindcss').Config} */
|
||||
|
||||
import defaultTheme from "tailwindcss/defaultTheme";
|
||||
import plugin from "tailwindcss/plugin";
|
||||
|
||||
export default {
|
||||
darkMode: ["class"],
|
||||
content: ["./src/**/*.{js,ts,jsx,tsx,html}"],
|
||||
|
||||
theme: {
|
||||
container: {
|
||||
center: true,
|
||||
padding: "2rem",
|
||||
screens: {
|
||||
"2xl": "1400px",
|
||||
},
|
||||
},
|
||||
extend: {
|
||||
// https://tailwindcss.com/docs/font-family#font-families
|
||||
fontFamily: {
|
||||
sans: ['"Poppins"', ...defaultTheme.fontFamily.sans],
|
||||
},
|
||||
|
||||
/*fontFamily: {
|
||||
display: "Public Sans, ui-sans-serif",
|
||||
heading: "Noto Serif, ui-serif",
|
||||
},*/
|
||||
|
||||
colors: {
|
||||
border: "hsl(240, 5.9%, 90%)",
|
||||
input: "hsl(240, 5.9%, 90%)",
|
||||
ring: "hsl(346.8, 77.2%, 49.8%)",
|
||||
background: "hsl(0, 0%, 100%)",
|
||||
foreground: "hsl(240, 10%, 3.9%)",
|
||||
primary: {
|
||||
DEFAULT: "hsl(346.8, 77.2%, 49.8%)",
|
||||
foreground: "hsl(355.7, 100%, 97.3%)",
|
||||
},
|
||||
secondary: {
|
||||
DEFAULT: "hsl(240, 4.8%, 95.9%)",
|
||||
foreground: "hsl(240, 5.9%, 10%)",
|
||||
},
|
||||
destructive: {
|
||||
DEFAULT: "hsl(0, 84.2%, 60.2%)",
|
||||
foreground: "hsl(0, 0%, 98%)",
|
||||
},
|
||||
muted: {
|
||||
DEFAULT: "hsl(240, 4.8%, 95.9%)",
|
||||
foreground: "hsl(240, 3.8%, 46.1%)",
|
||||
},
|
||||
accent: {
|
||||
DEFAULT: "hsl(240, 4.8%, 95.9%)",
|
||||
foreground: "hsl(240, 5.9%, 10%)",
|
||||
},
|
||||
popover: {
|
||||
DEFAULT: "hsl(0, 0%, 100%)",
|
||||
foreground: "hsl(240, 10%, 3.9%)",
|
||||
},
|
||||
card: {
|
||||
DEFAULT: "hsl(0, 0%, 100%)",
|
||||
foreground: "hsl(240, 10%, 3.9%)",
|
||||
},
|
||||
},
|
||||
borderRadius: {
|
||||
lg: "0.3rem",
|
||||
md: "calc(0.3rem - 2px)",
|
||||
sm: "calc(0.3rem - 4px)",
|
||||
},
|
||||
keyframes: {
|
||||
"accordion-down": {
|
||||
from: { height: "0" },
|
||||
to: { height: "var(--radix-accordion-content-height)" },
|
||||
},
|
||||
"accordion-up": {
|
||||
from: { height: "var(--radix-accordion-content-height)" },
|
||||
to: { height: "0" },
|
||||
},
|
||||
},
|
||||
animation: {
|
||||
"accordion-down": "accordion-down 0.2s ease-out",
|
||||
"accordion-up": "accordion-up 0.2s ease-out",
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
require("tailwindcss-animate"),
|
||||
plugin(function ({ addBase }) {
|
||||
addBase({
|
||||
html: { fontSize: "16px" }, // 16px es el valor por defecto
|
||||
});
|
||||
}),
|
||||
],
|
||||
};
|
||||
26
apps/web/tsconfig.app.json
Normal file
26
apps/web/tsconfig.app.json
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
||||
"target": "ES2020",
|
||||
"useDefineForClassFields": true,
|
||||
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
||||
"module": "ESNext",
|
||||
"skipLibCheck": true,
|
||||
|
||||
/* Bundler mode */
|
||||
"moduleResolution": "bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
"isolatedModules": true,
|
||||
"moduleDetection": "force",
|
||||
"noEmit": true,
|
||||
"jsx": "react-jsx",
|
||||
|
||||
/* Linting */
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noUncheckedSideEffectImports": true
|
||||
},
|
||||
"include": ["src"]
|
||||
}
|
||||
@ -1,7 +1,4 @@
|
||||
{
|
||||
"extends": "@repo/typescript-config/vite.json",
|
||||
"include": ["src"],
|
||||
"compilerOptions": {
|
||||
"jsx": "react-jsx"
|
||||
}
|
||||
}
|
||||
"files": [],
|
||||
"references": [{ "path": "./tsconfig.app.json" }, { "path": "./tsconfig.node.json" }]
|
||||
}
|
||||
|
||||
24
apps/web/tsconfig.node.json
Normal file
24
apps/web/tsconfig.node.json
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
||||
"target": "ES2022",
|
||||
"lib": ["ES2023"],
|
||||
"module": "ESNext",
|
||||
"skipLibCheck": true,
|
||||
|
||||
/* Bundler mode */
|
||||
"moduleResolution": "bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
"isolatedModules": true,
|
||||
"moduleDetection": "force",
|
||||
"noEmit": true,
|
||||
|
||||
/* Linting */
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noUncheckedSideEffectImports": true
|
||||
},
|
||||
"include": ["vite.config.ts"]
|
||||
}
|
||||
@ -10,7 +10,8 @@
|
||||
"clean": "turbo run clean && rm -rf node_modules",
|
||||
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
|
||||
"lint": "turbo run lint",
|
||||
"test": "turbo run test"
|
||||
"test": "turbo run test",
|
||||
"ui": "pnpm --filter @repo/ui ui"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^9.25.1",
|
||||
|
||||
@ -1,8 +1,11 @@
|
||||
const { rules } = require("eslint-config-prettier");
|
||||
|
||||
module.exports = {
|
||||
extends: ["eslint:recommended"],
|
||||
parser: "@typescript-eslint/parser",
|
||||
plugins: ["@typescript-eslint", "sort-class-members"],
|
||||
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"],
|
||||
env: {
|
||||
browser: false,
|
||||
node: true,
|
||||
es6: true,
|
||||
},
|
||||
@ -19,6 +22,32 @@ module.exports = {
|
||||
},
|
||||
],
|
||||
rules: {
|
||||
"@typescript-eslint/no-explicit-any": "off",
|
||||
"@typescript-eslint/no-inferrable-types": "off",
|
||||
"@typescript-eslint/no-empty-interface": "off",
|
||||
"@typescript-eslint/recommended-requiring-type-checking": "off",
|
||||
"@typescript-eslint/no-unused-vars": "warn",
|
||||
"lines-between-class-members": ["error", "always", { exceptAfterSingleLine: true }],
|
||||
|
||||
"sort-class-members/sort-class-members": [
|
||||
2,
|
||||
{
|
||||
order: [
|
||||
"[static-properties]",
|
||||
"[static-methods]",
|
||||
"[conventional-private-properties]",
|
||||
"[properties]",
|
||||
"constructor",
|
||||
"[methods]",
|
||||
"[conventional-private-methods]",
|
||||
],
|
||||
accessorPairPositioning: "getThenSet",
|
||||
},
|
||||
],
|
||||
"@typescript-eslint/no-unused-vars": [
|
||||
"warn",
|
||||
{ argsIgnorePattern: "^_", varsIgnorePattern: "^T$" },
|
||||
],
|
||||
"import/no-relative-parent-imports": "error",
|
||||
"import/order": [
|
||||
"error",
|
||||
|
||||
@ -1 +1,2 @@
|
||||
// @ts-expect-error: T is intentionally unused in this interface
|
||||
export interface IAggregateRootRepository<T> {}
|
||||
|
||||
@ -93,7 +93,7 @@ export class DomainEvents {
|
||||
if (!this.handlersMap.hasOwnProperty(eventClassName)) {
|
||||
this.handlersMap[eventClassName] = [];
|
||||
}
|
||||
this.handlersMap[eventClassName].push(callback);
|
||||
this.handlersMap[eventClassName]?.push(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -126,9 +126,11 @@ export class DomainEvents {
|
||||
const eventClassName: string = event.constructor.name;
|
||||
|
||||
if (this.handlersMap.hasOwnProperty(eventClassName)) {
|
||||
const handlers: any[] = this.handlersMap[eventClassName];
|
||||
for (let handler of handlers) {
|
||||
handler(event);
|
||||
const handlers = this.handlersMap[eventClassName];
|
||||
if (handlers) {
|
||||
for (let handler of handlers) {
|
||||
handler(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -45,7 +45,7 @@ export class Quantity extends ValueObject<IQuantityProps> implements IQuantity {
|
||||
const checkProps = Quantity.validate(props);
|
||||
|
||||
if (!checkProps.success) {
|
||||
return Result.fail(new Error(checkProps.error.errors[0].message));
|
||||
return Result.fail(new Error(checkProps.error?.errors[0]?.message));
|
||||
}
|
||||
return Result.ok(new Quantity({ ...checkProps.data! }));
|
||||
}
|
||||
|
||||
@ -26,7 +26,7 @@ export class Slug extends ValueObject<SlugProps> {
|
||||
const valueIsValid = Slug.validate(value);
|
||||
|
||||
if (!valueIsValid.success) {
|
||||
return Result.fail(new Error(valueIsValid.error.errors[0].message));
|
||||
return Result.fail(new Error(valueIsValid.error?.errors[0]?.message));
|
||||
}
|
||||
return Result.ok(new Slug({ value: valueIsValid.data! }));
|
||||
}
|
||||
|
||||
@ -68,6 +68,7 @@ export abstract class SequelizeMapper<
|
||||
return source.map((value, index) => this.mapToPersistence(value, { index, ...params }));
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
protected safeMap<T>(operation: () => T, key: string): Result<T, Error> {
|
||||
try {
|
||||
return Result.ok(operation());
|
||||
|
||||
@ -5,6 +5,7 @@ import { ApiError } from "./api-error";
|
||||
|
||||
export const validateAndParseBody =
|
||||
(schema: ZodSchema, options?: { sanitize?: boolean }) =>
|
||||
// @ts-ignore
|
||||
(req: Request, res: Response, next: NextFunction) => {
|
||||
const result = schema.safeParse(req.body);
|
||||
try {
|
||||
|
||||
@ -1,20 +1,25 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/tsconfig",
|
||||
"display": "Default",
|
||||
"compilerOptions": {
|
||||
"composite": false,
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"esModuleInterop": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"incremental": false,
|
||||
"inlineSources": false,
|
||||
"isolatedModules": true,
|
||||
"moduleResolution": "node",
|
||||
"noUnusedLocals": false,
|
||||
"noUnusedParameters": false,
|
||||
"preserveWatchOutput": true,
|
||||
"lib": ["es2022", "DOM", "DOM.Iterable"],
|
||||
"module": "NodeNext",
|
||||
"moduleDetection": "force",
|
||||
"moduleResolution": "NodeNext",
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"noUncheckedIndexedAccess": false,
|
||||
"resolveJsonModule": true,
|
||||
"skipLibCheck": true,
|
||||
"strict": true,
|
||||
"sourceMap": true
|
||||
"target": "ES2022"
|
||||
},
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/tsconfig",
|
||||
"display": "React Library",
|
||||
"extends": "./base.json",
|
||||
"compilerOptions": {
|
||||
"jsx": "react-jsx"
|
||||
|
||||
20
packages/ui/components.json
Normal file
20
packages/ui/components.json
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"$schema": "https://ui.shadcn.com/schema.json",
|
||||
"style": "new-york",
|
||||
"rsc": true,
|
||||
"tsx": true,
|
||||
"tailwind": {
|
||||
"config": "",
|
||||
"css": "src/styles/globals.css",
|
||||
"baseColor": "neutral",
|
||||
"cssVariables": true
|
||||
},
|
||||
"iconLibrary": "lucide",
|
||||
"aliases": {
|
||||
"components": "@repo/ui/components",
|
||||
"utils": "@repo/ui/lib/utils",
|
||||
"hooks": "@repo/ui/hooks",
|
||||
"lib": "@repo/ui/lib",
|
||||
"ui": "@repo/ui/components"
|
||||
}
|
||||
}
|
||||
@ -1,11 +0,0 @@
|
||||
import React, { useState } from "react";
|
||||
|
||||
export const Counter: React.FC = () => {
|
||||
const [count, setCount] = useState(0);
|
||||
|
||||
return (
|
||||
<button id="counter" type="button" onClick={() => setCount(count + 1)}>
|
||||
{count}
|
||||
</button>
|
||||
);
|
||||
};
|
||||
@ -1,13 +0,0 @@
|
||||
import React from "react";
|
||||
|
||||
interface HeaderProps {
|
||||
title: string;
|
||||
}
|
||||
|
||||
export const Header: React.FC<HeaderProps> = ({ title }) => {
|
||||
return (
|
||||
<header id="header">
|
||||
<h1>{title}</h1>
|
||||
</header>
|
||||
);
|
||||
};
|
||||
@ -1,2 +0,0 @@
|
||||
export * from "./header";
|
||||
export * from "./counter";
|
||||
4
packages/ui/eslint.config.js
Normal file
4
packages/ui/eslint.config.js
Normal file
@ -0,0 +1,4 @@
|
||||
import { config } from "@repo/eslint-config/react-internal";
|
||||
|
||||
/** @type {import("eslint").Linter.Config} */
|
||||
export default config;
|
||||
@ -1,2 +0,0 @@
|
||||
// components
|
||||
export * from "./components";
|
||||
@ -1,27 +1,40 @@
|
||||
{
|
||||
"name": "@repo/ui",
|
||||
"version": "0.0.0",
|
||||
"exports": {
|
||||
".": "./index.ts",
|
||||
"./counter": "./components/counter.ts",
|
||||
"./header": "./components/header.ts",
|
||||
"./setup-counter": "./utils/counter.ts"
|
||||
},
|
||||
"license": "MIT",
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"clean": "rm -rf node_modules",
|
||||
"lint": "eslint \"**/*.ts\""
|
||||
"lint": "eslint . --max-warnings 0",
|
||||
"ui": "pnpm dlx shadcn@latest add"
|
||||
},
|
||||
"dependencies": {
|
||||
"@radix-ui/react-slot": "^1.2.0",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"clsx": "^2.1.1",
|
||||
"lucide-react": "^0.503.0",
|
||||
"next-themes": "^0.4.6",
|
||||
"react": "^19.1.0",
|
||||
"react-dom": "^19.1.0"
|
||||
"react-dom": "^19.1.0",
|
||||
"tailwind-merge": "^3.2.0",
|
||||
"tw-animate-css": "^1.2.8",
|
||||
"zod": "^3.24.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@repo/eslint-config": "workspace:*",
|
||||
"@repo/typescript-config": "workspace:*",
|
||||
"@tailwindcss/postcss": "^4.1.5",
|
||||
"@turbo/gen": "^2.5.2",
|
||||
"@types/node": "^22.15.3",
|
||||
"@types/react": "^19.1.2",
|
||||
"@types/react-dom": "^19.1.2",
|
||||
"eslint": "^9.25.1",
|
||||
"typescript": "5.8.3"
|
||||
"@types/react-dom": "^19.1.3",
|
||||
"tailwindcss": "^4.1.5",
|
||||
"typescript": "^5.8.3"
|
||||
},
|
||||
"exports": {
|
||||
"./globals.css": "./src/styles/globals.css",
|
||||
"./postcss.config": "./postcss.config.mjs",
|
||||
"./lib/*": "./src/lib/*.ts",
|
||||
"./components/*": "./src/components/*.tsx",
|
||||
"./hooks/*": "./src/hooks/*.ts"
|
||||
}
|
||||
}
|
||||
|
||||
6
packages/ui/postcss.config.mjs
Normal file
6
packages/ui/postcss.config.mjs
Normal file
@ -0,0 +1,6 @@
|
||||
/** @type {import('postcss-load-config').Config} */
|
||||
const config = {
|
||||
plugins: { "@tailwindcss/postcss": {} },
|
||||
};
|
||||
|
||||
export default config;
|
||||
56
packages/ui/src/components/button.tsx
Normal file
56
packages/ui/src/components/button.tsx
Normal file
@ -0,0 +1,56 @@
|
||||
import { Slot } from "@radix-ui/react-slot";
|
||||
import { cva, type VariantProps } from "class-variance-authority";
|
||||
import * as React from "react";
|
||||
|
||||
import { cn } from "@repo/ui/lib/utils";
|
||||
|
||||
const buttonVariants = cva(
|
||||
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-[color,box-shadow] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
||||
{
|
||||
variants: {
|
||||
variant: {
|
||||
default: "bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",
|
||||
destructive:
|
||||
"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40",
|
||||
outline:
|
||||
"border border-input bg-background shadow-xs hover:bg-accent hover:text-accent-foreground",
|
||||
secondary: "bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
|
||||
ghost: "hover:bg-accent hover:text-accent-foreground",
|
||||
link: "text-primary underline-offset-4 hover:underline",
|
||||
},
|
||||
size: {
|
||||
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
||||
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
||||
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
||||
icon: "size-9",
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
variant: "default",
|
||||
size: "default",
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
function Button({
|
||||
className,
|
||||
variant,
|
||||
size,
|
||||
asChild = false,
|
||||
...props
|
||||
}: React.ComponentProps<"button"> &
|
||||
VariantProps<typeof buttonVariants> & {
|
||||
asChild?: boolean;
|
||||
}) {
|
||||
const Comp = asChild ? Slot : "button";
|
||||
|
||||
return (
|
||||
<Comp
|
||||
data-slot='button'
|
||||
className={cn(buttonVariants({ variant, size, className }))}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export { Button, buttonVariants };
|
||||
6
packages/ui/src/lib/utils.ts
Normal file
6
packages/ui/src/lib/utils.ts
Normal file
@ -0,0 +1,6 @@
|
||||
import { clsx, type ClassValue } from "clsx";
|
||||
import { twMerge } from "tailwind-merge";
|
||||
|
||||
export function cn(...inputs: ClassValue[]) {
|
||||
return twMerge(clsx(inputs));
|
||||
}
|
||||
128
packages/ui/src/styles/globals.css
Normal file
128
packages/ui/src/styles/globals.css
Normal file
@ -0,0 +1,128 @@
|
||||
@import "tailwindcss";
|
||||
@import "tw-animate-css";
|
||||
|
||||
@source "../../../apps/**/*.{ts,tsx}";
|
||||
@source "../../../modules/**/*.{ts,tsx}";
|
||||
@source "../../../components/**/*.{ts,tsx}";
|
||||
@source "../**/*.{ts,tsx}";
|
||||
|
||||
@custom-variant dark (&:is(.dark *));
|
||||
|
||||
:root {
|
||||
--background: oklch(1 0 0);
|
||||
--foreground: oklch(0.145 0 0);
|
||||
--card: oklch(1 0 0);
|
||||
--card-foreground: oklch(0.145 0 0);
|
||||
--popover: oklch(1 0 0);
|
||||
--popover-foreground: oklch(0.145 0 0);
|
||||
--primary: oklch(0.205 0 0);
|
||||
--primary-foreground: oklch(0.985 0 0);
|
||||
--secondary: oklch(0.97 0 0);
|
||||
--secondary-foreground: oklch(0.205 0 0);
|
||||
--muted: oklch(0.97 0 0);
|
||||
--muted-foreground: oklch(0.556 0 0);
|
||||
--accent: oklch(0.97 0 0);
|
||||
--accent-foreground: oklch(0.205 0 0);
|
||||
--destructive: oklch(0.577 0.245 27.325);
|
||||
--destructive-foreground: oklch(0.577 0.245 27.325);
|
||||
--border: oklch(0.922 0 0);
|
||||
--input: oklch(0.922 0 0);
|
||||
--ring: oklch(0.708 0 0);
|
||||
--chart-1: oklch(0.646 0.222 41.116);
|
||||
--chart-2: oklch(0.6 0.118 184.704);
|
||||
--chart-3: oklch(0.398 0.07 227.392);
|
||||
--chart-4: oklch(0.828 0.189 84.429);
|
||||
--chart-5: oklch(0.769 0.188 70.08);
|
||||
--radius: 0.625rem;
|
||||
--sidebar: oklch(0.985 0 0);
|
||||
--sidebar-foreground: oklch(0.145 0 0);
|
||||
--sidebar-primary: oklch(0.205 0 0);
|
||||
--sidebar-primary-foreground: oklch(0.985 0 0);
|
||||
--sidebar-accent: oklch(0.97 0 0);
|
||||
--sidebar-accent-foreground: oklch(0.205 0 0);
|
||||
--sidebar-border: oklch(0.922 0 0);
|
||||
--sidebar-ring: oklch(0.708 0 0);
|
||||
}
|
||||
|
||||
.dark {
|
||||
--background: oklch(0.145 0 0);
|
||||
--foreground: oklch(0.985 0 0);
|
||||
--card: oklch(0.145 0 0);
|
||||
--card-foreground: oklch(0.985 0 0);
|
||||
--popover: oklch(0.145 0 0);
|
||||
--popover-foreground: oklch(0.985 0 0);
|
||||
--primary: oklch(0.985 0 0);
|
||||
--primary-foreground: oklch(0.205 0 0);
|
||||
--secondary: oklch(0.269 0 0);
|
||||
--secondary-foreground: oklch(0.985 0 0);
|
||||
--muted: oklch(0.269 0 0);
|
||||
--muted-foreground: oklch(0.708 0 0);
|
||||
--accent: oklch(0.269 0 0);
|
||||
--accent-foreground: oklch(0.985 0 0);
|
||||
--destructive: oklch(0.396 0.141 25.723);
|
||||
--destructive-foreground: oklch(0.637 0.237 25.331);
|
||||
--border: oklch(0.269 0 0);
|
||||
--input: oklch(0.269 0 0);
|
||||
--ring: oklch(0.556 0 0);
|
||||
--chart-1: oklch(0.488 0.243 264.376);
|
||||
--chart-2: oklch(0.696 0.17 162.48);
|
||||
--chart-3: oklch(0.769 0.188 70.08);
|
||||
--chart-4: oklch(0.627 0.265 303.9);
|
||||
--chart-5: oklch(0.645 0.246 16.439);
|
||||
--sidebar: oklch(0.205 0 0);
|
||||
--sidebar-foreground: oklch(0.985 0 0);
|
||||
--sidebar-primary: oklch(0.488 0.243 264.376);
|
||||
--sidebar-primary-foreground: oklch(0.985 0 0);
|
||||
--sidebar-accent: oklch(0.269 0 0);
|
||||
--sidebar-accent-foreground: oklch(0.985 0 0);
|
||||
--sidebar-border: oklch(0.269 0 0);
|
||||
--sidebar-ring: oklch(0.439 0 0);
|
||||
}
|
||||
|
||||
@theme inline {
|
||||
--color-background: var(--background);
|
||||
--color-foreground: var(--foreground);
|
||||
--color-card: var(--card);
|
||||
--color-card-foreground: var(--card-foreground);
|
||||
--color-popover: var(--popover);
|
||||
--color-popover-foreground: var(--popover-foreground);
|
||||
--color-primary: var(--primary);
|
||||
--color-primary-foreground: var(--primary-foreground);
|
||||
--color-secondary: var(--secondary);
|
||||
--color-secondary-foreground: var(--secondary-foreground);
|
||||
--color-muted: var(--muted);
|
||||
--color-muted-foreground: var(--muted-foreground);
|
||||
--color-accent: var(--accent);
|
||||
--color-accent-foreground: var(--accent-foreground);
|
||||
--color-destructive: var(--destructive);
|
||||
--color-destructive-foreground: var(--destructive-foreground);
|
||||
--color-border: var(--border);
|
||||
--color-input: var(--input);
|
||||
--color-ring: var(--ring);
|
||||
--color-chart-1: var(--chart-1);
|
||||
--color-chart-2: var(--chart-2);
|
||||
--color-chart-3: var(--chart-3);
|
||||
--color-chart-4: var(--chart-4);
|
||||
--color-chart-5: var(--chart-5);
|
||||
--radius-sm: calc(var(--radius) - 4px);
|
||||
--radius-md: calc(var(--radius) - 2px);
|
||||
--radius-lg: var(--radius);
|
||||
--radius-xl: calc(var(--radius) + 4px);
|
||||
--color-sidebar: var(--sidebar);
|
||||
--color-sidebar-foreground: var(--sidebar-foreground);
|
||||
--color-sidebar-primary: var(--sidebar-primary);
|
||||
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
||||
--color-sidebar-accent: var(--sidebar-accent);
|
||||
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
||||
--color-sidebar-border: var(--sidebar-border);
|
||||
--color-sidebar-ring: var(--sidebar-ring);
|
||||
}
|
||||
|
||||
@layer base {
|
||||
* {
|
||||
@apply border-border outline-ring/50;
|
||||
}
|
||||
body {
|
||||
@apply bg-background text-foreground;
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,11 @@
|
||||
{
|
||||
"extends": "@repo/typescript-config/react-library.json",
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@repo/ui/*": ["./src/*"]
|
||||
}
|
||||
},
|
||||
"include": ["."],
|
||||
"exclude": ["node_modules"]
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
||||
|
||||
8
packages/ui/tsconfig.lint.json
Normal file
8
packages/ui/tsconfig.lint.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "@repo/typescript-config/react-library.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "dist"
|
||||
},
|
||||
"include": ["src", "turbo"],
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
||||
1965
pnpm-lock.yaml
1965
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user