@estiva-app/ui 0.97.0 → 0.98.1

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": "@estiva-app/ui",
3
- "version": "0.97.0",
3
+ "version": "0.98.1",
4
4
  "description": "Estiva's design tokens (the contract) and a small set of primitives (a convenience) for every Estiva app.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/registry.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "kind": "package",
5
5
  "repo": "estiva-ui",
6
6
  "package": "@estiva-app/ui",
7
- "packageVersion": "0.97.0",
7
+ "packageVersion": "0.98.1",
8
8
  "exports": 229,
9
9
  "typeExports": 234,
10
10
  "files": null
@@ -2662,7 +2662,19 @@
2662
2662
  "name": "resolved",
2663
2663
  "takes": "{ by: string; note?: string; at?: string }",
2664
2664
  "required": false,
2665
- "note": "Resolved, by whom, with what note and when (`at`, in the app's words)."
2665
+ "note": "Resolved, by whom, with what note and when (`at`, in the app's words): \"✓ Resolved\" by the time, who and the note on hover; \"Person two → the note · time\" above the replies row."
2666
+ },
2667
+ {
2668
+ "name": "noun",
2669
+ "takes": "text",
2670
+ "required": false,
2671
+ "note": "What the comment is called in the delete question: \"Delete this comment?\" by default."
2672
+ },
2673
+ {
2674
+ "name": "resolveHint",
2675
+ "takes": "text",
2676
+ "required": false,
2677
+ "note": "Beside Resolve in the ⋯ menu, how the app's box resolves too, as its key hint: Peek's \"->\"."
2666
2678
  },
2667
2679
  {
2668
2680
  "name": "onResolve",
@@ -2712,6 +2724,12 @@
2712
2724
  "required": false,
2713
2725
  "note": "A link to it: the time is then the link, \"Link to this\", as a reply's is."
2714
2726
  },
2727
+ {
2728
+ "name": "timeLabel",
2729
+ "takes": "text",
2730
+ "required": false,
2731
+ "note": "The time's tooltip when it is a link, in the app's words: \"Link to this\" by default; Peek's \"Link to this message\"."
2732
+ },
2715
2733
  {
2716
2734
  "name": "edited",
2717
2735
  "takes": "text",
@@ -2800,13 +2818,31 @@
2800
2818
  "name": "deleteNote",
2801
2819
  "takes": "anything",
2802
2820
  "required": false,
2803
- "note": "The app's sentence in the delete question, what deleting does there."
2821
+ "note": "The app's own words under the delete question, what deleting does there, in place of the kit's: \"It is deleted for everyone.\", and on a comment how many replies stay."
2804
2822
  },
2805
2823
  {
2806
2824
  "name": "menu",
2807
2825
  "takes": "anything",
2808
2826
  "required": false,
2809
- "note": "The app's own rows in the ⋯ menu: `MenuItem`s."
2827
+ "note": "The app's own rows in the ⋯ menu, after Resolve: `MenuItem`s."
2828
+ },
2829
+ {
2830
+ "name": "menuAfter",
2831
+ "takes": "anything",
2832
+ "required": false,
2833
+ "note": "The app's own rows in the ⋯ menu after Edit, before Delete: Peek's \"View details\"."
2834
+ },
2835
+ {
2836
+ "name": "menuLabel",
2837
+ "takes": "text",
2838
+ "required": false,
2839
+ "note": "A heading over the menu's first rows, in the app's words: Peek's \"Utilities\"."
2840
+ },
2841
+ {
2842
+ "name": "editLabel",
2843
+ "takes": "text",
2844
+ "required": false,
2845
+ "note": "Edit's words in the ⋯ menu: \"Edit\" by default; Peek's \"Edit message\"."
2810
2846
  },
2811
2847
  {
2812
2848
  "name": "className",
@@ -2823,9 +2859,7 @@
2823
2859
  "storyId": "conversation-conversationcard--comment",
2824
2860
  "docPage": "src/ConversationCard.mdx",
2825
2861
  "app": null,
2826
- "looks": [
2827
- "[&>div]:line-clamp-1 [&>div]:max-h-[1lh] [&>div>*:not(p):not(ul):not(ol):not(blockquote):not(pre):not(div:only-child)]:hidden [&>div>div:only-child>*:not(p):not(ul):not(ol):not(blockquote):not(pre)]:hidden"
2828
- ]
2862
+ "looks": []
2829
2863
  },
2830
2864
  {
2831
2865
  "name": "ConversationLayout",
@@ -2870,7 +2904,19 @@
2870
2904
  "name": "above",
2871
2905
  "takes": "anything",
2872
2906
  "required": false,
2873
- "note": "Above the comments, inside their list: a `ReactionHorizon`, a note."
2907
+ "note": "Above the comments, inside their list: placeholders while older comments are read, a note."
2908
+ },
2909
+ {
2910
+ "name": "below",
2911
+ "takes": "anything",
2912
+ "required": false,
2913
+ "note": "Two columns: under the comments, inside their list, or under the empty line: a `ReactionHorizon`."
2914
+ },
2915
+ {
2916
+ "name": "top",
2917
+ "takes": "anything",
2918
+ "required": false,
2919
+ "note": "Two columns: at the top of the column however few the comments are, over the room a short conversation leaves: an `ArchivedNotice`."
2874
2920
  },
2875
2921
  {
2876
2922
  "name": "loading",
@@ -2880,9 +2926,21 @@
2880
2926
  },
2881
2927
  {
2882
2928
  "name": "empty",
2883
- "takes": "text",
2929
+ "takes": "anything",
2884
2930
  "required": false,
2885
- "note": "What an empty conversation says."
2931
+ "note": "What an empty conversation says: words, or the app's own `EmptyState` (a read that failed says so)."
2932
+ },
2933
+ {
2934
+ "name": "bodyRef",
2935
+ "takes": "Ref<HTMLDivElement>",
2936
+ "required": false,
2937
+ "note": "Two columns: the comments' scrolling box, for an app that keeps its own place in it (where it was left, its \"New\" line, following what arrives)."
2938
+ },
2939
+ {
2940
+ "name": "onBodyScroll",
2941
+ "takes": "UIEventHandler<HTMLDivElement>",
2942
+ "required": false,
2943
+ "note": "Two columns: the comments' box scrolled."
2886
2944
  },
2887
2945
  {
2888
2946
  "name": "header",
@@ -2894,7 +2952,7 @@
2894
2952
  "name": "title",
2895
2953
  "takes": "anything",
2896
2954
  "required": false,
2897
- "note": "One column: its name, in its header."
2955
+ "note": "Its name: one column's, in its header. Two columns, said with the message if the column breaks (the page's own bar is `header`)."
2898
2956
  },
2899
2957
  {
2900
2958
  "name": "actions",
@@ -2933,7 +2991,7 @@
2933
2991
  "kind": "component",
2934
2992
  "importPath": "@estiva-app/ui",
2935
2993
  "sourceFile": "src/ConversationMenu.tsx",
2936
- "purpose": "The ⋯ menu of a comment or a reply: Resolve or Reopen, the app's own rows, then Edit and Delete on your own.",
2994
+ "purpose": "The ⋯ menu of a comment or a reply: Resolve or Reopen and the app's own rows; then Edit on your own; then Delete on your own, apart.",
2937
2995
  "purposeFrom": "page",
2938
2996
  "props": [
2939
2997
  {
@@ -2954,11 +3012,23 @@
2954
3012
  "required": false,
2955
3013
  "note": null
2956
3014
  },
3015
+ {
3016
+ "name": "resolveHint",
3017
+ "takes": "text",
3018
+ "required": false,
3019
+ "note": "Beside Resolve, how the app's box resolves too, as its key hint: Peek's \"->\"."
3020
+ },
2957
3021
  {
2958
3022
  "name": "children",
2959
3023
  "takes": "anything",
2960
3024
  "required": false,
2961
- "note": "The app's own rows, between Resolve and Edit: `MenuItem`s."
3025
+ "note": "The app's own rows, after Resolve: `MenuItem`s."
3026
+ },
3027
+ {
3028
+ "name": "label",
3029
+ "takes": "text",
3030
+ "required": false,
3031
+ "note": "A heading over Resolve and the app's rows, in the app's words: Peek's \"Utilities\"."
2962
3032
  },
2963
3033
  {
2964
3034
  "name": "onEdit",
@@ -2966,6 +3036,18 @@
2966
3036
  "required": false,
2967
3037
  "note": "Offered on your own only."
2968
3038
  },
3039
+ {
3040
+ "name": "editLabel",
3041
+ "takes": "text",
3042
+ "required": false,
3043
+ "note": "Edit's words: \"Edit\" by default; Peek's \"Edit message\"."
3044
+ },
3045
+ {
3046
+ "name": "after",
3047
+ "takes": "anything",
3048
+ "required": false,
3049
+ "note": "The app's own rows after Edit, before Delete: Peek's \"View details\"."
3050
+ },
2969
3051
  {
2970
3052
  "name": "onDelete",
2971
3053
  "takes": "a handler",
@@ -8073,6 +8155,12 @@
8073
8155
  "takes": "true/false",
8074
8156
  "required": false,
8075
8157
  "note": "Some reactions may be missing: the read was cut short."
8158
+ },
8159
+ {
8160
+ "name": "noun",
8161
+ "takes": "text",
8162
+ "required": false,
8163
+ "note": "What the app calls what is said, in the plural: \"messages\" in Peek."
8076
8164
  }
8077
8165
  ],
8078
8166
  "variants": [],
@@ -8533,6 +8621,12 @@
8533
8621
  "required": false,
8534
8622
  "note": "A link to it: the time is then the link, \"Link to this\", as a reply's is."
8535
8623
  },
8624
+ {
8625
+ "name": "timeLabel",
8626
+ "takes": "text",
8627
+ "required": false,
8628
+ "note": "The time's tooltip when it is a link, in the app's words: \"Link to this\" by default; Peek's \"Link to this message\"."
8629
+ },
8536
8630
  {
8537
8631
  "name": "edited",
8538
8632
  "takes": "text",
@@ -8621,13 +8715,31 @@
8621
8715
  "name": "deleteNote",
8622
8716
  "takes": "anything",
8623
8717
  "required": false,
8624
- "note": "The app's sentence in the delete question, what deleting does there."
8718
+ "note": "The app's own words under the delete question, what deleting does there, in place of the kit's: \"It is deleted for everyone.\", and on a comment how many replies stay."
8625
8719
  },
8626
8720
  {
8627
8721
  "name": "menu",
8628
8722
  "takes": "anything",
8629
8723
  "required": false,
8630
- "note": "The app's own rows in the ⋯ menu: `MenuItem`s."
8724
+ "note": "The app's own rows in the ⋯ menu, after Resolve: `MenuItem`s."
8725
+ },
8726
+ {
8727
+ "name": "menuAfter",
8728
+ "takes": "anything",
8729
+ "required": false,
8730
+ "note": "The app's own rows in the ⋯ menu after Edit, before Delete: Peek's \"View details\"."
8731
+ },
8732
+ {
8733
+ "name": "menuLabel",
8734
+ "takes": "text",
8735
+ "required": false,
8736
+ "note": "A heading over the menu's first rows, in the app's words: Peek's \"Utilities\"."
8737
+ },
8738
+ {
8739
+ "name": "editLabel",
8740
+ "takes": "text",
8741
+ "required": false,
8742
+ "note": "Edit's words in the ⋯ menu: \"Edit\" by default; Peek's \"Edit message\"."
8631
8743
  },
8632
8744
  {
8633
8745
  "name": "className",
@@ -8644,9 +8756,7 @@
8644
8756
  "storyId": "conversation-replycard--reply",
8645
8757
  "docPage": "src/ReplyCard.mdx",
8646
8758
  "app": null,
8647
- "looks": [
8648
- "[&>div]:line-clamp-1 [&>div]:max-h-[1lh] [&>div>*:not(p):not(ul):not(ol):not(blockquote):not(pre):not(div:only-child)]:hidden [&>div>div:only-child>*:not(p):not(ul):not(ol):not(blockquote):not(pre)]:hidden"
8649
- ]
8759
+ "looks": []
8650
8760
  },
8651
8761
  {
8652
8762
  "name": "ResolveDialog",
@@ -10173,6 +10283,18 @@
10173
10283
  "required": false,
10174
10284
  "note": "Closes the column."
10175
10285
  },
10286
+ {
10287
+ "name": "closeLabel",
10288
+ "takes": "text",
10289
+ "required": false,
10290
+ "note": "Close's name for a screen reader, in the app's words (\"Close thread\")."
10291
+ },
10292
+ {
10293
+ "name": "empty",
10294
+ "takes": "anything",
10295
+ "required": false,
10296
+ "note": "Beside: what an empty thread says, words or the app's own `EmptyState`."
10297
+ },
10176
10298
  {
10177
10299
  "name": "title",
10178
10300
  "takes": "anything",
@@ -13,7 +13,8 @@ One comment, the same in every app: who, when, the words, files, cards, reaction
13
13
 
14
14
  - **A comment** in any conversation: in the comments beside a page, or filling the page with its thread beside it (**ConversationLayout**).
15
15
  - `own` on yours: Edit (with `editor`) and Delete (with `onDelete`) in its menu. The card asks before it deletes.
16
- - `resolved`: folded. "✓ Resolved" by the time, with who, when and the note on hover; "Person two → the note · time" above its replies row. While its thread is closed, the words fold to their first line, without files or reactions; open, it is whole.
16
+ - `resolved`: "✓ Resolved" by the time, with who, when and the note on hover; "Person two → the note · time" above its replies row. Nothing of the comment is hidden: its words, cards, files and reactions stay.
17
+ - `noun`: what the delete question calls it, "Delete this comment?" by default; a direct message says `message`.
17
18
  - `about` on a comment on a part of the page: a **QuotedLine** under the name, above the words.
18
19
  - `isNew`, `urgent`: the dot or the urgent mark, and a hairline, until it is read.
19
20
 
@@ -63,9 +64,10 @@ import { ConversationCard } from '@estiva-app/ui'
63
64
  | It does | So you never write | Refused when written by hand |
64
65
  |---|---|---|
65
66
  | Shows its actions while pointed at, and holds them while a menu is open | hover state and an outside-click check | |
67
+ | A card that opens on a press is a Tab stop: reaching it shows its actions, Enter or Space opens it | a `tabIndex` and a key handler | |
66
68
  | Asks before it deletes | a confirm dialog | |
67
69
  | Opens the Resolve dialog, and closes it once resolved | a dialog and its open state | |
68
- | Says it is resolved, with who and the note, and folds it while its thread is closed | a resolved line or chip of your own | |
70
+ | Says it is resolved, with who and the note, and hides nothing of it | a resolved line or chip of your own | |
69
71
 
70
72
  ## Props
71
73
 
@@ -277,18 +277,38 @@ describe('what the review found (1 November)', () => {
277
277
  expect(onClick).toHaveBeenCalledOnce()
278
278
  })
279
279
 
280
- it('open beside by the app’s own `selected`, a resolved comment is whole: its files show', () => {
280
+ it('asks about a direct message as a message (Katerina, 1 November), and about a comment by default', async () => {
281
281
  render(
282
- <ConversationCard author={ONE} time="11:08 AM" selected resolved={{ by: 'Person two' }} files={<span>plan.png</span>}>
282
+ <ConversationCard author={ONE} time="11:08 AM" own onDelete={() => {}} noun="message">
283
283
  Words
284
284
  </ConversationCard>,
285
285
  )
286
- expect(screen.getByText('plan.png')).toBeTruthy()
286
+ point('Words')
287
+ fireEvent.click(screen.getByRole('button', { name: 'More actions' }))
288
+ fireEvent.click(await screen.findByRole('menuitem', { name: 'Delete' }))
289
+ expect(await screen.findByText('Delete this message?')).toBeTruthy()
290
+ expect(screen.getByRole('button', { name: 'Delete message' })).toBeTruthy()
291
+ })
292
+ })
293
+
294
+ describe('an app’s own words (Katerina, 1 November: Peek reads as it did)', () => {
295
+ it('says the app’s words under the delete question, in place of the kit’s, the replies’ line too', async () => {
296
+ render(
297
+ <ConversationCard author={ONE} time="11:08 AM" own onDelete={() => {}} replies={{ count: 2 }} deleteNote={<p>The app’s own words about what deleting does, and the replies.</p>}>
298
+ Words
299
+ </ConversationCard>,
300
+ )
301
+ point('Words')
302
+ fireEvent.click(screen.getByRole('button', { name: 'More actions' }))
303
+ fireEvent.click(await screen.findByRole('menuitem', { name: 'Delete' }))
304
+ expect(await screen.findByText('The app’s own words about what deleting does, and the replies.')).toBeTruthy()
305
+ expect(screen.queryByText('It is deleted for everyone.')).toBeNull()
306
+ expect(screen.queryByText('Its 2 replies stay.')).toBeNull()
287
307
  })
288
308
  })
289
309
 
290
310
  describe('its files, what it is about, and how it was resolved', () => {
291
- it('draws its files under the words, and holds them back while it is folded', () => {
311
+ it('draws its files under the words, and keeps them once resolved: nothing folds (Katerina, 1 November)', () => {
292
312
  render(
293
313
  <ConversationCard author={ONE} time="11:08 AM" files={<span>plan.png</span>}>
294
314
  Words
@@ -301,7 +321,7 @@ describe('its files, what it is about, and how it was resolved', () => {
301
321
  Words
302
322
  </ConversationCard>,
303
323
  )
304
- expect(screen.queryByText('plan.png')).toBeNull()
324
+ expect(after(screen.getByText('Words'), screen.getByText('plan.png'))).toBe(true)
305
325
  })
306
326
 
307
327
  it('puts what it is about under the name and above the words (Katerina, 1 November), on a reply too', () => {
@@ -24,7 +24,7 @@ type Story = StoryObj<typeof meta>
24
24
  /** Two paragraphs in RichText's own box, as an app's words come. */
25
25
  const RICH = [
26
26
  { type: 'paragraph' as const, inline: [{ text: WORDS, marks: [] }] },
27
- { type: 'paragraph' as const, inline: [{ text: 'A second paragraph, held back while it is folded.', marks: [] }] },
27
+ { type: 'paragraph' as const, inline: [{ text: 'A second paragraph: a resolved comment shows all of it.', marks: [] }] },
28
28
  ]
29
29
 
30
30
  /** A card that answers: its reactions, resolve, edit and delete change it, as an app's would. */
@@ -91,10 +91,10 @@ export const Urgent: Story = { render: (args) => <Live {...args} isNew urgent re
91
91
  /** A person named in the words, and a link. */
92
92
  export const WithMentions: Story = { name: 'Mentions', render: (args) => <Live {...args}><Mentions /></Live> }
93
93
 
94
- /** Resolved, folded: "Resolved" by the time, who and the note above its replies; closed, its words in one line, its reactions and files held back. */
94
+ /** Resolved: "Resolved" by the time, who and the note above its replies; its words, reactions and files all stay. */
95
95
  export const Resolved: Story = { render: (args) => <Live {...args} start={SOME} resolvedAt={{ by: 'Person two', note: 'Keeping the first one.' }} replies={{ count: 2, faces: [TWO, THREE], last: '12:02 PM' }} /> }
96
96
 
97
- /** Resolved, its words in a box of their own, as the apps draw them (RichText here): folded, still their first line. */
97
+ /** Resolved, its words in a box of their own, as the apps draw them (RichText here): all of them shown. */
98
98
  export const ResolvedInABox: Story = {
99
99
  name: 'Resolved, words in a box',
100
100
  render: (args) => (
@@ -71,7 +71,7 @@ describe('ConversationCard', () => {
71
71
  expect(onResolve).toHaveBeenCalledWith('Going with the first one')
72
72
  })
73
73
 
74
- it('folds when resolved: the check by the time, who and the note above its replies, its reactions held back, and still opens its thread on a press', async () => {
74
+ it('resolved: the check by the time, who and the note above its replies, nothing of it hidden, and still opens its thread on a press', async () => {
75
75
  const user = userEvent.setup()
76
76
  const onClick = vi.fn()
77
77
  render(
@@ -79,13 +79,13 @@ describe('ConversationCard', () => {
79
79
  Words
80
80
  </ConversationCard>,
81
81
  )
82
- // Folded (Katerina, 1 November): "✓ Resolved" by the time, and "Person two → Done." above its replies, with no "resolved";
83
- // closed, its words in one line and its reactions wait.
82
+ // "✓ Resolved" by the time, and "Person two → Done." above its replies, with no "resolved"; its words and its reactions
83
+ // stay (Katerina, 1 November: nothing folds).
84
84
  expect(screen.getByText('Resolved')).toBeTruthy()
85
85
  expect(screen.getByText('Person two')).toBeTruthy()
86
86
  expect(screen.getByText('Done.')).toBeTruthy()
87
87
  expect(screen.queryByText(/Person two resolved/)).toBeNull()
88
- expect(screen.queryByRole('button', { name: /👍/ })).toBeNull()
88
+ expect(screen.getByRole('button', { name: /👍/ })).toBeTruthy()
89
89
  await user.click(screen.getByText('Words'))
90
90
  expect(onClick).toHaveBeenCalledOnce()
91
91
  })
@@ -157,3 +157,43 @@ describe('ReplyCard', () => {
157
157
  expect(onDelete).toHaveBeenCalledOnce()
158
158
  })
159
159
  })
160
+
161
+ describe('ConversationCard, by the keyboard (Peek’s review, 1 November)', () => {
162
+ it('a card that opens on a press is a Tab stop: reaching it shows the strip, and Enter opens it', async () => {
163
+ const user = userEvent.setup()
164
+ const opened = vi.fn()
165
+ render(
166
+ <ConversationCard author={ONE} time="11:08 AM" onClick={opened} onReply={() => {}}>
167
+ A comment with nothing focusable in it
168
+ </ConversationCard>,
169
+ )
170
+ await user.tab()
171
+ const card = document.activeElement as HTMLElement
172
+ expect(card.textContent).toContain('A comment with nothing focusable in it')
173
+ expect(screen.getByRole('button', { name: 'Reply' })).toBeTruthy()
174
+ fireEvent.keyDown(card, { key: 'Enter' })
175
+ expect(opened).toHaveBeenCalledOnce()
176
+ fireEvent.keyDown(card, { key: ' ' })
177
+ expect(opened).toHaveBeenCalledTimes(2)
178
+ })
179
+
180
+ it('a key in a link inside it is the link’s, not a press on the card', () => {
181
+ const opened = vi.fn()
182
+ render(
183
+ <ConversationCard author={ONE} time="11:08 AM" onClick={opened}>
184
+ <a href="#somewhere">a link</a>
185
+ </ConversationCard>,
186
+ )
187
+ fireEvent.keyDown(screen.getByRole('link', { name: 'a link' }), { key: 'Enter' })
188
+ expect(opened).not.toHaveBeenCalled()
189
+ })
190
+
191
+ it('a card with nothing to open is no Tab stop', () => {
192
+ const { container } = render(
193
+ <ConversationCard author={ONE} time="11:08 AM" readOnly>
194
+ Nothing to open
195
+ </ConversationCard>,
196
+ )
197
+ expect(container.querySelector('[tabindex="0"]')).toBeNull()
198
+ })
199
+ })