odaptos_design_system 2.0.349 → 2.0.350

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/index.js CHANGED
@@ -265,9 +265,15 @@ style_inject_es_default(css_248z$82);
265
265
  * Supports: **bold**, *italic*, __underline__ (or <u>underline</u>), `code`, line breaks, and simple lists.
266
266
  */
267
267
  const renderInlineMarkdown = (rawText) => {
268
- if (rawText === null || rawText === void 0) return rawText;
269
- if (typeof rawText !== "string") return rawText;
270
- if (rawText.length === 0) return rawText;
268
+ const normalizeToDisplayText = (value) => {
269
+ if (value === null || value === void 0) return "";
270
+ if (typeof value === "string") return value;
271
+ if (value instanceof String) return value.toString();
272
+ if (typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") return String(value);
273
+ return "";
274
+ };
275
+ const normalizedText = normalizeToDisplayText(rawText);
276
+ if (normalizedText.length === 0) return normalizedText;
271
277
  const renderCode = (text) => {
272
278
  return text.split(/`([^`]+)`/g).map((part, index) => {
273
279
  if (!(index % 2 === 1)) return part;
@@ -373,40 +379,44 @@ const renderInlineMarkdown = (rawText) => {
373
379
  const codeNodes = renderCode(text);
374
380
  return renderStrongAndEm(codeNodes);
375
381
  };
376
- const lines = rawText.split("\n");
377
- const blocks = [];
378
- let i = 0;
379
- while (i < lines.length) {
380
- const line = lines[i] ?? "";
381
- const unorderedMatch = line.match(/^\s*[-*]\s+(.*)$/);
382
- const orderedMatch = line.match(/^\s*(\d+)\.\s+(.*)$/);
383
- if (unorderedMatch) {
384
- const items = [];
385
- while (i < lines.length) {
386
- const match = (lines[i] ?? "").match(/^\s*[-*]\s+(.*)$/);
387
- if (!match) break;
388
- items.push(match[1]);
389
- i += 1;
382
+ try {
383
+ const lines = normalizedText.split("\n");
384
+ const blocks = [];
385
+ let i = 0;
386
+ while (i < lines.length) {
387
+ const line = lines[i] ?? "";
388
+ const unorderedMatch = line.match(/^\s*[-*]\s+(.*)$/);
389
+ const orderedMatch = line.match(/^\s*(\d+)\.\s+(.*)$/);
390
+ if (unorderedMatch) {
391
+ const items = [];
392
+ while (i < lines.length) {
393
+ const match = (lines[i] ?? "").match(/^\s*[-*]\s+(.*)$/);
394
+ if (!match) break;
395
+ items.push(match[1]);
396
+ i += 1;
397
+ }
398
+ blocks.push(/* @__PURE__ */ React.createElement("ul", { key: `ul-${blocks.length}` }, items.map((item, index) => /* @__PURE__ */ React.createElement("li", { key: `ul-li-${index}` }, renderInline(item)))));
399
+ continue;
390
400
  }
391
- blocks.push(/* @__PURE__ */ React.createElement("ul", { key: `ul-${blocks.length}` }, items.map((item, index) => /* @__PURE__ */ React.createElement("li", { key: `ul-li-${index}` }, renderInline(item)))));
392
- continue;
393
- }
394
- if (orderedMatch) {
395
- const items = [];
396
- while (i < lines.length) {
397
- const match = (lines[i] ?? "").match(/^\s*\d+\.\s+(.*)$/);
398
- if (!match) break;
399
- items.push(match[1]);
400
- i += 1;
401
+ if (orderedMatch) {
402
+ const items = [];
403
+ while (i < lines.length) {
404
+ const match = (lines[i] ?? "").match(/^\s*\d+\.\s+(.*)$/);
405
+ if (!match) break;
406
+ items.push(match[1]);
407
+ i += 1;
408
+ }
409
+ blocks.push(/* @__PURE__ */ React.createElement("ol", { key: `ol-${blocks.length}` }, items.map((item, index) => /* @__PURE__ */ React.createElement("li", { key: `ol-li-${index}` }, renderInline(item)))));
410
+ continue;
401
411
  }
402
- blocks.push(/* @__PURE__ */ React.createElement("ol", { key: `ol-${blocks.length}` }, items.map((item, index) => /* @__PURE__ */ React.createElement("li", { key: `ol-li-${index}` }, renderInline(item)))));
403
- continue;
412
+ blocks.push(/* @__PURE__ */ React.createElement(React.Fragment, { key: `p-${blocks.length}` }, renderInline(line)));
413
+ if (i < lines.length - 1) blocks.push(/* @__PURE__ */ React.createElement("br", { key: `br-${blocks.length}` }));
414
+ i += 1;
404
415
  }
405
- blocks.push(/* @__PURE__ */ React.createElement(React.Fragment, { key: `p-${blocks.length}` }, renderInline(line)));
406
- if (i < lines.length - 1) blocks.push(/* @__PURE__ */ React.createElement("br", { key: `br-${blocks.length}` }));
407
- i += 1;
416
+ return blocks;
417
+ } catch (error) {
418
+ return normalizedText;
408
419
  }
409
- return blocks;
410
420
  };
411
421
 
412
422
  //#endregion