@ballistix.digital/react-components 8.5.5 → 8.5.6

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
@@ -6229,6 +6229,7 @@ var $b964d0845ae86974$var$base = {
6229
6229
  },
6230
6230
  area: {
6231
6231
  container: 'overflow-hidden p-4',
6232
+ emptyLine: 'min-h-[1em] leading-none',
6232
6233
  editable: 'leading-7 focus:outline-none prose prose-sm max-w-none prose-headings:font-semibold prose-h1:text-2xl prose-h2:text-xl prose-p:my-3 prose-blockquote:my-3'
6233
6234
  }
6234
6235
  },
@@ -6339,10 +6340,32 @@ var $784e2eeeb6b1d65b$var$applyMarks = function(content, marks) {
6339
6340
  });
6340
6341
  return content;
6341
6342
  };
6343
+ var $784e2eeeb6b1d65b$var$isNodeTextEmpty = function(node) {
6344
+ var _a, _b;
6345
+ if ((0, $iA2ta$slate.Text).isText(node)) return ((_a = node.text) !== null && _a !== void 0 ? _a : '').trim() === '';
6346
+ if ((0, $iA2ta$slate.Editor).isEditor(node) || (0, $iA2ta$slate.Element).isElement(node)) {
6347
+ var children = (_b = node.children) !== null && _b !== void 0 ? _b : [];
6348
+ if ((0, $iA2ta$lodash.isEmpty)(children)) return true;
6349
+ return (0, $iA2ta$lodash.every)(children, function(child) {
6350
+ return $784e2eeeb6b1d65b$var$isNodeTextEmpty(child);
6351
+ });
6352
+ }
6353
+ return true;
6354
+ };
6355
+ var $784e2eeeb6b1d65b$var$isDocumentAllTextEmpty = function(value) {
6356
+ if (!(0, $iA2ta$lodash.isArray)(value) || (0, $iA2ta$lodash.isEmpty)(value)) return true;
6357
+ return (0, $iA2ta$lodash.every)(value, function(node) {
6358
+ return $784e2eeeb6b1d65b$var$isNodeTextEmpty(node);
6359
+ });
6360
+ };
6342
6361
  var $784e2eeeb6b1d65b$var$renderRichNode = function(node, options) {
6343
6362
  if (options === void 0) options = {};
6344
6363
  var attributes = options.attributes, providedChildren = options.children, key = options.key;
6345
6364
  if ((0, $iA2ta$slate.Text).isText(node)) {
6365
+ if (String(providedChildren !== null && providedChildren !== void 0 ? providedChildren : node.text).trim() === '') return (0, $iA2ta$reactjsxruntime.jsx)("div", {
6366
+ className: (0, $b964d0845ae86974$export$2e2bcd8739ae039).editor.area.emptyLine,
6367
+ "aria-hidden": "true"
6368
+ }, key);
6346
6369
  var content = $784e2eeeb6b1d65b$var$applyMarks(providedChildren !== null && providedChildren !== void 0 ? providedChildren : node.text, node);
6347
6370
  return attributes ? (0, $iA2ta$reactjsxruntime.jsx)("span", $784e2eeeb6b1d65b$var$__assign({}, attributes, {
6348
6371
  children: content
@@ -6486,7 +6509,7 @@ var $784e2eeeb6b1d65b$var$RichTextArea = function(_a) {
6486
6509
  generateBlockButton('justify', 'align-justify')
6487
6510
  ]);
6488
6511
  if (!(0, $iA2ta$lodash.isEmpty)(align)) sections.push(align);
6489
- return sections.map(function(group, index) {
6512
+ return (0, $iA2ta$lodash.map)(sections, function(group, index) {
6490
6513
  return (0, $iA2ta$reactjsxruntime.jsxs)((0, $iA2ta$react.Fragment), {
6491
6514
  children: [
6492
6515
  index > 0 && (0, $iA2ta$reactjsxruntime.jsx)("div", {
@@ -6501,7 +6524,7 @@ var $784e2eeeb6b1d65b$var$RichTextArea = function(_a) {
6501
6524
  generateBlockButton,
6502
6525
  styles.editor.toolbar.divider
6503
6526
  ]);
6504
- if (isReadOnly && (0, $iA2ta$lodash.isEmpty)(parsedInitialValue)) return null;
6527
+ if (isReadOnly && ((0, $iA2ta$lodash.isEmpty)(parsedInitialValue) || $784e2eeeb6b1d65b$var$isDocumentAllTextEmpty(parsedInitialValue))) return null;
6505
6528
  return isReadOnly ? (0, $iA2ta$reactjsxruntime.jsx)("div", {
6506
6529
  className: styles.readOnlyWrapper,
6507
6530
  children: (0, $iA2ta$lodash.isArray)(parsedInitialValue) ? (0, $iA2ta$lodash.map)(parsedInitialValue, function(n, i) {