@pretable/ui 0.0.3 → 0.0.9

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/grid.css CHANGED
@@ -51,6 +51,7 @@
51
51
  font-size: var(--pretable-font-size-header);
52
52
  font-weight: 500;
53
53
  color: var(--pretable-text-header);
54
+ border: 0;
54
55
  border-right: 1px solid var(--pretable-rule);
55
56
  box-sizing: border-box;
56
57
  }
@@ -110,6 +111,77 @@
110
111
  background: var(--pretable-bg-grid-alt);
111
112
  }
112
113
 
114
+ /* ---- Row grouping ---------------------------------------------------- */
115
+
116
+ /* Group headers borrow the header fill so the eye reads them as structure
117
+ rather than as another record. */
118
+ :where([data-pretable-group-row] [data-pretable-cell]) {
119
+ background: var(--pretable-bg-header);
120
+ color: var(--pretable-text-header);
121
+ font-weight: 600;
122
+ }
123
+
124
+ /* Depth indent is padding INSIDE the cell box. Indenting the row instead
125
+ would scroll the indent away from a pinned group column, compute ellipsis
126
+ truncation against the wrong width, and misplace the focus outline.
127
+ The literal fallback matters: a third-party theme that predates
128
+ --pretable-group-indent degrades to a visible indent, not a flat list. */
129
+ :where([data-pretable-group-cell]) {
130
+ gap: var(--pretable-cell-padding-x);
131
+ padding-left: calc(
132
+ var(--pretable-cell-padding-x) + var(--pretable-group-depth, 0) *
133
+ var(--pretable-group-indent, 16px)
134
+ );
135
+ }
136
+
137
+ :where([data-pretable-group-twisty]) {
138
+ flex: none;
139
+ width: 1em;
140
+ height: 1em;
141
+ padding: 0;
142
+ border: 0;
143
+ background: none;
144
+ color: inherit;
145
+ font: inherit;
146
+ line-height: 1;
147
+ cursor: pointer;
148
+ transition: rotate 120ms ease;
149
+ }
150
+
151
+ /* The glyph points down when open; rotate it closed. */
152
+ :where([data-pretable-group-twisty][aria-expanded="false"]) {
153
+ rotate: -90deg;
154
+ }
155
+
156
+ :where([data-pretable-group-twisty]:focus-visible) {
157
+ outline: 2px solid var(--pretable-focus-ring);
158
+ outline-offset: 1px;
159
+ }
160
+
161
+ :where([data-pretable-group-label]) {
162
+ min-width: 0;
163
+ overflow: hidden;
164
+ text-overflow: ellipsis;
165
+ white-space: nowrap;
166
+ }
167
+
168
+ :where([data-pretable-group-count]) {
169
+ flex: none;
170
+ color: var(--pretable-text-dim);
171
+ font-weight: 400;
172
+ }
173
+
174
+ /* Data rows sit one twisty-width in, so their content lines up with sibling
175
+ group labels instead of hanging a chevron to the left. Only visible once
176
+ leaf and group rows share a depth — invisible in a screenshot, ragged in
177
+ every real grid. */
178
+ :where([data-pretable-group-leaf]) {
179
+ padding-left: calc(
180
+ var(--pretable-cell-padding-x) * 2 + 1em +
181
+ var(--pretable-group-depth, 0) * var(--pretable-group-indent, 16px)
182
+ );
183
+ }
184
+
113
185
  /* Hover */
114
186
  :where([data-pretable-row]:hover [data-pretable-cell]) {
115
187
  background: var(--pretable-bg-hover);
@@ -361,6 +433,193 @@
361
433
  padding: 2px 4px;
362
434
  }
363
435
 
436
+ /* ---- Drag-to-group panel (sub-project 3) ----------------------------- */
437
+
438
+ /* The strip above the header. @pretable/react sets its `height` inline —
439
+ the panel's height is layout math the surface has to know in JS, because
440
+ it is SUBTRACTED from viewportHeight — and reads it from this same token.
441
+ Mirrored here as a min-height so the token stays the single source for
442
+ both, and so a server-rendered panel has its height before hydration.
443
+ No calc(): a theme that misses the token would collapse the strip to
444
+ nothing rather than degrade. */
445
+ :where([data-pretable-group-panel]) {
446
+ box-sizing: border-box;
447
+ min-height: var(--pretable-group-panel-height);
448
+ gap: var(--pretable-cell-padding-x);
449
+ padding: 0 var(--pretable-cell-padding-x);
450
+ background: var(--pretable-bg-toolbar);
451
+ border: 1px solid var(--pretable-rule-strong);
452
+ border-bottom: 0;
453
+ border-radius: var(--pretable-radius) var(--pretable-radius) 0 0;
454
+ color: var(--pretable-text-header);
455
+ font-family: var(--pretable-font-sans);
456
+ font-size: var(--pretable-font-size-header);
457
+ }
458
+
459
+ /* The panel and the viewport are stacked in one box, so the two rounded
460
+ corners that now meet in the middle have to go — otherwise the strip
461
+ floats above a separately rounded card. */
462
+ :where(
463
+ [data-pretable-group-panel-wrapper] > [data-pretable-scroll-viewport]
464
+ ) {
465
+ border-top-left-radius: 0;
466
+ border-top-right-radius: 0;
467
+ }
468
+
469
+ /* A drop is pending over the panel. Present-or-absent rather than a value,
470
+ so it is selected on with an attribute-existence check.
471
+ `--pretable-selection-bg` rather than `--pretable-bg-hover`: Excel sets
472
+ hover to `transparent` on purpose, and a drop target that gives no
473
+ feedback in one of the two shipped themes is not feedback. */
474
+ :where([data-pretable-group-panel][data-pretable-group-panel-active]) {
475
+ background: var(--pretable-selection-bg);
476
+ }
477
+
478
+ :where([data-pretable-group-panel-empty]) {
479
+ color: var(--pretable-text-dim);
480
+ font-style: italic;
481
+ overflow: hidden;
482
+ text-overflow: ellipsis;
483
+ white-space: nowrap;
484
+ }
485
+
486
+ :where([data-pretable-group-chip]) {
487
+ display: inline-flex;
488
+ align-items: center;
489
+ gap: 4px;
490
+ box-sizing: border-box;
491
+ max-width: 14em;
492
+ padding: 2px 4px;
493
+ border: 1px solid var(--pretable-rule);
494
+ border-radius: var(--pretable-radius);
495
+ background: var(--pretable-bg-grid);
496
+ color: var(--pretable-text-cell);
497
+ cursor: grab;
498
+ user-select: none;
499
+ /* The chip is a pointer drag handle; without this a touch drag scrolls
500
+ the page instead of reordering the level. */
501
+ touch-action: none;
502
+ }
503
+
504
+ :where([data-pretable-group-chip]:focus-visible) {
505
+ outline: 2px solid var(--pretable-focus-ring);
506
+ outline-offset: 1px;
507
+ }
508
+
509
+ :where([data-pretable-group-chip][data-pretable-chip-dragging]) {
510
+ opacity: 0.5;
511
+ cursor: grabbing;
512
+ }
513
+
514
+ /* Grip dots, drawn rather than added to the DOM — the handle is an empty,
515
+ aria-hidden span so it costs no accessible content. */
516
+ :where([data-pretable-chip-handle]) {
517
+ flex: none;
518
+ width: 5px;
519
+ height: 12px;
520
+ background-image: radial-gradient(currentColor 40%, transparent 45%);
521
+ background-size: 3px 4px;
522
+ color: var(--pretable-text-dim);
523
+ }
524
+
525
+ :where([data-pretable-chip-label]) {
526
+ min-width: 0;
527
+ overflow: hidden;
528
+ text-overflow: ellipsis;
529
+ white-space: nowrap;
530
+ }
531
+
532
+ :where([data-pretable-chip-remove]) {
533
+ flex: none;
534
+ display: inline-flex;
535
+ align-items: center;
536
+ justify-content: center;
537
+ width: 14px;
538
+ height: 14px;
539
+ padding: 0;
540
+ border: 0;
541
+ border-radius: var(--pretable-radius);
542
+ background: transparent;
543
+ color: var(--pretable-text-dim);
544
+ font-size: 10px;
545
+ line-height: 1;
546
+ cursor: pointer;
547
+ }
548
+ :where([data-pretable-chip-remove]:hover) {
549
+ background: var(--pretable-selection-bg);
550
+ color: var(--pretable-text-cell);
551
+ }
552
+
553
+ /* The gap between two chips that a drop would land in. A zero-content span,
554
+ so every pixel of it is this rule. */
555
+ :where([data-pretable-chip-drop-indicator]) {
556
+ flex: none;
557
+ align-self: stretch;
558
+ width: 2px;
559
+ margin: 4px 0;
560
+ background: var(--pretable-reorder-drop-indicator);
561
+ }
562
+
563
+ /* ---- Column menu (sub-project 3) ------------------------------------- */
564
+
565
+ /* Same reveal model as the funnel it sits beside: invisible until the header
566
+ row is hovered, the button is keyboard-focused, or its menu is open. The
567
+ open case matters — without it the button vanishes the moment the pointer
568
+ leaves the header, while its own menu is still up. */
569
+ :where([data-pretable-column-menu-button]) {
570
+ display: inline-flex;
571
+ align-items: center;
572
+ justify-content: center;
573
+ width: 18px;
574
+ height: 18px;
575
+ padding: 0;
576
+ border: 0;
577
+ border-radius: var(--pretable-radius);
578
+ background: transparent;
579
+ color: var(--pretable-text-dim);
580
+ cursor: pointer;
581
+ opacity: 0;
582
+ transition: opacity 0.1s ease;
583
+ }
584
+ :where([data-pretable-header-row]:hover [data-pretable-column-menu-button]),
585
+ :where([data-pretable-column-menu-button]:focus-visible),
586
+ :where([data-pretable-column-menu-button][aria-expanded="true"]) {
587
+ opacity: 1;
588
+ }
589
+ :where([data-pretable-column-menu-button]:hover) {
590
+ background: var(--pretable-selection-bg);
591
+ }
592
+
593
+ /* The popover itself takes its surface from [data-pretable-popover]. */
594
+ :where([data-pretable-column-menu]) {
595
+ display: flex;
596
+ flex-direction: column;
597
+ padding: 4px;
598
+ box-shadow: var(--pretable-reorder-ghost-shadow);
599
+ /* Portaled into <body>, so nothing is inherited from the viewport. */
600
+ font-family: var(--pretable-font-sans);
601
+ font-size: var(--pretable-font-size-cell);
602
+ }
603
+ :where([data-pretable-menu-item]) {
604
+ display: block;
605
+ width: 100%;
606
+ padding: 6px 8px;
607
+ border: 0;
608
+ border-radius: var(--pretable-radius);
609
+ background: transparent;
610
+ color: var(--pretable-text-cell);
611
+ font: inherit;
612
+ text-align: left;
613
+ cursor: pointer;
614
+ }
615
+ :where([data-pretable-menu-item]:hover) {
616
+ background: var(--pretable-selection-bg);
617
+ }
618
+ :where([data-pretable-menu-item]:focus-visible) {
619
+ outline: 2px solid var(--pretable-focus-ring);
620
+ outline-offset: -2px;
621
+ }
622
+
364
623
  /* Enum combobox listbox (cell editor) */
365
624
  :where([data-pretable-enum-editor]) {
366
625
  display: block;
@@ -55,7 +55,9 @@
55
55
  /* Density — natural default = compact (Excel "Compact" tier) */
56
56
  --pretable-row-height: 20px; /* 15pt at 96 DPI */
57
57
  --pretable-header-height: 24px;
58
+ --pretable-group-panel-height: 28px; /* drag-to-group strip above the header */
58
59
  --pretable-cell-padding-x: 6px;
60
+ --pretable-group-indent: 12px;
59
61
  --pretable-cell-padding-y: 2px;
60
62
  --pretable-font-size-cell: 15px; /* Aptos Narrow 11pt */
61
63
  --pretable-font-size-header: 13px;
@@ -73,7 +75,9 @@
73
75
  [data-density="standard"] {
74
76
  --pretable-row-height: 24px;
75
77
  --pretable-header-height: 32px;
78
+ --pretable-group-panel-height: 34px;
76
79
  --pretable-cell-padding-x: 8px;
80
+ --pretable-group-indent: 16px;
77
81
  --pretable-cell-padding-y: 4px;
78
82
  --pretable-font-size-cell: 15px;
79
83
  --pretable-font-size-header: 14px;
@@ -82,7 +86,9 @@
82
86
  [data-density="spacious"] {
83
87
  --pretable-row-height: 32px;
84
88
  --pretable-header-height: 40px;
89
+ --pretable-group-panel-height: 42px;
85
90
  --pretable-cell-padding-x: 12px;
91
+ --pretable-group-indent: 20px;
86
92
  --pretable-cell-padding-y: 8px;
87
93
  --pretable-font-size-cell: 15px;
88
94
  --pretable-font-size-header: 14px;
@@ -58,7 +58,9 @@
58
58
  /* Density — natural default = standard */
59
59
  --pretable-row-height: 48px;
60
60
  --pretable-header-height: 52px;
61
+ --pretable-group-panel-height: 44px; /* drag-to-group strip above the header */
61
62
  --pretable-cell-padding-x: 16px;
63
+ --pretable-group-indent: 24px;
62
64
  --pretable-cell-padding-y: 12px;
63
65
  --pretable-font-size-cell: 14px; /* body-medium */
64
66
  --pretable-font-size-header: 14px; /* label-large (px equal; weight differs in grid.css) */
@@ -75,7 +77,9 @@
75
77
  [data-density="compact"] {
76
78
  --pretable-row-height: 40px;
77
79
  --pretable-header-height: 44px;
80
+ --pretable-group-panel-height: 36px;
78
81
  --pretable-cell-padding-x: 12px;
82
+ --pretable-group-indent: 20px;
79
83
  --pretable-cell-padding-y: 6px;
80
84
  --pretable-font-size-cell: 12px; /* body-small */
81
85
  --pretable-font-size-header: 12px;
@@ -84,7 +88,9 @@
84
88
  [data-density="spacious"] {
85
89
  --pretable-row-height: 56px;
86
90
  --pretable-header-height: 64px;
91
+ --pretable-group-panel-height: 52px;
87
92
  --pretable-cell-padding-x: 24px;
93
+ --pretable-group-indent: 32px;
88
94
  --pretable-cell-padding-y: 16px;
89
95
  --pretable-font-size-cell: 14px;
90
96
  --pretable-font-size-header: 14px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pretable/ui",
3
- "version": "0.0.3",
3
+ "version": "0.0.9",
4
4
  "description": "CSS themes, tokens, and grid styles for Pretable.",
5
5
  "license": "MIT",
6
6
  "repository": {