@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 +1 -1
- package/src/components/message-list-pane.render.test.ts +1 -1
- package/src/components/message-list-pane.stories.tsx +1 -1
- package/src/components/message-list-state.render.test.ts +14 -3
- package/src/components/message-list-state.stories.tsx +28 -3
- package/src/components/message-list-state.tsx +15 -10
package/package.json
CHANGED
|
@@ -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
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
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
|
-
/**
|
|
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
|
|
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
|
-
|
|
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 ${
|
|
148
|
-
if (scopeLabel) return `No ${
|
|
149
|
-
return `No ${
|
|
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 }) {
|