@activecollab/components 2.0.417 → 2.0.419

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 (71) hide show
  1. package/dist/cjs/components/Icons/collection/Portfolio.js +61 -0
  2. package/dist/cjs/components/Icons/collection/Portfolio.js.map +1 -0
  3. package/dist/cjs/components/Icons/collection/PortfolioPlus.js +62 -0
  4. package/dist/cjs/components/Icons/collection/PortfolioPlus.js.map +1 -0
  5. package/dist/cjs/components/Icons/collection/Target.js +65 -0
  6. package/dist/cjs/components/Icons/collection/Target.js.map +1 -0
  7. package/dist/cjs/components/Icons/collection/index.js +21 -0
  8. package/dist/cjs/components/Icons/collection/index.js.map +1 -1
  9. package/dist/cjs/presentation/shared/MessageDialog.js +62 -107
  10. package/dist/cjs/presentation/shared/MessageDialog.js.map +1 -1
  11. package/dist/cjs/presentation/shared/MessageFeedback.js +284 -0
  12. package/dist/cjs/presentation/shared/MessageFeedback.js.map +1 -0
  13. package/dist/cjs/presentation/shared/PortfolioOptionsMenu.js +64 -0
  14. package/dist/cjs/presentation/shared/PortfolioOptionsMenu.js.map +1 -0
  15. package/dist/cjs/presentation/shared/ProjectOptionsMenu.js +367 -0
  16. package/dist/cjs/presentation/shared/ProjectOptionsMenu.js.map +1 -0
  17. package/dist/cjs/presentation/shared/dashboardWidgets.js +726 -0
  18. package/dist/cjs/presentation/shared/dashboardWidgets.js.map +1 -0
  19. package/dist/cjs/presentation/shared/headers.js +25 -360
  20. package/dist/cjs/presentation/shared/headers.js.map +1 -1
  21. package/dist/cjs/presentation/shared/index.js +130 -0
  22. package/dist/cjs/presentation/shared/index.js.map +1 -1
  23. package/dist/esm/components/Icons/collection/Portfolio.d.ts +32 -0
  24. package/dist/esm/components/Icons/collection/Portfolio.d.ts.map +1 -0
  25. package/dist/esm/components/Icons/collection/Portfolio.js +54 -0
  26. package/dist/esm/components/Icons/collection/Portfolio.js.map +1 -0
  27. package/dist/esm/components/Icons/collection/PortfolioPlus.d.ts +32 -0
  28. package/dist/esm/components/Icons/collection/PortfolioPlus.d.ts.map +1 -0
  29. package/dist/esm/components/Icons/collection/PortfolioPlus.js +55 -0
  30. package/dist/esm/components/Icons/collection/PortfolioPlus.js.map +1 -0
  31. package/dist/esm/components/Icons/collection/Target.d.ts +32 -0
  32. package/dist/esm/components/Icons/collection/Target.d.ts.map +1 -0
  33. package/dist/esm/components/Icons/collection/Target.js +58 -0
  34. package/dist/esm/components/Icons/collection/Target.js.map +1 -0
  35. package/dist/esm/components/Icons/collection/index.d.ts +3 -0
  36. package/dist/esm/components/Icons/collection/index.d.ts.map +1 -1
  37. package/dist/esm/components/Icons/collection/index.js +3 -0
  38. package/dist/esm/components/Icons/collection/index.js.map +1 -1
  39. package/dist/esm/presentation/shared/MessageDialog.d.ts +8 -3
  40. package/dist/esm/presentation/shared/MessageDialog.d.ts.map +1 -1
  41. package/dist/esm/presentation/shared/MessageDialog.js +64 -98
  42. package/dist/esm/presentation/shared/MessageDialog.js.map +1 -1
  43. package/dist/esm/presentation/shared/MessageFeedback.d.ts +54 -0
  44. package/dist/esm/presentation/shared/MessageFeedback.d.ts.map +1 -0
  45. package/dist/esm/presentation/shared/MessageFeedback.js +252 -0
  46. package/dist/esm/presentation/shared/MessageFeedback.js.map +1 -0
  47. package/dist/esm/presentation/shared/PortfolioOptionsMenu.d.ts +12 -0
  48. package/dist/esm/presentation/shared/PortfolioOptionsMenu.d.ts.map +1 -0
  49. package/dist/esm/presentation/shared/PortfolioOptionsMenu.js +46 -0
  50. package/dist/esm/presentation/shared/PortfolioOptionsMenu.js.map +1 -0
  51. package/dist/esm/presentation/shared/ProjectOptionsMenu.d.ts +31 -0
  52. package/dist/esm/presentation/shared/ProjectOptionsMenu.d.ts.map +1 -0
  53. package/dist/esm/presentation/shared/ProjectOptionsMenu.js +311 -0
  54. package/dist/esm/presentation/shared/ProjectOptionsMenu.js.map +1 -0
  55. package/dist/esm/presentation/shared/dashboardWidgets.d.ts +203 -0
  56. package/dist/esm/presentation/shared/dashboardWidgets.d.ts.map +1 -0
  57. package/dist/esm/presentation/shared/dashboardWidgets.js +665 -0
  58. package/dist/esm/presentation/shared/dashboardWidgets.js.map +1 -0
  59. package/dist/esm/presentation/shared/headers.d.ts +0 -11
  60. package/dist/esm/presentation/shared/headers.d.ts.map +1 -1
  61. package/dist/esm/presentation/shared/headers.js +23 -315
  62. package/dist/esm/presentation/shared/headers.js.map +1 -1
  63. package/dist/esm/presentation/shared/index.d.ts +8 -0
  64. package/dist/esm/presentation/shared/index.d.ts.map +1 -1
  65. package/dist/esm/presentation/shared/index.js +4 -0
  66. package/dist/esm/presentation/shared/index.js.map +1 -1
  67. package/dist/index.js +666 -508
  68. package/dist/index.js.map +1 -1
  69. package/dist/index.min.js +1 -1
  70. package/dist/index.min.js.map +1 -1
  71. package/package.json +1 -1
@@ -1,10 +1,11 @@
1
- import React, { useCallback, useContext, useState } from "react";
1
+ import React, { useContext } from "react";
2
2
  import styled from "styled-components";
3
+ import { MessageFeedback } from "./MessageFeedback";
3
4
  import { screenBelow } from "../../components/BreakPoints";
4
5
  import { Button } from "../../components/Button";
5
6
  import { Columns } from "../../components/Columns";
6
7
  import { IconButton } from "../../components/IconButton";
7
- import { CancelCrossIcon, ThumbUpOutlineIcon } from "../../components/Icons";
8
+ import { CancelCrossIcon } from "../../components/Icons";
8
9
  import { InfoBox } from "../../components/InfoBox";
9
10
  import { Media } from "../../components/Media";
10
11
  import { Modal } from "../../components/Modal";
@@ -40,63 +41,27 @@ const DIALOG_WIDTH = {
40
41
  lg: "880px"
41
42
  };
42
43
 
43
- /* Feedback — the thumbs up / down slot. Down-vote reuses the up icon,
44
- rotated (the DS set only ships ThumbUpOutlineIcon). */
45
- const StyledFeedback = styled.div.withConfig({
46
- displayName: "MessageDialog__StyledFeedback",
47
- componentId: "sc-1kt5lil-0"
48
- })(["display:flex;align-items:center;justify-content:center;gap:8px;padding:8px 24px 28px;", "{padding:4px 24px 24px;}.fb-question{margin-right:4px;}.fb-btn svg{width:18px;height:18px;}.fb-down svg{transform:rotate(180deg);}"], screenBelow.sm);
49
- const DialogFeedback = _ref => {
50
- let onVote = _ref.onVote;
51
- const _useState = useState(null),
52
- voted = _useState[0],
53
- setVoted = _useState[1];
54
- const vote = useCallback(value => {
55
- setVoted(value);
56
- onVote == null || onVote(value);
57
- }, [onVote]);
58
- return /*#__PURE__*/React.createElement(StyledFeedback, null, voted ? /*#__PURE__*/React.createElement(Body2, {
59
- color: "secondary"
60
- }, "Thanks for your feedback!") : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Body2, {
61
- color: "secondary",
62
- className: "fb-question"
63
- }, "Was this helpful?"), /*#__PURE__*/React.createElement(Tooltip, {
64
- title: "Yes, helpful"
65
- }, /*#__PURE__*/React.createElement(IconButton, {
66
- type: "button",
67
- variant: "text gray",
68
- className: "fb-btn",
69
- "aria-label": "Yes, helpful",
70
- onClick: () => vote("up")
71
- }, /*#__PURE__*/React.createElement(ThumbUpOutlineIcon, null))), /*#__PURE__*/React.createElement(Tooltip, {
72
- title: "No, not helpful"
73
- }, /*#__PURE__*/React.createElement(IconButton, {
74
- type: "button",
75
- variant: "text gray",
76
- className: "fb-btn fb-down",
77
- "aria-label": "No, not helpful",
78
- onClick: () => vote("down")
79
- }, /*#__PURE__*/React.createElement(ThumbUpOutlineIcon, null)))));
80
- };
81
-
82
44
  /* The shell is behaviour only: it sizes itself, closes on click-outside /
83
45
  Esc (DS Modal) / the X, and shows the feedback slot when an onVote handler
84
46
  is supplied. Content is whatever the caller renders as children — usually
85
47
  the Portable Text engine with the demo catalog injected. */
86
48
  const StyledDialog = styled.div.withConfig({
87
49
  displayName: "MessageDialog__StyledDialog",
88
- componentId: "sc-1kt5lil-1"
89
- })(["position:relative;box-sizing:border-box;display:flex;flex-direction:column;width:calc(100% - 32px);max-width:", ";max-height:calc(100vh - 96px);margin:56px auto 40px;overflow-y:auto;background-color:var(--page-paper-main);color:var(--color-theme-900);border-radius:12px;box-shadow:var(--shadow-primary);", "{margin:16px auto;}.dlg-close{position:absolute;top:12px;right:12px;z-index:2;}.dlg-content{padding:40px;}", "{.dlg-content{padding:32px 20px 24px;}}"], _ref2 => {
90
- let $size = _ref2.$size;
50
+ componentId: "sc-1kt5lil-0"
51
+ })(["position:relative;box-sizing:border-box;display:flex;flex-direction:column;width:calc(100% - 32px);max-width:", ";max-height:calc(100vh - 96px);margin:56px auto 40px;overflow-y:auto;background-color:var(--page-paper-main);color:var(--color-theme-900);border-radius:12px;box-shadow:var(--shadow-primary);", "{margin:16px auto;}.dlg-close{position:absolute;top:12px;right:12px;z-index:2;}.dlg-content{padding:40px;}", "{.dlg-content{padding:32px 20px 24px;}}"], _ref => {
52
+ let $size = _ref.$size;
91
53
  return DIALOG_WIDTH[$size];
92
54
  }, screenBelow.sm, screenBelow.sm);
93
- export const MessageDialog = _ref3 => {
94
- let open = _ref3.open,
95
- onClose = _ref3.onClose,
96
- _ref3$size = _ref3.size,
97
- size = _ref3$size === void 0 ? "md" : _ref3$size,
98
- onVote = _ref3.onVote,
99
- children = _ref3.children;
55
+ export const MessageDialog = _ref2 => {
56
+ let open = _ref2.open,
57
+ onClose = _ref2.onClose,
58
+ _ref2$size = _ref2.size,
59
+ size = _ref2$size === void 0 ? "md" : _ref2$size,
60
+ _ref2$feedback = _ref2.feedback,
61
+ feedback = _ref2$feedback === void 0 ? false : _ref2$feedback,
62
+ onVote = _ref2.onVote,
63
+ onFeedbackSubmit = _ref2.onFeedbackSubmit,
64
+ children = _ref2.children;
100
65
  return /*#__PURE__*/React.createElement(Modal, {
101
66
  open: open,
102
67
  onClose: onClose
@@ -113,8 +78,9 @@ export const MessageDialog = _ref3 => {
113
78
  onClick: onClose
114
79
  }, /*#__PURE__*/React.createElement(CancelCrossIcon, null)))), /*#__PURE__*/React.createElement("div", {
115
80
  className: "dlg-content"
116
- }, children), onVote ? /*#__PURE__*/React.createElement(DialogFeedback, {
117
- onVote: onVote
81
+ }, children), feedback ? /*#__PURE__*/React.createElement(MessageFeedback, {
82
+ onVote: onVote,
83
+ onSubmit: onFeedbackSubmit
118
84
  }) : null));
119
85
  };
120
86
 
@@ -133,20 +99,20 @@ export const DocLinkContext = /*#__PURE__*/React.createContext(() => undefined);
133
99
  /* interface-name — the name of an interface element, e.g. the Security page. */
134
100
  const StyledInterfaceName = styled.span.withConfig({
135
101
  displayName: "MessageDialog__StyledInterfaceName",
136
- componentId: "sc-1kt5lil-2"
102
+ componentId: "sc-1kt5lil-1"
137
103
  })(["padding:0 4px;border-radius:4px;background-color:var(--color-theme-300);color:var(--color-theme-900);font-weight:600;white-space:nowrap;"]);
138
- const InterfaceNameMark = _ref4 => {
139
- let children = _ref4.children;
104
+ const InterfaceNameMark = _ref3 => {
105
+ let children = _ref3.children;
140
106
  return /*#__PURE__*/React.createElement(StyledInterfaceName, null, children);
141
107
  };
142
108
 
143
109
  /* keyboard-key — a keyboard key cap. */
144
110
  const StyledKeyboardKey = styled.kbd.withConfig({
145
111
  displayName: "MessageDialog__StyledKeyboardKey",
146
- componentId: "sc-1kt5lil-3"
112
+ componentId: "sc-1kt5lil-2"
147
113
  })(["display:inline-flex;align-items:center;justify-content:center;min-width:20px;height:20px;padding:0 6px;border:1px solid var(--border-primary);border-bottom-width:2px;border-radius:5px;background-color:var(--color-theme-200);color:var(--color-theme-900);font-family:ui-monospace,\"SFMono-Regular\",Menlo,Consolas,monospace;font-size:11px;font-weight:600;line-height:1;vertical-align:baseline;"]);
148
- const KeyboardKeyMark = _ref5 => {
149
- let children = _ref5.children;
114
+ const KeyboardKeyMark = _ref4 => {
115
+ let children = _ref4.children;
150
116
  return /*#__PURE__*/React.createElement(StyledKeyboardKey, null, children);
151
117
  };
152
118
 
@@ -158,11 +124,11 @@ const KeyboardKeyMark = _ref5 => {
158
124
  surrounding copy — just recoloured. */
159
125
  const StyledDocLink = styled(InlineLink).withConfig({
160
126
  displayName: "MessageDialog__StyledDocLink",
161
- componentId: "sc-1kt5lil-4"
127
+ componentId: "sc-1kt5lil-3"
162
128
  })(["color:var(--color-secondary);text-decoration-color:var(--color-secondary);"]);
163
- const DocLinkMark = _ref6 => {
164
- let mark = _ref6.mark,
165
- children = _ref6.children;
129
+ const DocLinkMark = _ref5 => {
130
+ let mark = _ref5.mark,
131
+ children = _ref5.children;
166
132
  const openArticle = useContext(DocLinkContext);
167
133
  return /*#__PURE__*/React.createElement(StyledDocLink, {
168
134
  href: "#",
@@ -183,12 +149,12 @@ const CALLOUT_TYPE = {
183
149
  note: "note",
184
150
  success: "success"
185
151
  };
186
- const CalloutObject = _ref7 => {
187
- var _ref8;
188
- let node = _ref7.node,
189
- children = _ref7.children;
152
+ const CalloutObject = _ref6 => {
153
+ var _ref7;
154
+ let node = _ref6.node,
155
+ children = _ref6.children;
190
156
  return /*#__PURE__*/React.createElement(InfoBox, {
191
- type: CALLOUT_TYPE[(_ref8 = node.tone) != null ? _ref8 : "info"],
157
+ type: CALLOUT_TYPE[(_ref7 = node.tone) != null ? _ref7 : "info"],
192
158
  title: node.title,
193
159
  showIcon: true
194
160
  }, children);
@@ -199,18 +165,18 @@ const CalloutObject = _ref7 => {
199
165
  intentionally non-interactive. */
200
166
  const StyledButtonReference = styled.div.withConfig({
201
167
  displayName: "MessageDialog__StyledButtonReference",
202
- componentId: "sc-1kt5lil-5"
168
+ componentId: "sc-1kt5lil-4"
203
169
  })(["display:flex;.c-button{pointer-events:none;}"]);
204
- const ButtonReferenceObject = _ref9 => {
205
- var _ref0;
206
- let node = _ref9.node;
170
+ const ButtonReferenceObject = _ref8 => {
171
+ var _ref9;
172
+ let node = _ref8.node;
207
173
  if (typeof node.label !== "string") {
208
174
  return null;
209
175
  }
210
176
  return /*#__PURE__*/React.createElement(StyledButtonReference, {
211
177
  "aria-hidden": "true"
212
178
  }, /*#__PURE__*/React.createElement(Button, {
213
- variant: (_ref0 = node.variant) != null ? _ref0 : "primary",
179
+ variant: (_ref9 = node.variant) != null ? _ref9 : "primary",
214
180
  size: "small",
215
181
  type: "button",
216
182
  tabIndex: -1
@@ -218,22 +184,22 @@ const ButtonReferenceObject = _ref9 => {
218
184
  };
219
185
 
220
186
  /* row — a horizontal run of blocks (e.g. two button references). */
221
- const RowObject = _ref1 => {
222
- var _ref10;
223
- let node = _ref1.node,
224
- children = _ref1.children;
187
+ const RowObject = _ref0 => {
188
+ var _ref1;
189
+ let node = _ref0.node,
190
+ children = _ref0.children;
225
191
  return /*#__PURE__*/React.createElement(Row, {
226
- space: (_ref10 = node.space) != null ? _ref10 : "sm"
192
+ space: (_ref1 = node.space) != null ? _ref1 : "sm"
227
193
  }, children);
228
194
  };
229
195
 
230
196
  /* tiles — an equal-size mosaic of blocks. */
231
- const TilesObject = _ref11 => {
232
- var _ref12;
233
- let node = _ref11.node,
234
- children = _ref11.children;
197
+ const TilesObject = _ref10 => {
198
+ var _ref11;
199
+ let node = _ref10.node,
200
+ children = _ref10.children;
235
201
  return /*#__PURE__*/React.createElement(Tiles, {
236
- columns: (_ref12 = node.columns) != null ? _ref12 : 3,
202
+ columns: (_ref11 = node.columns) != null ? _ref11 : 3,
237
203
  space: "md",
238
204
  collapseBelow: "sm"
239
205
  }, children);
@@ -243,12 +209,12 @@ const TilesObject = _ref11 => {
243
209
  screenshots sit on the right, flat illustrations on the left. `widths` is
244
210
  authored as [text, media] and reordered with the columns. */
245
211
 
246
- const SplitObject = _ref13 => {
247
- var _ref14;
248
- let node = _ref13.node,
249
- children = _ref13.children;
212
+ const SplitObject = _ref12 => {
213
+ var _ref13;
214
+ let node = _ref12.node,
215
+ children = _ref12.children;
250
216
  const media = node.media;
251
- const widths = (_ref14 = node.widths) != null ? _ref14 : [1, 1];
217
+ const widths = (_ref13 = node.widths) != null ? _ref13 : [1, 1];
252
218
  const textColumn = /*#__PURE__*/React.createElement(Stack, {
253
219
  space: "lg"
254
220
  }, children);
@@ -277,15 +243,15 @@ const SplitObject = _ref13 => {
277
243
  /* The engine's defaults use Body 1 primary; the messages are designed on the
278
244
  quieter Body 2 secondary voice, so the catalog overrides the text blocks —
279
245
  demonstrating the `blocks` half of the injection contract. */
280
- const ParagraphBlock = _ref15 => {
281
- let children = _ref15.children;
246
+ const ParagraphBlock = _ref14 => {
247
+ let children = _ref14.children;
282
248
  return /*#__PURE__*/React.createElement(Body2, {
283
249
  color: "secondary",
284
250
  lineHeight: "loose"
285
251
  }, children);
286
252
  };
287
- const ListItemBlock = _ref16 => {
288
- let children = _ref16.children;
253
+ const ListItemBlock = _ref15 => {
254
+ let children = _ref15.children;
289
255
  return /*#__PURE__*/React.createElement(Typography, {
290
256
  variant: "Body 2",
291
257
  as: "li",
@@ -297,12 +263,12 @@ const ListItemBlock = _ref16 => {
297
263
  /* Titled sections speak in the quiet Header2 subhead voice rather than the
298
264
  engine's default Title2 for level 2, and keep a roomier rhythm between a
299
265
  titled section's content nodes. */
300
- const TitledTextBlock = _ref17 => {
301
- let block = _ref17.block,
302
- children = _ref17.children;
303
- const _ref18 = block,
304
- title = _ref18.title,
305
- level = _ref18.level;
266
+ const TitledTextBlock = _ref16 => {
267
+ let block = _ref16.block,
268
+ children = _ref16.children;
269
+ const _ref17 = block,
270
+ title = _ref17.title,
271
+ level = _ref17.level;
306
272
  return /*#__PURE__*/React.createElement(TitledText, {
307
273
  title: title,
308
274
  variant: level === 1 ? "title1" : "header2"
@@ -1 +1 @@
1
- {"version":3,"file":"MessageDialog.js","names":["React","useCallback","useContext","useState","styled","screenBelow","Button","Columns","IconButton","CancelCrossIcon","ThumbUpOutlineIcon","InfoBox","Media","Modal","StyledLink","InlineLink","Row","Stack","Tiles","TitledText","Tooltip","Body2","Typography","DIALOG_WIDTH","sm","md","lg","StyledFeedback","div","withConfig","displayName","componentId","DialogFeedback","_ref","onVote","_useState","voted","setVoted","vote","value","createElement","color","Fragment","className","title","type","variant","onClick","StyledDialog","_ref2","$size","MessageDialog","_ref3","open","onClose","_ref3$size","size","children","DocLinkContext","createContext","undefined","StyledInterfaceName","span","InterfaceNameMark","_ref4","StyledKeyboardKey","kbd","KeyboardKeyMark","_ref5","StyledDocLink","DocLinkMark","_ref6","mark","openArticle","href","event","preventDefault","article","CALLOUT_TYPE","info","note","success","CalloutObject","_ref7","_ref8","node","tone","showIcon","StyledButtonReference","ButtonReferenceObject","_ref9","_ref0","label","tabIndex","RowObject","_ref1","_ref10","space","TilesObject","_ref11","_ref12","columns","collapseBelow","SplitObject","_ref13","_ref14","media","widths","textColumn","src","screenshot","mediaColumn","alt","caption","reverse","alignY","ParagraphBlock","_ref15","lineHeight","ListItemBlock","_ref16","as","TitledTextBlock","_ref17","block","_ref18","level","messageComponents","marks","objects","callout","row","tiles","split","blocks","paragraph"],"sources":["../../../../src/presentation/shared/MessageDialog.tsx"],"sourcesContent":["import React, {\n ReactElement,\n ReactNode,\n useCallback,\n useContext,\n useState,\n} from \"react\";\n\nimport styled from \"styled-components\";\n\nimport { screenBelow } from \"../../components/BreakPoints\";\nimport { Button } from \"../../components/Button\";\nimport { Columns } from \"../../components/Columns\";\nimport { IconButton } from \"../../components/IconButton\";\nimport { CancelCrossIcon, ThumbUpOutlineIcon } from \"../../components/Icons\";\nimport { InfoBox, InfoBoxType } from \"../../components/InfoBox\";\nimport { Space } from \"../../components/LayoutTokens\";\nimport { Media } from \"../../components/Media\";\nimport { Modal } from \"../../components/Modal\";\nimport {\n PortableTextBlockRenderer,\n PortableTextComponents,\n PortableTextMarkRenderer,\n PortableTextMediaImageVariant,\n PortableTextObjectRenderer,\n PortableTextTitledTextBlock,\n} from \"../../components/PortableText\";\nimport { StyledLink as InlineLink } from \"../../components/PortableText/Styles\";\nimport { Row } from \"../../components/Row\";\nimport { Stack } from \"../../components/Stack\";\nimport { Tiles } from \"../../components/Tiles\";\nimport { TitledText } from \"../../components/TitledText\";\nimport { Tooltip } from \"../../components/Tooltip\";\nimport { Body2 } from \"../../components/Typography\";\nimport { Typography } from \"../../components/Typography/Typography\";\n\n/**\n * The in-app message dialog, as a Presentation mock.\n *\n * Two pieces, mirroring how the product is split:\n *\n * - {@link MessageDialog} — the hollow dialog shell (width, closing,\n * feedback), built only from design-system parts. In the product this shell\n * lives in the application as `InAppMessageDialog`.\n * - {@link messageComponents} — a demo message element catalog injected into\n * the design-system Portable Text engine, exactly like the typed cards\n * injected into the hollow StackedCard shell. In the product the catalog is\n * application code; the presentation ships this demo copy so the stories\n * need no app imports.\n */\n\n/* ---- the dialog shell ---------------------------------------------- */\n\nexport type MessageDialogSize = \"sm\" | \"md\" | \"lg\";\n\nconst DIALOG_WIDTH: Record<MessageDialogSize, string> = {\n sm: \"520px\",\n md: \"720px\",\n lg: \"880px\",\n};\n\n/* Feedback — the thumbs up / down slot. Down-vote reuses the up icon,\n rotated (the DS set only ships ThumbUpOutlineIcon). */\nconst StyledFeedback = styled.div`\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n padding: 8px 24px 28px;\n\n ${screenBelow.sm} {\n padding: 4px 24px 24px;\n }\n\n .fb-question {\n margin-right: 4px;\n }\n\n .fb-btn svg {\n width: 18px;\n height: 18px;\n }\n\n .fb-down svg {\n transform: rotate(180deg);\n }\n`;\n\nconst DialogFeedback = ({\n onVote,\n}: {\n onVote?: (vote: \"up\" | \"down\") => void;\n}): ReactElement => {\n const [voted, setVoted] = useState<\"up\" | \"down\" | null>(null);\n const vote = useCallback(\n (value: \"up\" | \"down\") => {\n setVoted(value);\n onVote?.(value);\n },\n [onVote]\n );\n\n return (\n <StyledFeedback>\n {voted ? (\n <Body2 color=\"secondary\">Thanks for your feedback!</Body2>\n ) : (\n <>\n <Body2 color=\"secondary\" className=\"fb-question\">\n Was this helpful?\n </Body2>\n <Tooltip title=\"Yes, helpful\">\n <IconButton\n type=\"button\"\n variant=\"text gray\"\n className=\"fb-btn\"\n aria-label=\"Yes, helpful\"\n onClick={() => vote(\"up\")}\n >\n <ThumbUpOutlineIcon />\n </IconButton>\n </Tooltip>\n <Tooltip title=\"No, not helpful\">\n <IconButton\n type=\"button\"\n variant=\"text gray\"\n className=\"fb-btn fb-down\"\n aria-label=\"No, not helpful\"\n onClick={() => vote(\"down\")}\n >\n <ThumbUpOutlineIcon />\n </IconButton>\n </Tooltip>\n </>\n )}\n </StyledFeedback>\n );\n};\n\n/* The shell is behaviour only: it sizes itself, closes on click-outside /\n Esc (DS Modal) / the X, and shows the feedback slot when an onVote handler\n is supplied. Content is whatever the caller renders as children — usually\n the Portable Text engine with the demo catalog injected. */\nconst StyledDialog = styled.div<{ $size: MessageDialogSize }>`\n position: relative;\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n width: calc(100% - 32px);\n max-width: ${({ $size }) => DIALOG_WIDTH[$size]};\n max-height: calc(100vh - 96px);\n margin: 56px auto 40px;\n overflow-y: auto;\n background-color: var(--page-paper-main);\n color: var(--color-theme-900);\n border-radius: 12px;\n box-shadow: var(--shadow-primary);\n\n ${screenBelow.sm} {\n margin: 16px auto;\n }\n\n /* X floats in the corner and overlaps the content padding — it does not\n reserve a row of its own. */\n .dlg-close {\n position: absolute;\n top: 12px;\n right: 12px;\n z-index: 2;\n }\n\n .dlg-content {\n padding: 40px;\n }\n\n ${screenBelow.sm} {\n .dlg-content {\n padding: 32px 20px 24px;\n }\n }\n`;\n\nexport interface MessageDialogProps {\n open: boolean;\n onClose: () => void;\n size?: MessageDialogSize;\n /** Supplying a handler shows the centred helpful / not-helpful vote. */\n onVote?: (vote: \"up\" | \"down\") => void;\n children: ReactNode;\n}\n\nexport const MessageDialog = ({\n open,\n onClose,\n size = \"md\",\n onVote,\n children,\n}: MessageDialogProps): ReactElement => (\n <Modal open={open} onClose={onClose}>\n <StyledDialog $size={size}>\n <div className=\"dlg-close\">\n <Tooltip title=\"Close\">\n <IconButton\n type=\"button\"\n variant=\"text gray\"\n aria-label=\"Close\"\n onClick={onClose}\n >\n <CancelCrossIcon />\n </IconButton>\n </Tooltip>\n </div>\n <div className=\"dlg-content\">{children}</div>\n {onVote ? <DialogFeedback onVote={onVote} /> : null}\n </StyledDialog>\n </Modal>\n);\n\n/* ---- doc-link wiring ------------------------------------------------ */\n\n/** How a doc-link mark opens its article (by a slug-like reference). The\n surface that renders the message supplies the handler — in the product it\n closes the dialog and opens the article Sheet. */\nexport type OpenArticleHandler = (article?: string) => void;\n\nexport const DocLinkContext = React.createContext<OpenArticleHandler>(\n () => undefined\n);\n\n/* ---- the demo message element catalog ------------------------------- */\n\n/* Inline marks ------------------------------------------------------- */\n\n/* interface-name — the name of an interface element, e.g. the Security page. */\nconst StyledInterfaceName = styled.span`\n padding: 0 4px;\n border-radius: 4px;\n background-color: var(--color-theme-300);\n color: var(--color-theme-900);\n font-weight: 600;\n white-space: nowrap;\n`;\nconst InterfaceNameMark: PortableTextMarkRenderer = ({ children }) => (\n <StyledInterfaceName>{children}</StyledInterfaceName>\n);\n\n/* keyboard-key — a keyboard key cap. */\nconst StyledKeyboardKey = styled.kbd`\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: 20px;\n height: 20px;\n padding: 0 6px;\n border: 1px solid var(--border-primary);\n border-bottom-width: 2px;\n border-radius: 5px;\n background-color: var(--color-theme-200);\n color: var(--color-theme-900);\n font-family: ui-monospace, \"SFMono-Regular\", Menlo, Consolas, monospace;\n font-size: 11px;\n font-weight: 600;\n line-height: 1;\n vertical-align: baseline;\n`;\nconst KeyboardKeyMark: PortableTextMarkRenderer = ({ children }) => (\n <StyledKeyboardKey>{children}</StyledKeyboardKey>\n);\n\n/* doc-link — an inline link that opens a full help article. The mark carries\n an article reference; the open behaviour comes from DocLinkContext, so the\n authored content stays declarative. */\n/* Built on the engine's inline anchor so a doc-link sits in the sentence\n exactly like a default link mark — same size, weight and line box as the\n surrounding copy — just recoloured. */\nconst StyledDocLink = styled(InlineLink)`\n color: var(--color-secondary);\n text-decoration-color: var(--color-secondary);\n`;\nconst DocLinkMark: PortableTextMarkRenderer = ({ mark, children }) => {\n const openArticle = useContext(DocLinkContext);\n return (\n <StyledDocLink\n href=\"#\"\n onClick={(event: React.MouseEvent) => {\n event.preventDefault();\n openArticle(mark?.article as string | undefined);\n }}\n >\n {children}\n </StyledDocLink>\n );\n};\n\n/* Component objects --------------------------------------------------- */\n\n/* callout — rendered with the DS InfoBox; the catalog keeps its own tone\n vocabulary and maps it to InfoBox types. */\ntype CalloutTone = \"info\" | \"note\" | \"success\";\nconst CALLOUT_TYPE: Record<CalloutTone, InfoBoxType> = {\n info: \"default\",\n note: \"note\",\n success: \"success\",\n};\nconst CalloutObject: PortableTextObjectRenderer = ({ node, children }) => (\n <InfoBox\n type={CALLOUT_TYPE[(node.tone as CalloutTone | undefined) ?? \"info\"]}\n title={node.title as string | undefined}\n showIcon\n >\n {children}\n </InfoBox>\n);\n\n/* button-reference — a real DS Button shown for reference as its own block,\n so a message can point at a button instead of screenshotting it. It is\n intentionally non-interactive. */\nconst StyledButtonReference = styled.div`\n display: flex;\n\n .c-button {\n pointer-events: none;\n }\n`;\ntype ButtonReferenceVariant =\n | \"primary\"\n | \"secondary\"\n | \"text colored\"\n | \"text gray\";\nconst ButtonReferenceObject: PortableTextObjectRenderer = ({ node }) => {\n if (typeof node.label !== \"string\") {\n return null;\n }\n\n return (\n <StyledButtonReference aria-hidden=\"true\">\n <Button\n variant={\n (node.variant as ButtonReferenceVariant | undefined) ?? \"primary\"\n }\n size=\"small\"\n type=\"button\"\n tabIndex={-1}\n >\n {node.label}\n </Button>\n </StyledButtonReference>\n );\n};\n\n/* row — a horizontal run of blocks (e.g. two button references). */\nconst RowObject: PortableTextObjectRenderer = ({ node, children }) => (\n <Row space={(node.space as Space | undefined) ?? \"sm\"}>{children}</Row>\n);\n\n/* tiles — an equal-size mosaic of blocks. */\nconst TilesObject: PortableTextObjectRenderer = ({ node, children }) => (\n <Tiles\n columns={(node.columns as number | undefined) ?? 3}\n space=\"md\"\n collapseBelow=\"sm\"\n >\n {children}\n </Tiles>\n);\n\n/* split — text beside media, with the one layout rule the messages follow:\n screenshots sit on the right, flat illustrations on the left. `widths` is\n authored as [text, media] and reordered with the columns. */\ninterface SplitMedia {\n src: string;\n alt?: string;\n // Split never carries a video: video media always stays in the vertical flow.\n variant?: PortableTextMediaImageVariant;\n caption?: string;\n}\nconst SplitObject: PortableTextObjectRenderer = ({ node, children }) => {\n const media = node.media as SplitMedia | undefined;\n const widths = (node.widths as number[] | undefined) ?? [1, 1];\n const textColumn = <Stack space=\"lg\">{children}</Stack>;\n\n // A split without media degrades to its text column instead of crashing.\n if (!media?.src) {\n return textColumn;\n }\n\n const screenshot = media.variant === \"screenshot\";\n\n const mediaColumn = (\n <Media\n src={media.src}\n alt={media.alt}\n variant={media.variant}\n caption={media.caption}\n />\n );\n\n return (\n <Columns\n widths={screenshot ? widths : [...widths].reverse()}\n space=\"xl\"\n alignY=\"center\"\n collapseBelow=\"md\"\n >\n {screenshot ? textColumn : mediaColumn}\n {screenshot ? mediaColumn : textColumn}\n </Columns>\n );\n};\n\n/* Default-block overrides --------------------------------------------- */\n\n/* The engine's defaults use Body 1 primary; the messages are designed on the\n quieter Body 2 secondary voice, so the catalog overrides the text blocks —\n demonstrating the `blocks` half of the injection contract. */\nconst ParagraphBlock: PortableTextBlockRenderer = ({ children }) => (\n <Body2 color=\"secondary\" lineHeight=\"loose\">\n {children}\n </Body2>\n);\n\nconst ListItemBlock: PortableTextBlockRenderer = ({ children }) => (\n <Typography variant=\"Body 2\" as=\"li\" color=\"secondary\" lineHeight=\"loose\">\n {children}\n </Typography>\n);\n\n/* Titled sections speak in the quiet Header2 subhead voice rather than the\n engine's default Title2 for level 2, and keep a roomier rhythm between a\n titled section's content nodes. */\nconst TitledTextBlock: PortableTextBlockRenderer = ({ block, children }) => {\n const { title, level } = block as PortableTextTitledTextBlock;\n\n return (\n <TitledText title={title} variant={level === 1 ? \"title1\" : \"header2\"}>\n {children ? <Stack space=\"sm\">{children}</Stack> : undefined}\n </TitledText>\n );\n};\n\n/** The demo catalog the presentations inject into the Portable Text engine —\n the stand-in for the application's `messageComponents` map. */\nexport const messageComponents: PortableTextComponents = {\n marks: {\n \"interface-name\": InterfaceNameMark,\n \"keyboard-key\": KeyboardKeyMark,\n \"doc-link\": DocLinkMark,\n },\n objects: {\n callout: CalloutObject,\n \"button-reference\": ButtonReferenceObject,\n row: RowObject,\n tiles: TilesObject,\n split: SplitObject,\n },\n blocks: {\n paragraph: ParagraphBlock,\n \"list-item\": ListItemBlock,\n \"titled-text\": TitledTextBlock,\n },\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IAGVC,WAAW,EACXC,UAAU,EACVC,QAAQ,QACH,OAAO;AAEd,OAAOC,MAAM,MAAM,mBAAmB;AAEtC,SAASC,WAAW,QAAQ,8BAA8B;AAC1D,SAASC,MAAM,QAAQ,yBAAyB;AAChD,SAASC,OAAO,QAAQ,0BAA0B;AAClD,SAASC,UAAU,QAAQ,6BAA6B;AACxD,SAASC,eAAe,EAAEC,kBAAkB,QAAQ,wBAAwB;AAC5E,SAASC,OAAO,QAAqB,0BAA0B;AAE/D,SAASC,KAAK,QAAQ,wBAAwB;AAC9C,SAASC,KAAK,QAAQ,wBAAwB;AAS9C,SAASC,UAAU,IAAIC,UAAU,QAAQ,sCAAsC;AAC/E,SAASC,GAAG,QAAQ,sBAAsB;AAC1C,SAASC,KAAK,QAAQ,wBAAwB;AAC9C,SAASC,KAAK,QAAQ,wBAAwB;AAC9C,SAASC,UAAU,QAAQ,6BAA6B;AACxD,SAASC,OAAO,QAAQ,0BAA0B;AAClD,SAASC,KAAK,QAAQ,6BAA6B;AACnD,SAASC,UAAU,QAAQ,wCAAwC;;AAEnE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAIA,MAAMC,YAA+C,GAAG;EACtDC,EAAE,EAAE,OAAO;EACXC,EAAE,EAAE,OAAO;EACXC,EAAE,EAAE;AACN,CAAC;;AAED;AACA;AACA,MAAMC,cAAc,GAAGvB,MAAM,CAACwB,GAAG,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,oOAO7B1B,WAAW,CAACmB,EAAE,CAgBjB;AAED,M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,MAAMiE,eAA0C,GAAGC,MAAA,IAAyB;EAAA,IAAtBC,KAAK,GAAAD,MAAA,CAALC,KAAK;IAAEnE,QAAQ,GAAAkE,MAAA,CAARlE,QAAQ;EACnE,MAAAoE,MAAA,GAAyBD,KAAK;IAAtBhF,KAAK,GAAAiF,MAAA,CAALjF,KAAK;IAAEkF,KAAK,GAAAD,MAAA,CAALC,KAAK;EAEpB,oBACE9H,KAAA,CAAAwC,aAAA,CAACrB,UAAU;IAACyB,KAAK,EAAEA,KAAM;IAACE,OAAO,EAAEgF,KAAK,KAAK,CAAC,GAAG,QAAQ,GAAG;EAAU,GACnErE,QAAQ,gBAAGzD,KAAA,CAAAwC,aAAA,CAACvB,KAAK;IAACgF,KAAK,EAAC;EAAI,GAAExC,QAAgB,CAAC,GAAGG,SACzC,CAAC;AAEjB,CAAC;;AAED;AACA;AACA,OAAO,MAAMmE,iBAAyC,GAAG;EACvDC,KAAK,EAAE;IACL,gBAAgB,EAAEjE,iBAAiB;IACnC,cAAc,EAAEI,eAAe;IAC/B,UAAU,EAAEG;EACd,CAAC;EACD2D,OAAO,EAAE;IACPC,OAAO,EAAEhD,aAAa;IACtB,kBAAkB,EAAEO,qBAAqB;IACzC0C,GAAG,EAAErC,SAAS;IACdsC,KAAK,EAAElC,WAAW;IAClBmC,KAAK,EAAE9B;EACT,CAAC;EACD+B,MAAM,EAAE;IACNC,SAAS,EAAEnB,cAAc;IACzB,WAAW,EAAEG,aAAa;IAC1B,aAAa,EAAEG;EACjB;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"MessageDialog.js","names":["React","useContext","styled","MessageFeedback","screenBelow","Button","Columns","IconButton","CancelCrossIcon","InfoBox","Media","Modal","StyledLink","InlineLink","Row","Stack","Tiles","TitledText","Tooltip","Body2","Typography","DIALOG_WIDTH","sm","md","lg","StyledDialog","div","withConfig","displayName","componentId","_ref","$size","MessageDialog","_ref2","open","onClose","_ref2$size","size","_ref2$feedback","feedback","onVote","onFeedbackSubmit","children","createElement","className","title","type","variant","onClick","onSubmit","DocLinkContext","createContext","undefined","StyledInterfaceName","span","InterfaceNameMark","_ref3","StyledKeyboardKey","kbd","KeyboardKeyMark","_ref4","StyledDocLink","DocLinkMark","_ref5","mark","openArticle","href","event","preventDefault","article","CALLOUT_TYPE","info","note","success","CalloutObject","_ref6","_ref7","node","tone","showIcon","StyledButtonReference","ButtonReferenceObject","_ref8","_ref9","label","tabIndex","RowObject","_ref0","_ref1","space","TilesObject","_ref10","_ref11","columns","collapseBelow","SplitObject","_ref12","_ref13","media","widths","textColumn","src","screenshot","mediaColumn","alt","caption","reverse","alignY","ParagraphBlock","_ref14","color","lineHeight","ListItemBlock","_ref15","as","TitledTextBlock","_ref16","block","_ref17","level","messageComponents","marks","objects","callout","row","tiles","split","blocks","paragraph"],"sources":["../../../../src/presentation/shared/MessageDialog.tsx"],"sourcesContent":["import React, { ReactElement, ReactNode, useContext } from \"react\";\n\nimport styled from \"styled-components\";\n\nimport { MessageFeedback } from \"./MessageFeedback\";\nimport type { MessageFeedbackResult } from \"./MessageFeedback\";\nimport { screenBelow } from \"../../components/BreakPoints\";\nimport { Button } from \"../../components/Button\";\nimport { Columns } from \"../../components/Columns\";\nimport { IconButton } from \"../../components/IconButton\";\nimport { CancelCrossIcon } from \"../../components/Icons\";\nimport { InfoBox, InfoBoxType } from \"../../components/InfoBox\";\nimport { Space } from \"../../components/LayoutTokens\";\nimport { Media } from \"../../components/Media\";\nimport { Modal } from \"../../components/Modal\";\nimport {\n PortableTextBlockRenderer,\n PortableTextComponents,\n PortableTextMarkRenderer,\n PortableTextMediaImageVariant,\n PortableTextObjectRenderer,\n PortableTextTitledTextBlock,\n} from \"../../components/PortableText\";\nimport { StyledLink as InlineLink } from \"../../components/PortableText/Styles\";\nimport { Row } from \"../../components/Row\";\nimport { Stack } from \"../../components/Stack\";\nimport { Tiles } from \"../../components/Tiles\";\nimport { TitledText } from \"../../components/TitledText\";\nimport { Tooltip } from \"../../components/Tooltip\";\nimport { Body2 } from \"../../components/Typography\";\nimport { Typography } from \"../../components/Typography/Typography\";\n\n/**\n * The in-app message dialog, as a Presentation mock.\n *\n * Two pieces, mirroring how the product is split:\n *\n * - {@link MessageDialog} — the hollow dialog shell (width, closing,\n * feedback), built only from design-system parts. In the product this shell\n * lives in the application as `InAppMessageDialog`.\n * - {@link messageComponents} — a demo message element catalog injected into\n * the design-system Portable Text engine, exactly like the typed cards\n * injected into the hollow StackedCard shell. In the product the catalog is\n * application code; the presentation ships this demo copy so the stories\n * need no app imports.\n */\n\n/* ---- the dialog shell ---------------------------------------------- */\n\nexport type MessageDialogSize = \"sm\" | \"md\" | \"lg\";\n\nconst DIALOG_WIDTH: Record<MessageDialogSize, string> = {\n sm: \"520px\",\n md: \"720px\",\n lg: \"880px\",\n};\n\n/* The shell is behaviour only: it sizes itself, closes on click-outside /\n Esc (DS Modal) / the X, and shows the feedback slot when an onVote handler\n is supplied. Content is whatever the caller renders as children — usually\n the Portable Text engine with the demo catalog injected. */\nconst StyledDialog = styled.div<{ $size: MessageDialogSize }>`\n position: relative;\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n width: calc(100% - 32px);\n max-width: ${({ $size }) => DIALOG_WIDTH[$size]};\n max-height: calc(100vh - 96px);\n margin: 56px auto 40px;\n overflow-y: auto;\n background-color: var(--page-paper-main);\n color: var(--color-theme-900);\n border-radius: 12px;\n box-shadow: var(--shadow-primary);\n\n ${screenBelow.sm} {\n margin: 16px auto;\n }\n\n /* X floats in the corner and overlaps the content padding — it does not\n reserve a row of its own. */\n .dlg-close {\n position: absolute;\n top: 12px;\n right: 12px;\n z-index: 2;\n }\n\n .dlg-content {\n padding: 40px;\n }\n\n ${screenBelow.sm} {\n .dlg-content {\n padding: 32px 20px 24px;\n }\n }\n`;\n\nexport interface MessageDialogProps {\n open: boolean;\n onClose: () => void;\n size?: MessageDialogSize;\n /** Show the reusable helpful / not-helpful feedback flow. */\n feedback?: boolean;\n /** Fired when a thumb is pressed (the vote itself). */\n onVote?: (sentiment: \"up\" | \"down\") => void;\n /** Fired on Submit, with the chosen options and comment. */\n onFeedbackSubmit?: (result: MessageFeedbackResult) => void;\n children: ReactNode;\n}\n\nexport const MessageDialog = ({\n open,\n onClose,\n size = \"md\",\n feedback = false,\n onVote,\n onFeedbackSubmit,\n children,\n}: MessageDialogProps): ReactElement => (\n <Modal open={open} onClose={onClose}>\n <StyledDialog $size={size}>\n <div className=\"dlg-close\">\n <Tooltip title=\"Close\">\n <IconButton\n type=\"button\"\n variant=\"text gray\"\n aria-label=\"Close\"\n onClick={onClose}\n >\n <CancelCrossIcon />\n </IconButton>\n </Tooltip>\n </div>\n <div className=\"dlg-content\">{children}</div>\n {feedback ? (\n <MessageFeedback onVote={onVote} onSubmit={onFeedbackSubmit} />\n ) : null}\n </StyledDialog>\n </Modal>\n);\n\n/* ---- doc-link wiring ------------------------------------------------ */\n\n/** How a doc-link mark opens its article (by a slug-like reference). The\n surface that renders the message supplies the handler — in the product it\n closes the dialog and opens the article Sheet. */\nexport type OpenArticleHandler = (article?: string) => void;\n\nexport const DocLinkContext = React.createContext<OpenArticleHandler>(\n () => undefined\n);\n\n/* ---- the demo message element catalog ------------------------------- */\n\n/* Inline marks ------------------------------------------------------- */\n\n/* interface-name — the name of an interface element, e.g. the Security page. */\nconst StyledInterfaceName = styled.span`\n padding: 0 4px;\n border-radius: 4px;\n background-color: var(--color-theme-300);\n color: var(--color-theme-900);\n font-weight: 600;\n white-space: nowrap;\n`;\nconst InterfaceNameMark: PortableTextMarkRenderer = ({ children }) => (\n <StyledInterfaceName>{children}</StyledInterfaceName>\n);\n\n/* keyboard-key — a keyboard key cap. */\nconst StyledKeyboardKey = styled.kbd`\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: 20px;\n height: 20px;\n padding: 0 6px;\n border: 1px solid var(--border-primary);\n border-bottom-width: 2px;\n border-radius: 5px;\n background-color: var(--color-theme-200);\n color: var(--color-theme-900);\n font-family: ui-monospace, \"SFMono-Regular\", Menlo, Consolas, monospace;\n font-size: 11px;\n font-weight: 600;\n line-height: 1;\n vertical-align: baseline;\n`;\nconst KeyboardKeyMark: PortableTextMarkRenderer = ({ children }) => (\n <StyledKeyboardKey>{children}</StyledKeyboardKey>\n);\n\n/* doc-link — an inline link that opens a full help article. The mark carries\n an article reference; the open behaviour comes from DocLinkContext, so the\n authored content stays declarative. */\n/* Built on the engine's inline anchor so a doc-link sits in the sentence\n exactly like a default link mark — same size, weight and line box as the\n surrounding copy — just recoloured. */\nconst StyledDocLink = styled(InlineLink)`\n color: var(--color-secondary);\n text-decoration-color: var(--color-secondary);\n`;\nconst DocLinkMark: PortableTextMarkRenderer = ({ mark, children }) => {\n const openArticle = useContext(DocLinkContext);\n return (\n <StyledDocLink\n href=\"#\"\n onClick={(event: React.MouseEvent) => {\n event.preventDefault();\n openArticle(mark?.article as string | undefined);\n }}\n >\n {children}\n </StyledDocLink>\n );\n};\n\n/* Component objects --------------------------------------------------- */\n\n/* callout — rendered with the DS InfoBox; the catalog keeps its own tone\n vocabulary and maps it to InfoBox types. */\ntype CalloutTone = \"info\" | \"note\" | \"success\";\nconst CALLOUT_TYPE: Record<CalloutTone, InfoBoxType> = {\n info: \"default\",\n note: \"note\",\n success: \"success\",\n};\nconst CalloutObject: PortableTextObjectRenderer = ({ node, children }) => (\n <InfoBox\n type={CALLOUT_TYPE[(node.tone as CalloutTone | undefined) ?? \"info\"]}\n title={node.title as string | undefined}\n showIcon\n >\n {children}\n </InfoBox>\n);\n\n/* button-reference — a real DS Button shown for reference as its own block,\n so a message can point at a button instead of screenshotting it. It is\n intentionally non-interactive. */\nconst StyledButtonReference = styled.div`\n display: flex;\n\n .c-button {\n pointer-events: none;\n }\n`;\ntype ButtonReferenceVariant =\n | \"primary\"\n | \"secondary\"\n | \"text colored\"\n | \"text gray\";\nconst ButtonReferenceObject: PortableTextObjectRenderer = ({ node }) => {\n if (typeof node.label !== \"string\") {\n return null;\n }\n\n return (\n <StyledButtonReference aria-hidden=\"true\">\n <Button\n variant={\n (node.variant as ButtonReferenceVariant | undefined) ?? \"primary\"\n }\n size=\"small\"\n type=\"button\"\n tabIndex={-1}\n >\n {node.label}\n </Button>\n </StyledButtonReference>\n );\n};\n\n/* row — a horizontal run of blocks (e.g. two button references). */\nconst RowObject: PortableTextObjectRenderer = ({ node, children }) => (\n <Row space={(node.space as Space | undefined) ?? \"sm\"}>{children}</Row>\n);\n\n/* tiles — an equal-size mosaic of blocks. */\nconst TilesObject: PortableTextObjectRenderer = ({ node, children }) => (\n <Tiles\n columns={(node.columns as number | undefined) ?? 3}\n space=\"md\"\n collapseBelow=\"sm\"\n >\n {children}\n </Tiles>\n);\n\n/* split — text beside media, with the one layout rule the messages follow:\n screenshots sit on the right, flat illustrations on the left. `widths` is\n authored as [text, media] and reordered with the columns. */\ninterface SplitMedia {\n src: string;\n alt?: string;\n // Split never carries a video: video media always stays in the vertical flow.\n variant?: PortableTextMediaImageVariant;\n caption?: string;\n}\nconst SplitObject: PortableTextObjectRenderer = ({ node, children }) => {\n const media = node.media as SplitMedia | undefined;\n const widths = (node.widths as number[] | undefined) ?? [1, 1];\n const textColumn = <Stack space=\"lg\">{children}</Stack>;\n\n // A split without media degrades to its text column instead of crashing.\n if (!media?.src) {\n return textColumn;\n }\n\n const screenshot = media.variant === \"screenshot\";\n\n const mediaColumn = (\n <Media\n src={media.src}\n alt={media.alt}\n variant={media.variant}\n caption={media.caption}\n />\n );\n\n return (\n <Columns\n widths={screenshot ? widths : [...widths].reverse()}\n space=\"xl\"\n alignY=\"center\"\n collapseBelow=\"md\"\n >\n {screenshot ? textColumn : mediaColumn}\n {screenshot ? mediaColumn : textColumn}\n </Columns>\n );\n};\n\n/* Default-block overrides --------------------------------------------- */\n\n/* The engine's defaults use Body 1 primary; the messages are designed on the\n quieter Body 2 secondary voice, so the catalog overrides the text blocks —\n demonstrating the `blocks` half of the injection contract. */\nconst ParagraphBlock: PortableTextBlockRenderer = ({ children }) => (\n <Body2 color=\"secondary\" lineHeight=\"loose\">\n {children}\n </Body2>\n);\n\nconst ListItemBlock: PortableTextBlockRenderer = ({ children }) => (\n <Typography variant=\"Body 2\" as=\"li\" color=\"secondary\" lineHeight=\"loose\">\n {children}\n </Typography>\n);\n\n/* Titled sections speak in the quiet Header2 subhead voice rather than the\n engine's default Title2 for level 2, and keep a roomier rhythm between a\n titled section's content nodes. */\nconst TitledTextBlock: PortableTextBlockRenderer = ({ block, children }) => {\n const { title, level } = block as PortableTextTitledTextBlock;\n\n return (\n <TitledText title={title} variant={level === 1 ? \"title1\" : \"header2\"}>\n {children ? <Stack space=\"sm\">{children}</Stack> : undefined}\n </TitledText>\n );\n};\n\n/** The demo catalog the presentations inject into the Portable Text engine —\n the stand-in for the application's `messageComponents` map. */\nexport const messageComponents: PortableTextComponents = {\n marks: {\n \"interface-name\": InterfaceNameMark,\n \"keyboard-key\": KeyboardKeyMark,\n \"doc-link\": DocLinkMark,\n },\n objects: {\n callout: CalloutObject,\n \"button-reference\": ButtonReferenceObject,\n row: RowObject,\n tiles: TilesObject,\n split: SplitObject,\n },\n blocks: {\n paragraph: ParagraphBlock,\n \"list-item\": ListItemBlock,\n \"titled-text\": TitledTextBlock,\n },\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IAA6BC,UAAU,QAAQ,OAAO;AAElE,OAAOC,MAAM,MAAM,mBAAmB;AAEtC,SAASC,eAAe,QAAQ,mBAAmB;AAEnD,SAASC,WAAW,QAAQ,8BAA8B;AAC1D,SAASC,MAAM,QAAQ,yBAAyB;AAChD,SAASC,OAAO,QAAQ,0BAA0B;AAClD,SAASC,UAAU,QAAQ,6BAA6B;AACxD,SAASC,eAAe,QAAQ,wBAAwB;AACxD,SAASC,OAAO,QAAqB,0BAA0B;AAE/D,SAASC,KAAK,QAAQ,wBAAwB;AAC9C,SAASC,KAAK,QAAQ,wBAAwB;AAS9C,SAASC,UAAU,IAAIC,UAAU,QAAQ,sCAAsC;AAC/E,SAASC,GAAG,QAAQ,sBAAsB;AAC1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CAAC;EACDgC,MAAM,EAAE;IACNC,SAAS,EAAEpB,cAAc;IACzB,WAAW,EAAEI,aAAa;IAC1B,aAAa,EAAEG;EACjB;AACF,CAAC","ignoreList":[]}
@@ -0,0 +1,54 @@
1
+ import { ReactElement, ReactNode } from "react";
2
+ /**
3
+ * MessageFeedback — the reusable "Was this helpful?" flow, as a Presentation
4
+ * mock.
5
+ *
6
+ * It is built only from design-system parts and owns the whole flow, so any
7
+ * content surface (the message dialog, a help article, a settings panel) can
8
+ * drop it in and get the same behaviour:
9
+ *
10
+ * 1. Prompt — an inline "Was this helpful?" row with a thumb up / down.
11
+ * 2. Details — a centred dialog: option chips for the chosen sentiment,
12
+ * plus an optional free-text comment. Submit or Cancel.
13
+ * 3. Thank you — a short confirmation, then the prompt shows a quiet
14
+ * "Thanks for your feedback!".
15
+ *
16
+ * The vote is recorded the moment a thumb is pressed (`onVote`), so a user who
17
+ * cancels the details step still leaves a valid vote — the same contract the
18
+ * trial Feedback flow uses. The details are reported on Submit (`onSubmit`).
19
+ *
20
+ * In the product this lives in application code; the presentation ships this
21
+ * demo copy so the stories need no app imports.
22
+ */
23
+ export type FeedbackSentiment = "up" | "down";
24
+ export interface FeedbackOption {
25
+ /** Stable id sent with the feedback record; not shown to the user. */
26
+ id: string;
27
+ /** The chip label the user sees. */
28
+ label: string;
29
+ }
30
+ export interface MessageFeedbackResult {
31
+ sentiment: FeedbackSentiment;
32
+ /** The ids of the chosen option chips. */
33
+ options: string[];
34
+ /** The free-text comment, trimmed; "" when left blank. */
35
+ comment: string;
36
+ }
37
+ export declare const POSITIVE_FEEDBACK_OPTIONS: FeedbackOption[];
38
+ export declare const NEGATIVE_FEEDBACK_OPTIONS: FeedbackOption[];
39
+ export interface MessageFeedbackProps {
40
+ /** The inline prompt copy. */
41
+ question?: ReactNode;
42
+ /** Details-dialog title for a thumb up / down. */
43
+ positiveTitle?: string;
44
+ negativeTitle?: string;
45
+ /** Option catalogs; default to the content-feedback sets above. */
46
+ positiveOptions?: FeedbackOption[];
47
+ negativeOptions?: FeedbackOption[];
48
+ /** Fired the moment a thumb is pressed (the vote itself). */
49
+ onVote?: (sentiment: FeedbackSentiment) => void;
50
+ /** Fired on Submit, with the chosen options and comment. */
51
+ onSubmit?: (result: MessageFeedbackResult) => void;
52
+ }
53
+ export declare const MessageFeedback: ({ question, positiveTitle, negativeTitle, positiveOptions, negativeOptions, onVote, onSubmit, }: MessageFeedbackProps) => ReactElement;
54
+ //# sourceMappingURL=MessageFeedback.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MessageFeedback.d.ts","sourceRoot":"","sources":["../../../../src/presentation/shared/MessageFeedback.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,YAAY,EAAE,SAAS,EAAyB,MAAM,OAAO,CAAC;AAe9E;;;;;;;;;;;;;;;;;;;;GAoBG;AAIH,MAAM,MAAM,iBAAiB,GAAG,IAAI,GAAG,MAAM,CAAC;AAE9C,MAAM,WAAW,cAAc;IAC7B,sEAAsE;IACtE,EAAE,EAAE,MAAM,CAAC;IACX,oCAAoC;IACpC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,iBAAiB,CAAC;IAC7B,0CAA0C;IAC1C,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,0DAA0D;IAC1D,OAAO,EAAE,MAAM,CAAC;CACjB;AAKD,eAAO,MAAM,yBAAyB,EAAE,cAAc,EAOrD,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,cAAc,EAUrD,CAAC;AA+GF,MAAM,WAAW,oBAAoB;IACnC,8BAA8B;IAC9B,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,kDAAkD;IAClD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mEAAmE;IACnE,eAAe,CAAC,EAAE,cAAc,EAAE,CAAC;IACnC,eAAe,CAAC,EAAE,cAAc,EAAE,CAAC;IACnC,6DAA6D;IAC7D,MAAM,CAAC,EAAE,CAAC,SAAS,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAChD,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,KAAK,IAAI,CAAC;CACpD;AAED,eAAO,MAAM,eAAe,GAAI,iGAQ7B,oBAAoB,KAAG,YA8IzB,CAAC"}