virtual-ui-lib 1.0.43 → 1.0.44

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 CHANGED
@@ -32,6 +32,7 @@ __export(index_exports, {
32
32
  CodeBlock: () => CodeBlock,
33
33
  CustomInputField: () => CustomInputField,
34
34
  OtpInput: () => OtpInput,
35
+ SearchBar: () => SearchBar,
35
36
  SmartButton: () => SmartButton,
36
37
  StatCard: () => StatCard,
37
38
  TextArea: () => TextArea,
@@ -390,11 +391,88 @@ var TextArea = ({
390
391
  }
391
392
  ), /* @__PURE__ */ import_react7.default.createElement("div", { style: { color: textColor, marginTop: "8px" } }, currentValue.length, "/", maxLength));
392
393
  };
394
+
395
+ // src/components/SearchBar/SearchBar.jsx
396
+ var import_react8 = __toESM(require("react"));
397
+ var SearchBar = ({
398
+ placeholder = "Search...",
399
+ bg = "#1e293b",
400
+ textColor = "#f1f5f9",
401
+ accent = "#7c3aed",
402
+ loading = false,
403
+ suggestions = [],
404
+ onChange = () => {
405
+ },
406
+ onClear = () => {
407
+ }
408
+ }) => {
409
+ const [query, setQuery] = (0, import_react8.useState)("");
410
+ const handleInputChange = (e) => {
411
+ setQuery(e.target.value);
412
+ onChange(e.target.value);
413
+ };
414
+ const handleClear = () => {
415
+ setQuery("");
416
+ onClear();
417
+ };
418
+ return /* @__PURE__ */ import_react8.default.createElement("div", { style: { position: "relative", width: "100%" } }, /* @__PURE__ */ import_react8.default.createElement(
419
+ "input",
420
+ {
421
+ value: query,
422
+ placeholder,
423
+ onChange: handleInputChange,
424
+ style: {
425
+ background: bg,
426
+ color: textColor,
427
+ padding: "10px",
428
+ borderRadius: "8px",
429
+ border: "1px solid #cbd5e1",
430
+ width: "100%",
431
+ transition: "border-color 0.3s",
432
+ outline: "none"
433
+ }
434
+ }
435
+ ), query && /* @__PURE__ */ import_react8.default.createElement("button", { onClick: handleClear, style: {
436
+ position: "absolute",
437
+ right: "10px",
438
+ top: "50%",
439
+ transform: "translateY(-50%)",
440
+ background: "transparent",
441
+ color: accent,
442
+ border: "none",
443
+ cursor: "pointer"
444
+ } }, "Clear"), loading && /* @__PURE__ */ import_react8.default.createElement("div", { style: {
445
+ position: "absolute",
446
+ left: "10px",
447
+ top: "50%",
448
+ transform: "translateY(-50%)"
449
+ } }, "Loading..."), suggestions.length > 0 && !loading && /* @__PURE__ */ import_react8.default.createElement("ul", { style: {
450
+ listStyleType: "none",
451
+ margin: 0,
452
+ padding: "10px",
453
+ background: bg,
454
+ borderRadius: "8px",
455
+ position: "absolute",
456
+ zIndex: 1e3,
457
+ width: "100%",
458
+ maxHeight: "200px",
459
+ overflowY: "auto"
460
+ } }, suggestions.map((suggestion, index) => /* @__PURE__ */ import_react8.default.createElement("li", { key: index, style: {
461
+ padding: "8px",
462
+ color: textColor,
463
+ cursor: "pointer",
464
+ transition: "background 0.2s"
465
+ }, onClick: () => {
466
+ setQuery(suggestion);
467
+ onChange(suggestion);
468
+ } }, suggestion))));
469
+ };
393
470
  // Annotate the CommonJS export names for ESM import in node:
394
471
  0 && (module.exports = {
395
472
  CodeBlock,
396
473
  CustomInputField,
397
474
  OtpInput,
475
+ SearchBar,
398
476
  SmartButton,
399
477
  StatCard,
400
478
  TextArea,
package/dist/index.mjs CHANGED
@@ -349,10 +349,87 @@ var TextArea = ({
349
349
  }
350
350
  ), /* @__PURE__ */ React7.createElement("div", { style: { color: textColor, marginTop: "8px" } }, currentValue.length, "/", maxLength));
351
351
  };
352
+
353
+ // src/components/SearchBar/SearchBar.jsx
354
+ import React8, { useState as useState7 } from "react";
355
+ var SearchBar = ({
356
+ placeholder = "Search...",
357
+ bg = "#1e293b",
358
+ textColor = "#f1f5f9",
359
+ accent = "#7c3aed",
360
+ loading = false,
361
+ suggestions = [],
362
+ onChange = () => {
363
+ },
364
+ onClear = () => {
365
+ }
366
+ }) => {
367
+ const [query, setQuery] = useState7("");
368
+ const handleInputChange = (e) => {
369
+ setQuery(e.target.value);
370
+ onChange(e.target.value);
371
+ };
372
+ const handleClear = () => {
373
+ setQuery("");
374
+ onClear();
375
+ };
376
+ return /* @__PURE__ */ React8.createElement("div", { style: { position: "relative", width: "100%" } }, /* @__PURE__ */ React8.createElement(
377
+ "input",
378
+ {
379
+ value: query,
380
+ placeholder,
381
+ onChange: handleInputChange,
382
+ style: {
383
+ background: bg,
384
+ color: textColor,
385
+ padding: "10px",
386
+ borderRadius: "8px",
387
+ border: "1px solid #cbd5e1",
388
+ width: "100%",
389
+ transition: "border-color 0.3s",
390
+ outline: "none"
391
+ }
392
+ }
393
+ ), query && /* @__PURE__ */ React8.createElement("button", { onClick: handleClear, style: {
394
+ position: "absolute",
395
+ right: "10px",
396
+ top: "50%",
397
+ transform: "translateY(-50%)",
398
+ background: "transparent",
399
+ color: accent,
400
+ border: "none",
401
+ cursor: "pointer"
402
+ } }, "Clear"), loading && /* @__PURE__ */ React8.createElement("div", { style: {
403
+ position: "absolute",
404
+ left: "10px",
405
+ top: "50%",
406
+ transform: "translateY(-50%)"
407
+ } }, "Loading..."), suggestions.length > 0 && !loading && /* @__PURE__ */ React8.createElement("ul", { style: {
408
+ listStyleType: "none",
409
+ margin: 0,
410
+ padding: "10px",
411
+ background: bg,
412
+ borderRadius: "8px",
413
+ position: "absolute",
414
+ zIndex: 1e3,
415
+ width: "100%",
416
+ maxHeight: "200px",
417
+ overflowY: "auto"
418
+ } }, suggestions.map((suggestion, index) => /* @__PURE__ */ React8.createElement("li", { key: index, style: {
419
+ padding: "8px",
420
+ color: textColor,
421
+ cursor: "pointer",
422
+ transition: "background 0.2s"
423
+ }, onClick: () => {
424
+ setQuery(suggestion);
425
+ onChange(suggestion);
426
+ } }, suggestion))));
427
+ };
352
428
  export {
353
429
  CodeBlock,
354
430
  CustomInputField,
355
431
  OtpInput,
432
+ SearchBar,
356
433
  SmartButton,
357
434
  StatCard,
358
435
  TextArea,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "virtual-ui-lib",
3
- "version": "1.0.43",
3
+ "version": "1.0.44",
4
4
  "description": "Virtual UI React Component Library",
5
5
  "author": "Ankush",
6
6
  "license": "ISC",