oneslash-design-system 2.24.0 → 2.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/README.md +1 -1
  2. package/dist/DESIGN.md +8 -4
  3. package/dist/cases/ask-page/answered.jsx +10 -2
  4. package/dist/cases/ask-page.md +12 -3
  5. package/dist/cases/billing-page/self-serve.jsx +4 -4
  6. package/dist/cases/billing-page/trial.d.ts +1 -0
  7. package/dist/cases/billing-page/trial.jsx +115 -0
  8. package/dist/cases/billing-page.md +166 -5
  9. package/dist/cases/collapsible-search/popover.jsx +1 -1
  10. package/dist/cases/collapsible-search.md +2 -2
  11. package/dist/cases/cookie-choice/banner.d.ts +1 -0
  12. package/dist/cases/cookie-choice/banner.jsx +82 -0
  13. package/dist/cases/cookie-choice/settings.d.ts +1 -0
  14. package/dist/cases/cookie-choice/settings.jsx +75 -0
  15. package/dist/cases/cookie-choice.md +234 -0
  16. package/dist/cases/dashboard/numbers-first.jsx +1 -1
  17. package/dist/cases/dashboard/work-first.jsx +1 -1
  18. package/dist/cases/dashboard.md +2 -2
  19. package/dist/cases/data-table-page/all-rows.jsx +1 -1
  20. package/dist/cases/data-table-page/paged.jsx +1 -1
  21. package/dist/cases/data-table-page.md +2 -2
  22. package/dist/cases/invoice-list/table.jsx +21 -9
  23. package/dist/cases/invoice-list.md +27 -12
  24. package/dist/cases/message-reactions/picker.jsx +1 -1
  25. package/dist/cases/message-reactions.md +2 -2
  26. package/dist/cases/message-row.md +2 -1
  27. package/dist/cases/newsletter-signup/inline.d.ts +1 -0
  28. package/dist/cases/newsletter-signup/inline.jsx +72 -0
  29. package/dist/cases/newsletter-signup/section.d.ts +1 -0
  30. package/dist/cases/newsletter-signup/section.jsx +72 -0
  31. package/dist/cases/newsletter-signup.md +234 -0
  32. package/dist/cases/number-format.md +6 -2
  33. package/dist/cases/on-this-page.md +2 -0
  34. package/dist/cases/people-row/stack.jsx +1 -1
  35. package/dist/cases/people-row.md +2 -2
  36. package/dist/cases/plan-comparison/table.d.ts +1 -0
  37. package/dist/cases/plan-comparison/table.jsx +47 -0
  38. package/dist/cases/plan-comparison.md +94 -0
  39. package/dist/cases/plan-picker.md +1 -0
  40. package/dist/cases/pricing-section.md +1 -1
  41. package/dist/cases/site-footer/columns.jsx +2 -1
  42. package/dist/cases/site-footer.md +3 -1
  43. package/dist/cases/stat-row/tiles.jsx +2 -1
  44. package/dist/cases/stat-row.md +4 -1
  45. package/dist/cases/task-header/agent-sets-status.jsx +1 -1
  46. package/dist/cases/task-header/people-change-status.jsx +1 -1
  47. package/dist/cases/task-header.md +2 -2
  48. package/dist/cases.json +245 -28
  49. package/dist/components/alert.d.ts +3 -1
  50. package/dist/components/alert.jsx +5 -5
  51. package/dist/components/barChart.jsx +4 -2
  52. package/dist/components/dateField.jsx +1 -1
  53. package/dist/components/formatNumber.d.ts +10 -2
  54. package/dist/components/formatNumber.js +44 -9
  55. package/dist/components/layout.d.ts +4 -2
  56. package/dist/components/layout.jsx +13 -2
  57. package/dist/components/markdown.d.ts +24 -0
  58. package/dist/components/markdown.jsx +81 -0
  59. package/dist/components/onThisPage.d.ts +14 -3
  60. package/dist/components/onThisPage.jsx +72 -8
  61. package/dist/components/pageShell.d.ts +3 -3
  62. package/dist/components/pageShell.jsx +6 -5
  63. package/dist/components/popover.d.ts +5 -1
  64. package/dist/components/popover.jsx +3 -2
  65. package/dist/components/progress.jsx +1 -1
  66. package/dist/components/select.jsx +5 -2
  67. package/dist/components/statTile.d.ts +1 -1
  68. package/dist/components/statTile.jsx +7 -2
  69. package/dist/components/tableCell.d.ts +4 -3
  70. package/dist/components/tableCell.jsx +2 -2
  71. package/dist/components/toaster.jsx +81 -11
  72. package/dist/index.d.ts +1 -0
  73. package/dist/index.js +1 -0
  74. package/dist/internal/markdown.d.ts +40 -0
  75. package/dist/internal/markdown.js +577 -0
  76. package/dist/internal/toaster.d.ts +2 -0
  77. package/dist/internal/toaster.js +8 -0
  78. package/dist/native-mapping.json +9 -3
  79. package/dist/stories/Cases.generated.stories.d.ts +6 -0
  80. package/dist/stories/Cases.generated.stories.jsx +12 -0
  81. package/dist/stories/Markdown.stories.d.ts +9 -0
  82. package/dist/stories/Markdown.stories.jsx +66 -0
  83. package/dist/stories/OnThisPage.stories.d.ts +1 -0
  84. package/dist/stories/OnThisPage.stories.jsx +11 -0
  85. package/dist/stories/Popover.stories.d.ts +2 -0
  86. package/dist/stories/Popover.stories.jsx +33 -0
  87. package/dist/stories/StatTile.stories.d.ts +4 -0
  88. package/dist/stories/StatTile.stories.jsx +47 -2
  89. package/dist/stories/Toaster.stories.d.ts +4 -0
  90. package/dist/stories/Toaster.stories.jsx +30 -0
  91. package/package.json +1 -1
@@ -0,0 +1,577 @@
1
+ // The markdown subset a message needs: headings, lists one level deep, fenced code, rules, bold,
2
+ // italic, inline code and safe links. Everything else reads as text. One pass over the lines, then a
3
+ // hand-written scanner per block whose lookups are tables built once, so no input makes it backtrack.
4
+ var __assign = (this && this.__assign) || function () {
5
+ __assign = Object.assign || function(t) {
6
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
7
+ s = arguments[i];
8
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
9
+ t[p] = s[p];
10
+ }
11
+ return t;
12
+ };
13
+ return __assign.apply(this, arguments);
14
+ };
15
+ /**
16
+ * Only `http:`, `https:` and `mailto:` links, with the scheme in lower case. Anything else gives null:
17
+ * `javascript:`, `data:`, `vbscript:`, relative paths, and any URL with a space or a control character
18
+ * in it (which a browser would strip before it reads the scheme). Entities are never decoded.
19
+ */
20
+ export function safeHref(href) {
21
+ var url = href.trim();
22
+ for (var i = 0; i < url.length; i += 1) {
23
+ var code = url.charCodeAt(i);
24
+ if (code <= 0x20 || code === 0x7f)
25
+ return null;
26
+ }
27
+ var head = url.slice(0, 8).toLowerCase();
28
+ if (head.startsWith('https://'))
29
+ return "https://".concat(url.slice(8));
30
+ if (head.startsWith('http://'))
31
+ return "http://".concat(url.slice(7));
32
+ if (head.startsWith('mailto:') && url.length > 7)
33
+ return "mailto:".concat(url.slice(7));
34
+ return null;
35
+ }
36
+ // ---- Inline ----
37
+ // A link's destination: the URL, with an optional title after it ("t", 't' or (t)) dropped
38
+ function linkHref(dest) {
39
+ var text = dest.trim();
40
+ var w = 0;
41
+ while (w < text.length && !isSpace(text[w]))
42
+ w += 1;
43
+ var title = text.slice(w).trim();
44
+ if (title) {
45
+ var open_1 = title[0];
46
+ var close_1 = open_1 === '(' ? ')' : open_1;
47
+ if (title.length < 2 || (open_1 !== '"' && open_1 !== "'" && open_1 !== '(') || title[title.length - 1] !== close_1)
48
+ return null;
49
+ }
50
+ return safeHref(text.slice(0, w));
51
+ }
52
+ // Deeper than this, the rest of a span reads as text, so no input can nest without end.
53
+ var MAX_DEPTH = 8;
54
+ var PUNCTUATION = '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~';
55
+ var isSpace = function (ch) { return ch === ' ' || ch === '\t' || ch === '\n'; };
56
+ var isAlnum = function (ch) {
57
+ var c = ch.charCodeAt(0);
58
+ return (c >= 48 && c <= 57) || (c >= 65 && c <= 90) || (c >= 97 && c <= 122) || c > 127;
59
+ };
60
+ var STRONG = 0;
61
+ var EM_STAR = 1;
62
+ var EM_UNDERSCORE = 2;
63
+ function parseInline(s) {
64
+ var _a;
65
+ var n = s.length;
66
+ if (n === 0)
67
+ return [];
68
+ // A backslash before punctuation makes it a plain character
69
+ var esc = new Uint8Array(n);
70
+ for (var i = 0; i < n; i += 1) {
71
+ if (s[i] === '\\' && i + 1 < n && PUNCTUATION.includes(s[i + 1])) {
72
+ esc[i + 1] = 1;
73
+ i += 1;
74
+ }
75
+ }
76
+ // Code spans: a run of backticks pairs with the next run of the same length
77
+ var codeClose = new Int32Array(n).fill(-1);
78
+ var runLength = new Int32Array(n);
79
+ var isCode = new Uint8Array(n);
80
+ var starts = [];
81
+ for (var i = 0; i < n;) {
82
+ if (s[i] === '`' && !esc[i]) {
83
+ var j = i;
84
+ while (j < n && s[j] === '`')
85
+ j += 1;
86
+ starts.push(i);
87
+ runLength[i] = j - i;
88
+ i = j;
89
+ }
90
+ else
91
+ i += 1;
92
+ }
93
+ var nextSame = new Int32Array(starts.length);
94
+ var last = new Map();
95
+ for (var r = starts.length - 1; r >= 0; r -= 1) {
96
+ var len = runLength[starts[r]];
97
+ nextSame[r] = (_a = last.get(len)) !== null && _a !== void 0 ? _a : -1;
98
+ last.set(len, r);
99
+ }
100
+ for (var r = 0; r < starts.length;) {
101
+ var m = nextSame[r];
102
+ if (m < 0) {
103
+ r += 1;
104
+ continue;
105
+ }
106
+ var open_2 = starts[r];
107
+ var close_2 = starts[m];
108
+ codeClose[open_2] = close_2;
109
+ isCode.fill(1, open_2, close_2 + runLength[close_2]);
110
+ r = m + 1;
111
+ }
112
+ // Brackets and parentheses outside code, matched with a stack
113
+ var bracketClose = new Int32Array(n).fill(-1);
114
+ var parenClose = new Int32Array(n).fill(-1);
115
+ var brackets = [];
116
+ var parens = [];
117
+ for (var i = 0; i < n; i += 1) {
118
+ if (isCode[i] || esc[i])
119
+ continue;
120
+ var ch = s[i];
121
+ if (ch === '[')
122
+ brackets.push(i);
123
+ else if (ch === ']') {
124
+ var o = brackets.pop();
125
+ if (o !== undefined)
126
+ bracketClose[o] = i;
127
+ }
128
+ else if (ch === '(')
129
+ parens.push(i);
130
+ else if (ch === ')') {
131
+ var o = parens.pop();
132
+ if (o !== undefined)
133
+ parenClose[o] = i;
134
+ }
135
+ }
136
+ // A link's URL is never read for emphasis (a star in a path stays in the path)
137
+ var cover = new Int32Array(n + 1);
138
+ for (var o = 0; o < n; o += 1) {
139
+ var c = bracketClose[o];
140
+ if (c < 0 || s[c + 1] !== '(' || parenClose[c + 1] < 0)
141
+ continue;
142
+ cover[c + 2] += 1;
143
+ cover[parenClose[c + 1]] -= 1;
144
+ }
145
+ var isUrl = new Uint8Array(n);
146
+ for (var i = 0, depth = 0; i < n; i += 1) {
147
+ depth += cover[i];
148
+ if (depth > 0)
149
+ isUrl[i] = 1;
150
+ }
151
+ // Emphasis runs: '**' is strong, '*' and '_' are em. Each closer kind has a next-closer table.
152
+ var runKind = new Int8Array(n).fill(-1);
153
+ var canOpen = new Uint8Array(n);
154
+ var nextClose = [new Int32Array(n + 1), new Int32Array(n + 1), new Int32Array(n + 1)];
155
+ var canClose = new Uint8Array(n);
156
+ for (var i = 0; i < n;) {
157
+ var ch = s[i];
158
+ if ((ch !== '*' && ch !== '_') || esc[i] || isCode[i] || isUrl[i]) {
159
+ i += 1;
160
+ continue;
161
+ }
162
+ var j = i;
163
+ while (j < n && s[j] === ch && !esc[j] && !isUrl[j])
164
+ j += 1;
165
+ var len = j - i;
166
+ var kind = ch === '*' ? (len === 1 ? EM_STAR : len === 2 ? STRONG : -1) : len === 1 ? EM_UNDERSCORE : -1;
167
+ if (kind >= 0) {
168
+ var before = i > 0 ? s[i - 1] : ' ';
169
+ var after = j < n ? s[j] : ' ';
170
+ runKind[i] = kind;
171
+ canOpen[i] = !isSpace(after) && (kind !== EM_UNDERSCORE || !isAlnum(before)) ? 1 : 0;
172
+ canClose[i] = !isSpace(before) && (kind !== EM_UNDERSCORE || !isAlnum(after)) ? 1 : 0;
173
+ }
174
+ i = j;
175
+ }
176
+ for (var _i = 0, nextClose_1 = nextClose; _i < nextClose_1.length; _i++) {
177
+ var table = nextClose_1[_i];
178
+ table[n] = -1;
179
+ }
180
+ for (var i = n - 1; i >= 0; i -= 1) {
181
+ for (var k = 0; k < 3; k += 1)
182
+ nextClose[k][i] = runKind[i] === k && canClose[i] ? i : nextClose[k][i + 1];
183
+ }
184
+ // Plain text of a range, with escapes resolved, for an image's alt text and spans past the depth limit
185
+ var plainText = function (start, end) {
186
+ var out = '';
187
+ for (var i = start; i < end; i += 1) {
188
+ if (s[i] === '\\' && i + 1 < end && esc[i + 1])
189
+ i += 1;
190
+ out += s[i];
191
+ }
192
+ return out;
193
+ };
194
+ var scan = function (start, end, depth, inLink) {
195
+ var out = [];
196
+ var buf = '';
197
+ var push = function (node) {
198
+ var prev = out[out.length - 1];
199
+ if (node.type === 'text' && prev && prev.type === 'text')
200
+ prev.text += node.text;
201
+ else
202
+ out.push(node);
203
+ };
204
+ var flush = function () {
205
+ if (buf)
206
+ push({ type: 'text', text: buf });
207
+ buf = '';
208
+ };
209
+ var i = start;
210
+ while (i < end) {
211
+ var ch = s[i];
212
+ if (ch === '\\' && i + 1 < end && esc[i + 1]) {
213
+ buf += s[i + 1];
214
+ i += 2;
215
+ continue;
216
+ }
217
+ if (ch === '`' && !esc[i] && runLength[i] > 0) {
218
+ var len = runLength[i];
219
+ var close_3 = codeClose[i];
220
+ if (close_3 >= 0 && close_3 + len <= end) {
221
+ var code = s.slice(i + len, close_3);
222
+ if (code.length > 1 && code[0] === ' ' && code[code.length - 1] === ' ' && code.trim() !== '')
223
+ code = code.slice(1, -1);
224
+ flush();
225
+ push({ type: 'code', text: code });
226
+ i = close_3 + len;
227
+ }
228
+ else {
229
+ buf += s.slice(i, i + len);
230
+ i += len;
231
+ }
232
+ continue;
233
+ }
234
+ // A link, or an image (`![alt](src)`), which reads as its alt text. Both are found at their first character.
235
+ var image = ch === '!' && !esc[i] && i + 1 < end && s[i + 1] === '[';
236
+ if ((ch === '[' || image) && !esc[i] && !isCode[i]) {
237
+ var o = image ? i + 1 : i;
238
+ var c = bracketClose[o];
239
+ var p = c >= 0 && c + 1 < end && s[c + 1] === '(' ? parenClose[c + 1] : -1;
240
+ if (p >= 0 && p < end) {
241
+ if (image)
242
+ buf += plainText(o + 1, c);
243
+ else {
244
+ var href = inLink ? null : linkHref(plainText(c + 2, p));
245
+ var children = depth + 1 < MAX_DEPTH ? scan(o + 1, c, depth + 1, true) : [{ type: 'text', text: plainText(o + 1, c) }];
246
+ flush();
247
+ if (href)
248
+ push({ type: 'link', href: href, children: children.length ? children : [{ type: 'text', text: href }] });
249
+ // Not safe, or a link inside a link: its text, and no link
250
+ else
251
+ children.forEach(push);
252
+ }
253
+ i = p + 1;
254
+ continue;
255
+ }
256
+ }
257
+ var kind = runKind[i];
258
+ if (kind >= 0) {
259
+ var len = kind === STRONG ? 2 : 1;
260
+ var j = canOpen[i] ? nextClose[kind][i + len] : -1;
261
+ if (j > i + len && j + len <= end && depth + 1 < MAX_DEPTH) {
262
+ flush();
263
+ push({ type: kind === STRONG ? 'strong' : 'em', children: scan(i + len, j, depth + 1, inLink) });
264
+ i = j + len;
265
+ }
266
+ else {
267
+ buf += s.slice(i, i + len);
268
+ i += len;
269
+ }
270
+ continue;
271
+ }
272
+ buf += ch;
273
+ i += 1;
274
+ }
275
+ flush();
276
+ return out;
277
+ };
278
+ return scan(0, n, 0, false);
279
+ }
280
+ // ---- Blocks ----
281
+ // Columns of leading space (a tab is 4) and where the text starts
282
+ function indentOf(line) {
283
+ var indent = 0;
284
+ var at = 0;
285
+ while (at < line.length && (line[at] === ' ' || line[at] === '\t')) {
286
+ indent += line[at] === '\t' ? 4 : 1;
287
+ at += 1;
288
+ }
289
+ return { indent: indent, at: at };
290
+ }
291
+ // Drops block quote markers ('> '), so a quote reads as its text
292
+ function stripQuote(line) {
293
+ var i = 0;
294
+ var quoted = false;
295
+ for (;;) {
296
+ var j = i;
297
+ var spaces = 0;
298
+ while (j < line.length && line[j] === ' ' && spaces < 3) {
299
+ j += 1;
300
+ spaces += 1;
301
+ }
302
+ if (line[j] !== '>')
303
+ break;
304
+ quoted = true;
305
+ i = j + 1;
306
+ if (line[i] === ' ')
307
+ i += 1;
308
+ }
309
+ return { line: quoted ? line.slice(i) : line, quoted: quoted };
310
+ }
311
+ function isRule(line) {
312
+ var _a = indentOf(line), indent = _a.indent, at = _a.at;
313
+ if (indent > 3)
314
+ return false;
315
+ var mark = line[at];
316
+ if (mark !== '-' && mark !== '*' && mark !== '_')
317
+ return false;
318
+ var count = 0;
319
+ for (var i = at; i < line.length; i += 1) {
320
+ if (line[i] === mark)
321
+ count += 1;
322
+ else if (line[i] !== ' ' && line[i] !== '\t')
323
+ return false;
324
+ }
325
+ return count >= 3;
326
+ }
327
+ function headingOf(line) {
328
+ var _a = indentOf(line), indent = _a.indent, at = _a.at;
329
+ if (indent > 3 || line[at] !== '#')
330
+ return null;
331
+ var j = at;
332
+ while (j < line.length && line[j] === '#')
333
+ j += 1;
334
+ var hashes = j - at;
335
+ if (hashes > 6 || (line[j] !== ' ' && line[j] !== '\t'))
336
+ return null;
337
+ var text = line.slice(j).trim();
338
+ // A closing run of '#' goes, when a space sets it off
339
+ var k = text.length;
340
+ while (k > 0 && text[k - 1] === '#')
341
+ k -= 1;
342
+ if (k < text.length && (k === 0 || text[k - 1] === ' ' || text[k - 1] === '\t'))
343
+ text = text.slice(0, k).trim();
344
+ if (!text)
345
+ return null;
346
+ return { depth: Math.min(hashes, 3), text: text };
347
+ }
348
+ function fenceOf(line) {
349
+ var _a = indentOf(line), indent = _a.indent, at = _a.at;
350
+ var mark = line[at];
351
+ if (mark !== '`' && mark !== '~')
352
+ return null;
353
+ var j = at;
354
+ while (j < line.length && line[j] === mark)
355
+ j += 1;
356
+ if (j - at < 3)
357
+ return null;
358
+ var info = line.slice(j).trim();
359
+ if (mark === '`' && info.includes('`'))
360
+ return null;
361
+ var word = info.split(/\s/, 1)[0];
362
+ return word ? { mark: mark, length: j - at, indent: indent, language: word } : { mark: mark, length: j - at, indent: indent };
363
+ }
364
+ function closesFence(line, fence) {
365
+ var at = indentOf(line).at;
366
+ var j = at;
367
+ while (j < line.length && line[j] === fence.mark)
368
+ j += 1;
369
+ return j - at >= fence.length && line.slice(j).trim() === '';
370
+ }
371
+ function itemOf(line) {
372
+ var _a = indentOf(line), indent = _a.indent, at = _a.at;
373
+ var ch = line[at];
374
+ var j = at;
375
+ var ordered = false;
376
+ if (ch === '-' || ch === '*' || ch === '+')
377
+ j += 1;
378
+ else {
379
+ while (j < line.length && j - at < 9 && line[j] >= '0' && line[j] <= '9')
380
+ j += 1;
381
+ if (j === at || (line[j] !== '.' && line[j] !== ')'))
382
+ return null;
383
+ j += 1;
384
+ ordered = true;
385
+ }
386
+ if (line[j] !== ' ' && line[j] !== '\t')
387
+ return null;
388
+ var text = line.slice(j).trim();
389
+ return text ? { indent: indent, ordered: ordered, text: text } : null;
390
+ }
391
+ function isTableDelimiter(line) {
392
+ if (line === undefined || !line.includes('|') || !line.includes('-'))
393
+ return false;
394
+ for (var i = 0; i < line.length; i += 1) {
395
+ if ('|-: \t'.indexOf(line[i]) < 0)
396
+ return false;
397
+ }
398
+ return true;
399
+ }
400
+ var paragraph = function (lines) {
401
+ var children = parseInline(lines.join(' '));
402
+ return children.length ? { type: 'paragraph', children: children } : null;
403
+ };
404
+ function flushItemLines(item) {
405
+ if (item.lines) {
406
+ var p = paragraph(item.lines);
407
+ if (p)
408
+ item.blocks.push(p);
409
+ item.lines = null;
410
+ }
411
+ }
412
+ function flushNested(item) {
413
+ if (item.nested) {
414
+ var _a = item.nested, ordered = _a.ordered, items = _a.items;
415
+ item.blocks.push({ type: 'list', ordered: ordered, items: items.map(function (lines) { return [paragraph(lines)].filter(Boolean); }) });
416
+ item.nested = null;
417
+ }
418
+ }
419
+ function flushItem(item) {
420
+ flushItemLines(item);
421
+ flushNested(item);
422
+ }
423
+ export function parseMarkdown(text) {
424
+ var _a;
425
+ var lines = text.split(/\r\n|\r|\n/);
426
+ var blocks = [];
427
+ var para = null;
428
+ var list = null;
429
+ var fence = null;
430
+ var closePara = function () {
431
+ if (para) {
432
+ var p = paragraph(para);
433
+ if (p)
434
+ blocks.push(p);
435
+ para = null;
436
+ }
437
+ };
438
+ var closeList = function () {
439
+ if (list) {
440
+ list.items.forEach(flushItem);
441
+ blocks.push({ type: 'list', ordered: list.ordered, items: list.items.map(function (item) { return item.blocks; }) });
442
+ list = null;
443
+ }
444
+ };
445
+ var closeFence = function (unclosed) {
446
+ if (unclosed === void 0) { unclosed = false; }
447
+ if (fence) {
448
+ // A fence still open at the end (a reply that is streaming) does not grow a blank last line
449
+ if (unclosed && fence.lines.at(-1) === '')
450
+ fence.lines.pop();
451
+ var block = fence.language
452
+ ? { type: 'code', language: fence.language, code: fence.lines.join('\n') }
453
+ : { type: 'code', code: fence.lines.join('\n') };
454
+ fence.into.push(block);
455
+ fence = null;
456
+ }
457
+ };
458
+ var newItem = function (itemText) { return ({ blocks: [], lines: [itemText], nested: null }); };
459
+ for (var index = 0; index < lines.length; index += 1) {
460
+ var raw = lines[index];
461
+ if (fence) {
462
+ var line_1 = fence.quoted ? stripQuote(raw).line : raw;
463
+ if (closesFence(line_1, fence)) {
464
+ closeFence();
465
+ continue;
466
+ }
467
+ // Up to the fence's own indent comes off each line
468
+ var k = 0;
469
+ while (k < fence.indent && line_1[k] === ' ')
470
+ k += 1;
471
+ fence.lines.push(line_1.slice(k));
472
+ continue;
473
+ }
474
+ var _b = stripQuote(raw), line = _b.line, quoted = _b.quoted;
475
+ if (line.trim() === '') {
476
+ closePara();
477
+ if (list) {
478
+ list.blank = true;
479
+ flushItemLines(list.items[list.items.length - 1]);
480
+ }
481
+ continue;
482
+ }
483
+ var indent = indentOf(line).indent;
484
+ var opened = fenceOf(line);
485
+ if (opened) {
486
+ var into = blocks;
487
+ var current = list;
488
+ if (current && indent >= current.indent + 2) {
489
+ var item = current.items[current.items.length - 1];
490
+ flushItem(item);
491
+ into = item.blocks;
492
+ current.blank = false;
493
+ }
494
+ else {
495
+ closePara();
496
+ closeList();
497
+ }
498
+ fence = __assign(__assign({}, opened), { lines: [], quoted: quoted, into: into });
499
+ continue;
500
+ }
501
+ if (list) {
502
+ var current = list;
503
+ var item = current.items[current.items.length - 1];
504
+ var marker_1 = isRule(line) ? null : itemOf(line);
505
+ if (marker_1 && marker_1.indent >= current.indent + 2) {
506
+ // One level of nesting; anything deeper joins that level
507
+ flushItemLines(item);
508
+ if (item.nested && item.nested.ordered !== marker_1.ordered)
509
+ flushNested(item);
510
+ if (!item.nested)
511
+ item.nested = { ordered: marker_1.ordered, indent: marker_1.indent, items: [] };
512
+ item.nested.items.push([marker_1.text]);
513
+ current.blank = false;
514
+ continue;
515
+ }
516
+ if (marker_1 && marker_1.ordered === current.ordered) {
517
+ flushItem(item);
518
+ current.items.push(newItem(marker_1.text));
519
+ current.blank = false;
520
+ continue;
521
+ }
522
+ var startsBlock = isRule(line) || marker_1 || headingOf(line) || (line.includes('|') && isTableDelimiter(lines[index + 1]));
523
+ if (!startsBlock && (!current.blank || indent >= current.indent + 2)) {
524
+ var nested = item.nested;
525
+ if (nested && (!current.blank || indent >= nested.indent + 2)) {
526
+ nested.items[nested.items.length - 1].push(line.trim());
527
+ }
528
+ else {
529
+ flushNested(item);
530
+ if (!item.lines)
531
+ item.lines = [];
532
+ item.lines.push(line.trim());
533
+ }
534
+ current.blank = false;
535
+ continue;
536
+ }
537
+ closeList();
538
+ }
539
+ var heading = headingOf(line);
540
+ if (heading) {
541
+ closePara();
542
+ blocks.push({ type: 'heading', depth: heading.depth, children: parseInline(heading.text) });
543
+ continue;
544
+ }
545
+ if (isRule(line)) {
546
+ closePara();
547
+ blocks.push({ type: 'rule' });
548
+ continue;
549
+ }
550
+ if (line.includes('|') && isTableDelimiter(stripQuote((_a = lines[index + 1]) !== null && _a !== void 0 ? _a : '').line)) {
551
+ closePara();
552
+ var rows = [line.trim()];
553
+ while (index + 1 < lines.length) {
554
+ var next = stripQuote(lines[index + 1]).line;
555
+ if (next.trim() === '' || !next.includes('|'))
556
+ break;
557
+ rows.push(next.trim());
558
+ index += 1;
559
+ }
560
+ blocks.push({ type: 'code', code: rows.join('\n'), table: true });
561
+ continue;
562
+ }
563
+ var marker = indent <= 3 ? itemOf(line) : null;
564
+ if (marker) {
565
+ closePara();
566
+ list = { ordered: marker.ordered, indent: marker.indent, items: [newItem(marker.text)], blank: false };
567
+ continue;
568
+ }
569
+ if (!para)
570
+ para = [];
571
+ para.push(line.trim());
572
+ }
573
+ closeFence(true);
574
+ closePara();
575
+ closeList();
576
+ return blocks;
577
+ }
@@ -16,4 +16,6 @@ type PauseState = {
16
16
  type PauseEvent = 'pointerEnter' | 'pointerLeave' | 'focus' | 'blur';
17
17
  export declare function pauseReducer(state: PauseState, event: PauseEvent): PauseState;
18
18
  export declare const isPaused: ({ hovered, focused }: PauseState) => boolean;
19
+ export declare function announcementText(item: ToastItem): string;
20
+ export declare const liveRegionFor: (type: ToastItem["type"]) => "polite" | "assertive";
19
21
  export {};
@@ -48,3 +48,11 @@ export var isPaused = function (_a) {
48
48
  var hovered = _a.hovered, focused = _a.focused;
49
49
  return hovered || focused;
50
50
  };
51
+ // What a screen reader hears for a toast: the message, then the second line as its own sentence
52
+ export function announcementText(item) {
53
+ if (!item.secondMessage)
54
+ return item.message;
55
+ return /[.!?…]$/.test(item.message.trim()) ? "".concat(item.message, " ").concat(item.secondMessage) : "".concat(item.message, ". ").concat(item.secondMessage);
56
+ }
57
+ // Errors interrupt; everything else waits for a pause
58
+ export var liveRegionFor = function (type) { return (type === 'error' ? 'assertive' : 'polite'); };
@@ -207,6 +207,12 @@
207
207
  "swiftui": "`ProgressView`",
208
208
  "compose": "`CircularProgressIndicator`"
209
209
  },
210
+ {
211
+ "ods": "markdown",
212
+ "swiftui": "A `VStack` of the same subset of blocks, each line of text a `Text(AttributedString(markdown:options: .init(interpretedSyntax: .inlineOnlyPreservingWhitespace)))`, code in `codeBlock`",
213
+ "compose": "A `Column` of the same subset, parsed by hand (Compose has no system markdown), each line of text a `Text` with an `AnnotatedString` whose links are `LinkAnnotation.Url`",
214
+ "note": "Headings to three levels, lists one level deep, fenced code, rules, bold, italic, inline code and links. Only http, https and mailto links open; a table shows as code and an image as its alt text."
215
+ },
210
216
  {
211
217
  "ods": "menu",
212
218
  "swiftui": "`Menu` or `.contextMenu`",
@@ -369,7 +375,7 @@
369
375
  "ods": "statTile",
370
376
  "swiftui": "A `VStack` of `Text`s with `.accessibilityElement(children: .combine)`",
371
377
  "compose": "A `Column` with `Modifier.semantics(mergeDescendants = true)`",
372
- "note": "Not colored by good or bad. Numbers: `.number.notation(.compactName)` / `.currency(code:)` on Apple; `CompactDecimalFormat` / `NumberFormat.getCurrencyInstance` on Android. Loading: `.redacted(reason: .placeholder)`."
378
+ "note": "Not colored by good or bad. A percent's change is in points ('Up 3 pts'), not a percent of a percent, and its accessibility label says 'percentage points'. Money uses the currency's own decimals. Numbers: `.number.notation(.compactName)` / `.currency(code:)` on Apple; `CompactDecimalFormat` / `NumberFormat.getCurrencyInstance` on Android. Loading: `.redacted(reason: .placeholder)`."
373
379
  },
374
380
  {
375
381
  "ods": "tab",
@@ -387,7 +393,7 @@
387
393
  "ods": "tableCell",
388
394
  "swiftui": "A `TableColumn` content view",
389
395
  "compose": "`Text` in a `Row` with `Modifier.weight`",
390
- "note": "Material 3 has no table."
396
+ "note": "Material 3 has no table. `rowHeader` makes the first cell name its row: the first `TableColumn` on Apple, and `semantics { heading() }` on that cell on Android."
391
397
  },
392
398
  {
393
399
  "ods": "tableContainer",
@@ -456,7 +462,7 @@
456
462
  "ods": "toaster",
457
463
  "swiftui": "`ODSBanner` for an inline message; a system banner (a local notification) when the app is not in front",
458
464
  "compose": "`Snackbar` in a `SnackbarHost`",
459
- "note": "SwiftUI has no toast, so ODS adds none: show the message in the screen."
465
+ "note": "SwiftUI has no toast, so ODS adds none: show the message in the screen. SwiftUI posts `AccessibilityNotification.Announcement`; Compose sets `liveRegion` on the snackbar host."
460
466
  },
461
467
  {
462
468
  "ods": "tooltip",
@@ -28,6 +28,7 @@ export declare const AuthGateLoading_Spinner: Story;
28
28
  export declare const AuthGateLoading_SpinnerWithLine: Story;
29
29
  export declare const BillingPage_SelfServe: Story;
30
30
  export declare const BillingPage_BilledElsewhere: Story;
31
+ export declare const BillingPage_Trial: Story;
31
32
  export declare const BlogIndex_List: Story;
32
33
  export declare const BlogIndex_Cards: Story;
33
34
  export declare const Breadcrumb_Trail: Story;
@@ -53,6 +54,8 @@ export declare const ContactPage_Form: Story;
53
54
  export declare const ContactPage_Links: Story;
54
55
  export declare const ConversationStarters_Chips: Story;
55
56
  export declare const ConversationStarters_None: Story;
57
+ export declare const CookieChoice_Banner: Story;
58
+ export declare const CookieChoice_Settings: Story;
56
59
  export declare const CreateModal_Quick: Story;
57
60
  export declare const CreateModal_WithSettings: Story;
58
61
  export declare const DangerZone_Collapsed: Story;
@@ -132,6 +135,8 @@ export declare const MessageRow_PersonAndAgent: Story;
132
135
  export declare const MessageRow_Grouped: Story;
133
136
  export declare const MobileMenu_Links: Story;
134
137
  export declare const MobileMenu_Sections: Story;
138
+ export declare const NewsletterSignup_Inline: Story;
139
+ export declare const NewsletterSignup_Section: Story;
135
140
  export declare const NotFoundPage_FullPage: Story;
136
141
  export declare const NotFoundPage_InShell: Story;
137
142
  export declare const NotificationMenu_Menu: Story;
@@ -159,6 +164,7 @@ export declare const PeopleRow_Names: Story;
159
164
  export declare const PlanChangeConfirm_Upgrade: Story;
160
165
  export declare const PlanChangeConfirm_Downgrade: Story;
161
166
  export declare const PlanChangeConfirm_Blocked: Story;
167
+ export declare const PlanComparison_Table: Story;
162
168
  export declare const PlanPicker_Cards: Story;
163
169
  export declare const PlanPicker_List: Story;
164
170
  export declare const PlanSignOff_OneApprover: Story;