@becklyn/components 0.1.5 → 0.2.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/dist/cli/init.js +1 -1
- package/dist/components/atoms/Clickable/Clickable.d.ts +12 -0
- package/dist/components/atoms/Clickable/Clickable.d.ts.map +1 -0
- package/dist/components/atoms/{Button/Button.js → Clickable/Clickable.js} +7 -12
- package/dist/components/atoms/{Button/Button.stories.d.ts → Clickable/Clickable.stories.d.ts} +5 -5
- package/dist/components/atoms/Clickable/Clickable.stories.d.ts.map +1 -0
- package/dist/components/atoms/{Button/Button.stories.js → Clickable/Clickable.stories.js} +3 -3
- package/package.json +14 -14
- package/dist/components/atoms/Button/Button.d.ts +0 -4
- package/dist/components/atoms/Button/Button.d.ts.map +0 -1
- package/dist/components/atoms/Button/Button.stories.d.ts.map +0 -1
- package/dist/components/atoms/Button/ButtonSchema.d.ts +0 -27
- package/dist/components/atoms/Button/ButtonSchema.d.ts.map +0 -1
- package/dist/components/atoms/Button/ButtonSchema.js +0 -19
package/dist/cli/init.js
CHANGED
|
@@ -50,7 +50,7 @@ const util_1 = require("util");
|
|
|
50
50
|
const execAsync = (0, util_1.promisify)(child_process_1.exec);
|
|
51
51
|
const requiredPeerDependencies = ["next", "react", "react-dom", "@types/react", "@types/react-dom"];
|
|
52
52
|
const devDependencies = ["sass", "typescript"];
|
|
53
|
-
const dependencies = ["
|
|
53
|
+
const dependencies = ["clsx", "@becklyn/next"];
|
|
54
54
|
function init() {
|
|
55
55
|
return __awaiter(this, void 0, void 0, function* () {
|
|
56
56
|
console.log("🚀 Initializing @becklyn/components in your project...\n");
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FC, PropsWithChildren } from "react";
|
|
2
|
+
interface ClickableProps {
|
|
3
|
+
href: string;
|
|
4
|
+
type: "button" | "submit" | "reset";
|
|
5
|
+
variant?: "primary" | "secondary" | "tertiary";
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
className?: string;
|
|
8
|
+
onClick?: () => void;
|
|
9
|
+
}
|
|
10
|
+
export declare const Clickable: FC<PropsWithChildren<ClickableProps>>;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=Clickable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Clickable.d.ts","sourceRoot":"","sources":["../../../../components/atoms/Clickable/Clickable.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAwB,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAK3E,UAAU,cAAc;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC,OAAO,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,UAAU,CAAC;IAC/C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAmBD,eAAO,MAAM,SAAS,EAAE,EAAE,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAe3D,CAAC"}
|
|
@@ -14,22 +14,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
17
|
+
exports.Clickable = void 0;
|
|
18
18
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
19
|
const link_1 = __importDefault(require("next/link"));
|
|
20
20
|
const clsx_1 = __importDefault(require("clsx"));
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const ButtonWrapperComponent = (_a) => {
|
|
21
|
+
const Clickable_module_scss_1 = __importDefault(require("./Clickable.module.scss"));
|
|
22
|
+
const ClickableWrapperComponent = (_a) => {
|
|
24
23
|
var { children } = _a, props = __rest(_a, ["children"]);
|
|
25
24
|
return props.href ? ((0, jsx_runtime_1.jsx)(link_1.default, Object.assign({ href: props.href }, props, { children: children }))) : ((0, jsx_runtime_1.jsx)("button", Object.assign({ type: props.type || "button" }, props, { children: children })));
|
|
26
25
|
};
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
return undefined;
|
|
31
|
-
}
|
|
32
|
-
const _a = validatedProps.data, { variant, disabled, className } = _a, restProps = __rest(_a, ["variant", "disabled", "className"]);
|
|
33
|
-
return ((0, jsx_runtime_1.jsx)(ButtonWrapperComponent, Object.assign({}, restProps, { className: (0, clsx_1.default)(Button_module_scss_1.default.button, Button_module_scss_1.default[variant], disabled && Button_module_scss_1.default.disabled, className), children: props.children })));
|
|
26
|
+
const Clickable = props => {
|
|
27
|
+
const { variant, disabled, className } = props, restProps = __rest(props, ["variant", "disabled", "className"]);
|
|
28
|
+
return ((0, jsx_runtime_1.jsx)(ClickableWrapperComponent, Object.assign({}, restProps, { className: (0, clsx_1.default)(Clickable_module_scss_1.default.clickable, variant ? Clickable_module_scss_1.default[variant] : undefined, disabled && Clickable_module_scss_1.default.disabled, className), children: props.children })));
|
|
34
29
|
};
|
|
35
|
-
exports.
|
|
30
|
+
exports.Clickable = Clickable;
|
package/dist/components/atoms/{Button/Button.stories.d.ts → Clickable/Clickable.stories.d.ts}
RENAMED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/nextjs";
|
|
2
|
-
import {
|
|
3
|
-
declare const meta: Meta<typeof
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/nextjs-vite";
|
|
2
|
+
import { Clickable } from "./Clickable";
|
|
3
|
+
declare const meta: Meta<typeof Clickable>;
|
|
4
4
|
export default meta;
|
|
5
|
-
type Story = StoryObj<typeof
|
|
5
|
+
type Story = StoryObj<typeof Clickable>;
|
|
6
6
|
export declare const Primary: Story;
|
|
7
7
|
export declare const PrimaryDisabled: Story;
|
|
8
8
|
export declare const Secondary: Story;
|
|
9
9
|
export declare const SecondaryDisabled: Story;
|
|
10
10
|
export declare const Tertiary: Story;
|
|
11
11
|
export declare const TertiaryDisabled: Story;
|
|
12
|
-
//# sourceMappingURL=
|
|
12
|
+
//# sourceMappingURL=Clickable.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Clickable.stories.d.ts","sourceRoot":"","sources":["../../../../components/atoms/Clickable/Clickable.stories.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,SAAS,CA8BhC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,SAAS,CAAC,CAAC;AAExC,eAAO,MAAM,OAAO,EAAE,KAKrB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAM7B,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAKvB,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,KAM/B,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAKtB,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,KAM9B,CAAC"}
|
|
@@ -7,10 +7,10 @@ exports.TertiaryDisabled = exports.Tertiary = exports.SecondaryDisabled = export
|
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
8
|
const clsx_1 = __importDefault(require("clsx"));
|
|
9
9
|
const Story_module_scss_1 = __importDefault(require("@becklyn/components/.storybook/Story.module.scss"));
|
|
10
|
-
const
|
|
10
|
+
const Clickable_1 = require("./Clickable");
|
|
11
11
|
const meta = {
|
|
12
12
|
title: "Atoms/Button/Button",
|
|
13
|
-
component:
|
|
13
|
+
component: Clickable_1.Clickable,
|
|
14
14
|
parameters: {
|
|
15
15
|
layout: "centered",
|
|
16
16
|
},
|
|
@@ -28,7 +28,7 @@ const meta = {
|
|
|
28
28
|
const handleOnClick = () => {
|
|
29
29
|
alert("Button clicked!");
|
|
30
30
|
};
|
|
31
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, clsx_1.default)(Story_module_scss_1.default.storyContainer, Story_module_scss_1.default.large, Story_module_scss_1.default.flex), children: [(0, jsx_runtime_1.jsx)(
|
|
31
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, clsx_1.default)(Story_module_scss_1.default.storyContainer, Story_module_scss_1.default.large, Story_module_scss_1.default.flex), children: [(0, jsx_runtime_1.jsx)(Clickable_1.Clickable, Object.assign({}, args, { onClick: handleOnClick })), (0, jsx_runtime_1.jsx)(Clickable_1.Clickable, Object.assign({}, args, { href: "#", children: "Button as Link" }))] }));
|
|
32
32
|
},
|
|
33
33
|
};
|
|
34
34
|
exports.default = meta;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@becklyn/components",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"homepage": "https://github.com/Becklyn-Studios/ts-libs/tree/main/packages/components",
|
|
6
6
|
"repository": {
|
|
@@ -20,22 +20,22 @@
|
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@becklyn/eslint": "*",
|
|
23
|
-
"@becklyn/next": "^4.2.
|
|
23
|
+
"@becklyn/next": "^4.2.6",
|
|
24
24
|
"@becklyn/tsconfig": "*",
|
|
25
|
-
"@storybook/addon-designs": "^11.0
|
|
26
|
-
"@storybook/addon-docs": "^10.1.
|
|
27
|
-
"@storybook/addon-links": "^10.1.
|
|
28
|
-
"@
|
|
29
|
-
"@types/node": "^24.10.1",
|
|
25
|
+
"@storybook/addon-designs": "^11.1.0",
|
|
26
|
+
"@storybook/addon-docs": "^10.1.10",
|
|
27
|
+
"@storybook/addon-links": "^10.1.10",
|
|
28
|
+
"@types/node": "^24.10.4",
|
|
30
29
|
"@types/react": "^19.2.7",
|
|
31
30
|
"clsx": "^2.1.1",
|
|
32
|
-
"eslint-plugin-storybook": "^10.1.
|
|
33
|
-
"next": "^
|
|
34
|
-
"react": "^19.2.
|
|
35
|
-
"react-dom": "^19.2.
|
|
36
|
-
"sass": "^1.
|
|
37
|
-
"storybook": "^10.1.
|
|
38
|
-
"
|
|
31
|
+
"eslint-plugin-storybook": "^10.1.10",
|
|
32
|
+
"next": "^16.0.10",
|
|
33
|
+
"react": "^19.2.3",
|
|
34
|
+
"react-dom": "^19.2.3",
|
|
35
|
+
"sass": "^1.97.0",
|
|
36
|
+
"storybook": "^10.1.10",
|
|
37
|
+
"@storybook/nextjs-vite": "10.1.10",
|
|
38
|
+
"vite": "^7.3.0"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"react": "^18.3.1 || ^19.0.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../components/atoms/Button/Button.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAwB,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAI3E,OAAO,EAAE,WAAW,EAAgB,MAAM,gBAAgB,CAAC;AAgB3D,eAAO,MAAM,MAAM,EAAE,EAAE,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAqBrD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Button.stories.d.ts","sourceRoot":"","sources":["../../../../components/atoms/Button/Button.stories.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,MAAM,CA8B7B,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,MAAM,CAAC,CAAC;AAErC,eAAO,MAAM,OAAO,EAAE,KAKrB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAM7B,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAKvB,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,KAM/B,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAKtB,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,KAM9B,CAAC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { type AnchorHTMLAttributes, type ButtonHTMLAttributes } from "react";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
export declare const ButtonVariantSchema: z.ZodEnum<{
|
|
4
|
-
primary: "primary";
|
|
5
|
-
secondary: "secondary";
|
|
6
|
-
tertiary: "tertiary";
|
|
7
|
-
}>;
|
|
8
|
-
export type ButtonVariant = z.input<typeof ButtonVariantSchema>;
|
|
9
|
-
/**
|
|
10
|
-
* Zod schema for Button component props validation
|
|
11
|
-
*/
|
|
12
|
-
export declare const ButtonSchema: z.ZodObject<{
|
|
13
|
-
variant: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
14
|
-
primary: "primary";
|
|
15
|
-
secondary: "secondary";
|
|
16
|
-
tertiary: "tertiary";
|
|
17
|
-
}>>>;
|
|
18
|
-
disabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
19
|
-
type: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
20
|
-
button: "button";
|
|
21
|
-
submit: "submit";
|
|
22
|
-
reset: "reset";
|
|
23
|
-
}>>>;
|
|
24
|
-
className: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
25
|
-
}, z.core.$loose>;
|
|
26
|
-
export type ButtonProps = z.input<typeof ButtonSchema> & (ButtonHTMLAttributes<HTMLButtonElement> | AnchorHTMLAttributes<HTMLAnchorElement>);
|
|
27
|
-
//# sourceMappingURL=ButtonSchema.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonSchema.d.ts","sourceRoot":"","sources":["../../../../components/atoms/Button/ButtonSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,oBAAoB,EAAE,KAAK,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAC7E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,mBAAmB;;;;EAA+C,CAAC;AAChF,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;iBASvB,CAAC;AAGH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,GAClD,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,GAAG,oBAAoB,CAAC,iBAAiB,CAAC,CAAC,CAAC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ButtonSchema = exports.ButtonVariantSchema = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
// Zod schema for button variants
|
|
6
|
-
exports.ButtonVariantSchema = zod_1.z.enum(["primary", "secondary", "tertiary"]);
|
|
7
|
-
/**
|
|
8
|
-
* Zod schema for Button component props validation
|
|
9
|
-
*/
|
|
10
|
-
exports.ButtonSchema = zod_1.z.looseObject({
|
|
11
|
-
// Visual style variant
|
|
12
|
-
variant: exports.ButtonVariantSchema.optional().default("primary"),
|
|
13
|
-
// Full width button
|
|
14
|
-
disabled: zod_1.z.boolean().optional().default(false),
|
|
15
|
-
// type of the button, defaults to "button"
|
|
16
|
-
type: zod_1.z.enum(["button", "submit", "reset"]).optional().default("button"),
|
|
17
|
-
// CSS class
|
|
18
|
-
className: zod_1.z.string().optional().default(""),
|
|
19
|
-
});
|