@fayz-ai/ui 0.8.1 → 0.8.3
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/{chunk-OTUH4K4B.js → chunk-2GDQUARM.js} +214 -4
- package/dist/chunk-2GDQUARM.js.map +1 -0
- package/dist/{chunk-W5O2X277.js → chunk-A7O7KGNL.js} +8 -4
- package/dist/chunk-A7O7KGNL.js.map +1 -0
- package/dist/{chunk-FY7OZNKU.js → chunk-BVF2KPTT.js} +7 -7
- package/dist/{chunk-FY7OZNKU.js.map → chunk-BVF2KPTT.js.map} +1 -1
- package/dist/{chunk-MZZMZYSE.js → chunk-ID2HQK2Q.js} +328 -51
- package/dist/chunk-ID2HQK2Q.js.map +1 -0
- package/dist/{chunk-ODY3GZ3Y.cjs → chunk-MI6FOB4O.cjs} +7 -7
- package/dist/{chunk-ODY3GZ3Y.cjs.map → chunk-MI6FOB4O.cjs.map} +1 -1
- package/dist/{chunk-7PTRAWHO.cjs → chunk-SVVKUMSL.cjs} +217 -6
- package/dist/chunk-SVVKUMSL.cjs.map +1 -0
- package/dist/{chunk-NWPMNPGR.cjs → chunk-WF3STNDX.cjs} +38 -34
- package/dist/chunk-WF3STNDX.cjs.map +1 -0
- package/dist/{chunk-XAOGMWLC.cjs → chunk-XIRJGVDK.cjs} +325 -48
- package/dist/chunk-XIRJGVDK.cjs.map +1 -0
- package/dist/dashboard/OnboardingWidget.d.ts.map +1 -1
- package/dist/dashboard/index.cjs +26 -26
- package/dist/dashboard/index.js +2 -2
- package/dist/index.cjs +125 -121
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/layout/AppShell.d.ts +41 -1
- package/dist/layout/AppShell.d.ts.map +1 -1
- package/dist/layout/ModulePage.d.ts +9 -6
- package/dist/layout/ModulePage.d.ts.map +1 -1
- package/dist/layout/Sidebar.d.ts +20 -1
- package/dist/layout/Sidebar.d.ts.map +1 -1
- package/dist/layout/Topbar.d.ts +13 -1
- package/dist/layout/Topbar.d.ts.map +1 -1
- package/dist/layout/index.cjs +19 -19
- package/dist/layout/index.js +1 -1
- package/dist/primitives/SearchCombobox.d.ts +38 -0
- package/dist/primitives/SearchCombobox.d.ts.map +1 -0
- package/dist/primitives/data-table.d.ts.map +1 -1
- package/dist/primitives/index.cjs +80 -76
- package/dist/primitives/index.d.ts +1 -0
- package/dist/primitives/index.d.ts.map +1 -1
- package/dist/primitives/index.js +2 -2
- package/package.json +3 -3
- package/src/dashboard/OnboardingWidget.tsx +10 -1
- package/src/index.ts +2 -0
- package/src/layout/AppShell.tsx +255 -7
- package/src/layout/ModulePage.tsx +32 -3
- package/src/layout/Sidebar.tsx +132 -35
- package/src/layout/Topbar.tsx +51 -4
- package/src/primitives/SearchCombobox.tsx +216 -0
- package/src/primitives/data-table.tsx +10 -1
- package/src/primitives/index.ts +1 -0
- package/src/styles.css +34 -0
- package/dist/chunk-7PTRAWHO.cjs.map +0 -1
- package/dist/chunk-MZZMZYSE.js.map +0 -1
- package/dist/chunk-NWPMNPGR.cjs.map +0 -1
- package/dist/chunk-OTUH4K4B.js.map +0 -1
- package/dist/chunk-W5O2X277.js.map +0 -1
- package/dist/chunk-XAOGMWLC.cjs.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkOW73RZOU_cjs = require('./chunk-OW73RZOU.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunkMI6FOB4O_cjs = require('./chunk-MI6FOB4O.cjs');
|
|
5
5
|
var chunkH6OULCHF_cjs = require('./chunk-H6OULCHF.cjs');
|
|
6
6
|
var React10 = require('react');
|
|
7
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -695,12 +695,12 @@ function ListView({
|
|
|
695
695
|
))
|
|
696
696
|
] }),
|
|
697
697
|
toolbar,
|
|
698
|
-
loading ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
698
|
+
loading ? /* @__PURE__ */ jsxRuntime.jsx(chunkMI6FOB4O_cjs.DataTable, { columns, data: [], loading: true, variant: "card" }) : data.length === 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center justify-center py-12 text-center rounded-lg border-2 border-dashed border-muted", children: [
|
|
699
699
|
EmptyIcon && /* @__PURE__ */ jsxRuntime.jsx(EmptyIcon, { className: "h-8 w-8 text-muted-foreground/30 mb-2" }),
|
|
700
700
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: emptyMessage }),
|
|
701
701
|
emptyActionLabel && onEmptyAction && /* @__PURE__ */ jsxRuntime.jsx("button", { onClick: onEmptyAction, className: "text-xs text-primary hover:underline mt-1", children: emptyActionLabel })
|
|
702
702
|
] }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
703
|
-
|
|
703
|
+
chunkMI6FOB4O_cjs.DataTable,
|
|
704
704
|
{
|
|
705
705
|
columns,
|
|
706
706
|
data,
|
|
@@ -1436,7 +1436,7 @@ function MarkdownEditor({
|
|
|
1436
1436
|
);
|
|
1437
1437
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkH6OULCHF_cjs.cn("flex flex-col gap-2", className), children: [
|
|
1438
1438
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1439
|
-
|
|
1439
|
+
chunkMI6FOB4O_cjs.SegmentedControl,
|
|
1440
1440
|
{
|
|
1441
1441
|
"aria-label": "Markdown mode",
|
|
1442
1442
|
options: [
|
|
@@ -1463,6 +1463,216 @@ function MarkdownEditor({
|
|
|
1463
1463
|
) : renderPreview ? renderPreview(value) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-md border border-border bg-card p-4", children: /* @__PURE__ */ jsxRuntime.jsx(Markdown, { source: value }) })
|
|
1464
1464
|
] });
|
|
1465
1465
|
}
|
|
1466
|
+
function SearchCombobox({
|
|
1467
|
+
value,
|
|
1468
|
+
onChange,
|
|
1469
|
+
onSelect,
|
|
1470
|
+
options,
|
|
1471
|
+
placeholder,
|
|
1472
|
+
autoFocus,
|
|
1473
|
+
onBlurEmpty,
|
|
1474
|
+
renderRight,
|
|
1475
|
+
allowCreate,
|
|
1476
|
+
onCreateNew,
|
|
1477
|
+
createLabel = "Create",
|
|
1478
|
+
className,
|
|
1479
|
+
minimal,
|
|
1480
|
+
inlineLabel,
|
|
1481
|
+
inlineIcon = "search",
|
|
1482
|
+
loading,
|
|
1483
|
+
onFocus: onFocusProp
|
|
1484
|
+
}) {
|
|
1485
|
+
const [open, setOpen] = React10.useState(false);
|
|
1486
|
+
const [activeIndex, setActiveIndex] = React10.useState(-1);
|
|
1487
|
+
const [expanded, setExpanded] = React10.useState(!inlineLabel);
|
|
1488
|
+
const [dropRect, setDropRect] = React10.useState(null);
|
|
1489
|
+
const inputRef = React10.useRef(null);
|
|
1490
|
+
const wrapperRef = React10.useRef(null);
|
|
1491
|
+
const listRef = React10.useRef(null);
|
|
1492
|
+
React10.useEffect(() => {
|
|
1493
|
+
if (value && inlineLabel) setExpanded(true);
|
|
1494
|
+
if (!value && inlineLabel && !open) setExpanded(false);
|
|
1495
|
+
}, [value, open]);
|
|
1496
|
+
function updateRect() {
|
|
1497
|
+
if (wrapperRef.current) setDropRect(wrapperRef.current.getBoundingClientRect());
|
|
1498
|
+
}
|
|
1499
|
+
const showCreate = open && allowCreate && onCreateNew && value.trim().length > 0 && !options.some((o) => o.label.toLowerCase() === value.trim().toLowerCase());
|
|
1500
|
+
const totalItems = options.length + (showCreate ? 1 : 0);
|
|
1501
|
+
React10.useEffect(() => {
|
|
1502
|
+
setActiveIndex(-1);
|
|
1503
|
+
}, [options]);
|
|
1504
|
+
React10.useEffect(() => {
|
|
1505
|
+
if ((options.length > 0 || showCreate || loading) && document.activeElement === inputRef.current) setOpen(true);
|
|
1506
|
+
}, [options, showCreate, loading]);
|
|
1507
|
+
const handleKeyDown = React10.useCallback((e) => {
|
|
1508
|
+
if (!open || totalItems === 0) {
|
|
1509
|
+
if (e.key === "ArrowDown" && totalItems > 0) {
|
|
1510
|
+
e.preventDefault();
|
|
1511
|
+
setOpen(true);
|
|
1512
|
+
setActiveIndex(0);
|
|
1513
|
+
}
|
|
1514
|
+
return;
|
|
1515
|
+
}
|
|
1516
|
+
switch (e.key) {
|
|
1517
|
+
case "ArrowDown":
|
|
1518
|
+
e.preventDefault();
|
|
1519
|
+
setActiveIndex((prev) => (prev + 1) % totalItems);
|
|
1520
|
+
break;
|
|
1521
|
+
case "ArrowUp":
|
|
1522
|
+
e.preventDefault();
|
|
1523
|
+
setActiveIndex((prev) => prev <= 0 ? totalItems - 1 : prev - 1);
|
|
1524
|
+
break;
|
|
1525
|
+
case "Enter":
|
|
1526
|
+
e.preventDefault();
|
|
1527
|
+
if (activeIndex >= 0 && activeIndex < options.length) {
|
|
1528
|
+
onSelect(options[activeIndex]);
|
|
1529
|
+
setOpen(false);
|
|
1530
|
+
setActiveIndex(-1);
|
|
1531
|
+
} else if (showCreate && activeIndex === options.length) {
|
|
1532
|
+
onCreateNew?.(value.trim());
|
|
1533
|
+
setOpen(false);
|
|
1534
|
+
setActiveIndex(-1);
|
|
1535
|
+
}
|
|
1536
|
+
break;
|
|
1537
|
+
case "Escape":
|
|
1538
|
+
e.preventDefault();
|
|
1539
|
+
setOpen(false);
|
|
1540
|
+
setActiveIndex(-1);
|
|
1541
|
+
break;
|
|
1542
|
+
}
|
|
1543
|
+
}, [open, options, totalItems, activeIndex, onSelect, showCreate, onCreateNew, value]);
|
|
1544
|
+
React10.useEffect(() => {
|
|
1545
|
+
if (activeIndex < 0 || !listRef.current) return;
|
|
1546
|
+
const items = listRef.current.children;
|
|
1547
|
+
if (items[activeIndex]) items[activeIndex].scrollIntoView({ block: "nearest" });
|
|
1548
|
+
}, [activeIndex]);
|
|
1549
|
+
function handleBlur() {
|
|
1550
|
+
setTimeout(() => {
|
|
1551
|
+
setOpen(false);
|
|
1552
|
+
setActiveIndex(-1);
|
|
1553
|
+
if (!value && onBlurEmpty) onBlurEmpty();
|
|
1554
|
+
if (!value && inlineLabel) setExpanded(false);
|
|
1555
|
+
}, 200);
|
|
1556
|
+
}
|
|
1557
|
+
const hasDropdown = open && (options.length > 0 || showCreate || loading);
|
|
1558
|
+
if (!expanded && inlineLabel) {
|
|
1559
|
+
const isPlus = inlineIcon === "plus";
|
|
1560
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1561
|
+
"button",
|
|
1562
|
+
{
|
|
1563
|
+
type: "button",
|
|
1564
|
+
onClick: () => {
|
|
1565
|
+
setExpanded(true);
|
|
1566
|
+
setTimeout(() => inputRef.current?.focus(), 50);
|
|
1567
|
+
},
|
|
1568
|
+
className: `flex items-center gap-1.5 w-full text-left text-sm py-1.5 pl-2 transition-colors ${isPlus ? "text-primary hover:text-primary/80" : "text-muted-foreground hover:text-foreground"} ${className ?? ""}`,
|
|
1569
|
+
children: [
|
|
1570
|
+
isPlus && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plus, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
1571
|
+
inlineLabel
|
|
1572
|
+
]
|
|
1573
|
+
}
|
|
1574
|
+
);
|
|
1575
|
+
}
|
|
1576
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: wrapperRef, className: `relative ${className ?? ""}`, children: [
|
|
1577
|
+
!minimal && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { className: "absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground pointer-events-none" }),
|
|
1578
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1579
|
+
"input",
|
|
1580
|
+
{
|
|
1581
|
+
ref: inputRef,
|
|
1582
|
+
type: "text",
|
|
1583
|
+
value,
|
|
1584
|
+
onChange: (e) => {
|
|
1585
|
+
onChange(e.target.value);
|
|
1586
|
+
updateRect();
|
|
1587
|
+
setOpen(true);
|
|
1588
|
+
},
|
|
1589
|
+
onFocus: () => {
|
|
1590
|
+
updateRect();
|
|
1591
|
+
onFocusProp?.();
|
|
1592
|
+
if (options.length > 0 || showCreate || loading) setOpen(true);
|
|
1593
|
+
},
|
|
1594
|
+
onBlur: handleBlur,
|
|
1595
|
+
onKeyDown: handleKeyDown,
|
|
1596
|
+
placeholder,
|
|
1597
|
+
autoFocus,
|
|
1598
|
+
className: minimal ? "w-full bg-transparent pl-2 pr-3 py-1.5 text-sm placeholder:text-muted-foreground focus:outline-none border-b border-transparent hover:border-border focus:border-foreground transition-colors" : "w-full rounded-lg border bg-background pl-8 pr-3 py-2 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring",
|
|
1599
|
+
role: "combobox",
|
|
1600
|
+
"aria-expanded": hasDropdown,
|
|
1601
|
+
"aria-autocomplete": "list",
|
|
1602
|
+
"aria-activedescendant": activeIndex >= 0 ? `combobox-opt-${activeIndex}` : void 0
|
|
1603
|
+
}
|
|
1604
|
+
),
|
|
1605
|
+
hasDropdown && dropRect && reactDom.createPortal(
|
|
1606
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1607
|
+
"div",
|
|
1608
|
+
{
|
|
1609
|
+
ref: listRef,
|
|
1610
|
+
role: "listbox",
|
|
1611
|
+
"data-modal-passthrough": true,
|
|
1612
|
+
style: { position: "fixed", left: dropRect.left, top: dropRect.bottom + 4, width: dropRect.width, zIndex: 9999, pointerEvents: "auto" },
|
|
1613
|
+
className: "fayz-glass-surface max-h-52 overflow-y-auto rounded-lg border bg-popover shadow-lg py-0.5 animate-in fade-in zoom-in-95 duration-100",
|
|
1614
|
+
children: [
|
|
1615
|
+
loading && options.length === 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 px-3 py-2 text-sm text-muted-foreground", children: [
|
|
1616
|
+
/* @__PURE__ */ jsxRuntime.jsxs("svg", { className: "h-3.5 w-3.5 animate-spin shrink-0", viewBox: "0 0 16 16", fill: "none", children: [
|
|
1617
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "8", cy: "8", r: "6.5", stroke: "currentColor", strokeWidth: "1.5", opacity: "0.25" }),
|
|
1618
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M14.5 8a6.5 6.5 0 00-6.5-6.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
|
|
1619
|
+
] }),
|
|
1620
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Buscando\u2026" })
|
|
1621
|
+
] }),
|
|
1622
|
+
options.map((opt, i) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1623
|
+
"div",
|
|
1624
|
+
{
|
|
1625
|
+
id: `combobox-opt-${i}`,
|
|
1626
|
+
role: "option",
|
|
1627
|
+
"aria-selected": i === activeIndex,
|
|
1628
|
+
onMouseDown: (e) => {
|
|
1629
|
+
e.preventDefault();
|
|
1630
|
+
onSelect(opt);
|
|
1631
|
+
setOpen(false);
|
|
1632
|
+
},
|
|
1633
|
+
onMouseEnter: () => setActiveIndex(i),
|
|
1634
|
+
className: `flex w-full items-center gap-2 px-3 py-2 text-sm cursor-pointer transition-colors ${i === activeIndex ? "bg-primary/10 text-primary" : "hover:bg-muted/50"}`,
|
|
1635
|
+
children: [
|
|
1636
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
1637
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "truncate font-medium", children: opt.label }),
|
|
1638
|
+
opt.subtitle && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "truncate text-[11px] text-muted-foreground", children: opt.subtitle })
|
|
1639
|
+
] }),
|
|
1640
|
+
renderRight && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "shrink-0", children: renderRight(opt) })
|
|
1641
|
+
]
|
|
1642
|
+
},
|
|
1643
|
+
opt.id
|
|
1644
|
+
)),
|
|
1645
|
+
showCreate && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1646
|
+
"div",
|
|
1647
|
+
{
|
|
1648
|
+
id: `combobox-opt-${options.length}`,
|
|
1649
|
+
role: "option",
|
|
1650
|
+
"aria-selected": activeIndex === options.length,
|
|
1651
|
+
onMouseDown: (e) => {
|
|
1652
|
+
e.preventDefault();
|
|
1653
|
+
onCreateNew?.(value.trim());
|
|
1654
|
+
setOpen(false);
|
|
1655
|
+
},
|
|
1656
|
+
onMouseEnter: () => setActiveIndex(options.length),
|
|
1657
|
+
className: `flex w-full items-center gap-2 px-3 py-2 text-sm cursor-pointer transition-colors border-t ${activeIndex === options.length ? "bg-primary/10 text-primary" : "hover:bg-muted/50"}`,
|
|
1658
|
+
children: [
|
|
1659
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plus, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
1660
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
1661
|
+
createLabel,
|
|
1662
|
+
" \u201C",
|
|
1663
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: value.trim() }),
|
|
1664
|
+
"\u201D"
|
|
1665
|
+
] })
|
|
1666
|
+
]
|
|
1667
|
+
}
|
|
1668
|
+
)
|
|
1669
|
+
]
|
|
1670
|
+
}
|
|
1671
|
+
),
|
|
1672
|
+
document.body
|
|
1673
|
+
)
|
|
1674
|
+
] });
|
|
1675
|
+
}
|
|
1466
1676
|
|
|
1467
1677
|
Object.defineProperty(exports, "toast", {
|
|
1468
1678
|
enumerable: true,
|
|
@@ -1492,6 +1702,7 @@ exports.ModalTrigger = ModalTrigger;
|
|
|
1492
1702
|
exports.Popover = Popover;
|
|
1493
1703
|
exports.PopoverContent = PopoverContent;
|
|
1494
1704
|
exports.PopoverTrigger = PopoverTrigger;
|
|
1705
|
+
exports.SearchCombobox = SearchCombobox;
|
|
1495
1706
|
exports.SearchSelect = SearchSelect;
|
|
1496
1707
|
exports.Select = Select;
|
|
1497
1708
|
exports.SelectContent = SelectContent;
|
|
@@ -1518,5 +1729,5 @@ exports.TooltipProvider = TooltipProvider;
|
|
|
1518
1729
|
exports.TooltipTrigger = TooltipTrigger;
|
|
1519
1730
|
exports.badgeVariants = badgeVariants;
|
|
1520
1731
|
exports.renderMarkdown = renderMarkdown;
|
|
1521
|
-
//# sourceMappingURL=chunk-
|
|
1522
|
-
//# sourceMappingURL=chunk-
|
|
1732
|
+
//# sourceMappingURL=chunk-SVVKUMSL.cjs.map
|
|
1733
|
+
//# sourceMappingURL=chunk-SVVKUMSL.cjs.map
|