@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/styles.css
CHANGED
|
@@ -59,7 +59,10 @@ export interface CustomColumnMeta {
|
|
|
59
59
|
cellAlign?: "left" | "right";
|
|
60
60
|
dataType?: "string" | "number";
|
|
61
61
|
pin?: "left" | "right";
|
|
62
|
-
filterOptions?: string[] | number[]
|
|
62
|
+
filterOptions?: string[] | number[] | {
|
|
63
|
+
key?: string;
|
|
64
|
+
value?: string;
|
|
65
|
+
}[];
|
|
63
66
|
filterMode?: "singleSelect" | "multiSelect" | "search";
|
|
64
67
|
}
|
|
65
68
|
export type RowStatus = "action-pending" | "completed";
|
|
@@ -24,4 +24,5 @@ import "./shared/tokens/tokens.css";
|
|
|
24
24
|
import OrderStatus from "./components/OrderStatus/OrderStatus";
|
|
25
25
|
/**Exports */
|
|
26
26
|
export type { StellaIconDefinition } from "./components/StellaIcon/types";
|
|
27
|
+
export type { CustomColumnMeta } from "./components/Table/types";
|
|
27
28
|
export { Tabs, Label, StellaButton, IconButton, Loader, HelperText, Tooltip, StellaIcon, TextInput, PasswordInput, NumberInput, Table, Pagination, Sync, TableUnitsAndTotals, StellaButtonVariant, PaymentStatus, OrderStatus, Styles, };
|
package/dist/esm/index.esm.js
CHANGED
|
@@ -17044,6 +17044,9 @@ const RequiredIcon = styled(StellaIcon) `
|
|
|
17044
17044
|
`;
|
|
17045
17045
|
const ToolTipIcon = styled(Tooltip) `
|
|
17046
17046
|
margin-left: 2px;
|
|
17047
|
+
display: flex;
|
|
17048
|
+
justify-content: center;
|
|
17049
|
+
align-items: center;
|
|
17047
17050
|
`;
|
|
17048
17051
|
const LabelComponent = styled.label `
|
|
17049
17052
|
font-family: "Inter", sans-serif;
|
|
@@ -21389,7 +21392,7 @@ const KebabAlign = styled.div `
|
|
|
21389
21392
|
`;
|
|
21390
21393
|
// EmptyTableState
|
|
21391
21394
|
const EmptyTableCell = styled.td `
|
|
21392
|
-
padding:
|
|
21395
|
+
padding: 5rem;
|
|
21393
21396
|
background-color: white;
|
|
21394
21397
|
`;
|
|
21395
21398
|
const EmptyTableSection = styled.section `
|
|
@@ -21474,6 +21477,18 @@ function useDebounceCallback(callback, delay) {
|
|
|
21474
21477
|
return [debounced, { flush, cancel }];
|
|
21475
21478
|
}
|
|
21476
21479
|
|
|
21480
|
+
const normalizeOptions = (raw) => {
|
|
21481
|
+
return raw
|
|
21482
|
+
.map((item) => {
|
|
21483
|
+
if (typeof item === "string" || typeof item === "number") {
|
|
21484
|
+
return { key: item.toString(), value: item.toString() };
|
|
21485
|
+
}
|
|
21486
|
+
const key = item.key ?? item.value ?? "";
|
|
21487
|
+
const value = item.value ?? item.key ?? "";
|
|
21488
|
+
return { key, value };
|
|
21489
|
+
})
|
|
21490
|
+
.filter((o) => o.key && o.value);
|
|
21491
|
+
};
|
|
21477
21492
|
const TableHeaderCell = ({ header, serverSide, filters, sorting, scrollPosition, onFilterMenuInteraction, onFilterApply, }) => {
|
|
21478
21493
|
const column = header.column;
|
|
21479
21494
|
const columnDef = column.columnDef;
|
|
@@ -21486,6 +21501,9 @@ const TableHeaderCell = ({ header, serverSide, filters, sorting, scrollPosition,
|
|
|
21486
21501
|
const [tempFilters, setTempFilters] = useState([]);
|
|
21487
21502
|
const [currentAppliedFilters, setCurrentAppliedFilters] = useState([]);
|
|
21488
21503
|
const [filterOptions, setFilterOptions] = useState([]);
|
|
21504
|
+
const displayOptions = serverSide
|
|
21505
|
+
? filterOptions
|
|
21506
|
+
: normalizeOptions(Array.from(header.column.getFacetedUniqueValues().keys()));
|
|
21489
21507
|
const [textAlign, setTextAlign] = useState("left");
|
|
21490
21508
|
const [handleSave, { flush }] = useDebounceCallback((value) => {
|
|
21491
21509
|
column?.setFilterValue([value]);
|
|
@@ -21494,7 +21512,7 @@ const TableHeaderCell = ({ header, serverSide, filters, sorting, scrollPosition,
|
|
|
21494
21512
|
onFilterApply?.();
|
|
21495
21513
|
}, 300);
|
|
21496
21514
|
useEffect(() => {
|
|
21497
|
-
setFilterOptions(meta?.filterOptions || []);
|
|
21515
|
+
setFilterOptions(normalizeOptions(meta?.filterOptions || []));
|
|
21498
21516
|
}, [meta]);
|
|
21499
21517
|
const toggleMenu = (e) => {
|
|
21500
21518
|
e.stopPropagation();
|
|
@@ -21575,43 +21593,39 @@ const TableHeaderCell = ({ header, serverSide, filters, sorting, scrollPosition,
|
|
|
21575
21593
|
}, onBlur: () => !serverSide && flush(), endIcon: "search", value: tempFilters?.[0] }))),
|
|
21576
21594
|
(meta?.filterMode === "multiSelect" ||
|
|
21577
21595
|
!meta?.filterMode) && (a__default.createElement(MenuItem, { key: "select-all" },
|
|
21578
|
-
a__default.createElement(Checkbox, { id: "all-checkbox", name: "all-checkbox", checked:
|
|
21596
|
+
a__default.createElement(Checkbox, { id: "all-checkbox", name: "all-checkbox", checked: displayOptions?.every((opt) => tempFilters?.includes(opt.key)), onChange: () => {
|
|
21579
21597
|
setTempFilters((prev) => {
|
|
21580
|
-
if (prev?.length ===
|
|
21598
|
+
if (prev?.length === displayOptions?.length) {
|
|
21581
21599
|
return [];
|
|
21582
21600
|
}
|
|
21583
21601
|
else {
|
|
21584
|
-
return
|
|
21602
|
+
return displayOptions.map((opt) => opt.key);
|
|
21585
21603
|
}
|
|
21586
21604
|
});
|
|
21587
21605
|
} }),
|
|
21588
21606
|
a__default.createElement(FilterBoxLabel, { htmlFor: "all-checkbox" }, "Select All"))),
|
|
21589
|
-
(
|
|
21590
|
-
? filterOptions
|
|
21591
|
-
: Array.from(header.column.getFacetedUniqueValues().keys()))?.map((item) => {
|
|
21607
|
+
displayOptions?.map(({ key, value }, index) => {
|
|
21592
21608
|
if (meta?.filterMode === "singleSelect") {
|
|
21593
|
-
return (a__default.createElement(MenuItemOption, { key:
|
|
21594
|
-
setCurrentAppliedFilters([
|
|
21595
|
-
column?.setFilterValue([
|
|
21609
|
+
return (a__default.createElement(MenuItemOption, { key: `${key}-${index}`, id: `${key}-button`, onClick: () => {
|
|
21610
|
+
setCurrentAppliedFilters([key]);
|
|
21611
|
+
column?.setFilterValue([key]);
|
|
21596
21612
|
showFilterMenu(false);
|
|
21597
21613
|
onFilterApply?.();
|
|
21598
|
-
}, "$applied": tempFilters?.includes(
|
|
21614
|
+
}, "$applied": tempFilters?.includes(key) }, value));
|
|
21599
21615
|
}
|
|
21600
21616
|
if (meta?.filterMode === "multiSelect" ||
|
|
21601
21617
|
!meta?.filterMode) {
|
|
21602
|
-
return (a__default.createElement(MenuItem, { key:
|
|
21603
|
-
a__default.createElement(Checkbox, { id: `${
|
|
21618
|
+
return (a__default.createElement(MenuItem, { key: key },
|
|
21619
|
+
a__default.createElement(Checkbox, { id: `${key}-checkbox`, name: `${key}-checkbox`, checked: tempFilters?.includes(key), onChange: () => {
|
|
21604
21620
|
setTempFilters((prev) => {
|
|
21605
|
-
if (prev?.includes(
|
|
21606
|
-
return prev.filter((i) => i !==
|
|
21607
|
-
|
|
21608
|
-
|
|
21609
|
-
return [...prev, item];
|
|
21610
|
-
}
|
|
21621
|
+
if (prev?.includes(key))
|
|
21622
|
+
return prev.filter((i) => i !== key);
|
|
21623
|
+
else
|
|
21624
|
+
return [...prev, key];
|
|
21611
21625
|
});
|
|
21612
21626
|
} }),
|
|
21613
|
-
a__default.createElement(FilterLabelTransparent, null,
|
|
21614
|
-
a__default.createElement(FilterBoxLabel, { htmlFor: `${
|
|
21627
|
+
a__default.createElement(FilterLabelTransparent, null, value),
|
|
21628
|
+
a__default.createElement(FilterBoxLabel, { htmlFor: `${key}-checkbox` }, value)));
|
|
21615
21629
|
}
|
|
21616
21630
|
})),
|
|
21617
21631
|
(meta?.filterMode === "multiSelect" ||
|
|
@@ -21881,11 +21895,9 @@ function Table({ columns, data, isLoading, serverSide = false, onPageChange, onS
|
|
|
21881
21895
|
});
|
|
21882
21896
|
}
|
|
21883
21897
|
setColumnFilters(next);
|
|
21884
|
-
// Also keep your simple `filters` map in sync (optional)
|
|
21885
21898
|
const map = {};
|
|
21886
21899
|
next.forEach((f) => (map[f.id] = f.value));
|
|
21887
21900
|
setFilters(map);
|
|
21888
|
-
// Inform parent (useful for server-side)
|
|
21889
21901
|
onFilterChange?.(next);
|
|
21890
21902
|
},
|
|
21891
21903
|
filterFns: {
|
|
@@ -22134,6 +22146,9 @@ const PaymentStatusIcon = styled(StellaIcon) `
|
|
|
22134
22146
|
`;
|
|
22135
22147
|
const PaymentStatusLabel = styled.span `
|
|
22136
22148
|
line-height: 20px;
|
|
22149
|
+
text-overflow: ellipsis;
|
|
22150
|
+
white-space: nowrap;
|
|
22151
|
+
overflow: hidden;
|
|
22137
22152
|
`;
|
|
22138
22153
|
|
|
22139
22154
|
var PaymentStatusVariant;
|
|
@@ -22270,7 +22285,7 @@ const NotificationBubble = styled.span `
|
|
|
22270
22285
|
const Tab = ({ id, className, onClick, htmlProps, label, variant = "light", active = false, notifications, }) => {
|
|
22271
22286
|
return (a__default.createElement(TabButton, { id: id, "$variant": variant, className: `${className} ${active && "active"}`, onClick: () => onClick?.(label), ...htmlProps },
|
|
22272
22287
|
label,
|
|
22273
|
-
notifications && notifications > 0 && (a__default.createElement(NotificationBubble, { "$isActive": active }, notifications))));
|
|
22288
|
+
!!(notifications && notifications > 0) && (a__default.createElement(NotificationBubble, { "$isActive": active }, notifications))));
|
|
22274
22289
|
};
|
|
22275
22290
|
|
|
22276
22291
|
const Tabs = ({ id, className, tabs, htmlProps, onTabClick, defaultActiveTab, variant = "light", isPill, }) => {
|
|
@@ -22296,6 +22311,9 @@ const OrderStatusIcon = styled(StellaIcon) `
|
|
|
22296
22311
|
`;
|
|
22297
22312
|
const OrderStatusLabel = styled.span `
|
|
22298
22313
|
line-height: 20px;
|
|
22314
|
+
text-overflow: ellipsis;
|
|
22315
|
+
white-space: nowrap;
|
|
22316
|
+
overflow: hidden;
|
|
22299
22317
|
`;
|
|
22300
22318
|
|
|
22301
22319
|
var OrderStatusVariant;
|
|
@@ -22321,9 +22339,7 @@ const getOrderStatusLabel = (variant, isPurchaser) => {
|
|
|
22321
22339
|
case OrderStatusVariant.VIEW_PRICING:
|
|
22322
22340
|
return isPurchaser ? "View Quote" : "Quoted";
|
|
22323
22341
|
case OrderStatusVariant.ACTION_REQUIRED:
|
|
22324
|
-
return
|
|
22325
|
-
case OrderStatusVariant.ORDER_PLACED:
|
|
22326
|
-
return "Awaiting Acknowledgement";
|
|
22342
|
+
return "Action Required";
|
|
22327
22343
|
case OrderStatusVariant.DECLINED:
|
|
22328
22344
|
return "Declined to Purchase";
|
|
22329
22345
|
case OrderStatusVariant.EXPIRED:
|
|
@@ -22339,7 +22355,7 @@ const OrderStatus = ({ variant, id, className, isPurchaser, }) => {
|
|
|
22339
22355
|
const STATUS_ICON_MAP = {
|
|
22340
22356
|
InfoNeeded: "warning",
|
|
22341
22357
|
ViewPricing: "eye",
|
|
22342
|
-
ActionRequired:
|
|
22358
|
+
ActionRequired: "warning",
|
|
22343
22359
|
OrderPlaced: "list-checks",
|
|
22344
22360
|
OrderAcknowledged: "check-square",
|
|
22345
22361
|
OrderCanceled: "x-circle",
|