@surfaces-ui/components 0.2.0 → 0.4.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.
Files changed (53) hide show
  1. package/README.md +3 -0
  2. package/dist/chart/BulletGraph.js +2 -1
  3. package/dist/chart/BulletGraph.js.map +1 -1
  4. package/dist/chart/Chart.d.ts +2 -1
  5. package/dist/chart/Chart.js +9 -3
  6. package/dist/chart/Chart.js.map +1 -1
  7. package/dist/chart/Sparkline.js +2 -1
  8. package/dist/chart/Sparkline.js.map +1 -1
  9. package/dist/chart/advice.d.ts +5 -1
  10. package/dist/chart/advice.js +9 -0
  11. package/dist/chart/advice.js.map +1 -1
  12. package/dist/chart/wheel.d.ts +12 -0
  13. package/dist/chart/wheel.js +21 -0
  14. package/dist/chart/wheel.js.map +1 -0
  15. package/dist/data/DataNotes.d.ts +13 -0
  16. package/dist/data/DataNotes.js +18 -0
  17. package/dist/data/DataNotes.js.map +1 -0
  18. package/dist/discovery/AskData.js +2 -1
  19. package/dist/discovery/AskData.js.map +1 -1
  20. package/dist/explore/SemanticRows.js +5 -1
  21. package/dist/explore/SemanticRows.js.map +1 -1
  22. package/dist/graph/NodeGraph.js +3 -0
  23. package/dist/graph/NodeGraph.js.map +1 -1
  24. package/dist/grid/DataGrid.js +2 -1
  25. package/dist/grid/DataGrid.js.map +1 -1
  26. package/dist/index.d.ts +1 -0
  27. package/dist/index.js +1 -0
  28. package/dist/index.js.map +1 -1
  29. package/dist/metric/Metric.js +3 -2
  30. package/dist/metric/Metric.js.map +1 -1
  31. package/dist/metric/useMeasure.d.ts +2 -0
  32. package/dist/metric/useMeasure.js +2 -1
  33. package/dist/metric/useMeasure.js.map +1 -1
  34. package/dist/model/ModelDiagram.js +2 -1
  35. package/dist/model/ModelDiagram.js.map +1 -1
  36. package/dist/pivot/PivotTable.js +8 -3
  37. package/dist/pivot/PivotTable.js.map +1 -1
  38. package/dist/result/QueryResult.js +2 -1
  39. package/dist/result/QueryResult.js.map +1 -1
  40. package/dist/rows/RowList.js +3 -2
  41. package/dist/rows/RowList.js.map +1 -1
  42. package/dist/styles.css +113 -26
  43. package/dist/styles.layer.css +113 -26
  44. package/dist/theme/ThemePicker.d.ts +2 -2
  45. package/dist/theme/ThemePicker.js +3 -2
  46. package/dist/theme/ThemePicker.js.map +1 -1
  47. package/dist/theme/ThemeProvider.d.ts +10 -1
  48. package/dist/theme/ThemeProvider.js +31 -16
  49. package/dist/theme/ThemeProvider.js.map +1 -1
  50. package/dist/workspace/Workspace.d.ts +3 -0
  51. package/dist/workspace/Workspace.js +1 -1
  52. package/dist/workspace/Workspace.js.map +1 -1
  53. package/package.json +6 -6
package/dist/styles.css CHANGED
@@ -1357,21 +1357,14 @@ select.sf-input:disabled {
1357
1357
  cursor: pointer;
1358
1358
  }
1359
1359
 
1360
- .sf-result-sql summary:focus-visible,
1361
- .sf-result-sql pre:focus-visible {
1360
+ .sf-result-sql summary:focus-visible {
1362
1361
  outline: 2px solid var(--sf-color-focus);
1363
1362
  outline-offset: 2px;
1364
1363
  }
1365
1364
 
1366
- .sf-result-sql pre {
1367
- margin: var(--sf-space-2) 0 0;
1368
- padding: var(--sf-space-3);
1369
- border-radius: var(--sf-radius);
1370
- background: var(--sf-color-surface);
1371
- color: var(--sf-color-text);
1372
- font-family: var(--sf-font-mono);
1373
- white-space: pre-wrap;
1374
- overflow-wrap: anywhere;
1365
+ /* The SQL is a CodeBlock, highlighted by the theme's code colours like every other read-only query. */
1366
+ .sf-result-sql > .sf-code {
1367
+ margin-top: var(--sf-space-2);
1375
1368
  }
1376
1369
 
1377
1370
  .sf-result-notice {
@@ -1914,8 +1907,7 @@ select.sf-input:disabled {
1914
1907
  font-size: var(--sf-font-size-sm);
1915
1908
  }
1916
1909
 
1917
- .sf-context-preview,
1918
- .sf-ask-sql pre {
1910
+ .sf-context-preview {
1919
1911
  max-height: 320px;
1920
1912
  margin: 0;
1921
1913
  padding: var(--sf-space-3);
@@ -1930,12 +1922,17 @@ select.sf-input:disabled {
1930
1922
  overflow-wrap: anywhere;
1931
1923
  }
1932
1924
 
1933
- .sf-context-preview:focus-visible,
1934
- .sf-ask-sql pre:focus-visible {
1925
+ .sf-context-preview:focus-visible {
1935
1926
  outline: 2px solid var(--sf-color-focus);
1936
1927
  outline-offset: 2px;
1937
1928
  }
1938
1929
 
1930
+ /* A proposal is a CodeBlock, highlighted like every other read-only query; a long one scrolls inside its block. */
1931
+ .sf-ask-sql .sf-code pre {
1932
+ max-height: 320px;
1933
+ overflow: auto;
1934
+ }
1935
+
1939
1936
  .sf-context-actions {
1940
1937
  display: flex;
1941
1938
  flex-wrap: wrap;
@@ -2091,7 +2088,7 @@ select.sf-input:disabled {
2091
2088
  justify-items: start;
2092
2089
  }
2093
2090
 
2094
- .sf-ask-sql pre {
2091
+ .sf-ask-sql > .sf-code {
2095
2092
  width: 100%;
2096
2093
  }
2097
2094
 
@@ -3450,6 +3447,25 @@ select.sf-input:disabled {
3450
3447
  gap: var(--sf-space-2);
3451
3448
  }
3452
3449
 
3450
+ /* In a narrow place the suggestions are one row that scrolls sideways, so they do not take the thread's room. */
3451
+ @container sf (max-width: 40rem) {
3452
+ .sf-chat-suggestions {
3453
+ flex-wrap: nowrap;
3454
+ overflow-x: auto;
3455
+ overscroll-behavior-x: contain;
3456
+ scroll-snap-type: x proximity;
3457
+ scrollbar-width: none;
3458
+ /* Room for a button's focus ring inside the scrolling row. */
3459
+ padding: 2px;
3460
+ margin: -2px;
3461
+ }
3462
+
3463
+ .sf-chat-suggestions > * {
3464
+ flex: 0 0 auto;
3465
+ scroll-snap-align: start;
3466
+ }
3467
+ }
3468
+
3453
3469
  /* Buttons the host offers under a reply (ChatActions): one row, or a row for each choice. */
3454
3470
  .sf-chat-actions {
3455
3471
  container: sf-chat-actions / inline-size;
@@ -3679,6 +3695,15 @@ select.sf-input:disabled {
3679
3695
  margin-inline-start: auto;
3680
3696
  }
3681
3697
 
3698
+ /* On touch every tool is a 44px target around a small icon, which is space enough between them; without gaps the
3699
+ whole toolbar fits on one row of a phone. */
3700
+ @media (pointer: coarse) {
3701
+ .sf-chat-toolbar,
3702
+ .sf-chat-toolbar-end {
3703
+ column-gap: 0;
3704
+ }
3705
+ }
3706
+
3682
3707
  .sf-chat-icon {
3683
3708
  flex: none;
3684
3709
  width: 1.15em;
@@ -3749,8 +3774,9 @@ select.sf-input:disabled {
3749
3774
  .sf-chat-send {
3750
3775
  display: inline-grid;
3751
3776
  place-items: center;
3752
- width: calc(var(--sf-target-min) * 1.34);
3753
- height: calc(var(--sf-target-min) * 1.34);
3777
+ /* A control's size, and a touch target's where that is larger: Send stays in the toolbar's row on a phone. */
3778
+ width: max(var(--sf-target-min), var(--sf-control-size));
3779
+ height: max(var(--sf-target-min), var(--sf-control-size));
3754
3780
  border: 0;
3755
3781
  border-radius: 50%;
3756
3782
  background: var(--sf-color-accent);
@@ -4320,6 +4346,11 @@ select.sf-input:disabled {
4320
4346
  .sf-a2-grid[data-widths] {
4321
4347
  grid-template-columns: minmax(0, 1fr);
4322
4348
  }
4349
+
4350
+ /* One column: a column's width handle has nothing beside it (see the narrow container rules). */
4351
+ .sf-a2-grid > :is(.sf-arrange-frame, .sf-arrange-view) > .sf-resize-handle[data-edge="right"] {
4352
+ display: none;
4353
+ }
4323
4354
  }
4324
4355
 
4325
4356
  /* Page studio */
@@ -4828,6 +4859,7 @@ select.sf-input:disabled {
4828
4859
 
4829
4860
  .sf-spark {
4830
4861
  display: inline-flex;
4862
+ flex-wrap: wrap;
4831
4863
  align-items: center;
4832
4864
  gap: var(--sf-space-2);
4833
4865
  max-width: 100%;
@@ -5394,6 +5426,13 @@ select.sf-input:disabled {
5394
5426
  flex: 1 1 100% !important;
5395
5427
  }
5396
5428
 
5429
+ /* Nor the handles that set them: with nothing beside a child, its handle would stand past the page's right edge. */
5430
+ .sf-a2-grid > :is(.sf-arrange-frame, .sf-arrange-view) > .sf-resize-handle[data-edge="right"],
5431
+ .sf-a2-row:where(:not([data-wrap="false"])) > :is(.sf-arrange-frame, .sf-arrange-view) > .sf-resize-handle[data-edge="right"],
5432
+ .sf-a2-row:where(:not([data-wrap="false"])) > .sf-a2-row-cell > :is(.sf-arrange-frame, .sf-arrange-view) > .sf-resize-handle[data-edge="right"] {
5433
+ display: none;
5434
+ }
5435
+
5397
5436
  .sf-plan-review-step {
5398
5437
  grid-template-columns: minmax(0, 1fr);
5399
5438
  }
@@ -6299,12 +6338,24 @@ select.sf-input:disabled {
6299
6338
  flex: 0 0 auto !important;
6300
6339
  }
6301
6340
 
6302
- /* Stacked, a panel is as tall as its content, up to a screenful's worth, and scrolls past that. */
6341
+ /* Stacked, a panel is as tall as its content and the page scrolls past it: a box that scrolls inside a page that
6342
+ scrolls catches a phone's swipe, and its scroll bars took room the content needed. */
6303
6343
  .sf-workspace-panel {
6304
- max-height: min(var(--sf-workspace-height, 32rem), 36rem);
6305
6344
  margin-bottom: var(--sf-space-2);
6306
6345
  }
6307
6346
 
6347
+ .sf-workspace-panel:not([data-fill]),
6348
+ .sf-workspace-panel:not([data-fill]) > .sf-workspace-panel-body {
6349
+ overflow: visible;
6350
+ }
6351
+
6352
+ /* Content that scrolls inside itself has no height of its own to grow to, so a panel that fills is about a screenful
6353
+ below the host's sticky bar: scrolled to, the whole conversation and its composer are in view. */
6354
+ .sf-workspace-panel[data-fill]:not([data-folded]) {
6355
+ height: max(20rem, calc(100dvh - var(--sf-sticky-top, 0px) - var(--sf-space-4)));
6356
+ max-height: none;
6357
+ }
6358
+
6308
6359
  .sf-workspace-divider {
6309
6360
  display: none;
6310
6361
  }
@@ -8049,12 +8100,16 @@ button > .sf-item-control-icon:only-child {
8049
8100
  }
8050
8101
 
8051
8102
  .sf-semantic-identity label,
8052
- .sf-semantic-write label,
8103
+ .sf-semantic-write > p,
8053
8104
  .sf-semantic-ask label {
8054
8105
  font-size: var(--sf-font-size-sm);
8055
8106
  color: var(--sf-color-muted);
8056
8107
  }
8057
8108
 
8109
+ .sf-semantic-write > p {
8110
+ margin: 0;
8111
+ }
8112
+
8058
8113
  .sf-semantic-write textarea {
8059
8114
  font-family: var(--sf-font-mono);
8060
8115
  resize: vertical;
@@ -8147,15 +8202,13 @@ button > .sf-item-control-icon:only-child {
8147
8202
  }
8148
8203
 
8149
8204
  .sf-analytics-conversation {
8205
+ /* The thread keeps room to read even when suggestions and the composer are tall. The track holds that minimum, not
8206
+ the list alone, so the rows below never draw over the thread; the panel scrolls when there is not room for all. */
8207
+ grid-template-rows: minmax(10rem, 1fr) auto auto auto;
8150
8208
  height: 100%;
8151
8209
  min-height: 0;
8152
8210
  }
8153
8211
 
8154
- /* The thread keeps room to read even when suggestions and the composer are tall. */
8155
- .sf-analytics-conversation .sf-chat-list {
8156
- min-height: 10rem;
8157
- }
8158
-
8159
8212
  .sf-chat-panel {
8160
8213
  display: flex;
8161
8214
  flex-direction: column;
@@ -8427,6 +8480,8 @@ button > .sf-item-control-icon:only-child {
8427
8480
  /* Beside a component in a stack: the two will share a row, so the line is on that edge of it. */
8428
8481
  .sf-arrange-insert[data-side="left"] { left: -1px; }
8429
8482
  .sf-arrange-insert[data-side="right"] { right: -1px; }
8483
+ /* Down the whole page's edge: a column beside everything, drawn wider than the line beside one component. */
8484
+ .sf-arrange-insert[data-page] { width: var(--sf-space-1); }
8430
8485
 
8431
8486
  .sf-arrange-frame[data-receiving],
8432
8487
  .sf-arrange-root[data-receiving] {
@@ -8565,6 +8620,26 @@ button > .sf-item-control-icon:only-child {
8565
8620
  color: var(--sf-color-text);
8566
8621
  }
8567
8622
 
8623
+ /*
8624
+ * A container that holds something draws its strip over its own foot rather than in the page's flow, so the page
8625
+ * never moves under the pointer when a drag starts. Only an empty container's strip takes room: it needs it.
8626
+ */
8627
+ .sf-arrange-inside[data-overlay] {
8628
+ position: absolute;
8629
+ inset-inline: var(--sf-space-1);
8630
+ bottom: var(--sf-space-1);
8631
+ z-index: 2;
8632
+ margin: 0;
8633
+ padding: var(--sf-space-1);
8634
+ background: var(--sf-color-surface-raised);
8635
+ font-size: var(--sf-font-size-xs);
8636
+ }
8637
+ .sf-arrange-root:has(> .sf-arrange-inside[data-overlay]) { position: relative; }
8638
+ /* Strips over a foot would cover each other where containers nest, so only the innermost one under the pointer shows
8639
+ its own. Dropping after a container's last child lands in the same place, so nothing is lost where hover is not. */
8640
+ .sf-arrange-inside[data-overlay]:not([data-over]) { visibility: hidden; }
8641
+ :is(.sf-arrange-frame, .sf-arrange-root):hover:not(:has(:is(.sf-arrange-frame, .sf-arrange-root):hover)) > .sf-arrange-inside[data-overlay] { visibility: visible; }
8642
+
8568
8643
  /* Arrange's handles sit in the gap between two frames of a Grid or Row, not on the frame's own edge. */
8569
8644
  .sf-arrange-frame > .sf-resize-handle[data-edge="right"],
8570
8645
  .sf-arrange-view > .sf-resize-handle[data-edge="right"] { --sf-resize-offset: calc(var(--sf-arrange-gap, var(--sf-space-4)) / 2); }
@@ -9880,3 +9955,15 @@ button > .sf-item-control-icon:only-child {
9880
9955
  border-inline-start: 3px solid Highlight;
9881
9956
  }
9882
9957
  }
9958
+
9959
+ /* What a view was not filtered by: a page-wide filter on a column its rows lack. Words, not colour alone. */
9960
+ .sf-spark > .sf-data-note {
9961
+ flex-basis: 100%;
9962
+ }
9963
+
9964
+ .sf-data-note {
9965
+ display: block;
9966
+ margin: var(--sf-space-1) 0 0;
9967
+ color: var(--sf-color-muted);
9968
+ font-size: var(--sf-font-size-sm);
9969
+ }
@@ -1359,21 +1359,14 @@ select.sf-input:disabled {
1359
1359
  cursor: pointer;
1360
1360
  }
1361
1361
 
1362
- .sf-result-sql summary:focus-visible,
1363
- .sf-result-sql pre:focus-visible {
1362
+ .sf-result-sql summary:focus-visible {
1364
1363
  outline: 2px solid var(--sf-color-focus);
1365
1364
  outline-offset: 2px;
1366
1365
  }
1367
1366
 
1368
- .sf-result-sql pre {
1369
- margin: var(--sf-space-2) 0 0;
1370
- padding: var(--sf-space-3);
1371
- border-radius: var(--sf-radius);
1372
- background: var(--sf-color-surface);
1373
- color: var(--sf-color-text);
1374
- font-family: var(--sf-font-mono);
1375
- white-space: pre-wrap;
1376
- overflow-wrap: anywhere;
1367
+ /* The SQL is a CodeBlock, highlighted by the theme's code colours like every other read-only query. */
1368
+ .sf-result-sql > .sf-code {
1369
+ margin-top: var(--sf-space-2);
1377
1370
  }
1378
1371
 
1379
1372
  .sf-result-notice {
@@ -1916,8 +1909,7 @@ select.sf-input:disabled {
1916
1909
  font-size: var(--sf-font-size-sm);
1917
1910
  }
1918
1911
 
1919
- .sf-context-preview,
1920
- .sf-ask-sql pre {
1912
+ .sf-context-preview {
1921
1913
  max-height: 320px;
1922
1914
  margin: 0;
1923
1915
  padding: var(--sf-space-3);
@@ -1932,12 +1924,17 @@ select.sf-input:disabled {
1932
1924
  overflow-wrap: anywhere;
1933
1925
  }
1934
1926
 
1935
- .sf-context-preview:focus-visible,
1936
- .sf-ask-sql pre:focus-visible {
1927
+ .sf-context-preview:focus-visible {
1937
1928
  outline: 2px solid var(--sf-color-focus);
1938
1929
  outline-offset: 2px;
1939
1930
  }
1940
1931
 
1932
+ /* A proposal is a CodeBlock, highlighted like every other read-only query; a long one scrolls inside its block. */
1933
+ .sf-ask-sql .sf-code pre {
1934
+ max-height: 320px;
1935
+ overflow: auto;
1936
+ }
1937
+
1941
1938
  .sf-context-actions {
1942
1939
  display: flex;
1943
1940
  flex-wrap: wrap;
@@ -2093,7 +2090,7 @@ select.sf-input:disabled {
2093
2090
  justify-items: start;
2094
2091
  }
2095
2092
 
2096
- .sf-ask-sql pre {
2093
+ .sf-ask-sql > .sf-code {
2097
2094
  width: 100%;
2098
2095
  }
2099
2096
 
@@ -3452,6 +3449,25 @@ select.sf-input:disabled {
3452
3449
  gap: var(--sf-space-2);
3453
3450
  }
3454
3451
 
3452
+ /* In a narrow place the suggestions are one row that scrolls sideways, so they do not take the thread's room. */
3453
+ @container sf (max-width: 40rem) {
3454
+ .sf-chat-suggestions {
3455
+ flex-wrap: nowrap;
3456
+ overflow-x: auto;
3457
+ overscroll-behavior-x: contain;
3458
+ scroll-snap-type: x proximity;
3459
+ scrollbar-width: none;
3460
+ /* Room for a button's focus ring inside the scrolling row. */
3461
+ padding: 2px;
3462
+ margin: -2px;
3463
+ }
3464
+
3465
+ .sf-chat-suggestions > * {
3466
+ flex: 0 0 auto;
3467
+ scroll-snap-align: start;
3468
+ }
3469
+ }
3470
+
3455
3471
  /* Buttons the host offers under a reply (ChatActions): one row, or a row for each choice. */
3456
3472
  .sf-chat-actions {
3457
3473
  container: sf-chat-actions / inline-size;
@@ -3681,6 +3697,15 @@ select.sf-input:disabled {
3681
3697
  margin-inline-start: auto;
3682
3698
  }
3683
3699
 
3700
+ /* On touch every tool is a 44px target around a small icon, which is space enough between them; without gaps the
3701
+ whole toolbar fits on one row of a phone. */
3702
+ @media (pointer: coarse) {
3703
+ .sf-chat-toolbar,
3704
+ .sf-chat-toolbar-end {
3705
+ column-gap: 0;
3706
+ }
3707
+ }
3708
+
3684
3709
  .sf-chat-icon {
3685
3710
  flex: none;
3686
3711
  width: 1.15em;
@@ -3751,8 +3776,9 @@ select.sf-input:disabled {
3751
3776
  .sf-chat-send {
3752
3777
  display: inline-grid;
3753
3778
  place-items: center;
3754
- width: calc(var(--sf-target-min) * 1.34);
3755
- height: calc(var(--sf-target-min) * 1.34);
3779
+ /* A control's size, and a touch target's where that is larger: Send stays in the toolbar's row on a phone. */
3780
+ width: max(var(--sf-target-min), var(--sf-control-size));
3781
+ height: max(var(--sf-target-min), var(--sf-control-size));
3756
3782
  border: 0;
3757
3783
  border-radius: 50%;
3758
3784
  background: var(--sf-color-accent);
@@ -4322,6 +4348,11 @@ select.sf-input:disabled {
4322
4348
  .sf-a2-grid[data-widths] {
4323
4349
  grid-template-columns: minmax(0, 1fr);
4324
4350
  }
4351
+
4352
+ /* One column: a column's width handle has nothing beside it (see the narrow container rules). */
4353
+ .sf-a2-grid > :is(.sf-arrange-frame, .sf-arrange-view) > .sf-resize-handle[data-edge="right"] {
4354
+ display: none;
4355
+ }
4325
4356
  }
4326
4357
 
4327
4358
  /* Page studio */
@@ -4830,6 +4861,7 @@ select.sf-input:disabled {
4830
4861
 
4831
4862
  .sf-spark {
4832
4863
  display: inline-flex;
4864
+ flex-wrap: wrap;
4833
4865
  align-items: center;
4834
4866
  gap: var(--sf-space-2);
4835
4867
  max-width: 100%;
@@ -5396,6 +5428,13 @@ select.sf-input:disabled {
5396
5428
  flex: 1 1 100% !important;
5397
5429
  }
5398
5430
 
5431
+ /* Nor the handles that set them: with nothing beside a child, its handle would stand past the page's right edge. */
5432
+ .sf-a2-grid > :is(.sf-arrange-frame, .sf-arrange-view) > .sf-resize-handle[data-edge="right"],
5433
+ .sf-a2-row:where(:not([data-wrap="false"])) > :is(.sf-arrange-frame, .sf-arrange-view) > .sf-resize-handle[data-edge="right"],
5434
+ .sf-a2-row:where(:not([data-wrap="false"])) > .sf-a2-row-cell > :is(.sf-arrange-frame, .sf-arrange-view) > .sf-resize-handle[data-edge="right"] {
5435
+ display: none;
5436
+ }
5437
+
5399
5438
  .sf-plan-review-step {
5400
5439
  grid-template-columns: minmax(0, 1fr);
5401
5440
  }
@@ -6301,12 +6340,24 @@ select.sf-input:disabled {
6301
6340
  flex: 0 0 auto !important;
6302
6341
  }
6303
6342
 
6304
- /* Stacked, a panel is as tall as its content, up to a screenful's worth, and scrolls past that. */
6343
+ /* Stacked, a panel is as tall as its content and the page scrolls past it: a box that scrolls inside a page that
6344
+ scrolls catches a phone's swipe, and its scroll bars took room the content needed. */
6305
6345
  .sf-workspace-panel {
6306
- max-height: min(var(--sf-workspace-height, 32rem), 36rem);
6307
6346
  margin-bottom: var(--sf-space-2);
6308
6347
  }
6309
6348
 
6349
+ .sf-workspace-panel:not([data-fill]),
6350
+ .sf-workspace-panel:not([data-fill]) > .sf-workspace-panel-body {
6351
+ overflow: visible;
6352
+ }
6353
+
6354
+ /* Content that scrolls inside itself has no height of its own to grow to, so a panel that fills is about a screenful
6355
+ below the host's sticky bar: scrolled to, the whole conversation and its composer are in view. */
6356
+ .sf-workspace-panel[data-fill]:not([data-folded]) {
6357
+ height: max(20rem, calc(100dvh - var(--sf-sticky-top, 0px) - var(--sf-space-4)));
6358
+ max-height: none;
6359
+ }
6360
+
6310
6361
  .sf-workspace-divider {
6311
6362
  display: none;
6312
6363
  }
@@ -8051,12 +8102,16 @@ button > .sf-item-control-icon:only-child {
8051
8102
  }
8052
8103
 
8053
8104
  .sf-semantic-identity label,
8054
- .sf-semantic-write label,
8105
+ .sf-semantic-write > p,
8055
8106
  .sf-semantic-ask label {
8056
8107
  font-size: var(--sf-font-size-sm);
8057
8108
  color: var(--sf-color-muted);
8058
8109
  }
8059
8110
 
8111
+ .sf-semantic-write > p {
8112
+ margin: 0;
8113
+ }
8114
+
8060
8115
  .sf-semantic-write textarea {
8061
8116
  font-family: var(--sf-font-mono);
8062
8117
  resize: vertical;
@@ -8149,15 +8204,13 @@ button > .sf-item-control-icon:only-child {
8149
8204
  }
8150
8205
 
8151
8206
  .sf-analytics-conversation {
8207
+ /* The thread keeps room to read even when suggestions and the composer are tall. The track holds that minimum, not
8208
+ the list alone, so the rows below never draw over the thread; the panel scrolls when there is not room for all. */
8209
+ grid-template-rows: minmax(10rem, 1fr) auto auto auto;
8152
8210
  height: 100%;
8153
8211
  min-height: 0;
8154
8212
  }
8155
8213
 
8156
- /* The thread keeps room to read even when suggestions and the composer are tall. */
8157
- .sf-analytics-conversation .sf-chat-list {
8158
- min-height: 10rem;
8159
- }
8160
-
8161
8214
  .sf-chat-panel {
8162
8215
  display: flex;
8163
8216
  flex-direction: column;
@@ -8429,6 +8482,8 @@ button > .sf-item-control-icon:only-child {
8429
8482
  /* Beside a component in a stack: the two will share a row, so the line is on that edge of it. */
8430
8483
  .sf-arrange-insert[data-side="left"] { left: -1px; }
8431
8484
  .sf-arrange-insert[data-side="right"] { right: -1px; }
8485
+ /* Down the whole page's edge: a column beside everything, drawn wider than the line beside one component. */
8486
+ .sf-arrange-insert[data-page] { width: var(--sf-space-1); }
8432
8487
 
8433
8488
  .sf-arrange-frame[data-receiving],
8434
8489
  .sf-arrange-root[data-receiving] {
@@ -8567,6 +8622,26 @@ button > .sf-item-control-icon:only-child {
8567
8622
  color: var(--sf-color-text);
8568
8623
  }
8569
8624
 
8625
+ /*
8626
+ * A container that holds something draws its strip over its own foot rather than in the page's flow, so the page
8627
+ * never moves under the pointer when a drag starts. Only an empty container's strip takes room: it needs it.
8628
+ */
8629
+ .sf-arrange-inside[data-overlay] {
8630
+ position: absolute;
8631
+ inset-inline: var(--sf-space-1);
8632
+ bottom: var(--sf-space-1);
8633
+ z-index: 2;
8634
+ margin: 0;
8635
+ padding: var(--sf-space-1);
8636
+ background: var(--sf-color-surface-raised);
8637
+ font-size: var(--sf-font-size-xs);
8638
+ }
8639
+ .sf-arrange-root:has(> .sf-arrange-inside[data-overlay]) { position: relative; }
8640
+ /* Strips over a foot would cover each other where containers nest, so only the innermost one under the pointer shows
8641
+ its own. Dropping after a container's last child lands in the same place, so nothing is lost where hover is not. */
8642
+ .sf-arrange-inside[data-overlay]:not([data-over]) { visibility: hidden; }
8643
+ :is(.sf-arrange-frame, .sf-arrange-root):hover:not(:has(:is(.sf-arrange-frame, .sf-arrange-root):hover)) > .sf-arrange-inside[data-overlay] { visibility: visible; }
8644
+
8570
8645
  /* Arrange's handles sit in the gap between two frames of a Grid or Row, not on the frame's own edge. */
8571
8646
  .sf-arrange-frame > .sf-resize-handle[data-edge="right"],
8572
8647
  .sf-arrange-view > .sf-resize-handle[data-edge="right"] { --sf-resize-offset: calc(var(--sf-arrange-gap, var(--sf-space-4)) / 2); }
@@ -9883,4 +9958,16 @@ button > .sf-item-control-icon:only-child {
9883
9958
  }
9884
9959
  }
9885
9960
 
9961
+ /* What a view was not filtered by: a page-wide filter on a column its rows lack. Words, not colour alone. */
9962
+ .sf-spark > .sf-data-note {
9963
+ flex-basis: 100%;
9964
+ }
9965
+
9966
+ .sf-data-note {
9967
+ display: block;
9968
+ margin: var(--sf-space-1) 0 0;
9969
+ color: var(--sf-color-muted);
9970
+ font-size: var(--sf-font-size-sm);
9971
+ }
9972
+
9886
9973
  }
@@ -1,6 +1,6 @@
1
1
  import { type Theme } from "@surfaces-ui/tokens";
2
2
  export interface ThemePickerProps {
3
- /** Themes offered as one-click choices. Defaults to the built-in presets. */
3
+ /** Themes offered as one-click choices. Defaults to the built-in presets, then the ThemeProvider's own `themes`. */
4
4
  presets?: readonly Theme[];
5
5
  /** Hide controls a product does not want to expose. */
6
6
  hide?: Array<"mode" | "presets" | "accent" | "charts" | "radius" | "font" | "density">;
@@ -13,4 +13,4 @@ export interface ThemePickerProps {
13
13
  * neighbours would be confused is flagged before it reaches a chart. Reads and writes the
14
14
  * nearest ThemeProvider, so changes apply live and persist through its store.
15
15
  */
16
- export declare function ThemePicker({ presets, hide, className }: ThemePickerProps): import("react").JSX.Element;
16
+ export declare function ThemePicker({ presets: given, hide, className }: ThemePickerProps): import("react").JSX.Element;
@@ -21,8 +21,9 @@ function Segmented({ label, value, options, labels, onChange }) {
21
21
  * neighbours would be confused is flagged before it reaches a chart. Reads and writes the
22
22
  * nearest ThemeProvider, so changes apply live and persist through its store.
23
23
  */
24
- export function ThemePicker({ presets = builtInPresets, hide = [], className }) {
25
- const { theme, mode, resolvedMode, setTheme, setMode } = useTheme();
24
+ export function ThemePicker({ presets: given, hide = [], className }) {
25
+ const { theme, mode, resolvedMode, setTheme, setMode, themes } = useTheme();
26
+ const presets = given ?? [...builtInPresets, ...themes.filter((t) => !builtInPresets.some((p) => p.name.toLowerCase() === t.name.toLowerCase()))];
26
27
  const accentId = useId();
27
28
  const radiusId = useId();
28
29
  const presetName = useId();
@@ -1 +1 @@
1
- {"version":3,"file":"ThemePicker.js","sourceRoot":"","sources":["../../src/theme/ThemePicker.tsx"],"names":[],"mappings":";AAAA,OAAO,EAKL,SAAS,EACT,KAAK,EACL,KAAK,EACL,UAAU,EACV,UAAU,EACV,aAAa,EACb,kBAAkB,EAElB,WAAW,EACX,WAAW,EACX,OAA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AQ,EAAE,IAAI,EAAE,CAAC,GAChE,CACH,EAEA,IAAI,CAAC,SAAS,CAAC,IAAI,CAClB,KAAC,SAAS,IACR,KAAK,EAAC,SAAS,EACf,KAAK,EAAE,KAAK,CAAC,OAAO,EACpB,OAAO,EAAE,SAAS,EAClB,MAAM,EAAE,aAAa,EACrB,QAAQ,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,QAAQ,CAAC,EAAE,GAAG,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,GACtE,CACH,IACG,CACP,CAAC;AACJ,CAAC","sourcesContent":["import {\n type Density,\n type FontChoice,\n type Mode,\n type Theme,\n DENSITIES,\n FONTS,\n MODES,\n RADIUS_MAX,\n RADIUS_MIN,\n SERIES_ORDERS,\n SERIES_ORDER_NAMES,\n type SeriesOrderName,\n chartColors,\n checkSeries,\n presets as builtInPresets,\n resolveColors,\n seriesOrderOf,\n themesEqual,\n withAccent,\n withCharts,\n} from \"@surfaces-ui/tokens\";\nimport { useId } from \"react\";\nimport { useTheme } from \"./ThemeProvider.js\";\n\nexport interface ThemePickerProps {\n /** Themes offered as one-click choices. Defaults to the built-in presets. */\n presets?: readonly Theme[];\n /** Hide controls a product does not want to expose. */\n hide?: Array<\"mode\" | \"presets\" | \"accent\" | \"charts\" | \"radius\" | \"font\" | \"density\">;\n className?: string;\n}\n\nconst MODE_LABEL: Record<Mode, string> = { system: \"System\", light: \"Light\", dark: \"Dark\" };\nconst FONT_LABEL: Record<FontChoice, string> = {\n system: \"Sans\",\n rounded: \"Rounded\",\n serif: \"Serif\",\n mono: \"Mono\",\n};\nconst DENSITY_LABEL: Record<Density, string> = { comfortable: \"Comfortable\", compact: \"Compact\" };\n\ninterface SegmentedProps<T extends string> {\n label: string;\n value: T;\n options: readonly T[];\n labels: Record<T, string>;\n onChange(value: T): void;\n}\n\nfunction Segmented<T extends string>({ label, value, options, labels, onChange }: SegmentedProps<T>) {\n const name = useId();\n return (\n <fieldset className=\"sf-field\">\n <legend className=\"sf-label\">{label}</legend>\n <div className=\"sf-segmented\">\n {options.map((option) => (\n <label key={option} className=\"sf-segment\" data-checked={option === value || undefined}>\n <input\n type=\"radio\"\n name={name}\n value={option}\n checked={option === value}\n onChange={() => onChange(option)}\n />\n <span>{labels[option]}</span>\n </label>\n ))}\n </div>\n </fieldset>\n );\n}\n\n/**\n * Lets a person choose how the product looks: light or dark, a preset, their\n * own accent colour, the colours charts use, corner radius, font and density.\n * Chart colours are checked as they are edited, so a palette whose\n * neighbours would be confused is flagged before it reaches a chart. Reads and writes the\n * nearest ThemeProvider, so changes apply live and persist through its store.\n */\nexport function ThemePicker({ presets = builtInPresets, hide = [], className }: ThemePickerProps) {\n const { theme, mode, resolvedMode, setTheme, setMode } = useTheme();\n const accentId = useId();\n const radiusId = useId();\n const presetName = useId();\n const orderId = useId();\n const colors = resolveColors(theme[resolvedMode], theme.charts[resolvedMode]);\n const chart = theme.charts[resolvedMode];\n const order = seriesOrderOf(chart.series, resolvedMode);\n // Colours are judged against the surface charts are drawn on.\n const issues = checkSeries(chart.series, colors.surface);\n const clashes = issues.filter((issue) => issue.slots.length === 2);\n const faint = issues.filter((issue) => issue.slots.length === 1).map((issue) => issue.slots[0]!);\n const setChart = (change: Partial<typeof chart>) => setTheme(withCharts(theme, { ...theme.charts, [resolvedMode]: { ...chart, ...change } }));\n const show = (control: NonNullable<ThemePickerProps[\"hide\"]>[number]) => !hide.includes(control);\n\n return (\n <div className={[\"sf-theme-picker\", className].filter(Boolean).join(\" \")}>\n {show(\"mode\") && (\n <Segmented label=\"Appearance\" value={mode} options={MODES} labels={MODE_LABEL} onChange={setMode} />\n )}\n\n {show(\"presets\") && (\n <fieldset className=\"sf-field\">\n <legend className=\"sf-label\">Theme</legend>\n <div className=\"sf-preset-grid\">\n {presets.map((preset) => {\n const c = resolveColors(preset[resolvedMode], preset.charts[resolvedMode]);\n const selected = themesEqual(preset, theme);\n return (\n <label key={preset.name} className=\"sf-preset\" data-checked={selected || undefined}>\n <input\n type=\"radio\"\n name={presetName}\n checked={selected}\n onChange={() => setTheme(preset)}\n />\n <span\n className=\"sf-preset-swatch\"\n aria-hidden=\"true\"\n style={{ background: c.background, borderColor: c.border, borderRadius: Math.min(preset.radius, 10) }}\n >\n <span style={{ background: c.surface, borderRadius: Math.min(preset.radius, 6) / 2 }}>\n <span style={{ background: c.accent, borderRadius: Math.min(preset.radius, 6) / 2 }} />\n </span>\n {c.series.slice(0, 4).map((color, i) => (\n <span key={i} className=\"sf-preset-bar\" style={{ background: color, blockSize: `${[62, 100, 44, 80][i]}%`, borderRadius: Math.min(preset.radius, 4) / 2 }} />\n ))}\n </span>\n <span className=\"sf-preset-name\">{preset.name}</span>\n </label>\n );\n })}\n </div>\n </fieldset>\n )}\n\n {show(\"accent\") && (\n <div className=\"sf-field sf-field-row\">\n <label className=\"sf-label\" htmlFor={accentId}>\n Accent colour\n </label>\n <span className=\"sf-color\">\n <input\n id={accentId}\n type=\"color\"\n value={theme[resolvedMode].accent}\n onChange={(e) => setTheme(withAccent(theme, e.target.value))}\n />\n <code>{theme[resolvedMode].accent}</code>\n </span>\n </div>\n )}\n\n {show(\"charts\") && (\n <fieldset className=\"sf-field\">\n <legend className=\"sf-label\">Chart colours</legend>\n <div className=\"sf-field-row\">\n <label className=\"sf-chart-order-label\" htmlFor={orderId}>\n Series order\n </label>\n <select\n id={orderId}\n className=\"sf-input\"\n value={order ?? \"custom\"}\n onChange={(e) => {\n const name = e.target.value as SeriesOrderName;\n if (name in SERIES_ORDERS) setTheme(withCharts(theme, { light: chartColors(name, \"light\"), dark: chartColors(name, \"dark\") }));\n }}\n >\n {SERIES_ORDER_NAMES.map((name) => (\n <option key={name} value={name}>\n {name}: {SERIES_ORDERS[name][0]} first\n </option>\n ))}\n {!order && <option value=\"custom\">Your own colours</option>}\n </select>\n </div>\n <div className=\"sf-series-slots\" role=\"group\" aria-label={`Series colours, ${resolvedMode} mode`}>\n {chart.series.map((color, i) => (\n <input\n key={i}\n type=\"color\"\n aria-label={`Series ${i + 1}`}\n title={`Series ${i + 1}: ${color}`}\n value={color}\n onChange={(e) => setChart({ series: chart.series.map((c, at) => (at === i ? e.target.value.toUpperCase() : c)) })}\n />\n ))}\n </div>\n <div className=\"sf-field-row\">\n <span className=\"sf-ramp\" role=\"img\" aria-label=\"Scale for amounts, faint to strong\">\n {colors.sequential.map((color, i) => (\n <span key={i} style={{ background: color }} />\n ))}\n </span>\n <input type=\"color\" aria-label=\"Colour for amounts\" value={chart.sequential} onChange={(e) => setChart({ sequential: e.target.value.toUpperCase() })} />\n </div>\n <div className=\"sf-field-row\">\n <span className=\"sf-ramp\" role=\"img\" aria-label=\"Scale for values below and above a midpoint\">\n {colors.diverging.map((color, i) => (\n <span key={i} style={{ background: color }} />\n ))}\n </span>\n <span className=\"sf-color\">\n <input type=\"color\" aria-label=\"Colour for below the midpoint\" value={chart.diverging[0]} onChange={(e) => setChart({ diverging: [e.target.value.toUpperCase(), chart.diverging[1]] })} />\n <input type=\"color\" aria-label=\"Colour for above the midpoint\" value={chart.diverging[1]} onChange={(e) => setChart({ diverging: [chart.diverging[0], e.target.value.toUpperCase()] })} />\n </span>\n </div>\n <ul className=\"sf-series-issues\" aria-live=\"polite\" aria-label=\"Checks on these colours\">\n {clashes.length === 0 ? (\n <li data-ok=\"\">\n <span aria-hidden=\"true\">✓</span> Neighbouring series can be told apart, with or without colour blindness.\n </li>\n ) : (\n clashes.map((issue) => (\n <li key={issue.message} data-severity={issue.severity}>\n <span aria-hidden=\"true\">{issue.severity === \"error\" ? \"!\" : \"–\"}</span> {issue.message}\n </li>\n ))\n )}\n {faint.length > 0 && (\n <li data-severity=\"warning\">\n <span aria-hidden=\"true\">–</span> {faint.length === 1 ? `Colour ${faint[0]} is` : `Colours ${faint.join(\", \")} are`} light against this background. Charts\n using {faint.length === 1 ? \"it\" : \"them\"} should show values or offer a table.\n </li>\n )}\n </ul>\n </fieldset>\n )}\n\n {show(\"radius\") && (\n <div className=\"sf-field\">\n <div className=\"sf-field-row\">\n <label className=\"sf-label\" htmlFor={radiusId}>\n Corner radius\n </label>\n <output htmlFor={radiusId} className=\"sf-value\">\n {theme.radius}px\n </output>\n </div>\n <input\n id={radiusId}\n className=\"sf-range\"\n type=\"range\"\n min={RADIUS_MIN}\n max={RADIUS_MAX}\n step={1}\n value={theme.radius}\n onChange={(e) => setTheme({ ...theme, name: \"Custom\", radius: Number(e.target.value) })}\n />\n </div>\n )}\n\n {show(\"font\") && (\n <Segmented\n label=\"Font\"\n value={theme.font}\n options={FONTS}\n labels={FONT_LABEL}\n onChange={(font) => setTheme({ ...theme, name: \"Custom\", font })}\n />\n )}\n\n {show(\"density\") && (\n <Segmented\n label=\"Density\"\n value={theme.density}\n options={DENSITIES}\n labels={DENSITY_LABEL}\n onChange={(density) => setTheme({ ...theme, name: \"Custom\", density })}\n />\n )}\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"ThemePicker.js","sourceRoot":"","sources":["../../src/theme/ThemePicker.tsx"],"names":[],"mappings":";AAAA,OAAO,EAKL,SAAS,EACT,KAAK,EACL,KAAK,EACL,UAAU,EACV,UAAU,EACV,aAAa,EACb,kBAAkB,EAElB,WAAW,EACX,WAAW,EACX,OAAO,IAAI,cAAc,EACzB,aAAa,EACb,aAAa,EACb,WAAW,EACX,UAAU,EACV,UAAU,GACX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAU9C,MAAM,UAAU,GAAyB,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AAC5F,MAAM,UAAU,GAA+B;IAC7C,MAAM,EAAE,MAAM;IACd,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;CACb,CAAC;AACF,MAAM,aAAa,GAA4B,EAAE,W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AClB,MAAM,EAAE,aAAa,EACrB,QAAQ,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,QAAQ,CAAC,EAAE,GAAG,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,GACtE,CACH,IACG,CACP,CAAC;AACJ,CAAC","sourcesContent":["import {\n type Density,\n type FontChoice,\n type Mode,\n type Theme,\n DENSITIES,\n FONTS,\n MODES,\n RADIUS_MAX,\n RADIUS_MIN,\n SERIES_ORDERS,\n SERIES_ORDER_NAMES,\n type SeriesOrderName,\n chartColors,\n checkSeries,\n presets as builtInPresets,\n resolveColors,\n seriesOrderOf,\n themesEqual,\n withAccent,\n withCharts,\n} from \"@surfaces-ui/tokens\";\nimport { useId } from \"react\";\nimport { useTheme } from \"./ThemeProvider.js\";\n\nexport interface ThemePickerProps {\n /** Themes offered as one-click choices. Defaults to the built-in presets, then the ThemeProvider's own `themes`. */\n presets?: readonly Theme[];\n /** Hide controls a product does not want to expose. */\n hide?: Array<\"mode\" | \"presets\" | \"accent\" | \"charts\" | \"radius\" | \"font\" | \"density\">;\n className?: string;\n}\n\nconst MODE_LABEL: Record<Mode, string> = { system: \"System\", light: \"Light\", dark: \"Dark\" };\nconst FONT_LABEL: Record<FontChoice, string> = {\n system: \"Sans\",\n rounded: \"Rounded\",\n serif: \"Serif\",\n mono: \"Mono\",\n};\nconst DENSITY_LABEL: Record<Density, string> = { comfortable: \"Comfortable\", compact: \"Compact\" };\n\ninterface SegmentedProps<T extends string> {\n label: string;\n value: T;\n options: readonly T[];\n labels: Record<T, string>;\n onChange(value: T): void;\n}\n\nfunction Segmented<T extends string>({ label, value, options, labels, onChange }: SegmentedProps<T>) {\n const name = useId();\n return (\n <fieldset className=\"sf-field\">\n <legend className=\"sf-label\">{label}</legend>\n <div className=\"sf-segmented\">\n {options.map((option) => (\n <label key={option} className=\"sf-segment\" data-checked={option === value || undefined}>\n <input\n type=\"radio\"\n name={name}\n value={option}\n checked={option === value}\n onChange={() => onChange(option)}\n />\n <span>{labels[option]}</span>\n </label>\n ))}\n </div>\n </fieldset>\n );\n}\n\n/**\n * Lets a person choose how the product looks: light or dark, a preset, their\n * own accent colour, the colours charts use, corner radius, font and density.\n * Chart colours are checked as they are edited, so a palette whose\n * neighbours would be confused is flagged before it reaches a chart. Reads and writes the\n * nearest ThemeProvider, so changes apply live and persist through its store.\n */\nexport function ThemePicker({ presets: given, hide = [], className }: ThemePickerProps) {\n const { theme, mode, resolvedMode, setTheme, setMode, themes } = useTheme();\n const presets = given ?? [...builtInPresets, ...themes.filter((t) => !builtInPresets.some((p) => p.name.toLowerCase() === t.name.toLowerCase()))];\n const accentId = useId();\n const radiusId = useId();\n const presetName = useId();\n const orderId = useId();\n const colors = resolveColors(theme[resolvedMode], theme.charts[resolvedMode]);\n const chart = theme.charts[resolvedMode];\n const order = seriesOrderOf(chart.series, resolvedMode);\n // Colours are judged against the surface charts are drawn on.\n const issues = checkSeries(chart.series, colors.surface);\n const clashes = issues.filter((issue) => issue.slots.length === 2);\n const faint = issues.filter((issue) => issue.slots.length === 1).map((issue) => issue.slots[0]!);\n const setChart = (change: Partial<typeof chart>) => setTheme(withCharts(theme, { ...theme.charts, [resolvedMode]: { ...chart, ...change } }));\n const show = (control: NonNullable<ThemePickerProps[\"hide\"]>[number]) => !hide.includes(control);\n\n return (\n <div className={[\"sf-theme-picker\", className].filter(Boolean).join(\" \")}>\n {show(\"mode\") && (\n <Segmented label=\"Appearance\" value={mode} options={MODES} labels={MODE_LABEL} onChange={setMode} />\n )}\n\n {show(\"presets\") && (\n <fieldset className=\"sf-field\">\n <legend className=\"sf-label\">Theme</legend>\n <div className=\"sf-preset-grid\">\n {presets.map((preset) => {\n const c = resolveColors(preset[resolvedMode], preset.charts[resolvedMode]);\n const selected = themesEqual(preset, theme);\n return (\n <label key={preset.name} className=\"sf-preset\" data-checked={selected || undefined}>\n <input\n type=\"radio\"\n name={presetName}\n checked={selected}\n onChange={() => setTheme(preset)}\n />\n <span\n className=\"sf-preset-swatch\"\n aria-hidden=\"true\"\n style={{ background: c.background, borderColor: c.border, borderRadius: Math.min(preset.radius, 10) }}\n >\n <span style={{ background: c.surface, borderRadius: Math.min(preset.radius, 6) / 2 }}>\n <span style={{ background: c.accent, borderRadius: Math.min(preset.radius, 6) / 2 }} />\n </span>\n {c.series.slice(0, 4).map((color, i) => (\n <span key={i} className=\"sf-preset-bar\" style={{ background: color, blockSize: `${[62, 100, 44, 80][i]}%`, borderRadius: Math.min(preset.radius, 4) / 2 }} />\n ))}\n </span>\n <span className=\"sf-preset-name\">{preset.name}</span>\n </label>\n );\n })}\n </div>\n </fieldset>\n )}\n\n {show(\"accent\") && (\n <div className=\"sf-field sf-field-row\">\n <label className=\"sf-label\" htmlFor={accentId}>\n Accent colour\n </label>\n <span className=\"sf-color\">\n <input\n id={accentId}\n type=\"color\"\n value={theme[resolvedMode].accent}\n onChange={(e) => setTheme(withAccent(theme, e.target.value))}\n />\n <code>{theme[resolvedMode].accent}</code>\n </span>\n </div>\n )}\n\n {show(\"charts\") && (\n <fieldset className=\"sf-field\">\n <legend className=\"sf-label\">Chart colours</legend>\n <div className=\"sf-field-row\">\n <label className=\"sf-chart-order-label\" htmlFor={orderId}>\n Series order\n </label>\n <select\n id={orderId}\n className=\"sf-input\"\n value={order ?? \"custom\"}\n onChange={(e) => {\n const name = e.target.value as SeriesOrderName;\n if (name in SERIES_ORDERS) setTheme(withCharts(theme, { light: chartColors(name, \"light\"), dark: chartColors(name, \"dark\") }));\n }}\n >\n {SERIES_ORDER_NAMES.map((name) => (\n <option key={name} value={name}>\n {name}: {SERIES_ORDERS[name][0]} first\n </option>\n ))}\n {!order && <option value=\"custom\">Your own colours</option>}\n </select>\n </div>\n <div className=\"sf-series-slots\" role=\"group\" aria-label={`Series colours, ${resolvedMode} mode`}>\n {chart.series.map((color, i) => (\n <input\n key={i}\n type=\"color\"\n aria-label={`Series ${i + 1}`}\n title={`Series ${i + 1}: ${color}`}\n value={color}\n onChange={(e) => setChart({ series: chart.series.map((c, at) => (at === i ? e.target.value.toUpperCase() : c)) })}\n />\n ))}\n </div>\n <div className=\"sf-field-row\">\n <span className=\"sf-ramp\" role=\"img\" aria-label=\"Scale for amounts, faint to strong\">\n {colors.sequential.map((color, i) => (\n <span key={i} style={{ background: color }} />\n ))}\n </span>\n <input type=\"color\" aria-label=\"Colour for amounts\" value={chart.sequential} onChange={(e) => setChart({ sequential: e.target.value.toUpperCase() })} />\n </div>\n <div className=\"sf-field-row\">\n <span className=\"sf-ramp\" role=\"img\" aria-label=\"Scale for values below and above a midpoint\">\n {colors.diverging.map((color, i) => (\n <span key={i} style={{ background: color }} />\n ))}\n </span>\n <span className=\"sf-color\">\n <input type=\"color\" aria-label=\"Colour for below the midpoint\" value={chart.diverging[0]} onChange={(e) => setChart({ diverging: [e.target.value.toUpperCase(), chart.diverging[1]] })} />\n <input type=\"color\" aria-label=\"Colour for above the midpoint\" value={chart.diverging[1]} onChange={(e) => setChart({ diverging: [chart.diverging[0], e.target.value.toUpperCase()] })} />\n </span>\n </div>\n <ul className=\"sf-series-issues\" aria-live=\"polite\" aria-label=\"Checks on these colours\">\n {clashes.length === 0 ? (\n <li data-ok=\"\">\n <span aria-hidden=\"true\">✓</span> Neighbouring series can be told apart, with or without colour blindness.\n </li>\n ) : (\n clashes.map((issue) => (\n <li key={issue.message} data-severity={issue.severity}>\n <span aria-hidden=\"true\">{issue.severity === \"error\" ? \"!\" : \"–\"}</span> {issue.message}\n </li>\n ))\n )}\n {faint.length > 0 && (\n <li data-severity=\"warning\">\n <span aria-hidden=\"true\">–</span> {faint.length === 1 ? `Colour ${faint[0]} is` : `Colours ${faint.join(\", \")} are`} light against this background. Charts\n using {faint.length === 1 ? \"it\" : \"them\"} should show values or offer a table.\n </li>\n )}\n </ul>\n </fieldset>\n )}\n\n {show(\"radius\") && (\n <div className=\"sf-field\">\n <div className=\"sf-field-row\">\n <label className=\"sf-label\" htmlFor={radiusId}>\n Corner radius\n </label>\n <output htmlFor={radiusId} className=\"sf-value\">\n {theme.radius}px\n </output>\n </div>\n <input\n id={radiusId}\n className=\"sf-range\"\n type=\"range\"\n min={RADIUS_MIN}\n max={RADIUS_MAX}\n step={1}\n value={theme.radius}\n onChange={(e) => setTheme({ ...theme, name: \"Custom\", radius: Number(e.target.value) })}\n />\n </div>\n )}\n\n {show(\"font\") && (\n <Segmented\n label=\"Font\"\n value={theme.font}\n options={FONTS}\n labels={FONT_LABEL}\n onChange={(font) => setTheme({ ...theme, name: \"Custom\", font })}\n />\n )}\n\n {show(\"density\") && (\n <Segmented\n label=\"Density\"\n value={theme.density}\n options={DENSITIES}\n labels={DENSITY_LABEL}\n onChange={(density) => setTheme({ ...theme, name: \"Custom\", density })}\n />\n )}\n </div>\n );\n}\n"]}