comins-table 0.1.7 → 0.1.8

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/selection.js CHANGED
@@ -1,2 +1,2 @@
1
- import { clearCominsCellRange as e, clearCominsSelection as t, getCominsSelectedCellRange as n, isCominsCellInSelectedRange as r, isCominsCellSelected as i, isCominsRowSelected as a, selectCell as o, selectCellRange as s, selectRow as c } from "./core.js";
2
- export { e as clearCominsCellRange, t as clearCominsSelection, n as getCominsSelectedCellRange, r as isCominsCellInSelectedRange, i as isCominsCellSelected, a as isCominsRowSelected, o as selectCell, s as selectCellRange, c as selectRow };
1
+ import { D as e, E as t, L as n, R as r, T as i, b as a, i as o, r as s, z as c } from "./core-BF1H3EEK.js";
2
+ export { s as clearCominsCellRange, o as clearCominsSelection, a as getCominsSelectedCellRange, i as isCominsCellInSelectedRange, t as isCominsCellSelected, e as isCominsRowSelected, n as selectCell, r as selectCellRange, c as selectRow };
@@ -0,0 +1,153 @@
1
+ import type React from "react";
2
+ import type { CominsRowId } from "./core";
3
+ export type CominsTableTransferConflictPolicy = "overwrite" | "reject";
4
+ export type CominsTableTransferDropPosition = "after" | "append" | "before";
5
+ export type CominsTableTransferRowEndpoint<TData> = {
6
+ dataIndex: number;
7
+ row: TData;
8
+ rowId: CominsRowId;
9
+ tableId: string;
10
+ };
11
+ export type CominsTableTransferGroupEndpoint<TData, TGroup> = {
12
+ group: TGroup;
13
+ groupId: CominsRowId;
14
+ groupIndex: number;
15
+ rows: readonly CominsTableTransferRowEndpoint<TData>[];
16
+ tableId: string;
17
+ };
18
+ export type CominsTableTransferConflict<TData, TGroup> = {
19
+ kind: "row";
20
+ rowId: CominsRowId;
21
+ source: CominsTableTransferRowEndpoint<TData>;
22
+ target: CominsTableTransferRowEndpoint<TData>;
23
+ } | {
24
+ groupId: CominsRowId;
25
+ kind: "group";
26
+ source: CominsTableTransferGroupEndpoint<TData, TGroup>;
27
+ target: CominsTableTransferGroupEndpoint<TData, TGroup>;
28
+ };
29
+ export type CominsTableTransferResolvedConflict<TData, TGroup> = {
30
+ conflict: CominsTableTransferConflict<TData, TGroup>;
31
+ policy: CominsTableTransferConflictPolicy;
32
+ };
33
+ export type CominsTableTransferConflictResolver<TData, TGroup> = (conflict: CominsTableTransferConflict<TData, TGroup>) => CominsTableTransferConflictPolicy | undefined;
34
+ export type CominsTableTransferIntent<TData, TGroup> = {
35
+ kind: "row";
36
+ row: TData;
37
+ sourceRowId: CominsRowId;
38
+ sourceTableId: string;
39
+ targetGroupId?: CominsRowId;
40
+ targetRowId?: CominsRowId;
41
+ targetTableId: string;
42
+ } | {
43
+ group: TGroup;
44
+ kind: "group";
45
+ rows: readonly TData[];
46
+ sourceGroupId: CominsRowId;
47
+ sourceTableId: string;
48
+ targetGroupId?: CominsRowId;
49
+ targetTableId: string;
50
+ };
51
+ export type CominsTableTransferRejection<TData, TGroup = never> = {
52
+ conflict: CominsTableTransferConflict<TData, TGroup>;
53
+ kind: "group" | "row";
54
+ reason: "duplicate-id";
55
+ sourceTableId: string;
56
+ targetTableId: string;
57
+ };
58
+ export type CominsTableTransferRejectionFeedback<TData, TGroup = never> = {
59
+ duration?: number;
60
+ renderTooltip?: (rejection: CominsTableTransferRejection<TData, TGroup>) => React.ReactNode;
61
+ };
62
+ declare const cominsTableTransferCoordinatorBrand: unique symbol;
63
+ export type CominsTableTransferCoordinator<TData, TGroup = never> = {
64
+ readonly [cominsTableTransferCoordinatorBrand]: (data: TData, group: TGroup) => [TData, TGroup];
65
+ };
66
+ export type CominsTableTransferCoordinatorOptions<TData, TGroup = never> = {
67
+ onTransfer: (result: CominsTableTransferResult<TData, TGroup>) => void;
68
+ onTransferRejected?: (rejection: CominsTableTransferRejection<TData, TGroup>) => void;
69
+ };
70
+ export type CominsTableTransferConfig<TData, TGroup = never> = {
71
+ canTransfer?: (intent: CominsTableTransferIntent<TData, TGroup>) => boolean;
72
+ coordinator: CominsTableTransferCoordinator<TData, TGroup>;
73
+ rejectionFeedback?: false | CominsTableTransferRejectionFeedback<TData, TGroup>;
74
+ resolveConflict?: CominsTableTransferConflictResolver<TData, TGroup>;
75
+ scope: string;
76
+ tableId: string;
77
+ };
78
+ export type CominsTableTransferEndpoint<TData, TGroup = never> = {
79
+ data: readonly TData[];
80
+ getGroupId?: (group: TGroup) => CominsRowId;
81
+ getRowGroupId?: (row: TData, dataIndex: number) => CominsRowId;
82
+ getRowId: (row: TData, dataIndex: number) => CominsRowId;
83
+ groups?: readonly TGroup[];
84
+ setRowGroupId?: (params: {
85
+ fromGroupId: CominsRowId;
86
+ row: TData;
87
+ rowId: CominsRowId;
88
+ toGroupId: CominsRowId;
89
+ }) => TData;
90
+ tableId: string;
91
+ };
92
+ type CominsTableTransferNextEndpoint<TData, TGroup> = {
93
+ data: TData[];
94
+ groups?: TGroup[];
95
+ tableId: string;
96
+ };
97
+ export type CominsTableRowTransferDetails<TData, TGroup> = {
98
+ conflicts: readonly CominsTableTransferResolvedConflict<TData, TGroup>[];
99
+ kind: "row";
100
+ sourceRowId: CominsRowId;
101
+ targetGroupId?: CominsRowId;
102
+ targetRowId?: CominsRowId;
103
+ };
104
+ export type CominsTableGroupTransferDetails<TData, TGroup> = {
105
+ conflicts: readonly CominsTableTransferResolvedConflict<TData, TGroup>[];
106
+ kind: "group";
107
+ position: CominsTableTransferDropPosition;
108
+ sourceGroupId: CominsRowId;
109
+ targetGroupId?: CominsRowId;
110
+ };
111
+ export type CominsTableTransferDetails<TData, TGroup> = CominsTableGroupTransferDetails<TData, TGroup> | CominsTableRowTransferDetails<TData, TGroup>;
112
+ export type CominsTableTransferResult<TData, TGroup = never> = {
113
+ details: CominsTableTransferDetails<TData, TGroup>;
114
+ kind: "group" | "row";
115
+ source: CominsTableTransferNextEndpoint<TData, TGroup>;
116
+ target: CominsTableTransferNextEndpoint<TData, TGroup>;
117
+ };
118
+ export type CominsRowBetweenTablesInput<TData, TGroup = never> = {
119
+ resolveConflict?: CominsTableTransferConflictResolver<TData, TGroup>;
120
+ source: CominsTableTransferEndpoint<TData, TGroup>;
121
+ sourceRowId: CominsRowId;
122
+ target: CominsTableTransferEndpoint<TData, TGroup>;
123
+ targetGroupId?: CominsRowId;
124
+ targetRowId?: CominsRowId;
125
+ };
126
+ export type CominsGroupBetweenTablesInput<TData, TGroup> = {
127
+ position?: CominsTableTransferDropPosition;
128
+ resolveConflict?: CominsTableTransferConflictResolver<TData, TGroup>;
129
+ source: CominsTableTransferEndpoint<TData, TGroup>;
130
+ sourceGroupId: CominsRowId;
131
+ target: CominsTableTransferEndpoint<TData, TGroup>;
132
+ targetGroupId?: CominsRowId;
133
+ };
134
+ export type CominsTableTransferRegistrationSnapshot<TData, TGroup> = {
135
+ config: CominsTableTransferConfig<TData, TGroup>;
136
+ endpoint: CominsTableTransferEndpoint<TData, TGroup>;
137
+ instanceId: string;
138
+ root: HTMLElement | null;
139
+ viewport: HTMLElement | null;
140
+ };
141
+ export type CominsTableTransferRegistration<TData, TGroup> = {
142
+ getSnapshot: () => CominsTableTransferRegistrationSnapshot<TData, TGroup> | null;
143
+ };
144
+ export declare function createCominsTableTransferCoordinator<TData, TGroup = never>(options: CominsTableTransferCoordinatorOptions<TData, TGroup>): CominsTableTransferCoordinator<TData, TGroup>;
145
+ export declare function isCominsTableTransferCoordinator<TData, TGroup>(coordinator: unknown): coordinator is CominsTableTransferCoordinator<TData, TGroup>;
146
+ export declare function registerCominsTableTransfer<TData, TGroup>(coordinator: CominsTableTransferCoordinator<TData, TGroup>, scope: string, tableId: string, registration: CominsTableTransferRegistration<TData, TGroup>): () => void;
147
+ export declare function getCominsTableTransferRegistration<TData, TGroup>(coordinator: CominsTableTransferCoordinator<TData, TGroup>, scope: string, tableId: string): CominsTableTransferRegistration<TData, TGroup> | null;
148
+ export declare function emitCominsTableTransfer<TData, TGroup>(coordinator: CominsTableTransferCoordinator<TData, TGroup>, result: CominsTableTransferResult<TData, TGroup>): boolean;
149
+ export declare function emitCominsTableTransferRejected<TData, TGroup>(coordinator: CominsTableTransferCoordinator<TData, TGroup>, rejection: CominsTableTransferRejection<TData, TGroup>): boolean;
150
+ export declare function transferCominsRowBetweenTables<TData, TGroup = never>(input: CominsRowBetweenTablesInput<TData, TGroup>): CominsTableTransferResult<TData, TGroup> | null;
151
+ export declare function transferCominsGroupBetweenTables<TData, TGroup>(input: CominsGroupBetweenTablesInput<TData, TGroup>): CominsTableTransferResult<TData, TGroup> | null;
152
+ export {};
153
+ //# sourceMappingURL=table-transfer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table-transfer.d.ts","sourceRoot":"","sources":["../src/table-transfer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAE1C,MAAM,MAAM,iCAAiC,GAAG,WAAW,GAAG,QAAQ,CAAC;AACvE,MAAM,MAAM,+BAA+B,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE5E,MAAM,MAAM,8BAA8B,CAAC,KAAK,IAAI;IAClD,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,KAAK,CAAC;IACX,KAAK,EAAE,WAAW,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,gCAAgC,CAAC,KAAK,EAAE,MAAM,IAAI;IAC5D,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,WAAW,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,SAAS,8BAA8B,CAAC,KAAK,CAAC,EAAE,CAAC;IACvD,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,2BAA2B,CAAC,KAAK,EAAE,MAAM,IACjD;IACE,IAAI,EAAE,KAAK,CAAC;IACZ,KAAK,EAAE,WAAW,CAAC;IACnB,MAAM,EAAE,8BAA8B,CAAC,KAAK,CAAC,CAAC;IAC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ED,wBAAgB,kCAAkC,CAAC,KAAK,EAAE,MAAM,EAC9D,WAAW,EAAE,8BAA8B,CAAC,KAAK,EAAE,MAAM,CAAC,EAC1D,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,yDAWhB;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,EACnD,WAAW,EAAE,8BAA8B,CAAC,KAAK,EAAE,MAAM,CAAC,EAC1D,MAAM,EAAE,yBAAyB,CAAC,KAAK,EAAE,MAAM,CAAC,WAUjD;AAED,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,MAAM,EAC3D,WAAW,EAAE,8BAA8B,CAAC,KAAK,EAAE,MAAM,CAAC,EAC1D,SAAS,EAAE,4BAA4B,CAAC,KAAK,EAAE,MAAM,CAAC,WAUvD;AA4ED,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,EAClE,KAAK,EAAE,2BAA2B,CAAC,KAAK,EAAE,MAAM,CAAC,GAChD,yBAAyB,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,IAAI,CA8IjD;AAED,wBAAgB,gCAAgC,CAAC,KAAK,EAAE,MAAM,EAC5D,KAAK,EAAE,6BAA6B,CAAC,KAAK,EAAE,MAAM,CAAC,GAClD,yBAAyB,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,IAAI,CAuJjD"}
@@ -0,0 +1,14 @@
1
+ import type React from "react";
2
+ export type CominsTooltipSurfaceProps = {
3
+ children: React.ReactNode;
4
+ className?: string;
5
+ icon?: React.ReactNode;
6
+ tone?: "danger" | "neutral";
7
+ };
8
+ export declare function CominsTooltipSurface({ children, className, icon, tone, }: CominsTooltipSurfaceProps): React.JSX.Element;
9
+ export type CominsPointerTooltipProps = CominsTooltipSurfaceProps & {
10
+ x: number;
11
+ y: number;
12
+ };
13
+ export declare function CominsPointerTooltip({ children, className, icon, tone, x, y, }: CominsPointerTooltipProps): React.JSX.Element;
14
+ //# sourceMappingURL=tooltip.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../src/tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,MAAM,MAAM,yBAAyB,GAAG;IACtC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,IAAI,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;CAC7B,CAAC;AAEF,wBAAgB,oBAAoB,CAAC,EACnC,QAAQ,EACR,SAAS,EACT,IAAI,EACJ,IAAgB,GACjB,EAAE,yBAAyB,qBAa3B;AAED,MAAM,MAAM,yBAAyB,GAAG,yBAAyB,GAAG;IAClE,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAEF,wBAAgB,oBAAoB,CAAC,EACnC,QAAQ,EACR,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,CAAC,EACD,CAAC,GACF,EAAE,yBAAyB,qBAiD3B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "comins-table",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "repository": {
@@ -28,7 +28,8 @@
28
28
  "test:security": "node --test test/sensitive-data-gates.node.mjs test/package-artifact-gate.node.mjs test/npm-maintainer-gate.node.mjs",
29
29
  "verify": "npm run check:hygiene && npm run test:security && npm run test:licenses && npm run check:licenses && npm run lint && npm run test:run && npm run build",
30
30
  "verify:e2e": "npm run test:e2e",
31
- "verify:full": "npm run verify && npm run verify:e2e",
31
+ "verify:local": "npm run verify && npm run verify:e2e",
32
+ "verify:full": "npm run verify:local && npm run test:perf -- --workers=1",
32
33
  "verify:npm-maintainer": "node scripts/check-npm-maintainer.mjs",
33
34
  "verify:package-artifact": "node scripts/verify-package-artifact.mjs"
34
35
  },
package/styles.css CHANGED
@@ -50,6 +50,11 @@
50
50
  --comins-table-scrollbar-track: var(--comins-table-surface-muted);
51
51
  --comins-table-surface: #ffffff;
52
52
  --comins-table-surface-muted: #f6fcfa;
53
+ --comins-table-tooltip-danger-background: #7f1d1d;
54
+ --comins-table-tooltip-danger-border: rgba(254, 202, 202, 0.28);
55
+ --comins-table-tooltip-danger-color: #ffffff;
56
+ --comins-table-tooltip-danger-muted: #fecaca;
57
+ --comins-table-tooltip-shadow: 0 12px 30px rgba(69, 10, 10, 0.28);
53
58
  --comins-table-component-accent: var(--comins-table-accent);
54
59
  --comins-table-component-accent-foreground: var(--comins-table-accent-foreground);
55
60
  --comins-table-component-accent-strong: var(--comins-table-accent-strong);
@@ -389,6 +394,25 @@
389
394
  box-shadow: inset 0 -3px var(--comins-table-drop-marker);
390
395
  }
391
396
 
397
+ .comins-table__group-row[data-comins-group-drop-valid="false"] > .comins-table__group-cell {
398
+ background: var(--comins-table-drop-invalid-background);
399
+ }
400
+
401
+ .comins-table__body-viewport[data-comins-group-drop-valid="true"],
402
+ .comins-table__body-viewport[data-comins-row-drop-valid="true"] {
403
+ box-shadow: inset 0 0 0 3px var(--comins-table-drop-marker);
404
+ }
405
+
406
+ .comins-table__body-viewport[data-comins-group-drop-valid="false"],
407
+ .comins-table__body-viewport[data-comins-row-drop-valid="false"] {
408
+ box-shadow: inset 0 0 0 3px var(--comins-table-drop-invalid);
409
+ }
410
+
411
+ .comins-table[data-comins-transfer-rejected="true"] {
412
+ outline: 1px solid var(--comins-table-drop-invalid);
413
+ outline-offset: -1px;
414
+ }
415
+
392
416
  .comins-table__group-row[data-comins-row-drop-valid="true"] > .comins-table__group-cell {
393
417
  background: var(--comins-table-drop-valid-background);
394
418
  }
@@ -463,31 +487,57 @@
463
487
  }
464
488
 
465
489
  .comins-table__body-viewport[data-horizontal-overflow="true"] {
466
- overflow-x: scroll;
490
+ overflow-x: hidden;
467
491
  overflow-y: scroll;
468
492
  scrollbar-gutter: stable;
469
493
  }
470
494
 
471
- .comins-table__body-viewport::-webkit-scrollbar {
495
+ .comins-table__horizontal-scrollbar {
496
+ border-top: 1px solid var(--comins-table-row-border);
497
+ box-sizing: border-box;
498
+ flex: 0 0 12px;
499
+ max-width: 100%;
500
+ min-height: 12px;
501
+ overflow-x: scroll;
502
+ overflow-y: hidden;
503
+ scrollbar-color: var(--comins-table-scrollbar-thumb) var(--comins-table-scrollbar-track);
504
+ }
505
+
506
+ .comins-table__horizontal-scrollbar-content {
507
+ height: 1px;
508
+ pointer-events: none;
509
+ }
510
+
511
+ .comins-table__horizontal-range-spacer {
512
+ height: 0;
513
+ pointer-events: none;
514
+ }
515
+
516
+ .comins-table__body-viewport::-webkit-scrollbar,
517
+ .comins-table__horizontal-scrollbar::-webkit-scrollbar {
472
518
  height: 12px;
473
519
  width: 12px;
474
520
  }
475
521
 
476
- .comins-table__body-viewport::-webkit-scrollbar-track {
522
+ .comins-table__body-viewport::-webkit-scrollbar-track,
523
+ .comins-table__horizontal-scrollbar::-webkit-scrollbar-track {
477
524
  background: var(--comins-table-scrollbar-track);
478
525
  }
479
526
 
480
- .comins-table__body-viewport::-webkit-scrollbar-thumb {
527
+ .comins-table__body-viewport::-webkit-scrollbar-thumb,
528
+ .comins-table__horizontal-scrollbar::-webkit-scrollbar-thumb {
481
529
  background: var(--comins-table-scrollbar-thumb);
482
530
  border: 3px solid var(--comins-table-scrollbar-track);
483
531
  border-radius: 999px;
484
532
  }
485
533
 
486
- .comins-table__body-viewport::-webkit-scrollbar-thumb:hover {
534
+ .comins-table__body-viewport::-webkit-scrollbar-thumb:hover,
535
+ .comins-table__horizontal-scrollbar::-webkit-scrollbar-thumb:hover {
487
536
  background: var(--comins-table-accent-strong);
488
537
  }
489
538
 
490
- .comins-table__body-viewport::-webkit-scrollbar-corner {
539
+ .comins-table__body-viewport::-webkit-scrollbar-corner,
540
+ .comins-table__horizontal-scrollbar::-webkit-scrollbar-corner {
491
541
  background: var(--comins-table-scrollbar-corner);
492
542
  }
493
543
 
@@ -1013,6 +1063,99 @@
1013
1063
  text-overflow: ellipsis;
1014
1064
  }
1015
1065
 
1066
+ .comins-pointer-tooltip {
1067
+ max-width: min(320px, calc(100vw - 16px));
1068
+ pointer-events: none;
1069
+ position: fixed;
1070
+ z-index: 80;
1071
+ }
1072
+
1073
+ .comins-tooltip-surface {
1074
+ align-items: flex-start;
1075
+ border: 1px solid transparent;
1076
+ border-radius: 8px;
1077
+ box-shadow: var(--comins-table-tooltip-shadow);
1078
+ display: inline-flex;
1079
+ font-size: 12px;
1080
+ gap: 8px;
1081
+ line-height: 1.4;
1082
+ max-width: 100%;
1083
+ padding: 9px 11px;
1084
+ position: relative;
1085
+ }
1086
+
1087
+ .comins-tooltip-surface::before {
1088
+ background: inherit;
1089
+ border-left: inherit;
1090
+ border-top: inherit;
1091
+ content: "";
1092
+ height: 8px;
1093
+ left: 14px;
1094
+ position: absolute;
1095
+ transform: rotate(45deg);
1096
+ width: 8px;
1097
+ }
1098
+
1099
+ .comins-pointer-tooltip[data-placement="below"] .comins-tooltip-surface::before {
1100
+ top: -5px;
1101
+ }
1102
+
1103
+ .comins-pointer-tooltip[data-placement="above"] .comins-tooltip-surface::before {
1104
+ bottom: -5px;
1105
+ transform: rotate(225deg);
1106
+ }
1107
+
1108
+ .comins-tooltip-surface--neutral {
1109
+ background: var(--comins-table-foreground);
1110
+ border-color: color-mix(in srgb, var(--comins-table-foreground) 72%, #ffffff);
1111
+ color: var(--comins-table-background);
1112
+ }
1113
+
1114
+ .comins-tooltip-surface--danger {
1115
+ background: var(--comins-table-tooltip-danger-background);
1116
+ border-color: var(--comins-table-tooltip-danger-border);
1117
+ color: var(--comins-table-tooltip-danger-color);
1118
+ }
1119
+
1120
+ .comins-tooltip-surface__icon {
1121
+ align-items: center;
1122
+ color: var(--comins-table-tooltip-danger-muted);
1123
+ display: inline-flex;
1124
+ flex: 0 0 auto;
1125
+ height: 18px;
1126
+ justify-content: center;
1127
+ width: 18px;
1128
+ }
1129
+
1130
+ .comins-tooltip-surface__warning {
1131
+ align-items: center;
1132
+ border: 1.5px solid currentColor;
1133
+ border-radius: 999px;
1134
+ display: inline-flex;
1135
+ font-size: 11px;
1136
+ font-weight: 900;
1137
+ height: 15px;
1138
+ justify-content: center;
1139
+ line-height: 1;
1140
+ width: 15px;
1141
+ }
1142
+
1143
+ .comins-tooltip-surface__content {
1144
+ display: grid;
1145
+ gap: 2px;
1146
+ min-width: 0;
1147
+ }
1148
+
1149
+ .comins-tooltip-surface__content > strong {
1150
+ font-size: 13px;
1151
+ font-weight: 800;
1152
+ }
1153
+
1154
+ .comins-tooltip-surface__content > span {
1155
+ color: var(--comins-table-tooltip-danger-muted);
1156
+ overflow-wrap: anywhere;
1157
+ }
1158
+
1016
1159
  .comins-sort-meta {
1017
1160
  align-items: center;
1018
1161
  display: inline-flex;
@@ -1119,6 +1262,15 @@
1119
1262
  color: var(--comins-table-drop-invalid);
1120
1263
  }
1121
1264
 
1265
+ .comins-table__tr[data-comins-cross-row-drop-position="before"] > .comins-table__td {
1266
+ box-shadow: inset 0 3px var(--comins-table-drop-marker);
1267
+ }
1268
+
1269
+ .comins-table__tr[data-comins-cross-row-drop-position="before"][data-comins-row-drop-valid="false"] > .comins-table__td {
1270
+ background: var(--comins-table-drop-invalid-background);
1271
+ box-shadow: inset 0 3px var(--comins-table-drop-invalid);
1272
+ }
1273
+
1122
1274
  .comins-table-empty-filler td {
1123
1275
  border-bottom: 0;
1124
1276
  border-right: 1px solid var(--comins-table-cell-border);
@@ -1143,6 +1295,53 @@
1143
1295
  background: var(--comins-table-row-custom-background);
1144
1296
  }
1145
1297
 
1298
+ .comins-table__th[data-comins-pinned] {
1299
+ background: var(--comins-table-header-background);
1300
+ z-index: 5;
1301
+ }
1302
+
1303
+ .comins-table__td[data-comins-pinned] {
1304
+ background: var(--comins-table-surface);
1305
+ z-index: 2;
1306
+ }
1307
+
1308
+ .comins-table__tr[data-comins-row-parity="even"] > .comins-table__td[data-comins-pinned] {
1309
+ background: var(--comins-table-row-even-background);
1310
+ }
1311
+
1312
+ .comins-table__tr[data-comins-row-parity="odd"] > .comins-table__td[data-comins-pinned] {
1313
+ background: var(--comins-table-row-odd-background);
1314
+ }
1315
+
1316
+ .comins-table__tr[data-comins-row-custom-background="true"] > .comins-table__td[data-comins-pinned] {
1317
+ background: var(--comins-table-row-custom-background);
1318
+ }
1319
+
1320
+ .comins-table__tr.comins-row-selected > .comins-table__td[data-comins-pinned] {
1321
+ background: var(--comins-table-row-selected-background);
1322
+ }
1323
+
1324
+ .comins-table__tr[data-disabled="true"] > .comins-table__td[data-comins-pinned] {
1325
+ background: var(--comins-table-row-disabled-background);
1326
+ }
1327
+
1328
+ .comins-table__td.comins-table__skeleton-cell[data-comins-pinned] {
1329
+ background: var(--comins-table-skeleton-background);
1330
+ }
1331
+
1332
+ .comins-table__summary-cell[data-comins-pinned] {
1333
+ background: var(--comins-table-surface-muted);
1334
+ z-index: 2;
1335
+ }
1336
+
1337
+ [data-comins-pinned="left"][data-comins-pin-boundary="true"] {
1338
+ border-right: 2px solid var(--comins-table-border);
1339
+ }
1340
+
1341
+ [data-comins-pinned="right"][data-comins-pin-boundary="true"] {
1342
+ border-left: 2px solid var(--comins-table-border);
1343
+ }
1344
+
1146
1345
  .comins-table__component-layout {
1147
1346
  align-items: center;
1148
1347
  display: inline-flex;