@estiva-app/ui 0.116.0 โ 0.118.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/DialogShell.d.ts +11 -3
- package/dist/DialogShell.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 +1 -0
- package/dist/MembersDialog.d.ts.map +1 -1
- package/dist/Menu.d.ts +9 -2
- package/dist/Menu.d.ts.map +1 -1
- package/dist/NavItem.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/SectionHeader.d.ts.map +1 -1
- package/dist/WhoFollowsDialog.d.ts +12 -2
- package/dist/WhoFollowsDialog.d.ts.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +816 -671
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
- package/registry.json +272 -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/DialogShell.mdx +8 -2
- package/src/DialogShell.stories.tsx +20 -7
- package/src/DialogShell.tsx +10 -4
- package/src/FollowSwitch.test.tsx +6 -4
- 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 +3 -11
- package/src/Menu.mdx +3 -0
- package/src/Menu.stories.tsx +23 -0
- package/src/Menu.tsx +13 -3
- package/src/NavItem.mdx +2 -0
- package/src/NavItem.tsx +5 -1
- package/src/NavTree.mdx +6 -0
- package/src/NavTree.stories.tsx +14 -0
- package/src/NavTree.test.tsx +18 -0
- package/src/NavTree.tsx +16 -1
- 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/SectionHeader.mdx +2 -0
- package/src/SectionHeader.test.tsx +16 -0
- package/src/SectionHeader.tsx +4 -2
- package/src/WhoFollowsDialog.mdx +2 -0
- package/src/WhoFollowsDialog.stories.tsx +19 -0
- package/src/WhoFollowsDialog.test.tsx +40 -0
- package/src/WhoFollowsDialog.tsx +66 -10
- package/src/index.ts +2 -0
- package/src/registry/registry.test.ts +5 -5
- package/stories/Choosing.mdx +2 -0
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.118.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",
|
|
@@ -7079,6 +7309,12 @@
|
|
|
7079
7309
|
"required": false,
|
|
7080
7310
|
"note": "Before the label: a 16px icon (stroke 1.5, secondary), or an Avatar, for rows led by a face."
|
|
7081
7311
|
},
|
|
7312
|
+
{
|
|
7313
|
+
"name": "leadingAt",
|
|
7314
|
+
"takes": "center | top",
|
|
7315
|
+
"required": false,
|
|
7316
|
+
"note": "Where `leading` sits on a row of two lines: beside the first line, or centred on the whole row."
|
|
7317
|
+
},
|
|
7082
7318
|
{
|
|
7083
7319
|
"name": "trailing",
|
|
7084
7320
|
"takes": "anything",
|
|
@@ -7129,6 +7365,13 @@
|
|
|
7129
7365
|
"default",
|
|
7130
7366
|
"tall"
|
|
7131
7367
|
]
|
|
7368
|
+
},
|
|
7369
|
+
{
|
|
7370
|
+
"prop": "leadingAt",
|
|
7371
|
+
"values": [
|
|
7372
|
+
"center",
|
|
7373
|
+
"top"
|
|
7374
|
+
]
|
|
7132
7375
|
}
|
|
7133
7376
|
],
|
|
7134
7377
|
"ownsBehaviours": [
|
|
@@ -7856,6 +8099,12 @@
|
|
|
7856
8099
|
"required": false,
|
|
7857
8100
|
"note": "Beside the title, always shown: an `UnreadDot`, typically."
|
|
7858
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
|
+
},
|
|
7859
8108
|
{
|
|
7860
8109
|
"name": "actions",
|
|
7861
8110
|
"takes": "SectionAction[]",
|
|
@@ -7868,6 +8117,12 @@
|
|
|
7868
8117
|
"required": false,
|
|
7869
8118
|
"note": "The group's \"More options\" menu, after its actions: `MenuItem`s."
|
|
7870
8119
|
},
|
|
8120
|
+
{
|
|
8121
|
+
"name": "menuLabel",
|
|
8122
|
+
"takes": "text",
|
|
8123
|
+
"required": false,
|
|
8124
|
+
"note": "The โฎ's accessible name, \"More for Group one\"."
|
|
8125
|
+
},
|
|
7871
8126
|
{
|
|
7872
8127
|
"name": "icon",
|
|
7873
8128
|
"takes": "anything",
|
|
@@ -8015,7 +8270,7 @@
|
|
|
8015
8270
|
"name": "after",
|
|
8016
8271
|
"takes": "anything",
|
|
8017
8272
|
"required": false,
|
|
8018
|
-
"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`."
|
|
8019
8274
|
},
|
|
8020
8275
|
{
|
|
8021
8276
|
"name": "meta",
|
|
@@ -8035,6 +8290,12 @@
|
|
|
8035
8290
|
"required": false,
|
|
8036
8291
|
"note": "Who is in it: a `MembersPill`."
|
|
8037
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
|
+
},
|
|
8038
8299
|
{
|
|
8039
8300
|
"name": "actions",
|
|
8040
8301
|
"takes": "anything",
|
|
@@ -12691,6 +12952,12 @@
|
|
|
12691
12952
|
"required": false,
|
|
12692
12953
|
"note": "Adds the people chosen. With it, the \"Add someone\" row shows and opens the same add layer as `MembersDialog`'s."
|
|
12693
12954
|
},
|
|
12955
|
+
{
|
|
12956
|
+
"name": "self",
|
|
12957
|
+
"takes": "a handler",
|
|
12958
|
+
"required": false,
|
|
12959
|
+
"note": "The viewer's own Join or Leave, as `MembersDialog`'s: Leave on their own row, which comes first in its group; with no row of their own (not in it, or in it at no level shown here), Join or Leave on top, beside \"Add someone\"."
|
|
12960
|
+
},
|
|
12694
12961
|
{
|
|
12695
12962
|
"name": "initialView",
|
|
12696
12963
|
"takes": "list | add",
|
|
@@ -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
|
}
|
|
@@ -46,6 +46,17 @@ describe('CollapsibleSection', () => {
|
|
|
46
46
|
expect(title().getAttribute('aria-expanded')).toBe('true')
|
|
47
47
|
})
|
|
48
48
|
|
|
49
|
+
it('shows its count beside the title, shut as well as open, in the count style rather than the title', () => {
|
|
50
|
+
render(
|
|
51
|
+
<CollapsibleSection title="Section" count={2} defaultOpen={false}>
|
|
52
|
+
{rows}
|
|
53
|
+
</CollapsibleSection>,
|
|
54
|
+
)
|
|
55
|
+
const count = screen.getByText('2')
|
|
56
|
+
expect(screen.getByText('Section').textContent).toBe('Section')
|
|
57
|
+
expect(count.className).not.toBe(screen.getByText('Section').className)
|
|
58
|
+
})
|
|
59
|
+
|
|
49
60
|
it('starts closed with defaultOpen false', () => {
|
|
50
61
|
render(<CollapsibleSection title="Section" defaultOpen={false}>{rows}</CollapsibleSection>)
|
|
51
62
|
expect(title().getAttribute('aria-expanded')).toBe('false')
|