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.cjs CHANGED
@@ -319,9 +319,15 @@ style_inject_es_default(css_248z$82);
319
319
  * Supports: **bold**, *italic*, __underline__ (or <u>underline</u>), `code`, line breaks, and simple lists.
320
320
  */
321
321
  const renderInlineMarkdown = (rawText) => {
322
- if (rawText === null || rawText === void 0) return rawText;
323
- if (typeof rawText !== "string") return rawText;
324
- if (rawText.length === 0) return rawText;
322
+ const normalizeToDisplayText = (value) => {
323
+ if (value === null || value === void 0) return "";
324
+ if (typeof value === "string") return value;
325
+ if (value instanceof String) return value.toString();
326
+ if (typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") return String(value);
327
+ return "";
328
+ };
329
+ const normalizedText = normalizeToDisplayText(rawText);
330
+ if (normalizedText.length === 0) return normalizedText;
325
331
  const renderCode = (text) => {
326
332
  return text.split(/`([^`]+)`/g).map((part, index) => {
327
333
  if (!(index % 2 === 1)) return part;
@@ -427,40 +433,44 @@ const renderInlineMarkdown = (rawText) => {
427
433
  const codeNodes = renderCode(text);
428
434
  return renderStrongAndEm(codeNodes);
429
435
  };
430
- const lines = rawText.split("\n");
431
- const blocks = [];
432
- let i = 0;
433
- while (i < lines.length) {
434
- const line = lines[i] ?? "";
435
- const unorderedMatch = line.match(/^\s*[-*]\s+(.*)$/);
436
- const orderedMatch = line.match(/^\s*(\d+)\.\s+(.*)$/);
437
- if (unorderedMatch) {
438
- const items = [];
439
- while (i < lines.length) {
440
- const match = (lines[i] ?? "").match(/^\s*[-*]\s+(.*)$/);
441
- if (!match) break;
442
- items.push(match[1]);
443
- i += 1;
436
+ try {
437
+ const lines = normalizedText.split("\n");
438
+ const blocks = [];
439
+ let i = 0;
440
+ while (i < lines.length) {
441
+ const line = lines[i] ?? "";
442
+ const unorderedMatch = line.match(/^\s*[-*]\s+(.*)$/);
443
+ const orderedMatch = line.match(/^\s*(\d+)\.\s+(.*)$/);
444
+ if (unorderedMatch) {
445
+ const items = [];
446
+ while (i < lines.length) {
447
+ const match = (lines[i] ?? "").match(/^\s*[-*]\s+(.*)$/);
448
+ if (!match) break;
449
+ items.push(match[1]);
450
+ i += 1;
451
+ }
452
+ blocks.push(/* @__PURE__ */ react.default.createElement("ul", { key: `ul-${blocks.length}` }, items.map((item, index) => /* @__PURE__ */ react.default.createElement("li", { key: `ul-li-${index}` }, renderInline(item)))));
453
+ continue;
444
454
  }
445
- blocks.push(/* @__PURE__ */ react.default.createElement("ul", { key: `ul-${blocks.length}` }, items.map((item, index) => /* @__PURE__ */ react.default.createElement("li", { key: `ul-li-${index}` }, renderInline(item)))));
446
- continue;
447
- }
448
- if (orderedMatch) {
449
- const items = [];
450
- while (i < lines.length) {
451
- const match = (lines[i] ?? "").match(/^\s*\d+\.\s+(.*)$/);
452
- if (!match) break;
453
- items.push(match[1]);
454
- i += 1;
455
+ if (orderedMatch) {
456
+ const items = [];
457
+ while (i < lines.length) {
458
+ const match = (lines[i] ?? "").match(/^\s*\d+\.\s+(.*)$/);
459
+ if (!match) break;
460
+ items.push(match[1]);
461
+ i += 1;
462
+ }
463
+ blocks.push(/* @__PURE__ */ react.default.createElement("ol", { key: `ol-${blocks.length}` }, items.map((item, index) => /* @__PURE__ */ react.default.createElement("li", { key: `ol-li-${index}` }, renderInline(item)))));
464
+ continue;
455
465
  }
456
- blocks.push(/* @__PURE__ */ react.default.createElement("ol", { key: `ol-${blocks.length}` }, items.map((item, index) => /* @__PURE__ */ react.default.createElement("li", { key: `ol-li-${index}` }, renderInline(item)))));
457
- continue;
466
+ blocks.push(/* @__PURE__ */ react.default.createElement(react.default.Fragment, { key: `p-${blocks.length}` }, renderInline(line)));
467
+ if (i < lines.length - 1) blocks.push(/* @__PURE__ */ react.default.createElement("br", { key: `br-${blocks.length}` }));
468
+ i += 1;
458
469
  }
459
- blocks.push(/* @__PURE__ */ react.default.createElement(react.default.Fragment, { key: `p-${blocks.length}` }, renderInline(line)));
460
- if (i < lines.length - 1) blocks.push(/* @__PURE__ */ react.default.createElement("br", { key: `br-${blocks.length}` }));
461
- i += 1;
470
+ return blocks;
471
+ } catch (error) {
472
+ return normalizedText;
462
473
  }
463
- return blocks;
464
474
  };
465
475
 
466
476
  //#endregion