@caratlogic/design-system 0.1.49 → 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/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/components/ui/select.d.ts.map +1 -1
- package/dist/index.cjs.js +33 -7
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +33 -7
- package/dist/index.esm.js.map +1 -1
- package/dist/ui.cjs.js +10 -2
- package/dist/ui.cjs.js.map +1 -1
- package/dist/ui.esm.js +10 -2
- package/dist/ui.esm.js.map +1 -1
- package/package.json +1 -1
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
|
-
:
|
|
27166
|
-
?
|
|
27167
|
-
:
|
|
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'
|
|
@@ -42838,14 +42856,22 @@ searchPlaceholder = 'Search...', emptyMessage = 'No options available', ...props
|
|
|
42838
42856
|
const searchCtx = useSelectSearchContext();
|
|
42839
42857
|
const searchTerm = searchCtx?.searchTerm ?? '';
|
|
42840
42858
|
const setSearchTerm = searchCtx?.setSearchTerm;
|
|
42859
|
+
const searchInputRef = React.useRef(null);
|
|
42841
42860
|
// Clear search when the content unmounts (safety)
|
|
42842
42861
|
React.useEffect(() => {
|
|
42843
42862
|
return () => setSearchTerm?.('');
|
|
42844
42863
|
}, [setSearchTerm]);
|
|
42845
42864
|
return (jsx(SelectPrimitive.Portal, { children: jsxs(SelectPrimitive.Content, { "data-slot": "select-content", className: cn('bg-card cursor-pointer text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border border-border shadow-[0_10px_15px_-3px_rgba(0,0,0,0.10),0_4px_6px_-4px_rgba(0,0,0,0.10)]', position === 'popper' &&
|
|
42846
|
-
'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1', className), position: position, ...props, children: [searchable && (jsx("div", { className: "p-2 pb-1", children: jsxs("div", { className: "flex h-9 w-full items-center gap-2 rounded-lg bg-secondary px-3", children: [jsx(Search, { className: "h-4 w-4 shrink-0 text-[#737373]", "aria-hidden": "true" }), jsx("input", { type: "search", className: "min-w-0 flex-1 bg-transparent text-sm text-foreground outline-none placeholder:text-placeholder", placeholder: searchPlaceholder, value: searchTerm, onChange: (e) => setSearchTerm?.(e.target.value),
|
|
42865
|
+
'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1', className), position: position, ...props, children: [searchable && (jsx("div", { className: "p-2 pb-1", children: jsxs("div", { className: "flex h-9 w-full items-center gap-2 rounded-lg bg-secondary px-3", children: [jsx(Search, { className: "h-4 w-4 shrink-0 text-[#737373]", "aria-hidden": "true" }), jsx("input", { ref: searchInputRef, type: "search", className: "min-w-0 flex-1 bg-transparent text-sm text-foreground outline-none placeholder:text-placeholder", placeholder: searchPlaceholder, value: searchTerm, onChange: (e) => setSearchTerm?.(e.target.value),
|
|
42847
42866
|
// prevent keys from interfering with Radix keyboard nav
|
|
42848
|
-
onKeyDown: (e) => e.stopPropagation()
|
|
42867
|
+
onKeyDown: (e) => e.stopPropagation(),
|
|
42868
|
+
// When the search hides the selected item, Radix moves focus to
|
|
42869
|
+
// the list itself; keep it in the search box so typing goes on.
|
|
42870
|
+
onBlur: (e) => {
|
|
42871
|
+
if (e.relatedTarget?.getAttribute('role') === 'listbox') {
|
|
42872
|
+
searchInputRef.current?.focus();
|
|
42873
|
+
}
|
|
42874
|
+
} })] }) })), jsx(SelectScrollUpButton, {}), jsx(SelectPrimitive.Viewport, { "data-slot": "select-viewport", style: {
|
|
42849
42875
|
'--select-empty-message': JSON.stringify(searchTerm ? 'No matching options' : emptyMessage),
|
|
42850
42876
|
}, className: cn('p-1 max-h-[12.5rem] overflow-y-auto', 'empty:after:block empty:after:px-2 empty:after:py-4 empty:after:text-center empty:after:text-sm empty:after:text-muted-foreground empty:after:content-(--select-empty-message)', position === 'popper' &&
|
|
42851
42877
|
'w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1'), children: children }), jsx(SelectScrollDownButton, {})] }) }));
|