@adminide-stack/clock-tik-browser 12.0.35-alpha.0 → 12.0.36-alpha.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.
Files changed (70) hide show
  1. package/lib/pages/Home/__tests__/connectors.test.d.ts +2 -0
  2. package/lib/pages/Home/__tests__/connectors.test.d.ts.map +1 -0
  3. package/lib/pages/Home/__tests__/history.test.d.ts +2 -0
  4. package/lib/pages/Home/__tests__/history.test.d.ts.map +1 -0
  5. package/lib/pages/Home/__tests__/queue.test.d.ts +2 -0
  6. package/lib/pages/Home/__tests__/queue.test.d.ts.map +1 -0
  7. package/lib/pages/Home/__tests__/results.test.d.ts +2 -0
  8. package/lib/pages/Home/__tests__/results.test.d.ts.map +1 -0
  9. package/lib/pages/Home/chat/ChoresChat.d.ts.map +1 -1
  10. package/lib/pages/Home/chat/ChoresChat.js +409 -88
  11. package/lib/pages/Home/chat/ChoresChat.js.map +1 -1
  12. package/lib/pages/Home/chat/ChoresPanel.d.ts +10 -1
  13. package/lib/pages/Home/chat/ChoresPanel.d.ts.map +1 -1
  14. package/lib/pages/Home/chat/ChoresPanel.js +27 -18
  15. package/lib/pages/Home/chat/ChoresPanel.js.map +1 -1
  16. package/lib/pages/Home/chat/ConnectorsPanel.d.ts +23 -0
  17. package/lib/pages/Home/chat/ConnectorsPanel.d.ts.map +1 -0
  18. package/lib/pages/Home/chat/ConnectorsPanel.js +132 -0
  19. package/lib/pages/Home/chat/ConnectorsPanel.js.map +1 -0
  20. package/lib/pages/Home/chat/HistoryPanel.d.ts +27 -0
  21. package/lib/pages/Home/chat/HistoryPanel.d.ts.map +1 -0
  22. package/lib/pages/Home/chat/HistoryPanel.js +234 -0
  23. package/lib/pages/Home/chat/HistoryPanel.js.map +1 -0
  24. package/lib/pages/Home/chat/ResultCards.d.ts +16 -0
  25. package/lib/pages/Home/chat/ResultCards.d.ts.map +1 -0
  26. package/lib/pages/Home/chat/ResultCards.js +509 -0
  27. package/lib/pages/Home/chat/ResultCards.js.map +1 -0
  28. package/lib/pages/Home/chat/chatTheme.d.ts.map +1 -1
  29. package/lib/pages/Home/chat/chatTheme.js +685 -8
  30. package/lib/pages/Home/chat/chatTheme.js.map +1 -1
  31. package/lib/pages/Home/chat/chores.d.ts +10 -3
  32. package/lib/pages/Home/chat/chores.d.ts.map +1 -1
  33. package/lib/pages/Home/chat/chores.js +22 -5
  34. package/lib/pages/Home/chat/chores.js.map +1 -1
  35. package/lib/pages/Home/chat/connectors.d.ts +37 -0
  36. package/lib/pages/Home/chat/connectors.d.ts.map +1 -0
  37. package/lib/pages/Home/chat/connectors.js +73 -0
  38. package/lib/pages/Home/chat/connectors.js.map +1 -0
  39. package/lib/pages/Home/chat/history.d.ts +51 -0
  40. package/lib/pages/Home/chat/history.d.ts.map +1 -0
  41. package/lib/pages/Home/chat/history.js +186 -0
  42. package/lib/pages/Home/chat/history.js.map +1 -0
  43. package/lib/pages/Home/chat/lucy.d.ts.map +1 -1
  44. package/lib/pages/Home/chat/lucy.js +1 -1
  45. package/lib/pages/Home/chat/lucy.js.map +1 -1
  46. package/lib/pages/Home/chat/queue.d.ts +94 -0
  47. package/lib/pages/Home/chat/queue.d.ts.map +1 -0
  48. package/lib/pages/Home/chat/queue.js +88 -0
  49. package/lib/pages/Home/chat/queue.js.map +1 -0
  50. package/lib/pages/Home/chat/results.d.ts +207 -0
  51. package/lib/pages/Home/chat/results.d.ts.map +1 -0
  52. package/lib/pages/Home/chat/results.js +823 -0
  53. package/lib/pages/Home/chat/results.js.map +1 -0
  54. package/lib/pages/Home/chat/stop.d.ts +7 -6
  55. package/lib/pages/Home/chat/stop.d.ts.map +1 -1
  56. package/lib/pages/Home/chat/stop.js +7 -6
  57. package/lib/pages/Home/chat/stop.js.map +1 -1
  58. package/lib/pages/Home/chat/thread.d.ts +9 -3
  59. package/lib/pages/Home/chat/thread.d.ts.map +1 -1
  60. package/lib/pages/Home/chat/thread.js +14 -5
  61. package/lib/pages/Home/chat/thread.js.map +1 -1
  62. package/lib/pages/Home/chat/tour/tourSteps.d.ts +4 -3
  63. package/lib/pages/Home/chat/tour/tourSteps.d.ts.map +1 -1
  64. package/lib/pages/Home/chat/tour/tourSteps.js +23 -3
  65. package/lib/pages/Home/chat/tour/tourSteps.js.map +1 -1
  66. package/lib/pages/Home/chat/useChores.d.ts +5 -0
  67. package/lib/pages/Home/chat/useChores.d.ts.map +1 -1
  68. package/lib/pages/Home/chat/useChores.js +4 -1
  69. package/lib/pages/Home/chat/useChores.js.map +1 -1
  70. package/package.json +3 -3
@@ -0,0 +1,234 @@
1
+ import {jsxs,jsx,Fragment}from'react/jsx-runtime';import {useRef,useState,useCallback,useEffect,useMemo}from'react';import {History,X,MessageSquareText,Trash2}from'lucide-react';import {useNow,useAnchoredPanel}from'./ChoresPanel.js';import {chatWhen,CHAT_AGES}from'./history.js';/** The header's way in, beside New chat. */
2
+ function HistoryButton({
3
+ open,
4
+ onClick,
5
+ buttonRef
6
+ }) {
7
+ return jsxs("button", {
8
+ ref: buttonRef,
9
+ type: "button",
10
+ "data-tour": "history",
11
+ "data-track": "chat_history",
12
+ onClick: onClick,
13
+ "aria-haspopup": "dialog",
14
+ "aria-expanded": open,
15
+ "aria-label": "Chat history",
16
+ title: "Your past chats",
17
+ // A phone's header has no room for the word.
18
+ className: `inline-flex items-center gap-1.5 rounded-md p-1.5 text-xs font-medium hover:bg-muted hover:text-foreground sm:px-2 ${open ? 'bg-muted text-foreground' : 'text-muted-foreground'}`,
19
+ children: [jsx(History, {
20
+ className: "h-4 w-4",
21
+ "aria-hidden": true
22
+ }), jsx("span", {
23
+ className: "hidden sm:inline",
24
+ children: "History"
25
+ })]
26
+ });
27
+ }
28
+ function HistoryPanel({
29
+ chats,
30
+ open,
31
+ busy,
32
+ onOpen,
33
+ onDelete,
34
+ onClose,
35
+ anchor
36
+ }) {
37
+ const panelRef = useRef(null);
38
+ const now = useNow(open, 60_000);
39
+ const place = useAnchoredPanel(open, anchor, onClose);
40
+ // The chat to open once the person says so (Lucy is working), and the one to delete once they do.
41
+ const [opening, setOpening] = useState(null);
42
+ const [deleting, setDeleting] = useState(null);
43
+ // A question's first answer takes the focus, as the button that asked it goes.
44
+ const focusFirst = useCallback(button => button?.focus(), []);
45
+ // Each time it opens: read from the top, with no question left over from the last time.
46
+ const bodyRef = useRef(null);
47
+ useEffect(() => {
48
+ setOpening(null);
49
+ setDeleting(null);
50
+ if (!open) return;
51
+ if (bodyRef.current) bodyRef.current.scrollTop = 0;
52
+ panelRef.current?.focus();
53
+ }, [open]);
54
+ // She finished while it was asking: there is no chore left to stop.
55
+ useEffect(() => {
56
+ if (!busy) setOpening(null);
57
+ }, [busy]);
58
+ const sections = useMemo(() => {
59
+ const byAge = new Map();
60
+ for (const chat of chats) {
61
+ const {
62
+ age,
63
+ label
64
+ } = chatWhen(chat.at, now);
65
+ byAge.set(age, [...(byAge.get(age) ?? []), {
66
+ chat,
67
+ when: label
68
+ }]);
69
+ }
70
+ return CHAT_AGES.flatMap(age => {
71
+ const rows = byAge.get(age);
72
+ return rows ? [{
73
+ age,
74
+ rows
75
+ }] : [];
76
+ });
77
+ }, [chats, now]);
78
+ const settle = () => {
79
+ setDeleting(null);
80
+ panelRef.current?.focus();
81
+ };
82
+ if (!open) return null;
83
+ return jsxs(Fragment, {
84
+ children: [jsx("div", {
85
+ className: "cbh-chores-scrim",
86
+ onClick: onClose,
87
+ "aria-hidden": true
88
+ }), jsxs("div", {
89
+ ref: panelRef,
90
+ role: "dialog",
91
+ "aria-label": "Your past chats",
92
+ tabIndex: -1,
93
+ className: "cbh-chores cbh-history",
94
+ style: place,
95
+ children: [jsxs("div", {
96
+ className: "cbh-chores-head",
97
+ children: [jsxs("div", {
98
+ children: [jsx("h2", {
99
+ children: "Your past chats"
100
+ }), jsx("p", {
101
+ children: "Kept on this device. Lucy picks up where you left off."
102
+ })]
103
+ }), jsx("button", {
104
+ type: "button",
105
+ className: "cbh-chores-close",
106
+ onClick: onClose,
107
+ "aria-label": "Close",
108
+ children: jsx(X, {
109
+ size: 16,
110
+ "aria-hidden": true
111
+ })
112
+ })]
113
+ }), jsx("div", {
114
+ className: "cbh-chores-body",
115
+ ref: bodyRef,
116
+ children: sections.length ? sections.map(({
117
+ age,
118
+ rows
119
+ }) => jsxs("section", {
120
+ className: "cbh-chores-section",
121
+ children: [jsx("h3", {
122
+ children: age
123
+ }), jsx("ul", {
124
+ children: rows.map(({
125
+ chat,
126
+ when
127
+ }) => jsxs("li", {
128
+ children: [deleting === chat.id ? jsxs("div", {
129
+ className: "cbh-history-ask",
130
+ role: "group",
131
+ "aria-label": "Delete this chat?",
132
+ children: [jsxs("p", {
133
+ children: [jsxs("b", {
134
+ children: ["Delete \u201C", chat.title, "\u201D?"]
135
+ }), "It\u2019s gone from this device for good."]
136
+ }), jsxs("div", {
137
+ className: "cbh-history-ask-actions",
138
+ children: [jsx("button", {
139
+ type: "button",
140
+ ref: focusFirst,
141
+ onClick: settle,
142
+ children: "Cancel"
143
+ }), jsx("button", {
144
+ type: "button",
145
+ className: "cbh-history-danger",
146
+ "data-track": "chat_history_delete",
147
+ onClick: () => {
148
+ onDelete(chat.id);
149
+ settle();
150
+ },
151
+ children: "Delete"
152
+ })]
153
+ })]
154
+ }) : jsxs("div", {
155
+ className: "cbh-history-line",
156
+ children: [jsxs("button", {
157
+ type: "button",
158
+ className: "cbh-chores-row",
159
+ "data-track": "chat_history_open",
160
+ onClick: () => busy ? setOpening(chat.id) : onOpen(chat.id),
161
+ "aria-expanded": busy ? opening === chat.id : undefined,
162
+ children: [jsx("span", {
163
+ className: "cbh-chores-icon",
164
+ "aria-hidden": true,
165
+ children: jsx(MessageSquareText, {
166
+ size: 16
167
+ })
168
+ }), jsxs("span", {
169
+ className: "cbh-chores-row-text",
170
+ children: [jsx("b", {
171
+ children: chat.title
172
+ }), jsx("small", {
173
+ children: when
174
+ })]
175
+ })]
176
+ }), jsx("button", {
177
+ type: "button",
178
+ className: "cbh-history-delete",
179
+ onClick: () => {
180
+ setOpening(null);
181
+ setDeleting(chat.id);
182
+ },
183
+ "aria-label": `Delete “${chat.title}”`,
184
+ title: "Delete chat",
185
+ children: jsx(Trash2, {
186
+ size: 15,
187
+ "aria-hidden": true
188
+ })
189
+ })]
190
+ }), opening === chat.id && deleting !== chat.id ? jsxs("div", {
191
+ className: "cbh-history-ask",
192
+ role: "group",
193
+ "aria-label": "Open this chat?",
194
+ children: [jsxs("p", {
195
+ children: [jsx("b", {
196
+ children: "Lucy is still working."
197
+ }), "Opening this chat stops the chore she\u2019s on."]
198
+ }), jsxs("div", {
199
+ className: "cbh-history-ask-actions",
200
+ children: [jsx("button", {
201
+ type: "button",
202
+ ref: focusFirst,
203
+ onClick: () => setOpening(null),
204
+ children: "Keep going"
205
+ }), jsx("button", {
206
+ type: "button",
207
+ className: "cbh-history-go",
208
+ onClick: () => onOpen(chat.id),
209
+ children: "Open chat"
210
+ })]
211
+ })]
212
+ }) : null]
213
+ }, chat.id))
214
+ })]
215
+ }, age)) : jsxs("div", {
216
+ className: "cbh-chores-empty",
217
+ children: [jsx("span", {
218
+ className: "cbh-chores-icon",
219
+ "aria-hidden": true,
220
+ children: jsx(History, {
221
+ size: 18
222
+ })
223
+ }), jsx("p", {
224
+ children: jsx("b", {
225
+ children: "No past chats yet"
226
+ })
227
+ }), jsx("p", {
228
+ children: "When you start a new chat, this one is kept here so you can pick it up again."
229
+ })]
230
+ })
231
+ })]
232
+ })]
233
+ });
234
+ }export{HistoryButton,HistoryPanel};//# sourceMappingURL=HistoryPanel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HistoryPanel.js","sources":["../../../../src/pages/Home/chat/HistoryPanel.tsx"],"sourcesContent":[null],"names":["_jsx"],"mappings":"uRAUA;AACM,SAAU,aAAa,CAAC;MASnB;SAW8C;AAC7C,EAAA;AAQZ,CAAC,EAAA;AAeD,EAAA,oBAA4B,EAAA;AACxB,IAAA,GAAA,EAAA,SAAc;IACd,IAAM,EAAA,QAAY;IACl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,MAAA;AAwDxD,IAAC,IAAA,CAAA,IAAA,EAAA,UAAA,CAAA,IAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,16 @@
1
+ import { type ResultCard } from './results';
2
+ export interface ResultCardsProps {
3
+ cards: ResultCard[];
4
+ /** Each card's pick so far, by card key, as JSON (results.ts `cardPicks`): a card takes one. */
5
+ picks?: string;
6
+ /** Lucy is on a turn: a pick waits until she is done. */
7
+ busy: boolean;
8
+ /** The cards opened past their first rows, by key. */
9
+ open: ReadonlySet<string>;
10
+ onToggle: (key: string) => void;
11
+ /** Answers Lucy with the row's words, as if typed; `keyboard` when a key pressed it. */
12
+ onReply: (reply: string, keyboard: boolean) => void;
13
+ }
14
+ /** The cards for one reply. A tap answers at once and its card locks, before the thread shows it. */
15
+ export declare const ResultCards: import("react").NamedExoticComponent<ResultCardsProps>;
16
+ //# sourceMappingURL=ResultCards.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResultCards.d.ts","sourceRoot":"","sources":["../../../../src/pages/Home/chat/ResultCards.tsx"],"names":[],"mappings":"AA2BA,OAAO,EASH,KAAK,UAAU,EAElB,MAAM,WAAW,CAAC;AA0dnB,MAAM,WAAW,gBAAgB;IAC7B,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,gGAAgG;IAChG,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yDAAyD;IACzD,IAAI,EAAE,OAAO,CAAC;IACd,sDAAsD;IACtD,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC1B,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,wFAAwF;IACxF,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;CACvD;AAED,qGAAqG;AACrG,eAAO,MAAM,WAAW,wDAuCtB,CAAC"}