@activecollab/components 2.0.416 → 2.0.418
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/PortableText/renderers.js +5 -2
- package/dist/cjs/components/PortableText/renderers.js.map +1 -1
- package/dist/cjs/components/PortableText/types.js +2 -1
- package/dist/cjs/components/PortableText/types.js.map +1 -1
- package/dist/cjs/components/PortableText/types.test.js +18 -0
- package/dist/cjs/components/PortableText/types.test.js.map +1 -1
- package/dist/cjs/components/TitledText/TitledText.js +5 -1
- package/dist/cjs/components/TitledText/TitledText.js.map +1 -1
- package/dist/cjs/presentation/shared/MessageDialog.js +62 -107
- package/dist/cjs/presentation/shared/MessageDialog.js.map +1 -1
- package/dist/cjs/presentation/shared/MessageFeedback.js +284 -0
- package/dist/cjs/presentation/shared/MessageFeedback.js.map +1 -0
- package/dist/cjs/presentation/shared/index.js +22 -0
- package/dist/cjs/presentation/shared/index.js.map +1 -1
- package/dist/esm/components/PortableText/renderers.js +5 -2
- package/dist/esm/components/PortableText/renderers.js.map +1 -1
- package/dist/esm/components/PortableText/types.d.ts +6 -0
- package/dist/esm/components/PortableText/types.d.ts.map +1 -1
- package/dist/esm/components/PortableText/types.js +2 -1
- package/dist/esm/components/PortableText/types.js.map +1 -1
- package/dist/esm/components/PortableText/types.test.js +18 -0
- package/dist/esm/components/PortableText/types.test.js.map +1 -1
- package/dist/esm/components/TitledText/TitledText.d.ts +7 -3
- package/dist/esm/components/TitledText/TitledText.d.ts.map +1 -1
- package/dist/esm/components/TitledText/TitledText.js +5 -1
- package/dist/esm/components/TitledText/TitledText.js.map +1 -1
- package/dist/esm/presentation/shared/MessageDialog.d.ts +8 -3
- package/dist/esm/presentation/shared/MessageDialog.d.ts.map +1 -1
- package/dist/esm/presentation/shared/MessageDialog.js +64 -98
- package/dist/esm/presentation/shared/MessageDialog.js.map +1 -1
- package/dist/esm/presentation/shared/MessageFeedback.d.ts +54 -0
- package/dist/esm/presentation/shared/MessageFeedback.d.ts.map +1 -0
- package/dist/esm/presentation/shared/MessageFeedback.js +252 -0
- package/dist/esm/presentation/shared/MessageFeedback.js.map +1 -0
- package/dist/esm/presentation/shared/index.d.ts +2 -0
- package/dist/esm/presentation/shared/index.d.ts.map +1 -1
- package/dist/esm/presentation/shared/index.js +1 -0
- package/dist/esm/presentation/shared/index.js.map +1 -1
- package/dist/index.js +12 -4
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.POSITIVE_FEEDBACK_OPTIONS = exports.NEGATIVE_FEEDBACK_OPTIONS = exports.MessageFeedback = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
|
+
var _BreakPoints = require("../../components/BreakPoints");
|
|
10
|
+
var _Button = require("../../components/Button");
|
|
11
|
+
var _Dialog = require("../../components/Dialog");
|
|
12
|
+
var _IconButton = require("../../components/IconButton");
|
|
13
|
+
var _Icons = require("../../components/Icons");
|
|
14
|
+
var _Label = require("../../components/Label");
|
|
15
|
+
var _Textarea = require("../../components/Textarea");
|
|
16
|
+
var _Tooltip = require("../../components/Tooltip");
|
|
17
|
+
var _Typography = require("../../components/Typography");
|
|
18
|
+
var _Typography2 = require("../../components/Typography/Typography");
|
|
19
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
20
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
21
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
22
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
23
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
24
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
25
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
26
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
27
|
+
/**
|
|
28
|
+
* MessageFeedback — the reusable "Was this helpful?" flow, as a Presentation
|
|
29
|
+
* mock.
|
|
30
|
+
*
|
|
31
|
+
* It is built only from design-system parts and owns the whole flow, so any
|
|
32
|
+
* content surface (the message dialog, a help article, a settings panel) can
|
|
33
|
+
* drop it in and get the same behaviour:
|
|
34
|
+
*
|
|
35
|
+
* 1. Prompt — an inline "Was this helpful?" row with a thumb up / down.
|
|
36
|
+
* 2. Details — a centred dialog: option chips for the chosen sentiment,
|
|
37
|
+
* plus an optional free-text comment. Submit or Cancel.
|
|
38
|
+
* 3. Thank you — a short confirmation, then the prompt shows a quiet
|
|
39
|
+
* "Thanks for your feedback!".
|
|
40
|
+
*
|
|
41
|
+
* The vote is recorded the moment a thumb is pressed (`onVote`), so a user who
|
|
42
|
+
* cancels the details step still leaves a valid vote — the same contract the
|
|
43
|
+
* trial Feedback flow uses. The details are reported on Submit (`onSubmit`).
|
|
44
|
+
*
|
|
45
|
+
* In the product this lives in application code; the presentation ships this
|
|
46
|
+
* demo copy so the stories need no app imports.
|
|
47
|
+
*/
|
|
48
|
+
|
|
49
|
+
/* ---- public types & default option catalogs ------------------------ */
|
|
50
|
+
|
|
51
|
+
/* The options rate the one piece of content, not the whole product. Each
|
|
52
|
+
negative option maps to an action a writer can take. Override per surface
|
|
53
|
+
through the component props. */
|
|
54
|
+
var POSITIVE_FEEDBACK_OPTIONS = exports.POSITIVE_FEEDBACK_OPTIONS = [{
|
|
55
|
+
id: "clear",
|
|
56
|
+
label: "Clear and easy to understand"
|
|
57
|
+
}, {
|
|
58
|
+
id: "answered",
|
|
59
|
+
label: "Answered my question"
|
|
60
|
+
}, {
|
|
61
|
+
id: "right-detail",
|
|
62
|
+
label: "Right amount of detail"
|
|
63
|
+
}, {
|
|
64
|
+
id: "helped-use",
|
|
65
|
+
label: "Helped me use the feature"
|
|
66
|
+
}, {
|
|
67
|
+
id: "good-examples",
|
|
68
|
+
label: "Good examples or screenshots"
|
|
69
|
+
}, {
|
|
70
|
+
id: "other",
|
|
71
|
+
label: "Other"
|
|
72
|
+
}];
|
|
73
|
+
var NEGATIVE_FEEDBACK_OPTIONS = exports.NEGATIVE_FEEDBACK_OPTIONS = [{
|
|
74
|
+
id: "not-answered",
|
|
75
|
+
label: "Did not answer my question"
|
|
76
|
+
}, {
|
|
77
|
+
id: "confusing",
|
|
78
|
+
label: "Confusing or hard to follow"
|
|
79
|
+
}, {
|
|
80
|
+
id: "too-long",
|
|
81
|
+
label: "Too long"
|
|
82
|
+
}, {
|
|
83
|
+
id: "not-enough-detail",
|
|
84
|
+
label: "Not enough detail"
|
|
85
|
+
}, {
|
|
86
|
+
id: "out-of-date",
|
|
87
|
+
label: "Out of date or incorrect"
|
|
88
|
+
}, {
|
|
89
|
+
id: "wrong-plan-role",
|
|
90
|
+
label: "Wrong for my plan or role"
|
|
91
|
+
}, {
|
|
92
|
+
id: "not-found",
|
|
93
|
+
label: "I could not find what I needed"
|
|
94
|
+
}, {
|
|
95
|
+
id: "broken",
|
|
96
|
+
label: "Something is broken"
|
|
97
|
+
}, {
|
|
98
|
+
id: "other",
|
|
99
|
+
label: "Other"
|
|
100
|
+
}];
|
|
101
|
+
|
|
102
|
+
/* ---- the inline prompt row ----------------------------------------- */
|
|
103
|
+
|
|
104
|
+
/* Down-vote reuses the up icon, rotated (the DS set only ships
|
|
105
|
+
ThumbUpOutlineIcon). */
|
|
106
|
+
var StyledPrompt = _styledComponents.default.div.withConfig({
|
|
107
|
+
displayName: "MessageFeedback__StyledPrompt",
|
|
108
|
+
componentId: "sc-1i96o75-0"
|
|
109
|
+
})(["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);}"], _BreakPoints.screenBelow.sm);
|
|
110
|
+
|
|
111
|
+
/* ---- the details dialog -------------------------------------------- */
|
|
112
|
+
|
|
113
|
+
var StyledForm = _styledComponents.default.div.withConfig({
|
|
114
|
+
displayName: "MessageFeedback__StyledForm",
|
|
115
|
+
componentId: "sc-1i96o75-1"
|
|
116
|
+
})(["display:flex;flex-direction:column;gap:20px;.fb-field{display:flex;flex-direction:column;gap:8px;}.fb-chips{display:flex;flex-wrap:wrap;gap:8px;}.c-textarea{width:100%;box-sizing:border-box;}"]);
|
|
117
|
+
|
|
118
|
+
/* The option chip — a pill that toggles to the theme primary tint when
|
|
119
|
+
selected. Translated from the trial Feedback chip into styled-components
|
|
120
|
+
(runtime tw- classes do not work in the presentation storybook). The label
|
|
121
|
+
text is a DS Body2 so it carries the correct font. */
|
|
122
|
+
var StyledChip = _styledComponents.default.button.withConfig({
|
|
123
|
+
displayName: "MessageFeedback__StyledChip",
|
|
124
|
+
componentId: "sc-1i96o75-2"
|
|
125
|
+
})(["display:inline-flex;align-items:center;box-sizing:border-box;margin:0;padding:3px 8px 4px;border:1px solid ", ";border-radius:4px;background-color:", ";cursor:pointer;transition:border-color 120ms ease,background-color 120ms ease;&:hover{border-color:var(--color-primary);}"], function (_ref) {
|
|
126
|
+
var $selected = _ref.$selected;
|
|
127
|
+
return $selected ? "var(--color-primary)" : "var(--color-theme-500)";
|
|
128
|
+
}, function (_ref2) {
|
|
129
|
+
var $selected = _ref2.$selected;
|
|
130
|
+
return $selected ? "var(--color-primary-300)" : "transparent";
|
|
131
|
+
});
|
|
132
|
+
var FeedbackChip = function FeedbackChip(_ref3) {
|
|
133
|
+
var option = _ref3.option,
|
|
134
|
+
selected = _ref3.selected,
|
|
135
|
+
onToggle = _ref3.onToggle;
|
|
136
|
+
return /*#__PURE__*/_react.default.createElement(StyledChip, {
|
|
137
|
+
type: "button",
|
|
138
|
+
$selected: selected,
|
|
139
|
+
"aria-pressed": selected,
|
|
140
|
+
onClick: function onClick() {
|
|
141
|
+
return onToggle(option.id);
|
|
142
|
+
}
|
|
143
|
+
}, /*#__PURE__*/_react.default.createElement(_Typography2.Typography, {
|
|
144
|
+
variant: "Body 2",
|
|
145
|
+
as: "span"
|
|
146
|
+
}, option.label));
|
|
147
|
+
};
|
|
148
|
+
var StyledActions = _styledComponents.default.div.withConfig({
|
|
149
|
+
displayName: "MessageFeedback__StyledActions",
|
|
150
|
+
componentId: "sc-1i96o75-3"
|
|
151
|
+
})(["display:flex;gap:12px;"]);
|
|
152
|
+
|
|
153
|
+
/* ---- the component ------------------------------------------------- */
|
|
154
|
+
|
|
155
|
+
var MessageFeedback = exports.MessageFeedback = function MessageFeedback(_ref4) {
|
|
156
|
+
var _ref4$question = _ref4.question,
|
|
157
|
+
question = _ref4$question === void 0 ? "Was this helpful?" : _ref4$question,
|
|
158
|
+
_ref4$positiveTitle = _ref4.positiveTitle,
|
|
159
|
+
positiveTitle = _ref4$positiveTitle === void 0 ? "What was good?" : _ref4$positiveTitle,
|
|
160
|
+
_ref4$negativeTitle = _ref4.negativeTitle,
|
|
161
|
+
negativeTitle = _ref4$negativeTitle === void 0 ? "What went wrong?" : _ref4$negativeTitle,
|
|
162
|
+
_ref4$positiveOptions = _ref4.positiveOptions,
|
|
163
|
+
positiveOptions = _ref4$positiveOptions === void 0 ? POSITIVE_FEEDBACK_OPTIONS : _ref4$positiveOptions,
|
|
164
|
+
_ref4$negativeOptions = _ref4.negativeOptions,
|
|
165
|
+
negativeOptions = _ref4$negativeOptions === void 0 ? NEGATIVE_FEEDBACK_OPTIONS : _ref4$negativeOptions,
|
|
166
|
+
onVote = _ref4.onVote,
|
|
167
|
+
onSubmit = _ref4.onSubmit;
|
|
168
|
+
var _useState = (0, _react.useState)(null),
|
|
169
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
170
|
+
sentiment = _useState2[0],
|
|
171
|
+
setSentiment = _useState2[1];
|
|
172
|
+
var _useState3 = (0, _react.useState)("closed"),
|
|
173
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
174
|
+
stage = _useState4[0],
|
|
175
|
+
setStage = _useState4[1];
|
|
176
|
+
var _useState5 = (0, _react.useState)([]),
|
|
177
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
178
|
+
selected = _useState6[0],
|
|
179
|
+
setSelected = _useState6[1];
|
|
180
|
+
var _useState7 = (0, _react.useState)(""),
|
|
181
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
182
|
+
comment = _useState8[0],
|
|
183
|
+
setComment = _useState8[1];
|
|
184
|
+
var _useState9 = (0, _react.useState)(false),
|
|
185
|
+
_useState0 = _slicedToArray(_useState9, 2),
|
|
186
|
+
done = _useState0[0],
|
|
187
|
+
setDone = _useState0[1];
|
|
188
|
+
var vote = (0, _react.useCallback)(function (value) {
|
|
189
|
+
setSentiment(value);
|
|
190
|
+
setSelected([]);
|
|
191
|
+
setComment("");
|
|
192
|
+
onVote === null || onVote === void 0 || onVote(value);
|
|
193
|
+
setStage("details");
|
|
194
|
+
}, [onVote]);
|
|
195
|
+
var toggleOption = (0, _react.useCallback)(function (id) {
|
|
196
|
+
setSelected(function (current) {
|
|
197
|
+
return current.includes(id) ? current.filter(function (one) {
|
|
198
|
+
return one !== id;
|
|
199
|
+
}) : [...current, id];
|
|
200
|
+
});
|
|
201
|
+
}, []);
|
|
202
|
+
var submit = (0, _react.useCallback)(function () {
|
|
203
|
+
if (sentiment) {
|
|
204
|
+
onSubmit === null || onSubmit === void 0 || onSubmit({
|
|
205
|
+
sentiment,
|
|
206
|
+
options: selected,
|
|
207
|
+
comment: comment.trim()
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
setStage("closed");
|
|
211
|
+
setDone(true);
|
|
212
|
+
}, [sentiment, selected, comment, onSubmit]);
|
|
213
|
+
|
|
214
|
+
/* Cancel keeps the vote (already sent on the thumb press) and closes. */
|
|
215
|
+
var finish = (0, _react.useCallback)(function () {
|
|
216
|
+
setStage("closed");
|
|
217
|
+
setDone(true);
|
|
218
|
+
}, []);
|
|
219
|
+
var isPositive = sentiment === "up";
|
|
220
|
+
var options = isPositive ? positiveOptions : negativeOptions;
|
|
221
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(StyledPrompt, null, done ? /*#__PURE__*/_react.default.createElement(_Typography.Body2, {
|
|
222
|
+
color: "secondary"
|
|
223
|
+
}, "Thank you for the feedback!") : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Typography.Body2, {
|
|
224
|
+
color: "secondary",
|
|
225
|
+
className: "fb-question"
|
|
226
|
+
}, question), /*#__PURE__*/_react.default.createElement(_Tooltip.Tooltip, {
|
|
227
|
+
title: "Yes, helpful"
|
|
228
|
+
}, /*#__PURE__*/_react.default.createElement(_IconButton.IconButton, {
|
|
229
|
+
type: "button",
|
|
230
|
+
variant: "text gray",
|
|
231
|
+
className: "fb-btn",
|
|
232
|
+
"aria-label": "Yes, helpful",
|
|
233
|
+
onClick: function onClick() {
|
|
234
|
+
return vote("up");
|
|
235
|
+
}
|
|
236
|
+
}, /*#__PURE__*/_react.default.createElement(_Icons.ThumbUpOutlineIcon, null))), /*#__PURE__*/_react.default.createElement(_Tooltip.Tooltip, {
|
|
237
|
+
title: "No, not helpful"
|
|
238
|
+
}, /*#__PURE__*/_react.default.createElement(_IconButton.IconButton, {
|
|
239
|
+
type: "button",
|
|
240
|
+
variant: "text gray",
|
|
241
|
+
className: "fb-btn fb-down",
|
|
242
|
+
"aria-label": "No, not helpful",
|
|
243
|
+
onClick: function onClick() {
|
|
244
|
+
return vote("down");
|
|
245
|
+
}
|
|
246
|
+
}, /*#__PURE__*/_react.default.createElement(_Icons.ThumbUpOutlineIcon, null))))), /*#__PURE__*/_react.default.createElement(_Dialog.Dialog, {
|
|
247
|
+
open: stage !== "closed",
|
|
248
|
+
onClose: finish,
|
|
249
|
+
enableBackgroundClick: true
|
|
250
|
+
}, stage === "details" ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Dialog.Dialog.Title, null, isPositive ? positiveTitle : negativeTitle), /*#__PURE__*/_react.default.createElement(_Dialog.Dialog.ContentDivider, null), /*#__PURE__*/_react.default.createElement(_Dialog.Dialog.Content, null, /*#__PURE__*/_react.default.createElement(StyledForm, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
251
|
+
className: "fb-field"
|
|
252
|
+
}, /*#__PURE__*/_react.default.createElement(_Label.Label, null, "Select all that apply"), /*#__PURE__*/_react.default.createElement("div", {
|
|
253
|
+
className: "fb-chips"
|
|
254
|
+
}, options.map(function (option) {
|
|
255
|
+
return /*#__PURE__*/_react.default.createElement(FeedbackChip, {
|
|
256
|
+
key: option.id,
|
|
257
|
+
option: option,
|
|
258
|
+
selected: selected.includes(option.id),
|
|
259
|
+
onToggle: toggleOption
|
|
260
|
+
});
|
|
261
|
+
}))), /*#__PURE__*/_react.default.createElement("div", {
|
|
262
|
+
className: "fb-field"
|
|
263
|
+
}, /*#__PURE__*/_react.default.createElement(_Label.Label, {
|
|
264
|
+
htmlFor: "fb-comment"
|
|
265
|
+
}, "Tell us more (optional)"), /*#__PURE__*/_react.default.createElement(_Textarea.Textarea, {
|
|
266
|
+
id: "fb-comment",
|
|
267
|
+
value: comment,
|
|
268
|
+
placeholder: isPositive ? "What made this useful?" : "What would have helped?",
|
|
269
|
+
onChange: function onChange(event) {
|
|
270
|
+
return setComment(event.target.value);
|
|
271
|
+
}
|
|
272
|
+
})))), /*#__PURE__*/_react.default.createElement(_Dialog.Dialog.ContentDivider, null), /*#__PURE__*/_react.default.createElement(_Dialog.Dialog.Actions, null, /*#__PURE__*/_react.default.createElement(StyledActions, null, /*#__PURE__*/_react.default.createElement(_Button.Button, {
|
|
273
|
+
variant: "primary",
|
|
274
|
+
size: "small",
|
|
275
|
+
type: "button",
|
|
276
|
+
onClick: submit
|
|
277
|
+
}, "Submit"), /*#__PURE__*/_react.default.createElement(_Button.Button, {
|
|
278
|
+
variant: "secondary",
|
|
279
|
+
size: "small",
|
|
280
|
+
type: "button",
|
|
281
|
+
onClick: finish
|
|
282
|
+
}, "Cancel")))) : null));
|
|
283
|
+
};
|
|
284
|
+
//# sourceMappingURL=MessageFeedback.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MessageFeedback.js","names":["_react","_interopRequireWildcard","require","_styledComponents","_interopRequireDefault","_BreakPoints","_Button","_Dialog","_IconButton","_Icons","_Label","_Textarea","_Tooltip","_Typography","_Typography2","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","_t","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_slicedToArray","_arrayWithHoles","_iterableToArrayLimit","_unsupportedIterableToArray","_nonIterableRest","TypeError","a","_arrayLikeToArray","toString","slice","constructor","name","Array","from","test","length","l","Symbol","iterator","u","next","done","push","value","return","isArray","POSITIVE_FEEDBACK_OPTIONS","exports","id","label","NEGATIVE_FEEDBACK_OPTIONS","StyledPrompt","styled","div","withConfig","displayName","componentId","screenBelow","sm","StyledForm","StyledChip","button","_ref","$selected","_ref2","FeedbackChip","_ref3","option","selected","onToggle","createElement","type","onClick","Typography","variant","as","StyledActions","MessageFeedback","_ref4","_ref4$question","question","_ref4$positiveTitle","positiveTitle","_ref4$negativeTitle","negativeTitle","_ref4$positiveOptions","positiveOptions","_ref4$negativeOptions","negativeOptions","onVote","onSubmit","_useState","useState","_useState2","sentiment","setSentiment","_useState3","_useState4","stage","setStage","_useState5","_useState6","setSelected","_useState7","_useState8","comment","setComment","_useState9","_useState0","setDone","vote","useCallback","toggleOption","current","includes","filter","one","submit","options","trim","finish","isPositive","Fragment","Body2","color","className","Tooltip","title","IconButton","ThumbUpOutlineIcon","Dialog","open","onClose","enableBackgroundClick","Title","ContentDivider","Content","Label","map","key","htmlFor","Textarea","placeholder","onChange","event","target","Actions","Button","size"],"sources":["../../../../src/presentation/shared/MessageFeedback.tsx"],"sourcesContent":["import React, { ReactElement, ReactNode, useCallback, useState } from \"react\";\n\nimport styled from \"styled-components\";\n\nimport { screenBelow } from \"../../components/BreakPoints\";\nimport { Button } from \"../../components/Button\";\nimport { Dialog } from \"../../components/Dialog\";\nimport { IconButton } from \"../../components/IconButton\";\nimport { ThumbUpOutlineIcon } from \"../../components/Icons\";\nimport { Label } from \"../../components/Label\";\nimport { Textarea } from \"../../components/Textarea\";\nimport { Tooltip } from \"../../components/Tooltip\";\nimport { Body2 } from \"../../components/Typography\";\nimport { Typography } from \"../../components/Typography/Typography\";\n\n/**\n * MessageFeedback — the reusable \"Was this helpful?\" flow, as a Presentation\n * mock.\n *\n * It is built only from design-system parts and owns the whole flow, so any\n * content surface (the message dialog, a help article, a settings panel) can\n * drop it in and get the same behaviour:\n *\n * 1. Prompt — an inline \"Was this helpful?\" row with a thumb up / down.\n * 2. Details — a centred dialog: option chips for the chosen sentiment,\n * plus an optional free-text comment. Submit or Cancel.\n * 3. Thank you — a short confirmation, then the prompt shows a quiet\n * \"Thanks for your feedback!\".\n *\n * The vote is recorded the moment a thumb is pressed (`onVote`), so a user who\n * cancels the details step still leaves a valid vote — the same contract the\n * trial Feedback flow uses. The details are reported on Submit (`onSubmit`).\n *\n * In the product this lives in application code; the presentation ships this\n * demo copy so the stories need no app imports.\n */\n\n/* ---- public types & default option catalogs ------------------------ */\n\nexport type FeedbackSentiment = \"up\" | \"down\";\n\nexport interface FeedbackOption {\n /** Stable id sent with the feedback record; not shown to the user. */\n id: string;\n /** The chip label the user sees. */\n label: string;\n}\n\nexport interface MessageFeedbackResult {\n sentiment: FeedbackSentiment;\n /** The ids of the chosen option chips. */\n options: string[];\n /** The free-text comment, trimmed; \"\" when left blank. */\n comment: string;\n}\n\n/* The options rate the one piece of content, not the whole product. Each\n negative option maps to an action a writer can take. Override per surface\n through the component props. */\nexport const POSITIVE_FEEDBACK_OPTIONS: FeedbackOption[] = [\n { id: \"clear\", label: \"Clear and easy to understand\" },\n { id: \"answered\", label: \"Answered my question\" },\n { id: \"right-detail\", label: \"Right amount of detail\" },\n { id: \"helped-use\", label: \"Helped me use the feature\" },\n { id: \"good-examples\", label: \"Good examples or screenshots\" },\n { id: \"other\", label: \"Other\" },\n];\n\nexport const NEGATIVE_FEEDBACK_OPTIONS: FeedbackOption[] = [\n { id: \"not-answered\", label: \"Did not answer my question\" },\n { id: \"confusing\", label: \"Confusing or hard to follow\" },\n { id: \"too-long\", label: \"Too long\" },\n { id: \"not-enough-detail\", label: \"Not enough detail\" },\n { id: \"out-of-date\", label: \"Out of date or incorrect\" },\n { id: \"wrong-plan-role\", label: \"Wrong for my plan or role\" },\n { id: \"not-found\", label: \"I could not find what I needed\" },\n { id: \"broken\", label: \"Something is broken\" },\n { id: \"other\", label: \"Other\" },\n];\n\n/* ---- the inline prompt row ----------------------------------------- */\n\n/* Down-vote reuses the up icon, rotated (the DS set only ships\n ThumbUpOutlineIcon). */\nconst StyledPrompt = 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\n/* ---- the details dialog -------------------------------------------- */\n\nconst StyledForm = styled.div`\n display: flex;\n flex-direction: column;\n gap: 20px;\n\n .fb-field {\n display: flex;\n flex-direction: column;\n gap: 8px;\n }\n\n .fb-chips {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n }\n\n /* DS Textarea is a fixed 360px; let it fill the dialog width instead. */\n .c-textarea {\n width: 100%;\n box-sizing: border-box;\n }\n`;\n\n/* The option chip — a pill that toggles to the theme primary tint when\n selected. Translated from the trial Feedback chip into styled-components\n (runtime tw- classes do not work in the presentation storybook). The label\n text is a DS Body2 so it carries the correct font. */\nconst StyledChip = styled.button<{ $selected: boolean }>`\n display: inline-flex;\n align-items: center;\n box-sizing: border-box;\n margin: 0;\n padding: 3px 8px 4px;\n border: 1px solid\n ${({ $selected }) =>\n $selected ? \"var(--color-primary)\" : \"var(--color-theme-500)\"};\n border-radius: 4px;\n background-color: ${({ $selected }) =>\n $selected ? \"var(--color-primary-300)\" : \"transparent\"};\n cursor: pointer;\n transition: border-color 120ms ease, background-color 120ms ease;\n\n &:hover {\n border-color: var(--color-primary);\n }\n`;\n\nconst FeedbackChip = ({\n option,\n selected,\n onToggle,\n}: {\n option: FeedbackOption;\n selected: boolean;\n onToggle: (id: string) => void;\n}): ReactElement => (\n <StyledChip\n type=\"button\"\n $selected={selected}\n aria-pressed={selected}\n onClick={() => onToggle(option.id)}\n >\n <Typography variant=\"Body 2\" as=\"span\">\n {option.label}\n </Typography>\n </StyledChip>\n);\n\nconst StyledActions = styled.div`\n display: flex;\n gap: 12px;\n`;\n\n/* ---- the component ------------------------------------------------- */\n\ntype DialogStage = \"closed\" | \"details\";\n\nexport interface MessageFeedbackProps {\n /** The inline prompt copy. */\n question?: ReactNode;\n /** Details-dialog title for a thumb up / down. */\n positiveTitle?: string;\n negativeTitle?: string;\n /** Option catalogs; default to the content-feedback sets above. */\n positiveOptions?: FeedbackOption[];\n negativeOptions?: FeedbackOption[];\n /** Fired the moment a thumb is pressed (the vote itself). */\n onVote?: (sentiment: FeedbackSentiment) => void;\n /** Fired on Submit, with the chosen options and comment. */\n onSubmit?: (result: MessageFeedbackResult) => void;\n}\n\nexport const MessageFeedback = ({\n question = \"Was this helpful?\",\n positiveTitle = \"What was good?\",\n negativeTitle = \"What went wrong?\",\n positiveOptions = POSITIVE_FEEDBACK_OPTIONS,\n negativeOptions = NEGATIVE_FEEDBACK_OPTIONS,\n onVote,\n onSubmit,\n}: MessageFeedbackProps): ReactElement => {\n const [sentiment, setSentiment] = useState<FeedbackSentiment | null>(null);\n const [stage, setStage] = useState<DialogStage>(\"closed\");\n const [selected, setSelected] = useState<string[]>([]);\n const [comment, setComment] = useState(\"\");\n const [done, setDone] = useState(false);\n\n const vote = useCallback(\n (value: FeedbackSentiment) => {\n setSentiment(value);\n setSelected([]);\n setComment(\"\");\n onVote?.(value);\n setStage(\"details\");\n },\n [onVote]\n );\n\n const toggleOption = useCallback((id: string) => {\n setSelected((current) =>\n current.includes(id)\n ? current.filter((one) => one !== id)\n : [...current, id]\n );\n }, []);\n\n const submit = useCallback(() => {\n if (sentiment) {\n onSubmit?.({ sentiment, options: selected, comment: comment.trim() });\n }\n setStage(\"closed\");\n setDone(true);\n }, [sentiment, selected, comment, onSubmit]);\n\n /* Cancel keeps the vote (already sent on the thumb press) and closes. */\n const finish = useCallback(() => {\n setStage(\"closed\");\n setDone(true);\n }, []);\n\n const isPositive = sentiment === \"up\";\n const options = isPositive ? positiveOptions : negativeOptions;\n\n return (\n <>\n <StyledPrompt>\n {done ? (\n <Body2 color=\"secondary\">Thank you for the feedback!</Body2>\n ) : (\n <>\n <Body2 color=\"secondary\" className=\"fb-question\">\n {question}\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 </StyledPrompt>\n\n <Dialog open={stage !== \"closed\"} onClose={finish} enableBackgroundClick>\n {stage === \"details\" ? (\n <>\n <Dialog.Title>\n {isPositive ? positiveTitle : negativeTitle}\n </Dialog.Title>\n <Dialog.ContentDivider />\n <Dialog.Content>\n <StyledForm>\n <div className=\"fb-field\">\n <Label>Select all that apply</Label>\n <div className=\"fb-chips\">\n {options.map((option) => (\n <FeedbackChip\n key={option.id}\n option={option}\n selected={selected.includes(option.id)}\n onToggle={toggleOption}\n />\n ))}\n </div>\n </div>\n <div className=\"fb-field\">\n <Label htmlFor=\"fb-comment\">Tell us more (optional)</Label>\n <Textarea\n id=\"fb-comment\"\n value={comment}\n placeholder={\n isPositive\n ? \"What made this useful?\"\n : \"What would have helped?\"\n }\n onChange={(event) => setComment(event.target.value)}\n />\n </div>\n </StyledForm>\n </Dialog.Content>\n <Dialog.ContentDivider />\n <Dialog.Actions>\n <StyledActions>\n <Button\n variant=\"primary\"\n size=\"small\"\n type=\"button\"\n onClick={submit}\n >\n Submit\n </Button>\n <Button\n variant=\"secondary\"\n size=\"small\"\n type=\"button\"\n onClick={finish}\n >\n Cancel\n </Button>\n </StyledActions>\n </Dialog.Actions>\n </>\n ) : null}\n </Dialog>\n </>\n );\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,iBAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,SAAA,GAAAT,OAAA;AACA,IAAAU,QAAA,GAAAV,OAAA;AACA,IAAAW,WAAA,GAAAX,OAAA;AACA,IAAAY,YAAA,GAAAZ,OAAA;AAAoE,SAAAE,uBAAAW,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAd,wBAAAc,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAlB,uBAAA,YAAAA,wBAAAc,CAAA,EAAAG,CAAA,SAAAA,CAAA,IAAAH,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,MAAAO,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAR,OAAA,EAAAF,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAS,CAAA,MAAAF,CAAA,GAAAJ,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAE,CAAA,CAAAI,GAAA,CAAAX,CAAA,U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E,IAAI,EAAC,OAAO;IACZ7E,IAAI,EAAC,QAAQ;IACbC,OAAO,EAAE6C;EAAO,GACjB,QAEO,CAAC,eACTpI,MAAA,CAAAiB,OAAA,CAAAoE,aAAA,CAAC/E,OAAA,CAAA4J,MAAM;IACLzE,OAAO,EAAC,WAAW;IACnB0E,IAAI,EAAC,OAAO;IACZ7E,IAAI,EAAC,QAAQ;IACbC,OAAO,EAAEgD;EAAO,GACjB,QAEO,CACK,CACD,CAChB,CAAC,GACD,IACE,CACR,CAAC;AAEP,CAAC","ignoreList":[]}
|
|
@@ -15,6 +15,9 @@ var _exportNames = {
|
|
|
15
15
|
MessageDialog: true,
|
|
16
16
|
DocLinkContext: true,
|
|
17
17
|
messageComponents: true,
|
|
18
|
+
MessageFeedback: true,
|
|
19
|
+
POSITIVE_FEEDBACK_OPTIONS: true,
|
|
20
|
+
NEGATIVE_FEEDBACK_OPTIONS: true,
|
|
18
21
|
HelpAndSupportMenu: true,
|
|
19
22
|
LinkingCommandsButton: true,
|
|
20
23
|
LinkBranchOrPullRequestDialog: true,
|
|
@@ -156,6 +159,24 @@ Object.defineProperty(exports, "MessageDialog", {
|
|
|
156
159
|
return _MessageDialog.MessageDialog;
|
|
157
160
|
}
|
|
158
161
|
});
|
|
162
|
+
Object.defineProperty(exports, "MessageFeedback", {
|
|
163
|
+
enumerable: true,
|
|
164
|
+
get: function get() {
|
|
165
|
+
return _MessageFeedback.MessageFeedback;
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
Object.defineProperty(exports, "NEGATIVE_FEEDBACK_OPTIONS", {
|
|
169
|
+
enumerable: true,
|
|
170
|
+
get: function get() {
|
|
171
|
+
return _MessageFeedback.NEGATIVE_FEEDBACK_OPTIONS;
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
Object.defineProperty(exports, "POSITIVE_FEEDBACK_OPTIONS", {
|
|
175
|
+
enumerable: true,
|
|
176
|
+
get: function get() {
|
|
177
|
+
return _MessageFeedback.POSITIVE_FEEDBACK_OPTIONS;
|
|
178
|
+
}
|
|
179
|
+
});
|
|
159
180
|
Object.defineProperty(exports, "PROJECT_REPOSITORIES", {
|
|
160
181
|
enumerable: true,
|
|
161
182
|
get: function get() {
|
|
@@ -324,6 +345,7 @@ var _PresentationShell = require("./PresentationShell");
|
|
|
324
345
|
var _headers = require("./headers");
|
|
325
346
|
var _FloatingControls = require("./FloatingControls");
|
|
326
347
|
var _MessageDialog = require("./MessageDialog");
|
|
348
|
+
var _MessageFeedback = require("./MessageFeedback");
|
|
327
349
|
var _HelpAndSupportMenu = require("./HelpAndSupportMenu");
|
|
328
350
|
var _LinkingCommandsButton = require("./LinkingCommandsButton");
|
|
329
351
|
var _LinkBranchOrPullRequestDialog = require("./LinkBranchOrPullRequestDialog");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_tokens","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_MainLogo","_RoundAvatar","_PresentationShell","_headers","_FloatingControls","_MessageDialog","_HelpAndSupportMenu","_LinkingCommandsButton","_LinkBranchOrPullRequestDialog","_ConnectRepositoryDialog","_WebhookLogsDialog","_SourceCodeSection","_SuggestSubtasksButton","_TaskOptionsMenu","_UserMenu","_TwoFactorShield","_TwoFactorDialogs","_settings","_FeatureAvailability"],"sources":["../../../../src/presentation/shared/index.ts"],"sourcesContent":["/**\n * Shared building blocks for the Presentation mock-ups (`Presentation/*`\n * stories). The application shell, page headers, tab bar and small widgets are\n * defined once here and reused by the List view, Column view, Task sheet and\n * empty-page stories so the chrome stays identical and in one place.\n */\nexport * from \"./tokens\";\nexport { MainLogo } from \"./MainLogo\";\nexport { RoundAvatar } from \"./RoundAvatar\";\nexport { PresentationShell, StyledPagePaper } from \"./PresentationShell\";\nexport type { PresentationShellProps } from \"./PresentationShell\";\nexport { PageHeader, ProjectPageHeader, TabHeader } from \"./headers\";\nexport type {\n PageHeaderProps,\n ProjectPageHeaderProps,\n TabHeaderProps,\n} from \"./headers\";\nexport { FloatingControls } from \"./FloatingControls\";\nexport {\n MessageDialog,\n DocLinkContext,\n messageComponents,\n} from \"./MessageDialog\";\nexport type {\n MessageDialogProps,\n MessageDialogSize,\n OpenArticleHandler,\n} from \"./MessageDialog\";\nexport { HelpAndSupportMenu } from \"./HelpAndSupportMenu\";\nexport type { HelpAndSupportMenuProps } from \"./HelpAndSupportMenu\";\nexport { LinkingCommandsButton } from \"./LinkingCommandsButton\";\nexport { LinkBranchOrPullRequestDialog } from \"./LinkBranchOrPullRequestDialog\";\nexport type { LinkBranchOrPullRequestDialogProps } from \"./LinkBranchOrPullRequestDialog\";\nexport {\n ConnectRepositoryDialog,\n RepositorySelect,\n buildRepoOptions,\n CONNECTIONS,\n PROJECT_REPOSITORIES,\n CONNECTABLE_REPOSITORIES,\n} from \"./ConnectRepositoryDialog\";\nexport type {\n ConnectRepositoryDialogProps,\n RepositorySelectProps,\n Connection,\n ConnectionService,\n Repository,\n} from \"./ConnectRepositoryDialog\";\nexport {\n WebhookLogsDialog,\n WEBHOOK_CONNECTIONS,\n WEBHOOK_REPOSITORIES,\n} from \"./WebhookLogsDialog\";\nexport type {\n WebhookLogsDialogProps,\n WebhookConnection,\n WebhookRepository,\n WebhookLog,\n} from \"./WebhookLogsDialog\";\nexport {\n SourceCodeSection,\n IssueRow,\n CodeRow,\n Spine,\n HistoryDialog,\n CompletedHeader,\n} from \"./SourceCodeSection\";\nexport type {\n IssueEntry,\n CodeEntry,\n Stage,\n HistoryEvent,\n StageState,\n CodeStatus,\n SectionVariant,\n} from \"./SourceCodeSection\";\nexport { SuggestSubtasksButton } from \"./SuggestSubtasksButton\";\nexport { TaskOptionsMenu, TaskListOptionsMenu } from \"./TaskOptionsMenu\";\nexport type {\n TaskOptionsMenuProps,\n TaskListOptionsMenuProps,\n} from \"./TaskOptionsMenu\";\nexport { UserMenu } from \"./UserMenu\";\nexport type { UserMenuProps, UserMenuVariant } from \"./UserMenu\";\nexport { TwoFactorShield } from \"./TwoFactorShield\";\nexport type { TwoFactorShieldProps } from \"./TwoFactorShield\";\nexport { BackupCodesDialogs, CreateLoginCodeDialogs } from \"./TwoFactorDialogs\";\nexport type {\n BackupCodesDialogsProps,\n CreateLoginCodeDialogsProps,\n} from \"./TwoFactorDialogs\";\nexport {\n SettingsHeader,\n SettingsContent,\n StyledSettingRow,\n RowText,\n SettingRow,\n} from \"./settings\";\nexport type { SettingsHeaderProps, SettingRowProps } from \"./settings\";\nexport {\n FeatureAvailability,\n DEFAULT_FEATURE_AVAILABILITY,\n} from \"./FeatureAvailability\";\nexport type {\n FeatureAvailabilityProps,\n AvailabilityRow,\n AvailabilityMark,\n AvailabilityStatus,\n} from \"./FeatureAvailability\";\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":["_tokens","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_MainLogo","_RoundAvatar","_PresentationShell","_headers","_FloatingControls","_MessageDialog","_MessageFeedback","_HelpAndSupportMenu","_LinkingCommandsButton","_LinkBranchOrPullRequestDialog","_ConnectRepositoryDialog","_WebhookLogsDialog","_SourceCodeSection","_SuggestSubtasksButton","_TaskOptionsMenu","_UserMenu","_TwoFactorShield","_TwoFactorDialogs","_settings","_FeatureAvailability"],"sources":["../../../../src/presentation/shared/index.ts"],"sourcesContent":["/**\n * Shared building blocks for the Presentation mock-ups (`Presentation/*`\n * stories). The application shell, page headers, tab bar and small widgets are\n * defined once here and reused by the List view, Column view, Task sheet and\n * empty-page stories so the chrome stays identical and in one place.\n */\nexport * from \"./tokens\";\nexport { MainLogo } from \"./MainLogo\";\nexport { RoundAvatar } from \"./RoundAvatar\";\nexport { PresentationShell, StyledPagePaper } from \"./PresentationShell\";\nexport type { PresentationShellProps } from \"./PresentationShell\";\nexport { PageHeader, ProjectPageHeader, TabHeader } from \"./headers\";\nexport type {\n PageHeaderProps,\n ProjectPageHeaderProps,\n TabHeaderProps,\n} from \"./headers\";\nexport { FloatingControls } from \"./FloatingControls\";\nexport {\n MessageDialog,\n DocLinkContext,\n messageComponents,\n} from \"./MessageDialog\";\nexport type {\n MessageDialogProps,\n MessageDialogSize,\n OpenArticleHandler,\n} from \"./MessageDialog\";\nexport {\n MessageFeedback,\n POSITIVE_FEEDBACK_OPTIONS,\n NEGATIVE_FEEDBACK_OPTIONS,\n} from \"./MessageFeedback\";\nexport type {\n MessageFeedbackProps,\n MessageFeedbackResult,\n FeedbackOption,\n FeedbackSentiment,\n} from \"./MessageFeedback\";\nexport { HelpAndSupportMenu } from \"./HelpAndSupportMenu\";\nexport type { HelpAndSupportMenuProps } from \"./HelpAndSupportMenu\";\nexport { LinkingCommandsButton } from \"./LinkingCommandsButton\";\nexport { LinkBranchOrPullRequestDialog } from \"./LinkBranchOrPullRequestDialog\";\nexport type { LinkBranchOrPullRequestDialogProps } from \"./LinkBranchOrPullRequestDialog\";\nexport {\n ConnectRepositoryDialog,\n RepositorySelect,\n buildRepoOptions,\n CONNECTIONS,\n PROJECT_REPOSITORIES,\n CONNECTABLE_REPOSITORIES,\n} from \"./ConnectRepositoryDialog\";\nexport type {\n ConnectRepositoryDialogProps,\n RepositorySelectProps,\n Connection,\n ConnectionService,\n Repository,\n} from \"./ConnectRepositoryDialog\";\nexport {\n WebhookLogsDialog,\n WEBHOOK_CONNECTIONS,\n WEBHOOK_REPOSITORIES,\n} from \"./WebhookLogsDialog\";\nexport type {\n WebhookLogsDialogProps,\n WebhookConnection,\n WebhookRepository,\n WebhookLog,\n} from \"./WebhookLogsDialog\";\nexport {\n SourceCodeSection,\n IssueRow,\n CodeRow,\n Spine,\n HistoryDialog,\n CompletedHeader,\n} from \"./SourceCodeSection\";\nexport type {\n IssueEntry,\n CodeEntry,\n Stage,\n HistoryEvent,\n StageState,\n CodeStatus,\n SectionVariant,\n} from \"./SourceCodeSection\";\nexport { SuggestSubtasksButton } from \"./SuggestSubtasksButton\";\nexport { TaskOptionsMenu, TaskListOptionsMenu } from \"./TaskOptionsMenu\";\nexport type {\n TaskOptionsMenuProps,\n TaskListOptionsMenuProps,\n} from \"./TaskOptionsMenu\";\nexport { UserMenu } from \"./UserMenu\";\nexport type { UserMenuProps, UserMenuVariant } from \"./UserMenu\";\nexport { TwoFactorShield } from \"./TwoFactorShield\";\nexport type { TwoFactorShieldProps } from \"./TwoFactorShield\";\nexport { BackupCodesDialogs, CreateLoginCodeDialogs } from \"./TwoFactorDialogs\";\nexport type {\n BackupCodesDialogsProps,\n CreateLoginCodeDialogsProps,\n} from \"./TwoFactorDialogs\";\nexport {\n SettingsHeader,\n SettingsContent,\n StyledSettingRow,\n RowText,\n SettingRow,\n} from \"./settings\";\nexport type { SettingsHeaderProps, SettingRowProps } from \"./settings\";\nexport {\n FeatureAvailability,\n DEFAULT_FEATURE_AVAILABILITY,\n} from \"./FeatureAvailability\";\nexport type {\n FeatureAvailabilityProps,\n AvailabilityRow,\n AvailabilityMark,\n AvailabilityStatus,\n} from \"./FeatureAvailability\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,IAAAA,OAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,OAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAL,OAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAb,OAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,SAAA,GAAAb,OAAA;AACA,IAAAc,YAAA,GAAAd,OAAA;AACA,IAAAe,kBAAA,GAAAf,OAAA;AAEA,IAAAgB,QAAA,GAAAhB,OAAA;AAMA,IAAAiB,iBAAA,GAAAjB,OAAA;AACA,IAAAkB,cAAA,GAAAlB,OAAA;AAUA,IAAAmB,gBAAA,GAAAnB,OAAA;AAWA,IAAAoB,mBAAA,GAAApB,OAAA;AAEA,IAAAqB,sBAAA,GAAArB,OAAA;AACA,IAAAsB,8BAAA,GAAAtB,OAAA;AAEA,IAAAuB,wBAAA,GAAAvB,OAAA;AAeA,IAAAwB,kBAAA,GAAAxB,OAAA;AAWA,IAAAyB,kBAAA,GAAAzB,OAAA;AAiBA,IAAA0B,sBAAA,GAAA1B,OAAA;AACA,IAAA2B,gBAAA,GAAA3B,OAAA;AAKA,IAAA4B,SAAA,GAAA5B,OAAA;AAEA,IAAA6B,gBAAA,GAAA7B,OAAA;AAEA,IAAA8B,iBAAA,GAAA9B,OAAA;AAKA,IAAA+B,SAAA,GAAA/B,OAAA;AAQA,IAAAgC,oBAAA,GAAAhC,OAAA","ignoreList":[]}
|
|
@@ -77,9 +77,12 @@ const HeadingBlock = _ref5 => {
|
|
|
77
77
|
let block = _ref5.block,
|
|
78
78
|
children = _ref5.children;
|
|
79
79
|
const _ref6 = block,
|
|
80
|
-
level = _ref6.level
|
|
80
|
+
level = _ref6.level,
|
|
81
|
+
id = _ref6.id;
|
|
81
82
|
const Heading = titledTextHeadings[headingVariantForLevel(level)];
|
|
82
|
-
return /*#__PURE__*/React.createElement(Heading,
|
|
83
|
+
return /*#__PURE__*/React.createElement(Heading, {
|
|
84
|
+
id: id
|
|
85
|
+
}, children);
|
|
83
86
|
};
|
|
84
87
|
export const portableTextDefaultBlockRenderers = {
|
|
85
88
|
paragraph: _ref7 => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderers.js","names":["React","Fragment","StyledCode","StyledCodeBlock","StyledDivider","StyledLink","StyledList","StyledTableBlock","isPortableTextMediaImageVariant","Media","Table","Tbody","Thead","TitledText","titledTextHeadings","Body1","Typography","portableTextDefaultMarkRenderers","strong","_ref","children","createElement","em","_ref2","code","_ref3","link","_ref4","mark","href","target","rel","HEADING_LEVEL_VARIANTS","DEFAULT_HEADING_LEVEL","headingVariantForLevel","level","undefined","variant","console","warn","HeadingBlock","_ref5","block","_ref6","Heading","portableTextDefaultBlockRenderers","paragraph","_ref7","heading","list","_ref8","ordered","style","as","$ordered","_ref9","media","_ref0","_ref1","src","alt","caption","_ref10","_ref11","title","_ref12","_ref13","language","table","_ref14","renderSpans","_ref15","header","rows","cell","spans","map","span","index","key","text","row","rowIndex","cellIndex","divider"],"sources":["../../../../src/components/PortableText/renderers.tsx"],"sourcesContent":["import React, { Fragment, ReactNode } from \"react\";\n\nimport {\n StyledCode,\n StyledCodeBlock,\n StyledDivider,\n StyledLink,\n StyledList,\n StyledTableBlock,\n} from \"./Styles\";\nimport {\n isPortableTextMediaImageVariant,\n PortableTextBlockRenderer,\n PortableTextCodeBlock,\n PortableTextDefaultBlockType,\n PortableTextDefaultMark,\n PortableTextHeadingBlock,\n PortableTextHeadingLevel,\n PortableTextLinkMark,\n PortableTextListBlock,\n PortableTextMarkRenderer,\n PortableTextMediaBlock,\n PortableTextSpan,\n PortableTextTableBlock,\n PortableTextTitledTextBlock,\n} from \"./types\";\nimport { Media } from \"../Media\";\nimport { Table, Tbody, Thead } from \"../Tables\";\nimport {\n TitledText,\n TitledTextVariant,\n titledTextHeadings,\n} from \"../TitledText\";\nimport { Body1 } from \"../Typography\";\nimport { Typography } from \"../Typography/Typography\";\n\n/**\n * The default renderers for the universal set — everything a client renders\n * without injection, and nothing more: no product element ever lands here.\n * Injected {@link PortableTextComponents} maps take precedence entry by entry.\n */\n\nexport const portableTextDefaultMarkRenderers: Record<\n PortableTextDefaultMark,\n PortableTextMarkRenderer\n> = {\n strong: ({ children }) => <strong>{children}</strong>,\n em: ({ children }) => <em>{children}</em>,\n code: ({ children }) => <StyledCode>{children}</StyledCode>,\n link: ({ mark, children }) => {\n const href = (mark as PortableTextLinkMark | undefined)?.href;\n\n // A link mark without an href (authored as a plain string) has nowhere\n // to go — keep the text, skip the anchor.\n if (!href) {\n return <>{children}</>;\n }\n\n return (\n <StyledLink href={href} target=\"_blank\" rel=\"noopener noreferrer\">\n {children}\n </StyledLink>\n );\n },\n};\n\n/** The semantic wire levels resolve to typography only here, in the renderer. */\nconst HEADING_LEVEL_VARIANTS: Record<\n PortableTextHeadingLevel,\n TitledTextVariant\n> = {\n 1: \"title1\",\n 2: \"title2\",\n 3: \"header2\",\n};\n\n/** The level `heading` and `titled-text` fall back to. */\nconst DEFAULT_HEADING_LEVEL: PortableTextHeadingLevel = 3;\n\n/**\n * Resolve a semantic wire level to its typography variant. An absent level is\n * the documented default; any other unrecognised level is a serializer bug on\n * a fixed 1–3 scale, so it falls back to the default and is logged, per the\n * contract's degradation rule.\n */\nconst headingVariantForLevel = (\n level: PortableTextHeadingLevel | undefined\n): TitledTextVariant => {\n if (level === undefined) {\n return HEADING_LEVEL_VARIANTS[DEFAULT_HEADING_LEVEL];\n }\n\n const variant = HEADING_LEVEL_VARIANTS[level];\n if (!variant) {\n console.warn(\n `PortableText: unknown heading level ${level}, falling back to ${DEFAULT_HEADING_LEVEL}.`\n );\n return HEADING_LEVEL_VARIANTS[DEFAULT_HEADING_LEVEL];\n }\n\n return variant;\n};\n\n/** Heading levels map to the same typography TitledText uses. */\nconst HeadingBlock: PortableTextBlockRenderer = ({ block, children }) => {\n const { level } = block as PortableTextHeadingBlock;\n const Heading = titledTextHeadings[headingVariantForLevel(level)];\n return <Heading>{children}</Heading>;\n};\n\nexport const portableTextDefaultBlockRenderers: Record<\n PortableTextDefaultBlockType,\n PortableTextBlockRenderer\n> = {\n paragraph: ({ children }) => <Body1>{children}</Body1>,\n heading: HeadingBlock,\n list: ({ block, children }) => {\n const ordered = (block as PortableTextListBlock).style === \"number\";\n return (\n // `data-portable-list` scopes the depth-marker rules in Styles.ts to\n // design-system lists, and marks the ancestors those rules count.\n <StyledList\n as={ordered ? \"ol\" : \"ul\"}\n $ordered={ordered}\n data-portable-list=\"\"\n >\n {children}\n </StyledList>\n );\n },\n \"list-item\": ({ children }) => (\n <Typography variant=\"Body 1\" as=\"li\">\n {children}\n </Typography>\n ),\n media: ({ block }) => {\n const { src, alt, variant, caption } = block as PortableTextMediaBlock;\n\n // Video (and future) variants carry service semantics, so their renderer\n // is application-catalog territory — an injected `media` override. The\n // universal set covers images only; anything else degrades and warns, per\n // the contract's degradation rule.\n if (variant !== undefined && !isPortableTextMediaImageVariant(variant)) {\n console.warn(\n `PortableText: no default renderer for media variant \"${variant}\".`\n );\n return null;\n }\n\n return <Media src={src} alt={alt} variant={variant} caption={caption} />;\n },\n \"titled-text\": ({ block, children }) => {\n const { title, level } = block as PortableTextTitledTextBlock;\n return (\n <TitledText title={title} variant={headingVariantForLevel(level)}>\n {children}\n </TitledText>\n );\n },\n // No highlighter ships with the default set, so every language — known,\n // unknown or absent — is plain preformatted text; the hint travels on\n // data-language for surfaces that highlight.\n \"code-block\": ({ block }) => {\n const { code, language } = block as PortableTextCodeBlock;\n return (\n <StyledCodeBlock data-language={language || undefined}>\n <code>{code}</code>\n </StyledCodeBlock>\n );\n },\n table: ({ block, renderSpans }) => {\n const { header, rows } = block as PortableTextTableBlock;\n // Standalone (engine-less) use has no span renderer — keep the raw text.\n const cell = (spans: PortableTextSpan[]): ReactNode =>\n renderSpans\n ? renderSpans(spans)\n : spans.map((span, index) => (\n <Fragment key={index}>{span.text}</Fragment>\n ));\n\n return (\n <StyledTableBlock>\n <Table>\n <Thead>\n <tr>\n {header.map((spans, index) => (\n <th key={index}>{cell(spans)}</th>\n ))}\n </tr>\n </Thead>\n <Tbody>\n {rows.map((row, rowIndex) => (\n <tr key={rowIndex}>\n {row.map((spans, cellIndex) => (\n <td key={cellIndex}>{cell(spans)}</td>\n ))}\n </tr>\n ))}\n </Tbody>\n </Table>\n </StyledTableBlock>\n );\n },\n divider: () => <StyledDivider />,\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAmB,OAAO;AAElD,SACEC,UAAU,EACVC,eAAe,EACfC,aAAa,EACbC,UAAU,EACVC,UAAU,EACVC,gBAAgB,QACX,UAAU;AACjB,SACEC,+BAA+B,QAc1B,SAAS;AAChB,SAASC,KAAK,QAAQ,UAAU;AAChC,SAASC,KAAK,EAAEC,KAAK,EAAEC,KAAK,QAAQ,WAAW;AAC/C,SACEC,UAAU,EAEVC,kBAAkB,QACb,eAAe;AACtB,SAASC,KAAK,QAAQ,eAAe;AACrC,SAASC,UAAU,QAAQ,0BAA0B;;AAErD;AACA;AACA;AACA;AACA;;AAEA,OAAO,MAAMC,gCAGZ,GAAG;EACFC,MAAM,EAAEC,IAAA;IAAA,IAAGC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IAAA,oBAAOpB,KAAA,CAAAqB,aAAA,iBAASD,QAAiB,CAAC;EAAA;EACrDE,EAAE,EAAEC,KAAA;IAAA,IAAGH,QAAQ,GAAAG,KAAA,CAARH,QAAQ;IAAA,oBAAOpB,KAAA,CAAAqB,aAAA,aAAKD,QAAa,CAAC;EAAA;EACzCI,IAAI,EAAEC,KAAA;IAAA,IAAGL,QAAQ,GAAAK,KAAA,CAARL,QAAQ;IAAA,oBAAOpB,KAAA,CAAAqB,aAAA,CAACnB,UAAU,QAAEkB,QAAqB,CAAC;EAAA;EAC3DM,IAAI,EAAEC,KAAA,IAAwB;IAAA,IAArBC,IAAI,GAAAD,KAAA,CAAJC,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,MAAA,CAANC,MAAM;MAAEC,IAAI,GAAAF,MAAA,CAAJE,IAAI;IACpB;IACA,MAAMC,IAAI,GAAIC,KAAyB,IACrCL,WAAW,GACPA,WAAW,CAACK,KAAK,CAAC,GAClBA,KAAK,CAACC,GAAG,CAAC,CAACC,IAAI,EAAEC,KAAK,kBACpB9E,KAAA,CAAAqB,aAAA,CAACpB,QAAQ;MAAC8E,GAAG,EAAED;IAAM,GAAED,IAAI,CAACG,IAAe,CAC5C,CAAC;IAER,oBACEhF,KAAA,CAAAqB,aAAA,CAACd,gBAAgB,qBACfP,KAAA,CAAAqB,aAAA,CAACX,KAAK,qBACJV,KAAA,CAAAqB,aAAA,CAACT,KAAK,qBACJZ,KAAA,CAAAqB,aAAA,aACGmD,MAAM,CAACI,GAAG,CAAC,CAACD,KAAK,EAAEG,KAAK,kBACvB9E,KAAA,CAAAqB,aAAA;MAAI0D,GAAG,EAAED;IAAM,GAAEJ,IAAI,CAACC,KAAK,CAAM,CAClC,CACC,CACC,CAAC,eACR3E,KAAA,CAAAqB,aAAA,CAACV,KAAK,QACH8D,IAAI,CAACG,GAAG,CAAC,CAACK,GAAG,EAAEC,QAAQ,kBACtBlF,KAAA,CAAAqB,aAAA;MAAI0D,GAAG,EAAEG;IAAS,GACfD,GAAG,CAACL,GAAG,CAAC,CAACD,KAAK,EAAEQ,SAAS,kBACxBnF,KAAA,CAAAqB,aAAA;MAAI0D,GAAG,EAAEI;IAAU,GAAET,IAAI,CAACC,KAAK,CAAM,CACtC,CACC,CACL,CACI,CACF,CACS,CAAC;EAEvB,CAAC;EACDS,OAAO,EAAEA,CAAA,kBAAMpF,KAAA,CAAAqB,aAAA,CAACjB,aAAa,MAAE;AACjC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"renderers.js","names":["React","Fragment","StyledCode","StyledCodeBlock","StyledDivider","StyledLink","StyledList","StyledTableBlock","isPortableTextMediaImageVariant","Media","Table","Tbody","Thead","TitledText","titledTextHeadings","Body1","Typography","portableTextDefaultMarkRenderers","strong","_ref","children","createElement","em","_ref2","code","_ref3","link","_ref4","mark","href","target","rel","HEADING_LEVEL_VARIANTS","DEFAULT_HEADING_LEVEL","headingVariantForLevel","level","undefined","variant","console","warn","HeadingBlock","_ref5","block","_ref6","id","Heading","portableTextDefaultBlockRenderers","paragraph","_ref7","heading","list","_ref8","ordered","style","as","$ordered","_ref9","media","_ref0","_ref1","src","alt","caption","_ref10","_ref11","title","_ref12","_ref13","language","table","_ref14","renderSpans","_ref15","header","rows","cell","spans","map","span","index","key","text","row","rowIndex","cellIndex","divider"],"sources":["../../../../src/components/PortableText/renderers.tsx"],"sourcesContent":["import React, { Fragment, ReactNode } from \"react\";\n\nimport {\n StyledCode,\n StyledCodeBlock,\n StyledDivider,\n StyledLink,\n StyledList,\n StyledTableBlock,\n} from \"./Styles\";\nimport {\n isPortableTextMediaImageVariant,\n PortableTextBlockRenderer,\n PortableTextCodeBlock,\n PortableTextDefaultBlockType,\n PortableTextDefaultMark,\n PortableTextHeadingBlock,\n PortableTextHeadingLevel,\n PortableTextLinkMark,\n PortableTextListBlock,\n PortableTextMarkRenderer,\n PortableTextMediaBlock,\n PortableTextSpan,\n PortableTextTableBlock,\n PortableTextTitledTextBlock,\n} from \"./types\";\nimport { Media } from \"../Media\";\nimport { Table, Tbody, Thead } from \"../Tables\";\nimport {\n TitledText,\n TitledTextVariant,\n titledTextHeadings,\n} from \"../TitledText\";\nimport { Body1 } from \"../Typography\";\nimport { Typography } from \"../Typography/Typography\";\n\n/**\n * The default renderers for the universal set — everything a client renders\n * without injection, and nothing more: no product element ever lands here.\n * Injected {@link PortableTextComponents} maps take precedence entry by entry.\n */\n\nexport const portableTextDefaultMarkRenderers: Record<\n PortableTextDefaultMark,\n PortableTextMarkRenderer\n> = {\n strong: ({ children }) => <strong>{children}</strong>,\n em: ({ children }) => <em>{children}</em>,\n code: ({ children }) => <StyledCode>{children}</StyledCode>,\n link: ({ mark, children }) => {\n const href = (mark as PortableTextLinkMark | undefined)?.href;\n\n // A link mark without an href (authored as a plain string) has nowhere\n // to go — keep the text, skip the anchor.\n if (!href) {\n return <>{children}</>;\n }\n\n return (\n <StyledLink href={href} target=\"_blank\" rel=\"noopener noreferrer\">\n {children}\n </StyledLink>\n );\n },\n};\n\n/** The semantic wire levels resolve to typography only here, in the renderer. */\nconst HEADING_LEVEL_VARIANTS: Record<\n PortableTextHeadingLevel,\n TitledTextVariant\n> = {\n 1: \"title1\",\n 2: \"title2\",\n 3: \"header2\",\n};\n\n/** The level `heading` and `titled-text` fall back to. */\nconst DEFAULT_HEADING_LEVEL: PortableTextHeadingLevel = 3;\n\n/**\n * Resolve a semantic wire level to its typography variant. An absent level is\n * the documented default; any other unrecognised level is a serializer bug on\n * a fixed 1–3 scale, so it falls back to the default and is logged, per the\n * contract's degradation rule.\n */\nconst headingVariantForLevel = (\n level: PortableTextHeadingLevel | undefined\n): TitledTextVariant => {\n if (level === undefined) {\n return HEADING_LEVEL_VARIANTS[DEFAULT_HEADING_LEVEL];\n }\n\n const variant = HEADING_LEVEL_VARIANTS[level];\n if (!variant) {\n console.warn(\n `PortableText: unknown heading level ${level}, falling back to ${DEFAULT_HEADING_LEVEL}.`\n );\n return HEADING_LEVEL_VARIANTS[DEFAULT_HEADING_LEVEL];\n }\n\n return variant;\n};\n\n/** Heading levels map to the same typography TitledText uses. */\nconst HeadingBlock: PortableTextBlockRenderer = ({ block, children }) => {\n const { level, id } = block as PortableTextHeadingBlock;\n const Heading = titledTextHeadings[headingVariantForLevel(level)];\n return <Heading id={id}>{children}</Heading>;\n};\n\nexport const portableTextDefaultBlockRenderers: Record<\n PortableTextDefaultBlockType,\n PortableTextBlockRenderer\n> = {\n paragraph: ({ children }) => <Body1>{children}</Body1>,\n heading: HeadingBlock,\n list: ({ block, children }) => {\n const ordered = (block as PortableTextListBlock).style === \"number\";\n return (\n // `data-portable-list` scopes the depth-marker rules in Styles.ts to\n // design-system lists, and marks the ancestors those rules count.\n <StyledList\n as={ordered ? \"ol\" : \"ul\"}\n $ordered={ordered}\n data-portable-list=\"\"\n >\n {children}\n </StyledList>\n );\n },\n \"list-item\": ({ children }) => (\n <Typography variant=\"Body 1\" as=\"li\">\n {children}\n </Typography>\n ),\n media: ({ block }) => {\n const { src, alt, variant, caption } = block as PortableTextMediaBlock;\n\n // Video (and future) variants carry service semantics, so their renderer\n // is application-catalog territory — an injected `media` override. The\n // universal set covers images only; anything else degrades and warns, per\n // the contract's degradation rule.\n if (variant !== undefined && !isPortableTextMediaImageVariant(variant)) {\n console.warn(\n `PortableText: no default renderer for media variant \"${variant}\".`\n );\n return null;\n }\n\n return <Media src={src} alt={alt} variant={variant} caption={caption} />;\n },\n \"titled-text\": ({ block, children }) => {\n const { title, level } = block as PortableTextTitledTextBlock;\n return (\n <TitledText title={title} variant={headingVariantForLevel(level)}>\n {children}\n </TitledText>\n );\n },\n // No highlighter ships with the default set, so every language — known,\n // unknown or absent — is plain preformatted text; the hint travels on\n // data-language for surfaces that highlight.\n \"code-block\": ({ block }) => {\n const { code, language } = block as PortableTextCodeBlock;\n return (\n <StyledCodeBlock data-language={language || undefined}>\n <code>{code}</code>\n </StyledCodeBlock>\n );\n },\n table: ({ block, renderSpans }) => {\n const { header, rows } = block as PortableTextTableBlock;\n // Standalone (engine-less) use has no span renderer — keep the raw text.\n const cell = (spans: PortableTextSpan[]): ReactNode =>\n renderSpans\n ? renderSpans(spans)\n : spans.map((span, index) => (\n <Fragment key={index}>{span.text}</Fragment>\n ));\n\n return (\n <StyledTableBlock>\n <Table>\n <Thead>\n <tr>\n {header.map((spans, index) => (\n <th key={index}>{cell(spans)}</th>\n ))}\n </tr>\n </Thead>\n <Tbody>\n {rows.map((row, rowIndex) => (\n <tr key={rowIndex}>\n {row.map((spans, cellIndex) => (\n <td key={cellIndex}>{cell(spans)}</td>\n ))}\n </tr>\n ))}\n </Tbody>\n </Table>\n </StyledTableBlock>\n );\n },\n divider: () => <StyledDivider />,\n};\n"],"mappings":"AAAA,OAAO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C+E,GAAG,EAAED;IAAM,GAAED,IAAI,CAACG,IAAe,CAC5C,CAAC;IAER,oBACEjF,KAAA,CAAAqB,aAAA,CAACd,gBAAgB,qBACfP,KAAA,CAAAqB,aAAA,CAACX,KAAK,qBACJV,KAAA,CAAAqB,aAAA,CAACT,KAAK,qBACJZ,KAAA,CAAAqB,aAAA,aACGoD,MAAM,CAACI,GAAG,CAAC,CAACD,KAAK,EAAEG,KAAK,kBACvB/E,KAAA,CAAAqB,aAAA;MAAI2D,GAAG,EAAED;IAAM,GAAEJ,IAAI,CAACC,KAAK,CAAM,CAClC,CACC,CACC,CAAC,eACR5E,KAAA,CAAAqB,aAAA,CAACV,KAAK,QACH+D,IAAI,CAACG,GAAG,CAAC,CAACK,GAAG,EAAEC,QAAQ,kBACtBnF,KAAA,CAAAqB,aAAA;MAAI2D,GAAG,EAAEG;IAAS,GACfD,GAAG,CAACL,GAAG,CAAC,CAACD,KAAK,EAAEQ,SAAS,kBACxBpF,KAAA,CAAAqB,aAAA;MAAI2D,GAAG,EAAEI;IAAU,GAAET,IAAI,CAACC,KAAK,CAAM,CACtC,CACC,CACL,CACI,CACF,CACS,CAAC;EAEvB,CAAC;EACDS,OAAO,EAAEA,CAAA,kBAAMrF,KAAA,CAAAqB,aAAA,CAACjB,aAAa,MAAE;AACjC,CAAC","ignoreList":[]}
|
|
@@ -40,6 +40,12 @@ export type PortableTextHeadingLevel = 1 | 2 | 3;
|
|
|
40
40
|
export interface PortableTextHeadingBlock {
|
|
41
41
|
type: "heading";
|
|
42
42
|
level: PortableTextHeadingLevel;
|
|
43
|
+
/**
|
|
44
|
+
* Optional anchor id, rendered verbatim as the heading element's `id` so the
|
|
45
|
+
* heading is a scroll target (e.g. subarticle deep-links). Opaque to the
|
|
46
|
+
* renderer — any slug convention lives with whoever produced the block.
|
|
47
|
+
*/
|
|
48
|
+
id?: string;
|
|
43
49
|
children: PortableTextSpan[];
|
|
44
50
|
}
|
|
45
51
|
export type PortableTextListStyle = "bullet"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b,KAAK,IAAI,iBAuEX,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAChC,OAAO,OAAO,KACb,KAAK,IAAI,mBAIT,CAAC"}
|
|
@@ -118,8 +118,9 @@ export const isPortableTextBlock = value => {
|
|
|
118
118
|
}
|
|
119
119
|
switch (value.type) {
|
|
120
120
|
case "paragraph":
|
|
121
|
-
case "heading":
|
|
122
121
|
return Array.isArray(value.children) && value.children.every(isPortableTextSpan);
|
|
122
|
+
case "heading":
|
|
123
|
+
return (value.id === undefined || typeof value.id === "string") && Array.isArray(value.children) && value.children.every(isPortableTextSpan);
|
|
123
124
|
case "list-item":
|
|
124
125
|
// The item's spans, plus optional nested `list` block(s). Widened only
|
|
125
126
|
// for nested lists: any other block child (a stray paragraph, an object)
|