virtual-ui-lib 1.0.16 → 1.0.18
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/index.js +92 -2
- package/dist/index.mjs +89 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -32,7 +32,9 @@ __export(index_exports, {
|
|
|
32
32
|
AlertBanner: () => AlertBanner,
|
|
33
33
|
Button: () => Button,
|
|
34
34
|
Card: () => Card,
|
|
35
|
-
Dropdown: () => Dropdown
|
|
35
|
+
Dropdown: () => Dropdown,
|
|
36
|
+
EmptyState: () => EmptyState,
|
|
37
|
+
FormInput: () => FormInput
|
|
36
38
|
});
|
|
37
39
|
module.exports = __toCommonJS(index_exports);
|
|
38
40
|
|
|
@@ -272,10 +274,98 @@ var Dropdown = ({
|
|
|
272
274
|
transition: "background 0.2s"
|
|
273
275
|
}, onMouseEnter: (e) => e.currentTarget.style.background = "rgba(124,58,237,0.05)", onMouseLeave: (e) => e.currentTarget.style.background = "transparent" }, option))));
|
|
274
276
|
};
|
|
277
|
+
|
|
278
|
+
// src/components/EmptyState/EmptyState.jsx
|
|
279
|
+
var import_react5 = __toESM(require("react"));
|
|
280
|
+
var EmptyState = ({
|
|
281
|
+
mode = "default",
|
|
282
|
+
icon = "https://i.imgur.com/E9Gdppt.png",
|
|
283
|
+
message = "No data available. Please check back later.",
|
|
284
|
+
actionText = "Try Again",
|
|
285
|
+
onAction
|
|
286
|
+
}) => {
|
|
287
|
+
const [isVisible, setIsVisible] = (0, import_react5.useState)(false);
|
|
288
|
+
(0, import_react5.useEffect)(() => {
|
|
289
|
+
setIsVisible(true);
|
|
290
|
+
}, []);
|
|
291
|
+
const renderModeContent = () => {
|
|
292
|
+
switch (mode) {
|
|
293
|
+
case "action available":
|
|
294
|
+
return /* @__PURE__ */ import_react5.default.createElement("div", { style: { textAlign: "center" } }, /* @__PURE__ */ import_react5.default.createElement("img", { src: icon, alt: "Empty State Icon", style: { width: "60px", marginBottom: "16px" } }), /* @__PURE__ */ import_react5.default.createElement("p", { style: { fontSize: "16px", color: "#64748b", margin: 0 } }, message), /* @__PURE__ */ import_react5.default.createElement("button", { onClick: onAction, style: {
|
|
295
|
+
marginTop: "20px",
|
|
296
|
+
padding: "10px 20px",
|
|
297
|
+
background: "#7c3aed",
|
|
298
|
+
color: "white",
|
|
299
|
+
border: "none",
|
|
300
|
+
borderRadius: "8px",
|
|
301
|
+
cursor: "pointer",
|
|
302
|
+
fontSize: "14px",
|
|
303
|
+
fontWeight: "600",
|
|
304
|
+
transition: "background 0.3s ease, transform 0.3s ease",
|
|
305
|
+
boxShadow: "0 4px 14px rgba(124,58,237,0.4)"
|
|
306
|
+
}, onMouseEnter: (e) => e.currentTarget.style.background = "#6d28d9", onMouseLeave: (e) => e.currentTarget.style.background = "#7c3aed" }, actionText));
|
|
307
|
+
case "illustration mode":
|
|
308
|
+
return /* @__PURE__ */ import_react5.default.createElement("div", { style: { textAlign: "center" } }, /* @__PURE__ */ import_react5.default.createElement("img", { src: icon, alt: "Illustration", style: { width: "80px", marginBottom: "16px" } }), /* @__PURE__ */ import_react5.default.createElement("p", { style: { fontSize: "16px", color: "#64748b", margin: 0 } }, message));
|
|
309
|
+
default:
|
|
310
|
+
return /* @__PURE__ */ import_react5.default.createElement("div", { style: { textAlign: "center" } }, /* @__PURE__ */ import_react5.default.createElement("img", { src: icon, alt: "Default Icon", style: { width: "60px", marginBottom: "16px" } }), /* @__PURE__ */ import_react5.default.createElement("p", { style: { fontSize: "16px", color: "#64748b", margin: 0 } }, message));
|
|
311
|
+
}
|
|
312
|
+
};
|
|
313
|
+
return /* @__PURE__ */ import_react5.default.createElement("div", { style: {
|
|
314
|
+
display: "flex",
|
|
315
|
+
justifyContent: "center",
|
|
316
|
+
alignItems: "center",
|
|
317
|
+
height: "100vh",
|
|
318
|
+
opacity: isVisible ? 1 : 0,
|
|
319
|
+
transition: "opacity 0.5s ease-in-out"
|
|
320
|
+
} }, renderModeContent());
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
// src/components/FormInput/FormInput.jsx
|
|
324
|
+
var import_react6 = __toESM(require("react"));
|
|
325
|
+
var FormInput = ({
|
|
326
|
+
label = "Input Label",
|
|
327
|
+
type = "text",
|
|
328
|
+
value = "",
|
|
329
|
+
placeholder = "Enter text...",
|
|
330
|
+
errorMessage = "This field is required.",
|
|
331
|
+
isError = false,
|
|
332
|
+
isSuccess = false,
|
|
333
|
+
isDisabled = false,
|
|
334
|
+
onChange
|
|
335
|
+
}) => {
|
|
336
|
+
const [isFocused, setIsFocused] = (0, import_react6.useState)(false);
|
|
337
|
+
const handleFocus = () => setIsFocused(true);
|
|
338
|
+
const handleBlur = () => setIsFocused(false);
|
|
339
|
+
return /* @__PURE__ */ import_react6.default.createElement("div", { style: { marginBottom: "20px", fontFamily: "system-ui, sans-serif" } }, /* @__PURE__ */ import_react6.default.createElement("label", { style: { display: "block", marginBottom: "8px", fontSize: "14px", color: isError ? "#ef4444" : "#64748b" } }, label), /* @__PURE__ */ import_react6.default.createElement(
|
|
340
|
+
"input",
|
|
341
|
+
{
|
|
342
|
+
type,
|
|
343
|
+
value,
|
|
344
|
+
placeholder,
|
|
345
|
+
onFocus: handleFocus,
|
|
346
|
+
onBlur: handleBlur,
|
|
347
|
+
onChange,
|
|
348
|
+
disabled: isDisabled,
|
|
349
|
+
style: {
|
|
350
|
+
width: "100%",
|
|
351
|
+
padding: "12px 16px",
|
|
352
|
+
border: `2px solid ${isError ? "#ef4444" : isSuccess ? "#22c55e" : isFocused ? "#2563eb" : "#d1d5db"}`,
|
|
353
|
+
borderRadius: "8px",
|
|
354
|
+
boxShadow: isFocused ? "0 4px 14px rgba(37,99,235,0.3)" : "none",
|
|
355
|
+
outline: "none",
|
|
356
|
+
transition: "border-color 0.3s, box-shadow 0.3s",
|
|
357
|
+
fontSize: "16px",
|
|
358
|
+
color: "#0f172a"
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
), isError && /* @__PURE__ */ import_react6.default.createElement("p", { style: { marginTop: "8px", color: "#ef4444", fontSize: "12px", opacity: 0, animation: "fadeIn 0.3s forwards" } }, errorMessage), isSuccess && /* @__PURE__ */ import_react6.default.createElement("p", { style: { marginTop: "8px", color: "#22c55e", fontSize: "12px" } }, "Input is valid!"), /* @__PURE__ */ import_react6.default.createElement("style", null, `@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }`));
|
|
362
|
+
};
|
|
275
363
|
// Annotate the CommonJS export names for ESM import in node:
|
|
276
364
|
0 && (module.exports = {
|
|
277
365
|
AlertBanner,
|
|
278
366
|
Button,
|
|
279
367
|
Card,
|
|
280
|
-
Dropdown
|
|
368
|
+
Dropdown,
|
|
369
|
+
EmptyState,
|
|
370
|
+
FormInput
|
|
281
371
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -234,9 +234,97 @@ var Dropdown = ({
|
|
|
234
234
|
transition: "background 0.2s"
|
|
235
235
|
}, onMouseEnter: (e) => e.currentTarget.style.background = "rgba(124,58,237,0.05)", onMouseLeave: (e) => e.currentTarget.style.background = "transparent" }, option))));
|
|
236
236
|
};
|
|
237
|
+
|
|
238
|
+
// src/components/EmptyState/EmptyState.jsx
|
|
239
|
+
import React5, { useEffect as useEffect3, useState as useState3 } from "react";
|
|
240
|
+
var EmptyState = ({
|
|
241
|
+
mode = "default",
|
|
242
|
+
icon = "https://i.imgur.com/E9Gdppt.png",
|
|
243
|
+
message = "No data available. Please check back later.",
|
|
244
|
+
actionText = "Try Again",
|
|
245
|
+
onAction
|
|
246
|
+
}) => {
|
|
247
|
+
const [isVisible, setIsVisible] = useState3(false);
|
|
248
|
+
useEffect3(() => {
|
|
249
|
+
setIsVisible(true);
|
|
250
|
+
}, []);
|
|
251
|
+
const renderModeContent = () => {
|
|
252
|
+
switch (mode) {
|
|
253
|
+
case "action available":
|
|
254
|
+
return /* @__PURE__ */ React5.createElement("div", { style: { textAlign: "center" } }, /* @__PURE__ */ React5.createElement("img", { src: icon, alt: "Empty State Icon", style: { width: "60px", marginBottom: "16px" } }), /* @__PURE__ */ React5.createElement("p", { style: { fontSize: "16px", color: "#64748b", margin: 0 } }, message), /* @__PURE__ */ React5.createElement("button", { onClick: onAction, style: {
|
|
255
|
+
marginTop: "20px",
|
|
256
|
+
padding: "10px 20px",
|
|
257
|
+
background: "#7c3aed",
|
|
258
|
+
color: "white",
|
|
259
|
+
border: "none",
|
|
260
|
+
borderRadius: "8px",
|
|
261
|
+
cursor: "pointer",
|
|
262
|
+
fontSize: "14px",
|
|
263
|
+
fontWeight: "600",
|
|
264
|
+
transition: "background 0.3s ease, transform 0.3s ease",
|
|
265
|
+
boxShadow: "0 4px 14px rgba(124,58,237,0.4)"
|
|
266
|
+
}, onMouseEnter: (e) => e.currentTarget.style.background = "#6d28d9", onMouseLeave: (e) => e.currentTarget.style.background = "#7c3aed" }, actionText));
|
|
267
|
+
case "illustration mode":
|
|
268
|
+
return /* @__PURE__ */ React5.createElement("div", { style: { textAlign: "center" } }, /* @__PURE__ */ React5.createElement("img", { src: icon, alt: "Illustration", style: { width: "80px", marginBottom: "16px" } }), /* @__PURE__ */ React5.createElement("p", { style: { fontSize: "16px", color: "#64748b", margin: 0 } }, message));
|
|
269
|
+
default:
|
|
270
|
+
return /* @__PURE__ */ React5.createElement("div", { style: { textAlign: "center" } }, /* @__PURE__ */ React5.createElement("img", { src: icon, alt: "Default Icon", style: { width: "60px", marginBottom: "16px" } }), /* @__PURE__ */ React5.createElement("p", { style: { fontSize: "16px", color: "#64748b", margin: 0 } }, message));
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
return /* @__PURE__ */ React5.createElement("div", { style: {
|
|
274
|
+
display: "flex",
|
|
275
|
+
justifyContent: "center",
|
|
276
|
+
alignItems: "center",
|
|
277
|
+
height: "100vh",
|
|
278
|
+
opacity: isVisible ? 1 : 0,
|
|
279
|
+
transition: "opacity 0.5s ease-in-out"
|
|
280
|
+
} }, renderModeContent());
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
// src/components/FormInput/FormInput.jsx
|
|
284
|
+
import React6, { useState as useState4 } from "react";
|
|
285
|
+
var FormInput = ({
|
|
286
|
+
label = "Input Label",
|
|
287
|
+
type = "text",
|
|
288
|
+
value = "",
|
|
289
|
+
placeholder = "Enter text...",
|
|
290
|
+
errorMessage = "This field is required.",
|
|
291
|
+
isError = false,
|
|
292
|
+
isSuccess = false,
|
|
293
|
+
isDisabled = false,
|
|
294
|
+
onChange
|
|
295
|
+
}) => {
|
|
296
|
+
const [isFocused, setIsFocused] = useState4(false);
|
|
297
|
+
const handleFocus = () => setIsFocused(true);
|
|
298
|
+
const handleBlur = () => setIsFocused(false);
|
|
299
|
+
return /* @__PURE__ */ React6.createElement("div", { style: { marginBottom: "20px", fontFamily: "system-ui, sans-serif" } }, /* @__PURE__ */ React6.createElement("label", { style: { display: "block", marginBottom: "8px", fontSize: "14px", color: isError ? "#ef4444" : "#64748b" } }, label), /* @__PURE__ */ React6.createElement(
|
|
300
|
+
"input",
|
|
301
|
+
{
|
|
302
|
+
type,
|
|
303
|
+
value,
|
|
304
|
+
placeholder,
|
|
305
|
+
onFocus: handleFocus,
|
|
306
|
+
onBlur: handleBlur,
|
|
307
|
+
onChange,
|
|
308
|
+
disabled: isDisabled,
|
|
309
|
+
style: {
|
|
310
|
+
width: "100%",
|
|
311
|
+
padding: "12px 16px",
|
|
312
|
+
border: `2px solid ${isError ? "#ef4444" : isSuccess ? "#22c55e" : isFocused ? "#2563eb" : "#d1d5db"}`,
|
|
313
|
+
borderRadius: "8px",
|
|
314
|
+
boxShadow: isFocused ? "0 4px 14px rgba(37,99,235,0.3)" : "none",
|
|
315
|
+
outline: "none",
|
|
316
|
+
transition: "border-color 0.3s, box-shadow 0.3s",
|
|
317
|
+
fontSize: "16px",
|
|
318
|
+
color: "#0f172a"
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
), isError && /* @__PURE__ */ React6.createElement("p", { style: { marginTop: "8px", color: "#ef4444", fontSize: "12px", opacity: 0, animation: "fadeIn 0.3s forwards" } }, errorMessage), isSuccess && /* @__PURE__ */ React6.createElement("p", { style: { marginTop: "8px", color: "#22c55e", fontSize: "12px" } }, "Input is valid!"), /* @__PURE__ */ React6.createElement("style", null, `@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }`));
|
|
322
|
+
};
|
|
237
323
|
export {
|
|
238
324
|
AlertBanner,
|
|
239
325
|
Button,
|
|
240
326
|
Card,
|
|
241
|
-
Dropdown
|
|
327
|
+
Dropdown,
|
|
328
|
+
EmptyState,
|
|
329
|
+
FormInput
|
|
242
330
|
};
|