@oliasoft-open-source/react-ui-library 4.9.2 → 4.10.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 (28) hide show
  1. package/dist/404.html +1 -1
  2. package/dist/assets/{index-CnfDrmnZ.js → index-DoFa61ar.js} +79 -137
  3. package/dist/index.html +1 -1
  4. package/dist/index.js +26 -18
  5. package/dist/index.js.map +1 -1
  6. package/dist/storybook/assets/{Color-KGDBMAHA-sr_lo8VN.js → Color-KGDBMAHA-BaE9XYqa.js} +1 -1
  7. package/dist/storybook/assets/{DocsRenderer-PKQXORMH-Dio4TQT6.js → DocsRenderer-PKQXORMH-C4AGRx7h.js} +1 -1
  8. package/dist/storybook/assets/{buttons-and-links-BOcv8xIU.js → buttons-and-links-CT3uME8p.js} +1 -1
  9. package/dist/storybook/assets/{chunk-HLWAVYOI-SLqzrZ8s.js → chunk-HLWAVYOI-DU16cKyP.js} +1 -1
  10. package/dist/storybook/assets/{color-D1FmkH7Y.js → color-CHwfPS7Y.js} +1 -1
  11. package/dist/storybook/assets/{iframe-NUuxNiwO.js → iframe-BjMiZc8R.js} +2 -2
  12. package/dist/storybook/assets/{index-DNcuiqfZ.js → index-3PqFqMP3.js} +1 -1
  13. package/dist/storybook/assets/{index-Bhtru3gK.js → index-B50vPCIH.js} +4 -4
  14. package/dist/storybook/assets/{input-validation-FFJCXfNa.js → input-validation-I1yYbPtK.js} +1 -1
  15. package/dist/storybook/assets/{inputs-D3ZjmDIl.js → inputs-B6X_h0ac.js} +1 -1
  16. package/dist/storybook/assets/{layout-forms-DNUCHjRh.js → layout-forms-BHoZkwXg.js} +1 -1
  17. package/dist/storybook/assets/{layout-general-CuxE1EOt.js → layout-general-BA9lilWm.js} +1 -1
  18. package/dist/storybook/assets/{padding-and-spacing-B-LaxRb4.js → padding-and-spacing-CURwwYca.js} +1 -1
  19. package/dist/storybook/assets/{preview-ClcAw55r.js → preview-DKYV1Qdr.js} +2 -2
  20. package/dist/storybook/assets/{preview-DQgT2zeu.js → preview-Dgjy7Hpm.js} +1 -1
  21. package/dist/storybook/assets/{rich-text-input.stories-hAHCnDHk.js → rich-text-input.stories-DkaOBgbE.js} +46 -46
  22. package/dist/storybook/assets/unit-input.stories-C7gVMOCX.js +389 -0
  23. package/dist/storybook/iframe.html +1 -1
  24. package/dist/storybook/index.json +1 -1
  25. package/dist/storybook/project.json +1 -1
  26. package/dist/storybook/sb-manager/globals-runtime.js +1 -1
  27. package/package.json +1 -1
  28. package/dist/storybook/assets/unit-input.stories-BHTxKnOU.js +0 -380
package/dist/404.html CHANGED
@@ -1 +1 @@
1
- <!doctype html><head><title>React UI Library</title><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1" user-scalable="no"><meta name="apple-mobile-web-app-capable" content="yes"><script type="module" crossorigin src="/react-ui-library/assets/index-CnfDrmnZ.js"></script><link rel="stylesheet" crossorigin href="/react-ui-library/assets/index-BpSdrNXy.css"></head><body><div id="content"></div></body>
1
+ <!doctype html><head><title>React UI Library</title><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1" user-scalable="no"><meta name="apple-mobile-web-app-capable" content="yes"><script type="module" crossorigin src="/react-ui-library/assets/index-DoFa61ar.js"></script><link rel="stylesheet" crossorigin href="/react-ui-library/assets/index-BpSdrNXy.css"></head><body><div id="content"></div></body>
@@ -29044,7 +29044,7 @@ class DOMParser {
29044
29044
  */
29045
29045
  parse(dom, options2 = {}) {
29046
29046
  let context2 = new ParseContext(this, options2, false);
29047
- context2.addAll(dom, options2.from, options2.to);
29047
+ context2.addAll(dom, Mark.none, options2.from, options2.to);
29048
29048
  return context2.finish();
29049
29049
  }
29050
29050
  /**
@@ -29057,7 +29057,7 @@ class DOMParser {
29057
29057
  */
29058
29058
  parseSlice(dom, options2 = {}) {
29059
29059
  let context2 = new ParseContext(this, options2, true);
29060
- context2.addAll(dom, options2.from, options2.to);
29060
+ context2.addAll(dom, Mark.none, options2.from, options2.to);
29061
29061
  return Slice.maxOpen(context2.finish());
29062
29062
  }
29063
29063
  /**
@@ -29190,16 +29190,14 @@ function wsOptionsFor(type2, preserveWhitespace, base2) {
29190
29190
  return type2 && type2.whitespace == "pre" ? OPT_PRESERVE_WS | OPT_PRESERVE_WS_FULL : base2 & ~OPT_OPEN_LEFT;
29191
29191
  }
29192
29192
  class NodeContext {
29193
- constructor(type2, attrs, marks, pendingMarks, solid, match2, options2) {
29193
+ constructor(type2, attrs, marks, solid, match2, options2) {
29194
29194
  this.type = type2;
29195
29195
  this.attrs = attrs;
29196
29196
  this.marks = marks;
29197
- this.pendingMarks = pendingMarks;
29198
29197
  this.solid = solid;
29199
29198
  this.options = options2;
29200
29199
  this.content = [];
29201
29200
  this.activeMarks = Mark.none;
29202
- this.stashMarks = [];
29203
29201
  this.match = match2 || (options2 & OPT_OPEN_LEFT ? null : type2.contentMatch);
29204
29202
  }
29205
29203
  findWrapping(node2) {
@@ -29237,20 +29235,6 @@ class NodeContext {
29237
29235
  content = content.append(this.match.fillBefore(Fragment.empty, true));
29238
29236
  return this.type ? this.type.create(this.attrs, content, this.marks) : content;
29239
29237
  }
29240
- popFromStashMark(mark) {
29241
- for (let i = this.stashMarks.length - 1; i >= 0; i--)
29242
- if (mark.eq(this.stashMarks[i]))
29243
- return this.stashMarks.splice(i, 1)[0];
29244
- }
29245
- applyPending(nextType) {
29246
- for (let i = 0, pending = this.pendingMarks; i < pending.length; i++) {
29247
- let mark = pending[i];
29248
- if ((this.type ? this.type.allowsMarkType(mark.type) : markMayApply(mark.type, nextType)) && !mark.isInSet(this.activeMarks)) {
29249
- this.activeMarks = mark.addToSet(this.activeMarks);
29250
- this.pendingMarks = mark.removeFromSet(this.pendingMarks);
29251
- }
29252
- }
29253
- }
29254
29238
  inlineContext(node2) {
29255
29239
  if (this.type)
29256
29240
  return this.type.inlineContent;
@@ -29268,11 +29252,11 @@ class ParseContext {
29268
29252
  let topNode = options2.topNode, topContext;
29269
29253
  let topOptions = wsOptionsFor(null, options2.preserveWhitespace, 0) | (isOpen ? OPT_OPEN_LEFT : 0);
29270
29254
  if (topNode)
29271
- topContext = new NodeContext(topNode.type, topNode.attrs, Mark.none, Mark.none, true, options2.topMatch || topNode.type.contentMatch, topOptions);
29255
+ topContext = new NodeContext(topNode.type, topNode.attrs, Mark.none, true, options2.topMatch || topNode.type.contentMatch, topOptions);
29272
29256
  else if (isOpen)
29273
- topContext = new NodeContext(null, null, Mark.none, Mark.none, true, null, topOptions);
29257
+ topContext = new NodeContext(null, null, Mark.none, true, null, topOptions);
29274
29258
  else
29275
- topContext = new NodeContext(parser.schema.topNodeType, null, Mark.none, Mark.none, true, null, topOptions);
29259
+ topContext = new NodeContext(parser.schema.topNodeType, null, Mark.none, true, null, topOptions);
29276
29260
  this.nodes = [topContext];
29277
29261
  this.find = options2.findPositions;
29278
29262
  this.needsBlock = false;
@@ -29283,31 +29267,13 @@ class ParseContext {
29283
29267
  // Add a DOM node to the content. Text is inserted as text node,
29284
29268
  // otherwise, the node is passed to `addElement` or, if it has a
29285
29269
  // `style` attribute, `addElementWithStyles`.
29286
- addDOM(dom) {
29270
+ addDOM(dom, marks) {
29287
29271
  if (dom.nodeType == 3)
29288
- this.addTextNode(dom);
29272
+ this.addTextNode(dom, marks);
29289
29273
  else if (dom.nodeType == 1)
29290
- this.addElement(dom);
29291
- }
29292
- withStyleRules(dom, f2) {
29293
- let style = dom.style;
29294
- if (!style || !style.length)
29295
- return f2();
29296
- let marks = this.readStyles(dom.style);
29297
- if (!marks)
29298
- return;
29299
- let [addMarks, removeMarks] = marks, top2 = this.top;
29300
- for (let i = 0; i < removeMarks.length; i++)
29301
- this.removePendingMark(removeMarks[i], top2);
29302
- for (let i = 0; i < addMarks.length; i++)
29303
- this.addPendingMark(addMarks[i]);
29304
- f2();
29305
- for (let i = 0; i < addMarks.length; i++)
29306
- this.removePendingMark(addMarks[i], top2);
29307
- for (let i = 0; i < removeMarks.length; i++)
29308
- this.addPendingMark(removeMarks[i]);
29309
- }
29310
- addTextNode(dom) {
29274
+ this.addElement(dom, marks);
29275
+ }
29276
+ addTextNode(dom, marks) {
29311
29277
  let value = dom.nodeValue;
29312
29278
  let top2 = this.top;
29313
29279
  if (top2.options & OPT_PRESERVE_WS_FULL || top2.inlineContext(dom) || /[^ \t\r\n\u000c]/.test(value)) {
@@ -29325,7 +29291,7 @@ class ParseContext {
29325
29291
  value = value.replace(/\r\n?/g, "\n");
29326
29292
  }
29327
29293
  if (value)
29328
- this.insertNode(this.parser.schema.text(value));
29294
+ this.insertNode(this.parser.schema.text(value), marks);
29329
29295
  this.findInText(dom);
29330
29296
  } else {
29331
29297
  this.findInside(dom);
@@ -29333,14 +29299,14 @@ class ParseContext {
29333
29299
  }
29334
29300
  // Try to find a handler for the given tag and use that to parse. If
29335
29301
  // none is found, the element's content nodes are added directly.
29336
- addElement(dom, matchAfter) {
29302
+ addElement(dom, marks, matchAfter) {
29337
29303
  let name2 = dom.nodeName.toLowerCase(), ruleID;
29338
29304
  if (listTags.hasOwnProperty(name2) && this.parser.normalizeLists)
29339
29305
  normalizeList(dom);
29340
29306
  let rule = this.options.ruleFromNode && this.options.ruleFromNode(dom) || (ruleID = this.parser.matchTag(dom, this, matchAfter));
29341
29307
  if (rule ? rule.ignore : ignoreTags.hasOwnProperty(name2)) {
29342
29308
  this.findInside(dom);
29343
- this.ignoreFallback(dom);
29309
+ this.ignoreFallback(dom, marks);
29344
29310
  } else if (!rule || rule.skip || rule.closeParent) {
29345
29311
  if (rule && rule.closeParent)
29346
29312
  this.open = Math.max(0, this.open - 1);
@@ -29356,38 +29322,37 @@ class ParseContext {
29356
29322
  if (!top2.type)
29357
29323
  this.needsBlock = true;
29358
29324
  } else if (!dom.firstChild) {
29359
- this.leafFallback(dom);
29325
+ this.leafFallback(dom, marks);
29360
29326
  return;
29361
29327
  }
29362
- if (rule && rule.skip)
29363
- this.addAll(dom);
29364
- else
29365
- this.withStyleRules(dom, () => this.addAll(dom));
29328
+ let innerMarks = rule && rule.skip ? marks : this.readStyles(dom, marks);
29329
+ if (innerMarks)
29330
+ this.addAll(dom, innerMarks);
29366
29331
  if (sync2)
29367
29332
  this.sync(top2);
29368
29333
  this.needsBlock = oldNeedsBlock;
29369
29334
  } else {
29370
- this.withStyleRules(dom, () => {
29371
- this.addElementByRule(dom, rule, rule.consuming === false ? ruleID : void 0);
29372
- });
29335
+ let innerMarks = this.readStyles(dom, marks);
29336
+ if (innerMarks)
29337
+ this.addElementByRule(dom, rule, innerMarks, rule.consuming === false ? ruleID : void 0);
29373
29338
  }
29374
29339
  }
29375
29340
  // Called for leaf DOM nodes that would otherwise be ignored
29376
- leafFallback(dom) {
29341
+ leafFallback(dom, marks) {
29377
29342
  if (dom.nodeName == "BR" && this.top.type && this.top.type.inlineContent)
29378
- this.addTextNode(dom.ownerDocument.createTextNode("\n"));
29343
+ this.addTextNode(dom.ownerDocument.createTextNode("\n"), marks);
29379
29344
  }
29380
29345
  // Called for ignored nodes
29381
- ignoreFallback(dom) {
29346
+ ignoreFallback(dom, marks) {
29382
29347
  if (dom.nodeName == "BR" && (!this.top.type || !this.top.type.inlineContent))
29383
- this.findPlace(this.parser.schema.text("-"));
29348
+ this.findPlace(this.parser.schema.text("-"), marks);
29384
29349
  }
29385
29350
  // Run any style parser associated with the node's styles. Either
29386
- // return an array of marks, or null to indicate some of the styles
29387
- // had a rule with `ignore` set.
29388
- readStyles(styles2) {
29389
- let add = Mark.none, remove2 = Mark.none;
29390
- if (styles2.length)
29351
+ // return an updated array of marks, or null to indicate some of the
29352
+ // styles had a rule with `ignore` set.
29353
+ readStyles(dom, marks) {
29354
+ let styles2 = dom.style;
29355
+ if (styles2 && styles2.length)
29391
29356
  for (let i = 0; i < this.parser.matchedStyles.length; i++) {
29392
29357
  let name2 = this.parser.matchedStyles[i], value = styles2.getPropertyValue(name2);
29393
29358
  if (value)
@@ -29397,47 +29362,46 @@ class ParseContext {
29397
29362
  break;
29398
29363
  if (rule.ignore)
29399
29364
  return null;
29400
- if (rule.clearMark) {
29401
- this.top.pendingMarks.concat(this.top.activeMarks).forEach((m2) => {
29402
- if (rule.clearMark(m2))
29403
- remove2 = m2.addToSet(remove2);
29404
- });
29405
- } else {
29406
- add = this.parser.schema.marks[rule.mark].create(rule.attrs).addToSet(add);
29407
- }
29365
+ if (rule.clearMark)
29366
+ marks = marks.filter((m2) => !rule.clearMark(m2));
29367
+ else
29368
+ marks = marks.concat(this.parser.schema.marks[rule.mark].create(rule.attrs));
29408
29369
  if (rule.consuming === false)
29409
29370
  after = rule;
29410
29371
  else
29411
29372
  break;
29412
29373
  }
29413
29374
  }
29414
- return [add, remove2];
29375
+ return marks;
29415
29376
  }
29416
29377
  // Look up a handler for the given node. If none are found, return
29417
29378
  // false. Otherwise, apply it, use its return value to drive the way
29418
29379
  // the node's content is wrapped, and return true.
29419
- addElementByRule(dom, rule, continueAfter) {
29420
- let sync2, nodeType, mark;
29380
+ addElementByRule(dom, rule, marks, continueAfter) {
29381
+ let sync2, nodeType;
29421
29382
  if (rule.node) {
29422
29383
  nodeType = this.parser.schema.nodes[rule.node];
29423
29384
  if (!nodeType.isLeaf) {
29424
- sync2 = this.enter(nodeType, rule.attrs || null, rule.preserveWhitespace);
29425
- } else if (!this.insertNode(nodeType.create(rule.attrs))) {
29426
- this.leafFallback(dom);
29385
+ let inner2 = this.enter(nodeType, rule.attrs || null, marks, rule.preserveWhitespace);
29386
+ if (inner2) {
29387
+ sync2 = true;
29388
+ marks = inner2;
29389
+ }
29390
+ } else if (!this.insertNode(nodeType.create(rule.attrs), marks)) {
29391
+ this.leafFallback(dom, marks);
29427
29392
  }
29428
29393
  } else {
29429
29394
  let markType = this.parser.schema.marks[rule.mark];
29430
- mark = markType.create(rule.attrs);
29431
- this.addPendingMark(mark);
29395
+ marks = marks.concat(markType.create(rule.attrs));
29432
29396
  }
29433
29397
  let startIn = this.top;
29434
29398
  if (nodeType && nodeType.isLeaf) {
29435
29399
  this.findInside(dom);
29436
29400
  } else if (continueAfter) {
29437
- this.addElement(dom, continueAfter);
29401
+ this.addElement(dom, marks, continueAfter);
29438
29402
  } else if (rule.getContent) {
29439
29403
  this.findInside(dom);
29440
- rule.getContent(dom, this.parser.schema).forEach((node2) => this.insertNode(node2));
29404
+ rule.getContent(dom, this.parser.schema).forEach((node2) => this.insertNode(node2, marks));
29441
29405
  } else {
29442
29406
  let contentDOM = dom;
29443
29407
  if (typeof rule.contentElement == "string")
@@ -29447,28 +29411,26 @@ class ParseContext {
29447
29411
  else if (rule.contentElement)
29448
29412
  contentDOM = rule.contentElement;
29449
29413
  this.findAround(dom, contentDOM, true);
29450
- this.addAll(contentDOM);
29414
+ this.addAll(contentDOM, marks);
29451
29415
  }
29452
29416
  if (sync2 && this.sync(startIn))
29453
29417
  this.open--;
29454
- if (mark)
29455
- this.removePendingMark(mark, startIn);
29456
29418
  }
29457
29419
  // Add all child nodes between `startIndex` and `endIndex` (or the
29458
29420
  // whole node, if not given). If `sync` is passed, use it to
29459
29421
  // synchronize after every block element.
29460
- addAll(parent, startIndex, endIndex) {
29422
+ addAll(parent, marks, startIndex, endIndex) {
29461
29423
  let index2 = startIndex || 0;
29462
29424
  for (let dom = startIndex ? parent.childNodes[startIndex] : parent.firstChild, end2 = endIndex == null ? null : parent.childNodes[endIndex]; dom != end2; dom = dom.nextSibling, ++index2) {
29463
29425
  this.findAtPoint(parent, index2);
29464
- this.addDOM(dom);
29426
+ this.addDOM(dom, marks);
29465
29427
  }
29466
29428
  this.findAtPoint(parent, index2);
29467
29429
  }
29468
29430
  // Try to find a way to fit the given node type into the current
29469
29431
  // context. May add intermediate wrappers and/or leave non-solid
29470
29432
  // nodes that we're in.
29471
- findPlace(node2) {
29433
+ findPlace(node2, marks) {
29472
29434
  let route, sync2;
29473
29435
  for (let depth = this.open; depth >= 0; depth--) {
29474
29436
  let cx3 = this.nodes[depth];
@@ -29483,53 +29445,61 @@ class ParseContext {
29483
29445
  break;
29484
29446
  }
29485
29447
  if (!route)
29486
- return false;
29448
+ return null;
29487
29449
  this.sync(sync2);
29488
29450
  for (let i = 0; i < route.length; i++)
29489
- this.enterInner(route[i], null, false);
29490
- return true;
29451
+ marks = this.enterInner(route[i], null, marks, false);
29452
+ return marks;
29491
29453
  }
29492
29454
  // Try to insert the given node, adjusting the context when needed.
29493
- insertNode(node2) {
29455
+ insertNode(node2, marks) {
29494
29456
  if (node2.isInline && this.needsBlock && !this.top.type) {
29495
29457
  let block2 = this.textblockFromContext();
29496
29458
  if (block2)
29497
- this.enterInner(block2);
29459
+ marks = this.enterInner(block2, null, marks);
29498
29460
  }
29499
- if (this.findPlace(node2)) {
29461
+ let innerMarks = this.findPlace(node2, marks);
29462
+ if (innerMarks) {
29500
29463
  this.closeExtra();
29501
29464
  let top2 = this.top;
29502
- top2.applyPending(node2.type);
29503
29465
  if (top2.match)
29504
29466
  top2.match = top2.match.matchType(node2.type);
29505
- let marks = top2.activeMarks;
29506
- for (let i = 0; i < node2.marks.length; i++)
29507
- if (!top2.type || top2.type.allowsMarkType(node2.marks[i].type))
29508
- marks = node2.marks[i].addToSet(marks);
29509
- top2.content.push(node2.mark(marks));
29467
+ let nodeMarks = Mark.none;
29468
+ for (let m2 of innerMarks.concat(node2.marks))
29469
+ if (top2.type ? top2.type.allowsMarkType(m2.type) : markMayApply(m2.type, node2.type))
29470
+ nodeMarks = m2.addToSet(nodeMarks);
29471
+ top2.content.push(node2.mark(nodeMarks));
29510
29472
  return true;
29511
29473
  }
29512
29474
  return false;
29513
29475
  }
29514
29476
  // Try to start a node of the given type, adjusting the context when
29515
29477
  // necessary.
29516
- enter(type2, attrs, preserveWS) {
29517
- let ok2 = this.findPlace(type2.create(attrs));
29518
- if (ok2)
29519
- this.enterInner(type2, attrs, true, preserveWS);
29520
- return ok2;
29478
+ enter(type2, attrs, marks, preserveWS) {
29479
+ let innerMarks = this.findPlace(type2.create(attrs), marks);
29480
+ if (innerMarks)
29481
+ innerMarks = this.enterInner(type2, attrs, marks, true, preserveWS);
29482
+ return innerMarks;
29521
29483
  }
29522
29484
  // Open a node of the given type
29523
- enterInner(type2, attrs = null, solid = false, preserveWS) {
29485
+ enterInner(type2, attrs, marks, solid = false, preserveWS) {
29524
29486
  this.closeExtra();
29525
29487
  let top2 = this.top;
29526
- top2.applyPending(type2);
29527
29488
  top2.match = top2.match && top2.match.matchType(type2);
29528
29489
  let options2 = wsOptionsFor(type2, preserveWS, top2.options);
29529
29490
  if (top2.options & OPT_OPEN_LEFT && top2.content.length == 0)
29530
29491
  options2 |= OPT_OPEN_LEFT;
29531
- this.nodes.push(new NodeContext(type2, attrs, top2.activeMarks, top2.pendingMarks, solid, null, options2));
29492
+ let applyMarks = Mark.none;
29493
+ marks = marks.filter((m2) => {
29494
+ if (top2.type ? top2.type.allowsMarkType(m2.type) : markMayApply(m2.type, type2)) {
29495
+ applyMarks = m2.addToSet(applyMarks);
29496
+ return false;
29497
+ }
29498
+ return true;
29499
+ });
29500
+ this.nodes.push(new NodeContext(type2, attrs, applyMarks, solid, null, options2));
29532
29501
  this.open++;
29502
+ return marks;
29533
29503
  }
29534
29504
  // Make sure all nodes above this.open are finished and added to
29535
29505
  // their parents
@@ -29640,28 +29610,6 @@ class ParseContext {
29640
29610
  return type2;
29641
29611
  }
29642
29612
  }
29643
- addPendingMark(mark) {
29644
- let found2 = findSameMarkInSet(mark, this.top.pendingMarks);
29645
- if (found2)
29646
- this.top.stashMarks.push(found2);
29647
- this.top.pendingMarks = mark.addToSet(this.top.pendingMarks);
29648
- }
29649
- removePendingMark(mark, upto) {
29650
- for (let depth = this.open; depth >= 0; depth--) {
29651
- let level = this.nodes[depth];
29652
- let found2 = level.pendingMarks.lastIndexOf(mark);
29653
- if (found2 > -1) {
29654
- level.pendingMarks = mark.removeFromSet(level.pendingMarks);
29655
- } else {
29656
- level.activeMarks = mark.removeFromSet(level.activeMarks);
29657
- let stashMark = level.popFromStashMark(mark);
29658
- if (stashMark && level.type && level.type.allowsMarkType(stashMark.type))
29659
- level.activeMarks = stashMark.addToSet(level.activeMarks);
29660
- }
29661
- if (level == upto)
29662
- break;
29663
- }
29664
- }
29665
29613
  }
29666
29614
  function normalizeList(dom) {
29667
29615
  for (let child = dom.firstChild, prevItem = null; child; child = child.nextSibling) {
@@ -29705,12 +29653,6 @@ function markMayApply(markType, nodeType) {
29705
29653
  return true;
29706
29654
  }
29707
29655
  }
29708
- function findSameMarkInSet(mark, set) {
29709
- for (let i = 0; i < set.length; i++) {
29710
- if (mark.eq(set[i]))
29711
- return set[i];
29712
- }
29713
- }
29714
29656
  class DOMSerializer {
29715
29657
  /**
29716
29658
  Create a serializer. `nodes` should map node names to functions
package/dist/index.html CHANGED
@@ -1 +1 @@
1
- <!doctype html><head><title>React UI Library</title><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1" user-scalable="no"><meta name="apple-mobile-web-app-capable" content="yes"><script type="module" crossorigin src="/react-ui-library/assets/index-CnfDrmnZ.js"></script><link rel="stylesheet" crossorigin href="/react-ui-library/assets/index-BpSdrNXy.css"></head><body><div id="content"></div></body>
1
+ <!doctype html><head><title>React UI Library</title><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1" user-scalable="no"><meta name="apple-mobile-web-app-capable" content="yes"><script type="module" crossorigin src="/react-ui-library/assets/index-DoFa61ar.js"></script><link rel="stylesheet" crossorigin href="/react-ui-library/assets/index-BpSdrNXy.css"></head><body><div id="content"></div></body>
package/dist/index.js CHANGED
@@ -16,7 +16,7 @@ import * as PropTypes from "prop-types";
16
16
  import PropTypes__default from "prop-types";
17
17
  import ReactDOM, { createPortal, unstable_batchedUpdates, render } from "react-dom";
18
18
  import { noop as noop$3, set, get as get$2, isString as isString$3, isNumber as isNumber$1, isBoolean as isBoolean$2, isFunction as isFunction$3, isEmpty, isArray as isArray$1, toNumber, debounce as debounce$2, isObject as isObject$5, isEqual as isEqual$4 } from "lodash";
19
- import { isScientificStringNum, roundToPrecision, roundToFixed, toString as toString$1, validateNumber, cleanNumStr, stripLeadingZeros, unitFromQuantity, isValueWithUnit, withUnit, convertSamePrecision, getValue as getValue$1, getUnit, KNOWN_UNITS, split as split$1, label as label$b, altUnitsList, convertAndGetValue, getUnitsForQuantity, roundByMagnitudeToFixed } from "@oliasoft-open-source/units";
19
+ import { toString as toString$1, isScientificStringNum, roundToPrecision, toNum, roundToFixed, validateNumber, cleanNumStr, stripLeadingZeros, unitFromQuantity, isValueWithUnit, withUnit, convertSamePrecision, getValue as getValue$1, getUnit, KNOWN_UNITS, split as split$1, label as label$b, isValidNum, altUnitsList, convertAndGetValue, getUnitsForQuantity, roundByMagnitudeToFixed } from "@oliasoft-open-source/units";
20
20
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
21
21
  function getDefaultExportFromCjs(x2) {
22
22
  return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
@@ -55639,11 +55639,13 @@ const InputCell = ({
55639
55639
  );
55640
55640
  };
55641
55641
  const COSMETIC_ROUNDING_DEFAULT_PRECISION = 14;
55642
+ const safeToString = (value) => String(toString$1(value));
55642
55643
  const roundNumberCosmetic = (value) => {
55643
55644
  const isScientific = isScientificStringNum(value);
55644
- return !isScientific ? roundToPrecision(value, COSMETIC_ROUNDING_DEFAULT_PRECISION) : value;
55645
+ return !isScientific ? safeToString(
55646
+ roundToPrecision(toNum(value), COSMETIC_ROUNDING_DEFAULT_PRECISION)
55647
+ ) : value;
55645
55648
  };
55646
- const safeToString = (value) => String(toString$1(value));
55647
55649
  const getStringName$1 = (name2) => {
55648
55650
  if (!name2) return "";
55649
55651
  if (typeof name2 === "string") {
@@ -55677,15 +55679,11 @@ const NumberInput = ({
55677
55679
  allowEmpty = false,
55678
55680
  isInTable: isInTable2,
55679
55681
  groupOrder,
55680
- enableCosmeticRounding = false,
55682
+ enableCosmeticRounding = true,
55681
55683
  enableDisplayRounding = false,
55682
55684
  roundDisplayValue,
55683
55685
  disableInternalErrorValidationMessages = false
55684
55686
  }) => {
55685
- const inputRef = useRef(null);
55686
- const [displayValue, setDisplayValue] = useState(safeToString(value));
55687
- const [focus2, setFocus] = useState(false);
55688
- const stringName = getStringName$1(name2);
55689
55687
  const validateInputValue = (value2) => {
55690
55688
  const validation = validateNumber(value2);
55691
55689
  if (allowEmpty && value2 === "" || validation.valid) {
@@ -55694,10 +55692,26 @@ const NumberInput = ({
55694
55692
  return validation;
55695
55693
  }
55696
55694
  };
55695
+ const cosmeticRound = (value2) => {
55696
+ var _a2;
55697
+ const displayValueEndsWithZero = !!(value2 == null ? void 0 : value2.endsWith("0"));
55698
+ const shouldCosmeticallyRound = enableCosmeticRounding && // only when prop is enabled
55699
+ value2 && // not when empty typed value
55700
+ !displayValueEndsWithZero && // not when intentionally trying to type trailing zeros as interim values (OW-17109)
55701
+ ((_a2 = validateInputValue(value2)) == null ? void 0 : _a2.valid);
55702
+ const valueWithCosmeticRounding = shouldCosmeticallyRound ? roundNumberCosmetic(value2) : value2;
55703
+ return safeToString(valueWithCosmeticRounding);
55704
+ };
55705
+ const inputRef = useRef(null);
55706
+ const [displayValue, setDisplayValue] = useState(
55707
+ cosmeticRound(safeToString(value))
55708
+ );
55709
+ const [focus2, setFocus] = useState(false);
55710
+ const stringName = getStringName$1(name2);
55697
55711
  const { valid, errors: errors2 } = validateInputValue(displayValue);
55698
55712
  const firstError = errors2 && errors2.length && !disableInternalErrorValidationMessages ? errors2[0] : null;
55699
55713
  useEffect(() => {
55700
- setDisplayValue(safeToString(value));
55714
+ setDisplayValue(cosmeticRound(safeToString(value)));
55701
55715
  }, [value, enableCosmeticRounding, enableDisplayRounding]);
55702
55716
  useEffect(() => {
55703
55717
  if (!focus2 && !valid) {
@@ -55747,12 +55761,6 @@ const NumberInput = ({
55747
55761
  };
55748
55762
  const shouldDisplayRound = enableDisplayRounding && !focus2 && valid;
55749
55763
  const valueWithDisplayRounding = shouldDisplayRound ? roundDisplayValue ? safeToString(roundDisplayValue(displayValue)) : roundToFixed(displayValue, 2) : displayValue;
55750
- const displayValueEndsWithZero = !!(valueWithDisplayRounding == null ? void 0 : valueWithDisplayRounding.endsWith("0"));
55751
- const shouldCosmeticallyRound = enableCosmeticRounding && // only when prop is enabled
55752
- valueWithDisplayRounding && // not when empty typed value
55753
- !displayValueEndsWithZero && // not when intentionally trying to type trailing zeros as interim values (OW-17109)
55754
- valid;
55755
- const valueWithCosmeticRounding = shouldCosmeticallyRound ? roundNumberCosmetic(valueWithDisplayRounding) : valueWithDisplayRounding;
55756
55764
  return /* @__PURE__ */ jsx(
55757
55765
  KeyboardEventHandler,
55758
55766
  {
@@ -55766,7 +55774,7 @@ const NumberInput = ({
55766
55774
  testId,
55767
55775
  disabled: disabled2,
55768
55776
  placeholder: placeholder3,
55769
- value: valueWithCosmeticRounding,
55777
+ value: valueWithDisplayRounding,
55770
55778
  onChange: onChangeValue,
55771
55779
  onFocus: onInputFocus,
55772
55780
  onBlur: onInputBlur,
@@ -70237,7 +70245,7 @@ const UnitInput = ({
70237
70245
  allowEmpty = false,
70238
70246
  autoValue,
70239
70247
  convertBackToStorageUnit = false,
70240
- enableCosmeticRounding = false,
70248
+ enableCosmeticRounding = true,
70241
70249
  enableDisplayRounding = false
70242
70250
  }) => {
70243
70251
  const context2 = useUnitContext();
@@ -70489,7 +70497,7 @@ const UnitInput = ({
70489
70497
  small: small2,
70490
70498
  sections: alternativeUnits.map(([value2, altUnit, label2]) => {
70491
70499
  const displayUnit = label2 || altUnit || "";
70492
- const safeValue = !isNaN(Number(value2)) ? value2 : "";
70500
+ const safeValue = isValidNum(value2) ? value2 : "";
70493
70501
  const displayValue = enableCosmeticRounding ? roundNumberCosmetic(safeValue) : safeValue;
70494
70502
  return {
70495
70503
  type: "Option",