@teamofsilicons/silicon-ui 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 (163) hide show
  1. package/README.md +4 -3
  2. package/check.mjs +14 -5
  3. package/components/activity-heatmap/activity-heatmap.module.css +4 -4
  4. package/components/alert/alert.module.css +1 -1
  5. package/components/animated-counter/animated-counter.js +1 -1
  6. package/components/announcement-bar/announcement-bar.module.css +6 -6
  7. package/components/avatar/avatar.d.ts +2 -2
  8. package/components/avatar/avatar.js +1 -1
  9. package/components/avatar/avatar.module.css +5 -2
  10. package/components/avatar-group/avatar-group.module.css +4 -4
  11. package/components/badge/badge.module.css +4 -4
  12. package/components/bar-chart/bar-chart.js +1 -1
  13. package/components/bar-chart/bar-chart.module.css +4 -4
  14. package/components/billing-toggle/billing-toggle.js +2 -2
  15. package/components/billing-toggle/billing-toggle.module.css +10 -10
  16. package/components/bottom-sheet/bottom-sheet.js +1 -1
  17. package/components/bottom-sheet/bottom-sheet.module.css +4 -5
  18. package/components/breadcrumb/breadcrumb.d.ts +8 -2
  19. package/components/breadcrumb/breadcrumb.js +21 -9
  20. package/components/breadcrumb/breadcrumb.module.css +7 -3
  21. package/components/brush-chart/brush-chart.module.css +9 -9
  22. package/components/button/button.d.ts +7 -2
  23. package/components/button/button.js +3 -1
  24. package/components/button/button.module.css +10 -1
  25. package/components/button-group/button-group.module.css +7 -7
  26. package/components/calendar/calendar.js +15 -5
  27. package/components/calendar/calendar.module.css +13 -10
  28. package/components/card/card.js +4 -4
  29. package/components/card/card.module.css +2 -2
  30. package/components/card-stack/card-stack.js +2 -2
  31. package/components/card-stack/card-stack.module.css +2 -3
  32. package/components/carousel/carousel.module.css +3 -3
  33. package/components/chat-thread/chat-thread.module.css +41 -41
  34. package/components/checkbox/checkbox.module.css +1 -1
  35. package/components/chip-group/chip-group.js +1 -1
  36. package/components/chip-group/chip-group.module.css +2 -2
  37. package/components/code-block/code-block.module.css +7 -14
  38. package/components/color-picker/color-picker.module.css +20 -21
  39. package/components/combobox/combobox.js +5 -1
  40. package/components/combobox/combobox.module.css +2 -2
  41. package/components/command-palette/command-palette.js +18 -11
  42. package/components/command-palette/command-palette.module.css +18 -18
  43. package/components/comment-thread/comment-thread.module.css +35 -35
  44. package/components/confirm-morph/confirm-morph.js +5 -5
  45. package/components/confirm-morph/confirm-morph.module.css +9 -9
  46. package/components/context-menu/context-menu.js +10 -28
  47. package/components/context-menu/context-menu.module.css +3 -3
  48. package/components/copy-button/copy-button.js +4 -4
  49. package/components/countdown/countdown.module.css +4 -4
  50. package/components/date-picker/date-picker.js +3 -3
  51. package/components/date-picker/date-picker.module.css +7 -7
  52. package/components/date-range-picker/date-range-picker.js +13 -10
  53. package/components/date-range-picker/date-range-picker.module.css +23 -22
  54. package/components/dialog/dialog.module.css +2 -2
  55. package/components/donut-chart/donut-chart.module.css +5 -5
  56. package/components/drawer/drawer.module.css +7 -7
  57. package/components/dropdown-menu/dropdown-menu.d.ts +71 -1
  58. package/components/dropdown-menu/dropdown-menu.js +100 -6
  59. package/components/dropdown-menu/dropdown-menu.module.css +15 -5
  60. package/components/elastic-slider/elastic-slider.js +2 -2
  61. package/components/elastic-slider/elastic-slider.module.css +4 -4
  62. package/components/expandable-card/expandable-card.js +1 -1
  63. package/components/expandable-card/expandable-card.module.css +1 -1
  64. package/components/expanding-button-group/expanding-button-group.module.css +3 -3
  65. package/components/expanding-search/expanding-search.js +3 -3
  66. package/components/expanding-search/expanding-search.module.css +9 -9
  67. package/components/file-dropzone/file-dropzone.js +3 -3
  68. package/components/file-dropzone/file-dropzone.module.css +21 -21
  69. package/components/file-upload/file-upload.module.css +7 -7
  70. package/components/filter-toolbar/filter-toolbar.js +7 -3
  71. package/components/filter-toolbar/filter-toolbar.module.css +9 -9
  72. package/components/floating-button-group/floating-button-group.module.css +7 -7
  73. package/components/gauge/gauge.js +1 -1
  74. package/components/gauge/gauge.module.css +2 -2
  75. package/components/hover-card/hover-card.js +2 -2
  76. package/components/hover-card/hover-card.module.css +2 -2
  77. package/components/image-compare/image-compare.module.css +4 -4
  78. package/components/inline-edit/inline-edit.module.css +12 -12
  79. package/components/json-viewer/json-viewer.module.css +12 -12
  80. package/components/line-chart/line-chart.js +1 -1
  81. package/components/line-chart/line-chart.module.css +8 -8
  82. package/components/mention-input/mention-input.js +4 -2
  83. package/components/mention-input/mention-input.module.css +8 -8
  84. package/components/metric-card/metric-card.module.css +1 -1
  85. package/components/money-input/money-input.js +6 -3
  86. package/components/money-input/money-input.module.css +10 -10
  87. package/components/morph-select/morph-select.js +7 -5
  88. package/components/morph-select/morph-select.module.css +13 -13
  89. package/components/multi-select/multi-select.js +4 -2
  90. package/components/multi-select/multi-select.module.css +6 -6
  91. package/components/nav-list/nav-list.d.ts +64 -0
  92. package/components/nav-list/nav-list.js +96 -0
  93. package/components/nav-list/nav-list.module.css +25 -0
  94. package/components/notification-center/notification-center.module.css +27 -27
  95. package/components/number-field/number-field.js +3 -3
  96. package/components/number-field/number-field.module.css +3 -3
  97. package/components/otp-input/otp-input.module.css +4 -4
  98. package/components/pagination/pagination.module.css +1 -1
  99. package/components/password-field/password-field.module.css +2 -2
  100. package/components/password-strength/password-strength.module.css +8 -8
  101. package/components/phone-input/phone-input.js +9 -7
  102. package/components/phone-input/phone-input.module.css +19 -19
  103. package/components/popover/popover.module.css +2 -2
  104. package/components/progress/progress.module.css +1 -1
  105. package/components/radio-cards/radio-cards.module.css +8 -8
  106. package/components/radio-group/radio-group.js +4 -1
  107. package/components/radio-group/radio-group.module.css +4 -3
  108. package/components/resizable-panels/resizable-panels.module.css +5 -5
  109. package/components/rich-text-editor/rich-text-editor.js +3 -3
  110. package/components/rich-text-editor/rich-text-editor.module.css +12 -12
  111. package/components/ridgeline/ridgeline.module.css +7 -7
  112. package/components/scroll-area/scroll-area.module.css +8 -8
  113. package/components/segmented-control/segmented-control.d.ts +3 -1
  114. package/components/segmented-control/segmented-control.js +5 -2
  115. package/components/segmented-control/segmented-control.module.css +9 -4
  116. package/components/select/select.module.css +5 -5
  117. package/components/shortcut-recorder/shortcut-recorder.js +5 -5
  118. package/components/shortcut-recorder/shortcut-recorder.module.css +16 -16
  119. package/components/signature-pad/signature-pad.module.css +11 -11
  120. package/components/slider/slider.module.css +4 -4
  121. package/components/slope-chart/slope-chart.module.css +7 -7
  122. package/components/slot-text/slot-text.js +2 -1
  123. package/components/sortable-data-table/sortable-data-table.module.css +4 -4
  124. package/components/sparkline/sparkline.js +1 -1
  125. package/components/split-button/split-button.module.css +6 -6
  126. package/components/stepper/stepper.module.css +3 -3
  127. package/components/streamgraph/streamgraph.module.css +7 -7
  128. package/components/swipe-actions/swipe-actions.js +2 -2
  129. package/components/swipe-actions/swipe-actions.module.css +5 -5
  130. package/components/switch/switch.js +2 -2
  131. package/components/switch/switch.module.css +1 -1
  132. package/components/tabs/tabs.d.ts +9 -2
  133. package/components/tabs/tabs.js +11 -5
  134. package/components/tabs/tabs.module.css +10 -3
  135. package/components/tag-input/tag-input.module.css +4 -4
  136. package/components/text-reveal/text-reveal.js +1 -1
  137. package/components/time-picker/time-picker.js +4 -2
  138. package/components/time-picker/time-picker.module.css +3 -3
  139. package/components/timeline/timeline.js +4 -4
  140. package/components/timeline/timeline.module.css +3 -3
  141. package/components/toast/toast.js +1 -1
  142. package/components/toast/toast.module.css +5 -5
  143. package/components/toast-stack/toast-stack.js +1 -1
  144. package/components/toast-stack/toast-stack.module.css +5 -5
  145. package/components/tooltip/tooltip.module.css +1 -1
  146. package/components/tree-view/tree-view.js +16 -12
  147. package/components/tree-view/tree-view.module.css +10 -8
  148. package/components/treemap/treemap.module.css +13 -13
  149. package/components/usage-meter/usage-meter.js +1 -1
  150. package/components/usage-meter/usage-meter.module.css +5 -5
  151. package/components/user-menu/user-menu.js +16 -14
  152. package/components/user-menu/user-menu.module.css +22 -22
  153. package/components/waffle-chart/waffle-chart.module.css +7 -7
  154. package/components.json +416 -1
  155. package/eslint.js +35 -3
  156. package/lib/fluid-hover.d.ts +83 -0
  157. package/lib/fluid-hover.js +184 -0
  158. package/lib/menu-highlight.d.ts +24 -11
  159. package/lib/menu-highlight.js +29 -28
  160. package/lib/motion-tokens.d.ts +76 -18
  161. package/lib/motion-tokens.js +45 -10
  162. package/package.json +1 -1
  163. package/styles.css +50 -7
@@ -13,8 +13,8 @@
13
13
  display: flex;
14
14
  min-height: 54px;
15
15
  align-items: center;
16
- gap: 10px;
17
- padding: 8px 14px;
16
+ gap: var(--space-group);
17
+ padding: var(--space-related) var(--space-inset);
18
18
  border-bottom: 1px solid var(--border-subtle);
19
19
  transition: background var(--duration-fast) var(--ease-standard);
20
20
  }
@@ -42,51 +42,51 @@
42
42
  font-variant-numeric: tabular-nums;
43
43
  }
44
44
 
45
- .commandKey { min-width: 38px; height: 24px; padding: 0 6px; gap: 2px; }
45
+ .commandKey { min-width: 38px; height: 24px; padding: 0 var(--space-related); gap: var(--space-hair); }
46
46
  .clearButton { display: grid; width: 24px; height: 24px; flex: none; place-items: center; border: 0; border-radius: var(--radius-detail); background: transparent; color: var(--text-muted); cursor: pointer; transition: color var(--duration-fast) var(--ease-standard), background-color var(--duration-fast) var(--ease-standard); }
47
47
  @media (hover: hover) and (pointer: fine) { .clearButton:hover, .closeButton:hover { background: var(--surface); color: var(--foreground); } }
48
48
  .clearButton:active, .closeButton:active { background: var(--surface); color: var(--foreground); }
49
- .closeButton { display: grid; min-width: 27px; height: 24px; flex: none; place-items: center; border: 1px solid var(--border-subtle); border-radius: var(--radius-detail); background: transparent; color: var(--text-muted); padding: 0 6px; font: inherit; font-size: var(--text-xs); font-weight: 500; line-height: 1; cursor: pointer; transition: color var(--duration-fast) var(--ease-standard), background-color var(--duration-fast) var(--ease-standard); }
49
+ .closeButton { display: grid; min-width: 27px; height: 24px; flex: none; place-items: center; border: 1px solid var(--border-subtle); border-radius: var(--radius-detail); background: transparent; color: var(--text-muted); padding: 0 var(--space-related); font: inherit; font-size: var(--text-xs); font-weight: 500; line-height: 1; cursor: pointer; transition: color var(--duration-fast) var(--ease-standard), background-color var(--duration-fast) var(--ease-standard); }
50
50
 
51
51
  /* The frame animates to the list height; the list keeps its own scroll. */
52
52
  .resultsFrame { overflow: hidden; }
53
- .results { position: relative; max-height: 342px; overflow: auto; padding: 6px 8px; }
54
- .highlight { position: absolute; top: 0; right: 8px; left: 8px; border-radius: var(--radius-detail); background: var(--surface-muted); opacity: 0; pointer-events: none; }
53
+ .results { position: relative; max-height: 342px; overflow: auto; padding: var(--space-related) var(--space-related); }
54
+ .highlight { position: absolute; top: 0; right: var(--space-related); left: var(--space-related); border-radius: var(--radius-detail); background: var(--surface-muted); opacity: 0; pointer-events: none; }
55
55
  /* Groups are positioned so a row that pops out of the flow is placed against the same box it was measured in, even mid-glide. */
56
56
  .group { position: relative; }
57
- .group + .group { margin-top: 6px; }
58
- .groupHeading { display: block; padding: 6px 8px 3px; color: var(--text-muted); font-size: var(--text-xs); font-weight: 500; line-height: var(--leading-body); }
57
+ .group + .group { margin-top: var(--space-related); }
58
+ .groupHeading { display: block; padding: var(--space-related) var(--space-related) var(--space-tight); color: var(--text-muted); font-size: var(--text-xs); font-weight: 500; line-height: var(--leading-body); }
59
59
 
60
60
  /* One line per result: the title, then its description in muted text, so the list stays short and scannable. */
61
- .result { position: relative; display: flex; width: 100%; min-height: 34px; align-items: center; gap: 10px; border: 0; border-radius: var(--radius-detail); padding: 0 8px; background: transparent; color: var(--foreground); text-align: left; cursor: pointer; }
61
+ .result { position: relative; display: flex; width: 100%; min-height: 34px; align-items: center; gap: var(--space-group); border: 0; border-radius: var(--radius-detail); padding: 0 var(--space-related); background: transparent; color: var(--foreground); text-align: left; cursor: pointer; }
62
62
  /* The active row is drawn by the shared highlight; the row itself only tints its icon and arrow. */
63
63
  .itemIcon { transition: color var(--duration-fast) var(--ease-standard); }
64
64
  .itemIcon { display: grid; width: 16px; height: 16px; flex: none; place-items: center; color: var(--text-muted); }
65
65
  .itemIcon svg { width: 16px; height: 16px; }
66
- .resultCopy { display: flex; min-width: 0; flex: 1; align-items: baseline; gap: 8px; }
66
+ .resultCopy { display: flex; min-width: 0; flex: 1; align-items: baseline; gap: var(--space-related); }
67
67
  .resultCopy strong, .resultCopy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
68
68
  .resultCopy strong { flex: none; max-width: 100%; }
69
69
  .resultCopy small { min-width: 0; }
70
70
  .resultCopy strong { font-size: var(--text-sm); font-weight: 500; }
71
71
  .resultCopy small { color: var(--text-muted); font-size: var(--text-xs); }
72
- .shortcut { min-width: 18px; height: 18px; padding: 0 4px; border-color: transparent; border-radius: var(--radius-detail); font-size: 11px; }
72
+ .shortcut { min-width: 18px; height: 18px; padding: 0 var(--space-tight); border-color: transparent; border-radius: var(--radius-detail); font-size: var(--text-xs); }
73
73
  .activeResult .itemIcon { color: var(--foreground); }
74
- .empty { display: grid; justify-items: center; gap: 4px; padding: 26px 12px 28px; text-align: center; }
75
- .empty > span { display: grid; width: 32px; height: 32px; place-items: center; margin-bottom: 5px; color: var(--text-muted); }
74
+ .empty { display: grid; justify-items: center; gap: var(--space-tight); padding: var(--space-section) var(--space-group) var(--space-block); text-align: center; }
75
+ .empty > span { display: grid; width: 32px; height: 32px; place-items: center; margin-bottom: var(--space-tight); color: var(--text-muted); }
76
76
  .empty strong { font-size: var(--text-sm); font-weight: 500; }
77
77
  .empty small { color: var(--text-muted); font-size: var(--text-xs); }
78
78
  .visuallyHidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
79
79
 
80
80
  @media (max-width: 480px) {
81
- .searchRow { gap: 8px; padding: 8px 11px; }
82
- .results { padding: 6px; }
83
- .highlight { right: 6px; left: 6px; }
84
- .result { gap: 8px; }
81
+ .searchRow { gap: var(--space-related); padding: var(--space-related) var(--space-group); }
82
+ .results { padding: var(--space-related); }
83
+ .highlight { right: var(--space-related); left: var(--space-related); }
84
+ .result { gap: var(--space-related); }
85
85
  .shortcut, .commandKey { display: none; }
86
86
  }
87
87
 
88
88
  @media (max-width: 340px) {
89
- .result { padding-inline: 6px; }
89
+ .result { padding-inline: var(--space-related); }
90
90
  }
91
91
 
92
92
  @media (prefers-reduced-motion: reduce) {
@@ -18,7 +18,7 @@
18
18
 
19
19
  /* Header */
20
20
  .thread { display: grid; }
21
- .header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 12px 8px 18px; }
21
+ .header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-group); padding: var(--space-group) var(--space-group) var(--space-related) var(--space-comfort); }
22
22
  .heading { display: grid; min-width: 0; }
23
23
  .title { margin: 0; overflow: hidden; font-size: var(--text-sm); font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
24
24
  .subtitle { color: var(--text-muted); font-size: var(--text-xs); font-variant-numeric: tabular-nums; }
@@ -28,8 +28,8 @@
28
28
  height: 32px;
29
29
  flex: none;
30
30
  align-items: center;
31
- gap: 6px;
32
- padding: 0 12px 0 10px;
31
+ gap: var(--space-related);
32
+ padding: 0 var(--space-group) 0 var(--space-group);
33
33
  border: 1px solid var(--border);
34
34
  border-radius: var(--radius-full); corner-shape: round;
35
35
  background: var(--surface);
@@ -46,32 +46,32 @@
46
46
 
47
47
  /* Comments */
48
48
  .list, .replies { display: grid; margin: 0; padding: 0; list-style: none; }
49
- .list { padding: 0 8px; }
49
+ .list { padding: 0 var(--space-related); }
50
50
  .item { overflow: clip; overflow-clip-margin: 4px; }
51
51
  .repliesWrap { overflow: clip; }
52
52
  /* Replies hang from a quiet rail under their parent's avatar. */
53
- .replies { position: relative; margin-left: 24px; padding-left: 12px; }
54
- .replies::before { content: ""; position: absolute; top: 2px; bottom: 14px; left: 0; width: 1px; background: var(--border); }
53
+ .replies { position: relative; margin-left: var(--space-section); padding-left: var(--space-group); }
54
+ .replies::before { content: ""; position: absolute; top: var(--space-hair); bottom: var(--space-inset); left: 0; width: 1px; background: var(--border); }
55
55
 
56
- .comment { display: flex; gap: 10px; padding: 10px; border-radius: var(--radius-control); corner-shape: var(--corner-shape); }
56
+ .comment { display: flex; gap: var(--space-group); padding: var(--space-group); border-radius: var(--radius-control); corner-shape: var(--corner-shape); }
57
57
  .avatar { display: inline-grid; flex: none; place-items: center; overflow: hidden; border-radius: 50%; corner-shape: round; background: var(--surface-muted); color: var(--text-secondary); font-size: var(--text-xs); font-weight: 500; letter-spacing: 0; object-fit: cover; }
58
58
  .deletedDot { width: 28px; height: 28px; flex: none; border: 1px dashed var(--border-strong); border-radius: 50%; corner-shape: round; }
59
- .main { display: grid; min-width: 0; flex: 1; gap: 2px; }
60
- .meta { display: flex; min-width: 0; align-items: baseline; gap: 8px; }
59
+ .main { display: grid; min-width: 0; flex: 1; gap: var(--space-hair); }
60
+ .meta { display: flex; min-width: 0; align-items: baseline; gap: var(--space-related); }
61
61
  .name { overflow: hidden; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
62
62
  .time { flex: none; color: var(--text-muted); font-size: var(--text-xs); }
63
63
  .body { margin: 0; color: var(--text-secondary); overflow-wrap: anywhere; white-space: pre-wrap; text-wrap: pretty; }
64
64
  .mention { color: var(--accent-strong); font-weight: 500; }
65
- .deleted { margin: 4px 0 0; color: var(--text-muted); font-style: italic; }
65
+ .deleted { margin: var(--space-tight) 0 0; color: var(--text-muted); font-style: italic; }
66
66
 
67
- .footer { display: flex; min-height: 30px; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 4px; }
68
- .reactions { display: flex; flex-wrap: wrap; gap: 4px; }
67
+ .footer { display: flex; min-height: 30px; flex-wrap: wrap; align-items: center; gap: var(--space-tight) var(--space-related); margin-top: var(--space-tight); }
68
+ .reactions { display: flex; flex-wrap: wrap; gap: var(--space-tight); }
69
69
  .reaction {
70
70
  display: inline-flex;
71
71
  height: 26px;
72
72
  align-items: center;
73
- gap: 5px;
74
- padding: 0 9px 0 7px;
73
+ gap: var(--space-tight);
74
+ padding: 0 var(--space-related) 0 var(--space-related);
75
75
  border: 1px solid var(--border);
76
76
  border-radius: var(--radius-full); corner-shape: round;
77
77
  background: var(--surface);
@@ -88,14 +88,14 @@
88
88
  .count > span { grid-area: 1 / 1; }
89
89
 
90
90
  /* Actions sit quietly after the reactions and come forward on hover or focus; touch screens always show them. */
91
- .actions { display: flex; min-height: 28px; flex-wrap: wrap; align-items: center; gap: 2px; transition: opacity var(--duration-fast) var(--ease-standard); }
91
+ .actions { display: flex; min-height: 28px; flex-wrap: wrap; align-items: center; gap: var(--space-hair); transition: opacity var(--duration-fast) var(--ease-standard); }
92
92
  .action,
93
93
  .iconAction {
94
94
  display: inline-flex;
95
95
  height: 28px;
96
96
  align-items: center;
97
97
  justify-content: center;
98
- padding: 0 8px;
98
+ padding: 0 var(--space-related);
99
99
  border: 0;
100
100
  border-radius: var(--radius-full); corner-shape: round;
101
101
  background: transparent;
@@ -109,34 +109,34 @@
109
109
  }
110
110
  .iconAction { width: 28px; padding: 0; }
111
111
  .action[data-tone="danger"] { color: var(--danger); }
112
- .prompt { margin-right: 4px; color: var(--foreground); font-size: var(--text-xs); }
112
+ .prompt { margin-right: var(--space-tight); color: var(--foreground); font-size: var(--text-xs); }
113
113
  .emoji { display: grid; width: 28px; height: 28px; place-items: center; padding: 0; border: 0; border-radius: 50%; corner-shape: round; background: transparent; cursor: pointer; font-size: var(--text-base); line-height: 1; transition: background-color var(--duration-fast) var(--ease-standard), transform var(--duration-instant) var(--ease-standard); }
114
114
  .emoji[aria-pressed="true"] { background: var(--accent-subtle); }
115
115
  .emoji:active { transform: scale(.88); }
116
116
 
117
- .toggle { display: inline-flex; width: fit-content; height: 28px; align-items: center; gap: 6px; margin: 2px 0 0 -6px; padding: 0 8px 0 6px; border: 0; border-radius: var(--radius-full); corner-shape: round; background: transparent; color: var(--text-secondary); cursor: pointer; font: inherit; font-size: var(--text-xs); font-weight: 500; transition: background-color var(--duration-fast) var(--ease-standard); }
117
+ .toggle { display: inline-flex; width: fit-content; height: 28px; align-items: center; gap: var(--space-related); margin: var(--space-hair) 0 0 calc(var(--space-related) * -1); padding: 0 var(--space-related) 0 var(--space-related); border: 0; border-radius: var(--radius-full); corner-shape: round; background: transparent; color: var(--text-secondary); cursor: pointer; font: inherit; font-size: var(--text-xs); font-weight: 500; transition: background-color var(--duration-fast) var(--ease-standard); }
118
118
  .toggleIcon { display: grid; place-items: center; color: var(--text-muted); }
119
- .stack { display: inline-flex; flex: none; padding-left: 4px; }
120
- .stack > * { margin-left: -5px; box-shadow: 0 0 0 2px var(--surface); }
119
+ .stack { display: inline-flex; flex: none; padding-left: var(--space-tight); }
120
+ .stack > * { margin-left: calc(var(--space-tight) * -1); box-shadow: 0 0 0 2px var(--surface); }
121
121
 
122
- .empty { margin: 0; padding: 8px 18px 16px; color: var(--text-muted); }
122
+ .empty { margin: 0; padding: var(--space-related) var(--space-comfort) var(--space-inset); color: var(--text-muted); }
123
123
 
124
124
  /* Composer */
125
- .composerArea { display: grid; margin-top: 4px; padding: 10px 12px 12px; border-top: 1px solid var(--border-subtle); }
125
+ .composerArea { display: grid; margin-top: var(--space-tight); padding: var(--space-group) var(--space-group) var(--space-group); border-top: 1px solid var(--border-subtle); }
126
126
  .replying { overflow: clip; }
127
- .replyingInner { display: flex; align-items: center; gap: 6px; padding: 0 2px 8px 38px; color: var(--text-secondary); font-size: var(--text-xs); }
128
- .replyingInner .iconAction { width: 22px; height: 22px; margin-left: 2px; }
127
+ .replyingInner { display: flex; align-items: center; gap: var(--space-related); padding: 0 var(--space-hair) var(--space-related) var(--space-block); color: var(--text-secondary); font-size: var(--text-xs); }
128
+ .replyingInner .iconAction { width: 22px; height: 22px; margin-left: var(--space-hair); }
129
129
  .replyingName { color: var(--foreground); font-weight: 500; }
130
130
 
131
- .composer { display: grid; align-items: start; gap: 8px 10px; grid-template-columns: auto minmax(0, 1fr) auto; }
132
- .composer > .avatar { margin-top: 5px; }
133
- .composer[data-compact] { grid-template-columns: minmax(0, 1fr); margin-top: 4px; }
131
+ .composer { display: grid; align-items: start; gap: var(--space-related) var(--space-group); grid-template-columns: auto minmax(0, 1fr) auto; }
132
+ .composer > .avatar { margin-top: var(--space-tight); }
133
+ .composer[data-compact] { grid-template-columns: minmax(0, 1fr); margin-top: var(--space-tight); }
134
134
  .fieldWrap { display: grid; min-width: 0; }
135
135
  .field {
136
136
  width: 100%;
137
137
  min-height: 38px;
138
138
  max-height: 160px;
139
- padding: 8px 12px;
139
+ padding: var(--space-related) var(--space-group);
140
140
  border: 1px solid var(--border);
141
141
  border-radius: var(--radius-control); corner-shape: var(--corner-shape);
142
142
  background: var(--surface);
@@ -148,22 +148,22 @@
148
148
  }
149
149
  .field::placeholder { color: var(--text-muted); }
150
150
  .field:focus { border-color: var(--border-strong); }
151
- .composerActions { display: flex; align-items: center; gap: 4px; }
151
+ .composerActions { display: flex; align-items: center; gap: var(--space-tight); }
152
152
  .composer[data-compact] .composerActions { justify-content: flex-end; }
153
153
  .send,
154
- .ghost { height: 38px; padding: 0 14px; border: 0; border-radius: var(--radius-full); corner-shape: round; cursor: pointer; font: inherit; font-weight: 500; transition: background-color var(--duration-fast) var(--ease-standard), opacity var(--duration-fast) var(--ease-standard), transform var(--duration-instant) var(--ease-standard); }
154
+ .ghost { height: 38px; padding: 0 var(--space-inset); border: 0; border-radius: var(--radius-full); corner-shape: round; cursor: pointer; font: inherit; font-weight: 500; transition: background-color var(--duration-fast) var(--ease-standard), opacity var(--duration-fast) var(--ease-standard), transform var(--duration-instant) var(--ease-standard); }
155
155
  .composer[data-compact] :is(.send, .ghost) { height: 32px; font-size: var(--text-xs); }
156
156
  .send { background: var(--foreground); color: var(--background); }
157
157
  .send:disabled { opacity: .35; cursor: default; }
158
158
  .send:active:not(:disabled), .ghost:active { transform: scale(.97); }
159
159
  .ghost { background: transparent; color: var(--text-secondary); }
160
160
 
161
- .suggestions { display: grid; margin: 6px 0 0; padding: 4px; overflow: clip; border: 1px solid var(--border); border-radius: var(--radius-control); corner-shape: var(--corner-shape); background: var(--surface-raised); list-style: none; }
162
- .suggestion { display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 0 8px; border-radius: var(--radius-detail); corner-shape: var(--corner-shape); cursor: pointer; }
161
+ .suggestions { display: grid; margin: var(--space-related) 0 0; padding: var(--space-tight); overflow: clip; border: 1px solid var(--border); border-radius: var(--radius-control); corner-shape: var(--corner-shape); background: var(--surface-raised); list-style: none; }
162
+ .suggestion { display: flex; align-items: center; gap: var(--space-related); min-height: 32px; padding: 0 var(--space-related); border-radius: var(--radius-detail); corner-shape: var(--corner-shape); cursor: pointer; }
163
163
  .suggestion[aria-selected="true"] { background: var(--surface-muted); }
164
164
 
165
165
  /* Resolved chip */
166
- .resolved { display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 14px; }
166
+ .resolved { display: flex; align-items: center; gap: var(--space-group); padding: var(--space-group) var(--space-group) var(--space-group) var(--space-inset); }
167
167
  .resolvedIcon { display: grid; width: 24px; height: 24px; flex: none; place-items: center; border-radius: 50%; corner-shape: round; background: color-mix(in oklab, var(--success) 14%, transparent); color: var(--success); }
168
168
  .resolvedText { display: grid; min-width: 0; flex: 1; }
169
169
  .resolvedTitle { overflow: hidden; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
@@ -186,8 +186,8 @@
186
186
  @media (max-width: 420px) {
187
187
  .composer { grid-template-columns: minmax(0, 1fr) auto; }
188
188
  .composer > .avatar { display: none; }
189
- .replyingInner { padding-left: 2px; }
190
- .replies { margin-left: 12px; }
189
+ .replyingInner { padding-left: var(--space-hair); }
190
+ .replies { margin-left: var(--space-group); }
191
191
  }
192
192
 
193
193
  @media (prefers-reduced-motion: reduce) {
@@ -34,9 +34,9 @@ const faceVariants = {
34
34
  };
35
35
  const partVariants = {
36
36
  hidden: { opacity: 0, filter: `blur(${blur.soft}px)` },
37
- shown: { opacity: 1, filter: "blur(0px)", transition: { duration: .26, ease: enter } },
37
+ shown: { opacity: 1, filter: "blur(0px)", transition: { duration: motionTokens.duration.exit, ease: enter } },
38
38
  };
39
- const reducedFace = { hidden: { opacity: 0 }, shown: { opacity: 1, transition: { duration: .14 } }, gone: { opacity: 0, transition: { duration: .1 } } };
39
+ const reducedFace = { hidden: { opacity: 0 }, shown: { opacity: 1, transition: { duration: motionTokens.duration.fast } }, gone: { opacity: 0, transition: { duration: motionTokens.duration.instant } } };
40
40
  const reducedPart = { hidden: { opacity: 1 }, shown: { opacity: 1 } };
41
41
  function Face({ id, reduced, onSize, children, labelledBy }) {
42
42
  const ref = useRef(null);
@@ -61,7 +61,7 @@ function Part({ reduced, className, children }) {
61
61
  }
62
62
  /** A success disc that pops in with a tick drawing across it, the moment the action lands. */
63
63
  function Check({ reduced }) {
64
- return _jsxs("svg", { className: styles.check, viewBox: "0 0 18 18", fill: "none", "aria-hidden": "true", children: [_jsx(motion.circle, { className: styles.checkDisc, cx: "9", cy: "9", r: "8", style: { transformOrigin: "9px 9px" }, initial: reduced ? false : { scale: .5, opacity: 0 }, animate: { scale: 1, opacity: 1 }, transition: { scale: physical(motionTokens.spring.snappy), opacity: { duration: .12 } } }), _jsx(motion.path, { className: styles.checkTick, d: "M5.6 9.3 7.8 11.4 12.4 6.7", strokeWidth: "1.9", strokeLinecap: "round", strokeLinejoin: "round", initial: reduced ? false : { pathLength: 0 }, animate: { pathLength: 1 }, transition: { duration: .3, ease: enter, delay: .14 } })] });
64
+ return _jsxs("svg", { className: styles.check, viewBox: "0 0 18 18", fill: "none", "aria-hidden": "true", children: [_jsx(motion.circle, { className: styles.checkDisc, cx: "9", cy: "9", r: "8", style: { transformOrigin: "9px 9px" }, initial: reduced ? false : { scale: .5, opacity: 0 }, animate: { scale: 1, opacity: 1 }, transition: { scale: physical(motionTokens.spring.snappy), opacity: { duration: motionTokens.duration.instant } } }), _jsx(motion.path, { className: styles.checkTick, d: "M5.6 9.3 7.8 11.4 12.4 6.7", strokeWidth: "1.9", strokeLinecap: "round", strokeLinejoin: "round", initial: reduced ? false : { pathLength: 0 }, animate: { pathLength: 1 }, transition: { duration: .3, ease: enter, delay: .14 } })] });
65
65
  }
66
66
  /** A ring that drains with the countdown. */
67
67
  function Ring({ progress }) {
@@ -69,7 +69,7 @@ function Ring({ progress }) {
69
69
  }
70
70
  /** Seconds that swap in place: the old digit fades up and out, the new one rises in, on tabular figures so the width holds. */
71
71
  function Seconds({ value, reduced }) {
72
- return _jsx("span", { className: styles.seconds, children: _jsx(AnimatePresence, { initial: false, mode: "popLayout", children: _jsx(motion.span, { className: styles.digit, initial: reduced ? { opacity: 0 } : { opacity: 0, y: 6, filter: `blur(${blur.subtle}px)` }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, exit: reduced ? { opacity: 0 } : { opacity: 0, y: -6, filter: `blur(${blur.subtle}px)` }, transition: { duration: .22, ease: enter }, children: value }, value) }) });
72
+ return _jsx("span", { className: styles.seconds, children: _jsx(AnimatePresence, { initial: false, mode: "popLayout", children: _jsx(motion.span, { className: styles.digit, initial: reduced ? { opacity: 0 } : { opacity: 0, y: 6, filter: `blur(${blur.subtle}px)` }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, exit: reduced ? { opacity: 0 } : { opacity: 0, y: -6, filter: `blur(${blur.subtle}px)` }, transition: { duration: motionTokens.duration.exit, ease: enter }, children: value }, value) }) });
73
73
  }
74
74
  export function ConfirmMorph({ label, icon, prompt, confirmLabel = "Delete", cancelLabel = "Cancel", pendingLabel = "Deleting", doneLabel = "Deleted", errorLabel = "Couldn’t finish", retryLabel = "Retry", undoLabel = "Undo", undoingLabel = "Restoring", tone = "danger", confirmMode = "press", holdDuration = 1000, countdown = 3, countdownLabel, onConfirm, onUndo, onCancel, state: stateProp, defaultState = "idle", onStateChange, confirmTimeout = 6000, resultTimeout = 5000, cancelOnOutsidePress = true, disabled = false, className, ref, }) {
75
75
  const reduced = useReducedFlag();
@@ -252,7 +252,7 @@ export function ConfirmMorph({ label, icon, prompt, confirmLabel = "Delete", can
252
252
  holding.current = null;
253
253
  control.stop();
254
254
  if (hold.get() < 1) {
255
- animate(hold, 0, reduced ? { duration: 0 } : { type: "spring", visualDuration: .3, bounce: 0 });
255
+ animate(hold, 0, reduced ? { duration: 0 } : { type: "spring", visualDuration: motionTokens.spring.fast.visualDuration, bounce: 0 });
256
256
  setAnnouncement(`Keep holding to ${confirmLabel.toLowerCase()}`);
257
257
  }
258
258
  };
@@ -34,7 +34,7 @@
34
34
  .root[data-disabled][data-state="idle"] .surface { box-shadow: none; }
35
35
  .root[data-disabled][data-state="idle"] .surface::after { border-color: var(--border-subtle); }
36
36
 
37
- .face { display: flex; flex: none; height: 100%; align-items: center; gap: 2px; padding: 0 4px; white-space: nowrap; }
37
+ .face { display: flex; flex: none; height: 100%; align-items: center; gap: var(--space-hair); padding: 0 var(--space-tight); white-space: nowrap; }
38
38
  .face[data-face="idle"] { padding: 0; }
39
39
  /* A leaving face steps out of the flow, exactly where it was, and fades while the pill springs to the next one. */
40
40
  .face[inert] { position: absolute; top: 0; inset-inline-start: 0; pointer-events: none; }
@@ -44,8 +44,8 @@
44
44
  display: inline-flex;
45
45
  height: 100%;
46
46
  align-items: center;
47
- gap: 8px;
48
- padding: 0 16px 0 14px;
47
+ gap: var(--space-related);
48
+ padding: 0 var(--space-inset) 0 var(--space-inset);
49
49
  border: 0;
50
50
  border-radius: var(--radius-full); corner-shape: round;
51
51
  background: transparent;
@@ -62,7 +62,7 @@
62
62
  .trigger:disabled .icon { color: inherit; }
63
63
  .icon > svg { width: 16px; height: 16px; }
64
64
 
65
- .prompt { max-width: 16rem; overflow: hidden; padding: 0 8px 0 12px; color: var(--foreground); font-weight: 500; font-variant-numeric: tabular-nums; }
65
+ .prompt { max-width: 16rem; overflow: hidden; padding: 0 var(--space-related) 0 var(--space-group); color: var(--foreground); font-weight: 500; font-variant-numeric: tabular-nums; }
66
66
  .prompt > span { overflow: hidden; text-overflow: ellipsis; }
67
67
 
68
68
  .secondary,
@@ -73,7 +73,7 @@
73
73
  height: calc(var(--control-height-sm) - 8px);
74
74
  align-items: center;
75
75
  justify-content: center;
76
- padding: 0 12px;
76
+ padding: 0 var(--space-group);
77
77
  border: 0;
78
78
  border-radius: var(--radius-full); corner-shape: round;
79
79
  cursor: pointer;
@@ -97,12 +97,12 @@
97
97
  .fill { position: absolute; inset: 0; display: inline-flex; align-items: center; justify-content: center; background: var(--danger); color: var(--background); pointer-events: none; }
98
98
  .root[data-tone="neutral"] .fill { background: var(--accent-strong); color: var(--accent-foreground); }
99
99
 
100
- .status { gap: 8px; padding: 0 10px 0 12px; color: var(--foreground); font-weight: 500; font-variant-numeric: tabular-nums; }
100
+ .status { gap: var(--space-related); padding: 0 var(--space-group) 0 var(--space-group); color: var(--foreground); font-weight: 500; font-variant-numeric: tabular-nums; }
101
101
  .status > svg { flex: none; }
102
102
  .statusText { display: inline-flex; align-items: baseline; gap: .25em; }
103
- .face[data-face="pending"] .status { padding-inline: 12px 16px; color: var(--text-secondary); }
104
- .face[data-face="done"]:not(:has(.secondary)) .status { padding-right: 14px; }
105
- .face[data-face="counting"] .status { padding-right: 6px; color: var(--text-secondary); }
103
+ .face[data-face="pending"] .status { padding-inline: var(--space-group) var(--space-inset); color: var(--text-secondary); }
104
+ .face[data-face="done"]:not(:has(.secondary)) .status { padding-right: var(--space-inset); }
105
+ .face[data-face="counting"] .status { padding-right: var(--space-related); color: var(--text-secondary); }
106
106
  .alert { color: var(--danger); }
107
107
  .check { width: 18px; height: 18px; }
108
108
  .checkDisc { fill: var(--success); }
@@ -5,6 +5,7 @@ import { useEffect, useLayoutEffect, useRef, useState } from "react";
5
5
  import { AnimatePresence, motion, useReducedMotion } from "motion/react";
6
6
  import { Check, Copy, MoreHorizontal, Trash2 } from "lucide-react";
7
7
  import { motionTokens } from "../../lib/motion-tokens.js";
8
+ import { MenuHighlight, useMenuHighlight } from "../../lib/menu-highlight.js";
8
9
  import styles from "./context-menu.module.css";
9
10
  const MENU_WIDTH = 208;
10
11
  // Keeps the menu 8px inside the viewport. Rows are 34px with 5px padding and a 1px border; the real size is measured before paint.
@@ -22,11 +23,10 @@ export function ContextMenu({ children, items, label = "Context menu" }) {
22
23
  // Each open gets its own key, so reopening at a new point fades the old menu out in place
23
24
  // and grows a fresh one from the pointer instead of teleporting the visible menu.
24
25
  const [point, setPoint] = useState({ x: 0, y: 0, originX: 0, originY: 0, key: 0 });
25
- const [highlight, setHighlight] = useState(null);
26
+ // Fluid hover: the nearest row is lit, gaps and padding included, and a click in a gap picks it.
27
+ const { highlight, reset, contentProps } = useMenuHighlight();
26
28
  const menuRef = useRef(null);
27
29
  const targetRef = useRef(null);
28
- const pointer = useRef(false);
29
- const clearTimer = useRef(0);
30
30
  // A primary press on the target while the menu is open closes it; the click that follows must not reopen it.
31
31
  const pressedWhileOpen = useRef(false);
32
32
  // An exiting menu keeps its last props, so its handlers check this before moving focus or selecting.
@@ -41,7 +41,6 @@ export function ContextMenu({ children, items, label = "Context menu" }) {
41
41
  const next = clampTo(anchor.current.x, anchor.current.y, node.offsetWidth, node.offsetHeight);
42
42
  setPoint(current => (current.x === next.x && current.y === next.y && current.originX === next.originX && current.originY === next.originY ? current : { ...next, key: current.key }));
43
43
  }, [open, point.key]);
44
- useEffect(() => () => window.clearTimeout(clearTimer.current), []);
45
44
  useEffect(() => {
46
45
  if (!open)
47
46
  return;
@@ -68,9 +67,7 @@ export function ContextMenu({ children, items, label = "Context menu" }) {
68
67
  anchor.current = { x, y };
69
68
  const estimate = clampTo(x, y, MENU_WIDTH, Math.min(300, items.length * 34 + 12));
70
69
  setPoint(current => ({ ...estimate, key: current.key + 1 }));
71
- window.clearTimeout(clearTimer.current);
72
- pointer.current = false;
73
- setHighlight(null);
70
+ reset();
74
71
  setPortal(true);
75
72
  setOpen(true);
76
73
  }
@@ -114,30 +111,15 @@ export function ContextMenu({ children, items, label = "Context menu" }) {
114
111
  targetRef.current?.focus();
115
112
  }
116
113
  }
117
- function place(item, glide) {
118
- window.clearTimeout(clearTimer.current);
119
- const next = { index: Number(item.dataset.index), top: item.offsetTop, height: item.offsetHeight, danger: item.dataset.tone === "danger" };
120
- setHighlight(current => ({ ...next, glide: glide && current !== null }));
121
- }
122
- // Keyboard focus places the highlight instantly; the pointer makes it glide between rows.
114
+ // Keyboard focus lights its row at once. A pointer-opened menu focuses its first row without lighting it, like a native menu.
123
115
  function onMenuFocus(event) {
124
- const item = event.target instanceof HTMLElement ? event.target.closest('[role="menuitem"]') : null;
125
- if (item) {
126
- // A pointer-opened menu focuses its first row without showing a highlight, like a native menu.
127
- if (!pointer.current && item.matches(":focus-visible"))
128
- place(item, false);
129
- return;
130
- }
131
- // A short grace period keeps the highlight gliding across the gap between rows.
132
- window.clearTimeout(clearTimer.current);
133
- clearTimer.current = window.setTimeout(() => setHighlight(null), pointer.current ? 70 : 0);
116
+ if (event.target instanceof HTMLElement && event.target.matches(":focus-visible"))
117
+ contentProps.onFocus(event);
134
118
  }
135
119
  return _jsxs(_Fragment, { children: [_jsx("div", { ref: targetRef, className: styles.target, tabIndex: 0, onPointerDown: event => { pressedWhileOpen.current = open && event.button === 0; }, onClick: onTargetClick, onContextMenu: event => { event.preventDefault(); showMenu(event.clientX, event.clientY); }, onKeyDown: onTargetKeyDown, "aria-label": label, "aria-haspopup": "menu", "aria-expanded": open, children: children }), portal ? createPortal(_jsx(AnimatePresence, { children: open && _jsxs(motion.div, { ref: node => { if (node)
136
- menuRef.current = node; }, className: styles.menu, role: "menu", "aria-label": label, tabIndex: -1, style: { left: point.x, top: point.y, transformOrigin: `${point.originX}px ${point.originY}px` }, onKeyDown: onMenuKeyDown, onFocus: onMenuFocus, onPointerMoveCapture: () => { pointer.current = true; }, onKeyDownCapture: () => { pointer.current = false; }, onPointerLeave: event => { if (live.current)
137
- event.currentTarget.focus({ preventScroll: true }); }, initial: reduced ? { opacity: 0 } : { opacity: 0, scale: .96 }, animate: { opacity: 1, scale: 1 }, exit: reduced ? { opacity: 0, transition: { duration: motionTokens.duration.instant } } : { opacity: 0, scale: .98, transition: { duration: motionTokens.duration.instant, ease: [...motionTokens.ease.standard] } }, transition: reduced ? { duration: motionTokens.duration.instant } : { default: motionTokens.spring.snappy, opacity: { duration: motionTokens.duration.fast, ease: [...motionTokens.ease.enter] } }, children: [_jsx(motion.span, { className: styles.highlight, "data-tone": highlight?.danger ? "danger" : undefined, "aria-hidden": "true", initial: false, animate: highlight ? { y: highlight.top, height: highlight.height, opacity: 1 } : { opacity: 0 }, transition: { default: highlight?.glide && !reduced ? motionTokens.spring.snappy : { duration: 0 }, opacity: { duration: reduced ? 0 : motionTokens.duration.instant } } }), items.map((item, index) => _jsxs("button", { type: "button", role: "menuitem", tabIndex: -1, "data-index": index, "data-tone": item.destructive ? "danger" : undefined, style: { "--i": index }, disabled: item.disabled, className: [styles.item, item.destructive ? styles.destructive : ""].filter(Boolean).join(" "), onPointerMove: event => { if (!live.current)
138
- return; window.clearTimeout(clearTimer.current); if (document.activeElement !== event.currentTarget)
139
- event.currentTarget.focus({ preventScroll: true }); if (highlight?.index !== index)
140
- place(event.currentTarget, true); }, onPointerLeave: () => { if (live.current)
120
+ menuRef.current = node; }, className: styles.menu, role: "menu", "aria-label": label, tabIndex: -1, style: { left: point.x, top: point.y, transformOrigin: `${point.originX}px ${point.originY}px` }, onKeyDown: onMenuKeyDown, ...contentProps, onFocus: onMenuFocus, onPointerLeave: event => { if (live.current)
121
+ event.currentTarget.focus({ preventScroll: true }); }, initial: reduced ? { opacity: 0 } : { opacity: 0, scale: .96 }, animate: { opacity: 1, scale: 1 }, exit: reduced ? { opacity: 0, transition: { duration: motionTokens.duration.instant } } : { opacity: 0, scale: .98, transition: { duration: motionTokens.duration.instant, ease: [...motionTokens.ease.standard] } }, transition: reduced ? { duration: motionTokens.duration.instant } : { default: motionTokens.spring.snappy, opacity: { duration: motionTokens.duration.fast, ease: [...motionTokens.ease.enter] } }, children: [_jsx(MenuHighlight, { state: highlight, className: styles.highlight }), items.map((item, index) => _jsxs("button", { type: "button", role: "menuitem", tabIndex: -1, "data-index": index, "data-tone": item.destructive ? "danger" : undefined, style: { "--i": index }, disabled: item.disabled, className: [styles.item, item.destructive ? styles.destructive : ""].filter(Boolean).join(" "), onPointerMove: event => { if (live.current && document.activeElement !== event.currentTarget)
122
+ event.currentTarget.focus({ preventScroll: true }); }, onPointerLeave: () => { if (live.current)
141
123
  menuRef.current?.focus({ preventScroll: true }); }, onClick: () => { if (!live.current)
142
124
  return; live.current = false; item.onSelect?.(); setOpen(false); targetRef.current?.focus(); }, children: [_jsx("span", { className: styles.icon, "aria-hidden": "true", children: item.icon ?? (item.checked ? _jsx(Check, { size: 15 }) : _jsx(MoreHorizontal, { size: 15 })) }), _jsx("span", { children: item.label })] }, item.id))] }, point.key) }), document.body) : null] });
143
125
  }
@@ -1,9 +1,9 @@
1
1
  .target { display: block; outline: none; }
2
2
  /* Motion scales the menu from the pointer (transform-origin is set inline) and fades it out faster than it arrives. */
3
- .menu { position: fixed; z-index: 100; min-width: min(13rem, calc(100vw - 16px)); max-width: calc(100vw - 16px); max-height: min(300px, calc(100vh - 16px)); overflow-y: auto; padding: 5px; border: 1px solid var(--border); border-radius: var(--radius-container); background: var(--surface-raised); color: var(--foreground); box-shadow: var(--shadow-floating); outline: none; }
4
- .highlight { position: absolute; top: 0; right: 5px; left: 5px; border-radius: calc(var(--radius-container) - 6px); background: var(--surface-muted); opacity: 0; pointer-events: none; transition: background-color var(--duration-fast) var(--ease-standard); }
3
+ .menu { position: fixed; z-index: var(--layer-dropdown); min-width: min(13rem, calc(100vw - 16px)); max-width: calc(100vw - 16px); max-height: min(300px, calc(100vh - 16px)); overflow-y: auto; padding: var(--space-tight); border: 1px solid var(--border); border-radius: var(--radius-container); background: var(--surface-raised); color: var(--foreground); box-shadow: var(--shadow-floating); outline: none; }
4
+ .highlight { position: absolute; top: 0; right: var(--space-tight); left: var(--space-tight); border-radius: calc(var(--radius-container) - var(--space-related)); background: var(--surface-muted); opacity: 0; pointer-events: none; transition: background-color var(--duration-fast) var(--ease-standard); }
5
5
  .highlight[data-tone="danger"] { background: color-mix(in oklab, var(--danger) 8%, var(--surface)); }
6
- .item { position: relative; display: flex; width: 100%; min-height: 34px; align-items: center; gap: 9px; padding: 0 11px; border: 0; border-radius: calc(var(--radius-container) - 6px); background: transparent; color: inherit; font: inherit; font-size: var(--text-sm); letter-spacing: var(--tracking-body); line-height: var(--leading-body); text-align: left; cursor: pointer; outline: none; transition: background-color var(--duration-instant) var(--ease-standard), color var(--duration-fast) var(--ease-standard); animation: context-item-in var(--duration-standard) var(--ease-enter) both; animation-delay: calc(min(var(--i, 0), 4) * 35ms); }
6
+ .item { position: relative; display: flex; width: 100%; min-height: 34px; align-items: center; gap: var(--space-related); padding: 0 var(--space-group); border: 0; border-radius: calc(var(--radius-container) - var(--space-related)); background: transparent; color: inherit; font: inherit; font-size: var(--text-sm); letter-spacing: var(--tracking-body); line-height: var(--leading-body); text-align: left; cursor: pointer; outline: none; transition: background-color var(--duration-instant) var(--ease-standard), color var(--duration-fast) var(--ease-standard); animation: context-item-in var(--duration-standard) var(--ease-enter) both; animation-delay: calc(min(var(--i, 0), 4) * 35ms); }
7
7
  /* The gliding highlight is the focus indicator, as in the dropdown menu. */
8
8
  .item:focus-visible { outline: none; }
9
9
  /* Rows press with a tint, not a scale. */
@@ -8,9 +8,9 @@ import { useCopyFeedback } from "../../lib/use-copy-feedback.js";
8
8
  import styles from "./copy-button.module.css";
9
9
  /** Copy feedback is deliberately unhurried: a slow, almost critically damped spring and long, soft crossfades read as calm, never busy.
10
10
  * The same motion plays in reverse when the confirmation hands back to idle, so nothing ever snaps. */
11
- const settle = { type: "spring", visualDuration: .5, bounce: .06 };
12
- const enter = { duration: .36, ease: [...motionTokens.ease.enter] };
13
- const leave = { duration: .2, ease: [...motionTokens.ease.standard] };
11
+ const settle = { type: "spring", visualDuration: motionTokens.spring.slow.visualDuration, bounce: .06 };
12
+ const enter = { duration: motionTokens.duration.standard, ease: [...motionTokens.ease.enter] };
13
+ const leave = { duration: motionTokens.duration.exit, ease: [...motionTokens.ease.standard] };
14
14
  const instant = { duration: motionTokens.duration.instant };
15
15
  const soft = `blur(${motionTokens.blur.soft}px)`;
16
16
  const rest = { opacity: 1, y: 0, scale: 1, filter: "blur(0px)" };
@@ -18,7 +18,7 @@ const fadeIn = { ...rest, opacity: 0 };
18
18
  const fadeOut = { opacity: 0, transition: instant };
19
19
  /** Icons trade places in one soft breath: the old glyph shrinks into a blur while the new one grows out of it on the slow spring. */
20
20
  const iconIn = { opacity: 0, scale: .6, filter: soft };
21
- const iconOut = { opacity: 0, scale: .6, filter: soft, transition: { duration: .24, ease: [...motionTokens.ease.standard] } };
21
+ const iconOut = { opacity: 0, scale: .6, filter: soft, transition: { duration: motionTokens.duration.exit, ease: [...motionTokens.ease.standard] } };
22
22
  const iconEnter = { scale: settle, opacity: { ...enter, delay: .03 }, filter: { ...enter, delay: .03 } };
23
23
  /** Letters rise about .3em out of a soft blur; the outgoing ones lift away a little faster. */
24
24
  const glyphIn = { opacity: 0, y: 4, filter: soft };
@@ -11,21 +11,21 @@
11
11
 
12
12
  .units { display: inline-flex; align-items: flex-start; white-space: nowrap; }
13
13
  .unit { display: inline-flex; align-items: flex-start; }
14
- .group { display: inline-grid; justify-items: center; gap: 6px; }
14
+ .group { display: inline-grid; justify-items: center; gap: var(--space-related); }
15
15
  .number { display: inline-flex; font-variant-numeric: tabular-nums; transition: opacity var(--duration-considered) var(--ease-standard); }
16
16
  .countdown[data-pending] .number { opacity: .3; }
17
17
  .name { color: var(--text-muted); font-size: var(--text-xs); line-height: 1; }
18
18
  .colon { color: var(--text-muted); opacity: .6; }
19
19
 
20
20
  /* Large: display digits sized to the container, so four groups fit at 320px and breathe on a wide card. */
21
- .countdown[data-variant="large"] .units { gap: 0; font-family: var(--font-display); font-size: clamp(1.75rem, 12.5cqi, var(--text-5xl)); font-weight: 500; letter-spacing: var(--tracking-display); line-height: 1; }
21
+ .countdown[data-variant="large"] .units { gap: 0; font-family: var(--font-display); font-size: clamp(var(--text-2xl), 12.5cqi, var(--text-5xl)); font-weight: 500; letter-spacing: var(--tracking-display); line-height: 1; }
22
22
  .countdown[data-variant="large"] .colon { padding-inline: .12em; line-height: 1; transform: translateY(-.06em); }
23
23
  /* On a narrow card the unit names outgrow the digits; an even column floor keeps the colons evenly spaced instead of following each name's width. */
24
24
  .countdown[data-variant="large"] .group { min-width: min(calc((100cqi - 1.6em) / 4), calc(var(--text-xs) * 4.2)); }
25
25
  .countdown[data-variant="large"] .name { font-family: var(--font-body); letter-spacing: var(--tracking-body); }
26
26
 
27
27
  /* Compact: one line, digits then a quiet unit letter. */
28
- .countdown[data-variant="compact"] .units { gap: 6px; font-size: var(--text-sm); font-weight: 500; line-height: 1.3; }
28
+ .countdown[data-variant="compact"] .units { gap: var(--space-related); font-size: var(--text-sm); font-weight: 500; line-height: 1.3; }
29
29
  .countdown[data-variant="compact"] .group { display: inline-flex; align-items: baseline; gap: 1px; }
30
30
  .countdown[data-variant="compact"] .name { font-size: var(--text-sm); font-weight: 400; line-height: 1.3; }
31
31
 
@@ -36,7 +36,7 @@
36
36
 
37
37
  /* Finished: the digits give way to the label and a live mark. */
38
38
  .done { display: inline-flex; align-items: center; gap: .4em; white-space: nowrap; }
39
- .countdown[data-variant="large"] .done { font-family: var(--font-display); font-size: clamp(1.75rem, 11cqi, var(--text-4xl)); font-weight: 500; letter-spacing: var(--tracking-display); line-height: 1.1; }
39
+ .countdown[data-variant="large"] .done { font-family: var(--font-display); font-size: clamp(var(--text-2xl), 11cqi, var(--text-4xl)); font-weight: 500; letter-spacing: var(--tracking-display); line-height: 1.1; }
40
40
  .countdown[data-variant="compact"] .done { color: var(--success); font-size: var(--text-sm); font-weight: 500; line-height: 1.3; }
41
41
  .pulse { position: relative; width: .3em; height: .3em; min-width: 8px; min-height: 8px; flex: none; border-radius: 50%; corner-shape: round; background: var(--success); }
42
42
  .pulse::after { position: absolute; inset: 0; border-radius: inherit; corner-shape: inherit; background: var(--success); content: ""; animation: pulse 2s var(--ease-standard) infinite; }
@@ -13,7 +13,7 @@ const instant = { duration: duration.instant };
13
13
  const valueRoll = {
14
14
  enter: (direction) => ({ opacity: 0, y: `${direction * 0.35}em`, filter: `blur(${blur.soft}px)` }),
15
15
  center: { opacity: 1, y: 0, filter: "blur(0px)", transition: { duration: duration.standard, ease: ease.enter } },
16
- exit: (direction) => ({ opacity: 0, y: `${direction * -0.3}em`, filter: `blur(${blur.subtle}px)`, transition: { duration: 0.14, ease: ease.standard } }),
16
+ exit: (direction) => ({ opacity: 0, y: `${direction * -0.3}em`, filter: `blur(${blur.subtle}px)`, transition: { duration: motionTokens.duration.fast, ease: ease.standard } }),
17
17
  };
18
18
  /** Reduced motion keeps a short crossfade; resting values match the roll so server and client markup agree. */
19
19
  const valueFade = { enter: { opacity: 0 }, center: { opacity: 1, y: 0, filter: "blur(0px)", transition: instant }, exit: { opacity: 0, transition: instant } };
@@ -21,7 +21,7 @@ const valueFade = { enter: { opacity: 0 }, center: { opacity: 1, y: 0, filter: "
21
21
  const statusRise = {
22
22
  enter: { opacity: 0, y: "0.3em", filter: `blur(${blur.soft}px)` },
23
23
  center: { opacity: 1, y: 0, filter: "blur(0px)", transition: { duration: duration.standard, ease: ease.enter } },
24
- exit: { opacity: 0, y: "-0.3em", filter: `blur(${blur.subtle}px)`, transition: { duration: 0.14, ease: ease.standard } },
24
+ exit: { opacity: 0, y: "-0.3em", filter: `blur(${blur.subtle}px)`, transition: { duration: motionTokens.duration.fast, ease: ease.standard } },
25
25
  };
26
26
  export function DatePicker({ label, value, onChange, description, placeholder = "Select a date", minDate, maxDate, disabledDates, locale = "en-US", format = { month: "short", day: "numeric", year: "numeric" }, showToday, id, className, disabled, ...buttonProps }) {
27
27
  const generatedId = useId();
@@ -96,5 +96,5 @@ export function DatePicker({ label, value, onChange, description, placeholder =
96
96
  return _jsxs("div", { className: [styles.field, className].filter(Boolean).join(" "), ref: rootRef, onBlur: onBlur, children: [_jsx("label", { className: styles.label, htmlFor: controlId, children: label }), _jsxs("div", { className: styles.anchor, children: [_jsxs("button", { ...buttonProps, ref: triggerRef, id: controlId, type: "button", disabled: disabled, "aria-haspopup": "dialog", "aria-expanded": open, "aria-describedby": hintId, className: styles.trigger, onClick: () => (open ? close() : show()), onKeyDown: onTriggerKeyDown, children: [_jsx(CalendarDays, { size: 16, strokeWidth: 1.75, "aria-hidden": "true" }), _jsx("span", { className: styles.srOnly, children: shown }), _jsx("span", { className: styles.valueText, "aria-hidden": "true", children: _jsx(AnimatePresence, { mode: "popLayout", initial: false, custom: 1, children: value ? _jsx(motion.span, { className: styles.value, custom: 1, variants: reduce ? valueFade : valueRoll, initial: "enter", animate: "center", exit: "exit", children: parts.map((part, index) => _jsx(motion.span, { className: styles.part, layout: "position", layoutDependency: time, transition: partMotion, children: part.type === "literal" ? _jsx("span", { className: styles.partValue, children: part.value }) : _jsx(AnimatePresence, { mode: "popLayout", initial: false, custom: direction, children: _jsx(motion.span, { className: styles.partValue, custom: direction, variants: reduce ? valueFade : valueRoll, initial: "enter", animate: "center", exit: "exit", children: part.value }, part.value) }) }, `${index}-${part.type}`)) }, "value") : _jsx(motion.span, { className: styles.placeholder, custom: -1, variants: reduce ? valueFade : valueRoll, initial: "enter", animate: "center", exit: "exit", children: placeholder }, "placeholder") }) }), _jsx(ChevronDown, { className: styles.chevron, size: 16, strokeWidth: 1.75, "aria-hidden": "true" })] }), _jsx(AnimatePresence, { children: open && _jsxs(motion.div, { ref: popoverRef, className: styles.popover, role: "dialog", "aria-label": `${label} calendar`, onKeyDown: (event) => { if (event.key === "Escape") {
97
97
  event.stopPropagation();
98
98
  close();
99
- } }, initial: reduce ? { opacity: 0 } : { opacity: 0, y: -8, scale: .95 }, animate: { opacity: 1, y: 0, scale: 1, transition: reduce ? instant : { ...spring.snappy, opacity: { duration: duration.fast, ease: ease.enter } } }, exit: { opacity: 0, ...(reduce ? {} : { y: -6, scale: .97 }), transition: { duration: 0.14, ease: ease.standard } }, children: [_jsx(Calendar, { value: value, onChange: selectDate, month: month, onMonthChange: setMonth, minDate: minDate, maxDate: maxDate, disabledDates: disabledDates, locale: locale, showToday: showToday }), _jsxs("div", { className: styles.footer, children: [_jsx("button", { type: "button", onClick: () => selectDate(undefined), disabled: !value, children: "Clear" }), _jsx("span", { className: styles.status, children: _jsx(AnimatePresence, { initial: false, children: _jsx(motion.span, { variants: reduce ? valueFade : statusRise, initial: "enter", animate: "center", exit: "exit", children: value ? `Selected ${formatter.format(value)}` : "Choose a day" }, time ?? "none") }) })] })] }) })] }), description && _jsx("span", { id: hintId, className: styles.description, children: description })] });
99
+ } }, initial: reduce ? { opacity: 0 } : { opacity: 0, y: -8, scale: .95 }, animate: { opacity: 1, y: 0, scale: 1, transition: reduce ? instant : { ...spring.snappy, opacity: { duration: duration.fast, ease: ease.enter } } }, exit: { opacity: 0, ...(reduce ? {} : { y: -6, scale: .97 }), transition: { duration: motionTokens.duration.fast, ease: ease.standard } }, children: [_jsx(Calendar, { value: value, onChange: selectDate, month: month, onMonthChange: setMonth, minDate: minDate, maxDate: maxDate, disabledDates: disabledDates, locale: locale, showToday: showToday }), _jsxs("div", { className: styles.footer, children: [_jsx("button", { type: "button", onClick: () => selectDate(undefined), disabled: !value, children: "Clear" }), _jsx("span", { className: styles.status, children: _jsx(AnimatePresence, { initial: false, children: _jsx(motion.span, { variants: reduce ? valueFade : statusRise, initial: "enter", animate: "center", exit: "exit", children: value ? `Selected ${formatter.format(value)}` : "Choose a day" }, time ?? "none") }) })] })] }) })] }), description && _jsx("span", { id: hintId, className: styles.description, children: description })] });
100
100
  }
@@ -1,8 +1,8 @@
1
- .field { display: grid; gap: 7px; min-width: 0; }
1
+ .field { display: grid; gap: var(--space-related); min-width: 0; }
2
2
  .label { color: var(--foreground); font-size: var(--text-sm); font-weight: 500; line-height: var(--leading-body); }
3
3
  .anchor { position: relative; min-width: 0; }
4
4
  /* The trigger anchors the calendar, so press feedback stays in color; it never scales. */
5
- .trigger { position: relative; display: flex; width: 100%; min-height: var(--control-height-md); align-items: center; gap: 9px; border: 1px solid var(--border); border-radius: var(--radius-control); padding: 0 12px; background: var(--surface); color: var(--foreground); font: inherit; font-size: var(--text-sm); text-align: left; cursor: pointer; transition: border-color var(--duration-fast) var(--ease-standard), background var(--duration-fast) var(--ease-standard), box-shadow var(--duration-fast) var(--ease-standard); }
5
+ .trigger { position: relative; display: flex; width: 100%; min-height: var(--control-height-md); align-items: center; gap: var(--space-related); border: 1px solid var(--border); border-radius: var(--radius-control); padding: 0 var(--space-group); background: var(--surface); color: var(--foreground); font: inherit; font-size: var(--text-sm); text-align: left; cursor: pointer; transition: border-color var(--duration-fast) var(--ease-standard), background var(--duration-fast) var(--ease-standard), box-shadow var(--duration-fast) var(--ease-standard); }
6
6
  @media (hover: hover) and (pointer: fine) { .trigger:hover:not(:disabled) { border-color: var(--border-strong); background: var(--surface-muted); } }
7
7
  .trigger:active:not(:disabled), .trigger[aria-expanded="true"] { border-color: var(--border-strong); background: var(--surface-muted); }
8
8
  .trigger:disabled { cursor: not-allowed; opacity: .5; }
@@ -17,16 +17,16 @@
17
17
  .chevron { flex: 0 0 auto; color: var(--text-muted); transition: transform var(--duration-spring) var(--ease-spring); }
18
18
  .trigger[aria-expanded="true"] .chevron { transform: rotate(180deg); }
19
19
  /* Grows out of the trigger's calendar icon and returns there on close. */
20
- .popover { position: absolute; z-index: 20; top: calc(100% + 8px); left: 0; width: min(320px, calc(100vw - 32px)); overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-container); padding: 16px; background: var(--surface-raised); box-shadow: var(--shadow-floating); transform-origin: 22px -8px; will-change: transform, opacity; }
20
+ .popover { position: absolute; z-index: var(--layer-popover); top: calc(100% + var(--space-related)); left: 0; width: min(320px, calc(100vw - 32px)); overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-container); padding: var(--space-inset); background: var(--surface-raised); box-shadow: var(--shadow-floating); transform-origin: 22px -8px; will-change: transform, opacity; }
21
21
  /* On phone widths the calendar matches the field instead of running past the screen edge, and a tighter inset keeps the month and its controls on one row. */
22
- @media (max-width: 360px) { .popover { right: 0; width: auto; padding: 12px; } }
23
- .footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 14px; border-top: 1px solid var(--border-subtle); padding-top: 11px; color: var(--text-muted); font-size: var(--text-xs); }
22
+ @media (max-width: 360px) { .popover { right: 0; width: auto; padding: var(--space-group); } }
23
+ .footer { display: flex; align-items: center; justify-content: space-between; gap: var(--space-related); margin-top: var(--space-inset); border-top: 1px solid var(--border-subtle); padding-top: var(--space-group); color: var(--text-muted); font-size: var(--text-xs); }
24
24
  /* Old and new status lines share one cell, pinned to the trailing edge so a shorter line never shifts. */
25
25
  .status { display: grid; min-width: 0; justify-items: end; }
26
26
  .status > span { grid-area: 1 / 1; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
27
- .footer button { border: 0; border-radius: var(--radius-control); padding: 4px 8px; background: transparent; color: var(--text-secondary); font: inherit; cursor: pointer; transition: background-color var(--duration-fast) var(--ease-standard), color var(--duration-fast) var(--ease-standard), transform var(--duration-spring) var(--ease-spring); }
27
+ .footer button { border: 0; border-radius: var(--radius-control); padding: var(--space-tight) var(--space-related); background: transparent; color: var(--text-secondary); font: inherit; cursor: pointer; transition: background-color var(--duration-fast) var(--ease-standard), color var(--duration-fast) var(--ease-standard), transform var(--duration-spring) var(--ease-spring); }
28
28
  @media (hover: hover) and (pointer: fine) { .footer button:hover:not(:disabled) { background: var(--surface-muted); color: var(--foreground); } }
29
- .footer button:active:not(:disabled) { transform: scale(.97); transition-duration: var(--duration-fast), var(--duration-fast), 100ms; transition-timing-function: var(--ease-standard); }
29
+ .footer button:active:not(:disabled) { transform: scale(.97); transition-duration: var(--duration-fast), var(--duration-fast), var(--duration-fast); transition-timing-function: var(--ease-standard); }
30
30
  .footer button:disabled { cursor: not-allowed; opacity: .4; }
31
31
  .description { color: var(--text-muted); font-size: var(--text-xs); line-height: var(--leading-body); transition: opacity var(--duration-fast) var(--ease-standard); }
32
32
  /* The open calendar covers the hint; fading it keeps its first letters from peeking past the popover's rounded corner. */