@crispy-seed/data-table 0.13.0 → 0.14.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/data-table-recipe.css +62 -27
- package/dist/data-table-recipe.layered.css +65 -24
- package/dist/index.cjs +429 -334
- package/dist/index.d.ts +18 -0
- package/dist/index.js +429 -334
- package/dist/styles.css +65 -24
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3251,19 +3251,20 @@ function StatusCell({ value }) {
|
|
|
3251
3251
|
* same "literal color as a computed prop" call `RatingCell`'s star fill already
|
|
3252
3252
|
* makes. Shared by `ChipCell` (Feature A, single value) and `ChipListCell`/
|
|
3253
3253
|
* editors.tsx's `ChipListEditor` (Feature B, multi value) so all three chip
|
|
3254
|
-
* renderings stay byte-identical. */ function SwatchChip({ value, className, children }) {
|
|
3254
|
+
* renderings stay byte-identical. */ function SwatchChip({ value, label, color, className, children }) {
|
|
3255
3255
|
return /*#__PURE__*/ jsxRuntime.jsxs("span", {
|
|
3256
3256
|
className: className,
|
|
3257
3257
|
style: {
|
|
3258
|
-
backgroundColor: swatchColorFor(value),
|
|
3259
|
-
color: swatchInkFor(value)
|
|
3258
|
+
backgroundColor: color ?? swatchColorFor(value),
|
|
3259
|
+
color: color ? CHIP_CUSTOM_COLOR_INK : swatchInkFor(value)
|
|
3260
3260
|
},
|
|
3261
3261
|
children: [
|
|
3262
|
-
value,
|
|
3262
|
+
label ?? value,
|
|
3263
3263
|
children
|
|
3264
3264
|
]
|
|
3265
3265
|
});
|
|
3266
3266
|
}
|
|
3267
|
+
const CHIP_CUSTOM_COLOR_INK = "#1f2937";
|
|
3267
3268
|
/** `type: "chip"` (Feature A, #9) -- a single value rendered as one colored chip,
|
|
3268
3269
|
* the color derived deterministically from the value string (`swatchColorFor`):
|
|
3269
3270
|
* same value, same color, every render, every column. For a column like provider/
|
|
@@ -3276,6 +3277,14 @@ function StatusCell({ value }) {
|
|
|
3276
3277
|
className: className
|
|
3277
3278
|
});
|
|
3278
3279
|
}
|
|
3280
|
+
/** The `label`/`color` a `chipOptions` entry gives `tag`, spread onto its chip so a
|
|
3281
|
+
* tag looks identical in the closed cell and in the editor's option list. */ function optionProps(chipOptions, tag) {
|
|
3282
|
+
const option = chipOptions?.find((entry)=>entry.value === tag);
|
|
3283
|
+
return option ? {
|
|
3284
|
+
label: option.label,
|
|
3285
|
+
color: option.color
|
|
3286
|
+
} : {};
|
|
3287
|
+
}
|
|
3279
3288
|
// Feature B rework (#8) -- the chip-list DISPLAY row's own gap, mirrored from the
|
|
3280
3289
|
// qvism recipe's `chipList` slot (`packages/qvism-preset/src/recipes/data-table.ts`'s
|
|
3281
3290
|
// `CHIP_GAP`, measured live off Attio at 3px between chips). Kept as a literal here
|
|
@@ -3308,7 +3317,7 @@ const CHIP_LIST_GAP_PX = 3;
|
|
|
3308
3317
|
* times, not just while a `ResizeObserver` fires, because widening the column back
|
|
3309
3318
|
* out needs to know the width of chips currently hidden behind "+N" to decide
|
|
3310
3319
|
* whether they now fit again.
|
|
3311
|
-
*/ function ChipListCell({ value, className, chipClassName, overflowClassName }) {
|
|
3320
|
+
*/ function ChipListCell({ value, className, chipClassName, overflowClassName, chipOptions }) {
|
|
3312
3321
|
const tags = Array.isArray(value) ? value.filter((tag)=>!!tag) : [];
|
|
3313
3322
|
const containerRef = React__namespace.useRef(null);
|
|
3314
3323
|
const measureRef = React__namespace.useRef(null);
|
|
@@ -3357,6 +3366,7 @@ const CHIP_LIST_GAP_PX = 3;
|
|
|
3357
3366
|
children: [
|
|
3358
3367
|
tags.slice(0, clampedVisible).map((tag)=>/*#__PURE__*/ jsxRuntime.jsx(SwatchChip, {
|
|
3359
3368
|
value: tag,
|
|
3369
|
+
...optionProps(chipOptions, tag),
|
|
3360
3370
|
className: chipClassName
|
|
3361
3371
|
}, tag)),
|
|
3362
3372
|
overflowCount > 0 && /*#__PURE__*/ jsxRuntime.jsxs("span", {
|
|
@@ -3377,6 +3387,7 @@ const CHIP_LIST_GAP_PX = 3;
|
|
|
3377
3387
|
},
|
|
3378
3388
|
children: tags.map((tag)=>/*#__PURE__*/ jsxRuntime.jsx(SwatchChip, {
|
|
3379
3389
|
value: tag,
|
|
3390
|
+
...optionProps(chipOptions, tag),
|
|
3380
3391
|
className: chipClassName
|
|
3381
3392
|
}, tag))
|
|
3382
3393
|
}),
|
|
@@ -4139,7 +4150,45 @@ const TextFieldTextarea = /*#__PURE__*/ React.forwardRef(({ className, autoresiz
|
|
|
4139
4150
|
});
|
|
4140
4151
|
TextFieldTextarea.displayName = "TextFieldTextarea";
|
|
4141
4152
|
|
|
4142
|
-
__insertCSS(".seed-data-table__root{box-sizing:border-box;position:relative;display:flex;flex-direction:column;width:100%;border-width:1px;border-style:solid;font-family:Inter,-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif}.seed-data-table__table{width:100%;border-collapse:separate;border-spacing:0;table-layout:fixed}.seed-data-table__headerCell{box-sizing:border-box;position:sticky;top:0;z-index:2;vertical-align:middle;text-align:start;padding:0;height:var(--seed-dimension-x10);background-color:var(--seed-color-bg-layer-default);border-top:1px solid var(--seed-color-stroke-neutral-muted);border-bottom:1px solid var(--seed-color-stroke-neutral-muted);border-inline-end:1px solid var(--seed-color-stroke-neutral-muted);border-inline-start:none;color:var(--seed-color-fg-neutral);font-size:var(--seed-font-size-t4);line-height:var(--seed-line-height-t4);font-weight:var(--seed-font-weight-medium);letter-spacing:-.14px}.seed-data-table__headerCell:last-child{border-inline-end:none}.seed-data-table__headerCell[data-sortable]{cursor:pointer;user-select:none}.seed-data-table__headerCell [data-chevron]{opacity:0;transition:opacity .12s}.seed-data-table__headerCell[data-sortable]:hover [data-chevron]{opacity:.6}.seed-data-table__headerCell[data-sorted] [data-chevron]{opacity:1;color:var(--seed-color-fg-neutral)}.seed-data-table__headerCell:hover [data-column-menu]{opacity:1}.seed-data-table__headerCell [data-column-menu]:focus-visible,.seed-data-table__headerCell [data-column-menu][data-open]{opacity:1}.seed-data-table__headerCell[data-dragging]{opacity:.5}.seed-data-table__headerCell[data-sticky]{position:sticky;z-index:3;background-color:var(--seed-color-bg-layer-default)}.seed-data-table__headerCell{outline:var(--seed-dimension-x0_5) solid transparent;outline-offset:calc(var(--seed-dimension-x0_5) * -1)}.seed-data-table__headerCell:is(:focus-visible,[data-focus-visible]){outline:var(--seed-dimension-x0_5) solid var(--seed-color-stroke-focus-ring);outline-offset:calc(var(--seed-dimension-x0_5) * -1)}.seed-data-table__headerCell .seed-data-table-resize-handle{position:absolute;top:0;inset-inline-end:calc(7px / -2);width:7px;height:100%;z-index:4;display:flex;align-items:center;justify-content:center;cursor:col-resize;touch-action:none}.seed-data-table__headerCell .seed-data-table-resize-handle-inner{width:3px;height:100%;border-radius:3px;background-color:#0298d9;opacity:0;transition:opacity .1s}.seed-data-table__headerCell .seed-data-table-resize-handle:hover .seed-data-table-resize-handle-inner,.seed-data-table__headerCell .seed-data-table-resize-handle[data-resizing] .seed-data-table-resize-handle-inner{opacity:1}.seed-data-table__headerCellInner{box-sizing:border-box;display:flex;align-items:center;width:100%;height:100%;min-width:0;gap:var(--seed-dimension-x1_5);padding-inline:var(--seed-dimension-x3)}.seed-data-table__headerCellLabel{min-width:0;flex:1 1 0%;overflow:clip;text-overflow:ellipsis;white-space:nowrap}.seed-data-table__headerCellIcon{flex-shrink:0;margin-inline-start:auto;display:inline-flex;align-items:center;justify-content:center;width:var(--seed-dimension-x4);height:var(--seed-dimension-x4);color:var(--seed-color-fg-neutral-subtle);border:none;background:0 0;padding:0;font:inherit;cursor:pointer}.seed-data-table__headerCellIcon[data-active]{color:var(--seed-color-fg-neutral)}.seed-data-table__headerCellIcon[data-column-menu]{opacity:0;transition:opacity .12s}.seed-data-table__row{position:relative;background-color:var(--seed-color-bg-layer-default);--seed-data-table-row-bg:var(--seed-color-bg-layer-default)}.seed-data-table__row[data-clickable]{cursor:pointer}.seed-data-table__row:is([aria-selected=true],[data-selected]){background-color:color-mix(in srgb,#0298d9 10%,var(--seed-color-bg-layer-default));--seed-data-table-row-bg:color-mix(in srgb, #0298d9 10%, var(--seed-color-bg-layer-default))}.seed-data-table__row:is([aria-selected=true],[data-selected]):is(:hover,[data-hover]){background-color:color-mix(in srgb,var(--seed-color-fg-neutral) 3%,color-mix(in srgb,#0298d9 10%,var(--seed-color-bg-layer-default)));--seed-data-table-row-bg:color-mix(in srgb, var(--seed-color-fg-neutral) 3%, color-mix(in srgb, #0298d9 10%, var(--seed-color-bg-layer-default)))}.seed-data-table__cell{box-sizing:border-box;position:relative;vertical-align:middle;text-align:start;height:var(--seed-dimension-x9);border-bottom:1px solid var(--seed-color-stroke-neutral-muted);border-inline-end:1px solid var(--seed-color-stroke-neutral-muted);border-top:none;border-inline-start:none;padding-block:0;padding-inline:var(--seed-dimension-x3);color:var(--seed-color-fg-neutral);font-size:var(--seed-font-size-t4);line-height:var(--seed-line-height-t4);font-weight:var(--seed-font-weight-regular);letter-spacing:-.14px;overflow:clip;text-overflow:ellipsis;white-space:nowrap}.seed-data-table__cell:not([data-editable]){user-select:none}.seed-data-table__cell:last-child{border-inline-end:none}tbody tr:last-child .seed-data-table__cell{border-bottom:none}.seed-data-table__cell[data-numeric]{text-align:end;font-variant-numeric:tabular-nums}.seed-data-table__cell[data-sticky]{position:sticky;z-index:1;background-color:var(--seed-data-table-row-bg)}.seed-data-table__cell[data-overlay-open]{overflow:visible;z-index:20}.seed-data-table__cell[data-editable]{cursor:default}.seed-data-table__cell .seed-data-table-edit-picker{display:flex;align-items:center;gap:var(--seed-dimension-x1_5);min-width:0}.seed-data-table__cell .seed-data-table-edit-pending{flex-shrink:0;color:var(--seed-color-fg-neutral-subtle);animation:rotate .6s linear infinite}.seed-data-table__cell .seed-data-table-edit-error{position:absolute;top:100%;inset-inline-start:var(--seed-dimension-x3);inset-inline-end:var(--seed-dimension-x3);z-index:2;padding-top:2px;font-size:12px;line-height:1.3;color:var(--seed-color-fg-critical);overflow:clip;text-overflow:ellipsis;white-space:nowrap}.seed-data-table__entity{display:flex;align-items:center;min-width:0;gap:var(--seed-dimension-x1_5)}.seed-data-table__entityName{min-width:0;font-weight:var(--seed-font-weight-medium);overflow:clip;text-overflow:ellipsis;white-space:nowrap}.seed-data-table__entityName[data-clickable]{cursor:pointer;border:none;background:0 0;padding:0;margin:0;font-family:inherit;font-size:inherit;line-height:inherit;color:inherit;text-align:start}.seed-data-table__entityName[data-clickable]:is(:hover,[data-hover]){text-decoration:underline}.seed-data-table__tagList{display:flex;align-items:center;gap:var(--seed-dimension-x1_5);overflow:hidden;min-width:0}.seed-data-table__entityActions{display:flex;align-items:center;gap:6px;margin-inline-start:auto;flex-shrink:0;opacity:0;transition:opacity .15s}tr:hover .seed-data-table__entityActions{opacity:1}.seed-data-table__entityActions:focus-within{opacity:1}.seed-data-table__entityAction{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;margin:0;padding:2px;border:none;border-radius:6px;background:0 0;font-family:inherit;color:color-mix(in srgb,var(--seed-color-fg-neutral) 55%,transparent);cursor:pointer;flex-shrink:0;transition:background-color .2s,color .2s,box-shadow .2s}.seed-data-table__entityAction:hover{background:color-mix(in srgb,var(--seed-color-fg-neutral) 4%,transparent);color:var(--seed-color-fg-neutral)}.seed-data-table__link{color:var(--seed-color-fg-neutral);text-decoration:none;min-width:0;overflow:clip;text-overflow:ellipsis;white-space:nowrap}.seed-data-table__link:is(:hover,[data-hover]){text-decoration:underline}.seed-data-table__chip{box-sizing:border-box;display:inline-flex;align-items:center;flex-shrink:0;max-width:100%;height:22px;padding:0 4px;border-radius:7px;font-size:13px;font-weight:var(--seed-font-weight-medium);line-height:15px;overflow:clip;text-overflow:ellipsis;white-space:nowrap}.seed-data-table__chipList{position:relative;display:flex;align-items:center;flex-wrap:nowrap;gap:3px;overflow:hidden;min-width:0;width:100%}.seed-data-table__chipOverflow{box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;height:20px;padding:0 4px;border-radius:6px;background-color:#f6f7f7;color:#000;font-size:10px;font-weight:var(--seed-font-weight-regular);line-height:15px;white-space:nowrap}.seed-data-table__chipListEditor{display:flex;align-items:center;flex-wrap:wrap;gap:3px;min-width:0;width:100%}.seed-data-table__chipRemove{box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:12px;height:12px;margin:0;margin-inline-start:2px;padding:0;border:none;border-radius:999px;background:0 0;color:inherit;opacity:.6;cursor:pointer;transition:opacity .12s,background-color .12s}.seed-data-table__chipRemove:hover{opacity:1;background-color:rgba(0,0,0,.08)}.seed-data-table__chipInput{flex:1 1 auto;min-width:40px;height:22px;margin:0;padding:0;border:none;outline:0;background:0 0;font-family:inherit;font-size:var(--seed-font-size-t4);color:var(--seed-color-fg-neutral);letter-spacing:-.14px}.seed-data-table__expandOverlay{box-sizing:border-box;position:absolute;top:-1px;inset-inline-start:-1px;inset-inline-end:-1px;z-index:10;min-height:calc(100% + 2px);display:flex;align-items:flex-start;padding-inline:var(--seed-dimension-x3);padding-block:var(--seed-dimension-x3);background-color:var(--seed-color-bg-layer-floating);border-radius:4px;box-shadow:none;border:1px solid #266df0;color:var(--seed-color-fg-neutral);font-size:var(--seed-font-size-t4);line-height:var(--seed-line-height-t4);letter-spacing:-.14px;cursor:default}.seed-data-table__expandOverlayText{width:100%;min-width:0;white-space:normal;word-break:break-word}.seed-data-table__cellSuffixRow{display:flex;align-items:center;gap:4px;min-width:0;width:100%}.seed-data-table__cellSuffixText{flex:1 1 0%;min-width:0;overflow:clip;text-overflow:ellipsis;white-space:nowrap}.seed-data-table__cellSuffixIcon{flex-shrink:0;display:inline-flex;align-items:center;color:color-mix(in srgb,var(--seed-color-fg-neutral) 55%,transparent)}.seed-data-table__toolbar{box-sizing:border-box;display:flex;align-items:center;width:100%;flex-shrink:0;min-height:49px;gap:var(--seed-dimension-x2);padding-inline:var(--seed-dimension-x3);border-top:1px solid var(--seed-color-stroke-neutral-muted)}.seed-data-table__search{position:relative;display:inline-flex;align-items:center;flex:1 1 0%;max-width:280px}.seed-data-table__search svg{position:absolute;inset-inline-start:var(--seed-dimension-x2);width:var(--seed-dimension-x4);height:var(--seed-dimension-x4);color:var(--seed-color-fg-neutral-muted);pointer-events:none}.seed-data-table__search input{width:100%;height:var(--seed-dimension-x8);padding-inline-start:var(--seed-dimension-x7);padding-inline-end:var(--seed-dimension-x2);border:none;border-radius:var(--seed-radius-r2);background-color:var(--seed-color-bg-layer-default);box-shadow:inset 0 0 0 1px var(--seed-color-stroke-neutral-weak);font-family:inherit;font-size:var(--seed-font-size-t4);color:var(--seed-color-fg-neutral);outline:0;transition:box-shadow .1s var(--seed-timing-function-easing)}.seed-data-table__search input::placeholder{color:var(--seed-color-fg-neutral-subtle)}.seed-data-table__search input:focus{box-shadow:inset 0 0 0 2px var(--seed-color-stroke-neutral-contrast)}.seed-data-table__count{flex-shrink:0;color:var(--seed-color-fg-neutral-subtle);font-size:var(--seed-font-size-t3);font-variant-numeric:tabular-nums}.seed-data-table__toolbarEnd{flex-shrink:0;margin-inline-start:auto;display:inline-flex;align-items:center;gap:var(--seed-dimension-x2)}.seed-data-table__scrollArea{position:relative;display:flex;flex-direction:column;width:100%;min-width:0;flex:1 1 auto;min-height:0;overflow-x:auto;overflow-y:auto}.seed-data-table__scrollArea[data-scrolled-start] [data-sticky-edge]{clip-path:inset(0 -38px 0 0);box-shadow:6px 0 16px 4px rgba(0,0,0,.12)}.seed-data-table__scrollArea[data-scrolled-end] [data-sticky-edge-end]{clip-path:inset(0 0 0 -38px);box-shadow:-6px 0 16px 4px rgba(0,0,0,.12)}.seed-data-table__footerCell{box-sizing:border-box;position:sticky;bottom:0;z-index:2;vertical-align:middle;padding:0;height:var(--seed-dimension-x9);background-color:var(--seed-color-bg-layer-default);border-top:1px solid var(--seed-color-stroke-neutral-muted);border-inline-end:1px solid var(--seed-color-stroke-neutral-muted);border-inline-start:none}.seed-data-table__footerCell:last-child{border-inline-end:none}.seed-data-table__footerCell[data-sticky]{z-index:3}.seed-data-table__footerCell .seed-data-table-column-calc-trigger{display:flex;align-items:center;gap:var(--seed-dimension-x1_5);width:100%;height:100%;min-width:0;margin:0;padding:0 var(--seed-dimension-x3);border:none;background:0 0;color:var(--seed-color-fg-neutral-subtle);font-family:inherit;font-size:var(--seed-font-size-t4);font-weight:var(--seed-font-weight-medium);white-space:nowrap;overflow:clip;cursor:pointer;transition:background-color .12s,color .12s}.seed-data-table__footerCell .seed-data-table-column-calc-trigger:hover{background-color:color-mix(in srgb,var(--seed-color-fg-neutral) 4%,transparent);color:var(--seed-color-fg-neutral)}.seed-data-table__footerCell .seed-data-table-column-calc-trigger[data-align=right]{justify-content:flex-end}.seed-data-table__footerCell .seed-data-table-column-calc-trigger svg{flex-shrink:0;opacity:.7}.seed-data-table__footerCell .seed-data-table-column-calc-placeholder{overflow:clip;text-overflow:ellipsis;white-space:nowrap}.seed-data-table__footerCell .seed-data-table-column-calc-value{min-width:0;flex-shrink:1;color:var(--seed-color-fg-neutral);font-variant-numeric:tabular-nums;overflow:clip;text-overflow:ellipsis;white-space:nowrap}.seed-data-table__footerCell .seed-data-table-column-calc-op{min-width:0;flex-shrink:1;color:color-mix(in srgb,var(--seed-color-fg-neutral) 63%,transparent);overflow:clip;text-overflow:ellipsis;white-space:nowrap}.seed-data-table__emptyState{box-sizing:border-box;text-align:center;padding-block:var(--seed-dimension-x8);padding-inline:var(--seed-dimension-x3);color:var(--seed-color-fg-neutral-subtle);font-size:var(--seed-font-size-t4)}.seed-data-table__loadingState{box-sizing:border-box;display:flex;align-items:center;justify-content:center;gap:10px;padding-block:var(--seed-dimension-x8);padding-inline:var(--seed-dimension-x3);color:color-mix(in srgb,var(--seed-color-fg-neutral) 63%,transparent);font-size:var(--seed-font-size-t4);line-height:var(--seed-line-height-t4);font-weight:var(--seed-font-weight-medium)}.seed-data-table__loadingState[data-inline]{padding-block:0;padding-inline:0;height:var(--seed-dimension-x9)}.seed-data-table__loadingState .seed-data-table-loading-spinner{flex-shrink:0;color:color-mix(in srgb,var(--seed-color-fg-neutral) 63%,transparent);animation:rotate .6s linear infinite}.seed-data-table__addRowCell{box-sizing:border-box;padding:0;border-top:none}.seed-data-table__addRow{box-sizing:border-box;display:flex;align-items:center;width:100%;margin:0;border:none;border-top:1px solid var(--seed-color-stroke-neutral-muted);background-color:var(--seed-color-bg-layer-default);height:var(--seed-dimension-x9);gap:var(--seed-dimension-x2);padding-inline:var(--seed-dimension-x2);color:var(--seed-color-fg-neutral-subtle);font-family:inherit;font-size:var(--seed-font-size-t4);cursor:pointer;transition:background-color .12s,color .12s}.seed-data-table__addRow:hover{background-color:color-mix(in srgb,var(--seed-color-fg-neutral) 4%,var(--seed-color-bg-layer-default));color:var(--seed-color-fg-neutral)}.seed-data-table__addRow svg{flex-shrink:0}.seed-data-table__selectionCell{text-align:center;padding:0}.seed-data-table__bulkBar{box-sizing:border-box;position:absolute;inset-inline-start:50%;transform:translateX(-50%);bottom:var(--seed-dimension-x4);z-index:30;display:flex;align-items:center;gap:var(--seed-dimension-x3);min-height:36px;padding-inline:var(--seed-dimension-x3_5);padding-block:var(--seed-dimension-x2);border-radius:var(--seed-radius-full);box-shadow:var(--seed-shadow-s3);background-color:var(--seed-color-bg-layer-floating);color:var(--seed-color-fg-neutral);font-family:inherit;font-size:var(--seed-font-size-t4);font-weight:var(--seed-font-weight-medium);white-space:nowrap}.seed-data-table__bulkBar[data-above-footer]{bottom:calc(var(--seed-dimension-x4) + var(--seed-dimension-x9))}.seed-data-table__bulkBarCount{flex-shrink:0;color:var(--seed-color-fg-neutral);font-variant-numeric:tabular-nums}.seed-data-table__bulkBarClear{box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:20px;height:20px;margin:0;padding:2px;border:none;border-radius:6px;background:0 0;font-family:inherit;color:color-mix(in srgb,var(--seed-color-fg-neutral) 55%,transparent);cursor:pointer;transition:background-color .2s,color .2s}.seed-data-table__bulkBarClear:hover{background-color:color-mix(in srgb,var(--seed-color-fg-neutral) 8%,transparent);color:var(--seed-color-fg-neutral)}.seed-data-table__bulkBarActions{display:flex;align-items:center;flex-shrink:0;gap:var(--seed-dimension-x3);padding-inline-start:var(--seed-dimension-x3);border-inline-start:1px solid color-mix(in srgb,var(--seed-color-fg-neutral) 16%,transparent)}.seed-data-table__root--surface_card{border-color:var(--seed-color-stroke-neutral-muted);background-color:var(--seed-color-bg-layer-default);border-radius:var(--seed-radius-r3)}.seed-data-table__root--surface_bleed{border-color:var(--seed-color-bg-transparent);background-color:var(--seed-color-bg-transparent)}.seed-data-table__row--interactive_true{transition:background-color .12s}.seed-data-table__row--interactive_true:is(:hover,[data-hover]){background-color:color-mix(in srgb,var(--seed-color-fg-neutral) 3%,transparent);--seed-data-table-row-bg:color-mix(in srgb, var(--seed-color-fg-neutral) 3%, var(--seed-color-bg-layer-default))}");
|
|
4153
|
+
// Row-narrowing for the toolbar's search box -- split out of DataTable.tsx the way
|
|
4154
|
+
// cells.tsx splits out cell-type rendering: a self-contained, independently testable
|
|
4155
|
+
// concern DataTable.tsx just calls, rather than inline `.filter()` calls piling up in
|
|
4156
|
+
// the same component that also owns markup. The toolbar's typed Filter CONDITIONS
|
|
4157
|
+
// (field/operator/value chips, DATATABLE-ATTIO-SPEC.md's Attio/crisp model) live in
|
|
4158
|
+
// `toolbar-conditions.tsx` instead, alongside the Sort/Filter chrome that manages
|
|
4159
|
+
// them -- this file is search only now; the old per-column "is/is not" picker
|
|
4160
|
+
// (`matchesFilter`/`DataTableFilterState`) is gone, replaced by that toolbar model.
|
|
4161
|
+
/**
|
|
4162
|
+
* A column's `value(row)` if it supplies one, else the raw field at `column.key` --
|
|
4163
|
+
* the single accessor sort/search/filter/export all read through
|
|
4164
|
+
* (DATATABLE-ATTIO-SPEC.md's Column API), so a consumer only teaches the table how to
|
|
4165
|
+
* read a value ONCE rather than once per feature.
|
|
4166
|
+
*/ function getColumnValue(column, row) {
|
|
4167
|
+
return column.value ? column.value(row) : row[column.key];
|
|
4168
|
+
}
|
|
4169
|
+
/**
|
|
4170
|
+
* Case-insensitive substring match against a row's stringified value -- crisp's own
|
|
4171
|
+
* `applyFilters` "contains" semantics (`tabletoolbar.tsx`), reused here for the
|
|
4172
|
+
* toolbar's single free-text query. `null`/`undefined` never match a non-empty query --
|
|
4173
|
+
* there is no text to search.
|
|
4174
|
+
*/ function matchesSearch(value, query) {
|
|
4175
|
+
if (!query) return true;
|
|
4176
|
+
if (value == null) return false;
|
|
4177
|
+
return String(value).toLowerCase().includes(query.toLowerCase());
|
|
4178
|
+
}
|
|
4179
|
+
/**
|
|
4180
|
+
* The toolbar's search query -- an OR across `searchable` columns, matching GRC's own
|
|
4181
|
+
* `useFilteredRows`. The toolbar's own typed Filter conditions apply SEPARATELY, as a
|
|
4182
|
+
* second pass over this function's result (`toolbar-conditions.tsx`'s
|
|
4183
|
+
* `applyToolbarFilters`, called by `DataTable.tsx` right after this) -- narrowing what
|
|
4184
|
+
* the search box already found, not the other way round.
|
|
4185
|
+
*/ function getVisibleRows(data, columns, query) {
|
|
4186
|
+
const searchableColumns = columns.filter((column)=>column.searchable);
|
|
4187
|
+
if (!query) return data;
|
|
4188
|
+
return data.filter((row)=>searchableColumns.some((column)=>matchesSearch(getColumnValue(column, row), query)));
|
|
4189
|
+
}
|
|
4190
|
+
|
|
4191
|
+
__insertCSS(".seed-data-table__root{box-sizing:border-box;position:relative;display:flex;flex-direction:column;width:100%;border-width:1px;border-style:solid;font-family:Inter,-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif}.seed-data-table__table{width:100%;border-collapse:separate;border-spacing:0;table-layout:fixed}.seed-data-table__headerCell{box-sizing:border-box;position:sticky;top:0;z-index:2;vertical-align:middle;text-align:start;padding:0;height:var(--seed-dimension-x10);background-color:var(--seed-color-bg-layer-default);border-top:1px solid var(--seed-color-stroke-neutral-muted);border-bottom:1px solid var(--seed-color-stroke-neutral-muted);border-inline-end:1px solid var(--seed-color-stroke-neutral-muted);border-inline-start:none;color:var(--seed-color-fg-neutral);font-size:var(--seed-font-size-t4);line-height:var(--seed-line-height-t4);font-weight:var(--seed-font-weight-medium);letter-spacing:-.14px}.seed-data-table__headerCell:last-child{border-inline-end:none}.seed-data-table__headerCell[data-sortable]{cursor:pointer;user-select:none}.seed-data-table__headerCell [data-chevron]{opacity:0;transition:opacity .12s}.seed-data-table__headerCell[data-sortable]:hover [data-chevron]{opacity:.6}.seed-data-table__headerCell[data-sorted] [data-chevron]{opacity:1;color:var(--seed-color-fg-neutral)}.seed-data-table__headerCell:hover [data-column-menu]{opacity:1}.seed-data-table__headerCell [data-column-menu]:focus-visible,.seed-data-table__headerCell [data-column-menu][data-open]{opacity:1}.seed-data-table__headerCell[data-dragging]{opacity:.5}.seed-data-table__headerCell[data-sticky]{position:sticky;z-index:3;background-color:var(--seed-color-bg-layer-default)}.seed-data-table__headerCell{outline:var(--seed-dimension-x0_5) solid transparent;outline-offset:calc(var(--seed-dimension-x0_5) * -1)}.seed-data-table__headerCell:is(:focus-visible,[data-focus-visible]){outline:var(--seed-dimension-x0_5) solid var(--seed-color-stroke-focus-ring);outline-offset:calc(var(--seed-dimension-x0_5) * -1)}.seed-data-table__headerCell .seed-data-table-resize-handle{position:absolute;top:0;inset-inline-end:calc(7px / -2);width:7px;height:100%;z-index:4;display:flex;align-items:center;justify-content:center;cursor:col-resize;touch-action:none}.seed-data-table__headerCell .seed-data-table-resize-handle-inner{width:3px;height:100%;border-radius:3px;background-color:#0298d9;opacity:0;transition:opacity .1s}.seed-data-table__headerCell .seed-data-table-resize-handle:hover .seed-data-table-resize-handle-inner,.seed-data-table__headerCell .seed-data-table-resize-handle[data-resizing] .seed-data-table-resize-handle-inner{opacity:1}.seed-data-table__headerCellInner{box-sizing:border-box;display:flex;align-items:center;width:100%;height:100%;min-width:0;gap:var(--seed-dimension-x1_5);padding-inline:var(--seed-dimension-x3)}.seed-data-table__headerCellLabel{min-width:0;flex:1 1 0%;overflow:clip;text-overflow:ellipsis;white-space:nowrap}.seed-data-table__headerCellIcon{flex-shrink:0;margin-inline-start:auto;display:inline-flex;align-items:center;justify-content:center;width:var(--seed-dimension-x4);height:var(--seed-dimension-x4);color:var(--seed-color-fg-neutral-subtle);border:none;background:0 0;padding:0;font:inherit;cursor:pointer}.seed-data-table__headerCellIcon[data-active]{color:var(--seed-color-fg-neutral)}.seed-data-table__headerCellIcon[data-column-menu]{opacity:0;transition:opacity .12s}.seed-data-table__row{position:relative;background-color:var(--seed-color-bg-layer-default);--seed-data-table-row-bg:var(--seed-color-bg-layer-default)}.seed-data-table__row[data-clickable]{cursor:pointer}.seed-data-table__row:is([aria-selected=true],[data-selected]){background-color:color-mix(in srgb,#0298d9 10%,var(--seed-color-bg-layer-default));--seed-data-table-row-bg:color-mix(in srgb, #0298d9 10%, var(--seed-color-bg-layer-default))}.seed-data-table__row:is([aria-selected=true],[data-selected]):is(:hover,[data-hover]){background-color:color-mix(in srgb,var(--seed-color-fg-neutral) 3%,color-mix(in srgb,#0298d9 10%,var(--seed-color-bg-layer-default)));--seed-data-table-row-bg:color-mix(in srgb, var(--seed-color-fg-neutral) 3%, color-mix(in srgb, #0298d9 10%, var(--seed-color-bg-layer-default)))}.seed-data-table__cell{box-sizing:border-box;position:relative;vertical-align:middle;text-align:start;height:var(--seed-dimension-x9);border-bottom:1px solid var(--seed-color-stroke-neutral-muted);border-inline-end:1px solid var(--seed-color-stroke-neutral-muted);border-top:none;border-inline-start:none;padding-block:0;padding-inline:var(--seed-dimension-x3);color:var(--seed-color-fg-neutral);font-size:var(--seed-font-size-t4);line-height:var(--seed-line-height-t4);font-weight:var(--seed-font-weight-regular);letter-spacing:-.14px;overflow:clip;text-overflow:ellipsis;white-space:nowrap}.seed-data-table__cell:not([data-editable]){user-select:none}.seed-data-table__cell:last-child{border-inline-end:none}tbody tr:last-child .seed-data-table__cell{border-bottom:none}.seed-data-table__cell[data-numeric]{text-align:end;font-variant-numeric:tabular-nums}.seed-data-table__cell[data-sticky]{position:sticky;z-index:1;background-color:var(--seed-data-table-row-bg)}.seed-data-table__cell[data-overlay-open]{overflow:visible;z-index:20}.seed-data-table__cell[data-editable]{cursor:default}.seed-data-table__cell .seed-data-table-edit-picker{display:flex;align-items:center;gap:var(--seed-dimension-x1_5);min-width:0}.seed-data-table__cell .seed-data-table-edit-pending{flex-shrink:0;color:var(--seed-color-fg-neutral-subtle);animation:rotate .6s linear infinite}.seed-data-table__cell .seed-data-table-edit-error{position:absolute;top:100%;inset-inline-start:var(--seed-dimension-x3);inset-inline-end:var(--seed-dimension-x3);z-index:2;padding-top:2px;font-size:12px;line-height:1.3;color:var(--seed-color-fg-critical);overflow:clip;text-overflow:ellipsis;white-space:nowrap}.seed-data-table__entity{display:flex;align-items:center;min-width:0;gap:var(--seed-dimension-x1_5)}.seed-data-table__entityName{min-width:0;font-weight:var(--seed-font-weight-medium);overflow:clip;text-overflow:ellipsis;white-space:nowrap}.seed-data-table__entityName[data-clickable]{cursor:pointer;border:none;background:0 0;padding:0;margin:0;font-family:inherit;font-size:inherit;line-height:inherit;color:inherit;text-align:start}.seed-data-table__entityName[data-clickable]:is(:hover,[data-hover]){text-decoration:underline}.seed-data-table__tagList{display:flex;align-items:center;gap:var(--seed-dimension-x1_5);overflow:hidden;min-width:0}.seed-data-table__entityActions{display:flex;align-items:center;gap:6px;margin-inline-start:auto;flex-shrink:0;opacity:0;transition:opacity .15s}tr:hover .seed-data-table__entityActions{opacity:1}.seed-data-table__entityActions:focus-within{opacity:1}.seed-data-table__entityAction{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;margin:0;padding:2px;border:none;border-radius:6px;background:0 0;font-family:inherit;color:color-mix(in srgb,var(--seed-color-fg-neutral) 55%,transparent);cursor:pointer;flex-shrink:0;transition:background-color .2s,color .2s,box-shadow .2s}.seed-data-table__entityAction:hover{background:color-mix(in srgb,var(--seed-color-fg-neutral) 4%,transparent);color:var(--seed-color-fg-neutral)}.seed-data-table__link{color:var(--seed-color-fg-neutral);text-decoration:none;min-width:0;overflow:clip;text-overflow:ellipsis;white-space:nowrap}.seed-data-table__link:is(:hover,[data-hover]){text-decoration:underline}.seed-data-table__chip{box-sizing:border-box;display:inline-flex;align-items:center;flex-shrink:0;max-width:100%;height:22px;padding:0 4px;border-radius:7px;font-size:13px;font-weight:var(--seed-font-weight-medium);line-height:15px;overflow:clip;text-overflow:ellipsis;white-space:nowrap}.seed-data-table__chipList{position:relative;display:flex;align-items:center;flex-wrap:nowrap;gap:3px;overflow:hidden;min-width:0;width:100%}.seed-data-table__chipOverflow{box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;height:20px;padding:0 4px;border-radius:6px;background-color:#f6f7f7;color:#000;font-size:10px;font-weight:var(--seed-font-weight-regular);line-height:15px;white-space:nowrap}.seed-data-table__chipPicker{display:flex;flex-direction:column;width:100%;min-width:0}.seed-data-table__chipPickerList{display:flex;flex-direction:column;max-height:240px;overflow-y:auto;padding:0 4px 4px}.seed-data-table__chipPickerRow{box-sizing:border-box;display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;min-height:32px;margin:0;padding:4px 8px;border:none;border-radius:6px;background:0 0;font:inherit;color:inherit;text-align:start;cursor:pointer}.seed-data-table__chipPickerRow:hover{background-color:#f6f7f7}.seed-data-table__chipPickerRow:disabled{cursor:default;opacity:.6}.seed-data-table__chipPickerBox{box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:16px;height:16px;border-radius:4px;border:1px solid rgba(0,0,0,.25);background-color:#fff;color:#fff}.seed-data-table__chipPickerBox[data-checked]{border-color:#266df0;background-color:#266df0}.seed-data-table__chipPickerBox svg{width:12px;height:12px}.seed-data-table__chipPickerCreate{box-sizing:border-box;display:flex;align-items:center;gap:6px;width:100%;min-height:32px;margin:0;padding:4px 8px;border:none;border-radius:6px;background:0 0;font:inherit;font-size:var(--seed-font-size-t4);color:var(--seed-color-fg-neutral);text-align:start;cursor:pointer}.seed-data-table__chipPickerCreate:hover{background-color:#f6f7f7}.seed-data-table__expandOverlay{box-sizing:border-box;position:absolute;top:-1px;inset-inline-start:-1px;inset-inline-end:-1px;z-index:10;min-height:calc(100% + 2px);display:flex;align-items:flex-start;padding-inline:var(--seed-dimension-x3);padding-block:var(--seed-dimension-x3);background-color:var(--seed-color-bg-layer-floating);border-radius:4px;box-shadow:none;border:1px solid #266df0;color:var(--seed-color-fg-neutral);font-size:var(--seed-font-size-t4);line-height:var(--seed-line-height-t4);letter-spacing:-.14px;cursor:default}.seed-data-table__expandOverlayText{width:100%;min-width:0;white-space:normal;word-break:break-word}.seed-data-table__cellSuffixRow{display:flex;align-items:center;gap:4px;min-width:0;width:100%}.seed-data-table__cellSuffixText{flex:1 1 0%;min-width:0;overflow:clip;text-overflow:ellipsis;white-space:nowrap}.seed-data-table__cellSuffixIcon{flex-shrink:0;display:inline-flex;align-items:center;color:color-mix(in srgb,var(--seed-color-fg-neutral) 55%,transparent)}.seed-data-table__toolbar{box-sizing:border-box;display:flex;align-items:center;width:100%;flex-shrink:0;min-height:49px;gap:var(--seed-dimension-x2);padding-inline:var(--seed-dimension-x3);border-top:1px solid var(--seed-color-stroke-neutral-muted)}.seed-data-table__search{position:relative;display:inline-flex;align-items:center;flex:1 1 0%;max-width:280px}.seed-data-table__search svg{position:absolute;inset-inline-start:var(--seed-dimension-x2);width:var(--seed-dimension-x4);height:var(--seed-dimension-x4);color:var(--seed-color-fg-neutral-muted);pointer-events:none}.seed-data-table__search input{width:100%;height:var(--seed-dimension-x8);padding-inline-start:var(--seed-dimension-x7);padding-inline-end:var(--seed-dimension-x2);border:none;border-radius:var(--seed-radius-r2);background-color:var(--seed-color-bg-layer-default);box-shadow:inset 0 0 0 1px var(--seed-color-stroke-neutral-weak);font-family:inherit;font-size:var(--seed-font-size-t4);color:var(--seed-color-fg-neutral);outline:0;transition:box-shadow .1s var(--seed-timing-function-easing)}.seed-data-table__search input::placeholder{color:var(--seed-color-fg-neutral-subtle)}.seed-data-table__search input:focus{box-shadow:inset 0 0 0 2px var(--seed-color-stroke-neutral-contrast)}.seed-data-table__count{flex-shrink:0;color:var(--seed-color-fg-neutral-subtle);font-size:var(--seed-font-size-t3);font-variant-numeric:tabular-nums}.seed-data-table__toolbarEnd{flex-shrink:0;margin-inline-start:auto;display:inline-flex;align-items:center;gap:var(--seed-dimension-x2)}.seed-data-table__scrollArea{position:relative;display:flex;flex-direction:column;width:100%;min-width:0;flex:1 1 auto;min-height:0;overflow-x:auto;overflow-y:auto}.seed-data-table__scrollArea[data-scrolled-start] [data-sticky-edge]{clip-path:inset(0 -38px 0 0);box-shadow:6px 0 16px 4px rgba(0,0,0,.12)}.seed-data-table__scrollArea[data-scrolled-end] [data-sticky-edge-end]{clip-path:inset(0 0 0 -38px);box-shadow:-6px 0 16px 4px rgba(0,0,0,.12)}.seed-data-table__footerCell{box-sizing:border-box;position:sticky;bottom:0;z-index:2;vertical-align:middle;padding:0;height:var(--seed-dimension-x9);background-color:var(--seed-color-bg-layer-default);border-top:1px solid var(--seed-color-stroke-neutral-muted);border-inline-end:1px solid var(--seed-color-stroke-neutral-muted);border-inline-start:none}.seed-data-table__footerCell:last-child{border-inline-end:none}.seed-data-table__footerCell[data-sticky]{z-index:3}.seed-data-table__footerCell .seed-data-table-column-calc-trigger{display:flex;align-items:center;gap:var(--seed-dimension-x1_5);width:100%;height:100%;min-width:0;margin:0;padding:0 var(--seed-dimension-x3);border:none;background:0 0;color:var(--seed-color-fg-neutral-subtle);font-family:inherit;font-size:var(--seed-font-size-t4);font-weight:var(--seed-font-weight-medium);white-space:nowrap;overflow:clip;cursor:pointer;transition:background-color .12s,color .12s}.seed-data-table__footerCell .seed-data-table-column-calc-trigger:hover{background-color:color-mix(in srgb,var(--seed-color-fg-neutral) 4%,transparent);color:var(--seed-color-fg-neutral)}.seed-data-table__footerCell .seed-data-table-column-calc-trigger[data-align=right]{justify-content:flex-end}.seed-data-table__footerCell .seed-data-table-column-calc-trigger svg{flex-shrink:0;opacity:.7}.seed-data-table__footerCell .seed-data-table-column-calc-placeholder{overflow:clip;text-overflow:ellipsis;white-space:nowrap}.seed-data-table__footerCell .seed-data-table-column-calc-value{min-width:0;flex-shrink:1;color:var(--seed-color-fg-neutral);font-variant-numeric:tabular-nums;overflow:clip;text-overflow:ellipsis;white-space:nowrap}.seed-data-table__footerCell .seed-data-table-column-calc-op{min-width:0;flex-shrink:1;color:color-mix(in srgb,var(--seed-color-fg-neutral) 63%,transparent);overflow:clip;text-overflow:ellipsis;white-space:nowrap}.seed-data-table__emptyState{box-sizing:border-box;text-align:center;padding-block:var(--seed-dimension-x8);padding-inline:var(--seed-dimension-x3);color:var(--seed-color-fg-neutral-subtle);font-size:var(--seed-font-size-t4)}.seed-data-table__loadingState{box-sizing:border-box;display:flex;align-items:center;justify-content:center;gap:10px;padding-block:var(--seed-dimension-x8);padding-inline:var(--seed-dimension-x3);color:color-mix(in srgb,var(--seed-color-fg-neutral) 63%,transparent);font-size:var(--seed-font-size-t4);line-height:var(--seed-line-height-t4);font-weight:var(--seed-font-weight-medium)}.seed-data-table__loadingState[data-inline]{padding-block:0;padding-inline:0;height:var(--seed-dimension-x9)}.seed-data-table__loadingState .seed-data-table-loading-spinner{flex-shrink:0;color:color-mix(in srgb,var(--seed-color-fg-neutral) 63%,transparent);animation:rotate .6s linear infinite}.seed-data-table__addRowCell{box-sizing:border-box;padding:0;border-top:none}.seed-data-table__addRow{box-sizing:border-box;display:flex;align-items:center;width:100%;margin:0;border:none;border-top:1px solid var(--seed-color-stroke-neutral-muted);background-color:var(--seed-color-bg-layer-default);height:var(--seed-dimension-x9);gap:var(--seed-dimension-x2);padding-inline:var(--seed-dimension-x2);color:var(--seed-color-fg-neutral-subtle);font-family:inherit;font-size:var(--seed-font-size-t4);cursor:pointer;transition:background-color .12s,color .12s}.seed-data-table__addRow:hover{background-color:color-mix(in srgb,var(--seed-color-fg-neutral) 4%,var(--seed-color-bg-layer-default));color:var(--seed-color-fg-neutral)}.seed-data-table__addRow svg{flex-shrink:0}.seed-data-table__selectionCell{text-align:center;padding:0}.seed-data-table__bulkBar{box-sizing:border-box;position:absolute;inset-inline-start:50%;transform:translateX(-50%);bottom:var(--seed-dimension-x4);z-index:30;display:flex;align-items:center;gap:var(--seed-dimension-x3);min-height:36px;padding-inline:var(--seed-dimension-x3_5);padding-block:var(--seed-dimension-x2);border-radius:var(--seed-radius-full);box-shadow:var(--seed-shadow-s3);background-color:var(--seed-color-bg-layer-floating);color:var(--seed-color-fg-neutral);font-family:inherit;font-size:var(--seed-font-size-t4);font-weight:var(--seed-font-weight-medium);white-space:nowrap}.seed-data-table__bulkBar[data-above-footer]{bottom:calc(var(--seed-dimension-x4) + var(--seed-dimension-x9))}.seed-data-table__bulkBarCount{flex-shrink:0;color:var(--seed-color-fg-neutral);font-variant-numeric:tabular-nums}.seed-data-table__bulkBarClear{box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:20px;height:20px;margin:0;padding:2px;border:none;border-radius:6px;background:0 0;font-family:inherit;color:color-mix(in srgb,var(--seed-color-fg-neutral) 55%,transparent);cursor:pointer;transition:background-color .2s,color .2s}.seed-data-table__bulkBarClear:hover{background-color:color-mix(in srgb,var(--seed-color-fg-neutral) 8%,transparent);color:var(--seed-color-fg-neutral)}.seed-data-table__bulkBarActions{display:flex;align-items:center;flex-shrink:0;gap:var(--seed-dimension-x3);padding-inline-start:var(--seed-dimension-x3);border-inline-start:1px solid color-mix(in srgb,var(--seed-color-fg-neutral) 16%,transparent)}.seed-data-table__root--surface_card{border-color:var(--seed-color-stroke-neutral-muted);background-color:var(--seed-color-bg-layer-default);border-radius:var(--seed-radius-r3)}.seed-data-table__root--surface_bleed{border-color:var(--seed-color-bg-transparent);background-color:var(--seed-color-bg-transparent)}.seed-data-table__row--interactive_true{transition:background-color .12s}.seed-data-table__row--interactive_true:is(:hover,[data-hover]){background-color:color-mix(in srgb,var(--seed-color-fg-neutral) 3%,transparent);--seed-data-table-row-bg:color-mix(in srgb, var(--seed-color-fg-neutral) 3%, var(--seed-color-bg-layer-default))}");
|
|
4143
4192
|
|
|
4144
4193
|
const createClassName = (className, variants, compoundVariants = [])=>{
|
|
4145
4194
|
const variantKeys = Object.keys(variants);
|
|
@@ -4247,16 +4296,24 @@ const dataTableSlotNames = [
|
|
|
4247
4296
|
"seed-data-table__chipOverflow"
|
|
4248
4297
|
],
|
|
4249
4298
|
[
|
|
4250
|
-
"
|
|
4251
|
-
"seed-data-
|
|
4299
|
+
"chipPicker",
|
|
4300
|
+
"seed-data-table__chipPicker"
|
|
4301
|
+
],
|
|
4302
|
+
[
|
|
4303
|
+
"chipPickerList",
|
|
4304
|
+
"seed-data-table__chipPickerList"
|
|
4305
|
+
],
|
|
4306
|
+
[
|
|
4307
|
+
"chipPickerRow",
|
|
4308
|
+
"seed-data-table__chipPickerRow"
|
|
4252
4309
|
],
|
|
4253
4310
|
[
|
|
4254
|
-
"
|
|
4255
|
-
"seed-data-
|
|
4311
|
+
"chipPickerBox",
|
|
4312
|
+
"seed-data-table__chipPickerBox"
|
|
4256
4313
|
],
|
|
4257
4314
|
[
|
|
4258
|
-
"
|
|
4259
|
-
"seed-data-
|
|
4315
|
+
"chipPickerCreate",
|
|
4316
|
+
"seed-data-table__chipPickerCreate"
|
|
4260
4317
|
],
|
|
4261
4318
|
[
|
|
4262
4319
|
"expandOverlay",
|
|
@@ -4875,94 +4932,154 @@ function RatingEditor({ column, value, pending, onCommit }) {
|
|
|
4875
4932
|
});
|
|
4876
4933
|
}
|
|
4877
4934
|
////////////////////////////////////////////////////////////////////////////////////
|
|
4878
|
-
// -- editable: "chip-list"
|
|
4879
|
-
//
|
|
4880
|
-
//
|
|
4881
|
-
//
|
|
4882
|
-
//
|
|
4883
|
-
//
|
|
4884
|
-
//
|
|
4885
|
-
//
|
|
4886
|
-
//
|
|
4887
|
-
//
|
|
4888
|
-
// `
|
|
4889
|
-
//
|
|
4890
|
-
//
|
|
4891
|
-
//
|
|
4892
|
-
//
|
|
4893
|
-
//
|
|
4894
|
-
// comment): `JSON.stringify(nextTags)`, which the consumer's `onEdit` parses back
|
|
4895
|
-
// -- crisp/GRC's contract stays "one string in, no typed union", not a second
|
|
4896
|
-
// commit shape invented for just this column.
|
|
4935
|
+
// -- editable: "chip-list" -- Attio's multi-select popover (0.14.0; replaces the
|
|
4936
|
+
// 0.10.0-0.13.0 free-text "Add..." tag adder, which stacked an empty input over the
|
|
4937
|
+
// chips and read as broken on an empty cell). Measured off Attio's Company
|
|
4938
|
+
// "Categories" cell: a search field pinned on top, below it a scrolling list of the
|
|
4939
|
+
// column's OPTIONS, each drawn as its own colored chip with a checkbox on the RIGHT
|
|
4940
|
+
// edge (filled blue when the tag is on this row); clicking a row toggles that tag
|
|
4941
|
+
// and the popover STAYS OPEN across toggles; typing filters the list; text matching
|
|
4942
|
+
// no option offers a "Create '<text>'" row (freeform tag columns, e.g. tether's
|
|
4943
|
+
// Labels). `body-cells.tsx`'s `DataTableBodyCell` opens this inside a portaled
|
|
4944
|
+
// `expandOverlay` on a plain click and closes it on blur/outside-click/Escape; it
|
|
4945
|
+
// tracks its own `overlayOpen` rather than `useDataTableEdit`'s `isEditing` gate,
|
|
4946
|
+
// since a sync commit closes `editingCell` on the first toggle.
|
|
4947
|
+
//
|
|
4948
|
+
// Commit contract is unchanged: every toggle/create commits the FULL next array as
|
|
4949
|
+
// `JSON.stringify(nextTags)` through the one-string `onCommit`, which the consumer's
|
|
4950
|
+
// `onEdit` parses back.
|
|
4897
4951
|
//
|
|
4898
|
-
//
|
|
4899
|
-
//
|
|
4900
|
-
//
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
|
|
4952
|
+
// Option source: `column.chipOptions` (value/label?/color?); tags already on the row
|
|
4953
|
+
// but absent from it are still listed (so they can be unchecked); with no
|
|
4954
|
+
// `chipOptions` at all, the distinct tags across the table's rows.
|
|
4955
|
+
/** Adds `tag` when absent, removes it when present -- the picker's one toggle. */ function toggleTag(tags, tag) {
|
|
4956
|
+
return tags.includes(tag) ? tags.filter((existing)=>existing !== tag) : [
|
|
4957
|
+
...tags,
|
|
4958
|
+
tag
|
|
4959
|
+
];
|
|
4960
|
+
}
|
|
4961
|
+
/** The option list a `chip-list` popover shows: declared `chipOptions` first, then any
|
|
4962
|
+
* selected tag not declared, then (only when nothing was declared) the distinct tags
|
|
4963
|
+
* across `rows`. */ function buildChipPickerOptions(column, tags, rows) {
|
|
4964
|
+
const seen = new Set();
|
|
4965
|
+
const out = [];
|
|
4966
|
+
function push(option) {
|
|
4967
|
+
if (!option.value || seen.has(option.value)) return;
|
|
4968
|
+
seen.add(option.value);
|
|
4969
|
+
out.push(option);
|
|
4970
|
+
}
|
|
4971
|
+
for (const option of column.chipOptions ?? [])push(option);
|
|
4972
|
+
for (const tag of tags)push({
|
|
4973
|
+
value: tag
|
|
4974
|
+
});
|
|
4975
|
+
if (!column.chipOptions) {
|
|
4976
|
+
const distinct = new Set();
|
|
4977
|
+
for (const row of rows){
|
|
4978
|
+
const raw = getColumnValue(column, row);
|
|
4979
|
+
if (Array.isArray(raw)) {
|
|
4980
|
+
for (const tag of raw)if (typeof tag === "string") distinct.add(tag);
|
|
4981
|
+
}
|
|
4982
|
+
}
|
|
4983
|
+
for (const tag of [
|
|
4984
|
+
...distinct
|
|
4985
|
+
].sort((x, y)=>x.localeCompare(y)))push({
|
|
4986
|
+
value: tag
|
|
4987
|
+
});
|
|
4988
|
+
}
|
|
4989
|
+
return out;
|
|
4990
|
+
}
|
|
4991
|
+
function ChipListEditor({ column, value, pending, onCommit, classNames, allRows = [] }) {
|
|
4904
4992
|
const tags = Array.isArray(value) ? value.filter((tag)=>!!tag) : [];
|
|
4905
|
-
const
|
|
4993
|
+
const built = buildChipPickerOptions(column, tags, allRows);
|
|
4994
|
+
// Options only ever GROW while the popover is open: with the row-derived fallback,
|
|
4995
|
+
// unchecking a tag that no other row carries would otherwise drop it from the list
|
|
4996
|
+
// and leave no way to re-check it.
|
|
4997
|
+
const knownRef = React__namespace.useRef([]);
|
|
4998
|
+
const known = knownRef.current;
|
|
4999
|
+
for (const option of built){
|
|
5000
|
+
const at = known.findIndex((entry)=>entry.value === option.value);
|
|
5001
|
+
if (at === -1) known.push(option);
|
|
5002
|
+
else known[at] = option;
|
|
5003
|
+
}
|
|
5004
|
+
const options = [
|
|
5005
|
+
...known
|
|
5006
|
+
];
|
|
5007
|
+
const optionText = React__namespace.useCallback((option)=>option.label ?? option.value, []);
|
|
5008
|
+
const { query, setQuery, filtered } = useSelectSearch(options, optionText);
|
|
5009
|
+
const trimmed = query.trim();
|
|
5010
|
+
const canCreate = column.chipCreatable !== false && trimmed !== "" && !options.some((option)=>option.value.toLowerCase() === trimmed.toLowerCase() || optionText(option).toLowerCase() === trimmed.toLowerCase());
|
|
4906
5011
|
function commitTags(next) {
|
|
4907
5012
|
onCommit(JSON.stringify(next));
|
|
4908
5013
|
}
|
|
4909
|
-
function
|
|
4910
|
-
|
|
4911
|
-
|
|
4912
|
-
if (!tag || tags.includes(tag)) return;
|
|
4913
|
-
commitTags([
|
|
4914
|
-
...tags,
|
|
4915
|
-
tag
|
|
4916
|
-
]);
|
|
4917
|
-
}
|
|
4918
|
-
function removeTag(tag) {
|
|
4919
|
-
commitTags(tags.filter((existing)=>existing !== tag));
|
|
5014
|
+
function create() {
|
|
5015
|
+
setQuery("");
|
|
5016
|
+
commitTags(toggleTag(tags, trimmed));
|
|
4920
5017
|
}
|
|
4921
|
-
return(// biome-ignore lint/a11y/noStaticElementInteractions: not a widget -- this
|
|
4922
|
-
/*#__PURE__*/ jsxRuntime.jsxs("
|
|
4923
|
-
className: classNames.
|
|
5018
|
+
return(// biome-ignore lint/a11y/noStaticElementInteractions: not a widget -- this wrapper never responds to interaction on ITSELF, only stops propagation of events that already occurred on a real interactive descendant (the search input, the option rows). No role fits it because it isn't a control.
|
|
5019
|
+
/*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
5020
|
+
className: classNames.chipPicker,
|
|
4924
5021
|
onClick: (event)=>event.stopPropagation(),
|
|
4925
5022
|
children: [
|
|
4926
|
-
|
|
4927
|
-
value: tag,
|
|
4928
|
-
className: classNames.chip,
|
|
4929
|
-
children: /*#__PURE__*/ jsxRuntime.jsx("button", {
|
|
4930
|
-
type: "button",
|
|
4931
|
-
disabled: pending,
|
|
4932
|
-
"aria-label": `Remove ${tag}`,
|
|
4933
|
-
className: classNames.chipRemove,
|
|
4934
|
-
onClick: ()=>removeTag(tag),
|
|
4935
|
-
children: /*#__PURE__*/ jsxRuntime.jsx(IconXmarkLine_default, {
|
|
4936
|
-
size: 10
|
|
4937
|
-
})
|
|
4938
|
-
})
|
|
4939
|
-
}, tag)),
|
|
4940
|
-
/*#__PURE__*/ jsxRuntime.jsx("input", {
|
|
4941
|
-
// biome-ignore lint/a11y/noAutofocus: this editor only ever mounts in response to an explicit click that just opened it (never on page load), matching `SelectEditor`'s own `open` (controlled, always-open-on-mount) -- the same UX every gated editor in this file already gives via a component the linter can't see through (`TextFieldInput`/`SelectSearchField`), just on a bare `<input>` here since `chipInput` has no such wrapper.
|
|
5023
|
+
/*#__PURE__*/ jsxRuntime.jsx(SelectSearchField, {
|
|
4942
5024
|
autoFocus: true,
|
|
4943
|
-
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
"aria-label": `Add tag to ${column.key}`,
|
|
4948
|
-
onChange: (event)=>setDraft(event.target.value),
|
|
5025
|
+
value: query,
|
|
5026
|
+
onChange: setQuery,
|
|
5027
|
+
placeholder: column.editorSearchPlaceholder ?? "Search…",
|
|
5028
|
+
"aria-label": `Search ${column.key}`,
|
|
4949
5029
|
onKeyDown: (event)=>{
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
// never reaches the row's own click/keyboard handling.
|
|
4956
|
-
if (event.key === "Escape") return;
|
|
4957
|
-
event.stopPropagation();
|
|
4958
|
-
if (event.key === "Enter") {
|
|
4959
|
-
event.preventDefault();
|
|
4960
|
-
addTag();
|
|
4961
|
-
} else if (event.key === "Backspace" && draft === "" && tags.length > 0) {
|
|
4962
|
-
removeTag(tags[tags.length - 1]);
|
|
4963
|
-
}
|
|
5030
|
+
if (event.key !== "Enter") return;
|
|
5031
|
+
event.preventDefault();
|
|
5032
|
+
if (pending) return;
|
|
5033
|
+
if (canCreate) create();
|
|
5034
|
+
else if (trimmed && filtered.length > 0) commitTags(toggleTag(tags, filtered[0].value));
|
|
4964
5035
|
}
|
|
4965
5036
|
}),
|
|
5037
|
+
/*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
5038
|
+
className: classNames.chipPickerList,
|
|
5039
|
+
role: "group",
|
|
5040
|
+
"aria-label": `${column.key} options`,
|
|
5041
|
+
children: [
|
|
5042
|
+
filtered.map((option)=>{
|
|
5043
|
+
const checked = tags.includes(option.value);
|
|
5044
|
+
return /*#__PURE__*/ jsxRuntime.jsxs("button", {
|
|
5045
|
+
type: "button",
|
|
5046
|
+
role: "checkbox",
|
|
5047
|
+
"aria-checked": checked,
|
|
5048
|
+
disabled: pending,
|
|
5049
|
+
className: classNames.chipPickerRow,
|
|
5050
|
+
// Keep focus in the search field so typing keeps filtering after a toggle.
|
|
5051
|
+
onMouseDown: (event)=>event.preventDefault(),
|
|
5052
|
+
onClick: ()=>commitTags(toggleTag(tags, option.value)),
|
|
5053
|
+
children: [
|
|
5054
|
+
/*#__PURE__*/ jsxRuntime.jsx(SwatchChip, {
|
|
5055
|
+
value: option.value,
|
|
5056
|
+
label: option.label,
|
|
5057
|
+
color: option.color,
|
|
5058
|
+
className: classNames.chip
|
|
5059
|
+
}),
|
|
5060
|
+
/*#__PURE__*/ jsxRuntime.jsx("span", {
|
|
5061
|
+
className: classNames.chipPickerBox,
|
|
5062
|
+
"data-checked": checked ? "" : undefined,
|
|
5063
|
+
children: checked && /*#__PURE__*/ jsxRuntime.jsx(IconCheckmarkFatFill_default, {
|
|
5064
|
+
"aria-hidden": "true"
|
|
5065
|
+
})
|
|
5066
|
+
})
|
|
5067
|
+
]
|
|
5068
|
+
}, option.value);
|
|
5069
|
+
}),
|
|
5070
|
+
canCreate && /*#__PURE__*/ jsxRuntime.jsx("button", {
|
|
5071
|
+
type: "button",
|
|
5072
|
+
disabled: pending,
|
|
5073
|
+
className: classNames.chipPickerCreate,
|
|
5074
|
+
onMouseDown: (event)=>event.preventDefault(),
|
|
5075
|
+
onClick: create,
|
|
5076
|
+
children: `Create '${trimmed}'`
|
|
5077
|
+
}),
|
|
5078
|
+
!canCreate && filtered.length === 0 && /*#__PURE__*/ jsxRuntime.jsx(SelectSearchEmpty, {
|
|
5079
|
+
children: column.editorEmptyLabel ?? "No results"
|
|
5080
|
+
})
|
|
5081
|
+
]
|
|
5082
|
+
}),
|
|
4966
5083
|
pending && /*#__PURE__*/ jsxRuntime.jsx(EditPendingIndicator, {})
|
|
4967
5084
|
]
|
|
4968
5085
|
}));
|
|
@@ -5051,44 +5168,6 @@ function CellExpandOverlay({ className, anchorRef, contentRef, children }) {
|
|
|
5051
5168
|
}), document.body);
|
|
5052
5169
|
}
|
|
5053
5170
|
|
|
5054
|
-
// Row-narrowing for the toolbar's search box -- split out of DataTable.tsx the way
|
|
5055
|
-
// cells.tsx splits out cell-type rendering: a self-contained, independently testable
|
|
5056
|
-
// concern DataTable.tsx just calls, rather than inline `.filter()` calls piling up in
|
|
5057
|
-
// the same component that also owns markup. The toolbar's typed Filter CONDITIONS
|
|
5058
|
-
// (field/operator/value chips, DATATABLE-ATTIO-SPEC.md's Attio/crisp model) live in
|
|
5059
|
-
// `toolbar-conditions.tsx` instead, alongside the Sort/Filter chrome that manages
|
|
5060
|
-
// them -- this file is search only now; the old per-column "is/is not" picker
|
|
5061
|
-
// (`matchesFilter`/`DataTableFilterState`) is gone, replaced by that toolbar model.
|
|
5062
|
-
/**
|
|
5063
|
-
* A column's `value(row)` if it supplies one, else the raw field at `column.key` --
|
|
5064
|
-
* the single accessor sort/search/filter/export all read through
|
|
5065
|
-
* (DATATABLE-ATTIO-SPEC.md's Column API), so a consumer only teaches the table how to
|
|
5066
|
-
* read a value ONCE rather than once per feature.
|
|
5067
|
-
*/ function getColumnValue(column, row) {
|
|
5068
|
-
return column.value ? column.value(row) : row[column.key];
|
|
5069
|
-
}
|
|
5070
|
-
/**
|
|
5071
|
-
* Case-insensitive substring match against a row's stringified value -- crisp's own
|
|
5072
|
-
* `applyFilters` "contains" semantics (`tabletoolbar.tsx`), reused here for the
|
|
5073
|
-
* toolbar's single free-text query. `null`/`undefined` never match a non-empty query --
|
|
5074
|
-
* there is no text to search.
|
|
5075
|
-
*/ function matchesSearch(value, query) {
|
|
5076
|
-
if (!query) return true;
|
|
5077
|
-
if (value == null) return false;
|
|
5078
|
-
return String(value).toLowerCase().includes(query.toLowerCase());
|
|
5079
|
-
}
|
|
5080
|
-
/**
|
|
5081
|
-
* The toolbar's search query -- an OR across `searchable` columns, matching GRC's own
|
|
5082
|
-
* `useFilteredRows`. The toolbar's own typed Filter conditions apply SEPARATELY, as a
|
|
5083
|
-
* second pass over this function's result (`toolbar-conditions.tsx`'s
|
|
5084
|
-
* `applyToolbarFilters`, called by `DataTable.tsx` right after this) -- narrowing what
|
|
5085
|
-
* the search box already found, not the other way round.
|
|
5086
|
-
*/ function getVisibleRows(data, columns, query) {
|
|
5087
|
-
const searchableColumns = columns.filter((column)=>column.searchable);
|
|
5088
|
-
if (!query) return data;
|
|
5089
|
-
return data.filter((row)=>searchableColumns.some((column)=>matchesSearch(getColumnValue(column, row), query)));
|
|
5090
|
-
}
|
|
5091
|
-
|
|
5092
5171
|
// Feature C (#12) -- the click-to-expand gate: measures whether a cell's rendered
|
|
5093
5172
|
// content is ACTUALLY truncated right now, so a single click only opens the
|
|
5094
5173
|
// anchored overlay (editors.tsx's `CellExpandOverlay`) when there's real hidden
|
|
@@ -5154,7 +5233,10 @@ function isCellTruncated(cell) {
|
|
|
5154
5233
|
* `overflow: visible` on every element in between and regardless of how high its
|
|
5155
5234
|
* `z-index` is raised -- neither of which is a stacking-context or overflow bug
|
|
5156
5235
|
* fixable from the INSIDE. A portal sidesteps it entirely by not being a
|
|
5157
|
-
* descendant of the sticky `<td>` at all once mounted. */
|
|
5236
|
+
* descendant of the sticky `<td>` at all once mounted. */ /** The table's full `data`, so an editable chip-list column with no `chipOptions` can
|
|
5237
|
+
* fall back to the distinct tags already present across rows. */ const DataTableRowsContext = /*#__PURE__*/ React__namespace.createContext([]);
|
|
5238
|
+
/** Attio's multi-select popover is wider than a narrow tags column. */ const CHIP_PICKER_MIN_WIDTH = 240;
|
|
5239
|
+
function isChipListEditable(column) {
|
|
5158
5240
|
return !!column.editable && column.type === "chip-list";
|
|
5159
5241
|
}
|
|
5160
5242
|
function ColumnBodyCells({ columns, row, classNames, locale, selectable, stickyFirst, stickyLast, cellContextMenu, onViewEditHistory, cellContextMenuItems }) {
|
|
@@ -5214,6 +5296,7 @@ function ColumnBodyCells({ columns, row, classNames, locale, selectable, stickyF
|
|
|
5214
5296
|
const [contextMenuOpen, setContextMenuOpen] = React__namespace.useState(false);
|
|
5215
5297
|
const alwaysLive = isAlwaysLiveEditable(column);
|
|
5216
5298
|
const chipListEditable = isChipListEditable(column);
|
|
5299
|
+
const allRows = React__namespace.useContext(DataTableRowsContext);
|
|
5217
5300
|
// A gated `editable` column (everything except the always-live widgets AND the
|
|
5218
5301
|
// click-to-edit chip-list) opens on double-click -- Attio's own measured gesture
|
|
5219
5302
|
// (crisp's #411), matched here rather than a single click, which stays "select
|
|
@@ -5243,7 +5326,10 @@ function ColumnBodyCells({ columns, row, classNames, locale, selectable, stickyF
|
|
|
5243
5326
|
top: rect.bottom,
|
|
5244
5327
|
insetInlineStart: rect.left,
|
|
5245
5328
|
insetInlineEnd: "auto",
|
|
5246
|
-
minWidth: rect.width,
|
|
5329
|
+
minWidth: Math.max(rect.width, CHIP_PICKER_MIN_WIDTH),
|
|
5330
|
+
// The multi-select popover owns its own inner padding (search field + option
|
|
5331
|
+
// rows inset themselves); the overlay's cell-editor padding would double it.
|
|
5332
|
+
padding: 0,
|
|
5247
5333
|
// Both override the SAME `expandOverlay` class properties this box also
|
|
5248
5334
|
// carries (`className={classNames.expandOverlay}`, below) -- that class's
|
|
5249
5335
|
// `minHeight: calc(100% + 2px)` resolves against an ANCHORED box's own
|
|
@@ -5390,7 +5476,10 @@ function ColumnBodyCells({ columns, row, classNames, locale, selectable, stickyF
|
|
|
5390
5476
|
chipListEditorOpen,
|
|
5391
5477
|
measurePopoverPosition
|
|
5392
5478
|
]);
|
|
5393
|
-
|
|
5479
|
+
// Never for a chip-list cell: its picker is its own portaled popover, and the
|
|
5480
|
+
// in-cell overlay box would show for the first frame only (a sync commit closes
|
|
5481
|
+
// `isEditing` on the first toggle) and overlap the popover's top edge.
|
|
5482
|
+
const overlayActive = overlayOpen && !chipListEditable && (alwaysLive || isEditing(row.id, column.key) || isPeeking(row.id, column.key));
|
|
5394
5483
|
const rawValue = getColumnValue(column, row);
|
|
5395
5484
|
const pending = isPending(row.id, column.key);
|
|
5396
5485
|
return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
@@ -5448,7 +5537,8 @@ function ColumnBodyCells({ columns, row, classNames, locale, selectable, stickyF
|
|
|
5448
5537
|
value: resolveEditValue(column, row, rawValue),
|
|
5449
5538
|
pending: pending,
|
|
5450
5539
|
onCommit: (value)=>commitEdit(row.id, column.key, value),
|
|
5451
|
-
classNames: classNames
|
|
5540
|
+
classNames: classNames,
|
|
5541
|
+
allRows: allRows
|
|
5452
5542
|
})
|
|
5453
5543
|
}), document.body)
|
|
5454
5544
|
]
|
|
@@ -5502,7 +5592,8 @@ function ColumnBodyCells({ columns, row, classNames, locale, selectable, stickyF
|
|
|
5502
5592
|
value: rawValue,
|
|
5503
5593
|
className: classNames.chipList,
|
|
5504
5594
|
chipClassName: classNames.chip,
|
|
5505
|
-
overflowClassName: classNames.chipOverflow
|
|
5595
|
+
overflowClassName: classNames.chipOverflow,
|
|
5596
|
+
chipOptions: column.chipOptions
|
|
5506
5597
|
});
|
|
5507
5598
|
} else if (column.editable && isEditing(rowId, column.key)) {
|
|
5508
5599
|
if (column.editor === "select") {
|
|
@@ -5619,7 +5710,8 @@ function DisplayCellContent({ column, row, value, classNames, locale }) {
|
|
|
5619
5710
|
value: value,
|
|
5620
5711
|
className: classNames.chipList,
|
|
5621
5712
|
chipClassName: classNames.chip,
|
|
5622
|
-
overflowClassName: classNames.chipOverflow
|
|
5713
|
+
overflowClassName: classNames.chipOverflow,
|
|
5714
|
+
chipOptions: column.chipOptions
|
|
5623
5715
|
});
|
|
5624
5716
|
case "number":
|
|
5625
5717
|
return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
@@ -12039,223 +12131,226 @@ function DataTableInner(props, ref) {
|
|
|
12039
12131
|
const totalCols = columns.length + (selectable ? 1 : 0);
|
|
12040
12132
|
return /*#__PURE__*/ jsxRuntime.jsx(ClassNamesProvider, {
|
|
12041
12133
|
value: classNames,
|
|
12042
|
-
children: /*#__PURE__*/ jsxRuntime.
|
|
12043
|
-
|
|
12044
|
-
|
|
12045
|
-
|
|
12046
|
-
|
|
12047
|
-
|
|
12048
|
-
|
|
12049
|
-
|
|
12050
|
-
|
|
12051
|
-
|
|
12052
|
-
|
|
12053
|
-
|
|
12054
|
-
|
|
12055
|
-
|
|
12056
|
-
|
|
12057
|
-
|
|
12058
|
-
|
|
12059
|
-
|
|
12060
|
-
|
|
12061
|
-
|
|
12062
|
-
|
|
12063
|
-
|
|
12064
|
-
|
|
12065
|
-
|
|
12066
|
-
|
|
12067
|
-
|
|
12068
|
-
|
|
12069
|
-
|
|
12070
|
-
|
|
12071
|
-
|
|
12072
|
-
|
|
12073
|
-
|
|
12074
|
-
|
|
12075
|
-
|
|
12076
|
-
|
|
12077
|
-
|
|
12078
|
-
|
|
12079
|
-
|
|
12080
|
-
|
|
12081
|
-
|
|
12082
|
-
|
|
12083
|
-
|
|
12084
|
-
|
|
12085
|
-
|
|
12086
|
-
|
|
12087
|
-
|
|
12088
|
-
|
|
12089
|
-
|
|
12090
|
-
onColumnsChange
|
|
12091
|
-
|
|
12092
|
-
|
|
12093
|
-
|
|
12094
|
-
|
|
12095
|
-
placeholder: searchPlaceholder,
|
|
12096
|
-
label: searchLabel
|
|
12097
|
-
}),
|
|
12098
|
-
/*#__PURE__*/ jsxRuntime.jsx(SortControl, {
|
|
12099
|
-
columns: columns
|
|
12100
|
-
}),
|
|
12101
|
-
/*#__PURE__*/ jsxRuntime.jsx(FilterControl, {
|
|
12102
|
-
columns: columns
|
|
12103
|
-
}),
|
|
12104
|
-
(showCount || toolbarActions) && /*#__PURE__*/ jsxRuntime.jsxs(DataTableToolbarEnd, {
|
|
12105
|
-
children: [
|
|
12106
|
-
toolbarActions,
|
|
12107
|
-
showCount && /*#__PURE__*/ jsxRuntime.jsx(RowCount, {
|
|
12108
|
-
shown: sortedData.length,
|
|
12109
|
-
total: data.length,
|
|
12110
|
-
countLabel: countLabel
|
|
12111
|
-
})
|
|
12112
|
-
]
|
|
12113
|
-
})
|
|
12114
|
-
]
|
|
12115
|
-
}),
|
|
12116
|
-
/*#__PURE__*/ jsxRuntime.jsx(DataTableScrollBody, {
|
|
12117
|
-
scrollProps: scrollProps,
|
|
12118
|
-
virtualized: virtualized,
|
|
12119
|
-
children: /*#__PURE__*/ jsxRuntime.jsxs(DataTableTable, {
|
|
12120
|
-
"aria-rowcount": virtualized ? sortedData.length + 1 : undefined,
|
|
12134
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(DataTableRowsContext.Provider, {
|
|
12135
|
+
value: data,
|
|
12136
|
+
children: /*#__PURE__*/ jsxRuntime.jsxs(DataTableRoot, {
|
|
12137
|
+
ref: ref,
|
|
12138
|
+
className: clsx(classNames.root, className),
|
|
12139
|
+
rowIds: rowIds,
|
|
12140
|
+
selectable: selectable,
|
|
12141
|
+
selectedIds: selectedIds,
|
|
12142
|
+
defaultSelectedIds: defaultSelectedIds,
|
|
12143
|
+
onSelectionChange: onSelectionChange,
|
|
12144
|
+
sort: sort,
|
|
12145
|
+
defaultSort: defaultSort,
|
|
12146
|
+
onSortChange: handleSortChange,
|
|
12147
|
+
query: resolvedQuery,
|
|
12148
|
+
onQueryChange: handleQueryChange,
|
|
12149
|
+
toolbarSorts: resolvedToolbarSorts,
|
|
12150
|
+
onToolbarSortsChange: handleToolbarSortsChange,
|
|
12151
|
+
toolbarFilters: resolvedToolbarFilters,
|
|
12152
|
+
onToolbarFiltersChange: handleToolbarFiltersChange,
|
|
12153
|
+
columnKeys: columnKeys,
|
|
12154
|
+
actionsColumnKey: actionsColumnKey,
|
|
12155
|
+
columnOrder: columnOrder,
|
|
12156
|
+
defaultColumnOrder: defaultColumnOrder,
|
|
12157
|
+
onColumnOrderChange: onColumnOrderChange,
|
|
12158
|
+
hiddenColumnKeys: hiddenColumnKeys,
|
|
12159
|
+
defaultHiddenColumnKeys: defaultHiddenColumnKeys,
|
|
12160
|
+
onHiddenColumnKeysChange: onHiddenColumnKeysChange,
|
|
12161
|
+
columnWidths: columnWidths,
|
|
12162
|
+
defaultColumnWidths: defaultColumnWidths,
|
|
12163
|
+
onColumnWidthsChange: onColumnWidthsChange,
|
|
12164
|
+
columnLabels: columnLabels,
|
|
12165
|
+
defaultColumnLabels: defaultColumnLabels,
|
|
12166
|
+
onColumnLabelsChange: onColumnLabelsChange,
|
|
12167
|
+
pinnedColumnKeys: pinnedColumnKeys,
|
|
12168
|
+
defaultPinnedColumnKeys: defaultPinnedColumnKeys,
|
|
12169
|
+
onPinnedColumnKeysChange: onPinnedColumnKeysChange,
|
|
12170
|
+
columnCalcOps: columnCalcOps,
|
|
12171
|
+
defaultColumnCalcOps: defaultColumnCalcOps,
|
|
12172
|
+
onColumnCalcOpsChange: onColumnCalcOpsChange,
|
|
12173
|
+
onEdit: onEdit,
|
|
12174
|
+
onLoadMore: onLoadMore,
|
|
12175
|
+
hasMore: hasMore,
|
|
12176
|
+
loadingMore: loadingMore,
|
|
12177
|
+
virtualized: virtualized,
|
|
12178
|
+
rowHeight: rowHeight,
|
|
12179
|
+
overscan: overscan,
|
|
12180
|
+
...restProps,
|
|
12181
|
+
children: [
|
|
12182
|
+
onColumnsChange && /*#__PURE__*/ jsxRuntime.jsx(ColumnsChangeEffect, {
|
|
12183
|
+
columns: columns,
|
|
12184
|
+
onColumnsChange: onColumnsChange
|
|
12185
|
+
}),
|
|
12186
|
+
showToolbar && /*#__PURE__*/ jsxRuntime.jsxs(DataTableToolbar, {
|
|
12121
12187
|
children: [
|
|
12122
|
-
/*#__PURE__*/ jsxRuntime.jsx(
|
|
12123
|
-
|
|
12124
|
-
|
|
12125
|
-
|
|
12188
|
+
searchable && /*#__PURE__*/ jsxRuntime.jsx(SearchBox, {
|
|
12189
|
+
placeholder: searchPlaceholder,
|
|
12190
|
+
label: searchLabel
|
|
12191
|
+
}),
|
|
12192
|
+
/*#__PURE__*/ jsxRuntime.jsx(SortControl, {
|
|
12193
|
+
columns: columns
|
|
12126
12194
|
}),
|
|
12127
|
-
/*#__PURE__*/ jsxRuntime.
|
|
12195
|
+
/*#__PURE__*/ jsxRuntime.jsx(FilterControl, {
|
|
12196
|
+
columns: columns
|
|
12197
|
+
}),
|
|
12198
|
+
(showCount || toolbarActions) && /*#__PURE__*/ jsxRuntime.jsxs(DataTableToolbarEnd, {
|
|
12128
12199
|
children: [
|
|
12129
|
-
|
|
12130
|
-
|
|
12131
|
-
|
|
12132
|
-
|
|
12133
|
-
|
|
12134
|
-
indeterminateIcon: selectionIndeterminateIcon ?? DEFAULT_INDETERMINATE_ICON
|
|
12135
|
-
})
|
|
12136
|
-
}),
|
|
12137
|
-
/*#__PURE__*/ jsxRuntime.jsx(ColumnHeaderCells, {
|
|
12138
|
-
columns: columns,
|
|
12139
|
-
columnMenu: columnMenu,
|
|
12140
|
-
reorderable: reorderable,
|
|
12141
|
-
resizable: resizable,
|
|
12142
|
-
sortIcon: sortIcon,
|
|
12143
|
-
selectable: !!selectable,
|
|
12144
|
-
stickyFirst: stickyFirst,
|
|
12145
|
-
stickyLast: resolvedStickyLast
|
|
12200
|
+
toolbarActions,
|
|
12201
|
+
showCount && /*#__PURE__*/ jsxRuntime.jsx(RowCount, {
|
|
12202
|
+
shown: sortedData.length,
|
|
12203
|
+
total: data.length,
|
|
12204
|
+
countLabel: countLabel
|
|
12146
12205
|
})
|
|
12147
12206
|
]
|
|
12148
|
-
})
|
|
12149
|
-
|
|
12150
|
-
|
|
12151
|
-
|
|
12152
|
-
|
|
12153
|
-
|
|
12154
|
-
|
|
12155
|
-
|
|
12207
|
+
})
|
|
12208
|
+
]
|
|
12209
|
+
}),
|
|
12210
|
+
/*#__PURE__*/ jsxRuntime.jsx(DataTableScrollBody, {
|
|
12211
|
+
scrollProps: scrollProps,
|
|
12212
|
+
virtualized: virtualized,
|
|
12213
|
+
children: /*#__PURE__*/ jsxRuntime.jsxs(DataTableTable, {
|
|
12214
|
+
"aria-rowcount": virtualized ? sortedData.length + 1 : undefined,
|
|
12215
|
+
children: [
|
|
12216
|
+
/*#__PURE__*/ jsxRuntime.jsx(DataTableColGroup, {
|
|
12217
|
+
columns: columns,
|
|
12218
|
+
selectable: !!selectable,
|
|
12219
|
+
stickyFirst: stickyFirst
|
|
12220
|
+
}),
|
|
12221
|
+
/*#__PURE__*/ jsxRuntime.jsxs(DataTableHeader, {
|
|
12222
|
+
children: [
|
|
12223
|
+
selectable && /*#__PURE__*/ jsxRuntime.jsx(SelectionHeaderCell, {
|
|
12224
|
+
stickyFirst: stickyFirst,
|
|
12225
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(SelectAllCheckbox, {
|
|
12226
|
+
label: selectAllLabel,
|
|
12227
|
+
checkedIcon: selectionCheckedIcon ?? DEFAULT_CHECKED_ICON,
|
|
12228
|
+
indeterminateIcon: selectionIndeterminateIcon ?? DEFAULT_INDETERMINATE_ICON
|
|
12229
|
+
})
|
|
12230
|
+
}),
|
|
12231
|
+
/*#__PURE__*/ jsxRuntime.jsx(ColumnHeaderCells, {
|
|
12232
|
+
columns: columns,
|
|
12233
|
+
columnMenu: columnMenu,
|
|
12234
|
+
reorderable: reorderable,
|
|
12235
|
+
resizable: resizable,
|
|
12236
|
+
sortIcon: sortIcon,
|
|
12237
|
+
selectable: !!selectable,
|
|
12238
|
+
stickyFirst: stickyFirst,
|
|
12239
|
+
stickyLast: resolvedStickyLast
|
|
12156
12240
|
})
|
|
12157
|
-
|
|
12158
|
-
})
|
|
12159
|
-
|
|
12160
|
-
|
|
12161
|
-
children: /*#__PURE__*/ jsxRuntime.jsx(
|
|
12162
|
-
|
|
12163
|
-
children:
|
|
12241
|
+
]
|
|
12242
|
+
}),
|
|
12243
|
+
/*#__PURE__*/ jsxRuntime.jsx(DataTableBody, {
|
|
12244
|
+
children: loading ? /*#__PURE__*/ jsxRuntime.jsx("tr", {
|
|
12245
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(DataTableCell, {
|
|
12246
|
+
colSpan: totalCols,
|
|
12247
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(LoadingStateContent, {
|
|
12248
|
+
label: loadingLabel,
|
|
12249
|
+
classNames: classNames
|
|
12250
|
+
})
|
|
12164
12251
|
})
|
|
12165
|
-
})
|
|
12166
|
-
|
|
12167
|
-
|
|
12168
|
-
|
|
12169
|
-
|
|
12170
|
-
|
|
12171
|
-
|
|
12252
|
+
}) : error ? /*#__PURE__*/ jsxRuntime.jsx("tr", {
|
|
12253
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(DataTableCell, {
|
|
12254
|
+
colSpan: totalCols,
|
|
12255
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(EmptyStateContent, {
|
|
12256
|
+
classNames: classNames,
|
|
12257
|
+
children: error
|
|
12258
|
+
})
|
|
12172
12259
|
})
|
|
12173
|
-
})
|
|
12174
|
-
|
|
12175
|
-
children: [
|
|
12176
|
-
/*#__PURE__*/ jsxRuntime.jsx(WindowedRows, {
|
|
12177
|
-
rows: sortedData,
|
|
12178
|
-
virtualized: virtualized,
|
|
12260
|
+
}) : sortedData.length === 0 ? /*#__PURE__*/ jsxRuntime.jsx("tr", {
|
|
12261
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(DataTableCell, {
|
|
12179
12262
|
colSpan: totalCols,
|
|
12180
|
-
children:
|
|
12181
|
-
|
|
12182
|
-
|
|
12183
|
-
|
|
12184
|
-
|
|
12185
|
-
|
|
12186
|
-
|
|
12187
|
-
|
|
12188
|
-
|
|
12189
|
-
|
|
12190
|
-
|
|
12191
|
-
|
|
12192
|
-
|
|
12193
|
-
|
|
12194
|
-
|
|
12195
|
-
|
|
12196
|
-
|
|
12197
|
-
|
|
12198
|
-
|
|
12263
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(EmptyStateContent, {
|
|
12264
|
+
classNames: classNames,
|
|
12265
|
+
children: empty
|
|
12266
|
+
})
|
|
12267
|
+
})
|
|
12268
|
+
}) : /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
12269
|
+
children: [
|
|
12270
|
+
/*#__PURE__*/ jsxRuntime.jsx(WindowedRows, {
|
|
12271
|
+
rows: sortedData,
|
|
12272
|
+
virtualized: virtualized,
|
|
12273
|
+
colSpan: totalCols,
|
|
12274
|
+
children: (windowRows, firstIndex)=>/*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
12275
|
+
children: windowRows.map((row, offset)=>/*#__PURE__*/ jsxRuntime.jsxs(DataTableRow, {
|
|
12276
|
+
rowId: row.id,
|
|
12277
|
+
"aria-rowindex": virtualized ? firstIndex + offset + 2 : undefined,
|
|
12278
|
+
"data-clickable": onRowClick ? "" : undefined,
|
|
12279
|
+
onClick: onRowClick ? ()=>onRowClick(row) : undefined,
|
|
12280
|
+
children: [
|
|
12281
|
+
selectable && /*#__PURE__*/ jsxRuntime.jsx(SelectionCell, {
|
|
12282
|
+
// The row itself carries `onClick={onRowClick}` above, and a
|
|
12283
|
+
// native click on this cell's checkbox bubbles up through it
|
|
12284
|
+
// (React attaches DataTableRow's handler on the <tr>, which
|
|
12285
|
+
// sits between the checkbox and anything a consumer could stop
|
|
12286
|
+
// it from at -- so this has to live here, not in the consumer).
|
|
12287
|
+
// Without this, checking a row's box also fires `onRowClick`.
|
|
12288
|
+
onClick: (event)=>event.stopPropagation(),
|
|
12289
|
+
stickyFirst: stickyFirst,
|
|
12290
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(RowCheckbox, {
|
|
12291
|
+
label: getRowSelectionLabel(row),
|
|
12292
|
+
checkedIcon: selectionCheckedIcon ?? DEFAULT_CHECKED_ICON
|
|
12293
|
+
})
|
|
12294
|
+
}),
|
|
12295
|
+
/*#__PURE__*/ jsxRuntime.jsx(ColumnBodyCells, {
|
|
12296
|
+
columns: columns,
|
|
12297
|
+
row: row,
|
|
12298
|
+
classNames: classNames,
|
|
12299
|
+
locale: locale,
|
|
12300
|
+
selectable: !!selectable,
|
|
12301
|
+
stickyFirst: stickyFirst,
|
|
12302
|
+
stickyLast: resolvedStickyLast,
|
|
12303
|
+
cellContextMenu: cellContextMenu,
|
|
12304
|
+
onViewEditHistory: onViewEditHistory,
|
|
12305
|
+
cellContextMenuItems: cellContextMenuItems
|
|
12199
12306
|
})
|
|
12200
|
-
|
|
12201
|
-
|
|
12202
|
-
|
|
12203
|
-
|
|
12204
|
-
|
|
12205
|
-
|
|
12206
|
-
|
|
12207
|
-
|
|
12208
|
-
|
|
12209
|
-
|
|
12210
|
-
|
|
12211
|
-
|
|
12212
|
-
|
|
12213
|
-
|
|
12214
|
-
|
|
12215
|
-
|
|
12307
|
+
]
|
|
12308
|
+
}, row.id))
|
|
12309
|
+
})
|
|
12310
|
+
}),
|
|
12311
|
+
onLoadMore && /*#__PURE__*/ jsxRuntime.jsx(InfiniteScrollRow, {
|
|
12312
|
+
colSpan: totalCols,
|
|
12313
|
+
classNames: classNames,
|
|
12314
|
+
loadingLabel: loadingLabel
|
|
12315
|
+
})
|
|
12316
|
+
]
|
|
12317
|
+
})
|
|
12318
|
+
}),
|
|
12319
|
+
showFooter && /*#__PURE__*/ jsxRuntime.jsxs(DataTableFooter, {
|
|
12320
|
+
children: [
|
|
12321
|
+
selectable && // The 40px-wide selection SPACER cell is now a plain `DataTableFooterCell`
|
|
12322
|
+
// (not the `selectionCell` slot) -- the `<colgroup>`'s own 40px `<col>`
|
|
12323
|
+
// is what makes every row's selection column line up now, not a matching
|
|
12324
|
+
// per-slot width formula, so there is no more reason for this cell to
|
|
12325
|
+
// borrow a different slot than its footer siblings.
|
|
12326
|
+
/*#__PURE__*/ jsxRuntime.jsx(SelectionFooterCell, {
|
|
12327
|
+
stickyFirst: stickyFirst
|
|
12216
12328
|
}),
|
|
12217
|
-
|
|
12218
|
-
|
|
12219
|
-
|
|
12220
|
-
|
|
12329
|
+
/*#__PURE__*/ jsxRuntime.jsx(ColumnCalcCells, {
|
|
12330
|
+
columns: columns,
|
|
12331
|
+
rows: sortedData,
|
|
12332
|
+
selectable: !!selectable,
|
|
12333
|
+
stickyFirst: stickyFirst,
|
|
12334
|
+
stickyLast: resolvedStickyLast
|
|
12221
12335
|
})
|
|
12222
12336
|
]
|
|
12337
|
+
}),
|
|
12338
|
+
onAddRow && /*#__PURE__*/ jsxRuntime.jsx(AddRowFooter, {
|
|
12339
|
+
onAddRow: onAddRow,
|
|
12340
|
+
addRowLabel: addRowLabel,
|
|
12341
|
+
colSpan: totalCols,
|
|
12342
|
+
classNames: classNames
|
|
12223
12343
|
})
|
|
12224
|
-
|
|
12225
|
-
|
|
12226
|
-
|
|
12227
|
-
|
|
12228
|
-
|
|
12229
|
-
|
|
12230
|
-
|
|
12231
|
-
// borrow a different slot than its footer siblings.
|
|
12232
|
-
/*#__PURE__*/ jsxRuntime.jsx(SelectionFooterCell, {
|
|
12233
|
-
stickyFirst: stickyFirst
|
|
12234
|
-
}),
|
|
12235
|
-
/*#__PURE__*/ jsxRuntime.jsx(ColumnCalcCells, {
|
|
12236
|
-
columns: columns,
|
|
12237
|
-
rows: sortedData,
|
|
12238
|
-
selectable: !!selectable,
|
|
12239
|
-
stickyFirst: stickyFirst,
|
|
12240
|
-
stickyLast: resolvedStickyLast
|
|
12241
|
-
})
|
|
12242
|
-
]
|
|
12243
|
-
}),
|
|
12244
|
-
onAddRow && /*#__PURE__*/ jsxRuntime.jsx(AddRowFooter, {
|
|
12245
|
-
onAddRow: onAddRow,
|
|
12246
|
-
addRowLabel: addRowLabel,
|
|
12247
|
-
colSpan: totalCols,
|
|
12248
|
-
classNames: classNames
|
|
12249
|
-
})
|
|
12250
|
-
]
|
|
12344
|
+
]
|
|
12345
|
+
})
|
|
12346
|
+
}),
|
|
12347
|
+
selectable && /*#__PURE__*/ jsxRuntime.jsx(DataTableBulkBar, {
|
|
12348
|
+
clearLabel: clearSelectionLabel,
|
|
12349
|
+
aboveFooter: showFooter || !!onAddRow,
|
|
12350
|
+
children: bulkActions
|
|
12251
12351
|
})
|
|
12252
|
-
|
|
12253
|
-
|
|
12254
|
-
clearLabel: clearSelectionLabel,
|
|
12255
|
-
aboveFooter: showFooter || !!onAddRow,
|
|
12256
|
-
children: bulkActions
|
|
12257
|
-
})
|
|
12258
|
-
]
|
|
12352
|
+
]
|
|
12353
|
+
})
|
|
12259
12354
|
})
|
|
12260
12355
|
});
|
|
12261
12356
|
}
|