@remit/ui 0.0.172 → 0.0.173

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.172",
3
+ "version": "0.0.173",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src"
@@ -127,7 +127,7 @@ describe("MessageListPane", () => {
127
127
  isDesktop: true,
128
128
  listState: "empty",
129
129
  listFilter: {
130
- label: "Personal",
130
+ label: "Personal mail",
131
131
  reach: "whole-folder",
132
132
  onClear: () => undefined,
133
133
  },
@@ -354,7 +354,7 @@ export const FilteredEmptyState: Story = {
354
354
  listState: "empty",
355
355
  keyboard: noKeyboard,
356
356
  listFilter: {
357
- label: "Personal",
357
+ label: "Personal mail",
358
358
  reach: "whole-folder",
359
359
  onClear: () => undefined,
360
360
  },
@@ -20,7 +20,7 @@ function empty(props: MessageListEmptyProps = {}): string {
20
20
  }
21
21
 
22
22
  const personal: MessageListFilter = {
23
- label: "Personal",
23
+ label: "Personal mail",
24
24
  reach: "whole-folder",
25
25
  onClear: () => undefined,
26
26
  };
@@ -88,7 +88,7 @@ describe("MessageListEmpty under a filter", () => {
88
88
  { filter: personal, scopeLabel: "Inbox" },
89
89
  { filter: personal, searchQuery: "invoice" },
90
90
  { filter: personal, scopeLabel: "Inbox", searchQuery: "invoice" },
91
- { filter: { ...personal, label: "Unclassified" } },
91
+ { filter: { ...personal, label: "Unclassified mail" } },
92
92
  { filter: { ...personal, reach: "loaded-pages" } },
93
93
  { filter: { ...personal, reach: "loaded-pages" }, scopeLabel: "Inbox" },
94
94
  ];
@@ -130,6 +130,17 @@ describe("MessageListEmpty under a filter", () => {
130
130
  assert.match(html, new RegExp(COMPLETENESS));
131
131
  });
132
132
 
133
+ it("names a narrowing that is not a category at all (#1126)", () => {
134
+ const html = empty({
135
+ filter: { ...personal, label: "unread mail" },
136
+ scopeLabel: "Starred",
137
+ });
138
+ assert.match(html, /No unread mail in Starred/);
139
+ assert.match(html, new RegExp(COMPLETENESS));
140
+ assert.match(html, /Clear filter/);
141
+ assert.doesNotMatch(html, /No messages in Starred/);
142
+ });
143
+
133
144
  it("offers the way out of the filter", () => {
134
145
  assert.match(empty({ filter: personal }), /Clear filter/);
135
146
  });
@@ -152,7 +163,7 @@ describe("MessageListEmpty under a filter", () => {
152
163
 
153
164
  it("renders unclassified as itself, never as personal (#45)", () => {
154
165
  const unclassified = empty({
155
- filter: { ...personal, label: "Unclassified" },
166
+ filter: { ...personal, label: "Unclassified mail" },
156
167
  scopeLabel: "Inbox",
157
168
  });
158
169
  assert.match(unclassified, /No Unclassified mail in Inbox/);
@@ -44,7 +44,7 @@ const longRow: ThreadRowData = {
44
44
  };
45
45
 
46
46
  const personalFilter: MessageListFilter = {
47
- label: "Personal",
47
+ label: "Personal mail",
48
48
  reach: "whole-folder",
49
49
  onClear: () => undefined,
50
50
  };
@@ -185,6 +185,31 @@ export const FilteredEmpty: Story = {
185
185
  args: { filter: personalFilter, scopeLabel: "Inbox" },
186
186
  };
187
187
 
188
+ /**
189
+ * The narrowing is an attribute chip, or a token typed in the field, with no
190
+ * category chosen. The list is filtered exactly as much as it is under a
191
+ * category, and used to render as an empty collection instead (#1126).
192
+ */
193
+ export const FilteredEmptyAttributeOnly: Story = {
194
+ ...inFilteredPane,
195
+ args: {
196
+ filter: { ...personalFilter, label: "unread mail" },
197
+ scopeLabel: "Inbox",
198
+ },
199
+ };
200
+
201
+ /** Every dimension at once: category chip, attribute chip and typed token. */
202
+ export const FilteredEmptyEveryNarrowing: Story = {
203
+ ...inFilteredPane,
204
+ args: {
205
+ filter: {
206
+ ...personalFilter,
207
+ label: "Personal unread mail with an attachment",
208
+ },
209
+ scopeLabel: "Inbox",
210
+ },
211
+ };
212
+
188
213
  /** S2 with a search query on top of the filter — same completeness sentence. */
189
214
  export const FilteredEmptySearching: Story = {
190
215
  ...inFilteredPane,
@@ -216,7 +241,7 @@ export const FilteredEmptyBoundedReach: Story = {
216
241
  export const FilteredEmptyUnclassified: Story = {
217
242
  decorators: [paneFrame],
218
243
  args: {
219
- filter: { ...personalFilter, label: "Unclassified" },
244
+ filter: { ...personalFilter, label: "Unclassified mail" },
220
245
  scopeLabel: "Inbox",
221
246
  },
222
247
  render: (args) => (
@@ -230,7 +255,7 @@ export const FilteredEmptyUnclassified: Story = {
230
255
  export const FilteredEmptyLongLabels: Story = {
231
256
  ...inFilteredPane,
232
257
  args: {
233
- filter: { ...personalFilter, label: "Transactional" },
258
+ filter: { ...personalFilter, label: "Transactional mail" },
234
259
  scopeLabel: "Archive/2024/Suppliers/Netherlands Enterprise Agency",
235
260
  },
236
261
  };
@@ -49,20 +49,25 @@ export function MessageListLoading() {
49
49
  export type FilterReach = "whole-folder" | "loaded-pages";
50
50
 
51
51
  /**
52
- * The active category filter, the way out of it, and how far it reached. All
53
- * three together: the label cannot arrive without its escape, and the reach
54
- * cannot be left to a default, because it decides which completeness sentence
55
- * is true.
52
+ * What narrows the list, the way out of it, and how far it reached. All three
53
+ * together: the label cannot arrive without its escape, and the reach cannot be
54
+ * left to a default, because it decides which completeness sentence is true.
56
55
  */
57
56
  export interface MessageListFilter {
58
- /** Display label of the active category, e.g. "Personal". */
57
+ /**
58
+ * The narrowing as a noun phrase the headline reads "No " in front of:
59
+ * "Personal mail", "unread mail with an attachment". Whatever narrows the
60
+ * list belongs in it — a category chip, an attribute chip, a typed token —
61
+ * because this object's presence is what tells the reader the collection is
62
+ * filtered rather than empty (#1126).
63
+ */
59
64
  label: string;
60
65
  reach: FilterReach;
61
66
  onClear: () => void;
62
67
  }
63
68
 
64
69
  export interface MessageListEmptyProps {
65
- /** Absent when no category filter is active. */
70
+ /** Absent when nothing narrows the list. */
66
71
  filter?: MessageListFilter;
67
72
  /**
68
73
  * Name of the collection being listed, e.g. "Inbox". Absent for a plain
@@ -140,13 +145,13 @@ function unfilteredCopy(
140
145
 
141
146
  /** One string, not JSX, so the copy stays a single text node and reads whole. */
142
147
  function filteredHeadline(
143
- filterLabel: string,
148
+ narrowing: string,
144
149
  scopeLabel: string | undefined,
145
150
  query: string | undefined,
146
151
  ): string {
147
- if (query) return `No results for “${query}” in ${filterLabel}`;
148
- if (scopeLabel) return `No ${filterLabel} mail in ${scopeLabel}`;
149
- return `No ${filterLabel} mail`;
152
+ if (query) return `No results for “${query}” in ${narrowing}`;
153
+ if (scopeLabel) return `No ${narrowing} in ${scopeLabel}`;
154
+ return `No ${narrowing}`;
150
155
  }
151
156
 
152
157
  function EmptyFrame({ children }: { children: ReactNode }) {