@estiva-app/ui 0.117.0 → 0.119.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.
- package/dist/ActivityLine.d.ts +37 -0
- package/dist/ActivityLine.d.ts.map +1 -0
- package/dist/CollapsibleSection.d.ts +6 -1
- package/dist/CollapsibleSection.d.ts.map +1 -1
- package/dist/ContainerHeader.d.ts +10 -1
- package/dist/ContainerHeader.d.ts.map +1 -1
- package/dist/ConversationLayout.d.ts.map +1 -1
- package/dist/DialogShell.d.ts +11 -3
- package/dist/DialogShell.d.ts.map +1 -1
- package/dist/ListColumn.d.ts +6 -1
- package/dist/ListColumn.d.ts.map +1 -1
- package/dist/ListTable.d.ts +71 -0
- package/dist/ListTable.d.ts.map +1 -0
- package/dist/MembersDialog.d.ts.map +1 -1
- package/dist/NavTree.d.ts +12 -1
- package/dist/NavTree.d.ts.map +1 -1
- package/dist/PageHeader.d.ts +11 -2
- package/dist/PageHeader.d.ts.map +1 -1
- package/dist/conversationScroll.d.ts +6 -0
- package/dist/conversationScroll.d.ts.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +586 -433
- package/dist/index.js.map +4 -4
- package/dist/revealCurrentRow.d.ts +28 -0
- package/dist/revealCurrentRow.d.ts.map +1 -0
- package/dist/showInConversation.d.ts +5 -0
- package/dist/showInConversation.d.ts.map +1 -1
- package/package.json +1 -1
- package/registry.json +253 -5
- package/src/ActivityLine.mdx +67 -0
- package/src/ActivityLine.stories.tsx +49 -0
- package/src/ActivityLine.test.tsx +47 -0
- package/src/ActivityLine.tsx +74 -0
- package/src/Button.mdx +5 -0
- package/src/CollapsibleSection.mdx +6 -0
- package/src/CollapsibleSection.stories.tsx +4 -1
- package/src/CollapsibleSection.test.tsx +11 -0
- package/src/CollapsibleSection.tsx +7 -2
- package/src/ContainerHeader.mdx +7 -0
- package/src/ContainerHeader.stories.tsx +3 -0
- package/src/ContainerHeader.test.tsx +12 -1
- package/src/ContainerHeader.tsx +38 -18
- package/src/ConversationLayout.mdx +5 -2
- package/src/ConversationLayout.scroll.test.tsx +62 -1
- package/src/ConversationLayout.stories.tsx +44 -0
- package/src/ConversationLayout.tsx +33 -2
- package/src/DialogShell.mdx +8 -2
- package/src/DialogShell.stories.tsx +20 -7
- package/src/DialogShell.tsx +10 -4
- package/src/ListColumn.mdx +1 -0
- package/src/ListColumn.stories.tsx +53 -1
- package/src/ListColumn.tsx +10 -2
- package/src/ListTable.mdx +112 -0
- package/src/ListTable.stories.tsx +133 -0
- package/src/ListTable.test.tsx +81 -0
- package/src/ListTable.tsx +178 -0
- package/src/MembersDialog.test.tsx +8 -0
- package/src/MembersDialog.tsx +2 -10
- package/src/NavTree.mdx +7 -1
- package/src/NavTree.stories.tsx +75 -1
- package/src/NavTree.test.tsx +18 -0
- package/src/NavTree.tsx +23 -34
- package/src/PageHeader.mdx +13 -2
- package/src/PageHeader.stories.tsx +35 -1
- package/src/PageHeader.test.tsx +21 -0
- package/src/PageHeader.tsx +17 -5
- package/src/conversationScroll.ts +11 -0
- package/src/index.ts +2 -0
- package/src/registry/registry.test.ts +5 -5
- package/src/revealCurrentRow.test.tsx +168 -0
- package/src/revealCurrentRow.ts +68 -0
- package/src/showInConversation.ts +9 -1
- package/stories/Choosing.mdx +2 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type RefObject } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Showing where the open page lives in a list: its row (`aria-current="page"`, what `NavItem`'s `active` sets) brought
|
|
4
|
+
* into the column's sight, once for each new current row, whenever it is drawn and shown (Katerina, 17 November: "the
|
|
5
|
+
* selected [row] could be somewhere above or below the fold … a general problem we need to fix").
|
|
6
|
+
*
|
|
7
|
+
* However late: a row a fold reads only once it opens, a group sliding open, rows that arrive with a read. The list is
|
|
8
|
+
* watched for what changes in it, not for its own draws, so a row drawn by a part inside it is seen too (a team's Files
|
|
9
|
+
* fold, which reads its files itself, never drew the tree again: its open file stayed below the fold).
|
|
10
|
+
*
|
|
11
|
+
* Once: a row brought into sight is not brought back after the reader scrolls away, while it stays the current one;
|
|
12
|
+
* a new current row is.
|
|
13
|
+
*/
|
|
14
|
+
/** How long it waits to look, after the list changes: a group above the row slides open in 150ms. */
|
|
15
|
+
export declare const REVEAL_MS = 200;
|
|
16
|
+
/**
|
|
17
|
+
* Scroll the column the row is in, and only that box — never the page, nor a
|
|
18
|
+
* drawer that is shut — so the row is in sight. A row in sight stays put.
|
|
19
|
+
* A group taller than the column keeps its top in sight, as the browser's
|
|
20
|
+
* `block: 'nearest'` does (a row is never that tall).
|
|
21
|
+
*/
|
|
22
|
+
export declare function scrollToRow(row: HTMLElement): void;
|
|
23
|
+
/**
|
|
24
|
+
* Brings the current row inside `box` into sight, once per current row. `current` names it when the caller knows it
|
|
25
|
+
* (`NavTree`'s `selected`); without it, the row is known by its link.
|
|
26
|
+
*/
|
|
27
|
+
export declare function useRevealCurrentRow(box: RefObject<HTMLElement | null>, current?: string): void;
|
|
28
|
+
//# sourceMappingURL=revealCurrentRow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"revealCurrentRow.d.ts","sourceRoot":"","sources":["../src/revealCurrentRow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAEzD;;;;;;;;;;;GAWG;AAEH,qGAAqG;AACrG,eAAO,MAAM,SAAS,MAAM,CAAA;AAE5B;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,WAAW,QAQ3C;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CA6B9F"}
|
|
@@ -21,6 +21,11 @@ export interface ShowWhenDrawnOptions extends ShowOptions {
|
|
|
21
21
|
* nothing, so the caller says it, or opens its thread and waits with `showInConversationWhenDrawn`.
|
|
22
22
|
*/
|
|
23
23
|
export declare function showInConversation(id: string, options?: ShowOptions): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Marks one drawn comment or reply a moment (`data-shown`, the kit's flash): a show's mark, and the one a
|
|
26
|
+
* `ConversationLayout` gives the comment it lands on when it opens at a thread. The package's own, not exported.
|
|
27
|
+
*/
|
|
28
|
+
export declare function markShown(el: HTMLElement): void;
|
|
24
29
|
/**
|
|
25
30
|
* The same, for one that may not be drawn yet: its thread was just asked to open, and the page draws it a moment
|
|
26
31
|
* later. Looks every 50ms, for 3 seconds (`wait`), and answers whether it was shown: `false` must be said, since
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"showInConversation.d.ts","sourceRoot":"","sources":["../src/showInConversation.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAoBH,MAAM,WAAW,WAAW;IAC1B,8GAA8G;IAC9G,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,MAAM,WAAW,oBAAqB,SAAQ,WAAW;IACvD,wEAAwE;IACxE,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAUD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,OAAO,CAGjF;
|
|
1
|
+
{"version":3,"file":"showInConversation.d.ts","sourceRoot":"","sources":["../src/showInConversation.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAoBH,MAAM,WAAW,WAAW;IAC1B,8GAA8G;IAC9G,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,MAAM,WAAW,oBAAqB,SAAQ,WAAW;IACvD,wEAAwE;IACxE,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAUD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,OAAO,CAGjF;AAWD;;;GAGG;AACH,wBAAgB,SAAS,CAAC,EAAE,EAAE,WAAW,GAAG,IAAI,CAW/C;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,IAAc,EAAE,GAAG,OAAO,EAAE,GAAE,oBAAyB,GAAG,OAAO,CAAC,OAAO,CAAC,CAYnI"}
|
package/package.json
CHANGED
package/registry.json
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
"kind": "package",
|
|
5
5
|
"repo": "estiva-ui",
|
|
6
6
|
"package": "@estiva-app/ui",
|
|
7
|
-
"packageVersion": "0.
|
|
8
|
-
"exports":
|
|
9
|
-
"typeExports":
|
|
7
|
+
"packageVersion": "0.119.0",
|
|
8
|
+
"exports": 256,
|
|
9
|
+
"typeExports": 270,
|
|
10
10
|
"files": null
|
|
11
11
|
},
|
|
12
12
|
"storybook": {
|
|
@@ -15,6 +15,92 @@
|
|
|
15
15
|
"devUrl": "http://localhost:6008"
|
|
16
16
|
},
|
|
17
17
|
"entries": [
|
|
18
|
+
{
|
|
19
|
+
"name": "ActivityLine",
|
|
20
|
+
"repo": "estiva-ui",
|
|
21
|
+
"kind": "component",
|
|
22
|
+
"importPath": "@estiva-app/ui",
|
|
23
|
+
"sourceFile": "src/ActivityLine.tsx",
|
|
24
|
+
"purpose": "One thing that happened, in a list of them: a mark for what kind of thing it is, who did it and what, when; under it where it was said and the words.",
|
|
25
|
+
"purposeFrom": "page",
|
|
26
|
+
"props": [
|
|
27
|
+
{
|
|
28
|
+
"name": "person",
|
|
29
|
+
"takes": "{ name: string; picture?: string; bot?: boolean }",
|
|
30
|
+
"required": true,
|
|
31
|
+
"note": "Who did it: their face and name."
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"name": "did",
|
|
35
|
+
"takes": "text",
|
|
36
|
+
"required": true,
|
|
37
|
+
"note": "What they did, after their name: \"replied to you\", \"reacted 👍 to your message\"."
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"name": "time",
|
|
41
|
+
"takes": "text",
|
|
42
|
+
"required": true,
|
|
43
|
+
"note": "When, short: \"2h\", \"Fri 14:02\". At the right of the first line, in a count's type."
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"name": "mark",
|
|
47
|
+
"takes": "anything",
|
|
48
|
+
"required": false,
|
|
49
|
+
"note": "What kind of thing it is, a 16px icon beside the first line: a reply, a mention, a reaction."
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"name": "where",
|
|
53
|
+
"takes": "text",
|
|
54
|
+
"required": false,
|
|
55
|
+
"note": "Where it was said, before the words: \"Design › Brief\"."
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"name": "words",
|
|
59
|
+
"takes": "text",
|
|
60
|
+
"required": false,
|
|
61
|
+
"note": "What they said, cut to one line."
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"name": "seen",
|
|
65
|
+
"takes": "true/false",
|
|
66
|
+
"required": false,
|
|
67
|
+
"note": "Seen already: the name in the secondary text, as an Earlier line."
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"name": "href",
|
|
71
|
+
"takes": "text",
|
|
72
|
+
"required": false,
|
|
73
|
+
"note": "Opens where it was said, as a link: Cmd- or Ctrl-click opens a new tab."
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"name": "onClick",
|
|
77
|
+
"takes": "a handler",
|
|
78
|
+
"required": false,
|
|
79
|
+
"note": null
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"name": "aria-label",
|
|
83
|
+
"takes": "text",
|
|
84
|
+
"required": false,
|
|
85
|
+
"note": null
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"name": "className",
|
|
89
|
+
"takes": "text",
|
|
90
|
+
"required": false,
|
|
91
|
+
"note": "Placement only."
|
|
92
|
+
}
|
|
93
|
+
],
|
|
94
|
+
"variants": [],
|
|
95
|
+
"ownsBehaviours": [],
|
|
96
|
+
"status": "stable",
|
|
97
|
+
"migrationStage": null,
|
|
98
|
+
"docsId": "conversation-activityline--docs",
|
|
99
|
+
"storyId": "conversation-activityline--default",
|
|
100
|
+
"docPage": "src/ActivityLine.mdx",
|
|
101
|
+
"app": null,
|
|
102
|
+
"looks": []
|
|
103
|
+
},
|
|
18
104
|
{
|
|
19
105
|
"name": "AddReactionButton",
|
|
20
106
|
"repo": "estiva-ui",
|
|
@@ -1764,6 +1850,12 @@
|
|
|
1764
1850
|
"required": false,
|
|
1765
1851
|
"note": "Beside the title and always visible, before the actions — a count."
|
|
1766
1852
|
},
|
|
1853
|
+
{
|
|
1854
|
+
"name": "count",
|
|
1855
|
+
"takes": "number",
|
|
1856
|
+
"required": false,
|
|
1857
|
+
"note": "How many rows it holds, 8px after the title, shown open or shut — `SectionHeader`'s."
|
|
1858
|
+
},
|
|
1767
1859
|
{
|
|
1768
1860
|
"name": "actions",
|
|
1769
1861
|
"takes": "SectionAction[]",
|
|
@@ -2650,6 +2742,12 @@
|
|
|
2650
2742
|
"required": false,
|
|
2651
2743
|
"note": "The column's own buttons, at the right edge: IconButtons with tooltips, 4px apart."
|
|
2652
2744
|
},
|
|
2745
|
+
{
|
|
2746
|
+
"name": "back",
|
|
2747
|
+
"takes": "a handler",
|
|
2748
|
+
"required": false,
|
|
2749
|
+
"note": "A way back to the layer before, an arrow before the title, 8px from it — a dialog's Add members back to its list."
|
|
2750
|
+
},
|
|
2653
2751
|
{
|
|
2654
2752
|
"name": "className",
|
|
2655
2753
|
"takes": "text",
|
|
@@ -3534,7 +3632,13 @@
|
|
|
3534
3632
|
"name": "headerContent",
|
|
3535
3633
|
"takes": "anything",
|
|
3536
3634
|
"required": false,
|
|
3537
|
-
"note": "Replaces the title text in the header — a
|
|
3635
|
+
"note": "Replaces the title text in the header — a count chip after it."
|
|
3636
|
+
},
|
|
3637
|
+
{
|
|
3638
|
+
"name": "back",
|
|
3639
|
+
"takes": "a handler",
|
|
3640
|
+
"required": false,
|
|
3641
|
+
"note": "A way back to the layer before — an Add layer back to its list: an arrow before the title, the bar's own, whole (it was the dialog's own button pulled 8px out of the bar's box, its fill and ring cut off; Katerina, 16 November)."
|
|
3538
3642
|
},
|
|
3539
3643
|
{
|
|
3540
3644
|
"name": "footer",
|
|
@@ -6622,6 +6726,132 @@
|
|
|
6622
6726
|
"app": null,
|
|
6623
6727
|
"looks": []
|
|
6624
6728
|
},
|
|
6729
|
+
{
|
|
6730
|
+
"name": "ListTable",
|
|
6731
|
+
"repo": "estiva-ui",
|
|
6732
|
+
"kind": "component",
|
|
6733
|
+
"importPath": "@estiva-app/ui",
|
|
6734
|
+
"sourceFile": "src/ListTable.tsx",
|
|
6735
|
+
"purpose": "A list of things on a page, under column headings: each row leads to its thing, a few short facts in columns, and an action at its end.",
|
|
6736
|
+
"purposeFrom": "page",
|
|
6737
|
+
"props": [
|
|
6738
|
+
{
|
|
6739
|
+
"name": "aria-label",
|
|
6740
|
+
"takes": "text",
|
|
6741
|
+
"required": true,
|
|
6742
|
+
"note": "What the list is, to assistive technology: \"Initiatives\"."
|
|
6743
|
+
},
|
|
6744
|
+
{
|
|
6745
|
+
"name": "nameLabel",
|
|
6746
|
+
"takes": "text",
|
|
6747
|
+
"required": false,
|
|
6748
|
+
"note": "The first column's heading. Default \"Name\"."
|
|
6749
|
+
},
|
|
6750
|
+
{
|
|
6751
|
+
"name": "columns",
|
|
6752
|
+
"takes": "ListTableColumn[]",
|
|
6753
|
+
"required": true,
|
|
6754
|
+
"note": "The columns after the name, in their order."
|
|
6755
|
+
},
|
|
6756
|
+
{
|
|
6757
|
+
"name": "end",
|
|
6758
|
+
"takes": "true/false",
|
|
6759
|
+
"required": false,
|
|
6760
|
+
"note": "The rows hold something at their end — a small `Button`, a dot and a ⋮ — and the list keeps 64px for it."
|
|
6761
|
+
},
|
|
6762
|
+
{
|
|
6763
|
+
"name": "headings",
|
|
6764
|
+
"takes": "true/false",
|
|
6765
|
+
"required": false,
|
|
6766
|
+
"note": "The column headings on screen. Default true."
|
|
6767
|
+
},
|
|
6768
|
+
{
|
|
6769
|
+
"name": "children",
|
|
6770
|
+
"takes": "anything",
|
|
6771
|
+
"required": true,
|
|
6772
|
+
"note": "The rows: `ListTableRow`s."
|
|
6773
|
+
},
|
|
6774
|
+
{
|
|
6775
|
+
"name": "className",
|
|
6776
|
+
"takes": "text",
|
|
6777
|
+
"required": false,
|
|
6778
|
+
"note": "Placement only."
|
|
6779
|
+
}
|
|
6780
|
+
],
|
|
6781
|
+
"variants": [],
|
|
6782
|
+
"ownsBehaviours": [],
|
|
6783
|
+
"status": "stable",
|
|
6784
|
+
"migrationStage": null,
|
|
6785
|
+
"docsId": "page-structure-listtable--docs",
|
|
6786
|
+
"storyId": "page-structure-listtable--default",
|
|
6787
|
+
"docPage": "src/ListTable.mdx",
|
|
6788
|
+
"app": null,
|
|
6789
|
+
"looks": []
|
|
6790
|
+
},
|
|
6791
|
+
{
|
|
6792
|
+
"name": "ListTableRow",
|
|
6793
|
+
"repo": "estiva-ui",
|
|
6794
|
+
"kind": "component",
|
|
6795
|
+
"importPath": "@estiva-app/ui",
|
|
6796
|
+
"sourceFile": "src/ListTable.tsx",
|
|
6797
|
+
"purpose": "One row of a `ListTable`: the whole row leads to its thing; its end stays its own control.",
|
|
6798
|
+
"purposeFrom": "comment",
|
|
6799
|
+
"props": [
|
|
6800
|
+
{
|
|
6801
|
+
"name": "href",
|
|
6802
|
+
"takes": "text",
|
|
6803
|
+
"required": true,
|
|
6804
|
+
"note": "Where the row leads. The whole row is the link."
|
|
6805
|
+
},
|
|
6806
|
+
{
|
|
6807
|
+
"name": "label",
|
|
6808
|
+
"takes": "text",
|
|
6809
|
+
"required": true,
|
|
6810
|
+
"note": "Its name, one line, cut short with an ellipsis."
|
|
6811
|
+
},
|
|
6812
|
+
{
|
|
6813
|
+
"name": "description",
|
|
6814
|
+
"takes": "text",
|
|
6815
|
+
"required": false,
|
|
6816
|
+
"note": "Under the name, one line, cut short: what it is about."
|
|
6817
|
+
},
|
|
6818
|
+
{
|
|
6819
|
+
"name": "icon",
|
|
6820
|
+
"takes": "anything",
|
|
6821
|
+
"required": false,
|
|
6822
|
+
"note": "16px, before the name: its kind."
|
|
6823
|
+
},
|
|
6824
|
+
{
|
|
6825
|
+
"name": "cells",
|
|
6826
|
+
"takes": "anything",
|
|
6827
|
+
"required": true,
|
|
6828
|
+
"note": "One per column, in the columns' order: words, or a part (`AvatarGroup`, `MetaText`)."
|
|
6829
|
+
},
|
|
6830
|
+
{
|
|
6831
|
+
"name": "end",
|
|
6832
|
+
"takes": "anything",
|
|
6833
|
+
"required": false,
|
|
6834
|
+
"note": "At the row's end, its own control: a small `Button` (Join), or the row's dot and ⋮."
|
|
6835
|
+
},
|
|
6836
|
+
{
|
|
6837
|
+
"name": "onClick",
|
|
6838
|
+
"takes": "a handler",
|
|
6839
|
+
"required": false,
|
|
6840
|
+
"note": null
|
|
6841
|
+
}
|
|
6842
|
+
],
|
|
6843
|
+
"variants": [],
|
|
6844
|
+
"ownsBehaviours": [],
|
|
6845
|
+
"status": "stable",
|
|
6846
|
+
"migrationStage": null,
|
|
6847
|
+
"docsId": "page-structure-listtable--docs",
|
|
6848
|
+
"storyId": "page-structure-listtable--default",
|
|
6849
|
+
"docPage": null,
|
|
6850
|
+
"app": null,
|
|
6851
|
+
"looks": [
|
|
6852
|
+
"truncate text-body-2 font-medium text-text-primary"
|
|
6853
|
+
]
|
|
6854
|
+
},
|
|
6625
6855
|
{
|
|
6626
6856
|
"name": "loadingShapeOf",
|
|
6627
6857
|
"repo": "estiva-ui",
|
|
@@ -7869,6 +8099,12 @@
|
|
|
7869
8099
|
"required": false,
|
|
7870
8100
|
"note": "Beside the title, always shown: an `UnreadDot`, typically."
|
|
7871
8101
|
},
|
|
8102
|
+
{
|
|
8103
|
+
"name": "count",
|
|
8104
|
+
"takes": "number",
|
|
8105
|
+
"required": false,
|
|
8106
|
+
"note": "How many rows it holds, 8px after the title, shown open or shut — `SectionHeader`'s."
|
|
8107
|
+
},
|
|
7872
8108
|
{
|
|
7873
8109
|
"name": "actions",
|
|
7874
8110
|
"takes": "SectionAction[]",
|
|
@@ -7881,6 +8117,12 @@
|
|
|
7881
8117
|
"required": false,
|
|
7882
8118
|
"note": "The group's \"More options\" menu, after its actions: `MenuItem`s."
|
|
7883
8119
|
},
|
|
8120
|
+
{
|
|
8121
|
+
"name": "menuLabel",
|
|
8122
|
+
"takes": "text",
|
|
8123
|
+
"required": false,
|
|
8124
|
+
"note": "The ⋮'s accessible name, \"More for Group one\"."
|
|
8125
|
+
},
|
|
7884
8126
|
{
|
|
7885
8127
|
"name": "icon",
|
|
7886
8128
|
"takes": "anything",
|
|
@@ -8028,7 +8270,7 @@
|
|
|
8028
8270
|
"name": "after",
|
|
8029
8271
|
"takes": "anything",
|
|
8030
8272
|
"required": false,
|
|
8031
|
-
"note": "Right after the title, 8px from it, and never cut short: a small `Button`, a `Chip`."
|
|
8273
|
+
"note": "Right after the title, 8px from it, and never cut short: a small `Button`, a `Chip`, a `Link`."
|
|
8032
8274
|
},
|
|
8033
8275
|
{
|
|
8034
8276
|
"name": "meta",
|
|
@@ -8048,6 +8290,12 @@
|
|
|
8048
8290
|
"required": false,
|
|
8049
8291
|
"note": "Who is in it: a `MembersPill`."
|
|
8050
8292
|
},
|
|
8293
|
+
{
|
|
8294
|
+
"name": "button",
|
|
8295
|
+
"takes": "anything",
|
|
8296
|
+
"required": false,
|
|
8297
|
+
"note": "A button with words, before the page's buttons and 8px clear of them: Join, Add to Open work."
|
|
8298
|
+
},
|
|
8051
8299
|
{
|
|
8052
8300
|
"name": "actions",
|
|
8053
8301
|
"takes": "anything",
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Meta, Canvas, Controls } from '@storybook/addon-docs/blocks'
|
|
2
|
+
import * as ActivityLineStories from './ActivityLine.stories'
|
|
3
|
+
|
|
4
|
+
<Meta of={ActivityLineStories} />
|
|
5
|
+
|
|
6
|
+
# ActivityLine
|
|
7
|
+
|
|
8
|
+
One thing that happened, in a list of them: a mark for what kind of thing it is, who did it and what, when; under it where it was said and the words.
|
|
9
|
+
|
|
10
|
+
<Canvas of={ActivityLineStories.Default} />
|
|
11
|
+
|
|
12
|
+
## When
|
|
13
|
+
|
|
14
|
+
- A list of what happened, in a card, a popover or a page's dot: replies to
|
|
15
|
+
you, mentions, reactions to your messages.
|
|
16
|
+
- `mark`: what kind of thing it is, a 16px icon beside the first line — the
|
|
17
|
+
face and the name — never centred on both lines.
|
|
18
|
+
- `did`: what they did, after their name, in the app's words.
|
|
19
|
+
- `where`: the place it was said, before the words, on a list that mixes
|
|
20
|
+
places; absent on the place's own list.
|
|
21
|
+
- `seen`: an Earlier line — the name in the secondary text.
|
|
22
|
+
|
|
23
|
+
<Canvas of={ActivityLineStories.Seen} />
|
|
24
|
+
|
|
25
|
+
- `href`: it opens where it was said, as a link (Cmd- or Ctrl-click opens a
|
|
26
|
+
new tab). Absent, the line is a button and `onClick` acts.
|
|
27
|
+
- New and Earlier: each a **MenuSection** of lines, so the headings and the
|
|
28
|
+
lines start on one edge.
|
|
29
|
+
|
|
30
|
+
<Canvas of={ActivityLineStories.AList} />
|
|
31
|
+
|
|
32
|
+
## When not
|
|
33
|
+
|
|
34
|
+
- An action in a menu → **MenuItem**.
|
|
35
|
+
- The message itself, with its replies and reactions → **ConversationCard**.
|
|
36
|
+
- A row in a sidebar that leads to a place → **NavItem**.
|
|
37
|
+
|
|
38
|
+
## How
|
|
39
|
+
|
|
40
|
+
```tsx
|
|
41
|
+
import { ActivityLine } from '@estiva-app/ui'
|
|
42
|
+
|
|
43
|
+
<ActivityLine
|
|
44
|
+
person={{ name: person.name, picture: person.picture }}
|
|
45
|
+
did="replied to you"
|
|
46
|
+
time="2h"
|
|
47
|
+
mark={<IconArrowBackUp size={16} stroke={1.5} />}
|
|
48
|
+
where="Group one › Item one"
|
|
49
|
+
words={message.preview}
|
|
50
|
+
href={message.href}
|
|
51
|
+
/>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
- It is a menu row's look: a fill under the pointer and no edge, 8px
|
|
55
|
+
corners, 36px at the least. Write no card, edge or padding around a line.
|
|
56
|
+
- Its words have their sizes: the name `body-2-strong`, what they did
|
|
57
|
+
`body-2`, the time in a count's type, the second line `caption`. Write no
|
|
58
|
+
type of your own.
|
|
59
|
+
- `data-*` marks pass to the row, for the app's tests.
|
|
60
|
+
|
|
61
|
+
## What it owns
|
|
62
|
+
|
|
63
|
+
Nothing. It only draws. Clicks and keys are yours.
|
|
64
|
+
|
|
65
|
+
## Props
|
|
66
|
+
|
|
67
|
+
<Controls of={ActivityLineStories.Default} />
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite'
|
|
2
|
+
import { IconArrowBackUp, IconAt, IconMoodSmile } from '@tabler/icons-react'
|
|
3
|
+
import { ActivityLine } from './ActivityLine'
|
|
4
|
+
import { MenuSection } from './Menu'
|
|
5
|
+
|
|
6
|
+
const mark = { reply: <IconArrowBackUp size={16} stroke={1.5} />, mention: <IconAt size={16} stroke={1.5} className="text-accent-text" />, reaction: <IconMoodSmile size={16} stroke={1.5} /> }
|
|
7
|
+
|
|
8
|
+
const meta = {
|
|
9
|
+
title: 'Conversation/ActivityLine',
|
|
10
|
+
component: ActivityLine,
|
|
11
|
+
args: { person: { name: 'Ana Duarte' }, did: 'replied to you', time: '2h', mark: mark.reply, where: 'Group one › Item one', words: 'The words someone wrote, cut to one line when there is no more room for them.' },
|
|
12
|
+
argTypes: { mark: { control: false }, person: { control: false } },
|
|
13
|
+
// A line sits in a list as wide as a card or a popover.
|
|
14
|
+
render: (args) => (
|
|
15
|
+
<div className="flex w-80 flex-col gap-0.5 rounded-lg bg-bg-elevated p-1">
|
|
16
|
+
<ActivityLine {...args} />
|
|
17
|
+
</div>
|
|
18
|
+
),
|
|
19
|
+
} satisfies Meta<typeof ActivityLine>
|
|
20
|
+
|
|
21
|
+
export default meta
|
|
22
|
+
type Story = StoryObj<typeof meta>
|
|
23
|
+
|
|
24
|
+
/** One line: the mark beside the first line, who and what, when; under it where and the words. Point at it: a fill, no edge. */
|
|
25
|
+
export const Default: Story = {}
|
|
26
|
+
|
|
27
|
+
/** Seen already, as an Earlier line: the name in the secondary text. */
|
|
28
|
+
export const Seen: Story = { args: { seen: true } }
|
|
29
|
+
|
|
30
|
+
/** Only the words, with no place named: a line on the place's own list. */
|
|
31
|
+
export const NoPlace: Story = { args: { where: undefined } }
|
|
32
|
+
|
|
33
|
+
/** A link: Cmd- or Ctrl-click opens a new tab. */
|
|
34
|
+
export const AsALink: Story = { args: { href: '#' } }
|
|
35
|
+
|
|
36
|
+
/** New and Earlier, each a menu section of lines, headings and lines on one edge, as a page's dot lists them. */
|
|
37
|
+
export const AList: Story = {
|
|
38
|
+
render: () => (
|
|
39
|
+
<div className="flex w-80 flex-col gap-1 rounded-lg bg-bg-elevated p-1">
|
|
40
|
+
<MenuSection label="New">
|
|
41
|
+
<ActivityLine person={{ name: 'Ana Duarte' }} did="mentioned you" time="5m" mark={mark.mention} words="Can you look at this before Friday?" />
|
|
42
|
+
<ActivityLine person={{ name: 'Ravi Mehta' }} did="reacted 👍 to your message" time="1h" mark={mark.reaction} words="Item two is ready." />
|
|
43
|
+
</MenuSection>
|
|
44
|
+
<MenuSection label="Earlier">
|
|
45
|
+
<ActivityLine person={{ name: 'Marta Silva' }} did="replied to you" time="Fri" mark={mark.reply} words="Agreed, let’s keep it." seen />
|
|
46
|
+
</MenuSection>
|
|
47
|
+
</div>
|
|
48
|
+
),
|
|
49
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
/**
|
|
3
|
+
* What the page claims: who, what they did and when on the first line, where and the words under it; a link with an
|
|
4
|
+
* `href`, a button without; the app's `data-*` marks on the row; a menu row's look, with no edge of its own.
|
|
5
|
+
*/
|
|
6
|
+
import { afterEach, describe, expect, it, vi } from 'vitest'
|
|
7
|
+
import { cleanup, render, screen } from '@testing-library/react'
|
|
8
|
+
import userEvent from '@testing-library/user-event'
|
|
9
|
+
import { ActivityLine } from './ActivityLine'
|
|
10
|
+
|
|
11
|
+
afterEach(cleanup)
|
|
12
|
+
|
|
13
|
+
const line = { person: { name: 'Ana Duarte' }, did: 'replied to you', time: '2h', where: 'Group one › Item one', words: 'The words.' }
|
|
14
|
+
|
|
15
|
+
describe('ActivityLine', () => {
|
|
16
|
+
it('says who, what they did and when, then where and the words, each in its own words', () => {
|
|
17
|
+
render(<ActivityLine {...line} />)
|
|
18
|
+
expect(screen.getByText('Ana Duarte')).toBeTruthy()
|
|
19
|
+
expect(screen.getByText('replied to you')).toBeTruthy()
|
|
20
|
+
expect(screen.getByText('2h')).toBeTruthy()
|
|
21
|
+
expect(screen.getByText('Group one › Item one ·')).toBeTruthy()
|
|
22
|
+
expect(screen.getByText('The words.')).toBeTruthy()
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
it('is a link with an href, and carries the app’s marks', () => {
|
|
26
|
+
render(<ActivityLine {...line} href="/somewhere" data-reaction="" data-seen />)
|
|
27
|
+
const row = screen.getByText('replied to you').closest('a')
|
|
28
|
+
expect(row?.getAttribute('href')).toBe('/somewhere')
|
|
29
|
+
expect(row?.hasAttribute('data-reaction')).toBe(true)
|
|
30
|
+
expect(row?.hasAttribute('data-seen')).toBe(true)
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
it('is a button without one, and a press reaches onClick', async () => {
|
|
34
|
+
const onClick = vi.fn()
|
|
35
|
+
render(<ActivityLine {...line} onClick={onClick} />)
|
|
36
|
+
await userEvent.click(screen.getByRole('button'))
|
|
37
|
+
expect(onClick).toHaveBeenCalledOnce()
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
it('has a menu row’s look: a fill under the pointer, 8px corners, and no edge', () => {
|
|
41
|
+
render(<ActivityLine {...line} />)
|
|
42
|
+
const row = screen.getByRole('button')
|
|
43
|
+
expect(row.className).toContain('hover:bg-bg-hover')
|
|
44
|
+
expect(row.className).toContain('rounded-lg')
|
|
45
|
+
expect(row.className).not.toMatch(/\bborder\b/)
|
|
46
|
+
})
|
|
47
|
+
})
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { MouseEvent, ReactNode } from 'react'
|
|
2
|
+
import { cn } from './cn'
|
|
3
|
+
import { Link } from './Link'
|
|
4
|
+
import { MenuItemBody, menuItemClassName } from './Menu'
|
|
5
|
+
import { MetaText } from './MetaText'
|
|
6
|
+
import { Person } from './Person'
|
|
7
|
+
|
|
8
|
+
export interface ActivityLineProps {
|
|
9
|
+
/** Who did it: their face and name. */
|
|
10
|
+
person: { name: string; picture?: string; bot?: boolean }
|
|
11
|
+
/** What they did, after their name: "replied to you", "reacted 👍 to your message". The app's words. */
|
|
12
|
+
did: string
|
|
13
|
+
/** When, short: "2h", "Fri 14:02". At the right of the first line, in a count's type. */
|
|
14
|
+
time: string
|
|
15
|
+
/** What kind of thing it is, a 16px icon beside the first line: a reply, a mention, a reaction. */
|
|
16
|
+
mark?: ReactNode
|
|
17
|
+
/** Where it was said, before the words: "Design › Brief". */
|
|
18
|
+
where?: string
|
|
19
|
+
/** What they said, cut to one line. */
|
|
20
|
+
words?: string
|
|
21
|
+
/** Seen already: the name in the secondary text, as an Earlier line. Default: new, in the primary text. */
|
|
22
|
+
seen?: boolean
|
|
23
|
+
/** Opens where it was said, as a link: Cmd- or Ctrl-click opens a new tab. Absent, the line is a button. */
|
|
24
|
+
href?: string
|
|
25
|
+
onClick?: (event: MouseEvent<HTMLElement>) => void
|
|
26
|
+
'aria-label'?: string
|
|
27
|
+
/** Placement only. */
|
|
28
|
+
className?: string
|
|
29
|
+
/** Marks for the app's own tests and photo runs: `data-reaction`, `data-seen`. */
|
|
30
|
+
[data: `data-${string}`]: string | boolean | undefined
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* One thing that happened, in a list of them: a mark for what kind of thing it is, who did it and what, when; under
|
|
35
|
+
* it where it was said and the words. A menu row's look: a fill under the pointer and no edge, 8px corners, the mark
|
|
36
|
+
* beside the first line. Peek drew it twice by hand, as a card with an edge that showed on hover (its lit row's card)
|
|
37
|
+
* and inside a menu row (the navigation prototype's dot), five boxes with their own type each (Katerina, 16 November).
|
|
38
|
+
*/
|
|
39
|
+
export function ActivityLine({ person, did, time, mark, where, words, seen = false, href, onClick, className, ...rest }: ActivityLineProps) {
|
|
40
|
+
const body = (
|
|
41
|
+
<MenuItemBody leading={mark} leadingAt="top">
|
|
42
|
+
<span className="flex min-w-0 flex-1 flex-col gap-0.5">
|
|
43
|
+
<span className="flex min-w-0 items-center gap-1.5">
|
|
44
|
+
<span className={cn('flex min-w-0 shrink-0 text-body-2-strong', seen ? 'text-text-secondary' : 'text-text-primary')}>
|
|
45
|
+
<Person size={16} name={person.name} {...(person.picture ? { picture: person.picture } : {})} {...(person.bot ? { bot: true } : {})} />
|
|
46
|
+
</span>
|
|
47
|
+
<span className="min-w-0 truncate text-body-2 text-text-secondary">{did}</span>
|
|
48
|
+
<MetaText size="chip" className="ml-auto shrink-0">
|
|
49
|
+
{time}
|
|
50
|
+
</MetaText>
|
|
51
|
+
</span>
|
|
52
|
+
{(where || words) && (
|
|
53
|
+
<span className="truncate text-caption text-text-muted">
|
|
54
|
+
{where && <span className="text-text-secondary">{`${where}${words ? ' · ' : ''}`}</span>}
|
|
55
|
+
{words}
|
|
56
|
+
</span>
|
|
57
|
+
)}
|
|
58
|
+
</span>
|
|
59
|
+
</MenuItemBody>
|
|
60
|
+
)
|
|
61
|
+
const row = menuItemClassName({ size: 'default', className })
|
|
62
|
+
if (href) {
|
|
63
|
+
return (
|
|
64
|
+
<Link href={href} variant="plain" className={row} {...(onClick ? { onClick } : {})} {...rest}>
|
|
65
|
+
{body}
|
|
66
|
+
</Link>
|
|
67
|
+
)
|
|
68
|
+
}
|
|
69
|
+
return (
|
|
70
|
+
<button type="button" className={row} {...(onClick ? { onClick } : {})} {...rest}>
|
|
71
|
+
{body}
|
|
72
|
+
</button>
|
|
73
|
+
)
|
|
74
|
+
}
|
package/src/Button.mdx
CHANGED
|
@@ -18,6 +18,11 @@ The push-button for an action: a verb, clicked once — "Create", "Save",
|
|
|
18
18
|
both of those are.
|
|
19
19
|
- **`outlined`** — a real alternative standing beside the primary ("Cancel"
|
|
20
20
|
next to "Save"), or a lone action that needs an edge to be found at all.
|
|
21
|
+
- **One action, two weights, by where it is**: on each row of a list it is
|
|
22
|
+
`outlined`, since many are on screen; on the page of one thing, where it
|
|
23
|
+
is what the page is for, `primary`. Join is outlined on the rows of a list
|
|
24
|
+
of places and primary on the header of a place you are not in (Katerina,
|
|
25
|
+
16 November).
|
|
21
26
|
- **`muted`** — the default, and most buttons. Anything that should not
|
|
22
27
|
compete for attention: dialog dismissals, secondary page actions.
|
|
23
28
|
- **`destructive`** — "Delete …" and its kind: the muted button in the
|
|
@@ -36,6 +36,12 @@ toggle, and the rows under it, sliding shut and open.
|
|
|
36
36
|
yet drawn: on a section already showing its rows, `pending` shuts them
|
|
37
37
|
until it is false. The tests pin the state (open, busy, rows hidden); the
|
|
38
38
|
single slide is Chrome's to show, measured in Peek (OPT-11).
|
|
39
|
+
- `count` for how many rows it holds, 8px after the title, shown open or
|
|
40
|
+
shut — SectionHeader's. Never written into the title ("Group · 2"): there
|
|
41
|
+
it takes the heading's type, not a count's.
|
|
42
|
+
|
|
43
|
+
<Canvas of={CollapsibleSectionStories.WithCount} />
|
|
44
|
+
|
|
39
45
|
- `actions` for add, sort, filter beside the title — SectionHeader's,
|
|
40
46
|
revealed while the row is hovered or keyboard-focused.
|
|
41
47
|
- `look="row"` when the section is a row among rows — a folder in a
|
|
@@ -35,7 +35,10 @@ export const WithActions: Story = {
|
|
|
35
35
|
args: { actions: [{ icon: <IconPlus size={16} stroke={1.5} />, tooltip: 'Add', onClick: () => {} }] },
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
/**
|
|
38
|
+
/** How many rows it holds, 8px after the title, in a row's count style, open or shut. */
|
|
39
|
+
export const WithCount: Story = { args: { title: 'Group', count: 2, defaultOpen: false } }
|
|
40
|
+
|
|
41
|
+
/** Something at the row's end, held on screen whether the section is open or closed. */
|
|
39
42
|
export const WithTrailing: Story = {
|
|
40
43
|
args: { trailing: <Chip type="brand" label="2" /> },
|
|
41
44
|
}
|