@stella-source/stellasource-dsl 3.1.5 → 3.2.0
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/cjs/index.js +45 -29
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/styles.css +0 -3
- package/dist/cjs/types/components/Table/types.d.ts +4 -1
- package/dist/cjs/types/index.d.ts +1 -0
- package/dist/esm/index.esm.js +45 -29
- package/dist/esm/index.esm.js.map +1 -1
- package/dist/esm/styles.css +0 -3
- package/dist/esm/types/components/Table/types.d.ts +4 -1
- package/dist/esm/types/index.d.ts +1 -0
- package/dist/index.d.ts +12 -1
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -17064,6 +17064,9 @@ const RequiredIcon = styled(StellaIcon) `
|
|
|
17064
17064
|
`;
|
|
17065
17065
|
const ToolTipIcon = styled(Tooltip) `
|
|
17066
17066
|
margin-left: 2px;
|
|
17067
|
+
display: flex;
|
|
17068
|
+
justify-content: center;
|
|
17069
|
+
align-items: center;
|
|
17067
17070
|
`;
|
|
17068
17071
|
const LabelComponent = styled.label `
|
|
17069
17072
|
font-family: "Inter", sans-serif;
|
|
@@ -21409,7 +21412,7 @@ const KebabAlign = styled.div `
|
|
|
21409
21412
|
`;
|
|
21410
21413
|
// EmptyTableState
|
|
21411
21414
|
const EmptyTableCell = styled.td `
|
|
21412
|
-
padding:
|
|
21415
|
+
padding: 5rem;
|
|
21413
21416
|
background-color: white;
|
|
21414
21417
|
`;
|
|
21415
21418
|
const EmptyTableSection = styled.section `
|
|
@@ -21494,6 +21497,18 @@ function useDebounceCallback(callback, delay) {
|
|
|
21494
21497
|
return [debounced, { flush, cancel }];
|
|
21495
21498
|
}
|
|
21496
21499
|
|
|
21500
|
+
const normalizeOptions = (raw) => {
|
|
21501
|
+
return raw
|
|
21502
|
+
.map((item) => {
|
|
21503
|
+
if (typeof item === "string" || typeof item === "number") {
|
|
21504
|
+
return { key: item.toString(), value: item.toString() };
|
|
21505
|
+
}
|
|
21506
|
+
const key = item.key ?? item.value ?? "";
|
|
21507
|
+
const value = item.value ?? item.key ?? "";
|
|
21508
|
+
return { key, value };
|
|
21509
|
+
})
|
|
21510
|
+
.filter((o) => o.key && o.value);
|
|
21511
|
+
};
|
|
21497
21512
|
const TableHeaderCell = ({ header, serverSide, filters, sorting, scrollPosition, onFilterMenuInteraction, onFilterApply, }) => {
|
|
21498
21513
|
const column = header.column;
|
|
21499
21514
|
const columnDef = column.columnDef;
|
|
@@ -21506,6 +21521,9 @@ const TableHeaderCell = ({ header, serverSide, filters, sorting, scrollPosition,
|
|
|
21506
21521
|
const [tempFilters, setTempFilters] = a$m.useState([]);
|
|
21507
21522
|
const [currentAppliedFilters, setCurrentAppliedFilters] = a$m.useState([]);
|
|
21508
21523
|
const [filterOptions, setFilterOptions] = a$m.useState([]);
|
|
21524
|
+
const displayOptions = serverSide
|
|
21525
|
+
? filterOptions
|
|
21526
|
+
: normalizeOptions(Array.from(header.column.getFacetedUniqueValues().keys()));
|
|
21509
21527
|
const [textAlign, setTextAlign] = a$m.useState("left");
|
|
21510
21528
|
const [handleSave, { flush }] = useDebounceCallback((value) => {
|
|
21511
21529
|
column?.setFilterValue([value]);
|
|
@@ -21514,7 +21532,7 @@ const TableHeaderCell = ({ header, serverSide, filters, sorting, scrollPosition,
|
|
|
21514
21532
|
onFilterApply?.();
|
|
21515
21533
|
}, 300);
|
|
21516
21534
|
a$m.useEffect(() => {
|
|
21517
|
-
setFilterOptions(meta?.filterOptions || []);
|
|
21535
|
+
setFilterOptions(normalizeOptions(meta?.filterOptions || []));
|
|
21518
21536
|
}, [meta]);
|
|
21519
21537
|
const toggleMenu = (e) => {
|
|
21520
21538
|
e.stopPropagation();
|
|
@@ -21595,43 +21613,39 @@ const TableHeaderCell = ({ header, serverSide, filters, sorting, scrollPosition,
|
|
|
21595
21613
|
}, onBlur: () => !serverSide && flush(), endIcon: "search", value: tempFilters?.[0] }))),
|
|
21596
21614
|
(meta?.filterMode === "multiSelect" ||
|
|
21597
21615
|
!meta?.filterMode) && (a$m.createElement(MenuItem, { key: "select-all" },
|
|
21598
|
-
a$m.createElement(Checkbox, { id: "all-checkbox", name: "all-checkbox", checked:
|
|
21616
|
+
a$m.createElement(Checkbox, { id: "all-checkbox", name: "all-checkbox", checked: displayOptions?.every((opt) => tempFilters?.includes(opt.key)), onChange: () => {
|
|
21599
21617
|
setTempFilters((prev) => {
|
|
21600
|
-
if (prev?.length ===
|
|
21618
|
+
if (prev?.length === displayOptions?.length) {
|
|
21601
21619
|
return [];
|
|
21602
21620
|
}
|
|
21603
21621
|
else {
|
|
21604
|
-
return
|
|
21622
|
+
return displayOptions.map((opt) => opt.key);
|
|
21605
21623
|
}
|
|
21606
21624
|
});
|
|
21607
21625
|
} }),
|
|
21608
21626
|
a$m.createElement(FilterBoxLabel, { htmlFor: "all-checkbox" }, "Select All"))),
|
|
21609
|
-
(
|
|
21610
|
-
? filterOptions
|
|
21611
|
-
: Array.from(header.column.getFacetedUniqueValues().keys()))?.map((item) => {
|
|
21627
|
+
displayOptions?.map(({ key, value }, index) => {
|
|
21612
21628
|
if (meta?.filterMode === "singleSelect") {
|
|
21613
|
-
return (a$m.createElement(MenuItemOption, { key:
|
|
21614
|
-
setCurrentAppliedFilters([
|
|
21615
|
-
column?.setFilterValue([
|
|
21629
|
+
return (a$m.createElement(MenuItemOption, { key: `${key}-${index}`, id: `${key}-button`, onClick: () => {
|
|
21630
|
+
setCurrentAppliedFilters([key]);
|
|
21631
|
+
column?.setFilterValue([key]);
|
|
21616
21632
|
showFilterMenu(false);
|
|
21617
21633
|
onFilterApply?.();
|
|
21618
|
-
}, "$applied": tempFilters?.includes(
|
|
21634
|
+
}, "$applied": tempFilters?.includes(key) }, value));
|
|
21619
21635
|
}
|
|
21620
21636
|
if (meta?.filterMode === "multiSelect" ||
|
|
21621
21637
|
!meta?.filterMode) {
|
|
21622
|
-
return (a$m.createElement(MenuItem, { key:
|
|
21623
|
-
a$m.createElement(Checkbox, { id: `${
|
|
21638
|
+
return (a$m.createElement(MenuItem, { key: key },
|
|
21639
|
+
a$m.createElement(Checkbox, { id: `${key}-checkbox`, name: `${key}-checkbox`, checked: tempFilters?.includes(key), onChange: () => {
|
|
21624
21640
|
setTempFilters((prev) => {
|
|
21625
|
-
if (prev?.includes(
|
|
21626
|
-
return prev.filter((i) => i !==
|
|
21627
|
-
|
|
21628
|
-
|
|
21629
|
-
return [...prev, item];
|
|
21630
|
-
}
|
|
21641
|
+
if (prev?.includes(key))
|
|
21642
|
+
return prev.filter((i) => i !== key);
|
|
21643
|
+
else
|
|
21644
|
+
return [...prev, key];
|
|
21631
21645
|
});
|
|
21632
21646
|
} }),
|
|
21633
|
-
a$m.createElement(FilterLabelTransparent, null,
|
|
21634
|
-
a$m.createElement(FilterBoxLabel, { htmlFor: `${
|
|
21647
|
+
a$m.createElement(FilterLabelTransparent, null, value),
|
|
21648
|
+
a$m.createElement(FilterBoxLabel, { htmlFor: `${key}-checkbox` }, value)));
|
|
21635
21649
|
}
|
|
21636
21650
|
})),
|
|
21637
21651
|
(meta?.filterMode === "multiSelect" ||
|
|
@@ -21901,11 +21915,9 @@ function Table({ columns, data, isLoading, serverSide = false, onPageChange, onS
|
|
|
21901
21915
|
});
|
|
21902
21916
|
}
|
|
21903
21917
|
setColumnFilters(next);
|
|
21904
|
-
// Also keep your simple `filters` map in sync (optional)
|
|
21905
21918
|
const map = {};
|
|
21906
21919
|
next.forEach((f) => (map[f.id] = f.value));
|
|
21907
21920
|
setFilters(map);
|
|
21908
|
-
// Inform parent (useful for server-side)
|
|
21909
21921
|
onFilterChange?.(next);
|
|
21910
21922
|
},
|
|
21911
21923
|
filterFns: {
|
|
@@ -22154,6 +22166,9 @@ const PaymentStatusIcon = styled(StellaIcon) `
|
|
|
22154
22166
|
`;
|
|
22155
22167
|
const PaymentStatusLabel = styled.span `
|
|
22156
22168
|
line-height: 20px;
|
|
22169
|
+
text-overflow: ellipsis;
|
|
22170
|
+
white-space: nowrap;
|
|
22171
|
+
overflow: hidden;
|
|
22157
22172
|
`;
|
|
22158
22173
|
|
|
22159
22174
|
var PaymentStatusVariant;
|
|
@@ -22290,7 +22305,7 @@ const NotificationBubble = styled.span `
|
|
|
22290
22305
|
const Tab = ({ id, className, onClick, htmlProps, label, variant = "light", active = false, notifications, }) => {
|
|
22291
22306
|
return (a$m.createElement(TabButton, { id: id, "$variant": variant, className: `${className} ${active && "active"}`, onClick: () => onClick?.(label), ...htmlProps },
|
|
22292
22307
|
label,
|
|
22293
|
-
notifications && notifications > 0 && (a$m.createElement(NotificationBubble, { "$isActive": active }, notifications))));
|
|
22308
|
+
!!(notifications && notifications > 0) && (a$m.createElement(NotificationBubble, { "$isActive": active }, notifications))));
|
|
22294
22309
|
};
|
|
22295
22310
|
|
|
22296
22311
|
const Tabs = ({ id, className, tabs, htmlProps, onTabClick, defaultActiveTab, variant = "light", isPill, }) => {
|
|
@@ -22316,6 +22331,9 @@ const OrderStatusIcon = styled(StellaIcon) `
|
|
|
22316
22331
|
`;
|
|
22317
22332
|
const OrderStatusLabel = styled.span `
|
|
22318
22333
|
line-height: 20px;
|
|
22334
|
+
text-overflow: ellipsis;
|
|
22335
|
+
white-space: nowrap;
|
|
22336
|
+
overflow: hidden;
|
|
22319
22337
|
`;
|
|
22320
22338
|
|
|
22321
22339
|
var OrderStatusVariant;
|
|
@@ -22341,9 +22359,7 @@ const getOrderStatusLabel = (variant, isPurchaser) => {
|
|
|
22341
22359
|
case OrderStatusVariant.VIEW_PRICING:
|
|
22342
22360
|
return isPurchaser ? "View Quote" : "Quoted";
|
|
22343
22361
|
case OrderStatusVariant.ACTION_REQUIRED:
|
|
22344
|
-
return
|
|
22345
|
-
case OrderStatusVariant.ORDER_PLACED:
|
|
22346
|
-
return "Awaiting Acknowledgement";
|
|
22362
|
+
return "Action Required";
|
|
22347
22363
|
case OrderStatusVariant.DECLINED:
|
|
22348
22364
|
return "Declined to Purchase";
|
|
22349
22365
|
case OrderStatusVariant.EXPIRED:
|
|
@@ -22359,7 +22375,7 @@ const OrderStatus = ({ variant, id, className, isPurchaser, }) => {
|
|
|
22359
22375
|
const STATUS_ICON_MAP = {
|
|
22360
22376
|
InfoNeeded: "warning",
|
|
22361
22377
|
ViewPricing: "eye",
|
|
22362
|
-
ActionRequired:
|
|
22378
|
+
ActionRequired: "warning",
|
|
22363
22379
|
OrderPlaced: "list-checks",
|
|
22364
22380
|
OrderAcknowledged: "check-square",
|
|
22365
22381
|
OrderCanceled: "x-circle",
|