@estiva-app/ui 0.75.0 → 0.77.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/Button.d.ts +5 -0
- package/dist/Button.d.ts.map +1 -1
- package/dist/CommentBox.d.ts +119 -0
- package/dist/CommentBox.d.ts.map +1 -0
- package/dist/ComposeBox.d.ts +2 -0
- package/dist/ComposeBox.d.ts.map +1 -1
- package/dist/EmptyState.d.ts +2 -4
- package/dist/EmptyState.d.ts.map +1 -1
- package/dist/EntryShell.d.ts +50 -0
- package/dist/EntryShell.d.ts.map +1 -0
- package/dist/ReactionRow.d.ts +44 -0
- package/dist/ReactionRow.d.ts.map +1 -0
- package/dist/editor.d.ts +1 -0
- package/dist/editor.d.ts.map +1 -1
- package/dist/editor.js +2340 -2043
- package/dist/editor.js.map +4 -4
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +402 -324
- package/dist/index.js.map +4 -4
- package/package.json +6 -2
- package/registry.json +375 -4
- package/src/Button.tsx +6 -0
- package/src/CommentBox.mdx +83 -0
- package/src/CommentBox.stories.tsx +218 -0
- package/src/CommentBox.test.tsx +265 -0
- package/src/CommentBox.tsx +472 -0
- package/src/ComposeBox.tsx +5 -4
- package/src/EmptyState.tsx +2 -2
- package/src/EntryShell.mdx +69 -0
- package/src/EntryShell.stories.tsx +48 -0
- package/src/EntryShell.test.tsx +69 -0
- package/src/EntryShell.tsx +76 -0
- package/src/ReactionRow.mdx +50 -0
- package/src/ReactionRow.stories.tsx +91 -0
- package/src/ReactionRow.test.tsx +68 -0
- package/src/ReactionRow.tsx +118 -0
- package/src/editor.ts +11 -0
- package/src/index.ts +3 -1
- package/src/registry/registry.test.ts +5 -5
- package/stories/Choosing.mdx +4 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@estiva-app/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.77.0",
|
|
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",
|
|
@@ -92,7 +92,8 @@
|
|
|
92
92
|
"@tiptap/pm": "^3.22.1",
|
|
93
93
|
"@tiptap/react": "^3.22.1",
|
|
94
94
|
"@tiptap/suggestion": "^3.22.1",
|
|
95
|
-
"@tiptap/extension-code-block-lowlight": "^3.22.1"
|
|
95
|
+
"@tiptap/extension-code-block-lowlight": "^3.22.1",
|
|
96
|
+
"@tiptap/starter-kit": "^3.22.1"
|
|
96
97
|
},
|
|
97
98
|
"peerDependenciesMeta": {
|
|
98
99
|
"eslint": {
|
|
@@ -121,6 +122,9 @@
|
|
|
121
122
|
},
|
|
122
123
|
"@tiptap/extension-code-block-lowlight": {
|
|
123
124
|
"optional": true
|
|
125
|
+
},
|
|
126
|
+
"@tiptap/starter-kit": {
|
|
127
|
+
"optional": true
|
|
124
128
|
}
|
|
125
129
|
},
|
|
126
130
|
"devDependencies": {
|
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.77.0",
|
|
8
|
+
"exports": 203,
|
|
9
|
+
"typeExports": 197,
|
|
10
10
|
"files": null
|
|
11
11
|
},
|
|
12
12
|
"storybook": {
|
|
@@ -15,6 +15,65 @@
|
|
|
15
15
|
"devUrl": "http://localhost:6008"
|
|
16
16
|
},
|
|
17
17
|
"entries": [
|
|
18
|
+
{
|
|
19
|
+
"name": "AddReactionButton",
|
|
20
|
+
"repo": "estiva-ui",
|
|
21
|
+
"kind": "component",
|
|
22
|
+
"importPath": "@estiva-app/ui",
|
|
23
|
+
"sourceFile": "src/ReactionRow.tsx",
|
|
24
|
+
"purpose": "The add button: `ReactionPicker` opens over it.",
|
|
25
|
+
"purposeFrom": "comment",
|
|
26
|
+
"props": [
|
|
27
|
+
{
|
|
28
|
+
"name": "options",
|
|
29
|
+
"takes": "readonly ReactionOption[]",
|
|
30
|
+
"required": true,
|
|
31
|
+
"note": "The emoji offered, each named."
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"name": "onPick",
|
|
35
|
+
"takes": "a handler",
|
|
36
|
+
"required": true,
|
|
37
|
+
"note": null
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"name": "className",
|
|
41
|
+
"takes": "text",
|
|
42
|
+
"required": false,
|
|
43
|
+
"note": null
|
|
44
|
+
}
|
|
45
|
+
],
|
|
46
|
+
"variants": [],
|
|
47
|
+
"ownsBehaviours": [
|
|
48
|
+
{
|
|
49
|
+
"id": "portal",
|
|
50
|
+
"behaviour": "Floats on top of the page"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"id": "press-outside",
|
|
54
|
+
"behaviour": "Closes on a press outside"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"id": "page-keys",
|
|
58
|
+
"behaviour": "Takes its keys by itself"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"id": "focus",
|
|
62
|
+
"behaviour": "Holds focus inside while open, and gives it back"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"id": "follow",
|
|
66
|
+
"behaviour": "Stays attached to its anchor on scroll and resize"
|
|
67
|
+
}
|
|
68
|
+
],
|
|
69
|
+
"status": "stable",
|
|
70
|
+
"migrationStage": null,
|
|
71
|
+
"docsId": "primitives-reactionrow--docs",
|
|
72
|
+
"storyId": "primitives-reactionrow--default",
|
|
73
|
+
"docPage": null,
|
|
74
|
+
"app": null,
|
|
75
|
+
"looks": []
|
|
76
|
+
},
|
|
18
77
|
{
|
|
19
78
|
"name": "anchorOfSelection",
|
|
20
79
|
"repo": "estiva-ui",
|
|
@@ -1910,6 +1969,174 @@
|
|
|
1910
1969
|
"app": null,
|
|
1911
1970
|
"looks": []
|
|
1912
1971
|
},
|
|
1972
|
+
{
|
|
1973
|
+
"name": "CommentBox",
|
|
1974
|
+
"repo": "estiva-ui",
|
|
1975
|
+
"kind": "component",
|
|
1976
|
+
"importPath": "@estiva-app/ui/editor",
|
|
1977
|
+
"sourceFile": "src/CommentBox.tsx",
|
|
1978
|
+
"purpose": "The one box every app writes a comment, a reply and a line of a conversation in: `@`, `!@`, `[` and `/`, the keys, drafts, files, editing, sending and a refused send.",
|
|
1979
|
+
"purposeFrom": "page",
|
|
1980
|
+
"props": [
|
|
1981
|
+
{
|
|
1982
|
+
"name": "people",
|
|
1983
|
+
"takes": "readonly MentionPerson[]",
|
|
1984
|
+
"required": true,
|
|
1985
|
+
"note": "Who `@` and `!@` offer."
|
|
1986
|
+
},
|
|
1987
|
+
{
|
|
1988
|
+
"name": "references",
|
|
1989
|
+
"takes": "a handler",
|
|
1990
|
+
"required": false,
|
|
1991
|
+
"note": "What `[` lists for what was typed, already in the app's order."
|
|
1992
|
+
},
|
|
1993
|
+
{
|
|
1994
|
+
"name": "referencesChanged",
|
|
1995
|
+
"takes": "a handler",
|
|
1996
|
+
"required": false,
|
|
1997
|
+
"note": "Called with a listener while `[` is open; call it when `references` would answer differently (a search landed)."
|
|
1998
|
+
},
|
|
1999
|
+
{
|
|
2000
|
+
"name": "referenceIcon",
|
|
2001
|
+
"takes": "a handler",
|
|
2002
|
+
"required": false,
|
|
2003
|
+
"note": "A `[` row's and chip's 16px icon from what it points at; absent, a neutral square."
|
|
2004
|
+
},
|
|
2005
|
+
{
|
|
2006
|
+
"name": "insert",
|
|
2007
|
+
"takes": "readonly SlashCommand[]",
|
|
2008
|
+
"required": false,
|
|
2009
|
+
"note": "The app's own `/` Insert rows, after the shared Format section: {@link commentBoxRows} and its own."
|
|
2010
|
+
},
|
|
2011
|
+
{
|
|
2012
|
+
"name": "code",
|
|
2013
|
+
"takes": "CodeFormat",
|
|
2014
|
+
"required": false,
|
|
2015
|
+
"note": "`/` → Code: a mark inside the line, or a block."
|
|
2016
|
+
},
|
|
2017
|
+
{
|
|
2018
|
+
"name": "send",
|
|
2019
|
+
"takes": "a handler",
|
|
2020
|
+
"required": true,
|
|
2021
|
+
"note": "Send what is written, with the files that are ready; resolves with the relay's answer."
|
|
2022
|
+
},
|
|
2023
|
+
{
|
|
2024
|
+
"name": "showsAtOnce",
|
|
2025
|
+
"takes": "true/false",
|
|
2026
|
+
"required": false,
|
|
2027
|
+
"note": "The app shows a send before the relay answers: the box empties at once, and a refusal puts the words back."
|
|
2028
|
+
},
|
|
2029
|
+
{
|
|
2030
|
+
"name": "label",
|
|
2031
|
+
"takes": "text",
|
|
2032
|
+
"required": true,
|
|
2033
|
+
"note": "The editor's accessible name: what the box is for."
|
|
2034
|
+
},
|
|
2035
|
+
{
|
|
2036
|
+
"name": "placeholder",
|
|
2037
|
+
"takes": "anything",
|
|
2038
|
+
"required": true,
|
|
2039
|
+
"note": "Said in the empty box."
|
|
2040
|
+
},
|
|
2041
|
+
{
|
|
2042
|
+
"name": "draft",
|
|
2043
|
+
"takes": "CommentBoxDraft",
|
|
2044
|
+
"required": false,
|
|
2045
|
+
"note": "Keeps what is written when the box goes away."
|
|
2046
|
+
},
|
|
2047
|
+
{
|
|
2048
|
+
"name": "edit",
|
|
2049
|
+
"takes": "CommentBoxEdit",
|
|
2050
|
+
"required": false,
|
|
2051
|
+
"note": "Editing something already sent."
|
|
2052
|
+
},
|
|
2053
|
+
{
|
|
2054
|
+
"name": "upload",
|
|
2055
|
+
"takes": "a handler",
|
|
2056
|
+
"required": false,
|
|
2057
|
+
"note": "Offers the paperclip, `/` → File, a pasted picture and a dropped file: uploads one, and answers."
|
|
2058
|
+
},
|
|
2059
|
+
{
|
|
2060
|
+
"name": "accept",
|
|
2061
|
+
"takes": "text",
|
|
2062
|
+
"required": false,
|
|
2063
|
+
"note": "The file picker's `accept`."
|
|
2064
|
+
},
|
|
2065
|
+
{
|
|
2066
|
+
"name": "closed",
|
|
2067
|
+
"takes": "{ reason: ReactNode }",
|
|
2068
|
+
"required": false,
|
|
2069
|
+
"note": "The box cannot write here (an archived file, signed out): a line saying why takes its place."
|
|
2070
|
+
},
|
|
2071
|
+
{
|
|
2072
|
+
"name": "referenceView",
|
|
2073
|
+
"takes": "ComponentType<ReferenceViewProps>",
|
|
2074
|
+
"required": false,
|
|
2075
|
+
"note": "How a `nostr:` reference the box holds is drawn — the app's own chip."
|
|
2076
|
+
},
|
|
2077
|
+
{
|
|
2078
|
+
"name": "extensions",
|
|
2079
|
+
"takes": "readonly AnyExtension[]",
|
|
2080
|
+
"required": false,
|
|
2081
|
+
"note": "The app's own extra editor extensions: link chips, highlights."
|
|
2082
|
+
},
|
|
2083
|
+
{
|
|
2084
|
+
"name": "autoFocus",
|
|
2085
|
+
"takes": "true/false",
|
|
2086
|
+
"required": false,
|
|
2087
|
+
"note": null
|
|
2088
|
+
},
|
|
2089
|
+
{
|
|
2090
|
+
"name": "onSent",
|
|
2091
|
+
"takes": "a handler",
|
|
2092
|
+
"required": false,
|
|
2093
|
+
"note": "Called with what was sent once it went out: at once when `showsAtOnce`, else on the answer."
|
|
2094
|
+
},
|
|
2095
|
+
{
|
|
2096
|
+
"name": "onRefused",
|
|
2097
|
+
"takes": "a handler",
|
|
2098
|
+
"required": false,
|
|
2099
|
+
"note": "Called when a send shown at once was refused, so the app takes it back."
|
|
2100
|
+
},
|
|
2101
|
+
{
|
|
2102
|
+
"name": "className",
|
|
2103
|
+
"takes": "text",
|
|
2104
|
+
"required": false,
|
|
2105
|
+
"note": null
|
|
2106
|
+
}
|
|
2107
|
+
],
|
|
2108
|
+
"variants": [],
|
|
2109
|
+
"ownsBehaviours": [],
|
|
2110
|
+
"status": "stable",
|
|
2111
|
+
"migrationStage": null,
|
|
2112
|
+
"docsId": "primitives-commentbox--docs",
|
|
2113
|
+
"storyId": "primitives-commentbox--empty",
|
|
2114
|
+
"docPage": "src/CommentBox.mdx",
|
|
2115
|
+
"app": null,
|
|
2116
|
+
"looks": [
|
|
2117
|
+
"bg-bg-inset border border-border-default rounded-lg signal:transition-shadow signal:focus-within:border-border-focus signal:focus-within:shadow-focus-ring focus-within:border-border-strong transition-colors",
|
|
2118
|
+
"bg-bg-inset border border-border-default rounded-lg signal:transition-shadow signal:focus-within:border-border-focus signal:focus-within:shadow-focus-ring focus-within:border-border-strong transition-colors [&_.ProseMirror]:text-text-muted"
|
|
2119
|
+
]
|
|
2120
|
+
},
|
|
2121
|
+
{
|
|
2122
|
+
"name": "commentBoxRows",
|
|
2123
|
+
"repo": "estiva-ui",
|
|
2124
|
+
"kind": "helper",
|
|
2125
|
+
"importPath": "@estiva-app/ui/editor",
|
|
2126
|
+
"sourceFile": "src/CommentBox.tsx",
|
|
2127
|
+
"purpose": "The `/` Insert rows the kit offers. Pass the ones an app can perform, in its order, with its own after them; an edit drops File and Urgent itself.",
|
|
2128
|
+
"purposeFrom": "comment",
|
|
2129
|
+
"props": [],
|
|
2130
|
+
"variants": [],
|
|
2131
|
+
"ownsBehaviours": [],
|
|
2132
|
+
"status": "stable",
|
|
2133
|
+
"migrationStage": null,
|
|
2134
|
+
"docsId": "primitives-commentbox--docs",
|
|
2135
|
+
"storyId": "primitives-commentbox--empty",
|
|
2136
|
+
"docPage": null,
|
|
2137
|
+
"app": null,
|
|
2138
|
+
"looks": []
|
|
2139
|
+
},
|
|
1913
2140
|
{
|
|
1914
2141
|
"name": "CommentCount",
|
|
1915
2142
|
"repo": "estiva-ui",
|
|
@@ -2732,7 +2959,7 @@
|
|
|
2732
2959
|
},
|
|
2733
2960
|
{
|
|
2734
2961
|
"name": "action",
|
|
2735
|
-
"takes": "
|
|
2962
|
+
"takes": "ButtonAction",
|
|
2736
2963
|
"required": false,
|
|
2737
2964
|
"note": "The one thing to do about it — \"New topic\", \"Try again\" — drawn 16px under the line as the package's Button, outlined (Katerina, 2026-09-18)."
|
|
2738
2965
|
},
|
|
@@ -2789,6 +3016,62 @@
|
|
|
2789
3016
|
"text-menu signal:font-mono signal:text-small signal:tracking-wider leaf:font-mono leaf:text-small leaf:tracking-wider"
|
|
2790
3017
|
]
|
|
2791
3018
|
},
|
|
3019
|
+
{
|
|
3020
|
+
"name": "EntryShell",
|
|
3021
|
+
"repo": "estiva-ui",
|
|
3022
|
+
"kind": "component",
|
|
3023
|
+
"importPath": "@estiva-app/ui",
|
|
3024
|
+
"sourceFile": "src/EntryShell.tsx",
|
|
3025
|
+
"purpose": "What an app shows while nobody is signed in to it: its logo, one line saying why, and at most one button.",
|
|
3026
|
+
"purposeFrom": "page",
|
|
3027
|
+
"props": [
|
|
3028
|
+
{
|
|
3029
|
+
"name": "logo",
|
|
3030
|
+
"takes": "anything",
|
|
3031
|
+
"required": true,
|
|
3032
|
+
"note": "The app's own mark, drawn at the top in every state, as given: the app sizes it."
|
|
3033
|
+
},
|
|
3034
|
+
{
|
|
3035
|
+
"name": "busy",
|
|
3036
|
+
"takes": "true/false",
|
|
3037
|
+
"required": false,
|
|
3038
|
+
"note": "Entry is still being decided: the logo alone, faded in after 150ms (as a Skeleton is), so an entry that resolves at once flashes nothing."
|
|
3039
|
+
},
|
|
3040
|
+
{
|
|
3041
|
+
"name": "busyLabel",
|
|
3042
|
+
"takes": "text",
|
|
3043
|
+
"required": false,
|
|
3044
|
+
"note": "What a screen reader hears while `busy`; nothing is drawn for it."
|
|
3045
|
+
},
|
|
3046
|
+
{
|
|
3047
|
+
"name": "message",
|
|
3048
|
+
"takes": "anything",
|
|
3049
|
+
"required": false,
|
|
3050
|
+
"note": "The one line saying why nobody is signed in, announced politely when it appears."
|
|
3051
|
+
},
|
|
3052
|
+
{
|
|
3053
|
+
"name": "action",
|
|
3054
|
+
"takes": "ButtonAction & { disabled?: boolean }",
|
|
3055
|
+
"required": false,
|
|
3056
|
+
"note": "The one thing to do about it, drawn under the line (or alone, with no `message`) as the package's primary Button."
|
|
3057
|
+
},
|
|
3058
|
+
{
|
|
3059
|
+
"name": "className",
|
|
3060
|
+
"takes": "text",
|
|
3061
|
+
"required": false,
|
|
3062
|
+
"note": null
|
|
3063
|
+
}
|
|
3064
|
+
],
|
|
3065
|
+
"variants": [],
|
|
3066
|
+
"ownsBehaviours": [],
|
|
3067
|
+
"status": "stable",
|
|
3068
|
+
"migrationStage": null,
|
|
3069
|
+
"docsId": "frame-entryshell--docs",
|
|
3070
|
+
"storyId": "frame-entryshell--message-with-action",
|
|
3071
|
+
"docPage": "src/EntryShell.mdx",
|
|
3072
|
+
"app": null,
|
|
3073
|
+
"looks": []
|
|
3074
|
+
},
|
|
2792
3075
|
{
|
|
2793
3076
|
"name": "ErrorBoundary",
|
|
2794
3077
|
"repo": "estiva-ui",
|
|
@@ -6616,6 +6899,62 @@
|
|
|
6616
6899
|
"app": null,
|
|
6617
6900
|
"looks": []
|
|
6618
6901
|
},
|
|
6902
|
+
{
|
|
6903
|
+
"name": "ReactionRow",
|
|
6904
|
+
"repo": "estiva-ui",
|
|
6905
|
+
"kind": "component",
|
|
6906
|
+
"importPath": "@estiva-app/ui",
|
|
6907
|
+
"sourceFile": "src/ReactionRow.tsx",
|
|
6908
|
+
"purpose": "The one row of reactions under a comment or a line, in every app: Reaction pills in the order first chosen, yours lit, who reacted on hover, and the add button with ReactionPicker.",
|
|
6909
|
+
"purposeFrom": "page",
|
|
6910
|
+
"props": [
|
|
6911
|
+
{
|
|
6912
|
+
"name": "reactions",
|
|
6913
|
+
"takes": "readonly ReactionCount[]",
|
|
6914
|
+
"required": true,
|
|
6915
|
+
"note": "Each emoji and who chose it, in the order first chosen."
|
|
6916
|
+
},
|
|
6917
|
+
{
|
|
6918
|
+
"name": "options",
|
|
6919
|
+
"takes": "readonly ReactionOption[]",
|
|
6920
|
+
"required": true,
|
|
6921
|
+
"note": "The emoji offered, each named; also what a pill's name is read from."
|
|
6922
|
+
},
|
|
6923
|
+
{
|
|
6924
|
+
"name": "nameOf",
|
|
6925
|
+
"takes": "a handler",
|
|
6926
|
+
"required": true,
|
|
6927
|
+
"note": "A reactor's name, as \"who reacted\" says it."
|
|
6928
|
+
},
|
|
6929
|
+
{
|
|
6930
|
+
"name": "viewer",
|
|
6931
|
+
"takes": "text",
|
|
6932
|
+
"required": false,
|
|
6933
|
+
"note": "Who is looking: their pills are lit, and \"who reacted\" says \"you\"."
|
|
6934
|
+
},
|
|
6935
|
+
{
|
|
6936
|
+
"name": "onToggle",
|
|
6937
|
+
"takes": "a handler",
|
|
6938
|
+
"required": false,
|
|
6939
|
+
"note": "Your reaction on or off. Absent, the row only shows (read-only, signed out)."
|
|
6940
|
+
},
|
|
6941
|
+
{
|
|
6942
|
+
"name": "className",
|
|
6943
|
+
"takes": "text",
|
|
6944
|
+
"required": false,
|
|
6945
|
+
"note": null
|
|
6946
|
+
}
|
|
6947
|
+
],
|
|
6948
|
+
"variants": [],
|
|
6949
|
+
"ownsBehaviours": [],
|
|
6950
|
+
"status": "stable",
|
|
6951
|
+
"migrationStage": null,
|
|
6952
|
+
"docsId": "primitives-reactionrow--docs",
|
|
6953
|
+
"storyId": "primitives-reactionrow--default",
|
|
6954
|
+
"docPage": "src/ReactionRow.mdx",
|
|
6955
|
+
"app": null,
|
|
6956
|
+
"looks": []
|
|
6957
|
+
},
|
|
6619
6958
|
{
|
|
6620
6959
|
"name": "referenceAtSelection",
|
|
6621
6960
|
"repo": "estiva-ui",
|
|
@@ -9173,6 +9512,38 @@
|
|
|
9173
9512
|
"app": null,
|
|
9174
9513
|
"looks": []
|
|
9175
9514
|
},
|
|
9515
|
+
{
|
|
9516
|
+
"name": "whoReacted",
|
|
9517
|
+
"repo": "estiva-ui",
|
|
9518
|
+
"kind": "helper",
|
|
9519
|
+
"importPath": "@estiva-app/ui",
|
|
9520
|
+
"sourceFile": "src/ReactionRow.tsx",
|
|
9521
|
+
"purpose": "\"Person one, Person two and you reacted with Makes sense\".",
|
|
9522
|
+
"purposeFrom": "comment",
|
|
9523
|
+
"props": [
|
|
9524
|
+
{
|
|
9525
|
+
"name": "emoji",
|
|
9526
|
+
"takes": "text",
|
|
9527
|
+
"required": true,
|
|
9528
|
+
"note": null
|
|
9529
|
+
},
|
|
9530
|
+
{
|
|
9531
|
+
"name": "by",
|
|
9532
|
+
"takes": "readonly string[]",
|
|
9533
|
+
"required": true,
|
|
9534
|
+
"note": null
|
|
9535
|
+
}
|
|
9536
|
+
],
|
|
9537
|
+
"variants": [],
|
|
9538
|
+
"ownsBehaviours": [],
|
|
9539
|
+
"status": "stable",
|
|
9540
|
+
"migrationStage": null,
|
|
9541
|
+
"docsId": "primitives-reactionrow--docs",
|
|
9542
|
+
"storyId": "primitives-reactionrow--default",
|
|
9543
|
+
"docPage": null,
|
|
9544
|
+
"app": null,
|
|
9545
|
+
"looks": []
|
|
9546
|
+
},
|
|
9176
9547
|
{
|
|
9177
9548
|
"name": "WithTooltip",
|
|
9178
9549
|
"repo": "estiva-ui",
|
package/src/Button.tsx
CHANGED
|
@@ -32,6 +32,12 @@ import { TooltipTrigger } from './Tooltip'
|
|
|
32
32
|
export type ButtonVariant = 'primary' | 'outlined' | 'muted' | 'destructive' | 'resolve'
|
|
33
33
|
export type ButtonSize = 'default' | 'small'
|
|
34
34
|
|
|
35
|
+
/** One labelled action a part draws as its own Button: EmptyState's `action`, EntryShell's. */
|
|
36
|
+
export interface ButtonAction {
|
|
37
|
+
label: string
|
|
38
|
+
onClick: () => void
|
|
39
|
+
}
|
|
40
|
+
|
|
35
41
|
/**
|
|
36
42
|
* `ComponentPropsWithRef`, not `ButtonHTMLAttributes`, so a `ref` reaches the
|
|
37
43
|
* element. React 19 passes `ref` to a function component as an ordinary prop,
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { Meta, Canvas, Controls } from '@storybook/addon-docs/blocks'
|
|
2
|
+
import * as CommentBoxStories from './CommentBox.stories'
|
|
3
|
+
|
|
4
|
+
<Meta of={CommentBoxStories} />
|
|
5
|
+
|
|
6
|
+
# CommentBox
|
|
7
|
+
|
|
8
|
+
The one box every app writes a comment, a reply and a line of a conversation in: `@`, `!@`, `[` and `/`, the keys, drafts, files, editing, sending and a refused send. The app supplies its people, its `[` sections, its `/` Insert rows and a send.
|
|
9
|
+
|
|
10
|
+
<Canvas of={CommentBoxStories.Empty} />
|
|
11
|
+
|
|
12
|
+
## When
|
|
13
|
+
|
|
14
|
+
- **Writing anything that is sent**, in every app: a comment, a reply, a line in a conversation. The same box writes all of them.
|
|
15
|
+
- `showsAtOnce` when the app shows a send before the relay answers: the box empties at once, and a refusal puts the words back. Without it the box holds the words, shut, until the answer.
|
|
16
|
+
- `edit` to change something already sent: the same box with Cancel and Save, and only its keys on the left.
|
|
17
|
+
- `upload` to offer files: the paperclip, `/` → File, a pasted picture and a dropped file.
|
|
18
|
+
- `closed` where nothing can be written (archived, signed out): a line saying why, in the box's place. No greyed box.
|
|
19
|
+
|
|
20
|
+
<Canvas of={CommentBoxStories.Refused} />
|
|
21
|
+
|
|
22
|
+
## When not
|
|
23
|
+
|
|
24
|
+
- Writing a document in place → the editor itself, with **EditorBlockHandle** and **SelectionToolbar**. Nothing is sent.
|
|
25
|
+
- A box with nothing of this — no lists, no drafts, no files → **ComposeBox**, with the app's own editor. CommentBox is built on it.
|
|
26
|
+
- One line of plain text in a form → **TextInput** or **Textarea**.
|
|
27
|
+
|
|
28
|
+
## How
|
|
29
|
+
|
|
30
|
+
```tsx
|
|
31
|
+
import { CommentBox, commentBoxRows } from '@estiva-app/ui/editor'
|
|
32
|
+
|
|
33
|
+
// composerDraft, createDraftStore, draftKeys and composerText: @estiva-app/conversation, which this package does not depend on.
|
|
34
|
+
const draft = composerDraft(createDraftStore(localStorage), draftKeys.thread(rootId), labels)
|
|
35
|
+
|
|
36
|
+
<CommentBox
|
|
37
|
+
key={rootId}
|
|
38
|
+
label="Reply"
|
|
39
|
+
placeholder="Reply…"
|
|
40
|
+
people={people}
|
|
41
|
+
references={sectionsFor}
|
|
42
|
+
insert={[commentBoxRows.file, commentBoxRows.mention, commentBoxRows.urgent, commentBoxRows.reference]}
|
|
43
|
+
code="block"
|
|
44
|
+
draft={draft}
|
|
45
|
+
upload={uploadOne}
|
|
46
|
+
send={async (body, files) => {
|
|
47
|
+
const { text, urgent } = composerText(body)
|
|
48
|
+
return publish(text, urgent, files) // { accepted: true } or { accepted: false, reason }
|
|
49
|
+
}}
|
|
50
|
+
/>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
- **It speaks the editor's document.** The text a document sends, and the document an edit or a draft opens with, are `@estiva-app/conversation`'s: `composerText`, `composerDocument`, `composerDraft`. Never write marker text here.
|
|
54
|
+
- **`send` answers.** Resolve `{ accepted: false, reason }` and the words come back with "Not sent: *reason*". A thrown send is a refusal too.
|
|
55
|
+
- **`label` is required**: the editor's accessible name.
|
|
56
|
+
- **`insert` is the app's Insert rows**, after the shared Format section: `commentBoxRows` and the app's own. An edit drops File and Urgent itself; with no `upload` there is no File.
|
|
57
|
+
- **Give the box a `key` per destination.** The editor, the rows and `code` are made once, as the box opens; a new thread is a new box.
|
|
58
|
+
- A send shown at once and refused after its box went away writes the words into its draft instead.
|
|
59
|
+
|
|
60
|
+
## What it owns
|
|
61
|
+
|
|
62
|
+
It does these by itself. Write none of them around it.
|
|
63
|
+
|
|
64
|
+
| It does | So you never write |
|
|
65
|
+
|---|---|
|
|
66
|
+
| `@`, `!@`, `[` and `/`, with their lists and chips | the triggers and their extensions |
|
|
67
|
+
| Enter and Ctrl/Cmd+Enter send; Escape cancels an edit | key handlers |
|
|
68
|
+
| Holding the words until the answer, or showing the send at once | a sending state |
|
|
69
|
+
| A refusal: the words back, and a line under the box | a toast, or putting text back |
|
|
70
|
+
| The draft, written as you type and forgotten once sent | an update listener |
|
|
71
|
+
| Files: picking, pasting, dropping, uploading, failing; Send waits | a file list |
|
|
72
|
+
| The read-only line | a disabled box |
|
|
73
|
+
|
|
74
|
+
## Keys
|
|
75
|
+
|
|
76
|
+
| Key | What it does |
|
|
77
|
+
|---|---|
|
|
78
|
+
| Enter | Sends; saves an edit. With a list open, picks the row. |
|
|
79
|
+
| Ctrl/Cmd+Enter | Sends, as Enter does. |
|
|
80
|
+
| Shift+Enter | A new line; in a list, a new item. |
|
|
81
|
+
| Escape | Cancels an edit. With a list open, closes the list first. |
|
|
82
|
+
|
|
83
|
+
<Controls />
|