@t7blocks/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/.turbo/turbo-build.log +22 -0
- package/RULES.md +104 -0
- package/dist/index.d.mts +11 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +70 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +43 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +29 -0
- package/src/components/button/button-1/Button1.tsx +50 -0
- package/src/components/button/button-1/index.ts +1 -0
- package/src/index.ts +4 -0
- package/src/types/index.ts +1 -0
- package/tsconfig.json +8 -0
- package/tsup.config.ts +10 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
|
|
2
|
+
> @t7blocks/ui@0.0.1 build C:\Users\singh\Desktop\Dev\T7blocks\packages\ui
|
|
3
|
+
> tsup
|
|
4
|
+
|
|
5
|
+
[34mCLI[39m Building entry: src/index.ts
|
|
6
|
+
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
7
|
+
[34mCLI[39m tsup v8.5.1
|
|
8
|
+
[34mCLI[39m Using tsup config: C:\Users\singh\Desktop\Dev\T7blocks\packages\ui\tsup.config.ts
|
|
9
|
+
[34mCLI[39m Target: es2020
|
|
10
|
+
[34mCLI[39m Cleaning output folder
|
|
11
|
+
[34mCJS[39m Build start
|
|
12
|
+
[34mESM[39m Build start
|
|
13
|
+
[32mESM[39m [1mdist\index.mjs [22m[32m1.08 KB[39m
|
|
14
|
+
[32mESM[39m [1mdist\index.mjs.map [22m[32m2.13 KB[39m
|
|
15
|
+
[32mESM[39m ⚡️ Build success in 54ms
|
|
16
|
+
[32mCJS[39m [1mdist\index.js [22m[32m2.17 KB[39m
|
|
17
|
+
[32mCJS[39m [1mdist\index.js.map [22m[32m2.36 KB[39m
|
|
18
|
+
[32mCJS[39m ⚡️ Build success in 55ms
|
|
19
|
+
[34mDTS[39m Build start
|
|
20
|
+
[32mDTS[39m ⚡️ Build success in 1666ms
|
|
21
|
+
[32mDTS[39m [1mdist\index.d.ts [22m[32m326.00 B[39m
|
|
22
|
+
[32mDTS[39m [1mdist\index.d.mts [22m[32m326.00 B[39m
|
package/RULES.md
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# RULES.md — packages/ui
|
|
2
|
+
|
|
3
|
+
## What this package is
|
|
4
|
+
|
|
5
|
+
The **published npm package** `@t7blocks`. This is what users install.
|
|
6
|
+
It contains only free component source code. It is built with tsup and published to npm.
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Core Constraints
|
|
11
|
+
|
|
12
|
+
- Only free components live here. Premium components never enter this repo.
|
|
13
|
+
- Every export must be tree-shakeable — named exports only, no default exports from `index.ts`.
|
|
14
|
+
- This package has no runtime dependencies. Only peer dependencies.
|
|
15
|
+
- Peer dependencies: `react ^18`, and whatever animation library the component uses (e.g. `framer-motion`, `gsap`, `lenis`). Never bundle these.
|
|
16
|
+
- Never import from `apps/` — this package is standalone.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Folder Structure
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
src/
|
|
24
|
+
├── index.ts ← barrel export, only file to edit when adding a component
|
|
25
|
+
├── components/
|
|
26
|
+
│ └── [type]/ ← matches the category type in registry
|
|
27
|
+
│ └── [component-name]/
|
|
28
|
+
│ ├── [ComponentName].tsx ← component source
|
|
29
|
+
│ ├── [ComponentName].css ← scoped styles if needed (optional)
|
|
30
|
+
│ └── index.ts ← re-exports the component
|
|
31
|
+
└── types/
|
|
32
|
+
└── index.ts ← shared prop types
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Example for `button-1` in category `button`:
|
|
36
|
+
```
|
|
37
|
+
src/components/button/button-1/Button1.tsx
|
|
38
|
+
src/components/button/button-1/index.ts
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Adding a New Component — Exact Steps
|
|
44
|
+
|
|
45
|
+
1. Create the folder: `src/components/[type]/[component-name]/`
|
|
46
|
+
2. Write the component in `[ComponentName].tsx` — named export, typed props, no `any`
|
|
47
|
+
3. Create `index.ts` in that folder:
|
|
48
|
+
```ts
|
|
49
|
+
export { ComponentName } from './ComponentName';
|
|
50
|
+
```
|
|
51
|
+
4. Add the export to `src/index.ts`:
|
|
52
|
+
```ts
|
|
53
|
+
export { ComponentName } from './components/[type]/[component-name]';
|
|
54
|
+
```
|
|
55
|
+
5. If the component needs a peer dep, add it to `peerDependencies` in `package.json` — do not add it to `dependencies`
|
|
56
|
+
6. Rebuild: `pnpm turbo build --filter=@t7blocks/ui`
|
|
57
|
+
7. Confirm `dist/` updates with no errors
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Component Writing Rules
|
|
62
|
+
|
|
63
|
+
- Props interface must be explicitly typed — no implicit prop types.
|
|
64
|
+
- Always provide sensible defaults for every optional prop.
|
|
65
|
+
- Component file name: PascalCase matching the export name (`Button1.tsx`)
|
|
66
|
+
- Folder name: kebab-case matching the registry `name` (`button-1/`)
|
|
67
|
+
- No hardcoded colours — use CSS variables or accept colour as a prop.
|
|
68
|
+
- No side effects at module level (no `window` access outside `useEffect`).
|
|
69
|
+
- Animation libraries must be listed as peer deps and imported normally — never bundled.
|
|
70
|
+
- If a component needs a CSS file, scope all class names with a `t7-` prefix to avoid collisions with user styles.
|
|
71
|
+
- Components must work without any Tailwind — the user may not have it.
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## tsconfig Rules
|
|
76
|
+
|
|
77
|
+
- `tsconfig.json` extends `@t7blocks/typescript-config/base.json` — NOT `nextjs.json`
|
|
78
|
+
- Add `"jsx": "react-jsx"` manually in `compilerOptions`
|
|
79
|
+
- `"incremental"` must never appear in this tsconfig — it breaks tsup DTS build
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## package.json Rules
|
|
84
|
+
|
|
85
|
+
- In the `exports` field, `"types"` must come BEFORE `"import"` and `"require"`:
|
|
86
|
+
```json
|
|
87
|
+
".": {
|
|
88
|
+
"types": "./dist/index.d.ts",
|
|
89
|
+
"import": "./dist/index.mjs",
|
|
90
|
+
"require": "./dist/index.js"
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
- Bump the version in `package.json` before every `pnpm publish`
|
|
94
|
+
- Use semantic versioning: patch (0.0.x) for fixes, minor (0.x.0) for new components, major (x.0.0) for breaking changes
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## What Never Goes in This Package
|
|
99
|
+
|
|
100
|
+
- Premium component source code
|
|
101
|
+
- Demo UI (prop control cards, canvases)
|
|
102
|
+
- Documentation content (code block strings, prop tables)
|
|
103
|
+
- Any app-level code from `apps/`
|
|
104
|
+
- `devDependencies` listed as `dependencies` (keep the bundle clean)
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
interface Button1Props {
|
|
4
|
+
label?: string;
|
|
5
|
+
variant?: "primary" | "outline";
|
|
6
|
+
size?: "sm" | "md" | "lg";
|
|
7
|
+
onClick?: () => void;
|
|
8
|
+
}
|
|
9
|
+
declare function Button1({ label, variant, size, onClick, }: Button1Props): react_jsx_runtime.JSX.Element;
|
|
10
|
+
|
|
11
|
+
export { Button1 };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
interface Button1Props {
|
|
4
|
+
label?: string;
|
|
5
|
+
variant?: "primary" | "outline";
|
|
6
|
+
size?: "sm" | "md" | "lg";
|
|
7
|
+
onClick?: () => void;
|
|
8
|
+
}
|
|
9
|
+
declare function Button1({ label, variant, size, onClick, }: Button1Props): react_jsx_runtime.JSX.Element;
|
|
10
|
+
|
|
11
|
+
export { Button1 };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
Button1: () => Button1
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(index_exports);
|
|
26
|
+
|
|
27
|
+
// src/components/button/button-1/Button1.tsx
|
|
28
|
+
var import_framer_motion = require("framer-motion");
|
|
29
|
+
var import_react = require("react");
|
|
30
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
31
|
+
function Button1({
|
|
32
|
+
label = "Click me",
|
|
33
|
+
variant = "primary",
|
|
34
|
+
size = "md",
|
|
35
|
+
onClick
|
|
36
|
+
}) {
|
|
37
|
+
const ref = (0, import_react.useRef)(null);
|
|
38
|
+
const sizeMap = {
|
|
39
|
+
sm: { padding: "8px 20px", fontSize: "13px" },
|
|
40
|
+
md: { padding: "12px 28px", fontSize: "15px" },
|
|
41
|
+
lg: { padding: "16px 36px", fontSize: "17px" }
|
|
42
|
+
};
|
|
43
|
+
const isPrimary = variant === "primary";
|
|
44
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
45
|
+
import_framer_motion.motion.button,
|
|
46
|
+
{
|
|
47
|
+
ref,
|
|
48
|
+
onClick,
|
|
49
|
+
whileHover: { scale: 1.04 },
|
|
50
|
+
whileTap: { scale: 0.97 },
|
|
51
|
+
transition: { type: "spring", stiffness: 400, damping: 20 },
|
|
52
|
+
style: {
|
|
53
|
+
...sizeMap[size],
|
|
54
|
+
background: isPrimary ? "#000" : "transparent",
|
|
55
|
+
color: isPrimary ? "#fff" : "#000",
|
|
56
|
+
border: "1.5px solid #000",
|
|
57
|
+
borderRadius: "8px",
|
|
58
|
+
cursor: "pointer",
|
|
59
|
+
fontWeight: 500,
|
|
60
|
+
letterSpacing: "-0.01em"
|
|
61
|
+
},
|
|
62
|
+
children: label
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
67
|
+
0 && (module.exports = {
|
|
68
|
+
Button1
|
|
69
|
+
});
|
|
70
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/components/button/button-1/Button1.tsx"],"sourcesContent":["// free component exports go here\r\n// export { MagneticButton } from './components/button/MagneticButton';\r\n\r\nexport { Button1 } from './components/button/button-1';","\"use client\";\r\n\r\nimport { motion } from \"framer-motion\";\r\nimport { useRef } from \"react\";\r\n\r\ninterface Button1Props {\r\n label?: string;\r\n variant?: \"primary\" | \"outline\";\r\n size?: \"sm\" | \"md\" | \"lg\";\r\n onClick?: () => void;\r\n}\r\n\r\nexport function Button1({\r\n label = \"Click me\",\r\n variant = \"primary\",\r\n size = \"md\",\r\n onClick,\r\n}: Button1Props) {\r\n const ref = useRef<HTMLButtonElement>(null);\r\n\r\n const sizeMap = {\r\n sm: { padding: \"8px 20px\", fontSize: \"13px\" },\r\n md: { padding: \"12px 28px\", fontSize: \"15px\" },\r\n lg: { padding: \"16px 36px\", fontSize: \"17px\" },\r\n };\r\n\r\n const isPrimary = variant === \"primary\";\r\n\r\n return (\r\n <motion.button\r\n ref={ref}\r\n onClick={onClick}\r\n whileHover={{ scale: 1.04 }}\r\n whileTap={{ scale: 0.97 }}\r\n transition={{ type: \"spring\", stiffness: 400, damping: 20 }}\r\n style={{\r\n ...sizeMap[size],\r\n background: isPrimary ? \"#000\" : \"transparent\",\r\n color: isPrimary ? \"#fff\" : \"#000\",\r\n border: \"1.5px solid #000\",\r\n borderRadius: \"8px\",\r\n cursor: \"pointer\",\r\n fontWeight: 500,\r\n letterSpacing: \"-0.01em\",\r\n }}\r\n >\r\n {label}\r\n </motion.button>\r\n );\r\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEA,2BAAuB;AACvB,mBAAuB;AA0BnB;AAjBG,SAAS,QAAQ;AAAA,EACtB,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,OAAO;AAAA,EACP;AACF,GAAiB;AACf,QAAM,UAAM,qBAA0B,IAAI;AAE1C,QAAM,UAAU;AAAA,IACd,IAAI,EAAE,SAAS,YAAY,UAAU,OAAO;AAAA,IAC5C,IAAI,EAAE,SAAS,aAAa,UAAU,OAAO;AAAA,IAC7C,IAAI,EAAE,SAAS,aAAa,UAAU,OAAO;AAAA,EAC/C;AAEA,QAAM,YAAY,YAAY;AAE9B,SACE;AAAA,IAAC,4BAAO;AAAA,IAAP;AAAA,MACC;AAAA,MACA;AAAA,MACA,YAAY,EAAE,OAAO,KAAK;AAAA,MAC1B,UAAU,EAAE,OAAO,KAAK;AAAA,MACxB,YAAY,EAAE,MAAM,UAAU,WAAW,KAAK,SAAS,GAAG;AAAA,MAC1D,OAAO;AAAA,QACL,GAAG,QAAQ,IAAI;AAAA,QACf,YAAY,YAAY,SAAS;AAAA,QACjC,OAAO,YAAY,SAAS;AAAA,QAC5B,QAAQ;AAAA,QACR,cAAc;AAAA,QACd,QAAQ;AAAA,QACR,YAAY;AAAA,QACZ,eAAe;AAAA,MACjB;AAAA,MAEC;AAAA;AAAA,EACH;AAEJ;","names":[]}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// src/components/button/button-1/Button1.tsx
|
|
2
|
+
import { motion } from "framer-motion";
|
|
3
|
+
import { useRef } from "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
function Button1({
|
|
6
|
+
label = "Click me",
|
|
7
|
+
variant = "primary",
|
|
8
|
+
size = "md",
|
|
9
|
+
onClick
|
|
10
|
+
}) {
|
|
11
|
+
const ref = useRef(null);
|
|
12
|
+
const sizeMap = {
|
|
13
|
+
sm: { padding: "8px 20px", fontSize: "13px" },
|
|
14
|
+
md: { padding: "12px 28px", fontSize: "15px" },
|
|
15
|
+
lg: { padding: "16px 36px", fontSize: "17px" }
|
|
16
|
+
};
|
|
17
|
+
const isPrimary = variant === "primary";
|
|
18
|
+
return /* @__PURE__ */ jsx(
|
|
19
|
+
motion.button,
|
|
20
|
+
{
|
|
21
|
+
ref,
|
|
22
|
+
onClick,
|
|
23
|
+
whileHover: { scale: 1.04 },
|
|
24
|
+
whileTap: { scale: 0.97 },
|
|
25
|
+
transition: { type: "spring", stiffness: 400, damping: 20 },
|
|
26
|
+
style: {
|
|
27
|
+
...sizeMap[size],
|
|
28
|
+
background: isPrimary ? "#000" : "transparent",
|
|
29
|
+
color: isPrimary ? "#fff" : "#000",
|
|
30
|
+
border: "1.5px solid #000",
|
|
31
|
+
borderRadius: "8px",
|
|
32
|
+
cursor: "pointer",
|
|
33
|
+
fontWeight: 500,
|
|
34
|
+
letterSpacing: "-0.01em"
|
|
35
|
+
},
|
|
36
|
+
children: label
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
export {
|
|
41
|
+
Button1
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/button/button-1/Button1.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport { motion } from \"framer-motion\";\r\nimport { useRef } from \"react\";\r\n\r\ninterface Button1Props {\r\n label?: string;\r\n variant?: \"primary\" | \"outline\";\r\n size?: \"sm\" | \"md\" | \"lg\";\r\n onClick?: () => void;\r\n}\r\n\r\nexport function Button1({\r\n label = \"Click me\",\r\n variant = \"primary\",\r\n size = \"md\",\r\n onClick,\r\n}: Button1Props) {\r\n const ref = useRef<HTMLButtonElement>(null);\r\n\r\n const sizeMap = {\r\n sm: { padding: \"8px 20px\", fontSize: \"13px\" },\r\n md: { padding: \"12px 28px\", fontSize: \"15px\" },\r\n lg: { padding: \"16px 36px\", fontSize: \"17px\" },\r\n };\r\n\r\n const isPrimary = variant === \"primary\";\r\n\r\n return (\r\n <motion.button\r\n ref={ref}\r\n onClick={onClick}\r\n whileHover={{ scale: 1.04 }}\r\n whileTap={{ scale: 0.97 }}\r\n transition={{ type: \"spring\", stiffness: 400, damping: 20 }}\r\n style={{\r\n ...sizeMap[size],\r\n background: isPrimary ? \"#000\" : \"transparent\",\r\n color: isPrimary ? \"#fff\" : \"#000\",\r\n border: \"1.5px solid #000\",\r\n borderRadius: \"8px\",\r\n cursor: \"pointer\",\r\n fontWeight: 500,\r\n letterSpacing: \"-0.01em\",\r\n }}\r\n >\r\n {label}\r\n </motion.button>\r\n );\r\n}"],"mappings":";AAEA,SAAS,cAAc;AACvB,SAAS,cAAc;AA0BnB;AAjBG,SAAS,QAAQ;AAAA,EACtB,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,OAAO;AAAA,EACP;AACF,GAAiB;AACf,QAAM,MAAM,OAA0B,IAAI;AAE1C,QAAM,UAAU;AAAA,IACd,IAAI,EAAE,SAAS,YAAY,UAAU,OAAO;AAAA,IAC5C,IAAI,EAAE,SAAS,aAAa,UAAU,OAAO;AAAA,IAC7C,IAAI,EAAE,SAAS,aAAa,UAAU,OAAO;AAAA,EAC/C;AAEA,QAAM,YAAY,YAAY;AAE9B,SACE;AAAA,IAAC,OAAO;AAAA,IAAP;AAAA,MACC;AAAA,MACA;AAAA,MACA,YAAY,EAAE,OAAO,KAAK;AAAA,MAC1B,UAAU,EAAE,OAAO,KAAK;AAAA,MACxB,YAAY,EAAE,MAAM,UAAU,WAAW,KAAK,SAAS,GAAG;AAAA,MAC1D,OAAO;AAAA,QACL,GAAG,QAAQ,IAAI;AAAA,QACf,YAAY,YAAY,SAAS;AAAA,QACjC,OAAO,YAAY,SAAS;AAAA,QAC5B,QAAQ;AAAA,QACR,cAAc;AAAA,QACd,QAAQ;AAAA,QACR,YAAY;AAAA,QACZ,eAAe;AAAA,MACjB;AAAA,MAEC;AAAA;AAAA,EACH;AAEJ;","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@t7blocks/ui",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"main": "./dist/index.js",
|
|
5
|
+
"module": "./dist/index.mjs",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.mjs",
|
|
11
|
+
"require": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"peerDependencies": {
|
|
15
|
+
"framer-motion": "^11.0.0",
|
|
16
|
+
"react": "^18.0.0"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@types/react": "^18.0.0",
|
|
20
|
+
"framer-motion": "^12.38.0",
|
|
21
|
+
"tsup": "^8.0.0",
|
|
22
|
+
"typescript": "^5.0.0",
|
|
23
|
+
"@t7blocks/typescript-config": "0.0.1"
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "tsup",
|
|
27
|
+
"dev": "tsup --watch"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { motion } from "framer-motion";
|
|
4
|
+
import { useRef } from "react";
|
|
5
|
+
|
|
6
|
+
interface Button1Props {
|
|
7
|
+
label?: string;
|
|
8
|
+
variant?: "primary" | "outline";
|
|
9
|
+
size?: "sm" | "md" | "lg";
|
|
10
|
+
onClick?: () => void;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function Button1({
|
|
14
|
+
label = "Click me",
|
|
15
|
+
variant = "primary",
|
|
16
|
+
size = "md",
|
|
17
|
+
onClick,
|
|
18
|
+
}: Button1Props) {
|
|
19
|
+
const ref = useRef<HTMLButtonElement>(null);
|
|
20
|
+
|
|
21
|
+
const sizeMap = {
|
|
22
|
+
sm: { padding: "8px 20px", fontSize: "13px" },
|
|
23
|
+
md: { padding: "12px 28px", fontSize: "15px" },
|
|
24
|
+
lg: { padding: "16px 36px", fontSize: "17px" },
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const isPrimary = variant === "primary";
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<motion.button
|
|
31
|
+
ref={ref}
|
|
32
|
+
onClick={onClick}
|
|
33
|
+
whileHover={{ scale: 1.04 }}
|
|
34
|
+
whileTap={{ scale: 0.97 }}
|
|
35
|
+
transition={{ type: "spring", stiffness: 400, damping: 20 }}
|
|
36
|
+
style={{
|
|
37
|
+
...sizeMap[size],
|
|
38
|
+
background: isPrimary ? "#000" : "transparent",
|
|
39
|
+
color: isPrimary ? "#fff" : "#000",
|
|
40
|
+
border: "1.5px solid #000",
|
|
41
|
+
borderRadius: "8px",
|
|
42
|
+
cursor: "pointer",
|
|
43
|
+
fontWeight: 500,
|
|
44
|
+
letterSpacing: "-0.01em",
|
|
45
|
+
}}
|
|
46
|
+
>
|
|
47
|
+
{label}
|
|
48
|
+
</motion.button>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Button1 } from './Button1';
|
package/src/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// shared prop types go here
|
package/tsconfig.json
ADDED