@caratlogic/design-system 0.1.50 → 0.1.52
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/components/molecules/DataEditableTable/DataEditableTable.d.ts +1 -1
- package/dist/components/molecules/DataEditableTable/DataEditableTable.d.ts.map +1 -1
- package/dist/components/molecules/DataEditableTable/DataEditableTable.types.d.ts +4 -0
- package/dist/components/molecules/DataEditableTable/DataEditableTable.types.d.ts.map +1 -1
- package/dist/components/molecules/DataEditableTable/DataEditableTable.utils.d.ts +3 -1
- package/dist/components/molecules/DataEditableTable/DataEditableTable.utils.d.ts.map +1 -1
- package/dist/components/molecules/DataEditableTable/index.d.ts +1 -1
- package/dist/components/molecules/DataEditableTable/index.d.ts.map +1 -1
- package/dist/index.cjs.js +24 -5
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +24 -5
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -26488,6 +26488,22 @@ function pinnedHeaderClass() {
|
|
|
26488
26488
|
function pinnedCellClass(pinnedBg) {
|
|
26489
26489
|
return cn('sticky right-0 z-10', PINNED_BEFORE, PINNED_SHADOW, pinnedBg);
|
|
26490
26490
|
}
|
|
26491
|
+
// Dark badge backgrounds sit too close to the dark card, so dark mode tints with the status colour itself.
|
|
26492
|
+
const ROW_TONE = {
|
|
26493
|
+
warning: 'bg-badge-amber-bg/40 hover:bg-badge-amber-bg/60 dark:bg-warning/15 dark:hover:bg-warning/25',
|
|
26494
|
+
info: 'bg-badge-blue-bg/40 hover:bg-badge-blue-bg/60 dark:bg-info/15 dark:hover:bg-info/25',
|
|
26495
|
+
};
|
|
26496
|
+
// The pinned cell must stay opaque, so the tint is an overlay painted under its content.
|
|
26497
|
+
const PINNED_TONE = {
|
|
26498
|
+
warning: 'after:bg-badge-amber-bg/40 dark:after:bg-warning/15',
|
|
26499
|
+
info: 'after:bg-badge-blue-bg/40 dark:after:bg-info/15',
|
|
26500
|
+
};
|
|
26501
|
+
function rowToneClass(tone) {
|
|
26502
|
+
return ROW_TONE[tone];
|
|
26503
|
+
}
|
|
26504
|
+
function pinnedToneClass(tone) {
|
|
26505
|
+
return cn('after:pointer-events-none after:absolute after:inset-0 after:-z-10 after:content-[""]', PINNED_TONE[tone]);
|
|
26506
|
+
}
|
|
26491
26507
|
const PINNED_RIGHT_WIDTH = '72px';
|
|
26492
26508
|
/** Width for a header/body/filter cell: the resized width var while resized or dragging, a fixed width for the pinned actions column. */
|
|
26493
26509
|
function getColumnWidthStyle(key, isSized, isPinnedRight) {
|
|
@@ -27102,7 +27118,7 @@ function DocumentDetailSkeleton({ aside = 'payment', sections = 3, label = 'Load
|
|
|
27102
27118
|
return (jsxs("div", { role: "status", "aria-busy": "true", "aria-label": label, className: "space-y-4", children: [jsxs("div", { className: "flex flex-wrap items-center justify-between gap-3", children: [jsxs("div", { className: "flex items-center gap-3", children: [jsx(SquareSkeleton, { height: 14, width: 80, rounded: "full" }), jsx("span", { className: "h-5 w-px bg-border" }), jsx(SquareSkeleton, { height: 28, width: 200, rounded: "md" }), jsx(SquareSkeleton, { height: 22, width: 72, rounded: "full" })] }), jsxs("div", { className: "flex items-center gap-2", children: [jsx(SquareSkeleton, { height: 36, width: 112, rounded: "lg" }), jsx(SquareSkeleton, { height: 36, width: 80, rounded: "lg" }), jsx(SquareSkeleton, { height: 36, width: 128, rounded: "lg" }), jsx(SquareSkeleton, { height: 36, width: 36, rounded: "lg" })] })] }), jsxs("section", { "aria-hidden": "true", className: "grid grid-cols-1 overflow-hidden rounded-2xl border border-border bg-card md:grid-cols-[minmax(0,1.4fr)_minmax(0,1fr)]", children: [jsxs("div", { className: "flex flex-col justify-center space-y-3 px-5 py-4 sm:px-7 sm:py-4", children: [jsx(SquareSkeleton, { height: 12, width: 96, rounded: "full" }), jsx(SquareSkeleton, { height: 40, width: 220, rounded: "md" }), aside !== 'none' && (jsxs("div", { className: "w-full max-w-xl space-y-2 pt-1", children: [jsx(SquareSkeleton, { height: 8, className: "w-full", rounded: "full" }), jsxs("div", { className: "flex justify-between", children: [jsx(SquareSkeleton, { height: 11, width: 88, rounded: "full" }), jsx(SquareSkeleton, { height: 11, width: 40, rounded: "full" })] })] }))] }), jsx("div", { className: "border-t border-border bg-muted/40 px-5 py-2 md:border-l md:border-t-0", children: [0, 1, 2, 3].map((i) => (jsxs("div", { className: "flex min-h-10 items-center gap-3 border-b border-border py-1.5 last:border-b-0", children: [jsx(SquareSkeleton, { height: 24, width: 24, rounded: "md" }), jsx(SquareSkeleton, { height: 12, width: 72, rounded: "full" }), jsx(SquareSkeleton, { height: 12, width: 88, rounded: "full", className: "ml-auto" })] }, i))) })] }), Array.from({ length: sections }).map((_, s) => (jsxs("section", { "aria-hidden": "true", className: "overflow-hidden rounded-2xl border border-border bg-card", children: [jsxs("div", { className: "flex items-center gap-2.5 border-b border-border px-4 py-3", children: [jsx(SquareSkeleton, { height: 28, width: 28, rounded: "lg" }), jsx(SquareSkeleton, { height: 15, width: 128, rounded: "full" })] }), jsx("div", { className: "space-y-3 p-4", children: Array.from({ length: s === 1 ? 4 : 2 }).map((__, row) => (jsx(SquareSkeleton, { height: s === 1 ? 36 : 14, className: row % 2 ? 'w-3/4' : 'w-full', rounded: "md" }, row))) })] }, s))), jsx("span", { className: "sr-only", children: label })] }));
|
|
27103
27119
|
}
|
|
27104
27120
|
|
|
27105
|
-
function DataEditableTable({ data, columns, onRowClick, enableSelection = false, columnStyles = {}, onEditChange, onSaveRow, sortBy, setSortBy, sortOrder, setSortOrder, saving, selectedRows = [], onSelectionChange, isArchiveView = false, selectionInArchiveView = false, permissionKey = '', columnWidths, onColumnResize, pagination, fetchBusinessContacts, showGrid = true, striped = true, emptyState, loading = false, loadingRows = 10, filterRowLeading, onColumnReorder, }) {
|
|
27121
|
+
function DataEditableTable({ data, columns, onRowClick, enableSelection = false, columnStyles = {}, onEditChange, onSaveRow, sortBy, setSortBy, sortOrder, setSortOrder, saving, selectedRows = [], onSelectionChange, isArchiveView = false, selectionInArchiveView = false, permissionKey = '', columnWidths, onColumnResize, pagination, fetchBusinessContacts, showGrid = true, striped = true, emptyState, loading = false, loadingRows = 10, filterRowLeading, onColumnReorder, getRowTone, }) {
|
|
27106
27122
|
const showSelectionColumn = enableSelection && (!isArchiveView || selectionInArchiveView);
|
|
27107
27123
|
const vBorder = showGrid ? 'border-r' : '';
|
|
27108
27124
|
const { localWidths, draggingKey, tableRef, handleResizeMouseDown } = useColumnResize({
|
|
@@ -27158,13 +27174,16 @@ function DataEditableTable({ data, columns, onRowClick, enableSelection = false,
|
|
|
27158
27174
|
const isEditing = editingRow === row.id && editingRow !== null;
|
|
27159
27175
|
const isSaving = savingRow === row.id;
|
|
27160
27176
|
const isSelected = selectedSet.has(row.id);
|
|
27177
|
+
const tone = isEditing || isSelected ? undefined : getRowTone?.(row);
|
|
27161
27178
|
const bgClass = isEditing
|
|
27162
27179
|
? 'bg-warning/10 hover:bg-warning/10'
|
|
27163
27180
|
: isSelected
|
|
27164
27181
|
? 'bg-primary/10 hover:bg-primary/10'
|
|
27165
|
-
:
|
|
27166
|
-
?
|
|
27167
|
-
:
|
|
27182
|
+
: tone
|
|
27183
|
+
? rowToneClass(tone)
|
|
27184
|
+
: !striped || rowIndex % 2 === 0
|
|
27185
|
+
? 'bg-card hover:bg-secondary'
|
|
27186
|
+
: 'bg-background hover:bg-secondary';
|
|
27168
27187
|
return (jsxs("tr", { className: cn('group/row h-[46px] transition-colors text-sm text-table-cell', bgClass, onRowClick && 'cursor-pointer'), onClick: () => onRowClick?.(row), children: [isArchiveView ? null : (jsx("td", { className: cn('px-3 py-1.5 text-center first:!pl-6 border-b border-solid !border-border', vBorder), children: jsx(Protected, { module: permissionKey, minLevel: PERMISSIONS.WRITE, children: jsx("button", { onClick: (e) => {
|
|
27169
27188
|
e.stopPropagation();
|
|
27170
27189
|
handleEditIconClick(row.id, row);
|
|
@@ -27182,7 +27201,7 @@ function DataEditableTable({ data, columns, onRowClick, enableSelection = false,
|
|
|
27182
27201
|
? 'bg-[#FEFCE8] dark:bg-[#422006]'
|
|
27183
27202
|
: isSelected
|
|
27184
27203
|
? 'bg-[#EFF6FF] dark:bg-[#172554]'
|
|
27185
|
-
: 'bg-card group-hover/row:bg-table-header'
|
|
27204
|
+
: cn('bg-card group-hover/row:bg-table-header', tone && pinnedToneClass(tone))
|
|
27186
27205
|
: '';
|
|
27187
27206
|
return (jsx("td", { className: cn('px-4 py-1.5 first:!pl-6 border-b border-border whitespace-nowrap text-table-cell border-solid !border-border', vBorder, isPinnedRight || col.align === 'center'
|
|
27188
27207
|
? 'text-center'
|