@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.js
CHANGED
|
@@ -3232,19 +3232,20 @@ function StatusCell({ value }) {
|
|
|
3232
3232
|
* same "literal color as a computed prop" call `RatingCell`'s star fill already
|
|
3233
3233
|
* makes. Shared by `ChipCell` (Feature A, single value) and `ChipListCell`/
|
|
3234
3234
|
* editors.tsx's `ChipListEditor` (Feature B, multi value) so all three chip
|
|
3235
|
-
* renderings stay byte-identical. */ function SwatchChip({ value, className, children }) {
|
|
3235
|
+
* renderings stay byte-identical. */ function SwatchChip({ value, label, color, className, children }) {
|
|
3236
3236
|
return /*#__PURE__*/ jsxs("span", {
|
|
3237
3237
|
className: className,
|
|
3238
3238
|
style: {
|
|
3239
|
-
backgroundColor: swatchColorFor(value),
|
|
3240
|
-
color: swatchInkFor(value)
|
|
3239
|
+
backgroundColor: color ?? swatchColorFor(value),
|
|
3240
|
+
color: color ? CHIP_CUSTOM_COLOR_INK : swatchInkFor(value)
|
|
3241
3241
|
},
|
|
3242
3242
|
children: [
|
|
3243
|
-
value,
|
|
3243
|
+
label ?? value,
|
|
3244
3244
|
children
|
|
3245
3245
|
]
|
|
3246
3246
|
});
|
|
3247
3247
|
}
|
|
3248
|
+
const CHIP_CUSTOM_COLOR_INK = "#1f2937";
|
|
3248
3249
|
/** `type: "chip"` (Feature A, #9) -- a single value rendered as one colored chip,
|
|
3249
3250
|
* the color derived deterministically from the value string (`swatchColorFor`):
|
|
3250
3251
|
* same value, same color, every render, every column. For a column like provider/
|
|
@@ -3257,6 +3258,14 @@ function StatusCell({ value }) {
|
|
|
3257
3258
|
className: className
|
|
3258
3259
|
});
|
|
3259
3260
|
}
|
|
3261
|
+
/** The `label`/`color` a `chipOptions` entry gives `tag`, spread onto its chip so a
|
|
3262
|
+
* tag looks identical in the closed cell and in the editor's option list. */ function optionProps(chipOptions, tag) {
|
|
3263
|
+
const option = chipOptions?.find((entry)=>entry.value === tag);
|
|
3264
|
+
return option ? {
|
|
3265
|
+
label: option.label,
|
|
3266
|
+
color: option.color
|
|
3267
|
+
} : {};
|
|
3268
|
+
}
|
|
3260
3269
|
// Feature B rework (#8) -- the chip-list DISPLAY row's own gap, mirrored from the
|
|
3261
3270
|
// qvism recipe's `chipList` slot (`packages/qvism-preset/src/recipes/data-table.ts`'s
|
|
3262
3271
|
// `CHIP_GAP`, measured live off Attio at 3px between chips). Kept as a literal here
|
|
@@ -3289,7 +3298,7 @@ const CHIP_LIST_GAP_PX = 3;
|
|
|
3289
3298
|
* times, not just while a `ResizeObserver` fires, because widening the column back
|
|
3290
3299
|
* out needs to know the width of chips currently hidden behind "+N" to decide
|
|
3291
3300
|
* whether they now fit again.
|
|
3292
|
-
*/ function ChipListCell({ value, className, chipClassName, overflowClassName }) {
|
|
3301
|
+
*/ function ChipListCell({ value, className, chipClassName, overflowClassName, chipOptions }) {
|
|
3293
3302
|
const tags = Array.isArray(value) ? value.filter((tag)=>!!tag) : [];
|
|
3294
3303
|
const containerRef = React.useRef(null);
|
|
3295
3304
|
const measureRef = React.useRef(null);
|
|
@@ -3338,6 +3347,7 @@ const CHIP_LIST_GAP_PX = 3;
|
|
|
3338
3347
|
children: [
|
|
3339
3348
|
tags.slice(0, clampedVisible).map((tag)=>/*#__PURE__*/ jsx(SwatchChip, {
|
|
3340
3349
|
value: tag,
|
|
3350
|
+
...optionProps(chipOptions, tag),
|
|
3341
3351
|
className: chipClassName
|
|
3342
3352
|
}, tag)),
|
|
3343
3353
|
overflowCount > 0 && /*#__PURE__*/ jsxs("span", {
|
|
@@ -3358,6 +3368,7 @@ const CHIP_LIST_GAP_PX = 3;
|
|
|
3358
3368
|
},
|
|
3359
3369
|
children: tags.map((tag)=>/*#__PURE__*/ jsx(SwatchChip, {
|
|
3360
3370
|
value: tag,
|
|
3371
|
+
...optionProps(chipOptions, tag),
|
|
3361
3372
|
className: chipClassName
|
|
3362
3373
|
}, tag))
|
|
3363
3374
|
}),
|
|
@@ -4120,7 +4131,45 @@ const TextFieldTextarea = /*#__PURE__*/ forwardRef(({ className, autoresize = tr
|
|
|
4120
4131
|
});
|
|
4121
4132
|
TextFieldTextarea.displayName = "TextFieldTextarea";
|
|
4122
4133
|
|
|
4123
|
-
__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))}");
|
|
4134
|
+
// Row-narrowing for the toolbar's search box -- split out of DataTable.tsx the way
|
|
4135
|
+
// cells.tsx splits out cell-type rendering: a self-contained, independently testable
|
|
4136
|
+
// concern DataTable.tsx just calls, rather than inline `.filter()` calls piling up in
|
|
4137
|
+
// the same component that also owns markup. The toolbar's typed Filter CONDITIONS
|
|
4138
|
+
// (field/operator/value chips, DATATABLE-ATTIO-SPEC.md's Attio/crisp model) live in
|
|
4139
|
+
// `toolbar-conditions.tsx` instead, alongside the Sort/Filter chrome that manages
|
|
4140
|
+
// them -- this file is search only now; the old per-column "is/is not" picker
|
|
4141
|
+
// (`matchesFilter`/`DataTableFilterState`) is gone, replaced by that toolbar model.
|
|
4142
|
+
/**
|
|
4143
|
+
* A column's `value(row)` if it supplies one, else the raw field at `column.key` --
|
|
4144
|
+
* the single accessor sort/search/filter/export all read through
|
|
4145
|
+
* (DATATABLE-ATTIO-SPEC.md's Column API), so a consumer only teaches the table how to
|
|
4146
|
+
* read a value ONCE rather than once per feature.
|
|
4147
|
+
*/ function getColumnValue(column, row) {
|
|
4148
|
+
return column.value ? column.value(row) : row[column.key];
|
|
4149
|
+
}
|
|
4150
|
+
/**
|
|
4151
|
+
* Case-insensitive substring match against a row's stringified value -- crisp's own
|
|
4152
|
+
* `applyFilters` "contains" semantics (`tabletoolbar.tsx`), reused here for the
|
|
4153
|
+
* toolbar's single free-text query. `null`/`undefined` never match a non-empty query --
|
|
4154
|
+
* there is no text to search.
|
|
4155
|
+
*/ function matchesSearch(value, query) {
|
|
4156
|
+
if (!query) return true;
|
|
4157
|
+
if (value == null) return false;
|
|
4158
|
+
return String(value).toLowerCase().includes(query.toLowerCase());
|
|
4159
|
+
}
|
|
4160
|
+
/**
|
|
4161
|
+
* The toolbar's search query -- an OR across `searchable` columns, matching GRC's own
|
|
4162
|
+
* `useFilteredRows`. The toolbar's own typed Filter conditions apply SEPARATELY, as a
|
|
4163
|
+
* second pass over this function's result (`toolbar-conditions.tsx`'s
|
|
4164
|
+
* `applyToolbarFilters`, called by `DataTable.tsx` right after this) -- narrowing what
|
|
4165
|
+
* the search box already found, not the other way round.
|
|
4166
|
+
*/ function getVisibleRows(data, columns, query) {
|
|
4167
|
+
const searchableColumns = columns.filter((column)=>column.searchable);
|
|
4168
|
+
if (!query) return data;
|
|
4169
|
+
return data.filter((row)=>searchableColumns.some((column)=>matchesSearch(getColumnValue(column, row), query)));
|
|
4170
|
+
}
|
|
4171
|
+
|
|
4172
|
+
__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))}");
|
|
4124
4173
|
|
|
4125
4174
|
const createClassName = (className, variants, compoundVariants = [])=>{
|
|
4126
4175
|
const variantKeys = Object.keys(variants);
|
|
@@ -4228,16 +4277,24 @@ const dataTableSlotNames = [
|
|
|
4228
4277
|
"seed-data-table__chipOverflow"
|
|
4229
4278
|
],
|
|
4230
4279
|
[
|
|
4231
|
-
"
|
|
4232
|
-
"seed-data-
|
|
4280
|
+
"chipPicker",
|
|
4281
|
+
"seed-data-table__chipPicker"
|
|
4282
|
+
],
|
|
4283
|
+
[
|
|
4284
|
+
"chipPickerList",
|
|
4285
|
+
"seed-data-table__chipPickerList"
|
|
4286
|
+
],
|
|
4287
|
+
[
|
|
4288
|
+
"chipPickerRow",
|
|
4289
|
+
"seed-data-table__chipPickerRow"
|
|
4233
4290
|
],
|
|
4234
4291
|
[
|
|
4235
|
-
"
|
|
4236
|
-
"seed-data-
|
|
4292
|
+
"chipPickerBox",
|
|
4293
|
+
"seed-data-table__chipPickerBox"
|
|
4237
4294
|
],
|
|
4238
4295
|
[
|
|
4239
|
-
"
|
|
4240
|
-
"seed-data-
|
|
4296
|
+
"chipPickerCreate",
|
|
4297
|
+
"seed-data-table__chipPickerCreate"
|
|
4241
4298
|
],
|
|
4242
4299
|
[
|
|
4243
4300
|
"expandOverlay",
|
|
@@ -4856,94 +4913,154 @@ function RatingEditor({ column, value, pending, onCommit }) {
|
|
|
4856
4913
|
});
|
|
4857
4914
|
}
|
|
4858
4915
|
////////////////////////////////////////////////////////////////////////////////////
|
|
4859
|
-
// -- editable: "chip-list"
|
|
4860
|
-
//
|
|
4861
|
-
//
|
|
4862
|
-
//
|
|
4863
|
-
//
|
|
4864
|
-
//
|
|
4865
|
-
//
|
|
4866
|
-
//
|
|
4867
|
-
//
|
|
4868
|
-
//
|
|
4869
|
-
// `
|
|
4870
|
-
//
|
|
4871
|
-
//
|
|
4872
|
-
//
|
|
4873
|
-
//
|
|
4874
|
-
//
|
|
4875
|
-
// comment): `JSON.stringify(nextTags)`, which the consumer's `onEdit` parses back
|
|
4876
|
-
// -- crisp/GRC's contract stays "one string in, no typed union", not a second
|
|
4877
|
-
// commit shape invented for just this column.
|
|
4916
|
+
// -- editable: "chip-list" -- Attio's multi-select popover (0.14.0; replaces the
|
|
4917
|
+
// 0.10.0-0.13.0 free-text "Add..." tag adder, which stacked an empty input over the
|
|
4918
|
+
// chips and read as broken on an empty cell). Measured off Attio's Company
|
|
4919
|
+
// "Categories" cell: a search field pinned on top, below it a scrolling list of the
|
|
4920
|
+
// column's OPTIONS, each drawn as its own colored chip with a checkbox on the RIGHT
|
|
4921
|
+
// edge (filled blue when the tag is on this row); clicking a row toggles that tag
|
|
4922
|
+
// and the popover STAYS OPEN across toggles; typing filters the list; text matching
|
|
4923
|
+
// no option offers a "Create '<text>'" row (freeform tag columns, e.g. tether's
|
|
4924
|
+
// Labels). `body-cells.tsx`'s `DataTableBodyCell` opens this inside a portaled
|
|
4925
|
+
// `expandOverlay` on a plain click and closes it on blur/outside-click/Escape; it
|
|
4926
|
+
// tracks its own `overlayOpen` rather than `useDataTableEdit`'s `isEditing` gate,
|
|
4927
|
+
// since a sync commit closes `editingCell` on the first toggle.
|
|
4928
|
+
//
|
|
4929
|
+
// Commit contract is unchanged: every toggle/create commits the FULL next array as
|
|
4930
|
+
// `JSON.stringify(nextTags)` through the one-string `onCommit`, which the consumer's
|
|
4931
|
+
// `onEdit` parses back.
|
|
4878
4932
|
//
|
|
4879
|
-
//
|
|
4880
|
-
//
|
|
4881
|
-
//
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
4933
|
+
// Option source: `column.chipOptions` (value/label?/color?); tags already on the row
|
|
4934
|
+
// but absent from it are still listed (so they can be unchecked); with no
|
|
4935
|
+
// `chipOptions` at all, the distinct tags across the table's rows.
|
|
4936
|
+
/** Adds `tag` when absent, removes it when present -- the picker's one toggle. */ function toggleTag(tags, tag) {
|
|
4937
|
+
return tags.includes(tag) ? tags.filter((existing)=>existing !== tag) : [
|
|
4938
|
+
...tags,
|
|
4939
|
+
tag
|
|
4940
|
+
];
|
|
4941
|
+
}
|
|
4942
|
+
/** The option list a `chip-list` popover shows: declared `chipOptions` first, then any
|
|
4943
|
+
* selected tag not declared, then (only when nothing was declared) the distinct tags
|
|
4944
|
+
* across `rows`. */ function buildChipPickerOptions(column, tags, rows) {
|
|
4945
|
+
const seen = new Set();
|
|
4946
|
+
const out = [];
|
|
4947
|
+
function push(option) {
|
|
4948
|
+
if (!option.value || seen.has(option.value)) return;
|
|
4949
|
+
seen.add(option.value);
|
|
4950
|
+
out.push(option);
|
|
4951
|
+
}
|
|
4952
|
+
for (const option of column.chipOptions ?? [])push(option);
|
|
4953
|
+
for (const tag of tags)push({
|
|
4954
|
+
value: tag
|
|
4955
|
+
});
|
|
4956
|
+
if (!column.chipOptions) {
|
|
4957
|
+
const distinct = new Set();
|
|
4958
|
+
for (const row of rows){
|
|
4959
|
+
const raw = getColumnValue(column, row);
|
|
4960
|
+
if (Array.isArray(raw)) {
|
|
4961
|
+
for (const tag of raw)if (typeof tag === "string") distinct.add(tag);
|
|
4962
|
+
}
|
|
4963
|
+
}
|
|
4964
|
+
for (const tag of [
|
|
4965
|
+
...distinct
|
|
4966
|
+
].sort((x, y)=>x.localeCompare(y)))push({
|
|
4967
|
+
value: tag
|
|
4968
|
+
});
|
|
4969
|
+
}
|
|
4970
|
+
return out;
|
|
4971
|
+
}
|
|
4972
|
+
function ChipListEditor({ column, value, pending, onCommit, classNames, allRows = [] }) {
|
|
4885
4973
|
const tags = Array.isArray(value) ? value.filter((tag)=>!!tag) : [];
|
|
4886
|
-
const
|
|
4974
|
+
const built = buildChipPickerOptions(column, tags, allRows);
|
|
4975
|
+
// Options only ever GROW while the popover is open: with the row-derived fallback,
|
|
4976
|
+
// unchecking a tag that no other row carries would otherwise drop it from the list
|
|
4977
|
+
// and leave no way to re-check it.
|
|
4978
|
+
const knownRef = React.useRef([]);
|
|
4979
|
+
const known = knownRef.current;
|
|
4980
|
+
for (const option of built){
|
|
4981
|
+
const at = known.findIndex((entry)=>entry.value === option.value);
|
|
4982
|
+
if (at === -1) known.push(option);
|
|
4983
|
+
else known[at] = option;
|
|
4984
|
+
}
|
|
4985
|
+
const options = [
|
|
4986
|
+
...known
|
|
4987
|
+
];
|
|
4988
|
+
const optionText = React.useCallback((option)=>option.label ?? option.value, []);
|
|
4989
|
+
const { query, setQuery, filtered } = useSelectSearch(options, optionText);
|
|
4990
|
+
const trimmed = query.trim();
|
|
4991
|
+
const canCreate = column.chipCreatable !== false && trimmed !== "" && !options.some((option)=>option.value.toLowerCase() === trimmed.toLowerCase() || optionText(option).toLowerCase() === trimmed.toLowerCase());
|
|
4887
4992
|
function commitTags(next) {
|
|
4888
4993
|
onCommit(JSON.stringify(next));
|
|
4889
4994
|
}
|
|
4890
|
-
function
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
if (!tag || tags.includes(tag)) return;
|
|
4894
|
-
commitTags([
|
|
4895
|
-
...tags,
|
|
4896
|
-
tag
|
|
4897
|
-
]);
|
|
4898
|
-
}
|
|
4899
|
-
function removeTag(tag) {
|
|
4900
|
-
commitTags(tags.filter((existing)=>existing !== tag));
|
|
4995
|
+
function create() {
|
|
4996
|
+
setQuery("");
|
|
4997
|
+
commitTags(toggleTag(tags, trimmed));
|
|
4901
4998
|
}
|
|
4902
|
-
return(// biome-ignore lint/a11y/noStaticElementInteractions: not a widget -- this
|
|
4903
|
-
/*#__PURE__*/ jsxs("
|
|
4904
|
-
className: classNames.
|
|
4999
|
+
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.
|
|
5000
|
+
/*#__PURE__*/ jsxs("div", {
|
|
5001
|
+
className: classNames.chipPicker,
|
|
4905
5002
|
onClick: (event)=>event.stopPropagation(),
|
|
4906
5003
|
children: [
|
|
4907
|
-
|
|
4908
|
-
value: tag,
|
|
4909
|
-
className: classNames.chip,
|
|
4910
|
-
children: /*#__PURE__*/ jsx("button", {
|
|
4911
|
-
type: "button",
|
|
4912
|
-
disabled: pending,
|
|
4913
|
-
"aria-label": `Remove ${tag}`,
|
|
4914
|
-
className: classNames.chipRemove,
|
|
4915
|
-
onClick: ()=>removeTag(tag),
|
|
4916
|
-
children: /*#__PURE__*/ jsx(IconXmarkLine_default, {
|
|
4917
|
-
size: 10
|
|
4918
|
-
})
|
|
4919
|
-
})
|
|
4920
|
-
}, tag)),
|
|
4921
|
-
/*#__PURE__*/ jsx("input", {
|
|
4922
|
-
// 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.
|
|
5004
|
+
/*#__PURE__*/ jsx(SelectSearchField, {
|
|
4923
5005
|
autoFocus: true,
|
|
4924
|
-
|
|
4925
|
-
|
|
4926
|
-
|
|
4927
|
-
|
|
4928
|
-
"aria-label": `Add tag to ${column.key}`,
|
|
4929
|
-
onChange: (event)=>setDraft(event.target.value),
|
|
5006
|
+
value: query,
|
|
5007
|
+
onChange: setQuery,
|
|
5008
|
+
placeholder: column.editorSearchPlaceholder ?? "Search…",
|
|
5009
|
+
"aria-label": `Search ${column.key}`,
|
|
4930
5010
|
onKeyDown: (event)=>{
|
|
4931
|
-
|
|
4932
|
-
|
|
4933
|
-
|
|
4934
|
-
|
|
4935
|
-
|
|
4936
|
-
// never reaches the row's own click/keyboard handling.
|
|
4937
|
-
if (event.key === "Escape") return;
|
|
4938
|
-
event.stopPropagation();
|
|
4939
|
-
if (event.key === "Enter") {
|
|
4940
|
-
event.preventDefault();
|
|
4941
|
-
addTag();
|
|
4942
|
-
} else if (event.key === "Backspace" && draft === "" && tags.length > 0) {
|
|
4943
|
-
removeTag(tags[tags.length - 1]);
|
|
4944
|
-
}
|
|
5011
|
+
if (event.key !== "Enter") return;
|
|
5012
|
+
event.preventDefault();
|
|
5013
|
+
if (pending) return;
|
|
5014
|
+
if (canCreate) create();
|
|
5015
|
+
else if (trimmed && filtered.length > 0) commitTags(toggleTag(tags, filtered[0].value));
|
|
4945
5016
|
}
|
|
4946
5017
|
}),
|
|
5018
|
+
/*#__PURE__*/ jsxs("div", {
|
|
5019
|
+
className: classNames.chipPickerList,
|
|
5020
|
+
role: "group",
|
|
5021
|
+
"aria-label": `${column.key} options`,
|
|
5022
|
+
children: [
|
|
5023
|
+
filtered.map((option)=>{
|
|
5024
|
+
const checked = tags.includes(option.value);
|
|
5025
|
+
return /*#__PURE__*/ jsxs("button", {
|
|
5026
|
+
type: "button",
|
|
5027
|
+
role: "checkbox",
|
|
5028
|
+
"aria-checked": checked,
|
|
5029
|
+
disabled: pending,
|
|
5030
|
+
className: classNames.chipPickerRow,
|
|
5031
|
+
// Keep focus in the search field so typing keeps filtering after a toggle.
|
|
5032
|
+
onMouseDown: (event)=>event.preventDefault(),
|
|
5033
|
+
onClick: ()=>commitTags(toggleTag(tags, option.value)),
|
|
5034
|
+
children: [
|
|
5035
|
+
/*#__PURE__*/ jsx(SwatchChip, {
|
|
5036
|
+
value: option.value,
|
|
5037
|
+
label: option.label,
|
|
5038
|
+
color: option.color,
|
|
5039
|
+
className: classNames.chip
|
|
5040
|
+
}),
|
|
5041
|
+
/*#__PURE__*/ jsx("span", {
|
|
5042
|
+
className: classNames.chipPickerBox,
|
|
5043
|
+
"data-checked": checked ? "" : undefined,
|
|
5044
|
+
children: checked && /*#__PURE__*/ jsx(IconCheckmarkFatFill_default, {
|
|
5045
|
+
"aria-hidden": "true"
|
|
5046
|
+
})
|
|
5047
|
+
})
|
|
5048
|
+
]
|
|
5049
|
+
}, option.value);
|
|
5050
|
+
}),
|
|
5051
|
+
canCreate && /*#__PURE__*/ jsx("button", {
|
|
5052
|
+
type: "button",
|
|
5053
|
+
disabled: pending,
|
|
5054
|
+
className: classNames.chipPickerCreate,
|
|
5055
|
+
onMouseDown: (event)=>event.preventDefault(),
|
|
5056
|
+
onClick: create,
|
|
5057
|
+
children: `Create '${trimmed}'`
|
|
5058
|
+
}),
|
|
5059
|
+
!canCreate && filtered.length === 0 && /*#__PURE__*/ jsx(SelectSearchEmpty, {
|
|
5060
|
+
children: column.editorEmptyLabel ?? "No results"
|
|
5061
|
+
})
|
|
5062
|
+
]
|
|
5063
|
+
}),
|
|
4947
5064
|
pending && /*#__PURE__*/ jsx(EditPendingIndicator, {})
|
|
4948
5065
|
]
|
|
4949
5066
|
}));
|
|
@@ -5032,44 +5149,6 @@ function CellExpandOverlay({ className, anchorRef, contentRef, children }) {
|
|
|
5032
5149
|
}), document.body);
|
|
5033
5150
|
}
|
|
5034
5151
|
|
|
5035
|
-
// Row-narrowing for the toolbar's search box -- split out of DataTable.tsx the way
|
|
5036
|
-
// cells.tsx splits out cell-type rendering: a self-contained, independently testable
|
|
5037
|
-
// concern DataTable.tsx just calls, rather than inline `.filter()` calls piling up in
|
|
5038
|
-
// the same component that also owns markup. The toolbar's typed Filter CONDITIONS
|
|
5039
|
-
// (field/operator/value chips, DATATABLE-ATTIO-SPEC.md's Attio/crisp model) live in
|
|
5040
|
-
// `toolbar-conditions.tsx` instead, alongside the Sort/Filter chrome that manages
|
|
5041
|
-
// them -- this file is search only now; the old per-column "is/is not" picker
|
|
5042
|
-
// (`matchesFilter`/`DataTableFilterState`) is gone, replaced by that toolbar model.
|
|
5043
|
-
/**
|
|
5044
|
-
* A column's `value(row)` if it supplies one, else the raw field at `column.key` --
|
|
5045
|
-
* the single accessor sort/search/filter/export all read through
|
|
5046
|
-
* (DATATABLE-ATTIO-SPEC.md's Column API), so a consumer only teaches the table how to
|
|
5047
|
-
* read a value ONCE rather than once per feature.
|
|
5048
|
-
*/ function getColumnValue(column, row) {
|
|
5049
|
-
return column.value ? column.value(row) : row[column.key];
|
|
5050
|
-
}
|
|
5051
|
-
/**
|
|
5052
|
-
* Case-insensitive substring match against a row's stringified value -- crisp's own
|
|
5053
|
-
* `applyFilters` "contains" semantics (`tabletoolbar.tsx`), reused here for the
|
|
5054
|
-
* toolbar's single free-text query. `null`/`undefined` never match a non-empty query --
|
|
5055
|
-
* there is no text to search.
|
|
5056
|
-
*/ function matchesSearch(value, query) {
|
|
5057
|
-
if (!query) return true;
|
|
5058
|
-
if (value == null) return false;
|
|
5059
|
-
return String(value).toLowerCase().includes(query.toLowerCase());
|
|
5060
|
-
}
|
|
5061
|
-
/**
|
|
5062
|
-
* The toolbar's search query -- an OR across `searchable` columns, matching GRC's own
|
|
5063
|
-
* `useFilteredRows`. The toolbar's own typed Filter conditions apply SEPARATELY, as a
|
|
5064
|
-
* second pass over this function's result (`toolbar-conditions.tsx`'s
|
|
5065
|
-
* `applyToolbarFilters`, called by `DataTable.tsx` right after this) -- narrowing what
|
|
5066
|
-
* the search box already found, not the other way round.
|
|
5067
|
-
*/ function getVisibleRows(data, columns, query) {
|
|
5068
|
-
const searchableColumns = columns.filter((column)=>column.searchable);
|
|
5069
|
-
if (!query) return data;
|
|
5070
|
-
return data.filter((row)=>searchableColumns.some((column)=>matchesSearch(getColumnValue(column, row), query)));
|
|
5071
|
-
}
|
|
5072
|
-
|
|
5073
5152
|
// Feature C (#12) -- the click-to-expand gate: measures whether a cell's rendered
|
|
5074
5153
|
// content is ACTUALLY truncated right now, so a single click only opens the
|
|
5075
5154
|
// anchored overlay (editors.tsx's `CellExpandOverlay`) when there's real hidden
|
|
@@ -5135,7 +5214,10 @@ function isCellTruncated(cell) {
|
|
|
5135
5214
|
* `overflow: visible` on every element in between and regardless of how high its
|
|
5136
5215
|
* `z-index` is raised -- neither of which is a stacking-context or overflow bug
|
|
5137
5216
|
* fixable from the INSIDE. A portal sidesteps it entirely by not being a
|
|
5138
|
-
* descendant of the sticky `<td>` at all once mounted. */
|
|
5217
|
+
* descendant of the sticky `<td>` at all once mounted. */ /** The table's full `data`, so an editable chip-list column with no `chipOptions` can
|
|
5218
|
+
* fall back to the distinct tags already present across rows. */ const DataTableRowsContext = /*#__PURE__*/ React.createContext([]);
|
|
5219
|
+
/** Attio's multi-select popover is wider than a narrow tags column. */ const CHIP_PICKER_MIN_WIDTH = 240;
|
|
5220
|
+
function isChipListEditable(column) {
|
|
5139
5221
|
return !!column.editable && column.type === "chip-list";
|
|
5140
5222
|
}
|
|
5141
5223
|
function ColumnBodyCells({ columns, row, classNames, locale, selectable, stickyFirst, stickyLast, cellContextMenu, onViewEditHistory, cellContextMenuItems }) {
|
|
@@ -5195,6 +5277,7 @@ function ColumnBodyCells({ columns, row, classNames, locale, selectable, stickyF
|
|
|
5195
5277
|
const [contextMenuOpen, setContextMenuOpen] = React.useState(false);
|
|
5196
5278
|
const alwaysLive = isAlwaysLiveEditable(column);
|
|
5197
5279
|
const chipListEditable = isChipListEditable(column);
|
|
5280
|
+
const allRows = React.useContext(DataTableRowsContext);
|
|
5198
5281
|
// A gated `editable` column (everything except the always-live widgets AND the
|
|
5199
5282
|
// click-to-edit chip-list) opens on double-click -- Attio's own measured gesture
|
|
5200
5283
|
// (crisp's #411), matched here rather than a single click, which stays "select
|
|
@@ -5224,7 +5307,10 @@ function ColumnBodyCells({ columns, row, classNames, locale, selectable, stickyF
|
|
|
5224
5307
|
top: rect.bottom,
|
|
5225
5308
|
insetInlineStart: rect.left,
|
|
5226
5309
|
insetInlineEnd: "auto",
|
|
5227
|
-
minWidth: rect.width,
|
|
5310
|
+
minWidth: Math.max(rect.width, CHIP_PICKER_MIN_WIDTH),
|
|
5311
|
+
// The multi-select popover owns its own inner padding (search field + option
|
|
5312
|
+
// rows inset themselves); the overlay's cell-editor padding would double it.
|
|
5313
|
+
padding: 0,
|
|
5228
5314
|
// Both override the SAME `expandOverlay` class properties this box also
|
|
5229
5315
|
// carries (`className={classNames.expandOverlay}`, below) -- that class's
|
|
5230
5316
|
// `minHeight: calc(100% + 2px)` resolves against an ANCHORED box's own
|
|
@@ -5371,7 +5457,10 @@ function ColumnBodyCells({ columns, row, classNames, locale, selectable, stickyF
|
|
|
5371
5457
|
chipListEditorOpen,
|
|
5372
5458
|
measurePopoverPosition
|
|
5373
5459
|
]);
|
|
5374
|
-
|
|
5460
|
+
// Never for a chip-list cell: its picker is its own portaled popover, and the
|
|
5461
|
+
// in-cell overlay box would show for the first frame only (a sync commit closes
|
|
5462
|
+
// `isEditing` on the first toggle) and overlap the popover's top edge.
|
|
5463
|
+
const overlayActive = overlayOpen && !chipListEditable && (alwaysLive || isEditing(row.id, column.key) || isPeeking(row.id, column.key));
|
|
5375
5464
|
const rawValue = getColumnValue(column, row);
|
|
5376
5465
|
const pending = isPending(row.id, column.key);
|
|
5377
5466
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
@@ -5429,7 +5518,8 @@ function ColumnBodyCells({ columns, row, classNames, locale, selectable, stickyF
|
|
|
5429
5518
|
value: resolveEditValue(column, row, rawValue),
|
|
5430
5519
|
pending: pending,
|
|
5431
5520
|
onCommit: (value)=>commitEdit(row.id, column.key, value),
|
|
5432
|
-
classNames: classNames
|
|
5521
|
+
classNames: classNames,
|
|
5522
|
+
allRows: allRows
|
|
5433
5523
|
})
|
|
5434
5524
|
}), document.body)
|
|
5435
5525
|
]
|
|
@@ -5483,7 +5573,8 @@ function ColumnBodyCells({ columns, row, classNames, locale, selectable, stickyF
|
|
|
5483
5573
|
value: rawValue,
|
|
5484
5574
|
className: classNames.chipList,
|
|
5485
5575
|
chipClassName: classNames.chip,
|
|
5486
|
-
overflowClassName: classNames.chipOverflow
|
|
5576
|
+
overflowClassName: classNames.chipOverflow,
|
|
5577
|
+
chipOptions: column.chipOptions
|
|
5487
5578
|
});
|
|
5488
5579
|
} else if (column.editable && isEditing(rowId, column.key)) {
|
|
5489
5580
|
if (column.editor === "select") {
|
|
@@ -5600,7 +5691,8 @@ function DisplayCellContent({ column, row, value, classNames, locale }) {
|
|
|
5600
5691
|
value: value,
|
|
5601
5692
|
className: classNames.chipList,
|
|
5602
5693
|
chipClassName: classNames.chip,
|
|
5603
|
-
overflowClassName: classNames.chipOverflow
|
|
5694
|
+
overflowClassName: classNames.chipOverflow,
|
|
5695
|
+
chipOptions: column.chipOptions
|
|
5604
5696
|
});
|
|
5605
5697
|
case "number":
|
|
5606
5698
|
return /*#__PURE__*/ jsx(Fragment, {
|
|
@@ -12020,223 +12112,226 @@ function DataTableInner(props, ref) {
|
|
|
12020
12112
|
const totalCols = columns.length + (selectable ? 1 : 0);
|
|
12021
12113
|
return /*#__PURE__*/ jsx(ClassNamesProvider, {
|
|
12022
12114
|
value: classNames,
|
|
12023
|
-
children: /*#__PURE__*/
|
|
12024
|
-
|
|
12025
|
-
|
|
12026
|
-
|
|
12027
|
-
|
|
12028
|
-
|
|
12029
|
-
|
|
12030
|
-
|
|
12031
|
-
|
|
12032
|
-
|
|
12033
|
-
|
|
12034
|
-
|
|
12035
|
-
|
|
12036
|
-
|
|
12037
|
-
|
|
12038
|
-
|
|
12039
|
-
|
|
12040
|
-
|
|
12041
|
-
|
|
12042
|
-
|
|
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
|
-
onColumnsChange
|
|
12072
|
-
|
|
12073
|
-
|
|
12074
|
-
|
|
12075
|
-
|
|
12076
|
-
placeholder: searchPlaceholder,
|
|
12077
|
-
label: searchLabel
|
|
12078
|
-
}),
|
|
12079
|
-
/*#__PURE__*/ jsx(SortControl, {
|
|
12080
|
-
columns: columns
|
|
12081
|
-
}),
|
|
12082
|
-
/*#__PURE__*/ jsx(FilterControl, {
|
|
12083
|
-
columns: columns
|
|
12084
|
-
}),
|
|
12085
|
-
(showCount || toolbarActions) && /*#__PURE__*/ jsxs(DataTableToolbarEnd, {
|
|
12086
|
-
children: [
|
|
12087
|
-
toolbarActions,
|
|
12088
|
-
showCount && /*#__PURE__*/ jsx(RowCount, {
|
|
12089
|
-
shown: sortedData.length,
|
|
12090
|
-
total: data.length,
|
|
12091
|
-
countLabel: countLabel
|
|
12092
|
-
})
|
|
12093
|
-
]
|
|
12094
|
-
})
|
|
12095
|
-
]
|
|
12096
|
-
}),
|
|
12097
|
-
/*#__PURE__*/ jsx(DataTableScrollBody, {
|
|
12098
|
-
scrollProps: scrollProps,
|
|
12099
|
-
virtualized: virtualized,
|
|
12100
|
-
children: /*#__PURE__*/ jsxs(DataTableTable, {
|
|
12101
|
-
"aria-rowcount": virtualized ? sortedData.length + 1 : undefined,
|
|
12115
|
+
children: /*#__PURE__*/ jsx(DataTableRowsContext.Provider, {
|
|
12116
|
+
value: data,
|
|
12117
|
+
children: /*#__PURE__*/ jsxs(DataTableRoot, {
|
|
12118
|
+
ref: ref,
|
|
12119
|
+
className: clsx(classNames.root, className),
|
|
12120
|
+
rowIds: rowIds,
|
|
12121
|
+
selectable: selectable,
|
|
12122
|
+
selectedIds: selectedIds,
|
|
12123
|
+
defaultSelectedIds: defaultSelectedIds,
|
|
12124
|
+
onSelectionChange: onSelectionChange,
|
|
12125
|
+
sort: sort,
|
|
12126
|
+
defaultSort: defaultSort,
|
|
12127
|
+
onSortChange: handleSortChange,
|
|
12128
|
+
query: resolvedQuery,
|
|
12129
|
+
onQueryChange: handleQueryChange,
|
|
12130
|
+
toolbarSorts: resolvedToolbarSorts,
|
|
12131
|
+
onToolbarSortsChange: handleToolbarSortsChange,
|
|
12132
|
+
toolbarFilters: resolvedToolbarFilters,
|
|
12133
|
+
onToolbarFiltersChange: handleToolbarFiltersChange,
|
|
12134
|
+
columnKeys: columnKeys,
|
|
12135
|
+
actionsColumnKey: actionsColumnKey,
|
|
12136
|
+
columnOrder: columnOrder,
|
|
12137
|
+
defaultColumnOrder: defaultColumnOrder,
|
|
12138
|
+
onColumnOrderChange: onColumnOrderChange,
|
|
12139
|
+
hiddenColumnKeys: hiddenColumnKeys,
|
|
12140
|
+
defaultHiddenColumnKeys: defaultHiddenColumnKeys,
|
|
12141
|
+
onHiddenColumnKeysChange: onHiddenColumnKeysChange,
|
|
12142
|
+
columnWidths: columnWidths,
|
|
12143
|
+
defaultColumnWidths: defaultColumnWidths,
|
|
12144
|
+
onColumnWidthsChange: onColumnWidthsChange,
|
|
12145
|
+
columnLabels: columnLabels,
|
|
12146
|
+
defaultColumnLabels: defaultColumnLabels,
|
|
12147
|
+
onColumnLabelsChange: onColumnLabelsChange,
|
|
12148
|
+
pinnedColumnKeys: pinnedColumnKeys,
|
|
12149
|
+
defaultPinnedColumnKeys: defaultPinnedColumnKeys,
|
|
12150
|
+
onPinnedColumnKeysChange: onPinnedColumnKeysChange,
|
|
12151
|
+
columnCalcOps: columnCalcOps,
|
|
12152
|
+
defaultColumnCalcOps: defaultColumnCalcOps,
|
|
12153
|
+
onColumnCalcOpsChange: onColumnCalcOpsChange,
|
|
12154
|
+
onEdit: onEdit,
|
|
12155
|
+
onLoadMore: onLoadMore,
|
|
12156
|
+
hasMore: hasMore,
|
|
12157
|
+
loadingMore: loadingMore,
|
|
12158
|
+
virtualized: virtualized,
|
|
12159
|
+
rowHeight: rowHeight,
|
|
12160
|
+
overscan: overscan,
|
|
12161
|
+
...restProps,
|
|
12162
|
+
children: [
|
|
12163
|
+
onColumnsChange && /*#__PURE__*/ jsx(ColumnsChangeEffect, {
|
|
12164
|
+
columns: columns,
|
|
12165
|
+
onColumnsChange: onColumnsChange
|
|
12166
|
+
}),
|
|
12167
|
+
showToolbar && /*#__PURE__*/ jsxs(DataTableToolbar, {
|
|
12102
12168
|
children: [
|
|
12103
|
-
/*#__PURE__*/ jsx(
|
|
12104
|
-
|
|
12105
|
-
|
|
12106
|
-
|
|
12169
|
+
searchable && /*#__PURE__*/ jsx(SearchBox, {
|
|
12170
|
+
placeholder: searchPlaceholder,
|
|
12171
|
+
label: searchLabel
|
|
12172
|
+
}),
|
|
12173
|
+
/*#__PURE__*/ jsx(SortControl, {
|
|
12174
|
+
columns: columns
|
|
12107
12175
|
}),
|
|
12108
|
-
/*#__PURE__*/
|
|
12176
|
+
/*#__PURE__*/ jsx(FilterControl, {
|
|
12177
|
+
columns: columns
|
|
12178
|
+
}),
|
|
12179
|
+
(showCount || toolbarActions) && /*#__PURE__*/ jsxs(DataTableToolbarEnd, {
|
|
12109
12180
|
children: [
|
|
12110
|
-
|
|
12111
|
-
|
|
12112
|
-
|
|
12113
|
-
|
|
12114
|
-
|
|
12115
|
-
indeterminateIcon: selectionIndeterminateIcon ?? DEFAULT_INDETERMINATE_ICON
|
|
12116
|
-
})
|
|
12117
|
-
}),
|
|
12118
|
-
/*#__PURE__*/ jsx(ColumnHeaderCells, {
|
|
12119
|
-
columns: columns,
|
|
12120
|
-
columnMenu: columnMenu,
|
|
12121
|
-
reorderable: reorderable,
|
|
12122
|
-
resizable: resizable,
|
|
12123
|
-
sortIcon: sortIcon,
|
|
12124
|
-
selectable: !!selectable,
|
|
12125
|
-
stickyFirst: stickyFirst,
|
|
12126
|
-
stickyLast: resolvedStickyLast
|
|
12181
|
+
toolbarActions,
|
|
12182
|
+
showCount && /*#__PURE__*/ jsx(RowCount, {
|
|
12183
|
+
shown: sortedData.length,
|
|
12184
|
+
total: data.length,
|
|
12185
|
+
countLabel: countLabel
|
|
12127
12186
|
})
|
|
12128
12187
|
]
|
|
12129
|
-
})
|
|
12130
|
-
|
|
12131
|
-
|
|
12132
|
-
|
|
12133
|
-
|
|
12134
|
-
|
|
12135
|
-
|
|
12136
|
-
|
|
12188
|
+
})
|
|
12189
|
+
]
|
|
12190
|
+
}),
|
|
12191
|
+
/*#__PURE__*/ jsx(DataTableScrollBody, {
|
|
12192
|
+
scrollProps: scrollProps,
|
|
12193
|
+
virtualized: virtualized,
|
|
12194
|
+
children: /*#__PURE__*/ jsxs(DataTableTable, {
|
|
12195
|
+
"aria-rowcount": virtualized ? sortedData.length + 1 : undefined,
|
|
12196
|
+
children: [
|
|
12197
|
+
/*#__PURE__*/ jsx(DataTableColGroup, {
|
|
12198
|
+
columns: columns,
|
|
12199
|
+
selectable: !!selectable,
|
|
12200
|
+
stickyFirst: stickyFirst
|
|
12201
|
+
}),
|
|
12202
|
+
/*#__PURE__*/ jsxs(DataTableHeader, {
|
|
12203
|
+
children: [
|
|
12204
|
+
selectable && /*#__PURE__*/ jsx(SelectionHeaderCell, {
|
|
12205
|
+
stickyFirst: stickyFirst,
|
|
12206
|
+
children: /*#__PURE__*/ jsx(SelectAllCheckbox, {
|
|
12207
|
+
label: selectAllLabel,
|
|
12208
|
+
checkedIcon: selectionCheckedIcon ?? DEFAULT_CHECKED_ICON,
|
|
12209
|
+
indeterminateIcon: selectionIndeterminateIcon ?? DEFAULT_INDETERMINATE_ICON
|
|
12210
|
+
})
|
|
12211
|
+
}),
|
|
12212
|
+
/*#__PURE__*/ jsx(ColumnHeaderCells, {
|
|
12213
|
+
columns: columns,
|
|
12214
|
+
columnMenu: columnMenu,
|
|
12215
|
+
reorderable: reorderable,
|
|
12216
|
+
resizable: resizable,
|
|
12217
|
+
sortIcon: sortIcon,
|
|
12218
|
+
selectable: !!selectable,
|
|
12219
|
+
stickyFirst: stickyFirst,
|
|
12220
|
+
stickyLast: resolvedStickyLast
|
|
12137
12221
|
})
|
|
12138
|
-
|
|
12139
|
-
})
|
|
12140
|
-
|
|
12141
|
-
|
|
12142
|
-
children: /*#__PURE__*/ jsx(
|
|
12143
|
-
|
|
12144
|
-
children:
|
|
12222
|
+
]
|
|
12223
|
+
}),
|
|
12224
|
+
/*#__PURE__*/ jsx(DataTableBody, {
|
|
12225
|
+
children: loading ? /*#__PURE__*/ jsx("tr", {
|
|
12226
|
+
children: /*#__PURE__*/ jsx(DataTableCell, {
|
|
12227
|
+
colSpan: totalCols,
|
|
12228
|
+
children: /*#__PURE__*/ jsx(LoadingStateContent, {
|
|
12229
|
+
label: loadingLabel,
|
|
12230
|
+
classNames: classNames
|
|
12231
|
+
})
|
|
12145
12232
|
})
|
|
12146
|
-
})
|
|
12147
|
-
|
|
12148
|
-
|
|
12149
|
-
|
|
12150
|
-
|
|
12151
|
-
|
|
12152
|
-
|
|
12233
|
+
}) : error ? /*#__PURE__*/ jsx("tr", {
|
|
12234
|
+
children: /*#__PURE__*/ jsx(DataTableCell, {
|
|
12235
|
+
colSpan: totalCols,
|
|
12236
|
+
children: /*#__PURE__*/ jsx(EmptyStateContent, {
|
|
12237
|
+
classNames: classNames,
|
|
12238
|
+
children: error
|
|
12239
|
+
})
|
|
12153
12240
|
})
|
|
12154
|
-
})
|
|
12155
|
-
|
|
12156
|
-
children: [
|
|
12157
|
-
/*#__PURE__*/ jsx(WindowedRows, {
|
|
12158
|
-
rows: sortedData,
|
|
12159
|
-
virtualized: virtualized,
|
|
12241
|
+
}) : sortedData.length === 0 ? /*#__PURE__*/ jsx("tr", {
|
|
12242
|
+
children: /*#__PURE__*/ jsx(DataTableCell, {
|
|
12160
12243
|
colSpan: totalCols,
|
|
12161
|
-
children:
|
|
12162
|
-
|
|
12163
|
-
|
|
12164
|
-
|
|
12165
|
-
|
|
12166
|
-
|
|
12167
|
-
|
|
12168
|
-
|
|
12169
|
-
|
|
12170
|
-
|
|
12171
|
-
|
|
12172
|
-
|
|
12173
|
-
|
|
12174
|
-
|
|
12175
|
-
|
|
12176
|
-
|
|
12177
|
-
|
|
12178
|
-
|
|
12179
|
-
|
|
12244
|
+
children: /*#__PURE__*/ jsx(EmptyStateContent, {
|
|
12245
|
+
classNames: classNames,
|
|
12246
|
+
children: empty
|
|
12247
|
+
})
|
|
12248
|
+
})
|
|
12249
|
+
}) : /*#__PURE__*/ jsxs(Fragment, {
|
|
12250
|
+
children: [
|
|
12251
|
+
/*#__PURE__*/ jsx(WindowedRows, {
|
|
12252
|
+
rows: sortedData,
|
|
12253
|
+
virtualized: virtualized,
|
|
12254
|
+
colSpan: totalCols,
|
|
12255
|
+
children: (windowRows, firstIndex)=>/*#__PURE__*/ jsx(Fragment, {
|
|
12256
|
+
children: windowRows.map((row, offset)=>/*#__PURE__*/ jsxs(DataTableRow, {
|
|
12257
|
+
rowId: row.id,
|
|
12258
|
+
"aria-rowindex": virtualized ? firstIndex + offset + 2 : undefined,
|
|
12259
|
+
"data-clickable": onRowClick ? "" : undefined,
|
|
12260
|
+
onClick: onRowClick ? ()=>onRowClick(row) : undefined,
|
|
12261
|
+
children: [
|
|
12262
|
+
selectable && /*#__PURE__*/ jsx(SelectionCell, {
|
|
12263
|
+
// The row itself carries `onClick={onRowClick}` above, and a
|
|
12264
|
+
// native click on this cell's checkbox bubbles up through it
|
|
12265
|
+
// (React attaches DataTableRow's handler on the <tr>, which
|
|
12266
|
+
// sits between the checkbox and anything a consumer could stop
|
|
12267
|
+
// it from at -- so this has to live here, not in the consumer).
|
|
12268
|
+
// Without this, checking a row's box also fires `onRowClick`.
|
|
12269
|
+
onClick: (event)=>event.stopPropagation(),
|
|
12270
|
+
stickyFirst: stickyFirst,
|
|
12271
|
+
children: /*#__PURE__*/ jsx(RowCheckbox, {
|
|
12272
|
+
label: getRowSelectionLabel(row),
|
|
12273
|
+
checkedIcon: selectionCheckedIcon ?? DEFAULT_CHECKED_ICON
|
|
12274
|
+
})
|
|
12275
|
+
}),
|
|
12276
|
+
/*#__PURE__*/ jsx(ColumnBodyCells, {
|
|
12277
|
+
columns: columns,
|
|
12278
|
+
row: row,
|
|
12279
|
+
classNames: classNames,
|
|
12280
|
+
locale: locale,
|
|
12281
|
+
selectable: !!selectable,
|
|
12282
|
+
stickyFirst: stickyFirst,
|
|
12283
|
+
stickyLast: resolvedStickyLast,
|
|
12284
|
+
cellContextMenu: cellContextMenu,
|
|
12285
|
+
onViewEditHistory: onViewEditHistory,
|
|
12286
|
+
cellContextMenuItems: cellContextMenuItems
|
|
12180
12287
|
})
|
|
12181
|
-
|
|
12182
|
-
|
|
12183
|
-
|
|
12184
|
-
|
|
12185
|
-
|
|
12186
|
-
|
|
12187
|
-
|
|
12188
|
-
|
|
12189
|
-
|
|
12190
|
-
|
|
12191
|
-
|
|
12192
|
-
|
|
12193
|
-
|
|
12194
|
-
|
|
12195
|
-
|
|
12196
|
-
|
|
12288
|
+
]
|
|
12289
|
+
}, row.id))
|
|
12290
|
+
})
|
|
12291
|
+
}),
|
|
12292
|
+
onLoadMore && /*#__PURE__*/ jsx(InfiniteScrollRow, {
|
|
12293
|
+
colSpan: totalCols,
|
|
12294
|
+
classNames: classNames,
|
|
12295
|
+
loadingLabel: loadingLabel
|
|
12296
|
+
})
|
|
12297
|
+
]
|
|
12298
|
+
})
|
|
12299
|
+
}),
|
|
12300
|
+
showFooter && /*#__PURE__*/ jsxs(DataTableFooter, {
|
|
12301
|
+
children: [
|
|
12302
|
+
selectable && // The 40px-wide selection SPACER cell is now a plain `DataTableFooterCell`
|
|
12303
|
+
// (not the `selectionCell` slot) -- the `<colgroup>`'s own 40px `<col>`
|
|
12304
|
+
// is what makes every row's selection column line up now, not a matching
|
|
12305
|
+
// per-slot width formula, so there is no more reason for this cell to
|
|
12306
|
+
// borrow a different slot than its footer siblings.
|
|
12307
|
+
/*#__PURE__*/ jsx(SelectionFooterCell, {
|
|
12308
|
+
stickyFirst: stickyFirst
|
|
12197
12309
|
}),
|
|
12198
|
-
|
|
12199
|
-
|
|
12200
|
-
|
|
12201
|
-
|
|
12310
|
+
/*#__PURE__*/ jsx(ColumnCalcCells, {
|
|
12311
|
+
columns: columns,
|
|
12312
|
+
rows: sortedData,
|
|
12313
|
+
selectable: !!selectable,
|
|
12314
|
+
stickyFirst: stickyFirst,
|
|
12315
|
+
stickyLast: resolvedStickyLast
|
|
12202
12316
|
})
|
|
12203
12317
|
]
|
|
12318
|
+
}),
|
|
12319
|
+
onAddRow && /*#__PURE__*/ jsx(AddRowFooter, {
|
|
12320
|
+
onAddRow: onAddRow,
|
|
12321
|
+
addRowLabel: addRowLabel,
|
|
12322
|
+
colSpan: totalCols,
|
|
12323
|
+
classNames: classNames
|
|
12204
12324
|
})
|
|
12205
|
-
|
|
12206
|
-
|
|
12207
|
-
|
|
12208
|
-
|
|
12209
|
-
|
|
12210
|
-
|
|
12211
|
-
|
|
12212
|
-
// borrow a different slot than its footer siblings.
|
|
12213
|
-
/*#__PURE__*/ jsx(SelectionFooterCell, {
|
|
12214
|
-
stickyFirst: stickyFirst
|
|
12215
|
-
}),
|
|
12216
|
-
/*#__PURE__*/ jsx(ColumnCalcCells, {
|
|
12217
|
-
columns: columns,
|
|
12218
|
-
rows: sortedData,
|
|
12219
|
-
selectable: !!selectable,
|
|
12220
|
-
stickyFirst: stickyFirst,
|
|
12221
|
-
stickyLast: resolvedStickyLast
|
|
12222
|
-
})
|
|
12223
|
-
]
|
|
12224
|
-
}),
|
|
12225
|
-
onAddRow && /*#__PURE__*/ jsx(AddRowFooter, {
|
|
12226
|
-
onAddRow: onAddRow,
|
|
12227
|
-
addRowLabel: addRowLabel,
|
|
12228
|
-
colSpan: totalCols,
|
|
12229
|
-
classNames: classNames
|
|
12230
|
-
})
|
|
12231
|
-
]
|
|
12325
|
+
]
|
|
12326
|
+
})
|
|
12327
|
+
}),
|
|
12328
|
+
selectable && /*#__PURE__*/ jsx(DataTableBulkBar, {
|
|
12329
|
+
clearLabel: clearSelectionLabel,
|
|
12330
|
+
aboveFooter: showFooter || !!onAddRow,
|
|
12331
|
+
children: bulkActions
|
|
12232
12332
|
})
|
|
12233
|
-
|
|
12234
|
-
|
|
12235
|
-
clearLabel: clearSelectionLabel,
|
|
12236
|
-
aboveFooter: showFooter || !!onAddRow,
|
|
12237
|
-
children: bulkActions
|
|
12238
|
-
})
|
|
12239
|
-
]
|
|
12333
|
+
]
|
|
12334
|
+
})
|
|
12240
12335
|
})
|
|
12241
12336
|
});
|
|
12242
12337
|
}
|