@caratlogic/design-system 0.1.50 → 0.1.51

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.esm.js CHANGED
@@ -26488,6 +26488,21 @@ function pinnedHeaderClass() {
26488
26488
  function pinnedCellClass(pinnedBg) {
26489
26489
  return cn('sticky right-0 z-10', PINNED_BEFORE, PINNED_SHADOW, pinnedBg);
26490
26490
  }
26491
+ const ROW_TONE = {
26492
+ warning: 'bg-badge-amber-bg/40 hover:bg-badge-amber-bg/60',
26493
+ info: 'bg-badge-blue-bg/40 hover:bg-badge-blue-bg/60',
26494
+ };
26495
+ // The pinned cell must stay opaque, so the tint is an overlay painted under its content.
26496
+ const PINNED_TONE = {
26497
+ warning: 'after:bg-badge-amber-bg/40',
26498
+ info: 'after:bg-badge-blue-bg/40',
26499
+ };
26500
+ function rowToneClass(tone) {
26501
+ return ROW_TONE[tone];
26502
+ }
26503
+ function pinnedToneClass(tone) {
26504
+ return cn('after:pointer-events-none after:absolute after:inset-0 after:-z-10 after:content-[""]', PINNED_TONE[tone]);
26505
+ }
26491
26506
  const PINNED_RIGHT_WIDTH = '72px';
26492
26507
  /** Width for a header/body/filter cell: the resized width var while resized or dragging, a fixed width for the pinned actions column. */
26493
26508
  function getColumnWidthStyle(key, isSized, isPinnedRight) {
@@ -27102,7 +27117,7 @@ function DocumentDetailSkeleton({ aside = 'payment', sections = 3, label = 'Load
27102
27117
  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
27118
  }
27104
27119
 
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, }) {
27120
+ 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
27121
  const showSelectionColumn = enableSelection && (!isArchiveView || selectionInArchiveView);
27107
27122
  const vBorder = showGrid ? 'border-r' : '';
27108
27123
  const { localWidths, draggingKey, tableRef, handleResizeMouseDown } = useColumnResize({
@@ -27158,13 +27173,16 @@ function DataEditableTable({ data, columns, onRowClick, enableSelection = false,
27158
27173
  const isEditing = editingRow === row.id && editingRow !== null;
27159
27174
  const isSaving = savingRow === row.id;
27160
27175
  const isSelected = selectedSet.has(row.id);
27176
+ const tone = isEditing || isSelected ? undefined : getRowTone?.(row);
27161
27177
  const bgClass = isEditing
27162
27178
  ? 'bg-warning/10 hover:bg-warning/10'
27163
27179
  : isSelected
27164
27180
  ? 'bg-primary/10 hover:bg-primary/10'
27165
- : !striped || rowIndex % 2 === 0
27166
- ? 'bg-card hover:bg-secondary'
27167
- : 'bg-background hover:bg-secondary';
27181
+ : tone
27182
+ ? rowToneClass(tone)
27183
+ : !striped || rowIndex % 2 === 0
27184
+ ? 'bg-card hover:bg-secondary'
27185
+ : 'bg-background hover:bg-secondary';
27168
27186
  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
27187
  e.stopPropagation();
27170
27188
  handleEditIconClick(row.id, row);
@@ -27182,7 +27200,7 @@ function DataEditableTable({ data, columns, onRowClick, enableSelection = false,
27182
27200
  ? 'bg-[#FEFCE8] dark:bg-[#422006]'
27183
27201
  : isSelected
27184
27202
  ? 'bg-[#EFF6FF] dark:bg-[#172554]'
27185
- : 'bg-card group-hover/row:bg-table-header'
27203
+ : cn('bg-card group-hover/row:bg-table-header', tone && pinnedToneClass(tone))
27186
27204
  : '';
27187
27205
  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
27206
  ? 'text-center'