@qoretechnologies/reqraft 0.10.13-pr.74.gccefa54 → 0.10.13
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/.claude/CLAUDE.md +8 -11
- package/dist/components/form/engine/FormEngine.d.ts +1 -1
- package/dist/helpers/common.d.ts +0 -5
- package/dist/helpers/common.d.ts.map +1 -1
- package/dist/helpers/common.js +1 -20
- package/dist/helpers/common.js.map +1 -1
- package/dist/index.d.ts +0 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -7
- package/dist/index.js.map +1 -1
- package/dist/providers/StorageProvider.d.ts +13 -0
- package/dist/providers/StorageProvider.d.ts.map +1 -1
- package/dist/providers/StorageProvider.js +29 -5
- package/dist/providers/StorageProvider.js.map +1 -1
- package/package.json +3 -3
- package/src/helpers/common.ts +0 -19
- package/src/hooks/useStorage/useStorage.stories.tsx +52 -0
- package/src/index.tsx +0 -5
- package/src/providers/StorageProvider.tsx +30 -4
- package/dist/components/composer/Composer.d.ts +0 -108
- package/dist/components/composer/Composer.d.ts.map +0 -1
- package/dist/components/composer/Composer.js +0 -238
- package/dist/components/composer/Composer.js.map +0 -1
- package/dist/components/composer/helpers.d.ts +0 -21
- package/dist/components/composer/helpers.d.ts.map +0 -1
- package/dist/components/composer/helpers.js +0 -75
- package/dist/components/composer/helpers.js.map +0 -1
- package/dist/components/composer/index.d.ts +0 -3
- package/dist/components/composer/index.d.ts.map +0 -1
- package/dist/components/composer/index.js +0 -19
- package/dist/components/composer/index.js.map +0 -1
- package/dist/components/imageLightbox/ImageLightbox.d.ts +0 -17
- package/dist/components/imageLightbox/ImageLightbox.d.ts.map +0 -1
- package/dist/components/imageLightbox/ImageLightbox.js +0 -129
- package/dist/components/imageLightbox/ImageLightbox.js.map +0 -1
- package/dist/components/imageLightbox/index.d.ts +0 -2
- package/dist/components/imageLightbox/index.d.ts.map +0 -1
- package/dist/components/imageLightbox/index.js +0 -18
- package/dist/components/imageLightbox/index.js.map +0 -1
- package/dist/components/supportTicket/AttachmentChips.d.ts +0 -10
- package/dist/components/supportTicket/AttachmentChips.d.ts.map +0 -1
- package/dist/components/supportTicket/AttachmentChips.js +0 -119
- package/dist/components/supportTicket/AttachmentChips.js.map +0 -1
- package/dist/components/supportTicket/InterfaceReferenceTags.d.ts +0 -35
- package/dist/components/supportTicket/InterfaceReferenceTags.d.ts.map +0 -1
- package/dist/components/supportTicket/InterfaceReferenceTags.js +0 -31
- package/dist/components/supportTicket/InterfaceReferenceTags.js.map +0 -1
- package/dist/components/supportTicket/ReferencePicker.d.ts +0 -41
- package/dist/components/supportTicket/ReferencePicker.d.ts.map +0 -1
- package/dist/components/supportTicket/ReferencePicker.js +0 -86
- package/dist/components/supportTicket/ReferencePicker.js.map +0 -1
- package/dist/components/supportTicket/TicketHeader.d.ts +0 -86
- package/dist/components/supportTicket/TicketHeader.d.ts.map +0 -1
- package/dist/components/supportTicket/TicketHeader.js +0 -149
- package/dist/components/supportTicket/TicketHeader.js.map +0 -1
- package/dist/components/supportTicket/TicketMetaTags.d.ts +0 -32
- package/dist/components/supportTicket/TicketMetaTags.d.ts.map +0 -1
- package/dist/components/supportTicket/TicketMetaTags.js +0 -21
- package/dist/components/supportTicket/TicketMetaTags.js.map +0 -1
- package/dist/components/supportTicket/TicketReplyBox.d.ts +0 -63
- package/dist/components/supportTicket/TicketReplyBox.d.ts.map +0 -1
- package/dist/components/supportTicket/TicketReplyBox.js +0 -115
- package/dist/components/supportTicket/TicketReplyBox.js.map +0 -1
- package/dist/components/supportTicket/fileToAttachment.d.ts +0 -9
- package/dist/components/supportTicket/fileToAttachment.d.ts.map +0 -1
- package/dist/components/supportTicket/fileToAttachment.js +0 -28
- package/dist/components/supportTicket/fileToAttachment.js.map +0 -1
- package/dist/components/supportTicket/index.d.ts +0 -9
- package/dist/components/supportTicket/index.d.ts.map +0 -1
- package/dist/components/supportTicket/index.js +0 -25
- package/dist/components/supportTicket/index.js.map +0 -1
- package/dist/components/supportTicket/meta.d.ts +0 -63
- package/dist/components/supportTicket/meta.d.ts.map +0 -1
- package/dist/components/supportTicket/meta.js +0 -79
- package/dist/components/supportTicket/meta.js.map +0 -1
- package/dist/components/ticketReferences/TicketReferences.d.ts +0 -52
- package/dist/components/ticketReferences/TicketReferences.d.ts.map +0 -1
- package/dist/components/ticketReferences/TicketReferences.js +0 -453
- package/dist/components/ticketReferences/TicketReferences.js.map +0 -1
- package/dist/components/ticketReferences/index.d.ts +0 -3
- package/dist/components/ticketReferences/index.d.ts.map +0 -1
- package/dist/components/ticketReferences/index.js +0 -6
- package/dist/components/ticketReferences/index.js.map +0 -1
- package/dist/components/ticketThread/TicketThread.d.ts +0 -52
- package/dist/components/ticketThread/TicketThread.d.ts.map +0 -1
- package/dist/components/ticketThread/TicketThread.js +0 -248
- package/dist/components/ticketThread/TicketThread.js.map +0 -1
- package/dist/components/ticketThread/index.d.ts +0 -3
- package/dist/components/ticketThread/index.d.ts.map +0 -1
- package/dist/components/ticketThread/index.js +0 -7
- package/dist/components/ticketThread/index.js.map +0 -1
- package/dist/helpers/scrollbar.d.ts +0 -2
- package/dist/helpers/scrollbar.d.ts.map +0 -1
- package/dist/helpers/scrollbar.js +0 -25
- package/dist/helpers/scrollbar.js.map +0 -1
- package/src/components/composer/Composer.stories.tsx +0 -238
- package/src/components/composer/Composer.tsx +0 -545
- package/src/components/composer/helpers.ts +0 -74
- package/src/components/composer/index.ts +0 -2
- package/src/components/imageLightbox/ImageLightbox.stories.tsx +0 -156
- package/src/components/imageLightbox/ImageLightbox.tsx +0 -169
- package/src/components/imageLightbox/index.ts +0 -1
- package/src/components/supportTicket/AttachmentChips.stories.tsx +0 -122
- package/src/components/supportTicket/AttachmentChips.tsx +0 -142
- package/src/components/supportTicket/InterfaceReferenceTags.stories.tsx +0 -134
- package/src/components/supportTicket/InterfaceReferenceTags.tsx +0 -85
- package/src/components/supportTicket/ReferencePicker.stories.tsx +0 -296
- package/src/components/supportTicket/ReferencePicker.tsx +0 -237
- package/src/components/supportTicket/TicketConversation.stories.tsx +0 -122
- package/src/components/supportTicket/TicketHeader.stories.tsx +0 -183
- package/src/components/supportTicket/TicketHeader.tsx +0 -247
- package/src/components/supportTicket/TicketMetaTags.stories.tsx +0 -103
- package/src/components/supportTicket/TicketMetaTags.tsx +0 -85
- package/src/components/supportTicket/TicketReplyBox.stories.tsx +0 -355
- package/src/components/supportTicket/TicketReplyBox.tsx +0 -146
- package/src/components/supportTicket/fileToAttachment.ts +0 -24
- package/src/components/supportTicket/index.ts +0 -8
- package/src/components/supportTicket/meta.ts +0 -145
- package/src/components/ticketReferences/TicketReferences.stories.tsx +0 -301
- package/src/components/ticketReferences/TicketReferences.tsx +0 -899
- package/src/components/ticketReferences/index.ts +0 -2
- package/src/components/ticketThread/TicketThread.stories.tsx +0 -751
- package/src/components/ticketThread/TicketThread.tsx +0 -650
- package/src/components/ticketThread/index.ts +0 -6
- package/src/helpers/scrollbar.ts +0 -32
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
-
return cooked;
|
|
5
|
-
};
|
|
6
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
-
};
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.TicketThread = exports.ticketMessageDomId = void 0;
|
|
11
|
-
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
12
|
-
var reqore_1 = require("@qoretechnologies/reqore");
|
|
13
|
-
var colors_1 = require("@qoretechnologies/reqore/dist/helpers/colors");
|
|
14
|
-
var polished_1 = require("polished");
|
|
15
|
-
var react_1 = require("react");
|
|
16
|
-
var react_markdown_1 = __importDefault(require("react-markdown"));
|
|
17
|
-
var styled_components_1 = __importDefault(require("styled-components"));
|
|
18
|
-
var common_1 = require("../../helpers/common");
|
|
19
|
-
var imageLightbox_1 = require("../imageLightbox");
|
|
20
|
-
var supportTicket_1 = require("../supportTicket");
|
|
21
|
-
var AUTHOR_META = {
|
|
22
|
-
customer: { icon: 'User3Line' },
|
|
23
|
-
staff: { icon: 'CustomerService2Line' },
|
|
24
|
-
system: { icon: 'InformationLine' },
|
|
25
|
-
};
|
|
26
|
-
// Both sides share one accent: the side, the avatar and the author label already
|
|
27
|
-
// carry who is speaking, which frees colour to mean "internal note" and nothing
|
|
28
|
-
// else. `custom1` is a theme slot, so each host app supplies its own hue.
|
|
29
|
-
var ACCENT = { main: 'custom1' };
|
|
30
|
-
/** Avatar glyph; an internal note carries the "not visible to the customer" eye. */
|
|
31
|
-
var authorIcon = function (message) {
|
|
32
|
-
return message.internal ? 'EyeOffLine' : AUTHOR_META[message.author_type].icon;
|
|
33
|
-
};
|
|
34
|
-
/** The label above a message. The customer view masks staff identity as "Qorus
|
|
35
|
-
* Support"; the staff view shows the real author with a role prefix. Internal
|
|
36
|
-
* notes always label as "Internal note" regardless of viewer. */
|
|
37
|
-
var authorLabel = function (message, viewerRole) {
|
|
38
|
-
if (message.internal) {
|
|
39
|
-
return 'Internal note';
|
|
40
|
-
}
|
|
41
|
-
if (viewerRole === 'customer') {
|
|
42
|
-
return message.author_type === 'customer' ? 'You' : 'Qorus Support';
|
|
43
|
-
}
|
|
44
|
-
return "".concat(message.author_type === 'staff' ? 'Support' : 'Customer', " \u00B7 ").concat(message.author_id);
|
|
45
|
-
};
|
|
46
|
-
/**
|
|
47
|
-
* DOM id of a message in the rendered thread.
|
|
48
|
-
*
|
|
49
|
-
* Exported rather than inlined so that anything wanting to reveal a message — a
|
|
50
|
-
* "show in chat" action on a reference, a deep link — derives the id from the same
|
|
51
|
-
* function the thread renders with. Two copies of the same template string is exactly
|
|
52
|
-
* how that contract silently breaks when one side is renamed.
|
|
53
|
-
*/
|
|
54
|
-
var ticketMessageDomId = function (messageId) { return "ticket-message-".concat(messageId); };
|
|
55
|
-
exports.ticketMessageDomId = ticketMessageDomId;
|
|
56
|
-
var StyledThread = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n gap: 12px;\n width: 100%;\n\n /*\n * A thread too short to fill its scroller sits at the BOTTOM, against the\n * composer, the way every chat surface behaves \u2014 otherwise the first reply\n * floats at the top of a tall drawer with dead space beneath it, and each new\n * message appears further from the box you just typed in.\n *\n * The auto top margin does the pushing rather than 'justify-content: flex-end':\n * with flex-end, once the thread outgrows the scroller the overflow spills past\n * the top edge and those first messages cannot be scrolled back into view. An\n * auto margin only consumes FREE space, so it collapses to zero the moment the\n * content overflows and normal scrolling is preserved.\n *\n * min-height needs a definite height on the scroll parent to resolve; where a\n * consumer doesn't provide one it simply computes to auto and the thread keeps\n * its natural top-aligned flow.\n */\n min-height: 100%;\n\n > *:first-child {\n margin-top: auto;\n }\n"], ["\n display: flex;\n flex-direction: column;\n gap: 12px;\n width: 100%;\n\n /*\n * A thread too short to fill its scroller sits at the BOTTOM, against the\n * composer, the way every chat surface behaves \u2014 otherwise the first reply\n * floats at the top of a tall drawer with dead space beneath it, and each new\n * message appears further from the box you just typed in.\n *\n * The auto top margin does the pushing rather than 'justify-content: flex-end':\n * with flex-end, once the thread outgrows the scroller the overflow spills past\n * the top edge and those first messages cannot be scrolled back into view. An\n * auto margin only consumes FREE space, so it collapses to zero the moment the\n * content overflows and normal scrolling is preserved.\n *\n * min-height needs a definite height on the scroll parent to resolve; where a\n * consumer doesn't provide one it simply computes to auto and the thread keeps\n * its natural top-aligned flow.\n */\n min-height: 100%;\n\n > *:first-child {\n margin-top: auto;\n }\n"])));
|
|
57
|
-
// The loading placeholder: pulsing skeleton "bubbles" alternating sides, so the
|
|
58
|
-
// wait previews the thread it's about to become rather than a bare spinner. Built
|
|
59
|
-
// from reqore's `ReqoreSkeleton` — the shape (avatar circle + a short label line +
|
|
60
|
-
// N body lines) mirrors a real message. Sizes vary so it doesn't read as a grid.
|
|
61
|
-
var SKELETON_BUBBLES = [
|
|
62
|
-
{ self: false, lines: 2, width: 58 },
|
|
63
|
-
{ self: true, lines: 1, width: 42 },
|
|
64
|
-
{ self: true, lines: 3, width: 64 },
|
|
65
|
-
{ self: false, lines: 2, width: 50 },
|
|
66
|
-
{ self: false, lines: 1, width: 46 },
|
|
67
|
-
{ self: true, lines: 2, width: 60 },
|
|
68
|
-
{ self: false, lines: 3, width: 54 },
|
|
69
|
-
];
|
|
70
|
-
/*
|
|
71
|
-
* The skeleton fills the height from the TOP, unlike a real thread, which sits at the
|
|
72
|
-
* bottom against the composer. The bottom-pin is right for real messages — a short
|
|
73
|
-
* conversation belongs next to the box you type in — but a placeholder inheriting it
|
|
74
|
-
* clusters a few bubbles at the bottom under a large empty gap, which reads as a
|
|
75
|
-
* broken render rather than "loading". A loading skeleton grows top-down, the
|
|
76
|
-
* universal convention, so it occupies the space it's given no matter how tall.
|
|
77
|
-
*/
|
|
78
|
-
var StyledSkeletonThread = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n gap: 12px;\n width: 100%;\n min-height: 100%;\n"], ["\n display: flex;\n flex-direction: column;\n gap: 12px;\n width: 100%;\n min-height: 100%;\n"])));
|
|
79
|
-
var StyledSkeletonRow = styled_components_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: flex;\n gap: 10px;\n align-items: flex-start;\n justify-content: ", ";\n"], ["\n display: flex;\n gap: 10px;\n align-items: flex-start;\n justify-content: ", ";\n"])), function (_a) {
|
|
80
|
-
var $self = _a.$self;
|
|
81
|
-
return ($self ? 'flex-end' : 'flex-start');
|
|
82
|
-
});
|
|
83
|
-
// Content stays left-aligned even on a right-side row — like a real bubble, where
|
|
84
|
-
// the label sits top-left however the bubble is aligned; the row positions the
|
|
85
|
-
// whole block, this just lays the lines out within it.
|
|
86
|
-
var StyledSkeletonLines = styled_components_1.default.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n gap: 6px;\n align-items: flex-start;\n"], ["\n display: flex;\n flex-direction: column;\n gap: 6px;\n align-items: flex-start;\n"])));
|
|
87
|
-
var ConversationSkeleton = function () { return ((0, jsx_runtime_1.jsx)(StyledSkeletonThread, { "aria-busy": 'true', "aria-label": 'Loading conversation', children: SKELETON_BUBBLES.map(function (bubble, index) {
|
|
88
|
-
var avatar = (0, jsx_runtime_1.jsx)(reqore_1.ReqoreSkeleton, { circle: true, width: '30px', height: '30px' });
|
|
89
|
-
return ((0, jsx_runtime_1.jsxs)(StyledSkeletonRow, { "$self": bubble.self, children: [!bubble.self && avatar, (0, jsx_runtime_1.jsxs)(StyledSkeletonLines, { style: { width: "".concat(bubble.width, "%") }, children: [(0, jsx_runtime_1.jsx)(reqore_1.ReqoreSkeleton, { width: '38%', height: '10px' }), Array.from({ length: bubble.lines }).map(function (_, line) { return ((0, jsx_runtime_1.jsx)(reqore_1.ReqoreSkeleton, { width: line === bubble.lines - 1 ? '72%' : '100%', height: '8px' }, line)); })] }), bubble.self && avatar] }, index));
|
|
90
|
-
}) })); };
|
|
91
|
-
// Debosses the empty state: washes the icon + title back with opacity (kept
|
|
92
|
-
// theme-agnostic) and adds a faint light edge below, so "No messages yet" reads
|
|
93
|
-
// as pressed into the surface rather than announced.
|
|
94
|
-
var StyledEmpty = styled_components_1.default.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n /*\n * Centre the placeholder in the space it's given rather than letting it sit at the\n * top. Like the thread, this fills its scroll parent (min-height: 100%, which needs a\n * definite height to resolve \u2014 the drawer body provides one; where a consumer doesn't,\n * it collapses to auto and the state keeps its natural top-aligned flow).\n */\n min-height: 100%;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n\n .reqore-icon {\n opacity: 0.28;\n }\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n opacity: 0.4;\n text-shadow: 0 1px 0 rgba(255, 255, 255, 0.07);\n }\n"], ["\n /*\n * Centre the placeholder in the space it's given rather than letting it sit at the\n * top. Like the thread, this fills its scroll parent (min-height: 100%, which needs a\n * definite height to resolve \u2014 the drawer body provides one; where a consumer doesn't,\n * it collapses to auto and the state keeps its natural top-aligned flow).\n */\n min-height: 100%;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n\n .reqore-icon {\n opacity: 0.28;\n }\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n opacity: 0.4;\n text-shadow: 0 1px 0 rgba(255, 255, 255, 0.07);\n }\n"])));
|
|
95
|
-
// System messages read as a centered muted note between cards; the nested rule
|
|
96
|
-
// flattens react-markdown's own <p> margins so it sits on one line.
|
|
97
|
-
var StyledSystemRow = styled_components_1.default.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 6px;\n font-size: 11px;\n opacity: 0.55;\n text-align: center;\n p {\n margin: 0;\n }\n"], ["\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 6px;\n font-size: 11px;\n opacity: 0.55;\n text-align: center;\n p {\n margin: 0;\n }\n"])));
|
|
98
|
-
// The message body, washed a step below the bright author name in the card's
|
|
99
|
-
// header so the two read as different things; in-body **bold** lifts back toward
|
|
100
|
-
// full strength as emphasis. Every colour derives from the active Reqore theme
|
|
101
|
-
// rather than a hardcoded hex, so the thread reads correctly on any host app.
|
|
102
|
-
var StyledMarkdown = styled_components_1.default.div(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n color: ", ";\n word-break: break-word;\n\n > *:first-child {\n margin-top: 0;\n }\n > *:last-child {\n margin-bottom: 0;\n }\n\n p {\n margin: 0 0 6px;\n }\n strong {\n color: ", ";\n font-weight: 600;\n }\n ul,\n ol {\n margin: 4px 0;\n padding-left: 18px;\n }\n li {\n margin: 2px 0;\n }\n code {\n font-family: monospace;\n background: ", ";\n padding: 1px 5px;\n border-radius: 4px;\n }\n pre {\n margin: 6px 0;\n padding: 8px 10px;\n background: rgba(0, 0, 0, 0.35);\n border-radius: 4px;\n overflow-x: auto;\n }\n pre code {\n background: none;\n padding: 0;\n white-space: pre;\n }\n a {\n color: ", ";\n text-decoration: none;\n }\n a:hover {\n text-decoration: underline;\n }\n"], ["\n color: ", ";\n word-break: break-word;\n\n > *:first-child {\n margin-top: 0;\n }\n > *:last-child {\n margin-bottom: 0;\n }\n\n p {\n margin: 0 0 6px;\n }\n strong {\n color: ", ";\n font-weight: 600;\n }\n ul,\n ol {\n margin: 4px 0;\n padding-left: 18px;\n }\n li {\n margin: 2px 0;\n }\n code {\n font-family: monospace;\n background: ", ";\n padding: 1px 5px;\n border-radius: 4px;\n }\n pre {\n margin: 6px 0;\n padding: 8px 10px;\n background: rgba(0, 0, 0, 0.35);\n border-radius: 4px;\n overflow-x: auto;\n }\n pre code {\n background: none;\n padding: 0;\n white-space: pre;\n }\n a {\n color: ", ";\n text-decoration: none;\n }\n a:hover {\n text-decoration: underline;\n }\n"])), function (_a) {
|
|
103
|
-
var $color = _a.$color;
|
|
104
|
-
return $color;
|
|
105
|
-
}, function (_a) {
|
|
106
|
-
var $emphasis = _a.$emphasis;
|
|
107
|
-
return $emphasis;
|
|
108
|
-
}, function (_a) {
|
|
109
|
-
var $code = _a.$code;
|
|
110
|
-
return $code;
|
|
111
|
-
}, function (_a) {
|
|
112
|
-
var $link = _a.$link;
|
|
113
|
-
return $link;
|
|
114
|
-
});
|
|
115
|
-
/** A message body rendered as markdown, tinted from the active theme. */
|
|
116
|
-
var MessageBody = function (_a) {
|
|
117
|
-
var _b, _c;
|
|
118
|
-
var children = _a.children;
|
|
119
|
-
var theme = (0, reqore_1.useReqoreTheme)();
|
|
120
|
-
var readable = (0, colors_1.getReadableColor)(theme);
|
|
121
|
-
var link = (_c = (_b = theme.intents) === null || _b === void 0 ? void 0 : _b.info) !== null && _c !== void 0 ? _c : readable;
|
|
122
|
-
return ((0, jsx_runtime_1.jsx)(StyledMarkdown, { "$color": (0, polished_1.rgba)(readable, 0.72), "$emphasis": (0, polished_1.rgba)(readable, 0.95), "$code": (0, polished_1.rgba)(readable, 0.1), "$link": link, children: (0, jsx_runtime_1.jsx)(react_markdown_1.default, { children: children }) }));
|
|
123
|
-
};
|
|
124
|
-
/** A file attachment as a download chip — the fallback for every non-image, and for
|
|
125
|
-
* images when no `fetchAttachmentUrl` is wired. */
|
|
126
|
-
var AttachmentChip = function (_a) {
|
|
127
|
-
var attachment = _a.attachment, onDownloadAttachment = _a.onDownloadAttachment;
|
|
128
|
-
return ((0, jsx_runtime_1.jsx)(reqore_1.ReqoreButton, { icon: 'Download2Line', size: 'small', flat: true, badge: (0, common_1.formatBytes)(attachment.size_bytes), tooltip: "".concat(attachment.content_type, " \u00B7 download"), onClick: function () { return onDownloadAttachment === null || onDownloadAttachment === void 0 ? void 0 : onDownloadAttachment(attachment.attachment_id, attachment.filename); }, children: attachment.filename }));
|
|
129
|
-
};
|
|
130
|
-
var StyledThumb = styled_components_1.default.button(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n appearance: none;\n padding: 0;\n border: 1px solid ", ";\n border-radius: 8px;\n overflow: hidden;\n background: ", ";\n cursor: zoom-in;\n line-height: 0;\n display: block;\n\n img {\n display: block;\n max-width: 240px;\n max-height: 200px;\n object-fit: cover;\n }\n"], ["\n appearance: none;\n padding: 0;\n border: 1px solid ", ";\n border-radius: 8px;\n overflow: hidden;\n background: ", ";\n cursor: zoom-in;\n line-height: 0;\n display: block;\n\n img {\n display: block;\n max-width: 240px;\n max-height: 200px;\n object-fit: cover;\n }\n"])), (0, polished_1.rgba)('#ffffff', 0.12), (0, polished_1.rgba)('#000000', 0.25));
|
|
131
|
-
/**
|
|
132
|
-
* An image attachment as a thumbnail; clicking it opens the shared `ImageLightbox`
|
|
133
|
-
* (owned by `AttachmentList`, which knows the whole image set for paging). The bytes
|
|
134
|
-
* come from `fetchAttachmentUrl`, so until they arrive a skeleton holds the space, and
|
|
135
|
-
* if the fetch fails the attachment degrades to the same download chip as any other
|
|
136
|
-
* file rather than showing a broken image.
|
|
137
|
-
*/
|
|
138
|
-
var ImageThumb = function (_a) {
|
|
139
|
-
var attachment = _a.attachment, fetchAttachmentUrl = _a.fetchAttachmentUrl, onOpen = _a.onOpen, onDownloadAttachment = _a.onDownloadAttachment;
|
|
140
|
-
var _b = (0, react_1.useState)(null), url = _b[0], setUrl = _b[1];
|
|
141
|
-
var _c = (0, react_1.useState)(false), failed = _c[0], setFailed = _c[1];
|
|
142
|
-
(0, react_1.useEffect)(function () {
|
|
143
|
-
var alive = true;
|
|
144
|
-
fetchAttachmentUrl(attachment.attachment_id)
|
|
145
|
-
.then(function (resolved) { return alive && setUrl(resolved); })
|
|
146
|
-
.catch(function () { return alive && setFailed(true); });
|
|
147
|
-
return function () {
|
|
148
|
-
alive = false;
|
|
149
|
-
};
|
|
150
|
-
}, [attachment.attachment_id]);
|
|
151
|
-
if (failed) {
|
|
152
|
-
return (0, jsx_runtime_1.jsx)(AttachmentChip, { attachment: attachment, onDownloadAttachment: onDownloadAttachment });
|
|
153
|
-
}
|
|
154
|
-
if (!url) {
|
|
155
|
-
return (0, jsx_runtime_1.jsx)(reqore_1.ReqoreSkeleton, { width: '180px', height: '120px' });
|
|
156
|
-
}
|
|
157
|
-
return ((0, jsx_runtime_1.jsx)(StyledThumb, { type: 'button', title: "".concat(attachment.filename, " \u2014 click to enlarge"), onClick: onOpen, children: (0, jsx_runtime_1.jsx)("img", { src: url, alt: attachment.filename }) }));
|
|
158
|
-
};
|
|
159
|
-
/**
|
|
160
|
-
* A message's attachments, split into two rows: previewable images as a row of
|
|
161
|
-
* thumbnails, and everything else as a row of download chips beneath.
|
|
162
|
-
*
|
|
163
|
-
* They can't share one wrapping row — a thumbnail is ~120px tall and a chip ~26px, so
|
|
164
|
-
* mixed together the chips wrap raggedly around the image and the group reads as
|
|
165
|
-
* broken. Grouping by kind keeps each row uniform. Images only preview when a
|
|
166
|
-
* `fetchAttachmentUrl` is wired; without it they're files like any other and fall into
|
|
167
|
-
* the chip row.
|
|
168
|
-
*/
|
|
169
|
-
var AttachmentList = function (_a) {
|
|
170
|
-
var attachments = _a.attachments, fetchAttachmentUrl = _a.fetchAttachmentUrl, onDownloadAttachment = _a.onDownloadAttachment;
|
|
171
|
-
var previewable = Boolean(fetchAttachmentUrl);
|
|
172
|
-
var images = previewable ? attachments.filter(function (a) { return (0, common_1.isImage)(a.content_type); }) : [];
|
|
173
|
-
var imageIds = new Set(images.map(function (a) { return a.attachment_id; }));
|
|
174
|
-
var files = attachments.filter(function (a) { return !imageIds.has(a.attachment_id); });
|
|
175
|
-
// which image the shared lightbox is showing; null = closed
|
|
176
|
-
var _b = (0, react_1.useState)(null), openIndex = _b[0], setOpenIndex = _b[1];
|
|
177
|
-
return ((0, jsx_runtime_1.jsxs)(reqore_1.ReqoreControlGroup, { vertical: true, gapSize: 'small', style: { marginTop: 8 }, children: [images.length ? ((0, jsx_runtime_1.jsx)(reqore_1.ReqoreControlGroup, { wrap: true, gapSize: 'small', verticalAlign: 'flex-start', children: images.map(function (attachment, index) { return ((0, jsx_runtime_1.jsx)(ImageThumb, { attachment: attachment, fetchAttachmentUrl: fetchAttachmentUrl, onOpen: function () { return setOpenIndex(index); }, onDownloadAttachment: onDownloadAttachment }, attachment.attachment_id)); }) })) : null, files.length ? ((0, jsx_runtime_1.jsx)(reqore_1.ReqoreControlGroup, { wrap: true, gapSize: 'small', children: files.map(function (attachment) { return ((0, jsx_runtime_1.jsx)(AttachmentChip, { attachment: attachment, onDownloadAttachment: onDownloadAttachment }, attachment.attachment_id)); }) })) : null, openIndex !== null && fetchAttachmentUrl ? ((0, jsx_runtime_1.jsx)(imageLightbox_1.ImageLightbox, { images: images, index: openIndex, onIndex: setOpenIndex, onClose: function () { return setOpenIndex(null); }, fetchAttachmentUrl: fetchAttachmentUrl, onDownload: onDownloadAttachment })) : null] }));
|
|
178
|
-
};
|
|
179
|
-
/** Split the thread into centred system lines and runs of consecutive non-system
|
|
180
|
-
* messages — each run becomes one `ReqoreBubbleGroup`, which is what collapses a
|
|
181
|
-
* same-side burst onto a single timestamp. */
|
|
182
|
-
var toSegments = function (messages) {
|
|
183
|
-
var segments = [];
|
|
184
|
-
for (var _i = 0, messages_1 = messages; _i < messages_1.length; _i++) {
|
|
185
|
-
var message = messages_1[_i];
|
|
186
|
-
if (message.author_type === 'system') {
|
|
187
|
-
segments.push({ kind: 'system', message: message });
|
|
188
|
-
continue;
|
|
189
|
-
}
|
|
190
|
-
var last = segments[segments.length - 1];
|
|
191
|
-
if ((last === null || last === void 0 ? void 0 : last.kind) === 'bubbles') {
|
|
192
|
-
last.messages.push(message);
|
|
193
|
-
}
|
|
194
|
-
else {
|
|
195
|
-
segments.push({ kind: 'bubbles', messages: [message] });
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
return segments;
|
|
199
|
-
};
|
|
200
|
-
var TicketThread = function (_a) {
|
|
201
|
-
var messages = _a.messages, _b = _a.viewerRole, viewerRole = _b === void 0 ? 'customer' : _b, loading = _a.loading, onDownloadAttachment = _a.onDownloadAttachment, fetchAttachmentUrl = _a.fetchAttachmentUrl, resolveInterfaceIcon = _a.resolveInterfaceIcon, onInterfaceClick = _a.onInterfaceClick;
|
|
202
|
-
// Open scrolled to the newest message, and follow new arrivals down — a thread is read
|
|
203
|
-
// from the bottom, like any chat. Keyed on the message COUNT so it fires on open and when
|
|
204
|
-
// a reply lands, not on every re-render (which would fight a user who has scrolled up to
|
|
205
|
-
// read history). Scrolls the nearest scrollable ancestor (the drawer body) straight to its
|
|
206
|
-
// end rather than scrollIntoView on a sentinel — scrollIntoView also drags any outer scroll
|
|
207
|
-
// container around and stops one bottom-padding short of the real end.
|
|
208
|
-
var threadRef = (0, react_1.useRef)(null);
|
|
209
|
-
(0, react_1.useEffect)(function () {
|
|
210
|
-
var _a, _b;
|
|
211
|
-
// Find the thread's OWN scroll container — the nearest ancestor that actually scrolls
|
|
212
|
-
// (overflow-y auto/scroll), not merely the first one that currently overflows. A short
|
|
213
|
-
// thread's container fits its content, so a "does it overflow?" test would walk straight
|
|
214
|
-
// past it and scroll the whole page/panel to the bottom instead.
|
|
215
|
-
var scroller = (_b = (_a = threadRef.current) === null || _a === void 0 ? void 0 : _a.parentElement) !== null && _b !== void 0 ? _b : null;
|
|
216
|
-
while (scroller) {
|
|
217
|
-
var overflowY = getComputedStyle(scroller).overflowY;
|
|
218
|
-
if (overflowY === 'auto' || overflowY === 'scroll') {
|
|
219
|
-
break;
|
|
220
|
-
}
|
|
221
|
-
scroller = scroller.parentElement;
|
|
222
|
-
}
|
|
223
|
-
if (scroller) {
|
|
224
|
-
scroller.scrollTop = scroller.scrollHeight;
|
|
225
|
-
}
|
|
226
|
-
}, [messages.length]);
|
|
227
|
-
// Segment the flat message list into system rows + author-grouped bubble runs once per
|
|
228
|
-
// message change — not on every re-render (scroll, hover and resize all re-render this).
|
|
229
|
-
var segments = (0, react_1.useMemo)(function () { return toSegments(messages); }, [messages]);
|
|
230
|
-
if (loading) {
|
|
231
|
-
return (0, jsx_runtime_1.jsx)(ConversationSkeleton, {});
|
|
232
|
-
}
|
|
233
|
-
if (!messages.length) {
|
|
234
|
-
return ((0, jsx_runtime_1.jsx)(StyledEmpty, { children: (0, jsx_runtime_1.jsx)(reqore_1.ReqoreEmptyState, { icon: 'Chat3Line', title: 'No messages yet', flat: true, transparent: true }) }));
|
|
235
|
-
}
|
|
236
|
-
return ((0, jsx_runtime_1.jsxs)(StyledThread, { ref: threadRef, children: [segments.map(function (segment, index) {
|
|
237
|
-
return segment.kind === 'system' ? ((0, jsx_runtime_1.jsxs)(StyledSystemRow, { id: (0, exports.ticketMessageDomId)(segment.message.message_id), children: [(0, jsx_runtime_1.jsx)(reqore_1.ReqoreIcon, { icon: 'InformationLine', size: 'tiny' }), (0, jsx_runtime_1.jsx)(react_markdown_1.default, { children: segment.message.body })] }, segment.message.message_id)) : ((0, jsx_runtime_1.jsx)(reqore_1.ReqoreBubbleGroup, { children: segment.messages.map(function (message) {
|
|
238
|
-
var _a, _b;
|
|
239
|
-
return ((0, jsx_runtime_1.jsxs)(reqore_1.ReqoreBubble, {
|
|
240
|
-
// anchor for "show in chat"; ReqoreBubble forwards unknown props to
|
|
241
|
-
// its DOM node, so this lands on the rendered element
|
|
242
|
-
id: (0, exports.ticketMessageDomId)(message.message_id), size: 'small', maxWidth: '76%', align: message.author_type === viewerRole ? 'right' : 'left', avatar: { icon: authorIcon(message) }, label: authorLabel(message, viewerRole), timestamp: message.created ? (0, jsx_runtime_1.jsx)(reqore_1.ReqoreTimeAgo, { time: message.created }) : undefined, intent: message.internal ? 'warning' : undefined, customTheme: message.internal ? undefined : ACCENT, flat: false, minimal: true, children: [(0, jsx_runtime_1.jsx)(MessageBody, { children: message.body }), ((_a = message.attachments) === null || _a === void 0 ? void 0 : _a.length) ? ((0, jsx_runtime_1.jsx)(AttachmentList, { attachments: message.attachments, fetchAttachmentUrl: fetchAttachmentUrl, onDownloadAttachment: onDownloadAttachment })) : null, ((_b = message.referenced_interfaces) === null || _b === void 0 ? void 0 : _b.length) ? ((0, jsx_runtime_1.jsx)("div", { style: { marginTop: 8 }, children: (0, jsx_runtime_1.jsx)(supportTicket_1.InterfaceReferenceTags, { size: 'tiny', customTheme: ACCENT, references: message.referenced_interfaces, resolveInterfaceIcon: resolveInterfaceIcon, onInterfaceClick: onInterfaceClick }) })) : null] }, message.message_id));
|
|
243
|
-
}) }, "group-".concat(index)));
|
|
244
|
-
}), (0, jsx_runtime_1.jsxs)(reqore_1.ReqoreP, { size: 'tiny', effect: { opacity: 0.5, textAlign: 'center' }, children: [messages.length, " message", messages.length === 1 ? '' : 's'] })] }));
|
|
245
|
-
};
|
|
246
|
-
exports.TicketThread = TicketThread;
|
|
247
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8;
|
|
248
|
-
//# sourceMappingURL=TicketThread.js.map
|
|
@@ -1 +0,0 @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kBAAkB,EAAE,kBAAkB,EACtC,oBAAoB,EAAE,oBAAoB,GAC1C,CACH,CAAC,CAAC,CAAC,IAAI,EACP,CAAA,MAAA,OAAO,CAAC,qBAAqB,0CAAE,MAAM,EAAC,CAAC,CAAC,CACvC,gCAAK,KAAK,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,YAC1B,uBAAC,sCAAsB,IACrB,IAAI,EAAC,MAAM,EACX,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,OAAO,CAAC,qBAAqB,EACzC,oBAAoB,EAAE,oBAAoB,EAC1C,gBAAgB,EAAE,gBAAgB,GAClC,GACE,CACP,CAAC,CAAC,CAAC,IAAI,KAjCH,OAAO,CAAC,UAAU,CAkCV,CAChB,CAAA;qBAAA,CAAC,IAtCoB,gBAAS,KAAK,CAAE,CAuCpB,CACrB;YAjDD,CAiDC,CACF,EACD,wBAAC,gBAAO,IAAC,IAAI,EAAC,MAAM,EAAC,MAAM,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,QAAQ,EAAE,aAC/D,QAAQ,CAAC,MAAM,cAAU,QAAQ,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,IAClD,IACG,CAChB,CAAC;AACJ,CAAC,CAAC;AA7GW,QAAA,YAAY,gBA6GvB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ticketThread/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAClE,YAAY,EACV,uBAAuB,EACvB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,gBAAgB,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ticketMessageDomId = exports.TicketThread = void 0;
|
|
4
|
-
var TicketThread_1 = require("./TicketThread");
|
|
5
|
-
Object.defineProperty(exports, "TicketThread", { enumerable: true, get: function () { return TicketThread_1.TicketThread; } });
|
|
6
|
-
Object.defineProperty(exports, "ticketMessageDomId", { enumerable: true, get: function () { return TicketThread_1.ticketMessageDomId; } });
|
|
7
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/ticketThread/index.ts"],"names":[],"mappings":";;;AAAA,+CAAkE;AAAzD,4GAAA,YAAY,OAAA;AAAE,kHAAA,kBAAkB,OAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scrollbar.d.ts","sourceRoot":"","sources":["../../src/helpers/scrollbar.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,aAAa,KAezB,CAAC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
-
return cooked;
|
|
5
|
-
};
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.thinScrollbar = void 0;
|
|
8
|
-
var styled_components_1 = require("styled-components");
|
|
9
|
-
/*
|
|
10
|
-
* The thin, unobtrusive scrollbar the Qorus surfaces use — a transparent track and a
|
|
11
|
-
* translucent rounded thumb — in place of the platform default, which reads as heavy
|
|
12
|
-
* chrome inside a dark panel. Drop it into any `styled` scroll container:
|
|
13
|
-
*
|
|
14
|
-
* const Scroll = styled.div`
|
|
15
|
-
* overflow-y: auto;
|
|
16
|
-
* ${thinScrollbar}
|
|
17
|
-
* `;
|
|
18
|
-
*
|
|
19
|
-
* webkit-only on purpose: setting `scrollbar-width` as well lets Chromium override this
|
|
20
|
-
* custom 6px with its own wider "thin", so the two disagree. Firefox keeps its native
|
|
21
|
-
* bar, which is already slim.
|
|
22
|
-
*/
|
|
23
|
-
exports.thinScrollbar = (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n &::-webkit-scrollbar {\n width: 6px;\n height: 6px;\n }\n &::-webkit-scrollbar-track {\n background: transparent;\n }\n &::-webkit-scrollbar-thumb {\n background: rgba(255, 255, 255, 0.15);\n border-radius: 3px;\n }\n &::-webkit-scrollbar-thumb:hover {\n background: rgba(255, 255, 255, 0.28);\n }\n"], ["\n &::-webkit-scrollbar {\n width: 6px;\n height: 6px;\n }\n &::-webkit-scrollbar-track {\n background: transparent;\n }\n &::-webkit-scrollbar-thumb {\n background: rgba(255, 255, 255, 0.15);\n border-radius: 3px;\n }\n &::-webkit-scrollbar-thumb:hover {\n background: rgba(255, 255, 255, 0.28);\n }\n"])));
|
|
24
|
-
var templateObject_1;
|
|
25
|
-
//# sourceMappingURL=scrollbar.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scrollbar.js","sourceRoot":"","sources":["../../src/helpers/scrollbar.ts"],"names":[],"mappings":";;;;;;;AAAA,uDAAwC;AAExC;;;;;;;;;;;;;GAaG;AACU,QAAA,aAAa,OAAG,uBAAG,8YAAA,0UAe/B,KAAC"}
|
|
@@ -1,238 +0,0 @@
|
|
|
1
|
-
import { ReqoreButton, ReqoreTag, ReqoreUIProvider } from '@qoretechnologies/reqore';
|
|
2
|
-
import { StoryObj } from '@storybook/react-vite';
|
|
3
|
-
import { expect, fn, userEvent, waitFor, within } from 'storybook/test';
|
|
4
|
-
import { StoryMeta } from '../../types';
|
|
5
|
-
import { Composer } from './Composer';
|
|
6
|
-
|
|
7
|
-
const meta = {
|
|
8
|
-
component: Composer,
|
|
9
|
-
title: 'Components/Composer',
|
|
10
|
-
args: {
|
|
11
|
-
onSend: fn(),
|
|
12
|
-
},
|
|
13
|
-
} as StoryMeta<typeof Composer>;
|
|
14
|
-
|
|
15
|
-
export default meta;
|
|
16
|
-
type Story = StoryObj<typeof meta>;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* The default: the rich, Qonsole-style editor (`ReqoreRichTextEditor`). It renders
|
|
20
|
-
* a Slate contenteditable (not a `<textarea>`), an attach button, and Send.
|
|
21
|
-
*/
|
|
22
|
-
export const Rich: Story = {
|
|
23
|
-
parameters: {
|
|
24
|
-
docs: {
|
|
25
|
-
description: {
|
|
26
|
-
story:
|
|
27
|
-
'Renders the default rich editor — a Slate contenteditable (not a textarea) with an attach button and Send, seeded with a multi-line draft.',
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
args: {
|
|
32
|
-
placeholder: 'Write a message…',
|
|
33
|
-
defaultText: 'A rich, multi-line draft.\nSecond paragraph survives as a newline.',
|
|
34
|
-
},
|
|
35
|
-
async play({ canvasElement }) {
|
|
36
|
-
await expect(canvasElement.querySelector('[contenteditable="true"]')).not.toBeNull();
|
|
37
|
-
await expect(canvasElement.querySelector('textarea')).toBeNull();
|
|
38
|
-
await expect(within(canvasElement).getByText('Send')).toBeInTheDocument();
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* The `plain` variant — a `ReqoreTextarea`, used where a simple text field is
|
|
44
|
-
* enough (and for deterministic tests). Typing enables Send; clicking it calls
|
|
45
|
-
* `onSend` with the plain body and the staged files.
|
|
46
|
-
*/
|
|
47
|
-
export const Plain: Story = {
|
|
48
|
-
parameters: {
|
|
49
|
-
docs: {
|
|
50
|
-
description: {
|
|
51
|
-
story:
|
|
52
|
-
'Renders the plain textarea variant, where typing enables Send and clicking it calls onSend with the plain body and the staged files.',
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
args: { editor: 'plain' },
|
|
57
|
-
async play({ canvasElement, args }) {
|
|
58
|
-
const canvas = within(canvasElement);
|
|
59
|
-
const textarea = canvasElement.querySelector('textarea');
|
|
60
|
-
await expect(textarea).not.toBeNull();
|
|
61
|
-
|
|
62
|
-
await userEvent.type(textarea!, 'hello there');
|
|
63
|
-
await userEvent.click(canvas.getByText('Send'));
|
|
64
|
-
await waitFor(() =>
|
|
65
|
-
expect(args.onSend).toHaveBeenCalledWith(
|
|
66
|
-
'hello there',
|
|
67
|
-
expect.objectContaining({ files: [] })
|
|
68
|
-
)
|
|
69
|
-
);
|
|
70
|
-
},
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Multiple `sendActions` split the send button — a primary button plus a caret
|
|
75
|
-
* dropdown. The primary is the first action; its `id` is echoed back to `onSend`.
|
|
76
|
-
*/
|
|
77
|
-
export const SplitSend: Story = {
|
|
78
|
-
parameters: {
|
|
79
|
-
docs: {
|
|
80
|
-
description: {
|
|
81
|
-
story:
|
|
82
|
-
"Renders the composer with multiple sendActions, splitting Send into a primary Publish button plus a caret dropdown — sending echoes the chosen action's id back to onSend.",
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
args: {
|
|
87
|
-
editor: 'plain',
|
|
88
|
-
sendActions: [
|
|
89
|
-
{ id: 'publish', label: 'Publish', icon: 'SendPlane2Line' },
|
|
90
|
-
{ id: 'draft', label: 'Save draft', icon: 'FileLine' },
|
|
91
|
-
],
|
|
92
|
-
},
|
|
93
|
-
async play({ canvasElement, args }) {
|
|
94
|
-
const canvas = within(canvasElement);
|
|
95
|
-
const textarea = canvasElement.querySelector('textarea');
|
|
96
|
-
await userEvent.type(textarea!, 'ship it');
|
|
97
|
-
await userEvent.click(canvas.getByText('Publish'));
|
|
98
|
-
await waitFor(() =>
|
|
99
|
-
expect(args.onSend).toHaveBeenCalledWith(
|
|
100
|
-
'ship it',
|
|
101
|
-
expect.objectContaining({ action: 'publish' })
|
|
102
|
-
)
|
|
103
|
-
);
|
|
104
|
-
},
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* A map of the composer's injection slots. The same Composer becomes the Qonsole
|
|
109
|
-
* input or the helpdesk reply box by filling these — so here every slot renders a
|
|
110
|
-
* tag naming itself, to show exactly where each one lands:
|
|
111
|
-
*
|
|
112
|
-
* - `attachMenuItems` — turns the `+` into a dropdown (open it for the entry)
|
|
113
|
-
* - `toolbarStart` — after `+` on the left
|
|
114
|
-
* - `footerActions` — after `toolbarStart`
|
|
115
|
-
* - `rightActions` — just left of Send
|
|
116
|
-
* - `aboveInput` — on top of the editor, inside the bar (Qonsole's reference chips)
|
|
117
|
-
* - `belowInput` — under the whole bar
|
|
118
|
-
*/
|
|
119
|
-
const slotTag = (name: string) => <ReqoreTag label={name} size='small' intent='info' />;
|
|
120
|
-
|
|
121
|
-
export const WithSlots: Story = {
|
|
122
|
-
parameters: {
|
|
123
|
-
docs: {
|
|
124
|
-
description: {
|
|
125
|
-
story:
|
|
126
|
-
'Renders every composer injection slot — attachMenuItems, toolbarStart, footerActions, rightActions, aboveInput, and belowInput — each filled with a self-naming tag, so the story reads as a legible map of where each slot lands.',
|
|
127
|
-
},
|
|
128
|
-
},
|
|
129
|
-
},
|
|
130
|
-
args: {
|
|
131
|
-
editor: 'plain',
|
|
132
|
-
attachMenuItems: () => [
|
|
133
|
-
{ label: 'attachMenuItems entry', icon: 'CameraAiLine', onClick: fn() },
|
|
134
|
-
],
|
|
135
|
-
toolbarStart: slotTag('toolbarStart'),
|
|
136
|
-
footerActions: slotTag('footerActions'),
|
|
137
|
-
rightActions: slotTag('rightActions'),
|
|
138
|
-
aboveInput: slotTag('aboveInput'),
|
|
139
|
-
belowInput: slotTag('belowInput'),
|
|
140
|
-
},
|
|
141
|
-
async play({ canvasElement }) {
|
|
142
|
-
const canvas = within(canvasElement);
|
|
143
|
-
// every slot renders its own marker, so the story is a legible slot map
|
|
144
|
-
for (const slot of [
|
|
145
|
-
'toolbarStart',
|
|
146
|
-
'footerActions',
|
|
147
|
-
'rightActions',
|
|
148
|
-
'aboveInput',
|
|
149
|
-
'belowInput',
|
|
150
|
-
]) {
|
|
151
|
-
await expect(canvas.getByText(slot)).toBeInTheDocument();
|
|
152
|
-
}
|
|
153
|
-
},
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* Proof that the composer is configurable enough to *be* the qorus-ide Qonsole
|
|
158
|
-
* input — no fork. Wrapped in qorus-ide's Reqore theme (`main #121212`,
|
|
159
|
-
* `custom1 #762f7e`) and given the same effect + controls the real QonsoleInput
|
|
160
|
-
* uses: the `custom1:darken` gradient bar, an icon-only `custom1` send, and the
|
|
161
|
-
* `+` / `/` / compass controls in the slots. Compare against
|
|
162
|
-
* :6006 story `qonsole-ui-components--business-impact`.
|
|
163
|
-
*/
|
|
164
|
-
export const QonsoleReplica: Story = {
|
|
165
|
-
parameters: {
|
|
166
|
-
docs: {
|
|
167
|
-
description: {
|
|
168
|
-
story:
|
|
169
|
-
"Renders the composer configured to replicate qorus-ide's QonsoleInput — a dark custom1 theme, gradient bar, icon-only send, and the slash-commands and design-session compass controls in its slots.",
|
|
170
|
-
},
|
|
171
|
-
},
|
|
172
|
-
},
|
|
173
|
-
decorators: [
|
|
174
|
-
(Story) => (
|
|
175
|
-
<ReqoreUIProvider theme={{ main: '#121212', intents: { custom1: '#762f7e' } }}>
|
|
176
|
-
<div style={{ padding: 20, background: '#121212' }}>
|
|
177
|
-
<Story />
|
|
178
|
-
</div>
|
|
179
|
-
</ReqoreUIProvider>
|
|
180
|
-
),
|
|
181
|
-
],
|
|
182
|
-
args: {
|
|
183
|
-
placeholder: "Tell Qorus what you're trying to do…",
|
|
184
|
-
// the exact QonsoleInput bar effect (a custom1 gradient border + fill)
|
|
185
|
-
effect: { gradient: { direction: 'to bottom right', colors: 'custom1:darken:1:0.9' } },
|
|
186
|
-
// icon-only, custom1-themed, minimal — the Qonsole send
|
|
187
|
-
sendActions: [{ id: 'send', icon: 'SendPlane2Line', customTheme: { main: 'custom1' }, minimal: true }],
|
|
188
|
-
// `+` becomes a dropdown once it has extra items (screenshot / capture), like Qonsole
|
|
189
|
-
attachMenuItems: () => [
|
|
190
|
-
{ label: 'Take screenshot', icon: 'CameraAiLine', onClick: fn() },
|
|
191
|
-
{ label: 'Capture area', icon: 'CropLine', onClick: fn() },
|
|
192
|
-
],
|
|
193
|
-
// the `/` slash-commands control (a stand-in for the Qonsole completions dropdown)
|
|
194
|
-
toolbarStart: (
|
|
195
|
-
<ReqoreButton
|
|
196
|
-
icon='SlashCommands2'
|
|
197
|
-
minimal
|
|
198
|
-
flat
|
|
199
|
-
size='small'
|
|
200
|
-
customTheme={{ main: 'custom1' }}
|
|
201
|
-
tooltip='Slash commands'
|
|
202
|
-
/>
|
|
203
|
-
),
|
|
204
|
-
// the design-session compass, left of send — exactly where QonsoleInput puts it
|
|
205
|
-
rightActions: (
|
|
206
|
-
<ReqoreButton
|
|
207
|
-
icon='Compass3Line'
|
|
208
|
-
minimal
|
|
209
|
-
flat
|
|
210
|
-
size='small'
|
|
211
|
-
customTheme={{ main: 'custom1' }}
|
|
212
|
-
tooltip='Start a design session'
|
|
213
|
-
/>
|
|
214
|
-
),
|
|
215
|
-
},
|
|
216
|
-
async play({ canvasElement }) {
|
|
217
|
-
// rich editor + the icon-only send (no "Send" label) render
|
|
218
|
-
await expect(canvasElement.querySelector('[contenteditable="true"]')).not.toBeNull();
|
|
219
|
-
await expect(within(canvasElement).queryByText('Send')).not.toBeInTheDocument();
|
|
220
|
-
},
|
|
221
|
-
};
|
|
222
|
-
|
|
223
|
-
/** `disabled` replaces the whole composer with a muted notice. */
|
|
224
|
-
export const Disabled: Story = {
|
|
225
|
-
parameters: {
|
|
226
|
-
docs: {
|
|
227
|
-
description: {
|
|
228
|
-
story:
|
|
229
|
-
'Renders the disabled state, where the whole composer is replaced by a muted notice showing the disabledReason.',
|
|
230
|
-
},
|
|
231
|
-
},
|
|
232
|
-
},
|
|
233
|
-
args: { disabled: true, disabledReason: 'This channel is read-only.' },
|
|
234
|
-
async play({ canvasElement }) {
|
|
235
|
-
await expect(within(canvasElement).getByText('This channel is read-only.')).toBeInTheDocument();
|
|
236
|
-
await expect(canvasElement.querySelector('textarea')).toBeNull();
|
|
237
|
-
},
|
|
238
|
-
};
|