@remit/ui 0.0.129 → 0.0.130

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remit/ui",
3
- "version": "0.0.129",
3
+ "version": "0.0.130",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src"
@@ -24,9 +24,10 @@ export interface MailActionToolbarProps {
24
24
  /** Whether a thread is open. Drives the no-op-explain behaviour, never `disabled`. */
25
25
  hasThread: boolean;
26
26
  /**
27
- * Fired when an action button is pressed with no thread open. The host
28
- * surfaces a one-line inline explanation never a toast, never a disabled
29
- * button (`doc/rules/ux.md`: never disable a control).
27
+ * Fired when an action button is pressed and there is nothing behind it —
28
+ * no thread open, or no handler wired for that verb. The host surfaces a
29
+ * one-line inline explanation — never a toast, never a disabled button
30
+ * (`doc/rules/ux.md`: never disable a control).
30
31
  */
31
32
  onUnavailable?: (action: MailAction) => void;
32
33
  /** A one-line inline notice rendered under the toolbar (e.g. "Open a message first"). */
@@ -59,10 +60,12 @@ export interface MailActionToolbarProps {
59
60
 
60
61
  /**
61
62
  * The reading-pane action toolbar, shared between the remit-ui AppShell
62
- * reference and the live client. Buttons are always pressable: with no thread
63
- * open they no-op and call `onUnavailable(action)` so the host can explain why,
64
- * rather than greying out (the never-disable tenet a `disabled` button gives
65
- * the user no path to learn what it does or what they must do first).
63
+ * reference and the live client. Buttons are always pressable: where a press
64
+ * cannot act — no thread open, or no handler wired for that verb it calls
65
+ * `onUnavailable(action)` so the host can explain why, rather than greying out
66
+ * (the never-disable tenet a `disabled` button gives the user no path to
67
+ * learn what it does or what they must do first). Every press is answered; the
68
+ * bar has no branch that ends in silence.
66
69
  */
67
70
  export function MailActionToolbar({
68
71
  hasThread,
@@ -85,12 +88,16 @@ export function MailActionToolbar({
85
88
  children,
86
89
  className,
87
90
  }: MailActionToolbarProps) {
91
+ // A verb with no handler behind it is unavailable in exactly the way one with
92
+ // no thread is, and says so the same way. Dropping the press instead left the
93
+ // three reply verbs pressable and mute for as long as a host took to wire
94
+ // them (#803).
88
95
  const act = (action: MailAction, handler?: () => void) => () => {
89
- if (!hasThread) {
96
+ if (!hasThread || !handler) {
90
97
  onUnavailable?.(action);
91
98
  return;
92
99
  }
93
- handler?.();
100
+ handler();
94
101
  };
95
102
 
96
103
  return (
@@ -166,7 +173,7 @@ export function MailActionToolbar({
166
173
  <div className="flex-1" />
167
174
  {children}
168
175
  </header>
169
- {!hasThread && unavailableHint && (
176
+ {unavailableHint && (
170
177
  // biome-ignore lint/a11y/useSemanticElements: <p> with role="status" preserves block layout; <output> is inline
171
178
  <p
172
179
  role="status"
@@ -288,7 +288,16 @@ function MessageToolbar({
288
288
  return (
289
289
  <MailActionToolbar
290
290
  hasThread={hasThread}
291
- onUnavailable={() => setHint("Open a message first")}
291
+ // This shell documents the layout and has no mail behind its verbs, so
292
+ // with a thread open a press says that rather than borrowing the line
293
+ // about opening one.
294
+ onUnavailable={() =>
295
+ setHint(
296
+ hasThread
297
+ ? "Not wired in the layout reference"
298
+ : "Open a message first",
299
+ )
300
+ }
292
301
  unavailableHint={hint}
293
302
  >
294
303
  <IntelligenceToggle