@elsapiens/ui 0.1.0 → 0.1.4
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.d.ts +26 -4
- package/dist/index.js +123 -33
- package/package.json +15 -12
package/dist/index.d.ts
CHANGED
|
@@ -1028,8 +1028,13 @@ interface TableProps<T> {
|
|
|
1028
1028
|
* - 'first': first column is sticky
|
|
1029
1029
|
* - 'last': last column is sticky
|
|
1030
1030
|
* - 'both': first and last columns are sticky
|
|
1031
|
+
* @deprecated Use stickyColumnsLeft/stickyColumnsRight or pass an array of column keys
|
|
1031
1032
|
*/
|
|
1032
|
-
stickyColumns?: 'first' | 'last' | 'both';
|
|
1033
|
+
stickyColumns?: 'first' | 'last' | 'both' | string[];
|
|
1034
|
+
/** Number of columns from the left to make sticky (e.g., 2 for first two columns) */
|
|
1035
|
+
stickyColumnsLeft?: number;
|
|
1036
|
+
/** Number of columns from the right to make sticky (e.g., 1 for last column) */
|
|
1037
|
+
stickyColumnsRight?: number;
|
|
1033
1038
|
/** Make the header row sticky on vertical scroll */
|
|
1034
1039
|
stickyHeader?: boolean;
|
|
1035
1040
|
/** Top offset for sticky header (e.g., '64px' to account for a fixed navbar) */
|
|
@@ -1099,12 +1104,23 @@ interface TableProps<T> {
|
|
|
1099
1104
|
* columns={transactionColumns}
|
|
1100
1105
|
* inCard="full"
|
|
1101
1106
|
* stickyHeader
|
|
1102
|
-
*
|
|
1107
|
+
* stickyColumnsLeft={2} // First 2 columns sticky
|
|
1108
|
+
* stickyColumnsRight={1} // Last column sticky
|
|
1103
1109
|
* stickyScrollbar
|
|
1104
1110
|
* />
|
|
1105
1111
|
* ```
|
|
1112
|
+
*
|
|
1113
|
+
* @example
|
|
1114
|
+
* ```tsx
|
|
1115
|
+
* // Sticky columns by key
|
|
1116
|
+
* <Table
|
|
1117
|
+
* data={data}
|
|
1118
|
+
* columns={columns}
|
|
1119
|
+
* stickyColumns={['id', 'name', 'actions']}
|
|
1120
|
+
* />
|
|
1121
|
+
* ```
|
|
1106
1122
|
*/
|
|
1107
|
-
declare function Table<T extends Record<string, unknown>>({ data, columns, onRowClick, emptyMessage, className, striped, hoverable, aligned, size, inCard, cardPadding: _cardPadding, stickyColumns, stickyHeader, stickyHeaderTop, stickyColumnsOffset, scrollable, stickyScrollbar, }: TableProps<T>): react_jsx_runtime.JSX.Element;
|
|
1123
|
+
declare function Table<T extends Record<string, unknown>>({ data, columns, onRowClick, emptyMessage, className, striped, hoverable, aligned, size, inCard, cardPadding: _cardPadding, stickyColumns, stickyColumnsLeft, stickyColumnsRight, stickyHeader, stickyHeaderTop, stickyColumnsOffset, scrollable, stickyScrollbar, }: TableProps<T>): react_jsx_runtime.JSX.Element;
|
|
1108
1124
|
|
|
1109
1125
|
type FilterOperator = 'equals' | 'not_equals' | 'contains' | 'not_contains' | 'starts_with' | 'ends_with' | 'greater_than' | 'less_than' | 'greater_or_equal' | 'less_or_equal' | 'between' | 'is_empty' | 'is_not_empty';
|
|
1110
1126
|
interface FilterField {
|
|
@@ -1254,8 +1270,14 @@ interface FilterBarProps {
|
|
|
1254
1270
|
onConditionsChange?: (conditions: FilterBarCondition[]) => void;
|
|
1255
1271
|
/** Callback when user saves current filters as a new view */
|
|
1256
1272
|
onSaveFilter?: (name: string, conditions: FilterBarCondition[]) => void;
|
|
1273
|
+
/** Callback when refresh button is clicked */
|
|
1274
|
+
onRefresh?: () => void;
|
|
1257
1275
|
/** Apply negative margin for edge-to-edge display inside a Card */
|
|
1258
1276
|
inCard?: boolean;
|
|
1277
|
+
/** When true, adds rounded top corners, negative top margin, and removes top border to merge with card header */
|
|
1278
|
+
firstInCard?: boolean;
|
|
1279
|
+
/** When true, adds rounded bottom corners, negative bottom margin, and removes bottom border to merge with card footer */
|
|
1280
|
+
lastInCard?: boolean;
|
|
1259
1281
|
/** Additional CSS classes */
|
|
1260
1282
|
className?: string;
|
|
1261
1283
|
}
|
|
@@ -1317,7 +1339,7 @@ interface FilterBarProps {
|
|
|
1317
1339
|
* />
|
|
1318
1340
|
* ```
|
|
1319
1341
|
*/
|
|
1320
|
-
declare function FilterBar({ tabs, activeTab, onTabChange, allowAddTab: _allowAddTab, onAddTab: _onAddTab, search, sort, fields, conditions, onConditionsChange, onSaveFilter, inCard, className, }: FilterBarProps): react_jsx_runtime.JSX.Element | null;
|
|
1342
|
+
declare function FilterBar({ tabs, activeTab, onTabChange, allowAddTab: _allowAddTab, onAddTab: _onAddTab, search, sort, fields, conditions, onConditionsChange, onSaveFilter, onRefresh, inCard, firstInCard, lastInCard, className, }: FilterBarProps): react_jsx_runtime.JSX.Element | null;
|
|
1321
1343
|
|
|
1322
1344
|
/**
|
|
1323
1345
|
* Internal context value for Form component.
|
package/dist/index.js
CHANGED
|
@@ -3314,11 +3314,11 @@ function Tooltip({
|
|
|
3314
3314
|
style: {
|
|
3315
3315
|
top: position.top,
|
|
3316
3316
|
left: position.left,
|
|
3317
|
-
paddingLeft: "var(--el-tooltip-px)",
|
|
3318
|
-
paddingRight: "var(--el-tooltip-px)",
|
|
3319
|
-
paddingTop: "var(--el-tooltip-py)",
|
|
3320
|
-
paddingBottom: "var(--el-tooltip-py)",
|
|
3321
|
-
fontSize: "var(--el-font-size-
|
|
3317
|
+
paddingLeft: "var(--el-tooltip-px, 0.5rem)",
|
|
3318
|
+
paddingRight: "var(--el-tooltip-px, 0.5rem)",
|
|
3319
|
+
paddingTop: "var(--el-tooltip-py, 0.25rem)",
|
|
3320
|
+
paddingBottom: "var(--el-tooltip-py, 0.25rem)",
|
|
3321
|
+
fontSize: "var(--el-font-size-sm, 0.8125rem)"
|
|
3322
3322
|
},
|
|
3323
3323
|
role: "tooltip",
|
|
3324
3324
|
children: content
|
|
@@ -3346,6 +3346,8 @@ function Table({
|
|
|
3346
3346
|
inCard = false,
|
|
3347
3347
|
cardPadding: _cardPadding = "md",
|
|
3348
3348
|
stickyColumns,
|
|
3349
|
+
stickyColumnsLeft,
|
|
3350
|
+
stickyColumnsRight,
|
|
3349
3351
|
stickyHeader = false,
|
|
3350
3352
|
stickyHeaderTop,
|
|
3351
3353
|
stickyColumnsOffset,
|
|
@@ -3414,11 +3416,26 @@ function Table({
|
|
|
3414
3416
|
handleScroll();
|
|
3415
3417
|
return () => scrollParent.removeEventListener("scroll", handleScroll);
|
|
3416
3418
|
}, [stickyHeader]);
|
|
3419
|
+
const getStickyConfig = () => {
|
|
3420
|
+
const leftCount = stickyColumnsLeft ?? (stickyColumns === "first" || stickyColumns === "both" ? 1 : 0);
|
|
3421
|
+
const rightCount = stickyColumnsRight ?? (stickyColumns === "last" || stickyColumns === "both" ? 1 : 0);
|
|
3422
|
+
const keys = Array.isArray(stickyColumns) ? stickyColumns : [];
|
|
3423
|
+
return { leftCount, rightCount, keys };
|
|
3424
|
+
};
|
|
3425
|
+
const { leftCount: stickyLeftCount, rightCount: stickyRightCount, keys: stickyKeys } = getStickyConfig();
|
|
3426
|
+
const needsColumnMeasurement = stickyLeftCount > 1 || stickyRightCount > 1 || stickyKeys.length > 0;
|
|
3417
3427
|
useEffect9(() => {
|
|
3418
|
-
if (!stickyScrollbar && !stickyHeader || !tableContainerRef.current) return;
|
|
3428
|
+
if (!stickyScrollbar && !stickyHeader && !needsColumnMeasurement || !tableContainerRef.current) return;
|
|
3419
3429
|
const updateDimensions = () => {
|
|
3420
3430
|
if (tableContainerRef.current) {
|
|
3421
3431
|
setScrollWidth(tableContainerRef.current.scrollWidth);
|
|
3432
|
+
if (theadRef.current && needsColumnMeasurement) {
|
|
3433
|
+
const headerCells = theadRef.current.querySelectorAll("th:not(.el-table-spacer)");
|
|
3434
|
+
headerCells.forEach((cell, idx) => {
|
|
3435
|
+
const width = cell.getBoundingClientRect().width;
|
|
3436
|
+
tableContainerRef.current?.style.setProperty(`--el-table-col-${idx}-width`, `${width}px`);
|
|
3437
|
+
});
|
|
3438
|
+
}
|
|
3422
3439
|
}
|
|
3423
3440
|
if (theadRef.current && stickyHeader) {
|
|
3424
3441
|
const headerCells = theadRef.current.querySelectorAll("th");
|
|
@@ -3430,7 +3447,7 @@ function Table({
|
|
|
3430
3447
|
const resizeObserver = new ResizeObserver(updateDimensions);
|
|
3431
3448
|
resizeObserver.observe(tableContainerRef.current);
|
|
3432
3449
|
return () => resizeObserver.disconnect();
|
|
3433
|
-
}, [stickyScrollbar, stickyHeader, data, columns]);
|
|
3450
|
+
}, [stickyScrollbar, stickyHeader, needsColumnMeasurement, data, columns]);
|
|
3434
3451
|
const handleSort = (key) => {
|
|
3435
3452
|
if (sortColumn === key) {
|
|
3436
3453
|
if (sortDirection === "asc") {
|
|
@@ -3482,12 +3499,43 @@ function Table({
|
|
|
3482
3499
|
return "text-left";
|
|
3483
3500
|
}
|
|
3484
3501
|
};
|
|
3485
|
-
const
|
|
3486
|
-
|
|
3502
|
+
const isColumnSticky = (idx, columnKey) => {
|
|
3503
|
+
if (stickyKeys.includes(columnKey)) return true;
|
|
3504
|
+
if (idx < stickyLeftCount) return true;
|
|
3505
|
+
if (idx >= columns.length - stickyRightCount) return true;
|
|
3506
|
+
return false;
|
|
3507
|
+
};
|
|
3508
|
+
const getStickyPosition = (idx, columnKey) => {
|
|
3509
|
+
if (stickyKeys.includes(columnKey)) {
|
|
3510
|
+
const isLeftSide = idx < columns.length / 2;
|
|
3511
|
+
return isLeftSide ? "left" : "right";
|
|
3512
|
+
}
|
|
3513
|
+
if (idx < stickyLeftCount) return "left";
|
|
3514
|
+
if (idx >= columns.length - stickyRightCount) return "right";
|
|
3515
|
+
return null;
|
|
3516
|
+
};
|
|
3487
3517
|
const getOffsetValue = (offset) => {
|
|
3488
3518
|
if (!offset) return "0";
|
|
3489
3519
|
return typeof offset === "number" ? `${offset}px` : offset;
|
|
3490
3520
|
};
|
|
3521
|
+
const getStickyOffset = (idx, position) => {
|
|
3522
|
+
const baseOffset = stickyColumnsOffset ? getOffsetValue(stickyColumnsOffset) : "0px";
|
|
3523
|
+
const spacerWidth = "var(--el-table-spacer-width)";
|
|
3524
|
+
if (position === "left") {
|
|
3525
|
+
if (idx === 0) {
|
|
3526
|
+
return stickyColumnsOffset ? `calc(${baseOffset} + ${spacerWidth})` : spacerWidth;
|
|
3527
|
+
}
|
|
3528
|
+
const prevWidths = Array.from({ length: idx }, (_, i) => `var(--el-table-col-${i}-width, 0px)`).join(" + ");
|
|
3529
|
+
return stickyColumnsOffset ? `calc(${baseOffset} + ${spacerWidth} + ${prevWidths})` : `calc(${spacerWidth} + ${prevWidths})`;
|
|
3530
|
+
} else {
|
|
3531
|
+
const colsFromRight = columns.length - 1 - idx;
|
|
3532
|
+
if (colsFromRight === 0) {
|
|
3533
|
+
return stickyColumnsOffset ? `calc(${baseOffset} + ${spacerWidth})` : spacerWidth;
|
|
3534
|
+
}
|
|
3535
|
+
const nextWidths = Array.from({ length: colsFromRight }, (_, i) => `var(--el-table-col-${idx + 1 + i}-width, 0px)`).join(" + ");
|
|
3536
|
+
return stickyColumnsOffset ? `calc(${baseOffset} + ${spacerWidth} + ${nextWidths})` : `calc(${spacerWidth} + ${nextWidths})`;
|
|
3537
|
+
}
|
|
3538
|
+
};
|
|
3491
3539
|
const SpacerCell = ({ isHeader = false, position, isStriped = false, isHoverable = false }) => {
|
|
3492
3540
|
if (!aligned) return null;
|
|
3493
3541
|
const Component = isHeader ? "th" : "td";
|
|
@@ -3550,8 +3598,9 @@ function Table({
|
|
|
3550
3598
|
columns.map((column, idx) => {
|
|
3551
3599
|
const isFirst = idx === 0;
|
|
3552
3600
|
const isLast = idx === columns.length - 1;
|
|
3553
|
-
const
|
|
3554
|
-
const
|
|
3601
|
+
const columnKey = String(column.key);
|
|
3602
|
+
const isSticky = isColumnSticky(idx, columnKey);
|
|
3603
|
+
const stickyPosition = getStickyPosition(idx, columnKey);
|
|
3555
3604
|
const measuredWidth = isDummy && columnWidths.length > 0 && columnWidths[idx + 1] ? columnWidths[idx + 1] : void 0;
|
|
3556
3605
|
return /* @__PURE__ */ jsx13(
|
|
3557
3606
|
"th",
|
|
@@ -3562,8 +3611,7 @@ function Table({
|
|
|
3562
3611
|
column.sortable && "cursor-pointer select-none hover:bg-wisteria-200 dark:hover:bg-wisteria-700",
|
|
3563
3612
|
aligned && isFirst && "el-table-header-first",
|
|
3564
3613
|
aligned && isLast && "el-table-header-last",
|
|
3565
|
-
|
|
3566
|
-
shouldStickyLast && "sticky z-10 bg-wisteria-100 dark:bg-wisteria-800",
|
|
3614
|
+
isSticky && "sticky z-10 bg-wisteria-100 dark:bg-wisteria-800",
|
|
3567
3615
|
column.className
|
|
3568
3616
|
),
|
|
3569
3617
|
style: {
|
|
@@ -3572,12 +3620,12 @@ function Table({
|
|
|
3572
3620
|
...aligned && isLast && { paddingRight: 0 },
|
|
3573
3621
|
...column.width && { width: column.width },
|
|
3574
3622
|
...column.maxWidth && { maxWidth: column.maxWidth },
|
|
3575
|
-
...
|
|
3576
|
-
...
|
|
3623
|
+
...isSticky && stickyPosition === "left" && { left: getStickyOffset(idx, "left") },
|
|
3624
|
+
...isSticky && stickyPosition === "right" && { right: getStickyOffset(idx, "right") },
|
|
3577
3625
|
// Use measured width for dummy header to match main table exactly
|
|
3578
3626
|
...measuredWidth && { width: measuredWidth, minWidth: measuredWidth, maxWidth: measuredWidth, boxSizing: "border-box" }
|
|
3579
3627
|
},
|
|
3580
|
-
onClick: () => column.sortable && handleSort(
|
|
3628
|
+
onClick: () => column.sortable && handleSort(columnKey),
|
|
3581
3629
|
children: /* @__PURE__ */ jsxs13("div", { className: cn13(
|
|
3582
3630
|
"flex items-center el-gap-sm",
|
|
3583
3631
|
column.align === "right" && "justify-end",
|
|
@@ -3585,10 +3633,10 @@ function Table({
|
|
|
3585
3633
|
!column.wrap && "whitespace-nowrap overflow-hidden text-ellipsis"
|
|
3586
3634
|
), children: [
|
|
3587
3635
|
column.header,
|
|
3588
|
-
column.sortable && sortColumn ===
|
|
3636
|
+
column.sortable && sortColumn === columnKey && /* @__PURE__ */ jsx13("span", { className: "text-xs flex-shrink-0", children: sortDirection === "asc" ? "\u2191" : "\u2193" })
|
|
3589
3637
|
] })
|
|
3590
3638
|
},
|
|
3591
|
-
|
|
3639
|
+
columnKey
|
|
3592
3640
|
);
|
|
3593
3641
|
}),
|
|
3594
3642
|
/* @__PURE__ */ jsx13(SpacerCell, { isHeader: true, position: "right" })
|
|
@@ -3670,8 +3718,9 @@ function Table({
|
|
|
3670
3718
|
columns.map((column, idx) => {
|
|
3671
3719
|
const isFirst = idx === 0;
|
|
3672
3720
|
const isLast = idx === columns.length - 1;
|
|
3673
|
-
const
|
|
3674
|
-
const
|
|
3721
|
+
const columnKey = String(column.key);
|
|
3722
|
+
const isSticky = isColumnSticky(idx, columnKey);
|
|
3723
|
+
const stickyPosition = getStickyPosition(idx, columnKey);
|
|
3675
3724
|
const getStickyBgClass = () => {
|
|
3676
3725
|
if (isStripedRow) {
|
|
3677
3726
|
return "bg-wisteria-50 dark:bg-[hsl(var(--wisteria-850))]";
|
|
@@ -3692,9 +3741,9 @@ function Table({
|
|
|
3692
3741
|
getAlignClass(column.align),
|
|
3693
3742
|
aligned && isFirst && "el-table-cell-first",
|
|
3694
3743
|
aligned && isLast && "el-table-cell-last",
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3744
|
+
isSticky && "sticky z-10 transition-colors duration-150",
|
|
3745
|
+
isSticky && getStickyBgClass(),
|
|
3746
|
+
isSticky && getStickyHoverClass(),
|
|
3698
3747
|
!column.wrap && "whitespace-nowrap overflow-hidden text-ellipsis",
|
|
3699
3748
|
column.className
|
|
3700
3749
|
),
|
|
@@ -3703,16 +3752,16 @@ function Table({
|
|
|
3703
3752
|
...aligned && isFirst && { paddingLeft: 0 },
|
|
3704
3753
|
...aligned && isLast && { paddingRight: 0 },
|
|
3705
3754
|
...column.maxWidth && { maxWidth: column.maxWidth },
|
|
3706
|
-
...
|
|
3707
|
-
left:
|
|
3755
|
+
...isSticky && stickyPosition === "left" && {
|
|
3756
|
+
left: getStickyOffset(idx, "left")
|
|
3708
3757
|
},
|
|
3709
|
-
...
|
|
3710
|
-
right:
|
|
3758
|
+
...isSticky && stickyPosition === "right" && {
|
|
3759
|
+
right: getStickyOffset(idx, "right")
|
|
3711
3760
|
}
|
|
3712
3761
|
},
|
|
3713
3762
|
children: column.render ? column.render(item, index) : String(item[column.key] ?? "")
|
|
3714
3763
|
},
|
|
3715
|
-
|
|
3764
|
+
columnKey
|
|
3716
3765
|
);
|
|
3717
3766
|
}),
|
|
3718
3767
|
/* @__PURE__ */ jsx13(SpacerCell, { position: "right", isStriped: isStripedRow, isHoverable: hoverable })
|
|
@@ -3984,6 +4033,7 @@ var CloseIcon = ({ className, style }) => /* @__PURE__ */ jsx15("svg", { classNa
|
|
|
3984
4033
|
var PlusIcon = ({ className, style }) => /* @__PURE__ */ jsx15("svg", { className, width: "16", height: "16", style: { width: "var(--el-icon-size-sm, 1rem)", height: "var(--el-icon-size-sm, 1rem)", ...style }, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx15("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 4v16m8-8H4" }) });
|
|
3985
4034
|
var SortIcon = ({ className, style }) => /* @__PURE__ */ jsx15("svg", { className, width: "16", height: "16", style: { width: "var(--el-icon-size-sm, 1rem)", height: "var(--el-icon-size-sm, 1rem)", ...style }, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx15("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4" }) });
|
|
3986
4035
|
var FilterIcon = ({ className, style }) => /* @__PURE__ */ jsx15("svg", { className, width: "16", height: "16", style: { width: "var(--el-icon-size-sm, 1rem)", height: "var(--el-icon-size-sm, 1rem)", ...style }, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx15("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z" }) });
|
|
4036
|
+
var RefreshIcon = ({ className, style }) => /* @__PURE__ */ jsx15("svg", { className, width: "16", height: "16", style: { width: "var(--el-icon-size-sm, 1rem)", height: "var(--el-icon-size-sm, 1rem)", ...style }, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx15("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" }) });
|
|
3987
4037
|
function useIsMobile2(breakpoint = 768) {
|
|
3988
4038
|
const [isMobile, setIsMobile] = useState12(false);
|
|
3989
4039
|
useEffect11(() => {
|
|
@@ -5092,7 +5142,10 @@ function FilterBar({
|
|
|
5092
5142
|
conditions = [],
|
|
5093
5143
|
onConditionsChange,
|
|
5094
5144
|
onSaveFilter,
|
|
5145
|
+
onRefresh,
|
|
5095
5146
|
inCard = false,
|
|
5147
|
+
firstInCard = false,
|
|
5148
|
+
lastInCard = false,
|
|
5096
5149
|
className
|
|
5097
5150
|
}) {
|
|
5098
5151
|
const isMobile = useIsMobile2();
|
|
@@ -5352,12 +5405,28 @@ function FilterBar({
|
|
|
5352
5405
|
] });
|
|
5353
5406
|
}
|
|
5354
5407
|
const showMainBar = tabs.length > 0 || search || sort;
|
|
5355
|
-
|
|
5408
|
+
const seamlessConnection = inCard && showMainBar && isFilterPanelOpen && fields.length > 0;
|
|
5409
|
+
return /* @__PURE__ */ jsxs15("div", { className: cn15("flex flex-col", className), style: { gap: seamlessConnection ? 0 : "var(--el-filter-gap)" }, children: [
|
|
5356
5410
|
showMainBar && /* @__PURE__ */ jsxs15(
|
|
5357
5411
|
"div",
|
|
5358
5412
|
{
|
|
5359
|
-
className: cn15(
|
|
5360
|
-
|
|
5413
|
+
className: cn15(
|
|
5414
|
+
"flex items-center justify-between bg-slate-100 dark:bg-slate-800 border-slate-300 dark:border-slate-600",
|
|
5415
|
+
inCard ? cn15(
|
|
5416
|
+
"el-filter-bar",
|
|
5417
|
+
firstInCard && "el-filter-bar-first",
|
|
5418
|
+
firstInCard && !seamlessConnection && "border-b",
|
|
5419
|
+
!firstInCard && "border-t",
|
|
5420
|
+
!seamlessConnection && !lastInCard && "border-b",
|
|
5421
|
+
lastInCard && !seamlessConnection && "el-filter-bar-last border-t"
|
|
5422
|
+
) : "border rounded-lg"
|
|
5423
|
+
),
|
|
5424
|
+
style: {
|
|
5425
|
+
gap: "var(--el-gap-lg)",
|
|
5426
|
+
paddingTop: "var(--el-gap-md)",
|
|
5427
|
+
paddingBottom: "var(--el-gap-md)",
|
|
5428
|
+
...!inCard && { paddingInline: "var(--el-gap-md)" }
|
|
5429
|
+
},
|
|
5361
5430
|
children: [
|
|
5362
5431
|
/* @__PURE__ */ jsxs15("div", { className: "flex items-center min-w-0 flex-1 overflow-x-auto hide-native-scrollbar", style: { gap: "var(--el-gap-sm)" }, children: [
|
|
5363
5432
|
tabs.map((tab) => /* @__PURE__ */ jsxs15(
|
|
@@ -5421,6 +5490,16 @@ function FilterBar({
|
|
|
5421
5490
|
children: "Save"
|
|
5422
5491
|
}
|
|
5423
5492
|
),
|
|
5493
|
+
onRefresh && /* @__PURE__ */ jsx15(
|
|
5494
|
+
"button",
|
|
5495
|
+
{
|
|
5496
|
+
onClick: onRefresh,
|
|
5497
|
+
className: "text-muted-foreground hover:text-foreground hover:bg-muted rounded-md transition-colors",
|
|
5498
|
+
style: { padding: "var(--el-filter-pill-py)" },
|
|
5499
|
+
title: "Refresh",
|
|
5500
|
+
children: /* @__PURE__ */ jsx15(RefreshIcon, {})
|
|
5501
|
+
}
|
|
5502
|
+
),
|
|
5424
5503
|
search && /* @__PURE__ */ jsx15("div", { className: "relative", children: isSearchOpen ? /* @__PURE__ */ jsxs15("div", { className: "flex items-center", children: [
|
|
5425
5504
|
/* @__PURE__ */ jsx15(
|
|
5426
5505
|
"input",
|
|
@@ -5568,11 +5647,22 @@ function FilterBar({
|
|
|
5568
5647
|
isFilterPanelOpen && fields.length > 0 && /* @__PURE__ */ jsxs15(
|
|
5569
5648
|
"div",
|
|
5570
5649
|
{
|
|
5571
|
-
className:
|
|
5650
|
+
className: cn15(
|
|
5651
|
+
"flex items-center bg-slate-100 dark:bg-slate-800 border-slate-300 dark:border-slate-600",
|
|
5652
|
+
inCard ? cn15(
|
|
5653
|
+
"el-filter-bar",
|
|
5654
|
+
// If no main bar, filter pills can be first
|
|
5655
|
+
!showMainBar && firstInCard && "el-filter-bar-first",
|
|
5656
|
+
lastInCard && "el-filter-bar-last",
|
|
5657
|
+
!lastInCard && "border-b",
|
|
5658
|
+
!seamlessConnection && !(!showMainBar && firstInCard) && "border-t"
|
|
5659
|
+
) : "border rounded-lg"
|
|
5660
|
+
),
|
|
5572
5661
|
style: {
|
|
5573
5662
|
gap: "var(--el-gap-md)",
|
|
5574
5663
|
paddingTop: "var(--el-gap-md)",
|
|
5575
|
-
paddingBottom: "var(--el-gap-md)"
|
|
5664
|
+
paddingBottom: "var(--el-gap-md)",
|
|
5665
|
+
...!inCard && { paddingInline: "var(--el-gap-md)" }
|
|
5576
5666
|
},
|
|
5577
5667
|
children: [
|
|
5578
5668
|
/* @__PURE__ */ jsxs15(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elsapiens/ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "UI components for elSapiens SDK",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -20,11 +20,22 @@
|
|
|
20
20
|
"files": [
|
|
21
21
|
"dist"
|
|
22
22
|
],
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "tsup src/index.ts --format esm --dts --clean --external react --external react-dom --external lucide-react",
|
|
25
|
+
"dev": "tsup src/index.ts --format esm --dts --watch --external react --external react-dom --external lucide-react",
|
|
26
|
+
"clean": "rm -rf dist",
|
|
27
|
+
"typecheck": "tsc --noEmit",
|
|
28
|
+
"test": "vitest run",
|
|
29
|
+
"test:watch": "vitest"
|
|
30
|
+
},
|
|
31
|
+
"publishConfig": {
|
|
32
|
+
"access": "public"
|
|
33
|
+
},
|
|
23
34
|
"dependencies": {
|
|
35
|
+
"@elsapiens/utils": "^0.1.0",
|
|
24
36
|
"date-fns": "^3.6.0",
|
|
25
37
|
"lucide-react": "^0.468.0",
|
|
26
|
-
"recharts": "^3.7.0"
|
|
27
|
-
"@elsapiens/utils": "0.1.0"
|
|
38
|
+
"recharts": "^3.7.0"
|
|
28
39
|
},
|
|
29
40
|
"devDependencies": {
|
|
30
41
|
"@testing-library/react": "^16.3.0",
|
|
@@ -38,13 +49,5 @@
|
|
|
38
49
|
"peerDependencies": {
|
|
39
50
|
"react": "^18.2.0",
|
|
40
51
|
"react-dom": "^18.2.0"
|
|
41
|
-
},
|
|
42
|
-
"scripts": {
|
|
43
|
-
"build": "tsup src/index.ts --format esm --dts --clean --external react --external react-dom --external lucide-react",
|
|
44
|
-
"dev": "tsup src/index.ts --format esm --dts --watch --external react --external react-dom --external lucide-react",
|
|
45
|
-
"clean": "rm -rf dist",
|
|
46
|
-
"typecheck": "tsc --noEmit",
|
|
47
|
-
"test": "vitest run",
|
|
48
|
-
"test:watch": "vitest"
|
|
49
52
|
}
|
|
50
|
-
}
|
|
53
|
+
}
|