@bigpixelrocket/uiok 0.2.2 → 0.2.3

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.
Files changed (57) hide show
  1. package/CHANGELOG.md +37 -1
  2. package/dist/button/TextLink.d.ts +27 -0
  3. package/dist/button/TextLink.js +15 -0
  4. package/dist/button/button.css +48 -0
  5. package/dist/button/index.d.ts +2 -1
  6. package/dist/button/index.js +2 -1
  7. package/dist/dialog/ConfirmDialog.d.ts +7 -1
  8. package/dist/dialog/ConfirmDialog.js +9 -4
  9. package/dist/dialog/DialogLists.d.ts +8 -1
  10. package/dist/dialog/DialogLists.js +3 -2
  11. package/dist/field/field.css +110 -2
  12. package/dist/filter/filter.css +16 -0
  13. package/dist/grid/DataGrid.d.ts +10 -2
  14. package/dist/grid/DataGrid.js +47 -13
  15. package/dist/grid/DataGrid.logic.d.ts +16 -0
  16. package/dist/grid/DataGrid.logic.js +28 -0
  17. package/dist/grid/grid.css +128 -4
  18. package/dist/index.d.ts +1 -0
  19. package/dist/index.js +1 -0
  20. package/dist/labels/UiokLabels.d.ts +3 -0
  21. package/dist/labels/UiokLabels.js +3 -1
  22. package/dist/labels/index.d.ts +1 -0
  23. package/dist/labels/index.js +1 -0
  24. package/dist/labels/keys.js +2 -0
  25. package/dist/labels/paneTabs.d.ts +27 -0
  26. package/dist/labels/paneTabs.js +10 -0
  27. package/dist/labels/selectAll.d.ts +4 -1
  28. package/dist/labels/selectAll.js +1 -1
  29. package/dist/legend/KeyLegendStrip.d.ts +9 -1
  30. package/dist/legend/KeyLegendStrip.js +119 -5
  31. package/dist/legend/legend.css +52 -0
  32. package/dist/listing/Listing.d.ts +23 -5
  33. package/dist/listing/Listing.js +11 -8
  34. package/dist/listing/listing.css +106 -3
  35. package/dist/pane/PaneActions.d.ts +3 -1
  36. package/dist/pane/PaneActions.js +6 -5
  37. package/dist/pane/PaneTabs.d.ts +92 -0
  38. package/dist/pane/PaneTabs.js +326 -0
  39. package/dist/pane/PaneTabs.logic.d.ts +97 -0
  40. package/dist/pane/PaneTabs.logic.js +158 -0
  41. package/dist/pane/index.d.ts +5 -1
  42. package/dist/pane/index.js +5 -1
  43. package/dist/pane/panetabs.css +408 -0
  44. package/dist/pane/useTabDrag.d.ts +49 -0
  45. package/dist/pane/useTabDrag.js +306 -0
  46. package/dist/segmented/SegmentedChoice.d.ts +8 -1
  47. package/dist/segmented/SegmentedChoice.js +7 -4
  48. package/dist/styles.css +8 -0
  49. package/dist/surface/GroupSwatch.d.ts +22 -0
  50. package/dist/surface/GroupSwatch.js +15 -0
  51. package/dist/surface/Tag.d.ts +26 -0
  52. package/dist/surface/Tag.js +12 -0
  53. package/dist/surface/index.d.ts +7 -0
  54. package/dist/surface/index.js +7 -0
  55. package/dist/surface/surface.css +116 -1
  56. package/dist/themes/tokens.js +12 -1
  57. package/package.json +1 -1
@@ -45,6 +45,12 @@ export interface ListingColumn {
45
45
  readonly control?: ReactNode;
46
46
  /** The label sorts the listing by its column. */
47
47
  readonly sort?: ColumnSort;
48
+ /**
49
+ * What the label's column holds, beyond its label (a unit, how a value is
50
+ * measured): the label's tooltip and accessible description, sortable or
51
+ * not.
52
+ */
53
+ readonly tip?: string;
48
54
  }
49
55
  /** Props for {@link Strip}. */
50
56
  export interface StripProps {
@@ -143,6 +149,12 @@ export interface RowProps {
143
149
  readonly className?: string;
144
150
  /** Opens the row's item on a click anywhere but its controls. */
145
151
  readonly onOpen?: () => void;
152
+ /**
153
+ * How deep the row stands in a tree or a plan: its name is indented by one
154
+ * icon column a level (`--row-level`); 0, or none, is no indent. The
155
+ * expansion and its keys stay the host's.
156
+ */
157
+ readonly level?: number;
146
158
  /** Its controls stay in the Tab order. */
147
159
  readonly tabbable?: boolean;
148
160
  /** The row itself takes the focus: in the Tab order while it is the cursor row. */
@@ -165,7 +177,7 @@ export interface RowProps {
165
177
  * is a stop of its own: the cursor row in the Tab order (or, while no row
166
178
  * is, the one marked `entry`), the others reached by the keys that move it.
167
179
  */
168
- export declare function Row({ rowKey, mark, name, nameClass, className, onOpen, tabbable, focusable, entry, children }: RowProps): ReactElement;
180
+ export declare function Row({ rowKey, mark, name, nameClass, className, onOpen, level, tabbable, focusable, entry, children }: RowProps): ReactElement;
169
181
  /** Props for {@link Cell}. */
170
182
  export interface CellProps {
171
183
  /** Right-aligned, for numbers. */
@@ -177,8 +189,11 @@ export interface CellProps {
177
189
  }
178
190
  /** A cell of a row after its name, in the listing's metadata look (`.row-meta`). */
179
191
  export declare function Cell({ align, className, tip, children }: CellProps): ReactElement;
180
- /** The tone of a state: ready, a warning, a failure, a transition under way, or quiet. */
181
- export type StateTone = 'ready' | 'warning' | 'danger' | 'busy' | 'muted';
192
+ /**
193
+ * The tone of a state: ready, a warning, a failure, a transition under way,
194
+ * quiet, or a note (`info`: an Info or Note line, in the accent).
195
+ */
196
+ export type StateTone = 'ready' | 'warning' | 'danger' | 'busy' | 'muted' | 'info';
182
197
  /** Props for {@link StateMark}. */
183
198
  export interface StateMarkProps {
184
199
  readonly tone: StateTone;
@@ -186,6 +201,8 @@ export interface StateMarkProps {
186
201
  readonly word: string;
187
202
  /** A transition under way: a spinner in place of the dot. */
188
203
  readonly busy?: boolean;
204
+ /** What the state means, beyond its word: the mark's tooltip and accessible description. */
205
+ readonly tip?: string;
189
206
  }
190
207
  /**
191
208
  * A state as a State column says it: a mark in the state's tone and its word
@@ -194,9 +211,10 @@ export interface StateMarkProps {
194
211
  * without its hue. Inside a row the word takes the tone too, so a failure
195
212
  * reads red and a stopped line dim. A word wider than its column ends in an
196
213
  * ellipsis and carries itself whole as its tooltip, which a word shown
197
- * whole does not open.
214
+ * whole does not open; a `tip` says what the state means instead, as the
215
+ * whole mark's tooltip and description.
198
216
  */
199
- export declare function StateMark({ tone, word, busy }: StateMarkProps): ReactElement;
217
+ export declare function StateMark({ tone, word, busy, tip }: StateMarkProps): ReactElement;
200
218
  /** Props for {@link PathCell}. */
201
219
  export interface PathCellProps {
202
220
  /** The whole path, slash-separated ("/opt/homebrew/var/mysql"). */
@@ -44,10 +44,10 @@ export const linksColumn = (look, icons, words, extraPx = 0) => look === 'icons'
44
44
  * arrow of the way it sorts beside the label (before it over numbers, so
45
45
  * the label keeps the edge they line up on).
46
46
  */
47
- function SortLabel({ label, sort, align }) {
47
+ function SortLabel({ label, sort, align, tip }) {
48
48
  const { sortBy } = useLabels().listing;
49
49
  const mark = sort.direction === null ? null : sort.direction === 'asc' ? (_jsx(ChevronUp, { "aria-hidden": true, size: ICON_SM })) : (_jsx(ChevronDown, { "aria-hidden": true, size: ICON_SM }));
50
- return (_jsxs("button", { "aria-label": sortBy(label, sort.direction), className: sort.direction === null ? 'pane-sort sortable' : 'pane-sort sortable active', onClick: sort.onSort, type: "button", children: [align === 'right' && mark, _jsx("span", { className: "pane-sort-label", ...cutTooltip(label), children: label }), align !== 'right' && mark] }));
50
+ return (_jsxs("button", { "aria-label": sortBy(label, sort.direction), className: sort.direction === null ? 'pane-sort sortable' : 'pane-sort sortable active', onClick: sort.onSort, type: "button", ...describedTooltip(tip), children: [align === 'right' && mark, _jsx("span", { className: "pane-sort-label", ...(tip === undefined ? cutTooltip(label) : {}), children: label }), align !== 'right' && mark] }));
51
51
  }
52
52
  /** The `aria-sort` of a sorting column's header. */
53
53
  const ariaSort = (sort) => sort?.direction === 'asc' ? 'ascending' : sort?.direction === 'desc' ? 'descending' : undefined;
@@ -72,7 +72,9 @@ export function Strip({ title, columns = [], table = false, heading = false, cla
72
72
  .join(' '), "aria-sort": table ? ariaSort(entry.sort) : undefined, role: table ? 'columnheader' : undefined, children: [entry.control, entry.hidden === true
73
73
  ? table && _jsx("span", { className: "visually-hidden", children: entry.label })
74
74
  : entry.control === undefined &&
75
- (entry.sort === undefined ? (_jsx("span", { className: "pane-sort", children: _jsx("span", { className: "pane-sort-label", ...cutTooltip(entry.label), children: entry.label }) })) : (_jsx(SortLabel, { align: entry.align, label: entry.label, sort: entry.sort })))] }, entry.label)))] }));
75
+ (entry.sort === undefined ? (_jsx("span", { className: "pane-sort", children: _jsx("span", { className: "pane-sort-label", ...(entry.tip === undefined
76
+ ? cutTooltip(entry.label)
77
+ : describedTooltip(entry.tip)), children: entry.label }) })) : (_jsx(SortLabel, { align: entry.align, label: entry.label, sort: entry.sort, tip: entry.tip })))] }, entry.label)))] }));
76
78
  }
77
79
  /** The plainer look a row link takes when the one it has makes its listing scroll sideways. */
78
80
  const PLAINER_LOOK = {
@@ -211,7 +213,7 @@ export const RowCursorContext = createContext({
211
213
  * is a stop of its own: the cursor row in the Tab order (or, while no row
212
214
  * is, the one marked `entry`), the others reached by the keys that move it.
213
215
  */
214
- export function Row({ rowKey, mark, name, nameClass, className, onOpen, tabbable = false, focusable = false, entry = false, children }) {
216
+ export function Row({ rowKey, mark, name, nameClass, className, onOpen, level = 0, tabbable = false, focusable = false, entry = false, children }) {
215
217
  const cursor = useContext(RowCursorContext);
216
218
  const current = useSyncExternalStore(cursor.subscribe, () => cursor.current() === rowKey);
217
219
  useLayoutEffect(() => {
@@ -224,7 +226,7 @@ export function Row({ rowKey, mark, name, nameClass, className, onOpen, tabbable
224
226
  onPointerMove: () => {
225
227
  if (!current)
226
228
  cursor.point(rowKey);
227
- }, role: "row", tabIndex: focusable ? (current || entry ? 0 : -1) : undefined, children: [_jsx("span", { "aria-hidden": true, className: "row-icon", children: mark }), _jsx("span", { className: nameClass === undefined ? 'row-name' : `row-name ${nameClass}`, role: "cell", ...(typeof name === 'string' ? cutTooltip(name) : {}), children: name }), children] }) }) }));
229
+ }, role: "row", style: level > 0 ? { '--row-level': level } : undefined, tabIndex: focusable ? (current || entry ? 0 : -1) : undefined, children: [_jsx("span", { "aria-hidden": true, className: "row-icon", children: mark }), _jsx("span", { className: nameClass === undefined ? 'row-name' : `row-name ${nameClass}`, role: "cell", ...(typeof name === 'string' ? cutTooltip(name) : {}), children: name }), children] }) }) }));
228
230
  }
229
231
  /** A cell of a row after its name, in the listing's metadata look (`.row-meta`). */
230
232
  export function Cell({ align, className, tip, children }) {
@@ -239,10 +241,11 @@ export function Cell({ align, className, tip, children }) {
239
241
  * without its hue. Inside a row the word takes the tone too, so a failure
240
242
  * reads red and a stopped line dim. A word wider than its column ends in an
241
243
  * ellipsis and carries itself whole as its tooltip, which a word shown
242
- * whole does not open.
244
+ * whole does not open; a `tip` says what the state means instead, as the
245
+ * whole mark's tooltip and description.
243
246
  */
244
- export function StateMark({ tone, word, busy = false }) {
245
- return (_jsxs("span", { className: `pane-state pane-tone-${tone}`, children: [busy ? (_jsx(Spinner, { className: "pane-state-busy" })) : (_jsx("span", { "aria-hidden": true, className: "pane-state-dot" })), _jsx("span", { className: "pane-state-word", ...cutTooltip(word), children: word })] }));
247
+ export function StateMark({ tone, word, busy = false, tip }) {
248
+ return (_jsxs("span", { className: `pane-state pane-tone-${tone}`, ...describedTooltip(tip), children: [busy ? (_jsx(Spinner, { className: "pane-state-busy" })) : (_jsx("span", { "aria-hidden": true, className: "pane-state-dot" })), _jsx("span", { className: "pane-state-word", ...(tip === undefined ? cutTooltip(word) : {}), children: word })] }));
246
249
  }
247
250
  /**
248
251
  * A path cell: its folders in the row-meta tone, the head giving way first
@@ -1148,7 +1148,7 @@ button.crumb-label > .crumb-text {
1148
1148
 
1149
1149
  /* The bar: the state's tone, the width of the old inset bar. A row in no
1150
1150
  state draws none. */
1151
- :where(.listing-root) .row:is(.cursor, .marked)::after {
1151
+ :where(.listing-root) .row:is(.cursor, .marked, .row-changed)::after {
1152
1152
  content: '';
1153
1153
  width: var(--line-strong);
1154
1154
  background: var(--row-bar, transparent);
@@ -1236,6 +1236,42 @@ button.crumb-label > .crumb-text {
1236
1236
  background: var(--row-fill);
1237
1237
  }
1238
1238
 
1239
+ /* Rows a save will change, the listing form of the grid's cell states
1240
+ (host classes through Row's className): a changed row (.row-changed)
1241
+ on the warning wash with a warning bar on its leading edge, and a row a
1242
+ save will delete (.row-removed) struck out in --danger on the danger
1243
+ wash, its quiet words in the on-surface tone floored on a state ground.
1244
+ The cursor, a mark, and a selection paint their own fill and bar over
1245
+ either; a removed row keeps its strike. */
1246
+ :where(.listing-root) .row.row-changed:where(:not(.cursor, .marked, .selected)) {
1247
+ --row-fill: var(--warning-wash);
1248
+ --row-bar: var(--warning);
1249
+
1250
+ background: var(--row-fill);
1251
+ }
1252
+
1253
+ :where(.listing-root) .row.row-removed:where(:not(.cursor, .marked, .selected)) {
1254
+ --row-fill: var(--danger-wash);
1255
+
1256
+ background: var(--row-fill);
1257
+ }
1258
+
1259
+ :where(.listing-root) .row.row-removed > :is(.row-name, .row-meta) {
1260
+ text-decoration: line-through;
1261
+ text-decoration-color: var(--danger);
1262
+ }
1263
+
1264
+ :where(.listing-root) .row:is(.row-changed, .row-removed):where(:not(.selected)) > .row-meta {
1265
+ color: var(--text-on-surface);
1266
+ }
1267
+
1268
+ /* A row something is dragged over that will take the drop (.drop-target):
1269
+ an accent outline inside its edges, over whatever state it is in. */
1270
+ :where(.listing-root) .row.drop-target,
1271
+ :where(.listing-root) .row.drop-target:is(.cursor, .marked, .selected) {
1272
+ box-shadow: inset 0 0 0 var(--line-strong) var(--accent);
1273
+ }
1274
+
1239
1275
  /* A focusable row (`Row` `focusable`) rings inside its edges: the list
1240
1276
  around it scrolls, and would clip a ring drawn outside. */
1241
1277
  :where(.listing-root) .row:focus-visible {
@@ -1315,6 +1351,13 @@ button.crumb-label > .crumb-text {
1315
1351
  white-space: nowrap;
1316
1352
  }
1317
1353
 
1354
+ /* A row in a tree or a plan (Row's level, as --row-level) indents its
1355
+ name one icon column a level, so a child's name starts under its
1356
+ parent's. At zero weight, so a host's own rule on the name wins. */
1357
+ :where(.listing-root .row > .row-name) {
1358
+ padding-inline-start: calc(var(--row-level, 0) * var(--icon-column));
1359
+ }
1360
+
1318
1361
  /* A listing selects rows, not text, as a file manager does: a drag, a
1319
1362
  Shift-click, or a double-click on a row never starts a text selection,
1320
1363
  in its name and values included, and a row copies through the host's
@@ -1358,6 +1401,13 @@ button.crumb-label > .crumb-text {
1358
1401
  text-align: right;
1359
1402
  }
1360
1403
 
1404
+ /* A missing value (SQL NULL) in a cell: italic in the row-meta tone, as
1405
+ the grid's cell-null; a state row's quiet-word rule takes it to the
1406
+ on-surface tone. */
1407
+ :where(.listing-root) .row-meta.value-null {
1408
+ font-style: italic;
1409
+ }
1410
+
1361
1411
  /* The status line closes the pane: a summary of what the pane lists. Its
1362
1412
  words start, and its last control's glyph ends, on the row inset, the
1363
1413
  edges the path bar and the rows keep. */
@@ -1384,6 +1434,19 @@ button.crumb-label > .crumb-text {
1384
1434
  white-space: nowrap;
1385
1435
  }
1386
1436
 
1437
+ /* A notice as the status line's message keeps to its one line: centred on
1438
+ the bar, its words cut with an ellipsis rather than wrapped (give its
1439
+ notice-text cutTooltip with the whole text). */
1440
+ :where(.listing-root) .pane-summary > .notice {
1441
+ align-items: center;
1442
+ }
1443
+
1444
+ :where(.listing-root) .pane-summary > .notice .notice-text {
1445
+ overflow: hidden;
1446
+ text-overflow: ellipsis;
1447
+ white-space: nowrap;
1448
+ }
1449
+
1387
1450
  /* Compact controls at the status line's end (PaneStatus's tools: Reveal,
1388
1451
  Copy); the summary before them gives way to them. */
1389
1452
  :where(.listing-root) .pane-status-tools {
@@ -1584,6 +1647,28 @@ button.crumb-label > .crumb-text {
1584
1647
  color: var(--text);
1585
1648
  }
1586
1649
 
1650
+ /* A warning (.warning): the warning tone's TriangleAlert, drawn as a mask
1651
+ in --warning as the danger line's glyph is, then the words in --text. A
1652
+ host that draws its own glyph first (an svg) gets no second one. */
1653
+ :where(.listing-root) .pane-message.warning {
1654
+ color: var(--text);
1655
+ }
1656
+
1657
+ :where(.listing-root) .pane-message.warning:not(:has(> svg:first-child))::before {
1658
+ content: '';
1659
+ flex: none;
1660
+ width: var(--icon-md);
1661
+ height: var(--icon-md);
1662
+ background: var(--warning);
1663
+ mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3'/%3E%3Cpath d='M12 9v4'/%3E%3Cpath d='M12 17h.01'/%3E%3C/svg%3E")
1664
+ center / contain no-repeat;
1665
+ }
1666
+
1667
+ :where(.listing-root) .pane-message.warning > svg:first-child {
1668
+ flex: none;
1669
+ color: var(--warning);
1670
+ }
1671
+
1587
1672
  /* A line that says a listing has no rows (`.empty`, Listing's `empty`)
1588
1673
  reads as a quiet row in the rows' place: it starts where a row's icon
1589
1674
  starts, in the rows' own typeface and size (the host's, as the rows'
@@ -1630,6 +1715,12 @@ button.crumb-label > .crumb-text {
1630
1715
  color: var(--text-faint);
1631
1716
  }
1632
1717
 
1718
+ /* A pane that could not load (role="alert") leads with its glyph in the
1719
+ danger tone, as every failure's glyph is. */
1720
+ :where(.listing-root) .pane-empty[role='alert'] > svg {
1721
+ color: var(--danger);
1722
+ }
1723
+
1633
1724
  :where(.listing-root) .pane-empty :is(strong, h2) {
1634
1725
  margin: 0;
1635
1726
  color: var(--text);
@@ -1744,6 +1835,14 @@ button.crumb-label > .crumb-text {
1744
1835
  box-shadow: inset 0 0 0 var(--line-strong) var(--accent);
1745
1836
  }
1746
1837
 
1838
+ /* A note (info): an upright accent bar, the stem of an "i", as tall as the
1839
+ dot, so it reads apart from the busy ring in the same hue. */
1840
+ :where(.listing-root) .pane-tone-info > .pane-state-dot {
1841
+ width: var(--line-strong);
1842
+ background: var(--accent);
1843
+ box-shadow: none;
1844
+ }
1845
+
1747
1846
  /* The busy spinner is the shared Spinner (it turns and stands still under
1748
1847
  reduced motion on its own); the state only colours it. */
1749
1848
  :where(.listing-root) .pane-state > svg.pane-state-busy {
@@ -1781,7 +1880,7 @@ button.crumb-label > .crumb-text {
1781
1880
  on the accent tint whatever its hue. */
1782
1881
  :where(.listing-root)
1783
1882
  .row.marked:where(:not(.selected))
1784
- :is(.pane-tone-ready, .pane-tone-warning, .pane-tone-danger)
1883
+ :is(.pane-tone-ready, .pane-tone-warning, .pane-tone-danger, .pane-tone-info)
1785
1884
  > .pane-state-dot {
1786
1885
  box-shadow: 0 0 0 var(--line) var(--text-on-surface);
1787
1886
  }
@@ -1798,6 +1897,10 @@ button.crumb-label > .crumb-text {
1798
1897
  color: var(--warning-text);
1799
1898
  }
1800
1899
 
1900
+ :where(.listing-root) .row .pane-state.pane-tone-info {
1901
+ color: var(--accent-text);
1902
+ }
1903
+
1801
1904
  :where(.listing-root) .row .pane-state:is(.pane-tone-muted, .pane-tone-busy) {
1802
1905
  color: var(--row-meta-text);
1803
1906
  }
@@ -2207,7 +2310,7 @@ button.crumb-label > .crumb-text {
2207
2310
  .listing-root:has(.pane.active) .pane:not(.active, .active .pane) *
2208
2311
  )
2209
2312
  )
2210
- :is(.pane-tone-ready, .pane-tone-warning, .pane-tone-danger)
2313
+ :is(.pane-tone-ready, .pane-tone-warning, .pane-tone-danger, .pane-tone-info)
2211
2314
  > .pane-state-dot {
2212
2315
  box-shadow: 0 0 0 var(--line) var(--on-selected);
2213
2316
  }
@@ -134,6 +134,8 @@ export interface RowIconActionProps {
134
134
  readonly word?: string;
135
135
  /** A destructive action, drawn as on `QuietAction`. */
136
136
  readonly danger?: boolean;
137
+ /** The chord that runs it, as text ("⌘⌫"), written after the words in its tooltip as on `QuietAction`. */
138
+ readonly shortcut?: string;
137
139
  }
138
140
  /**
139
141
  * A compact icon control: in a row, one that shows on its row's hover, its
@@ -143,4 +145,4 @@ export interface RowIconActionProps {
143
145
  * in the listing look. Under `RowLinkLookContext` an action that names its
144
146
  * verb (`word`, a row link) draws it in place of the icon or beside it.
145
147
  */
146
- export declare function RowIconAction({ icon: Icon, label, disabled, onClick, ref, softDisabled, tip, verb, word, danger }: RowIconActionProps): ReactElement;
148
+ export declare function RowIconAction({ icon: Icon, label, disabled, onClick, ref, softDisabled, tip, verb, word, danger, shortcut }: RowIconActionProps): ReactElement;
@@ -91,7 +91,7 @@ export function QuietAction({ icon: Icon, word, label, lit = false, disabled = f
91
91
  * in the listing look. Under `RowLinkLookContext` an action that names its
92
92
  * verb (`word`, a row link) draws it in place of the icon or beside it.
93
93
  */
94
- export function RowIconAction({ icon: Icon, label, disabled = false, onClick, ref, softDisabled = false, tip = label, verb, word, danger = false }) {
94
+ export function RowIconAction({ icon: Icon, label, disabled = false, onClick, ref, softDisabled = false, tip = label, verb, word, danger = false, shortcut }) {
95
95
  const inRow = useInRow();
96
96
  const chosen = useContext(RowLinkLookContext);
97
97
  // Only an action that names its verb draws it in words.
@@ -102,9 +102,10 @@ export function RowIconAction({ icon: Icon, label, disabled = false, onClick, re
102
102
  event.stopPropagation();
103
103
  if (!softDisabled)
104
104
  onClick();
105
- }, ref: ref, tabIndex: inRow ? -1 : undefined, type: "button", ...(look !== 'icons' && tip === word
105
+ }, ref: ref, tabIndex: inRow ? -1 : undefined, type: "button", ...(look !== 'icons' && tip === word && shortcut === undefined
106
106
  ? {}
107
- : tip === label
108
- ? tooltip(label)
109
- : describedTooltip(tip)), children: [look !== 'text' && _jsx(Icon, { "aria-hidden": true, size: ICON_SM }), look !== 'icons' && _jsx("span", { children: word })] }));
107
+ : {
108
+ ...(tip === label ? tooltip(label) : describedTooltip(tip)),
109
+ ...(shortcut === undefined ? {} : { 'data-tooltip-shortcut': shortcut })
110
+ }), children: [look !== 'text' && _jsx(Icon, { "aria-hidden": true, size: ICON_SM }), look !== 'icons' && _jsx("span", { children: word })] }));
110
111
  }
@@ -0,0 +1,92 @@
1
+ import { type MouseEvent, type ReactElement, type ReactNode } from 'react';
2
+ import type { Chord } from '../keyboard/Keyboard.logic.js';
3
+ /** One tab of a pane's strip. */
4
+ export interface PaneTabItem {
5
+ /** Names the tab to every callback; also its `data-pane-tab` attribute. */
6
+ readonly id: string;
7
+ /** What the tab shows. */
8
+ readonly name: string;
9
+ /**
10
+ * Dim words before the name and a slash, to tell two tabs of one name
11
+ * apart (`shop` / `orders`). They give way to an ellipsis before the
12
+ * name loses a character.
13
+ */
14
+ readonly context?: string;
15
+ /** A node ahead of the name: a group's swatch or a lucide icon at `ICON_SM`. Decorative. */
16
+ readonly mark?: ReactNode;
17
+ /** The tooltip, at every width: the tab's whole path. Also its accessible description. */
18
+ readonly tip?: string;
19
+ /** The next place opened takes this tab over: its name is set in italic. */
20
+ readonly following?: boolean;
21
+ /**
22
+ * The tab holds changes not saved: the warning mark stands where its close
23
+ * control is, and the control comes back under the pointer.
24
+ */
25
+ readonly dirty?: boolean;
26
+ /** Stands before the pin rule, keeps its width, and carries a pin in place of a close control. */
27
+ readonly pinned?: boolean;
28
+ /** `'danger'` outlines the tab in the danger colour at every width (a place that needs care). */
29
+ readonly tone?: 'danger';
30
+ /** False draws no close control, and a middle click closes nothing. True by default. */
31
+ readonly closable?: boolean;
32
+ }
33
+ /** Props for {@link PaneTabs}. */
34
+ export interface PaneTabsProps {
35
+ /** The tablist's accessible name. */
36
+ readonly label: string;
37
+ /** The tabs in strip order; pinned tabs must come first. */
38
+ readonly tabs: readonly PaneTabItem[];
39
+ /** The id of the tab in front: exactly one, among `tabs`. */
40
+ readonly front: string;
41
+ /**
42
+ * The ids picked beside the tab in front, which the host keeps
43
+ * (`togglePick`, `pickRun`, `pickedTabs`). A picked tab wears the marked
44
+ * look and a drag of it carries every pick.
45
+ */
46
+ readonly picked?: readonly string[];
47
+ /** A press on a tab, or a choice in the folded tabs' menu: bring that tab to the front. */
48
+ readonly onSelect: (id: string) => void;
49
+ /** A tab's close control, or a middle click on a tab that has one. */
50
+ readonly onClose: (id: string) => void;
51
+ /** ⌘-click picks or drops a tab (`'toggle'`); ⇧-click picks the run from the front tab (`'run'`). */
52
+ readonly onPick?: (id: string, how: 'toggle' | 'run') => void;
53
+ /** A double-click on a tab: keeps a following tab. */
54
+ readonly onKeep?: (id: string) => void;
55
+ /** After a drag drops, the full order, folded tabs included. Omit to turn dragging off. */
56
+ readonly onReorder?: (order: readonly string[]) => void;
57
+ /** The New Tab button, and a double-click on the strip's empty end. Omit to draw no button. */
58
+ readonly onNew?: () => void;
59
+ /** The chord New Tab's tooltip shows; ⌘T by default. */
60
+ readonly newChord?: Chord;
61
+ /** A secondary click on a tab; the host decides whether to prevent the browser's menu. */
62
+ readonly onTabContextMenu?: (id: string, event: MouseEvent) => void;
63
+ /** Drawn after the folded tabs' count, at the strip's end (an update pill). */
64
+ readonly trailing?: ReactNode;
65
+ }
66
+ /**
67
+ * The tabs a pane hangs from: the first child of a `.pane` under
68
+ * `.listing-root`, whose frame hangs from the tab in front. A tab wears its
69
+ * place's name, with dim context before it when two tabs share a name; the
70
+ * one in front joins the frame, the others stand behind it, shorter and
71
+ * fainter. A following tab's name is italic, a dirty tab carries the
72
+ * warning mark in its close control's place, a pinned tab stands before the
73
+ * pin rule with a pin, and a danger-toned tab keeps its danger outline.
74
+ *
75
+ * The strip never wraps or scrolls. Tabs behind the front one shrink
76
+ * together to a floor (eight characters of the name, three of the
77
+ * context), then fold into a count after New Tab, farthest from the front
78
+ * tab first; pinned, front, and following tabs never fold, and pinned and
79
+ * front never shrink. The count's menu names the folded tabs.
80
+ *
81
+ * A press brings a tab to the front at once and, with `onReorder`, may
82
+ * start a drag (past a 4px slop): the held tab follows the pointer, its
83
+ * neighbours step aside at half cover, it stays its side of the pin rule,
84
+ * picked tabs ride with it, Escape puts every tab back, and release hands
85
+ * the full order to `onReorder`. ⌘-click and ⇧-click pick (`onPick`), a
86
+ * middle click closes, a double-click keeps (`onKeep`), and a double-click
87
+ * on the strip's empty end opens a new tab (`onNew`).
88
+ *
89
+ * Tabs take no focus: the host's verbs are the keyboard's way in. Words
90
+ * come from `useLabels().paneTabs`.
91
+ */
92
+ export declare function PaneTabs({ label, tabs, front, picked, onSelect, onClose, onPick, onKeep, onReorder, onNew, newChord, onTabContextMenu, trailing }: PaneTabsProps): ReactElement;