@ambuj.bhaskar/react-component-library 0.30.14 → 0.30.16

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/README.md CHANGED
@@ -1,34 +1,34 @@
1
- # 🚀 React UI Library
2
-
3
- ## A scalable, customizable, and accessible **React component library** designed for building modern UIs. This package includes reusable components, a flexible theming system, and a consistent icon set.
4
-
5
- ## 📦 What's Included?
6
-
7
- ### ✅ Components
8
-
9
- The library currently provides the following components:
10
-
11
- - **`Button`** – Customizable buttons with multiple variants and sizes
12
- - **`Input`** – Accessible input fields with optional icons and validation
13
- - **`Icon`** – A collection of SVG-based icons
14
- - **`Select`** – Single select dropdown component
15
- - **`MultiSelect`** – Multi-select dropdown with tags
16
- - **`Modal`** – Flexible modal dialog with header, body, and footer support
17
- - **`Backdrop`** – Dimmable background for modals or dialogs
18
- - **`DateRangePicker`** – Date picker for selecting start and end dates
19
- - **`ContactInput`** – A specialized input component for contact/email entry
20
- - **`Spinner`** – A loading spinner indicator
21
- - and more ...
22
-
23
- ---
24
-
25
- ### 🎨 Theming
26
-
27
- The library supports **theme customization** using:
28
-
29
- - **`ThemeProvider`** – Wrap your app with this provider to apply a custom theme
30
- - **`useTheme()` hook** – Access the active theme and color palette in your components
31
-
32
- Themes are managed using a flexible token-based system and can be extended or overridden easily.
33
-
34
- ---
1
+ # 🚀 React UI Library
2
+
3
+ ## A scalable, customizable, and accessible **React component library** designed for building modern UIs. This package includes reusable components, a flexible theming system, and a consistent icon set.
4
+
5
+ ## 📦 What's Included?
6
+
7
+ ### ✅ Components
8
+
9
+ The library currently provides the following components:
10
+
11
+ - **`Button`** – Customizable buttons with multiple variants and sizes
12
+ - **`Input`** – Accessible input fields with optional icons and validation
13
+ - **`Icon`** – A collection of SVG-based icons
14
+ - **`Select`** – Single select dropdown component
15
+ - **`MultiSelect`** – Multi-select dropdown with tags
16
+ - **`Modal`** – Flexible modal dialog with header, body, and footer support
17
+ - **`Backdrop`** – Dimmable background for modals or dialogs
18
+ - **`DateRangePicker`** – Date picker for selecting start and end dates
19
+ - **`ContactInput`** – A specialized input component for contact/email entry
20
+ - **`Spinner`** – A loading spinner indicator
21
+ - and more ...
22
+
23
+ ---
24
+
25
+ ### 🎨 Theming
26
+
27
+ The library supports **theme customization** using:
28
+
29
+ - **`ThemeProvider`** – Wrap your app with this provider to apply a custom theme
30
+ - **`useTheme()` hook** – Access the active theme and color palette in your components
31
+
32
+ Themes are managed using a flexible token-based system and can be extended or overridden easily.
33
+
34
+ ---
package/bin/cli.js CHANGED
@@ -1,87 +1,87 @@
1
1
  #!/usr/bin/env node
2
-
3
- import boxen from "boxen";
4
- import chalk from "chalk";
5
- import { Command } from "commander";
6
- import fs from "fs";
7
- import path from "path";
8
- import { fileURLToPath } from "url";
9
-
10
- const program = new Command();
11
-
12
- // Get __dirname equivalent in ES Modules
13
- const __filename = fileURLToPath(import.meta.url);
14
- const __dirname = path.dirname(__filename);
15
-
16
- // Styled banner
17
- console.log(
18
- boxen(chalk.bold.cyan("⚡ AWI CLI - Component Generator"), {
19
- padding: 1,
20
- margin: 1,
21
- borderStyle: "round",
22
- borderColor: "cyan",
23
- })
24
- );
25
-
26
- program
27
- .name("awi")
28
- .description(chalk.green("A CLI tool for generating components and utilities"))
29
- .version(chalk.yellow("1.0.0"));
30
-
31
- // Component Generator Command
32
- program
33
- .command("generate <type> <name>")
34
- .alias("g")
35
- .description(chalk.blue("Generate a new component or utility"))
36
- .action((type, name) => {
37
- if (type === "component" || type === "c") {
38
- createComponent(name);
39
- } else {
40
- console.log(chalk.red.bold(`❌ Unknown type: ${type}`));
41
- }
42
- });
43
-
44
- function createComponent(componentName) {
45
- const componentDir = path.join(process.cwd(), componentName);
46
- const formattedName = componentName.replace(/-/g, ".");
47
- const pascalCaseName = formattedName
48
- .split(".")
49
- .map((word) => word.charAt(0).toUpperCase() + word.slice(1))
50
- .join("");
51
-
52
- // Ensure the directory exists
53
- fs.mkdirSync(componentDir, { recursive: true });
54
-
55
- // Define file contents
56
- const indexContent = `import { ${pascalCaseName} } from "./${formattedName}";\nexport type { ${pascalCaseName}Props } from "./${formattedName}.type";\n\nexport default ${pascalCaseName};`;
57
-
58
- const componentContent = `import "./${formattedName}.css";\nimport { ${pascalCaseName}Props } from "./${formattedName}.type";\n\nexport const ${pascalCaseName}: React.FC<${pascalCaseName}Props> = ({\n title = "${pascalCaseName}",\n}) => {\n return <div>{title}</div>;\n};`;
59
-
60
- const typeContent = `export type ${pascalCaseName}Props = {\n title?: string;\n};`;
61
-
62
- const storiesContent = `import type { Meta, StoryObj } from "@storybook/react";\nimport ${pascalCaseName} from "./";\n\nconst meta: Meta<typeof ${pascalCaseName}> = {\n component: ${pascalCaseName},\n title: "Components/Atoms/${pascalCaseName}",\n tags: ["autodocs"],\n parameters: {\n layout: "centered",\n docs: {\n panelPosition: "right",\n },\n },\n argTypes: {\n title: {\n control: "text",\n description: "Title of the component",\n table: {\n type: { summary: "string" },\n defaultValue: { summary: "${pascalCaseName}" },\n },\n },\n },\n};\nexport default meta;\n\ntype Story = StoryObj<typeof ${pascalCaseName}>;\n\nexport const Default: Story = {\n args: { title: "${pascalCaseName}" },\n};`;
63
-
64
- // Create and write files
65
- const files = {
66
- "index.tsx": indexContent,
67
- [`${formattedName}.tsx`]: componentContent,
68
- [`${formattedName}.type.ts`]: typeContent,
69
- [`${formattedName}.stories.tsx`]: storiesContent,
70
- [`${formattedName}.css`]: "",
71
- [`${formattedName}.utils.ts`]: "",
72
- };
73
-
74
- for (const [file, content] of Object.entries(files)) {
75
- fs.writeFileSync(path.join(componentDir, file), content, { flag: "w" });
76
- }
77
-
78
- console.log(
79
- boxen(
80
- chalk.greenBright(`✅ Component '${componentName}' created successfully!`),
81
- { padding: 1, margin: 1, borderStyle: "double", borderColor: "green" }
82
- )
83
- );
84
- }
85
-
86
- // Parse CLI arguments
87
- program.parse(process.argv);
2
+
3
+ import boxen from "boxen";
4
+ import chalk from "chalk";
5
+ import { Command } from "commander";
6
+ import fs from "fs";
7
+ import path from "path";
8
+ import { fileURLToPath } from "url";
9
+
10
+ const program = new Command();
11
+
12
+ // Get __dirname equivalent in ES Modules
13
+ const __filename = fileURLToPath(import.meta.url);
14
+ const __dirname = path.dirname(__filename);
15
+
16
+ // Styled banner
17
+ console.log(
18
+ boxen(chalk.bold.cyan("⚡ AWI CLI - Component Generator"), {
19
+ padding: 1,
20
+ margin: 1,
21
+ borderStyle: "round",
22
+ borderColor: "cyan",
23
+ })
24
+ );
25
+
26
+ program
27
+ .name("awi")
28
+ .description(chalk.green("A CLI tool for generating components and utilities"))
29
+ .version(chalk.yellow("1.0.0"));
30
+
31
+ // Component Generator Command
32
+ program
33
+ .command("generate <type> <name>")
34
+ .alias("g")
35
+ .description(chalk.blue("Generate a new component or utility"))
36
+ .action((type, name) => {
37
+ if (type === "component" || type === "c") {
38
+ createComponent(name);
39
+ } else {
40
+ console.log(chalk.red.bold(`❌ Unknown type: ${type}`));
41
+ }
42
+ });
43
+
44
+ function createComponent(componentName) {
45
+ const componentDir = path.join(process.cwd(), componentName);
46
+ const formattedName = componentName.replace(/-/g, ".");
47
+ const pascalCaseName = formattedName
48
+ .split(".")
49
+ .map((word) => word.charAt(0).toUpperCase() + word.slice(1))
50
+ .join("");
51
+
52
+ // Ensure the directory exists
53
+ fs.mkdirSync(componentDir, { recursive: true });
54
+
55
+ // Define file contents
56
+ const indexContent = `import { ${pascalCaseName} } from "./${formattedName}";\nexport type { ${pascalCaseName}Props } from "./${formattedName}.type";\n\nexport default ${pascalCaseName};`;
57
+
58
+ const componentContent = `import "./${formattedName}.css";\nimport { ${pascalCaseName}Props } from "./${formattedName}.type";\n\nexport const ${pascalCaseName}: React.FC<${pascalCaseName}Props> = ({\n title = "${pascalCaseName}",\n}) => {\n return <div>{title}</div>;\n};`;
59
+
60
+ const typeContent = `export type ${pascalCaseName}Props = {\n title?: string;\n};`;
61
+
62
+ const storiesContent = `import type { Meta, StoryObj } from "@storybook/react";\nimport ${pascalCaseName} from "./";\n\nconst meta: Meta<typeof ${pascalCaseName}> = {\n component: ${pascalCaseName},\n title: "Components/Atoms/${pascalCaseName}",\n tags: ["autodocs"],\n parameters: {\n layout: "centered",\n docs: {\n panelPosition: "right",\n },\n },\n argTypes: {\n title: {\n control: "text",\n description: "Title of the component",\n table: {\n type: { summary: "string" },\n defaultValue: { summary: "${pascalCaseName}" },\n },\n },\n },\n};\nexport default meta;\n\ntype Story = StoryObj<typeof ${pascalCaseName}>;\n\nexport const Default: Story = {\n args: { title: "${pascalCaseName}" },\n};`;
63
+
64
+ // Create and write files
65
+ const files = {
66
+ "index.tsx": indexContent,
67
+ [`${formattedName}.tsx`]: componentContent,
68
+ [`${formattedName}.type.ts`]: typeContent,
69
+ [`${formattedName}.stories.tsx`]: storiesContent,
70
+ [`${formattedName}.css`]: "",
71
+ [`${formattedName}.utils.ts`]: "",
72
+ };
73
+
74
+ for (const [file, content] of Object.entries(files)) {
75
+ fs.writeFileSync(path.join(componentDir, file), content, { flag: "w" });
76
+ }
77
+
78
+ console.log(
79
+ boxen(
80
+ chalk.greenBright(`✅ Component '${componentName}' created successfully!`),
81
+ { padding: 1, margin: 1, borderStyle: "double", borderColor: "green" }
82
+ )
83
+ );
84
+ }
85
+
86
+ // Parse CLI arguments
87
+ program.parse(process.argv);