praveenarasu-react-button-lib 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.
- package/README.md +99 -0
- package/dist/components/Button.d.ts +8 -0
- package/dist/index.d.ts +2 -0
- package/dist/my-react-button.es.js +648 -0
- package/dist/my-react-button.umd.js +30 -0
- package/dist/style.css +1 -0
- package/package.json +39 -0
package/README.md
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# Reusable React Component Library
|
|
2
|
+
|
|
3
|
+
This is a complete template for creating a reusable React component library, bundled with **Vite** (in Library mode), using **TypeScript**, and auto-generating type declarations (`.d.ts` files).
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 🚀 How to Set Up and Build
|
|
8
|
+
|
|
9
|
+
### 1. Install Dependencies
|
|
10
|
+
Run this in the project directory:
|
|
11
|
+
```bash
|
|
12
|
+
npm install
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### 2. Build the Library
|
|
16
|
+
Compile your React components and output the build to the `dist` folder:
|
|
17
|
+
```bash
|
|
18
|
+
npm run build
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
This compiles your components into two main bundle formats in `dist/`:
|
|
22
|
+
- **ES Modules** (`my-react-button.es.js`): For modern bundlers like Vite, Webpack 5, etc.
|
|
23
|
+
- **UMD** (`my-react-button.umd.js`): For compatibility with CommonJS and legacy environments.
|
|
24
|
+
- **Type Declarations** (`index.d.ts`): Autogenerated typescript definitions.
|
|
25
|
+
- **CSS** (`style.css`): Shared component styles.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## 📦 How to Publish to npm
|
|
30
|
+
|
|
31
|
+
To publish this library to the npm registry so anyone (or your private team) can import it, follow these steps:
|
|
32
|
+
|
|
33
|
+
### Step 1: Create an npm account
|
|
34
|
+
If you don't have one, sign up on [npmjs.com](https://www.npmjs.com/).
|
|
35
|
+
|
|
36
|
+
### Step 2: Log in via your terminal
|
|
37
|
+
Run the following command and follow the prompt:
|
|
38
|
+
```bash
|
|
39
|
+
npm login
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Step 3: Choose a unique package name
|
|
43
|
+
Open [package.json](file:///c:/Users/PraveenArasu/Downloads/new/package.json) and change the `"name"` property to a unique package name.
|
|
44
|
+
* *Tip:* You can use scoped packages like `@your-username/my-button` to avoid naming conflicts on npm.
|
|
45
|
+
|
|
46
|
+
### Step 4: Publish it!
|
|
47
|
+
Run:
|
|
48
|
+
```bash
|
|
49
|
+
npm publish
|
|
50
|
+
```
|
|
51
|
+
*(If you are using a scoped package like `@username/my-button`, publish it with public access using: `npm publish --access public`)*
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## 🔌 How to Import & Use it in another project
|
|
56
|
+
|
|
57
|
+
Once published, install it in any other React project:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
npm install my-react-component-library
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Then, import and use it in your code:
|
|
64
|
+
|
|
65
|
+
```tsx
|
|
66
|
+
import React from 'react';
|
|
67
|
+
import { Button } from 'my-react-component-library';
|
|
68
|
+
import 'my-react-component-library/dist/style.css'; // Import the component styles
|
|
69
|
+
|
|
70
|
+
export default function App() {
|
|
71
|
+
return (
|
|
72
|
+
<div>
|
|
73
|
+
<Button
|
|
74
|
+
variant="primary"
|
|
75
|
+
size="large"
|
|
76
|
+
label="Click Me!"
|
|
77
|
+
onClick={() => alert("It works!")}
|
|
78
|
+
/>
|
|
79
|
+
</div>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## 🛠️ Testing Locally Before Publishing
|
|
87
|
+
|
|
88
|
+
You don't have to publish to npm to test it! You can install it locally in another project:
|
|
89
|
+
|
|
90
|
+
1. In your library project directory, run:
|
|
91
|
+
```bash
|
|
92
|
+
npm link
|
|
93
|
+
```
|
|
94
|
+
2. In your target app project directory, run:
|
|
95
|
+
```bash
|
|
96
|
+
npm link my-react-component-library
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Now, any changes you make and build will be instantly reflected in your test app.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
4
|
+
variant?: 'primary' | 'secondary' | 'outline';
|
|
5
|
+
size?: 'small' | 'medium' | 'large';
|
|
6
|
+
label: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const Button: React.FC<ButtonProps>;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,648 @@
|
|
|
1
|
+
import Ce from "react";
|
|
2
|
+
var X = { exports: {} }, I = {};
|
|
3
|
+
/**
|
|
4
|
+
* @license React
|
|
5
|
+
* react-jsx-runtime.production.min.js
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the MIT license found in the
|
|
10
|
+
* LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/
|
|
12
|
+
var Te;
|
|
13
|
+
function lr() {
|
|
14
|
+
if (Te) return I;
|
|
15
|
+
Te = 1;
|
|
16
|
+
var k = Ce, _ = Symbol.for("react.element"), D = Symbol.for("react.fragment"), y = Object.prototype.hasOwnProperty, C = k.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, S = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
17
|
+
function h(R, f, P) {
|
|
18
|
+
var p, g = {}, m = null, W = null;
|
|
19
|
+
P !== void 0 && (m = "" + P), f.key !== void 0 && (m = "" + f.key), f.ref !== void 0 && (W = f.ref);
|
|
20
|
+
for (p in f) y.call(f, p) && !S.hasOwnProperty(p) && (g[p] = f[p]);
|
|
21
|
+
if (R && R.defaultProps) for (p in f = R.defaultProps, f) g[p] === void 0 && (g[p] = f[p]);
|
|
22
|
+
return { $$typeof: _, type: R, key: m, ref: W, props: g, _owner: C.current };
|
|
23
|
+
}
|
|
24
|
+
return I.Fragment = D, I.jsx = h, I.jsxs = h, I;
|
|
25
|
+
}
|
|
26
|
+
var $ = {};
|
|
27
|
+
/**
|
|
28
|
+
* @license React
|
|
29
|
+
* react-jsx-runtime.development.js
|
|
30
|
+
*
|
|
31
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
32
|
+
*
|
|
33
|
+
* This source code is licensed under the MIT license found in the
|
|
34
|
+
* LICENSE file in the root directory of this source tree.
|
|
35
|
+
*/
|
|
36
|
+
var Oe;
|
|
37
|
+
function fr() {
|
|
38
|
+
return Oe || (Oe = 1, process.env.NODE_ENV !== "production" && function() {
|
|
39
|
+
var k = Ce, _ = Symbol.for("react.element"), D = Symbol.for("react.portal"), y = Symbol.for("react.fragment"), C = Symbol.for("react.strict_mode"), S = Symbol.for("react.profiler"), h = Symbol.for("react.provider"), R = Symbol.for("react.context"), f = Symbol.for("react.forward_ref"), P = Symbol.for("react.suspense"), p = Symbol.for("react.suspense_list"), g = Symbol.for("react.memo"), m = Symbol.for("react.lazy"), W = Symbol.for("react.offscreen"), H = Symbol.iterator, Se = "@@iterator";
|
|
40
|
+
function Pe(e) {
|
|
41
|
+
if (e === null || typeof e != "object")
|
|
42
|
+
return null;
|
|
43
|
+
var r = H && e[H] || e[Se];
|
|
44
|
+
return typeof r == "function" ? r : null;
|
|
45
|
+
}
|
|
46
|
+
var w = k.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
47
|
+
function c(e) {
|
|
48
|
+
{
|
|
49
|
+
for (var r = arguments.length, t = new Array(r > 1 ? r - 1 : 0), n = 1; n < r; n++)
|
|
50
|
+
t[n - 1] = arguments[n];
|
|
51
|
+
we("error", e, t);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function we(e, r, t) {
|
|
55
|
+
{
|
|
56
|
+
var n = w.ReactDebugCurrentFrame, i = n.getStackAddendum();
|
|
57
|
+
i !== "" && (r += "%s", t = t.concat([i]));
|
|
58
|
+
var u = t.map(function(o) {
|
|
59
|
+
return String(o);
|
|
60
|
+
});
|
|
61
|
+
u.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, u);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
var je = !1, xe = !1, ke = !1, De = !1, Fe = !1, Z;
|
|
65
|
+
Z = Symbol.for("react.module.reference");
|
|
66
|
+
function Ae(e) {
|
|
67
|
+
return !!(typeof e == "string" || typeof e == "function" || e === y || e === S || Fe || e === C || e === P || e === p || De || e === W || je || xe || ke || typeof e == "object" && e !== null && (e.$$typeof === m || e.$$typeof === g || e.$$typeof === h || e.$$typeof === R || e.$$typeof === f || // This needs to include all possible module reference object
|
|
68
|
+
// types supported by any Flight configuration anywhere since
|
|
69
|
+
// we don't know which Flight build this will end up being used
|
|
70
|
+
// with.
|
|
71
|
+
e.$$typeof === Z || e.getModuleId !== void 0));
|
|
72
|
+
}
|
|
73
|
+
function Ie(e, r, t) {
|
|
74
|
+
var n = e.displayName;
|
|
75
|
+
if (n)
|
|
76
|
+
return n;
|
|
77
|
+
var i = r.displayName || r.name || "";
|
|
78
|
+
return i !== "" ? t + "(" + i + ")" : t;
|
|
79
|
+
}
|
|
80
|
+
function Q(e) {
|
|
81
|
+
return e.displayName || "Context";
|
|
82
|
+
}
|
|
83
|
+
function E(e) {
|
|
84
|
+
if (e == null)
|
|
85
|
+
return null;
|
|
86
|
+
if (typeof e.tag == "number" && c("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
|
|
87
|
+
return e.displayName || e.name || null;
|
|
88
|
+
if (typeof e == "string")
|
|
89
|
+
return e;
|
|
90
|
+
switch (e) {
|
|
91
|
+
case y:
|
|
92
|
+
return "Fragment";
|
|
93
|
+
case D:
|
|
94
|
+
return "Portal";
|
|
95
|
+
case S:
|
|
96
|
+
return "Profiler";
|
|
97
|
+
case C:
|
|
98
|
+
return "StrictMode";
|
|
99
|
+
case P:
|
|
100
|
+
return "Suspense";
|
|
101
|
+
case p:
|
|
102
|
+
return "SuspenseList";
|
|
103
|
+
}
|
|
104
|
+
if (typeof e == "object")
|
|
105
|
+
switch (e.$$typeof) {
|
|
106
|
+
case R:
|
|
107
|
+
var r = e;
|
|
108
|
+
return Q(r) + ".Consumer";
|
|
109
|
+
case h:
|
|
110
|
+
var t = e;
|
|
111
|
+
return Q(t._context) + ".Provider";
|
|
112
|
+
case f:
|
|
113
|
+
return Ie(e, e.render, "ForwardRef");
|
|
114
|
+
case g:
|
|
115
|
+
var n = e.displayName || null;
|
|
116
|
+
return n !== null ? n : E(e.type) || "Memo";
|
|
117
|
+
case m: {
|
|
118
|
+
var i = e, u = i._payload, o = i._init;
|
|
119
|
+
try {
|
|
120
|
+
return E(o(u));
|
|
121
|
+
} catch {
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
var T = Object.assign, F = 0, ee, re, te, ne, ae, oe, ie;
|
|
129
|
+
function ue() {
|
|
130
|
+
}
|
|
131
|
+
ue.__reactDisabledLog = !0;
|
|
132
|
+
function $e() {
|
|
133
|
+
{
|
|
134
|
+
if (F === 0) {
|
|
135
|
+
ee = console.log, re = console.info, te = console.warn, ne = console.error, ae = console.group, oe = console.groupCollapsed, ie = console.groupEnd;
|
|
136
|
+
var e = {
|
|
137
|
+
configurable: !0,
|
|
138
|
+
enumerable: !0,
|
|
139
|
+
value: ue,
|
|
140
|
+
writable: !0
|
|
141
|
+
};
|
|
142
|
+
Object.defineProperties(console, {
|
|
143
|
+
info: e,
|
|
144
|
+
log: e,
|
|
145
|
+
warn: e,
|
|
146
|
+
error: e,
|
|
147
|
+
group: e,
|
|
148
|
+
groupCollapsed: e,
|
|
149
|
+
groupEnd: e
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
F++;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
function We() {
|
|
156
|
+
{
|
|
157
|
+
if (F--, F === 0) {
|
|
158
|
+
var e = {
|
|
159
|
+
configurable: !0,
|
|
160
|
+
enumerable: !0,
|
|
161
|
+
writable: !0
|
|
162
|
+
};
|
|
163
|
+
Object.defineProperties(console, {
|
|
164
|
+
log: T({}, e, {
|
|
165
|
+
value: ee
|
|
166
|
+
}),
|
|
167
|
+
info: T({}, e, {
|
|
168
|
+
value: re
|
|
169
|
+
}),
|
|
170
|
+
warn: T({}, e, {
|
|
171
|
+
value: te
|
|
172
|
+
}),
|
|
173
|
+
error: T({}, e, {
|
|
174
|
+
value: ne
|
|
175
|
+
}),
|
|
176
|
+
group: T({}, e, {
|
|
177
|
+
value: ae
|
|
178
|
+
}),
|
|
179
|
+
groupCollapsed: T({}, e, {
|
|
180
|
+
value: oe
|
|
181
|
+
}),
|
|
182
|
+
groupEnd: T({}, e, {
|
|
183
|
+
value: ie
|
|
184
|
+
})
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
F < 0 && c("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
var U = w.ReactCurrentDispatcher, N;
|
|
191
|
+
function Y(e, r, t) {
|
|
192
|
+
{
|
|
193
|
+
if (N === void 0)
|
|
194
|
+
try {
|
|
195
|
+
throw Error();
|
|
196
|
+
} catch (i) {
|
|
197
|
+
var n = i.stack.trim().match(/\n( *(at )?)/);
|
|
198
|
+
N = n && n[1] || "";
|
|
199
|
+
}
|
|
200
|
+
return `
|
|
201
|
+
` + N + e;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
var B = !1, L;
|
|
205
|
+
{
|
|
206
|
+
var Ye = typeof WeakMap == "function" ? WeakMap : Map;
|
|
207
|
+
L = new Ye();
|
|
208
|
+
}
|
|
209
|
+
function se(e, r) {
|
|
210
|
+
if (!e || B)
|
|
211
|
+
return "";
|
|
212
|
+
{
|
|
213
|
+
var t = L.get(e);
|
|
214
|
+
if (t !== void 0)
|
|
215
|
+
return t;
|
|
216
|
+
}
|
|
217
|
+
var n;
|
|
218
|
+
B = !0;
|
|
219
|
+
var i = Error.prepareStackTrace;
|
|
220
|
+
Error.prepareStackTrace = void 0;
|
|
221
|
+
var u;
|
|
222
|
+
u = U.current, U.current = null, $e();
|
|
223
|
+
try {
|
|
224
|
+
if (r) {
|
|
225
|
+
var o = function() {
|
|
226
|
+
throw Error();
|
|
227
|
+
};
|
|
228
|
+
if (Object.defineProperty(o.prototype, "props", {
|
|
229
|
+
set: function() {
|
|
230
|
+
throw Error();
|
|
231
|
+
}
|
|
232
|
+
}), typeof Reflect == "object" && Reflect.construct) {
|
|
233
|
+
try {
|
|
234
|
+
Reflect.construct(o, []);
|
|
235
|
+
} catch (d) {
|
|
236
|
+
n = d;
|
|
237
|
+
}
|
|
238
|
+
Reflect.construct(e, [], o);
|
|
239
|
+
} else {
|
|
240
|
+
try {
|
|
241
|
+
o.call();
|
|
242
|
+
} catch (d) {
|
|
243
|
+
n = d;
|
|
244
|
+
}
|
|
245
|
+
e.call(o.prototype);
|
|
246
|
+
}
|
|
247
|
+
} else {
|
|
248
|
+
try {
|
|
249
|
+
throw Error();
|
|
250
|
+
} catch (d) {
|
|
251
|
+
n = d;
|
|
252
|
+
}
|
|
253
|
+
e();
|
|
254
|
+
}
|
|
255
|
+
} catch (d) {
|
|
256
|
+
if (d && n && typeof d.stack == "string") {
|
|
257
|
+
for (var a = d.stack.split(`
|
|
258
|
+
`), v = n.stack.split(`
|
|
259
|
+
`), s = a.length - 1, l = v.length - 1; s >= 1 && l >= 0 && a[s] !== v[l]; )
|
|
260
|
+
l--;
|
|
261
|
+
for (; s >= 1 && l >= 0; s--, l--)
|
|
262
|
+
if (a[s] !== v[l]) {
|
|
263
|
+
if (s !== 1 || l !== 1)
|
|
264
|
+
do
|
|
265
|
+
if (s--, l--, l < 0 || a[s] !== v[l]) {
|
|
266
|
+
var b = `
|
|
267
|
+
` + a[s].replace(" at new ", " at ");
|
|
268
|
+
return e.displayName && b.includes("<anonymous>") && (b = b.replace("<anonymous>", e.displayName)), typeof e == "function" && L.set(e, b), b;
|
|
269
|
+
}
|
|
270
|
+
while (s >= 1 && l >= 0);
|
|
271
|
+
break;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
} finally {
|
|
275
|
+
B = !1, U.current = u, We(), Error.prepareStackTrace = i;
|
|
276
|
+
}
|
|
277
|
+
var x = e ? e.displayName || e.name : "", O = x ? Y(x) : "";
|
|
278
|
+
return typeof e == "function" && L.set(e, O), O;
|
|
279
|
+
}
|
|
280
|
+
function Le(e, r, t) {
|
|
281
|
+
return se(e, !1);
|
|
282
|
+
}
|
|
283
|
+
function Ve(e) {
|
|
284
|
+
var r = e.prototype;
|
|
285
|
+
return !!(r && r.isReactComponent);
|
|
286
|
+
}
|
|
287
|
+
function V(e, r, t) {
|
|
288
|
+
if (e == null)
|
|
289
|
+
return "";
|
|
290
|
+
if (typeof e == "function")
|
|
291
|
+
return se(e, Ve(e));
|
|
292
|
+
if (typeof e == "string")
|
|
293
|
+
return Y(e);
|
|
294
|
+
switch (e) {
|
|
295
|
+
case P:
|
|
296
|
+
return Y("Suspense");
|
|
297
|
+
case p:
|
|
298
|
+
return Y("SuspenseList");
|
|
299
|
+
}
|
|
300
|
+
if (typeof e == "object")
|
|
301
|
+
switch (e.$$typeof) {
|
|
302
|
+
case f:
|
|
303
|
+
return Le(e.render);
|
|
304
|
+
case g:
|
|
305
|
+
return V(e.type, r, t);
|
|
306
|
+
case m: {
|
|
307
|
+
var n = e, i = n._payload, u = n._init;
|
|
308
|
+
try {
|
|
309
|
+
return V(u(i), r, t);
|
|
310
|
+
} catch {
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
return "";
|
|
315
|
+
}
|
|
316
|
+
var A = Object.prototype.hasOwnProperty, le = {}, fe = w.ReactDebugCurrentFrame;
|
|
317
|
+
function M(e) {
|
|
318
|
+
if (e) {
|
|
319
|
+
var r = e._owner, t = V(e.type, e._source, r ? r.type : null);
|
|
320
|
+
fe.setExtraStackFrame(t);
|
|
321
|
+
} else
|
|
322
|
+
fe.setExtraStackFrame(null);
|
|
323
|
+
}
|
|
324
|
+
function Me(e, r, t, n, i) {
|
|
325
|
+
{
|
|
326
|
+
var u = Function.call.bind(A);
|
|
327
|
+
for (var o in e)
|
|
328
|
+
if (u(e, o)) {
|
|
329
|
+
var a = void 0;
|
|
330
|
+
try {
|
|
331
|
+
if (typeof e[o] != "function") {
|
|
332
|
+
var v = Error((n || "React class") + ": " + t + " type `" + o + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[o] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
333
|
+
throw v.name = "Invariant Violation", v;
|
|
334
|
+
}
|
|
335
|
+
a = e[o](r, o, n, t, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
336
|
+
} catch (s) {
|
|
337
|
+
a = s;
|
|
338
|
+
}
|
|
339
|
+
a && !(a instanceof Error) && (M(i), c("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", n || "React class", t, o, typeof a), M(null)), a instanceof Error && !(a.message in le) && (le[a.message] = !0, M(i), c("Failed %s type: %s", t, a.message), M(null));
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
var Ue = Array.isArray;
|
|
344
|
+
function J(e) {
|
|
345
|
+
return Ue(e);
|
|
346
|
+
}
|
|
347
|
+
function Ne(e) {
|
|
348
|
+
{
|
|
349
|
+
var r = typeof Symbol == "function" && Symbol.toStringTag, t = r && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
350
|
+
return t;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
function Be(e) {
|
|
354
|
+
try {
|
|
355
|
+
return ce(e), !1;
|
|
356
|
+
} catch {
|
|
357
|
+
return !0;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
function ce(e) {
|
|
361
|
+
return "" + e;
|
|
362
|
+
}
|
|
363
|
+
function ve(e) {
|
|
364
|
+
if (Be(e))
|
|
365
|
+
return c("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Ne(e)), ce(e);
|
|
366
|
+
}
|
|
367
|
+
var de = w.ReactCurrentOwner, Je = {
|
|
368
|
+
key: !0,
|
|
369
|
+
ref: !0,
|
|
370
|
+
__self: !0,
|
|
371
|
+
__source: !0
|
|
372
|
+
}, pe, be;
|
|
373
|
+
function qe(e) {
|
|
374
|
+
if (A.call(e, "ref")) {
|
|
375
|
+
var r = Object.getOwnPropertyDescriptor(e, "ref").get;
|
|
376
|
+
if (r && r.isReactWarning)
|
|
377
|
+
return !1;
|
|
378
|
+
}
|
|
379
|
+
return e.ref !== void 0;
|
|
380
|
+
}
|
|
381
|
+
function Ke(e) {
|
|
382
|
+
if (A.call(e, "key")) {
|
|
383
|
+
var r = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
384
|
+
if (r && r.isReactWarning)
|
|
385
|
+
return !1;
|
|
386
|
+
}
|
|
387
|
+
return e.key !== void 0;
|
|
388
|
+
}
|
|
389
|
+
function ze(e, r) {
|
|
390
|
+
typeof e.ref == "string" && de.current;
|
|
391
|
+
}
|
|
392
|
+
function Ge(e, r) {
|
|
393
|
+
{
|
|
394
|
+
var t = function() {
|
|
395
|
+
pe || (pe = !0, c("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
|
|
396
|
+
};
|
|
397
|
+
t.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
398
|
+
get: t,
|
|
399
|
+
configurable: !0
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
function Xe(e, r) {
|
|
404
|
+
{
|
|
405
|
+
var t = function() {
|
|
406
|
+
be || (be = !0, c("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
|
|
407
|
+
};
|
|
408
|
+
t.isReactWarning = !0, Object.defineProperty(e, "ref", {
|
|
409
|
+
get: t,
|
|
410
|
+
configurable: !0
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
var He = function(e, r, t, n, i, u, o) {
|
|
415
|
+
var a = {
|
|
416
|
+
// This tag allows us to uniquely identify this as a React Element
|
|
417
|
+
$$typeof: _,
|
|
418
|
+
// Built-in properties that belong on the element
|
|
419
|
+
type: e,
|
|
420
|
+
key: r,
|
|
421
|
+
ref: t,
|
|
422
|
+
props: o,
|
|
423
|
+
// Record the component responsible for creating this element.
|
|
424
|
+
_owner: u
|
|
425
|
+
};
|
|
426
|
+
return a._store = {}, Object.defineProperty(a._store, "validated", {
|
|
427
|
+
configurable: !1,
|
|
428
|
+
enumerable: !1,
|
|
429
|
+
writable: !0,
|
|
430
|
+
value: !1
|
|
431
|
+
}), Object.defineProperty(a, "_self", {
|
|
432
|
+
configurable: !1,
|
|
433
|
+
enumerable: !1,
|
|
434
|
+
writable: !1,
|
|
435
|
+
value: n
|
|
436
|
+
}), Object.defineProperty(a, "_source", {
|
|
437
|
+
configurable: !1,
|
|
438
|
+
enumerable: !1,
|
|
439
|
+
writable: !1,
|
|
440
|
+
value: i
|
|
441
|
+
}), Object.freeze && (Object.freeze(a.props), Object.freeze(a)), a;
|
|
442
|
+
};
|
|
443
|
+
function Ze(e, r, t, n, i) {
|
|
444
|
+
{
|
|
445
|
+
var u, o = {}, a = null, v = null;
|
|
446
|
+
t !== void 0 && (ve(t), a = "" + t), Ke(r) && (ve(r.key), a = "" + r.key), qe(r) && (v = r.ref, ze(r, i));
|
|
447
|
+
for (u in r)
|
|
448
|
+
A.call(r, u) && !Je.hasOwnProperty(u) && (o[u] = r[u]);
|
|
449
|
+
if (e && e.defaultProps) {
|
|
450
|
+
var s = e.defaultProps;
|
|
451
|
+
for (u in s)
|
|
452
|
+
o[u] === void 0 && (o[u] = s[u]);
|
|
453
|
+
}
|
|
454
|
+
if (a || v) {
|
|
455
|
+
var l = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
456
|
+
a && Ge(o, l), v && Xe(o, l);
|
|
457
|
+
}
|
|
458
|
+
return He(e, a, v, i, n, de.current, o);
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
var q = w.ReactCurrentOwner, ge = w.ReactDebugCurrentFrame;
|
|
462
|
+
function j(e) {
|
|
463
|
+
if (e) {
|
|
464
|
+
var r = e._owner, t = V(e.type, e._source, r ? r.type : null);
|
|
465
|
+
ge.setExtraStackFrame(t);
|
|
466
|
+
} else
|
|
467
|
+
ge.setExtraStackFrame(null);
|
|
468
|
+
}
|
|
469
|
+
var K;
|
|
470
|
+
K = !1;
|
|
471
|
+
function z(e) {
|
|
472
|
+
return typeof e == "object" && e !== null && e.$$typeof === _;
|
|
473
|
+
}
|
|
474
|
+
function ye() {
|
|
475
|
+
{
|
|
476
|
+
if (q.current) {
|
|
477
|
+
var e = E(q.current.type);
|
|
478
|
+
if (e)
|
|
479
|
+
return `
|
|
480
|
+
|
|
481
|
+
Check the render method of \`` + e + "`.";
|
|
482
|
+
}
|
|
483
|
+
return "";
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
function Qe(e) {
|
|
487
|
+
return "";
|
|
488
|
+
}
|
|
489
|
+
var Ee = {};
|
|
490
|
+
function er(e) {
|
|
491
|
+
{
|
|
492
|
+
var r = ye();
|
|
493
|
+
if (!r) {
|
|
494
|
+
var t = typeof e == "string" ? e : e.displayName || e.name;
|
|
495
|
+
t && (r = `
|
|
496
|
+
|
|
497
|
+
Check the top-level render call using <` + t + ">.");
|
|
498
|
+
}
|
|
499
|
+
return r;
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
function _e(e, r) {
|
|
503
|
+
{
|
|
504
|
+
if (!e._store || e._store.validated || e.key != null)
|
|
505
|
+
return;
|
|
506
|
+
e._store.validated = !0;
|
|
507
|
+
var t = er(r);
|
|
508
|
+
if (Ee[t])
|
|
509
|
+
return;
|
|
510
|
+
Ee[t] = !0;
|
|
511
|
+
var n = "";
|
|
512
|
+
e && e._owner && e._owner !== q.current && (n = " It was passed a child from " + E(e._owner.type) + "."), j(e), c('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', t, n), j(null);
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
function he(e, r) {
|
|
516
|
+
{
|
|
517
|
+
if (typeof e != "object")
|
|
518
|
+
return;
|
|
519
|
+
if (J(e))
|
|
520
|
+
for (var t = 0; t < e.length; t++) {
|
|
521
|
+
var n = e[t];
|
|
522
|
+
z(n) && _e(n, r);
|
|
523
|
+
}
|
|
524
|
+
else if (z(e))
|
|
525
|
+
e._store && (e._store.validated = !0);
|
|
526
|
+
else if (e) {
|
|
527
|
+
var i = Pe(e);
|
|
528
|
+
if (typeof i == "function" && i !== e.entries)
|
|
529
|
+
for (var u = i.call(e), o; !(o = u.next()).done; )
|
|
530
|
+
z(o.value) && _e(o.value, r);
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
function rr(e) {
|
|
535
|
+
{
|
|
536
|
+
var r = e.type;
|
|
537
|
+
if (r == null || typeof r == "string")
|
|
538
|
+
return;
|
|
539
|
+
var t;
|
|
540
|
+
if (typeof r == "function")
|
|
541
|
+
t = r.propTypes;
|
|
542
|
+
else if (typeof r == "object" && (r.$$typeof === f || // Note: Memo only checks outer props here.
|
|
543
|
+
// Inner props are checked in the reconciler.
|
|
544
|
+
r.$$typeof === g))
|
|
545
|
+
t = r.propTypes;
|
|
546
|
+
else
|
|
547
|
+
return;
|
|
548
|
+
if (t) {
|
|
549
|
+
var n = E(r);
|
|
550
|
+
Me(t, e.props, "prop", n, e);
|
|
551
|
+
} else if (r.PropTypes !== void 0 && !K) {
|
|
552
|
+
K = !0;
|
|
553
|
+
var i = E(r);
|
|
554
|
+
c("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", i || "Unknown");
|
|
555
|
+
}
|
|
556
|
+
typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && c("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
function tr(e) {
|
|
560
|
+
{
|
|
561
|
+
for (var r = Object.keys(e.props), t = 0; t < r.length; t++) {
|
|
562
|
+
var n = r[t];
|
|
563
|
+
if (n !== "children" && n !== "key") {
|
|
564
|
+
j(e), c("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", n), j(null);
|
|
565
|
+
break;
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
e.ref !== null && (j(e), c("Invalid attribute `ref` supplied to `React.Fragment`."), j(null));
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
var Re = {};
|
|
572
|
+
function me(e, r, t, n, i, u) {
|
|
573
|
+
{
|
|
574
|
+
var o = Ae(e);
|
|
575
|
+
if (!o) {
|
|
576
|
+
var a = "";
|
|
577
|
+
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (a += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
578
|
+
var v = Qe();
|
|
579
|
+
v ? a += v : a += ye();
|
|
580
|
+
var s;
|
|
581
|
+
e === null ? s = "null" : J(e) ? s = "array" : e !== void 0 && e.$$typeof === _ ? (s = "<" + (E(e.type) || "Unknown") + " />", a = " Did you accidentally export a JSX literal instead of a component?") : s = typeof e, c("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", s, a);
|
|
582
|
+
}
|
|
583
|
+
var l = Ze(e, r, t, i, u);
|
|
584
|
+
if (l == null)
|
|
585
|
+
return l;
|
|
586
|
+
if (o) {
|
|
587
|
+
var b = r.children;
|
|
588
|
+
if (b !== void 0)
|
|
589
|
+
if (n)
|
|
590
|
+
if (J(b)) {
|
|
591
|
+
for (var x = 0; x < b.length; x++)
|
|
592
|
+
he(b[x], e);
|
|
593
|
+
Object.freeze && Object.freeze(b);
|
|
594
|
+
} else
|
|
595
|
+
c("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
596
|
+
else
|
|
597
|
+
he(b, e);
|
|
598
|
+
}
|
|
599
|
+
if (A.call(r, "key")) {
|
|
600
|
+
var O = E(e), d = Object.keys(r).filter(function(sr) {
|
|
601
|
+
return sr !== "key";
|
|
602
|
+
}), G = d.length > 0 ? "{key: someKey, " + d.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
603
|
+
if (!Re[O + G]) {
|
|
604
|
+
var ur = d.length > 0 ? "{" + d.join(": ..., ") + ": ...}" : "{}";
|
|
605
|
+
c(`A props object containing a "key" prop is being spread into JSX:
|
|
606
|
+
let props = %s;
|
|
607
|
+
<%s {...props} />
|
|
608
|
+
React keys must be passed directly to JSX without using spread:
|
|
609
|
+
let props = %s;
|
|
610
|
+
<%s key={someKey} {...props} />`, G, O, ur, O), Re[O + G] = !0;
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
return e === y ? tr(l) : rr(l), l;
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
function nr(e, r, t) {
|
|
617
|
+
return me(e, r, t, !0);
|
|
618
|
+
}
|
|
619
|
+
function ar(e, r, t) {
|
|
620
|
+
return me(e, r, t, !1);
|
|
621
|
+
}
|
|
622
|
+
var or = ar, ir = nr;
|
|
623
|
+
$.Fragment = y, $.jsx = or, $.jsxs = ir;
|
|
624
|
+
}()), $;
|
|
625
|
+
}
|
|
626
|
+
process.env.NODE_ENV === "production" ? X.exports = lr() : X.exports = fr();
|
|
627
|
+
var cr = X.exports;
|
|
628
|
+
const dr = ({
|
|
629
|
+
variant: k = "primary",
|
|
630
|
+
size: _ = "medium",
|
|
631
|
+
label: D,
|
|
632
|
+
className: y = "",
|
|
633
|
+
...C
|
|
634
|
+
}) => {
|
|
635
|
+
const S = `btn-${k}`, h = `btn-${_}`;
|
|
636
|
+
return /* @__PURE__ */ cr.jsx(
|
|
637
|
+
"button",
|
|
638
|
+
{
|
|
639
|
+
type: "button",
|
|
640
|
+
className: ["reusable-btn", h, S, y].join(" "),
|
|
641
|
+
...C,
|
|
642
|
+
children: D
|
|
643
|
+
}
|
|
644
|
+
);
|
|
645
|
+
};
|
|
646
|
+
export {
|
|
647
|
+
dr as Button
|
|
648
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
(function(E,C){typeof exports=="object"&&typeof module<"u"?C(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],C):(E=typeof globalThis<"u"?globalThis:E||self,C(E.MyReactButton={},E.React))})(this,function(E,C){"use strict";var B={exports:{}},F={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-jsx-runtime.production.min.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var Q;function Pe(){if(Q)return F;Q=1;var I=C,_=Symbol.for("react.element"),W=Symbol.for("react.fragment"),g=Object.prototype.hasOwnProperty,P=I.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,w={key:!0,ref:!0,__self:!0,__source:!0};function R(m,l,j){var p,y={},T=null,M=null;j!==void 0&&(T=""+j),l.key!==void 0&&(T=""+l.key),l.ref!==void 0&&(M=l.ref);for(p in l)g.call(l,p)&&!w.hasOwnProperty(p)&&(y[p]=l[p]);if(m&&m.defaultProps)for(p in l=m.defaultProps,l)y[p]===void 0&&(y[p]=l[p]);return{$$typeof:_,type:m,key:T,ref:M,props:y,_owner:P.current}}return F.Fragment=W,F.jsx=R,F.jsxs=R,F}var A={};/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react-jsx-runtime.development.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var ee;function we(){return ee||(ee=1,process.env.NODE_ENV!=="production"&&function(){var I=C,_=Symbol.for("react.element"),W=Symbol.for("react.portal"),g=Symbol.for("react.fragment"),P=Symbol.for("react.strict_mode"),w=Symbol.for("react.profiler"),R=Symbol.for("react.provider"),m=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),j=Symbol.for("react.suspense"),p=Symbol.for("react.suspense_list"),y=Symbol.for("react.memo"),T=Symbol.for("react.lazy"),M=Symbol.for("react.offscreen"),re=Symbol.iterator,ke="@@iterator";function De(e){if(e===null||typeof e!="object")return null;var r=re&&e[re]||e[ke];return typeof r=="function"?r:null}var x=I.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function c(e){{for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];Fe("error",e,t)}}function Fe(e,r,t){{var n=x.ReactDebugCurrentFrame,i=n.getStackAddendum();i!==""&&(r+="%s",t=t.concat([i]));var u=t.map(function(o){return String(o)});u.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,u)}}var Ae=!1,Ie=!1,We=!1,Ye=!1,$e=!1,te;te=Symbol.for("react.module.reference");function Me(e){return!!(typeof e=="string"||typeof e=="function"||e===g||e===w||$e||e===P||e===j||e===p||Ye||e===M||Ae||Ie||We||typeof e=="object"&&e!==null&&(e.$$typeof===T||e.$$typeof===y||e.$$typeof===R||e.$$typeof===m||e.$$typeof===l||e.$$typeof===te||e.getModuleId!==void 0))}function Le(e,r,t){var n=e.displayName;if(n)return n;var i=r.displayName||r.name||"";return i!==""?t+"("+i+")":t}function ne(e){return e.displayName||"Context"}function h(e){if(e==null)return null;if(typeof e.tag=="number"&&c("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case g:return"Fragment";case W:return"Portal";case w:return"Profiler";case P:return"StrictMode";case j:return"Suspense";case p:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case m:var r=e;return ne(r)+".Consumer";case R:var t=e;return ne(t._context)+".Provider";case l:return Le(e,e.render,"ForwardRef");case y:var n=e.displayName||null;return n!==null?n:h(e.type)||"Memo";case T:{var i=e,u=i._payload,o=i._init;try{return h(o(u))}catch{return null}}}return null}var O=Object.assign,Y=0,ae,oe,ie,ue,se,fe,le;function ce(){}ce.__reactDisabledLog=!0;function Ve(){{if(Y===0){ae=console.log,oe=console.info,ie=console.warn,ue=console.error,se=console.group,fe=console.groupCollapsed,le=console.groupEnd;var e={configurable:!0,enumerable:!0,value:ce,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}Y++}}function Ue(){{if(Y--,Y===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:O({},e,{value:ae}),info:O({},e,{value:oe}),warn:O({},e,{value:ie}),error:O({},e,{value:ue}),group:O({},e,{value:se}),groupCollapsed:O({},e,{value:fe}),groupEnd:O({},e,{value:le})})}Y<0&&c("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var J=x.ReactCurrentDispatcher,K;function L(e,r,t){{if(K===void 0)try{throw Error()}catch(i){var n=i.stack.trim().match(/\n( *(at )?)/);K=n&&n[1]||""}return`
|
|
18
|
+
`+K+e}}var q=!1,V;{var Ne=typeof WeakMap=="function"?WeakMap:Map;V=new Ne}function de(e,r){if(!e||q)return"";{var t=V.get(e);if(t!==void 0)return t}var n;q=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var u;u=J.current,J.current=null,Ve();try{if(r){var o=function(){throw Error()};if(Object.defineProperty(o.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(o,[])}catch(v){n=v}Reflect.construct(e,[],o)}else{try{o.call()}catch(v){n=v}e.call(o.prototype)}}else{try{throw Error()}catch(v){n=v}e()}}catch(v){if(v&&n&&typeof v.stack=="string"){for(var a=v.stack.split(`
|
|
19
|
+
`),d=n.stack.split(`
|
|
20
|
+
`),s=a.length-1,f=d.length-1;s>=1&&f>=0&&a[s]!==d[f];)f--;for(;s>=1&&f>=0;s--,f--)if(a[s]!==d[f]){if(s!==1||f!==1)do if(s--,f--,f<0||a[s]!==d[f]){var b=`
|
|
21
|
+
`+a[s].replace(" at new "," at ");return e.displayName&&b.includes("<anonymous>")&&(b=b.replace("<anonymous>",e.displayName)),typeof e=="function"&&V.set(e,b),b}while(s>=1&&f>=0);break}}}finally{q=!1,J.current=u,Ue(),Error.prepareStackTrace=i}var D=e?e.displayName||e.name:"",S=D?L(D):"";return typeof e=="function"&&V.set(e,S),S}function Be(e,r,t){return de(e,!1)}function Je(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function U(e,r,t){if(e==null)return"";if(typeof e=="function")return de(e,Je(e));if(typeof e=="string")return L(e);switch(e){case j:return L("Suspense");case p:return L("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case l:return Be(e.render);case y:return U(e.type,r,t);case T:{var n=e,i=n._payload,u=n._init;try{return U(u(i),r,t)}catch{}}}return""}var $=Object.prototype.hasOwnProperty,ve={},pe=x.ReactDebugCurrentFrame;function N(e){if(e){var r=e._owner,t=U(e.type,e._source,r?r.type:null);pe.setExtraStackFrame(t)}else pe.setExtraStackFrame(null)}function Ke(e,r,t,n,i){{var u=Function.call.bind($);for(var o in e)if(u(e,o)){var a=void 0;try{if(typeof e[o]!="function"){var d=Error((n||"React class")+": "+t+" type `"+o+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[o]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw d.name="Invariant Violation",d}a=e[o](r,o,n,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(s){a=s}a&&!(a instanceof Error)&&(N(i),c("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",n||"React class",t,o,typeof a),N(null)),a instanceof Error&&!(a.message in ve)&&(ve[a.message]=!0,N(i),c("Failed %s type: %s",t,a.message),N(null))}}}var qe=Array.isArray;function z(e){return qe(e)}function ze(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function Ge(e){try{return be(e),!1}catch{return!0}}function be(e){return""+e}function ye(e){if(Ge(e))return c("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",ze(e)),be(e)}var ge=x.ReactCurrentOwner,Xe={key:!0,ref:!0,__self:!0,__source:!0},he,Ee;function He(e){if($.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function Ze(e){if($.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function Qe(e,r){typeof e.ref=="string"&&ge.current}function er(e,r){{var t=function(){he||(he=!0,c("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}}function rr(e,r){{var t=function(){Ee||(Ee=!0,c("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"ref",{get:t,configurable:!0})}}var tr=function(e,r,t,n,i,u,o){var a={$$typeof:_,type:e,key:r,ref:t,props:o,_owner:u};return a._store={},Object.defineProperty(a._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(a,"_self",{configurable:!1,enumerable:!1,writable:!1,value:n}),Object.defineProperty(a,"_source",{configurable:!1,enumerable:!1,writable:!1,value:i}),Object.freeze&&(Object.freeze(a.props),Object.freeze(a)),a};function nr(e,r,t,n,i){{var u,o={},a=null,d=null;t!==void 0&&(ye(t),a=""+t),Ze(r)&&(ye(r.key),a=""+r.key),He(r)&&(d=r.ref,Qe(r,i));for(u in r)$.call(r,u)&&!Xe.hasOwnProperty(u)&&(o[u]=r[u]);if(e&&e.defaultProps){var s=e.defaultProps;for(u in s)o[u]===void 0&&(o[u]=s[u])}if(a||d){var f=typeof e=="function"?e.displayName||e.name||"Unknown":e;a&&er(o,f),d&&rr(o,f)}return tr(e,a,d,i,n,ge.current,o)}}var G=x.ReactCurrentOwner,_e=x.ReactDebugCurrentFrame;function k(e){if(e){var r=e._owner,t=U(e.type,e._source,r?r.type:null);_e.setExtraStackFrame(t)}else _e.setExtraStackFrame(null)}var X;X=!1;function H(e){return typeof e=="object"&&e!==null&&e.$$typeof===_}function Re(){{if(G.current){var e=h(G.current.type);if(e)return`
|
|
22
|
+
|
|
23
|
+
Check the render method of \``+e+"`."}return""}}function ar(e){return""}var me={};function or(e){{var r=Re();if(!r){var t=typeof e=="string"?e:e.displayName||e.name;t&&(r=`
|
|
24
|
+
|
|
25
|
+
Check the top-level render call using <`+t+">.")}return r}}function Te(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=or(r);if(me[t])return;me[t]=!0;var n="";e&&e._owner&&e._owner!==G.current&&(n=" It was passed a child from "+h(e._owner.type)+"."),k(e),c('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,n),k(null)}}function Oe(e,r){{if(typeof e!="object")return;if(z(e))for(var t=0;t<e.length;t++){var n=e[t];H(n)&&Te(n,r)}else if(H(e))e._store&&(e._store.validated=!0);else if(e){var i=De(e);if(typeof i=="function"&&i!==e.entries)for(var u=i.call(e),o;!(o=u.next()).done;)H(o.value)&&Te(o.value,r)}}}function ir(e){{var r=e.type;if(r==null||typeof r=="string")return;var t;if(typeof r=="function")t=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===l||r.$$typeof===y))t=r.propTypes;else return;if(t){var n=h(r);Ke(t,e.props,"prop",n,e)}else if(r.PropTypes!==void 0&&!X){X=!0;var i=h(r);c("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",i||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&c("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function ur(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var n=r[t];if(n!=="children"&&n!=="key"){k(e),c("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),k(null);break}}e.ref!==null&&(k(e),c("Invalid attribute `ref` supplied to `React.Fragment`."),k(null))}}var Se={};function Ce(e,r,t,n,i,u){{var o=Me(e);if(!o){var a="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(a+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var d=ar();d?a+=d:a+=Re();var s;e===null?s="null":z(e)?s="array":e!==void 0&&e.$$typeof===_?(s="<"+(h(e.type)||"Unknown")+" />",a=" Did you accidentally export a JSX literal instead of a component?"):s=typeof e,c("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",s,a)}var f=nr(e,r,t,i,u);if(f==null)return f;if(o){var b=r.children;if(b!==void 0)if(n)if(z(b)){for(var D=0;D<b.length;D++)Oe(b[D],e);Object.freeze&&Object.freeze(b)}else c("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Oe(b,e)}if($.call(r,"key")){var S=h(e),v=Object.keys(r).filter(function(vr){return vr!=="key"}),Z=v.length>0?"{key: someKey, "+v.join(": ..., ")+": ...}":"{key: someKey}";if(!Se[S+Z]){var dr=v.length>0?"{"+v.join(": ..., ")+": ...}":"{}";c(`A props object containing a "key" prop is being spread into JSX:
|
|
26
|
+
let props = %s;
|
|
27
|
+
<%s {...props} />
|
|
28
|
+
React keys must be passed directly to JSX without using spread:
|
|
29
|
+
let props = %s;
|
|
30
|
+
<%s key={someKey} {...props} />`,Z,S,dr,S),Se[S+Z]=!0}}return e===g?ur(f):ir(f),f}}function sr(e,r,t){return Ce(e,r,t,!0)}function fr(e,r,t){return Ce(e,r,t,!1)}var lr=fr,cr=sr;A.Fragment=g,A.jsx=lr,A.jsxs=cr}()),A}process.env.NODE_ENV==="production"?B.exports=Pe():B.exports=we();var je=B.exports;const xe=({variant:I="primary",size:_="medium",label:W,className:g="",...P})=>{const w=`btn-${I}`,R=`btn-${_}`;return je.jsx("button",{type:"button",className:["reusable-btn",R,w,g].join(" "),...P,children:W})};E.Button=xe,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"})});
|
package/dist/style.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.reusable-btn{font-family:Inter,system-ui,-apple-system,sans-serif;font-weight:600;border:1px solid transparent;border-radius:8px;cursor:pointer;display:inline-block;line-height:1;transition:all .25s cubic-bezier(.4,0,.2,1);outline:none}.btn-primary{color:#fff;background:linear-gradient(135deg,#6366f1,#4f46e5);box-shadow:0 4px 14px #6366f14d}.btn-primary:hover{background:linear-gradient(135deg,#4f46e5,#4338ca);box-shadow:0 6px 20px #6366f166;transform:translateY(-1px)}.btn-primary:active{transform:translateY(0)}.btn-secondary{color:#1f2937;background:#f3f4f6;box-shadow:0 4px 6px -1px #0000000d}.btn-secondary:hover{background:#e5e7eb;transform:translateY(-1px)}.btn-outline{color:#4f46e5;background-color:transparent;border-color:#4f46e5}.btn-outline:hover{background-color:#6366f10f;transform:translateY(-1px)}.btn-small{font-size:12px;padding:8px 16px}.btn-medium{font-size:14px;padding:11px 20px}.btn-large{font-size:16px;padding:14px 28px}.reusable-btn:disabled{opacity:.6;cursor:not-allowed;pointer-events:none}
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "praveenarasu-react-button-lib",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A reusable React component library built with Vite, TypeScript, and dts.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/my-react-button.umd.js",
|
|
7
|
+
"module": "./dist/my-react-button.es.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./dist/my-react-button.es.js",
|
|
12
|
+
"require": "./dist/my-react-button.umd.js",
|
|
13
|
+
"types": "./dist/index.d.ts"
|
|
14
|
+
},
|
|
15
|
+
"./dist/style.css": "./dist/style.css"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"dev": "vite",
|
|
22
|
+
"build": "tsc && vite build",
|
|
23
|
+
"preview": "vite preview"
|
|
24
|
+
},
|
|
25
|
+
"peerDependencies": {
|
|
26
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
27
|
+
"react-dom": "^18.0.0 || ^19.0.0"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@types/react": "^18.2.0 || ^19.0.0",
|
|
31
|
+
"@types/react-dom": "^18.2.0 || ^19.0.0",
|
|
32
|
+
"@vitejs/plugin-react": "^4.2.1",
|
|
33
|
+
"react": "^18.2.0",
|
|
34
|
+
"react-dom": "^18.2.0",
|
|
35
|
+
"typescript": "^5.2.2",
|
|
36
|
+
"vite": "^5.2.0",
|
|
37
|
+
"vite-plugin-dts": "^3.9.1"
|
|
38
|
+
}
|
|
39
|
+
}
|