virtual-ui-lib 1.0.17 → 1.0.19
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 +85 -2
- package/dist/index.mjs +82 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -33,7 +33,9 @@ __export(index_exports, {
|
|
|
33
33
|
Button: () => Button,
|
|
34
34
|
Card: () => Card,
|
|
35
35
|
Dropdown: () => Dropdown,
|
|
36
|
-
EmptyState: () => EmptyState
|
|
36
|
+
EmptyState: () => EmptyState,
|
|
37
|
+
FormInput: () => FormInput,
|
|
38
|
+
GridLayout: () => GridLayout
|
|
37
39
|
});
|
|
38
40
|
module.exports = __toCommonJS(index_exports);
|
|
39
41
|
|
|
@@ -318,11 +320,92 @@ var EmptyState = ({
|
|
|
318
320
|
transition: "opacity 0.5s ease-in-out"
|
|
319
321
|
} }, renderModeContent());
|
|
320
322
|
};
|
|
323
|
+
|
|
324
|
+
// src/components/FormInput/FormInput.jsx
|
|
325
|
+
var import_react6 = __toESM(require("react"));
|
|
326
|
+
var FormInput = ({
|
|
327
|
+
label = "Input Label",
|
|
328
|
+
type = "text",
|
|
329
|
+
value = "",
|
|
330
|
+
placeholder = "Enter text...",
|
|
331
|
+
errorMessage = "This field is required.",
|
|
332
|
+
isError = false,
|
|
333
|
+
isSuccess = false,
|
|
334
|
+
isDisabled = false,
|
|
335
|
+
onChange
|
|
336
|
+
}) => {
|
|
337
|
+
const [isFocused, setIsFocused] = (0, import_react6.useState)(false);
|
|
338
|
+
const handleFocus = () => setIsFocused(true);
|
|
339
|
+
const handleBlur = () => setIsFocused(false);
|
|
340
|
+
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(
|
|
341
|
+
"input",
|
|
342
|
+
{
|
|
343
|
+
type,
|
|
344
|
+
value,
|
|
345
|
+
placeholder,
|
|
346
|
+
onFocus: handleFocus,
|
|
347
|
+
onBlur: handleBlur,
|
|
348
|
+
onChange,
|
|
349
|
+
disabled: isDisabled,
|
|
350
|
+
style: {
|
|
351
|
+
width: "100%",
|
|
352
|
+
padding: "12px 16px",
|
|
353
|
+
border: `2px solid ${isError ? "#ef4444" : isSuccess ? "#22c55e" : isFocused ? "#2563eb" : "#d1d5db"}`,
|
|
354
|
+
borderRadius: "8px",
|
|
355
|
+
boxShadow: isFocused ? "0 4px 14px rgba(37,99,235,0.3)" : "none",
|
|
356
|
+
outline: "none",
|
|
357
|
+
transition: "border-color 0.3s, box-shadow 0.3s",
|
|
358
|
+
fontSize: "16px",
|
|
359
|
+
color: "#0f172a"
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
), 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; } }`));
|
|
363
|
+
};
|
|
364
|
+
|
|
365
|
+
// src/components/GridLayout/GridLayout.jsx
|
|
366
|
+
var import_react7 = __toESM(require("react"));
|
|
367
|
+
var GridLayout = ({
|
|
368
|
+
items = [],
|
|
369
|
+
cols = 3,
|
|
370
|
+
loading = false,
|
|
371
|
+
emptyMessage = "No items available",
|
|
372
|
+
itemBg = "#1f2937",
|
|
373
|
+
itemColor = "#f1f5f9",
|
|
374
|
+
spacing = "16px",
|
|
375
|
+
radius = "8px"
|
|
376
|
+
}) => {
|
|
377
|
+
const renderItem = (item, index) => /* @__PURE__ */ import_react7.default.createElement("div", { key: index, style: {
|
|
378
|
+
background: itemBg,
|
|
379
|
+
color: itemColor,
|
|
380
|
+
borderRadius: radius,
|
|
381
|
+
padding: "16px",
|
|
382
|
+
margin: spacing,
|
|
383
|
+
transition: "transform 0.3s, box-shadow 0.3s",
|
|
384
|
+
boxShadow: "0 2px 10px rgba(0, 0, 0, 0.15)",
|
|
385
|
+
display: "flex",
|
|
386
|
+
justifyContent: "center",
|
|
387
|
+
alignItems: "center",
|
|
388
|
+
cursor: "pointer"
|
|
389
|
+
}, onMouseEnter: (e) => {
|
|
390
|
+
e.currentTarget.style.transform = "scale(1.05)";
|
|
391
|
+
}, onMouseLeave: (e) => {
|
|
392
|
+
e.currentTarget.style.transform = "scale(1)";
|
|
393
|
+
} }, item);
|
|
394
|
+
if (loading) {
|
|
395
|
+
return /* @__PURE__ */ import_react7.default.createElement("div", { style: { display: "grid", gridTemplateColumns: `repeat(${cols}, 1fr)`, gap: spacing } }, Array.from({ length: cols * 3 }).map((_, index) => /* @__PURE__ */ import_react7.default.createElement("div", { key: index, style: { background: "#334155", height: "100px", borderRadius: radius } })));
|
|
396
|
+
}
|
|
397
|
+
if (items.length === 0) {
|
|
398
|
+
return /* @__PURE__ */ import_react7.default.createElement("div", { style: { color: itemColor, textAlign: "center", padding: "20px" } }, emptyMessage);
|
|
399
|
+
}
|
|
400
|
+
return /* @__PURE__ */ import_react7.default.createElement("div", { style: { display: "grid", gridTemplateColumns: `repeat(${cols}, 1fr)`, gap: spacing } }, items.map(renderItem));
|
|
401
|
+
};
|
|
321
402
|
// Annotate the CommonJS export names for ESM import in node:
|
|
322
403
|
0 && (module.exports = {
|
|
323
404
|
AlertBanner,
|
|
324
405
|
Button,
|
|
325
406
|
Card,
|
|
326
407
|
Dropdown,
|
|
327
|
-
EmptyState
|
|
408
|
+
EmptyState,
|
|
409
|
+
FormInput,
|
|
410
|
+
GridLayout
|
|
328
411
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -279,10 +279,91 @@ var EmptyState = ({
|
|
|
279
279
|
transition: "opacity 0.5s ease-in-out"
|
|
280
280
|
} }, renderModeContent());
|
|
281
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
|
+
};
|
|
323
|
+
|
|
324
|
+
// src/components/GridLayout/GridLayout.jsx
|
|
325
|
+
import React7 from "react";
|
|
326
|
+
var GridLayout = ({
|
|
327
|
+
items = [],
|
|
328
|
+
cols = 3,
|
|
329
|
+
loading = false,
|
|
330
|
+
emptyMessage = "No items available",
|
|
331
|
+
itemBg = "#1f2937",
|
|
332
|
+
itemColor = "#f1f5f9",
|
|
333
|
+
spacing = "16px",
|
|
334
|
+
radius = "8px"
|
|
335
|
+
}) => {
|
|
336
|
+
const renderItem = (item, index) => /* @__PURE__ */ React7.createElement("div", { key: index, style: {
|
|
337
|
+
background: itemBg,
|
|
338
|
+
color: itemColor,
|
|
339
|
+
borderRadius: radius,
|
|
340
|
+
padding: "16px",
|
|
341
|
+
margin: spacing,
|
|
342
|
+
transition: "transform 0.3s, box-shadow 0.3s",
|
|
343
|
+
boxShadow: "0 2px 10px rgba(0, 0, 0, 0.15)",
|
|
344
|
+
display: "flex",
|
|
345
|
+
justifyContent: "center",
|
|
346
|
+
alignItems: "center",
|
|
347
|
+
cursor: "pointer"
|
|
348
|
+
}, onMouseEnter: (e) => {
|
|
349
|
+
e.currentTarget.style.transform = "scale(1.05)";
|
|
350
|
+
}, onMouseLeave: (e) => {
|
|
351
|
+
e.currentTarget.style.transform = "scale(1)";
|
|
352
|
+
} }, item);
|
|
353
|
+
if (loading) {
|
|
354
|
+
return /* @__PURE__ */ React7.createElement("div", { style: { display: "grid", gridTemplateColumns: `repeat(${cols}, 1fr)`, gap: spacing } }, Array.from({ length: cols * 3 }).map((_, index) => /* @__PURE__ */ React7.createElement("div", { key: index, style: { background: "#334155", height: "100px", borderRadius: radius } })));
|
|
355
|
+
}
|
|
356
|
+
if (items.length === 0) {
|
|
357
|
+
return /* @__PURE__ */ React7.createElement("div", { style: { color: itemColor, textAlign: "center", padding: "20px" } }, emptyMessage);
|
|
358
|
+
}
|
|
359
|
+
return /* @__PURE__ */ React7.createElement("div", { style: { display: "grid", gridTemplateColumns: `repeat(${cols}, 1fr)`, gap: spacing } }, items.map(renderItem));
|
|
360
|
+
};
|
|
282
361
|
export {
|
|
283
362
|
AlertBanner,
|
|
284
363
|
Button,
|
|
285
364
|
Card,
|
|
286
365
|
Dropdown,
|
|
287
|
-
EmptyState
|
|
366
|
+
EmptyState,
|
|
367
|
+
FormInput,
|
|
368
|
+
GridLayout
|
|
288
369
|
};
|