@nidhi_kumari/component-library 1.0.0

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.
Files changed (96) hide show
  1. package/.storybook/main.ts +16 -0
  2. package/.storybook/preview.tsx +21 -0
  3. package/README.md +75 -0
  4. package/eslint.config.js +22 -0
  5. package/index.html +13 -0
  6. package/nidhi_kumari-component-library-1.0.0.tgz +0 -0
  7. package/nidhigupta-component-library-1.0.0.tgz +0 -0
  8. package/package.json +46 -0
  9. package/public/favicon.svg +1 -0
  10. package/public/icons.svg +24 -0
  11. package/src/App.css +184 -0
  12. package/src/App.tsx +122 -0
  13. package/src/assets/hero.png +0 -0
  14. package/src/assets/react.svg +1 -0
  15. package/src/assets/vite.svg +1 -0
  16. package/src/components/Button/Button.css +20 -0
  17. package/src/components/Button/Button.stories.tsx +32 -0
  18. package/src/components/Button/Button.test.tsx +8 -0
  19. package/src/components/Button/Button.tsx +19 -0
  20. package/src/components/Button/Button.types.ts +8 -0
  21. package/src/components/Button/index.ts +2 -0
  22. package/src/components/EmptyState/EmptyState.css +0 -0
  23. package/src/components/EmptyState/EmptyState.stories.tsx +0 -0
  24. package/src/components/EmptyState/EmptyState.tsx +0 -0
  25. package/src/components/EmptyState/EmptyState.types.ts +0 -0
  26. package/src/components/EmptyState/index.ts +0 -0
  27. package/src/components/Header/Header.css +17 -0
  28. package/src/components/Header/Header.stories.tsx +24 -0
  29. package/src/components/Header/Header.tsx +12 -0
  30. package/src/components/Header/Header.types.ts +4 -0
  31. package/src/components/Header/index.ts +2 -0
  32. package/src/components/Input/Input.css +26 -0
  33. package/src/components/Input/Input.stories.tsx +47 -0
  34. package/src/components/Input/Input.tsx +14 -0
  35. package/src/components/Input/Input.types.ts +6 -0
  36. package/src/components/Input/index.ts +2 -0
  37. package/src/components/ListItem/ListItem.css +0 -0
  38. package/src/components/ListItem/ListItem.stories.tsx +0 -0
  39. package/src/components/ListItem/ListItem.tsx +0 -0
  40. package/src/components/ListItem/ListItem.types.ts +0 -0
  41. package/src/components/ListItem/index.ts +0 -0
  42. package/src/components/Loader/Loader.css +0 -0
  43. package/src/components/Loader/Loader.stories.tsx +0 -0
  44. package/src/components/Loader/Loader.tsx +0 -0
  45. package/src/components/Loader/Loader.types.ts +0 -0
  46. package/src/components/Loader/index.ts +0 -0
  47. package/src/components/SearchInput/SearchInput.css +20 -0
  48. package/src/components/SearchInput/SearchInput.stories.tsx +29 -0
  49. package/src/components/SearchInput/SearchInput.tsx +30 -0
  50. package/src/components/SearchInput/SearchInput.types.ts +6 -0
  51. package/src/components/SearchInput/index.ts +2 -0
  52. package/src/components/SearchList/SearchList.css +0 -0
  53. package/src/components/SearchList/SearchList.stories.tsx +0 -0
  54. package/src/components/SearchList/SearchList.tsx +0 -0
  55. package/src/components/SearchList/SearchList.types.ts +0 -0
  56. package/src/components/SearchList/index.ts +0 -0
  57. package/src/components/SlotManagement/SlotManagement.css +223 -0
  58. package/src/components/SlotManagement/SlotManagement.md +0 -0
  59. package/src/components/SlotManagement/SlotManagement.stories.tsx +12 -0
  60. package/src/components/SlotManagement/SlotManagement.tsx +217 -0
  61. package/src/components/SlotManagement/SlotManagement.types.ts +22 -0
  62. package/src/components/SlotManagement/slots.json +40 -0
  63. package/src/index.css +111 -0
  64. package/src/index.ts +0 -0
  65. package/src/main.tsx +10 -0
  66. package/src/stories/Button.stories.ts +54 -0
  67. package/src/stories/Button.tsx +39 -0
  68. package/src/stories/Configure.mdx +388 -0
  69. package/src/stories/Header.stories.ts +34 -0
  70. package/src/stories/Header.tsx +69 -0
  71. package/src/stories/Page.stories.ts +33 -0
  72. package/src/stories/Page.tsx +73 -0
  73. package/src/stories/assets/accessibility.png +0 -0
  74. package/src/stories/assets/accessibility.svg +1 -0
  75. package/src/stories/assets/addon-library.png +0 -0
  76. package/src/stories/assets/assets.png +0 -0
  77. package/src/stories/assets/avif-test-image.avif +0 -0
  78. package/src/stories/assets/context.png +0 -0
  79. package/src/stories/assets/discord.svg +1 -0
  80. package/src/stories/assets/docs.png +0 -0
  81. package/src/stories/assets/figma-plugin.png +0 -0
  82. package/src/stories/assets/github.svg +1 -0
  83. package/src/stories/assets/share.png +0 -0
  84. package/src/stories/assets/styling.png +0 -0
  85. package/src/stories/assets/testing.png +0 -0
  86. package/src/stories/assets/theming.png +0 -0
  87. package/src/stories/assets/tutorials.svg +1 -0
  88. package/src/stories/assets/youtube.svg +1 -0
  89. package/src/stories/button.css +30 -0
  90. package/src/stories/header.css +32 -0
  91. package/src/stories/page.css +68 -0
  92. package/tsconfig.app.json +26 -0
  93. package/tsconfig.json +7 -0
  94. package/tsconfig.node.json +23 -0
  95. package/vite.config.ts +37 -0
  96. package/vitest.shims.d.ts +1 -0
@@ -0,0 +1,32 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { Button } from "./Button";
3
+
4
+ const meta: Meta<typeof Button> = {
5
+ title: "Components/Button",
6
+ component: Button,
7
+ };
8
+
9
+ export default meta;
10
+
11
+ type Story = StoryObj<typeof Button>;
12
+
13
+ export const Primary: Story = {
14
+ args: {
15
+ children: "Save",
16
+ variant: "primary",
17
+ },
18
+ };
19
+
20
+ export const Secondary: Story = {
21
+ args: {
22
+ children: "Cancel",
23
+ variant: "secondary",
24
+ },
25
+ };
26
+
27
+ export const Loading: Story = {
28
+ args: {
29
+ children: "Saving",
30
+ loading: true,
31
+ },
32
+ };
@@ -0,0 +1,8 @@
1
+ // import { render, screen } from "@testing-library/react";
2
+ // import { Button } from "./Button";
3
+
4
+ // test("renders button", () => {
5
+ // render(<Button>Save</Button>);
6
+
7
+ // expect(screen.getByText("Save")).toBeInTheDocument();
8
+ // });
@@ -0,0 +1,19 @@
1
+ import "./Button.css";
2
+ import type { ButtonProps } from "./Button.types";
3
+
4
+ export const Button = ({
5
+ children,
6
+ variant = "primary",
7
+ loading = false,
8
+ ...props
9
+ }: ButtonProps) => {
10
+ return (
11
+ <button
12
+ className={`btn ${variant}`}
13
+ disabled={loading || props.disabled}
14
+ {...props}
15
+ >
16
+ {loading ? "Loading..." : children}
17
+ </button>
18
+ );
19
+ };
@@ -0,0 +1,8 @@
1
+ import type { ButtonHTMLAttributes, ReactNode } from "react";
2
+
3
+ export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
4
+ children: ReactNode;
5
+ variant?: "primary" | "secondary";
6
+
7
+ loading?: boolean;
8
+ }
@@ -0,0 +1,2 @@
1
+ export { Button } from "./Button";
2
+ export type { ButtonProps } from "./Button.types";
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,17 @@
1
+ .header {
2
+ display: flex;
3
+ flex-direction: column;
4
+ gap: 6px;
5
+ padding: 20px 0;
6
+ }
7
+
8
+ .header-title {
9
+ font-size: 32px;
10
+ font-weight: 700;
11
+ color: #1f2937;
12
+ }
13
+
14
+ .header-subtitle {
15
+ font-size: 16px;
16
+ color: #6b7280;
17
+ }
@@ -0,0 +1,24 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { Header } from "./Header";
3
+
4
+ const meta: Meta<typeof Header> = {
5
+ title: "Layout/Header",
6
+ component: Header,
7
+ };
8
+
9
+ export default meta;
10
+
11
+ type Story = StoryObj<typeof Header>;
12
+
13
+ export const Default: Story = {
14
+ args: {
15
+ title: "Todo Dashboard",
16
+ subtitle: "Manage your daily tasks efficiently",
17
+ },
18
+ };
19
+
20
+ export const TitleOnly: Story = {
21
+ args: {
22
+ title: "Dashboard",
23
+ },
24
+ };
@@ -0,0 +1,12 @@
1
+ import "./Header.css";
2
+ import type { HeaderProps } from "./Header.types";
3
+
4
+ export const Header = ({ title, subtitle }: HeaderProps) => {
5
+ return (
6
+ <header className="header">
7
+ <h1 className="header-title">{title}</h1>
8
+
9
+ {subtitle && <p className="header-subtitle">{subtitle}</p>}
10
+ </header>
11
+ );
12
+ };
@@ -0,0 +1,4 @@
1
+ export interface HeaderProps {
2
+ title: string;
3
+ subtitle?: string;
4
+ }
@@ -0,0 +1,2 @@
1
+ export { Header } from "./Header";
2
+ export type { HeaderProps } from "./Header.types";
@@ -0,0 +1,26 @@
1
+ .input-wrapper {
2
+ display: flex;
3
+ flex-direction: column;
4
+ gap: 6px;
5
+ }
6
+
7
+ .input {
8
+ padding: 10px;
9
+ border: 1px solid #ccc;
10
+ border-radius: 6px;
11
+ font-size: 14px;
12
+ }
13
+
14
+ .input:focus {
15
+ outline: none;
16
+ border-color: royalblue;
17
+ }
18
+
19
+ .error {
20
+ border-color: red;
21
+ }
22
+
23
+ .error-text {
24
+ color: red;
25
+ font-size: 12px;
26
+ }
@@ -0,0 +1,47 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { Input } from "./Input";
3
+
4
+ const meta: Meta<typeof Input> = {
5
+ title: "Components/Input",
6
+ component: Input,
7
+ };
8
+
9
+ export default meta;
10
+
11
+ type Story = StoryObj<typeof Input>;
12
+
13
+ export const Default: Story = {
14
+ args: {
15
+ placeholder: "Enter your name",
16
+ },
17
+ };
18
+
19
+ export const WithLabel: Story = {
20
+ args: {
21
+ label: "Username",
22
+ placeholder: "Enter username",
23
+ },
24
+ };
25
+
26
+ export const Password: Story = {
27
+ args: {
28
+ label: "Password",
29
+ placeholder: "Enter password",
30
+ type: "password",
31
+ },
32
+ };
33
+
34
+ export const Error: Story = {
35
+ args: {
36
+ label: "Email",
37
+ placeholder: "Enter email",
38
+ error: "Email is required",
39
+ },
40
+ };
41
+
42
+ export const Disabled: Story = {
43
+ args: {
44
+ placeholder: "Disabled input",
45
+ disabled: true,
46
+ },
47
+ };
@@ -0,0 +1,14 @@
1
+ import "./Input.css";
2
+ import type { InputProps } from "./Input.types";
3
+
4
+ export const Input = ({ label, error, ...props }: InputProps) => {
5
+ return (
6
+ <div className="input-wrapper">
7
+ {label && <label>{label}</label>}
8
+
9
+ <input className={`input ${error ? "error" : ""}`} {...props} />
10
+
11
+ {error && <p className="error-text">{error}</p>}
12
+ </div>
13
+ );
14
+ };
@@ -0,0 +1,6 @@
1
+ import type { InputHTMLAttributes } from "react";
2
+
3
+ export interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
4
+ label?: string;
5
+ error?: string;
6
+ }
@@ -0,0 +1,2 @@
1
+ export { Input } from "./Input";
2
+ export type { InputProps } from "./Input.types";
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,20 @@
1
+ .search-input {
2
+ display: flex;
3
+ align-items: center;
4
+ gap: 8px;
5
+ }
6
+
7
+ .search-icon {
8
+ font-size: 18px;
9
+ }
10
+
11
+ .clear-button {
12
+ border: none;
13
+ background: transparent;
14
+ cursor: pointer;
15
+ font-size: 16px;
16
+ }
17
+
18
+ .clear-button:hover {
19
+ color: red;
20
+ }
@@ -0,0 +1,29 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { SearchInput } from "./SearchInput";
3
+
4
+ const meta: Meta<typeof SearchInput> = {
5
+ title: "Components/SearchInput",
6
+ component: SearchInput,
7
+ };
8
+
9
+ export default meta;
10
+
11
+ type Story = StoryObj<typeof SearchInput>;
12
+
13
+ export const Default: Story = {
14
+ args: {
15
+ value: "",
16
+ placeholder: "Search products...",
17
+ onChange: (value) => console.log(value),
18
+ onClear: () => console.log("Clear"),
19
+ },
20
+ };
21
+
22
+ export const WithValue: Story = {
23
+ args: {
24
+ value: "Apple",
25
+ placeholder: "Search products...",
26
+ onChange: (value) => console.log(value),
27
+ onClear: () => console.log("Clear"),
28
+ },
29
+ };
@@ -0,0 +1,30 @@
1
+ import "./SearchInput.css";
2
+
3
+ import { Input } from "../Input";
4
+
5
+ import type { SearchInputProps } from "./SearchInput.types";
6
+
7
+ export const SearchInput = ({
8
+ value,
9
+ placeholder = "Search...",
10
+ onChange,
11
+ onClear,
12
+ }: SearchInputProps) => {
13
+ return (
14
+ <div className="search-input">
15
+ <span className="search-icon">🔍</span>
16
+
17
+ <Input
18
+ value={value}
19
+ placeholder={placeholder}
20
+ onChange={(e) => onChange(e.target.value)}
21
+ />
22
+
23
+ {value && (
24
+ <button className="clear-button" onClick={onClear} type="button">
25
+
26
+ </button>
27
+ )}
28
+ </div>
29
+ );
30
+ };
@@ -0,0 +1,6 @@
1
+ export interface SearchInputProps {
2
+ value: string;
3
+ placeholder?: string;
4
+ onChange: (value: string) => void;
5
+ onClear?: () => void;
6
+ }
@@ -0,0 +1,2 @@
1
+ export { SearchInput } from "./SearchInput";
2
+ export type { SearchInputProps } from "./SearchInput.types";
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,223 @@
1
+ /* SlotManagement styles */
2
+ .sm-root {
3
+ font-family:
4
+ system-ui,
5
+ -apple-system,
6
+ "Segoe UI",
7
+ Roboto,
8
+ "Helvetica Neue",
9
+ Arial;
10
+ padding: 20px;
11
+ background: #f5f5f5;
12
+ min-height: 100vh;
13
+ }
14
+
15
+ .sm-header {
16
+ margin-bottom: 24px;
17
+ }
18
+
19
+ .sm-title {
20
+ margin: 0;
21
+ font-size: 24px;
22
+ font-weight: 600;
23
+ color: #333;
24
+ }
25
+
26
+ .sm-table-wrapper {
27
+ background: #fff;
28
+ border-radius: 4px;
29
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
30
+ overflow: hidden;
31
+ margin-bottom: 24px;
32
+ }
33
+
34
+ .sm-table {
35
+ width: 100%;
36
+ border-collapse: collapse;
37
+ }
38
+
39
+ .sm-table th {
40
+ background: #2c3e50;
41
+ color: #fff;
42
+ text-align: left;
43
+ font-size: 12px;
44
+ font-weight: 600;
45
+ padding: 12px 12px;
46
+ border: none;
47
+ }
48
+
49
+ .sm-slot-header-row {
50
+ background: #f0f0f0;
51
+ border-top: 2px solid #ddd;
52
+ border-bottom: 1px solid #ddd;
53
+ }
54
+
55
+ .sm-slot-header-cell {
56
+ padding: 14px 12px;
57
+ font-size: 12px;
58
+ }
59
+
60
+ .sm-slot-header-content {
61
+ display: flex;
62
+ align-items: center;
63
+ gap: 16px;
64
+ }
65
+
66
+ .sm-slot-name {
67
+ font-weight: 600;
68
+ color: #333;
69
+ font-size: 13px;
70
+ }
71
+
72
+ .sm-slot-constraints {
73
+ font-size: 11px;
74
+ color: #666;
75
+ background: #e8e8e8;
76
+ padding: 4px 8px;
77
+ border-radius: 3px;
78
+ }
79
+
80
+ .sm-slot-status {
81
+ font-size: 11px;
82
+ color: #2f7d32;
83
+ background: #e8f5e9;
84
+ padding: 4px 8px;
85
+ border-radius: 3px;
86
+ }
87
+
88
+ .sm-slot-status.is-full {
89
+ color: #b42318;
90
+ background: #fef3f2;
91
+ }
92
+
93
+ .sm-table td {
94
+ padding: 12px;
95
+ font-size: 12px;
96
+ border-bottom: 1px solid #f5f5f5;
97
+ color: #333;
98
+ }
99
+
100
+ .sm-table tbody tr:not(.sm-slot-header-row):hover {
101
+ background: #f9f9f9;
102
+ }
103
+
104
+ .sm-checkbox-col {
105
+ width: 40px;
106
+ text-align: center;
107
+ padding: 12px;
108
+ }
109
+
110
+ .sm-checkbox-col input {
111
+ cursor: pointer;
112
+ width: 18px;
113
+ height: 18px;
114
+ }
115
+
116
+ /* Stepper styles */
117
+ .sm-stepper {
118
+ display: inline-flex;
119
+ align-items: center;
120
+ border: 1px solid #ddd;
121
+ border-radius: 4px;
122
+ overflow: hidden;
123
+ background: #fff;
124
+ }
125
+
126
+ .sm-stepper-btn {
127
+ background: transparent;
128
+ border: none;
129
+ padding: 6px 8px;
130
+ cursor: pointer;
131
+ font-size: 12px;
132
+ line-height: 1;
133
+ color: #666;
134
+ transition: background 0.2s;
135
+ }
136
+
137
+ .sm-stepper-btn:hover {
138
+ background: #f0f0f0;
139
+ }
140
+
141
+ .sm-stepper-btn:disabled {
142
+ opacity: 0.35;
143
+ cursor: not-allowed;
144
+ }
145
+
146
+ .sm-stepper-input {
147
+ min-width: 35px;
148
+ text-align: center;
149
+ padding: 4px 4px;
150
+ border: none;
151
+ font-size: 12px;
152
+ background: transparent;
153
+ outline: none;
154
+ }
155
+
156
+ .sm-stepper-input::-webkit-outer-spin-button,
157
+ .sm-stepper-input::-webkit-inner-spin-button {
158
+ -webkit-appearance: none;
159
+ margin: 0;
160
+ }
161
+
162
+ .sm-stepper-input[type="number"] {
163
+ -moz-appearance: textfield;
164
+ }
165
+
166
+ /* Selection info */
167
+ .sm-selection-info {
168
+ font-size: 12px;
169
+ color: #666;
170
+ margin-bottom: 20px;
171
+ padding: 12px 0;
172
+ text-align: center;
173
+ }
174
+
175
+ /* Footer buttons */
176
+ .sm-footer {
177
+ display: flex;
178
+ gap: 12px;
179
+ justify-content: center;
180
+ align-items: center;
181
+ padding: 20px;
182
+ background: #fff;
183
+ border-radius: 4px;
184
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
185
+ }
186
+
187
+ .sm-btn {
188
+ padding: 10px 32px;
189
+ font-size: 14px;
190
+ font-weight: 600;
191
+ border: 2px solid transparent;
192
+ border-radius: 4px;
193
+ cursor: pointer;
194
+ transition: all 0.3s ease;
195
+ min-width: 120px;
196
+ }
197
+
198
+ .sm-btn-secondary {
199
+ background: transparent;
200
+ color: #333;
201
+ border: 2px solid #d4d4d4;
202
+ }
203
+
204
+ .sm-btn-secondary:hover {
205
+ border-color: #999;
206
+ color: #000;
207
+ }
208
+
209
+ .sm-btn-primary {
210
+ background: #f5a623;
211
+ color: #fff;
212
+ border-color: #f5a623;
213
+ }
214
+
215
+ .sm-btn-primary:hover {
216
+ background: #e08e1d;
217
+ border-color: #e08e1d;
218
+ }
219
+
220
+ .sm-btn:disabled {
221
+ opacity: 0.5;
222
+ cursor: not-allowed;
223
+ }
@@ -0,0 +1,12 @@
1
+ import { SlotManagement } from "./SlotManagement";
2
+
3
+ export default {
4
+ title: "Components/SlotManagement",
5
+ component: SlotManagement,
6
+ };
7
+
8
+ export const Primary = () => (
9
+ <div style={{ padding: 16 }}>
10
+ <SlotManagement />
11
+ </div>
12
+ );