@stella-source/stellasource-dsl 3.1.6 → 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 +42 -29
- package/dist/cjs/index.js.map +1 -1
- 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 +42 -29
- package/dist/esm/index.esm.js.map +1 -1
- 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
|
@@ -21412,7 +21412,7 @@ const KebabAlign = styled.div `
|
|
|
21412
21412
|
`;
|
|
21413
21413
|
// EmptyTableState
|
|
21414
21414
|
const EmptyTableCell = styled.td `
|
|
21415
|
-
padding:
|
|
21415
|
+
padding: 5rem;
|
|
21416
21416
|
background-color: white;
|
|
21417
21417
|
`;
|
|
21418
21418
|
const EmptyTableSection = styled.section `
|
|
@@ -21497,6 +21497,18 @@ function useDebounceCallback(callback, delay) {
|
|
|
21497
21497
|
return [debounced, { flush, cancel }];
|
|
21498
21498
|
}
|
|
21499
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
|
+
};
|
|
21500
21512
|
const TableHeaderCell = ({ header, serverSide, filters, sorting, scrollPosition, onFilterMenuInteraction, onFilterApply, }) => {
|
|
21501
21513
|
const column = header.column;
|
|
21502
21514
|
const columnDef = column.columnDef;
|
|
@@ -21509,6 +21521,9 @@ const TableHeaderCell = ({ header, serverSide, filters, sorting, scrollPosition,
|
|
|
21509
21521
|
const [tempFilters, setTempFilters] = a$m.useState([]);
|
|
21510
21522
|
const [currentAppliedFilters, setCurrentAppliedFilters] = a$m.useState([]);
|
|
21511
21523
|
const [filterOptions, setFilterOptions] = a$m.useState([]);
|
|
21524
|
+
const displayOptions = serverSide
|
|
21525
|
+
? filterOptions
|
|
21526
|
+
: normalizeOptions(Array.from(header.column.getFacetedUniqueValues().keys()));
|
|
21512
21527
|
const [textAlign, setTextAlign] = a$m.useState("left");
|
|
21513
21528
|
const [handleSave, { flush }] = useDebounceCallback((value) => {
|
|
21514
21529
|
column?.setFilterValue([value]);
|
|
@@ -21517,7 +21532,7 @@ const TableHeaderCell = ({ header, serverSide, filters, sorting, scrollPosition,
|
|
|
21517
21532
|
onFilterApply?.();
|
|
21518
21533
|
}, 300);
|
|
21519
21534
|
a$m.useEffect(() => {
|
|
21520
|
-
setFilterOptions(meta?.filterOptions || []);
|
|
21535
|
+
setFilterOptions(normalizeOptions(meta?.filterOptions || []));
|
|
21521
21536
|
}, [meta]);
|
|
21522
21537
|
const toggleMenu = (e) => {
|
|
21523
21538
|
e.stopPropagation();
|
|
@@ -21598,43 +21613,39 @@ const TableHeaderCell = ({ header, serverSide, filters, sorting, scrollPosition,
|
|
|
21598
21613
|
}, onBlur: () => !serverSide && flush(), endIcon: "search", value: tempFilters?.[0] }))),
|
|
21599
21614
|
(meta?.filterMode === "multiSelect" ||
|
|
21600
21615
|
!meta?.filterMode) && (a$m.createElement(MenuItem, { key: "select-all" },
|
|
21601
|
-
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: () => {
|
|
21602
21617
|
setTempFilters((prev) => {
|
|
21603
|
-
if (prev?.length ===
|
|
21618
|
+
if (prev?.length === displayOptions?.length) {
|
|
21604
21619
|
return [];
|
|
21605
21620
|
}
|
|
21606
21621
|
else {
|
|
21607
|
-
return
|
|
21622
|
+
return displayOptions.map((opt) => opt.key);
|
|
21608
21623
|
}
|
|
21609
21624
|
});
|
|
21610
21625
|
} }),
|
|
21611
21626
|
a$m.createElement(FilterBoxLabel, { htmlFor: "all-checkbox" }, "Select All"))),
|
|
21612
|
-
(
|
|
21613
|
-
? filterOptions
|
|
21614
|
-
: Array.from(header.column.getFacetedUniqueValues().keys()))?.map((item) => {
|
|
21627
|
+
displayOptions?.map(({ key, value }, index) => {
|
|
21615
21628
|
if (meta?.filterMode === "singleSelect") {
|
|
21616
|
-
return (a$m.createElement(MenuItemOption, { key:
|
|
21617
|
-
setCurrentAppliedFilters([
|
|
21618
|
-
column?.setFilterValue([
|
|
21629
|
+
return (a$m.createElement(MenuItemOption, { key: `${key}-${index}`, id: `${key}-button`, onClick: () => {
|
|
21630
|
+
setCurrentAppliedFilters([key]);
|
|
21631
|
+
column?.setFilterValue([key]);
|
|
21619
21632
|
showFilterMenu(false);
|
|
21620
21633
|
onFilterApply?.();
|
|
21621
|
-
}, "$applied": tempFilters?.includes(
|
|
21634
|
+
}, "$applied": tempFilters?.includes(key) }, value));
|
|
21622
21635
|
}
|
|
21623
21636
|
if (meta?.filterMode === "multiSelect" ||
|
|
21624
21637
|
!meta?.filterMode) {
|
|
21625
|
-
return (a$m.createElement(MenuItem, { key:
|
|
21626
|
-
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: () => {
|
|
21627
21640
|
setTempFilters((prev) => {
|
|
21628
|
-
if (prev?.includes(
|
|
21629
|
-
return prev.filter((i) => i !==
|
|
21630
|
-
|
|
21631
|
-
|
|
21632
|
-
return [...prev, item];
|
|
21633
|
-
}
|
|
21641
|
+
if (prev?.includes(key))
|
|
21642
|
+
return prev.filter((i) => i !== key);
|
|
21643
|
+
else
|
|
21644
|
+
return [...prev, key];
|
|
21634
21645
|
});
|
|
21635
21646
|
} }),
|
|
21636
|
-
a$m.createElement(FilterLabelTransparent, null,
|
|
21637
|
-
a$m.createElement(FilterBoxLabel, { htmlFor: `${
|
|
21647
|
+
a$m.createElement(FilterLabelTransparent, null, value),
|
|
21648
|
+
a$m.createElement(FilterBoxLabel, { htmlFor: `${key}-checkbox` }, value)));
|
|
21638
21649
|
}
|
|
21639
21650
|
})),
|
|
21640
21651
|
(meta?.filterMode === "multiSelect" ||
|
|
@@ -21904,11 +21915,9 @@ function Table({ columns, data, isLoading, serverSide = false, onPageChange, onS
|
|
|
21904
21915
|
});
|
|
21905
21916
|
}
|
|
21906
21917
|
setColumnFilters(next);
|
|
21907
|
-
// Also keep your simple `filters` map in sync (optional)
|
|
21908
21918
|
const map = {};
|
|
21909
21919
|
next.forEach((f) => (map[f.id] = f.value));
|
|
21910
21920
|
setFilters(map);
|
|
21911
|
-
// Inform parent (useful for server-side)
|
|
21912
21921
|
onFilterChange?.(next);
|
|
21913
21922
|
},
|
|
21914
21923
|
filterFns: {
|
|
@@ -22157,6 +22166,9 @@ const PaymentStatusIcon = styled(StellaIcon) `
|
|
|
22157
22166
|
`;
|
|
22158
22167
|
const PaymentStatusLabel = styled.span `
|
|
22159
22168
|
line-height: 20px;
|
|
22169
|
+
text-overflow: ellipsis;
|
|
22170
|
+
white-space: nowrap;
|
|
22171
|
+
overflow: hidden;
|
|
22160
22172
|
`;
|
|
22161
22173
|
|
|
22162
22174
|
var PaymentStatusVariant;
|
|
@@ -22293,7 +22305,7 @@ const NotificationBubble = styled.span `
|
|
|
22293
22305
|
const Tab = ({ id, className, onClick, htmlProps, label, variant = "light", active = false, notifications, }) => {
|
|
22294
22306
|
return (a$m.createElement(TabButton, { id: id, "$variant": variant, className: `${className} ${active && "active"}`, onClick: () => onClick?.(label), ...htmlProps },
|
|
22295
22307
|
label,
|
|
22296
|
-
notifications && notifications > 0 && (a$m.createElement(NotificationBubble, { "$isActive": active }, notifications))));
|
|
22308
|
+
!!(notifications && notifications > 0) && (a$m.createElement(NotificationBubble, { "$isActive": active }, notifications))));
|
|
22297
22309
|
};
|
|
22298
22310
|
|
|
22299
22311
|
const Tabs = ({ id, className, tabs, htmlProps, onTabClick, defaultActiveTab, variant = "light", isPill, }) => {
|
|
@@ -22319,6 +22331,9 @@ const OrderStatusIcon = styled(StellaIcon) `
|
|
|
22319
22331
|
`;
|
|
22320
22332
|
const OrderStatusLabel = styled.span `
|
|
22321
22333
|
line-height: 20px;
|
|
22334
|
+
text-overflow: ellipsis;
|
|
22335
|
+
white-space: nowrap;
|
|
22336
|
+
overflow: hidden;
|
|
22322
22337
|
`;
|
|
22323
22338
|
|
|
22324
22339
|
var OrderStatusVariant;
|
|
@@ -22344,9 +22359,7 @@ const getOrderStatusLabel = (variant, isPurchaser) => {
|
|
|
22344
22359
|
case OrderStatusVariant.VIEW_PRICING:
|
|
22345
22360
|
return isPurchaser ? "View Quote" : "Quoted";
|
|
22346
22361
|
case OrderStatusVariant.ACTION_REQUIRED:
|
|
22347
|
-
return
|
|
22348
|
-
case OrderStatusVariant.ORDER_PLACED:
|
|
22349
|
-
return "Awaiting Acknowledgement";
|
|
22362
|
+
return "Action Required";
|
|
22350
22363
|
case OrderStatusVariant.DECLINED:
|
|
22351
22364
|
return "Declined to Purchase";
|
|
22352
22365
|
case OrderStatusVariant.EXPIRED:
|
|
@@ -22362,7 +22375,7 @@ const OrderStatus = ({ variant, id, className, isPurchaser, }) => {
|
|
|
22362
22375
|
const STATUS_ICON_MAP = {
|
|
22363
22376
|
InfoNeeded: "warning",
|
|
22364
22377
|
ViewPricing: "eye",
|
|
22365
|
-
ActionRequired:
|
|
22378
|
+
ActionRequired: "warning",
|
|
22366
22379
|
OrderPlaced: "list-checks",
|
|
22367
22380
|
OrderAcknowledged: "check-square",
|
|
22368
22381
|
OrderCanceled: "x-circle",
|