@oliasoft-open-source/react-ui-library 4.10.0-beta-1 → 4.10.1-beta-2

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 (37) hide show
  1. package/dist/index.js +117 -174
  2. package/dist/index.js.map +1 -1
  3. package/dist/storybook/assets/{Color-KGDBMAHA-Bn4yyV9u.js → Color-KGDBMAHA-DlQqI8Tk.js} +1 -1
  4. package/dist/storybook/assets/{DocsRenderer-PKQXORMH-BUBqlKwY.js → DocsRenderer-PKQXORMH-C-eDrY_1.js} +1 -1
  5. package/dist/storybook/assets/{accordion.stories-kLk1OtZZ.js → accordion.stories-DYWwH-nb.js} +1 -1
  6. package/dist/storybook/assets/{buttons-and-links-a_IVrxwj.js → buttons-and-links-wb-Y9p6x.js} +1 -1
  7. package/dist/storybook/assets/{casing-loads.stories-B2lND_PU.js → casing-loads.stories-CS3UEFRb.js} +1 -1
  8. package/dist/storybook/assets/{cell.stories-BVDrv2SU.js → cell.stories-DC0iukzz.js} +1 -1
  9. package/dist/storybook/assets/{chunk-HLWAVYOI-kpZZkSeH.js → chunk-HLWAVYOI-Lxbmzwgp.js} +1 -1
  10. package/dist/storybook/assets/{color-Cbf9UrQO.js → color-I4_Y9LFJ.js} +1 -1
  11. package/dist/storybook/assets/{footer.stories-BVXSVjq1.js → footer.stories-BGebD8DA.js} +1 -1
  12. package/dist/storybook/assets/{formation.stories-DmecxRaM.js → formation.stories-CSRmoL6O.js} +1 -1
  13. package/dist/storybook/assets/{iframe-DO2I_nJe.js → iframe-DG9U1Bn6.js} +2 -2
  14. package/dist/storybook/assets/{index-Nykkb-Z-.js → index-CINwEN_P.js} +1 -1
  15. package/dist/storybook/assets/{index-CP-qN_yN.js → index-Cfibu2ua.js} +4 -4
  16. package/dist/storybook/assets/{input-validation-51gQ2ORg.js → input-validation-B5UoupeG.js} +1 -1
  17. package/dist/storybook/assets/{inputs-CPKM4uZ6.js → inputs-ChYYqRCq.js} +1 -1
  18. package/dist/storybook/assets/{layout-forms-C9pc1r5D.js → layout-forms-P7QfwIXF.js} +1 -1
  19. package/dist/storybook/assets/{layout-general-Dks_ONKw.js → layout-general-CiIRqFmO.js} +1 -1
  20. package/dist/storybook/assets/{number-input-DBZIl9dz.js → number-input-B25TXDQC.js} +2 -2
  21. package/dist/storybook/assets/{number-input.stories-CqTYNX8G.js → number-input.stories-rcGMdz-Y.js} +6 -6
  22. package/dist/storybook/assets/{padding-and-spacing-Bki_uuMD.js → padding-and-spacing-BxAEU1k1.js} +1 -1
  23. package/dist/storybook/assets/{preview-DGoeP-Zy.js → preview-AQiRsl0e.js} +2 -2
  24. package/dist/storybook/assets/{preview-yquX1adV.js → preview-DyPtloVR.js} +1 -1
  25. package/dist/storybook/assets/{rich-text-input.stories-hAHCnDHk.js → rich-text-input.stories-DkaOBgbE.js} +46 -46
  26. package/dist/storybook/assets/{row.stories-BO2s7oph.js → row.stories-C6aRnuL5.js} +1 -1
  27. package/dist/storybook/assets/{table-CB6btQu9.js → table-Dh7Es_V6.js} +1 -1
  28. package/dist/storybook/assets/{table.stories-CvHvaYMC.js → table.stories-BsPbkctl.js} +1 -1
  29. package/dist/storybook/assets/{title.stories-DYXG2_x-.js → title.stories-wr63QEGT.js} +1 -1
  30. package/dist/storybook/assets/unit-input.stories-Dq7teE0t.js +403 -0
  31. package/dist/storybook/assets/{unit-table.stories-DiER-CMn.js → unit-table.stories-CbAekNaE.js} +1 -1
  32. package/dist/storybook/iframe.html +1 -1
  33. package/dist/storybook/index.json +1 -1
  34. package/dist/storybook/project.json +1 -1
  35. package/dist/storybook/sb-manager/globals-runtime.js +1 -1
  36. package/package.json +1 -1
  37. package/dist/storybook/assets/unit-input.stories-DRP-nDdh.js +0 -380
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, stripLeadingZeros, cleanNumStr, 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;
@@ -25685,7 +25685,7 @@ class DOMParser {
25685
25685
  */
25686
25686
  parse(dom, options = {}) {
25687
25687
  let context2 = new ParseContext(this, options, false);
25688
- context2.addAll(dom, options.from, options.to);
25688
+ context2.addAll(dom, Mark$1.none, options.from, options.to);
25689
25689
  return context2.finish();
25690
25690
  }
25691
25691
  /**
@@ -25698,7 +25698,7 @@ class DOMParser {
25698
25698
  */
25699
25699
  parseSlice(dom, options = {}) {
25700
25700
  let context2 = new ParseContext(this, options, true);
25701
- context2.addAll(dom, options.from, options.to);
25701
+ context2.addAll(dom, Mark$1.none, options.from, options.to);
25702
25702
  return Slice.maxOpen(context2.finish());
25703
25703
  }
25704
25704
  /**
@@ -25831,16 +25831,14 @@ function wsOptionsFor(type, preserveWhitespace, base2) {
25831
25831
  return type && type.whitespace == "pre" ? OPT_PRESERVE_WS | OPT_PRESERVE_WS_FULL : base2 & ~OPT_OPEN_LEFT;
25832
25832
  }
25833
25833
  class NodeContext {
25834
- constructor(type, attrs, marks, pendingMarks, solid, match2, options) {
25834
+ constructor(type, attrs, marks, solid, match2, options) {
25835
25835
  this.type = type;
25836
25836
  this.attrs = attrs;
25837
25837
  this.marks = marks;
25838
- this.pendingMarks = pendingMarks;
25839
25838
  this.solid = solid;
25840
25839
  this.options = options;
25841
25840
  this.content = [];
25842
25841
  this.activeMarks = Mark$1.none;
25843
- this.stashMarks = [];
25844
25842
  this.match = match2 || (options & OPT_OPEN_LEFT ? null : type.contentMatch);
25845
25843
  }
25846
25844
  findWrapping(node2) {
@@ -25878,20 +25876,6 @@ class NodeContext {
25878
25876
  content2 = content2.append(this.match.fillBefore(Fragment.empty, true));
25879
25877
  return this.type ? this.type.create(this.attrs, content2, this.marks) : content2;
25880
25878
  }
25881
- popFromStashMark(mark) {
25882
- for (let i = this.stashMarks.length - 1; i >= 0; i--)
25883
- if (mark.eq(this.stashMarks[i]))
25884
- return this.stashMarks.splice(i, 1)[0];
25885
- }
25886
- applyPending(nextType) {
25887
- for (let i = 0, pending = this.pendingMarks; i < pending.length; i++) {
25888
- let mark = pending[i];
25889
- if ((this.type ? this.type.allowsMarkType(mark.type) : markMayApply(mark.type, nextType)) && !mark.isInSet(this.activeMarks)) {
25890
- this.activeMarks = mark.addToSet(this.activeMarks);
25891
- this.pendingMarks = mark.removeFromSet(this.pendingMarks);
25892
- }
25893
- }
25894
- }
25895
25879
  inlineContext(node2) {
25896
25880
  if (this.type)
25897
25881
  return this.type.inlineContent;
@@ -25909,11 +25893,11 @@ class ParseContext {
25909
25893
  let topNode = options.topNode, topContext;
25910
25894
  let topOptions = wsOptionsFor(null, options.preserveWhitespace, 0) | (isOpen2 ? OPT_OPEN_LEFT : 0);
25911
25895
  if (topNode)
25912
- topContext = new NodeContext(topNode.type, topNode.attrs, Mark$1.none, Mark$1.none, true, options.topMatch || topNode.type.contentMatch, topOptions);
25896
+ topContext = new NodeContext(topNode.type, topNode.attrs, Mark$1.none, true, options.topMatch || topNode.type.contentMatch, topOptions);
25913
25897
  else if (isOpen2)
25914
- topContext = new NodeContext(null, null, Mark$1.none, Mark$1.none, true, null, topOptions);
25898
+ topContext = new NodeContext(null, null, Mark$1.none, true, null, topOptions);
25915
25899
  else
25916
- topContext = new NodeContext(parser2.schema.topNodeType, null, Mark$1.none, Mark$1.none, true, null, topOptions);
25900
+ topContext = new NodeContext(parser2.schema.topNodeType, null, Mark$1.none, true, null, topOptions);
25917
25901
  this.nodes = [topContext];
25918
25902
  this.find = options.findPositions;
25919
25903
  this.needsBlock = false;
@@ -25924,31 +25908,13 @@ class ParseContext {
25924
25908
  // Add a DOM node to the content. Text is inserted as text node,
25925
25909
  // otherwise, the node is passed to `addElement` or, if it has a
25926
25910
  // `style` attribute, `addElementWithStyles`.
25927
- addDOM(dom) {
25911
+ addDOM(dom, marks) {
25928
25912
  if (dom.nodeType == 3)
25929
- this.addTextNode(dom);
25913
+ this.addTextNode(dom, marks);
25930
25914
  else if (dom.nodeType == 1)
25931
- this.addElement(dom);
25932
- }
25933
- withStyleRules(dom, f2) {
25934
- let style2 = dom.style;
25935
- if (!style2 || !style2.length)
25936
- return f2();
25937
- let marks = this.readStyles(dom.style);
25938
- if (!marks)
25939
- return;
25940
- let [addMarks, removeMarks] = marks, top2 = this.top;
25941
- for (let i = 0; i < removeMarks.length; i++)
25942
- this.removePendingMark(removeMarks[i], top2);
25943
- for (let i = 0; i < addMarks.length; i++)
25944
- this.addPendingMark(addMarks[i]);
25945
- f2();
25946
- for (let i = 0; i < addMarks.length; i++)
25947
- this.removePendingMark(addMarks[i], top2);
25948
- for (let i = 0; i < removeMarks.length; i++)
25949
- this.addPendingMark(removeMarks[i]);
25950
- }
25951
- addTextNode(dom) {
25915
+ this.addElement(dom, marks);
25916
+ }
25917
+ addTextNode(dom, marks) {
25952
25918
  let value = dom.nodeValue;
25953
25919
  let top2 = this.top;
25954
25920
  if (top2.options & OPT_PRESERVE_WS_FULL || top2.inlineContext(dom) || /[^ \t\r\n\u000c]/.test(value)) {
@@ -25966,7 +25932,7 @@ class ParseContext {
25966
25932
  value = value.replace(/\r\n?/g, "\n");
25967
25933
  }
25968
25934
  if (value)
25969
- this.insertNode(this.parser.schema.text(value));
25935
+ this.insertNode(this.parser.schema.text(value), marks);
25970
25936
  this.findInText(dom);
25971
25937
  } else {
25972
25938
  this.findInside(dom);
@@ -25974,14 +25940,14 @@ class ParseContext {
25974
25940
  }
25975
25941
  // Try to find a handler for the given tag and use that to parse. If
25976
25942
  // none is found, the element's content nodes are added directly.
25977
- addElement(dom, matchAfter) {
25943
+ addElement(dom, marks, matchAfter) {
25978
25944
  let name2 = dom.nodeName.toLowerCase(), ruleID;
25979
25945
  if (listTags.hasOwnProperty(name2) && this.parser.normalizeLists)
25980
25946
  normalizeList(dom);
25981
25947
  let rule = this.options.ruleFromNode && this.options.ruleFromNode(dom) || (ruleID = this.parser.matchTag(dom, this, matchAfter));
25982
25948
  if (rule ? rule.ignore : ignoreTags.hasOwnProperty(name2)) {
25983
25949
  this.findInside(dom);
25984
- this.ignoreFallback(dom);
25950
+ this.ignoreFallback(dom, marks);
25985
25951
  } else if (!rule || rule.skip || rule.closeParent) {
25986
25952
  if (rule && rule.closeParent)
25987
25953
  this.open = Math.max(0, this.open - 1);
@@ -25997,38 +25963,37 @@ class ParseContext {
25997
25963
  if (!top2.type)
25998
25964
  this.needsBlock = true;
25999
25965
  } else if (!dom.firstChild) {
26000
- this.leafFallback(dom);
25966
+ this.leafFallback(dom, marks);
26001
25967
  return;
26002
25968
  }
26003
- if (rule && rule.skip)
26004
- this.addAll(dom);
26005
- else
26006
- this.withStyleRules(dom, () => this.addAll(dom));
25969
+ let innerMarks = rule && rule.skip ? marks : this.readStyles(dom, marks);
25970
+ if (innerMarks)
25971
+ this.addAll(dom, innerMarks);
26007
25972
  if (sync2)
26008
25973
  this.sync(top2);
26009
25974
  this.needsBlock = oldNeedsBlock;
26010
25975
  } else {
26011
- this.withStyleRules(dom, () => {
26012
- this.addElementByRule(dom, rule, rule.consuming === false ? ruleID : void 0);
26013
- });
25976
+ let innerMarks = this.readStyles(dom, marks);
25977
+ if (innerMarks)
25978
+ this.addElementByRule(dom, rule, innerMarks, rule.consuming === false ? ruleID : void 0);
26014
25979
  }
26015
25980
  }
26016
25981
  // Called for leaf DOM nodes that would otherwise be ignored
26017
- leafFallback(dom) {
25982
+ leafFallback(dom, marks) {
26018
25983
  if (dom.nodeName == "BR" && this.top.type && this.top.type.inlineContent)
26019
- this.addTextNode(dom.ownerDocument.createTextNode("\n"));
25984
+ this.addTextNode(dom.ownerDocument.createTextNode("\n"), marks);
26020
25985
  }
26021
25986
  // Called for ignored nodes
26022
- ignoreFallback(dom) {
25987
+ ignoreFallback(dom, marks) {
26023
25988
  if (dom.nodeName == "BR" && (!this.top.type || !this.top.type.inlineContent))
26024
- this.findPlace(this.parser.schema.text("-"));
25989
+ this.findPlace(this.parser.schema.text("-"), marks);
26025
25990
  }
26026
25991
  // Run any style parser associated with the node's styles. Either
26027
- // return an array of marks, or null to indicate some of the styles
26028
- // had a rule with `ignore` set.
26029
- readStyles(styles2) {
26030
- let add3 = Mark$1.none, remove2 = Mark$1.none;
26031
- if (styles2.length)
25992
+ // return an updated array of marks, or null to indicate some of the
25993
+ // styles had a rule with `ignore` set.
25994
+ readStyles(dom, marks) {
25995
+ let styles2 = dom.style;
25996
+ if (styles2 && styles2.length)
26032
25997
  for (let i = 0; i < this.parser.matchedStyles.length; i++) {
26033
25998
  let name2 = this.parser.matchedStyles[i], value = styles2.getPropertyValue(name2);
26034
25999
  if (value)
@@ -26038,47 +26003,46 @@ class ParseContext {
26038
26003
  break;
26039
26004
  if (rule.ignore)
26040
26005
  return null;
26041
- if (rule.clearMark) {
26042
- this.top.pendingMarks.concat(this.top.activeMarks).forEach((m2) => {
26043
- if (rule.clearMark(m2))
26044
- remove2 = m2.addToSet(remove2);
26045
- });
26046
- } else {
26047
- add3 = this.parser.schema.marks[rule.mark].create(rule.attrs).addToSet(add3);
26048
- }
26006
+ if (rule.clearMark)
26007
+ marks = marks.filter((m2) => !rule.clearMark(m2));
26008
+ else
26009
+ marks = marks.concat(this.parser.schema.marks[rule.mark].create(rule.attrs));
26049
26010
  if (rule.consuming === false)
26050
26011
  after = rule;
26051
26012
  else
26052
26013
  break;
26053
26014
  }
26054
26015
  }
26055
- return [add3, remove2];
26016
+ return marks;
26056
26017
  }
26057
26018
  // Look up a handler for the given node. If none are found, return
26058
26019
  // false. Otherwise, apply it, use its return value to drive the way
26059
26020
  // the node's content is wrapped, and return true.
26060
- addElementByRule(dom, rule, continueAfter) {
26061
- let sync2, nodeType, mark;
26021
+ addElementByRule(dom, rule, marks, continueAfter) {
26022
+ let sync2, nodeType;
26062
26023
  if (rule.node) {
26063
26024
  nodeType = this.parser.schema.nodes[rule.node];
26064
26025
  if (!nodeType.isLeaf) {
26065
- sync2 = this.enter(nodeType, rule.attrs || null, rule.preserveWhitespace);
26066
- } else if (!this.insertNode(nodeType.create(rule.attrs))) {
26067
- this.leafFallback(dom);
26026
+ let inner2 = this.enter(nodeType, rule.attrs || null, marks, rule.preserveWhitespace);
26027
+ if (inner2) {
26028
+ sync2 = true;
26029
+ marks = inner2;
26030
+ }
26031
+ } else if (!this.insertNode(nodeType.create(rule.attrs), marks)) {
26032
+ this.leafFallback(dom, marks);
26068
26033
  }
26069
26034
  } else {
26070
26035
  let markType = this.parser.schema.marks[rule.mark];
26071
- mark = markType.create(rule.attrs);
26072
- this.addPendingMark(mark);
26036
+ marks = marks.concat(markType.create(rule.attrs));
26073
26037
  }
26074
26038
  let startIn = this.top;
26075
26039
  if (nodeType && nodeType.isLeaf) {
26076
26040
  this.findInside(dom);
26077
26041
  } else if (continueAfter) {
26078
- this.addElement(dom, continueAfter);
26042
+ this.addElement(dom, marks, continueAfter);
26079
26043
  } else if (rule.getContent) {
26080
26044
  this.findInside(dom);
26081
- rule.getContent(dom, this.parser.schema).forEach((node2) => this.insertNode(node2));
26045
+ rule.getContent(dom, this.parser.schema).forEach((node2) => this.insertNode(node2, marks));
26082
26046
  } else {
26083
26047
  let contentDOM = dom;
26084
26048
  if (typeof rule.contentElement == "string")
@@ -26088,28 +26052,26 @@ class ParseContext {
26088
26052
  else if (rule.contentElement)
26089
26053
  contentDOM = rule.contentElement;
26090
26054
  this.findAround(dom, contentDOM, true);
26091
- this.addAll(contentDOM);
26055
+ this.addAll(contentDOM, marks);
26092
26056
  }
26093
26057
  if (sync2 && this.sync(startIn))
26094
26058
  this.open--;
26095
- if (mark)
26096
- this.removePendingMark(mark, startIn);
26097
26059
  }
26098
26060
  // Add all child nodes between `startIndex` and `endIndex` (or the
26099
26061
  // whole node, if not given). If `sync` is passed, use it to
26100
26062
  // synchronize after every block element.
26101
- addAll(parent, startIndex, endIndex) {
26063
+ addAll(parent, marks, startIndex, endIndex) {
26102
26064
  let index2 = startIndex || 0;
26103
26065
  for (let dom = startIndex ? parent.childNodes[startIndex] : parent.firstChild, end2 = endIndex == null ? null : parent.childNodes[endIndex]; dom != end2; dom = dom.nextSibling, ++index2) {
26104
26066
  this.findAtPoint(parent, index2);
26105
- this.addDOM(dom);
26067
+ this.addDOM(dom, marks);
26106
26068
  }
26107
26069
  this.findAtPoint(parent, index2);
26108
26070
  }
26109
26071
  // Try to find a way to fit the given node type into the current
26110
26072
  // context. May add intermediate wrappers and/or leave non-solid
26111
26073
  // nodes that we're in.
26112
- findPlace(node2) {
26074
+ findPlace(node2, marks) {
26113
26075
  let route, sync2;
26114
26076
  for (let depth = this.open; depth >= 0; depth--) {
26115
26077
  let cx3 = this.nodes[depth];
@@ -26124,53 +26086,61 @@ class ParseContext {
26124
26086
  break;
26125
26087
  }
26126
26088
  if (!route)
26127
- return false;
26089
+ return null;
26128
26090
  this.sync(sync2);
26129
26091
  for (let i = 0; i < route.length; i++)
26130
- this.enterInner(route[i], null, false);
26131
- return true;
26092
+ marks = this.enterInner(route[i], null, marks, false);
26093
+ return marks;
26132
26094
  }
26133
26095
  // Try to insert the given node, adjusting the context when needed.
26134
- insertNode(node2) {
26096
+ insertNode(node2, marks) {
26135
26097
  if (node2.isInline && this.needsBlock && !this.top.type) {
26136
26098
  let block2 = this.textblockFromContext();
26137
26099
  if (block2)
26138
- this.enterInner(block2);
26100
+ marks = this.enterInner(block2, null, marks);
26139
26101
  }
26140
- if (this.findPlace(node2)) {
26102
+ let innerMarks = this.findPlace(node2, marks);
26103
+ if (innerMarks) {
26141
26104
  this.closeExtra();
26142
26105
  let top2 = this.top;
26143
- top2.applyPending(node2.type);
26144
26106
  if (top2.match)
26145
26107
  top2.match = top2.match.matchType(node2.type);
26146
- let marks = top2.activeMarks;
26147
- for (let i = 0; i < node2.marks.length; i++)
26148
- if (!top2.type || top2.type.allowsMarkType(node2.marks[i].type))
26149
- marks = node2.marks[i].addToSet(marks);
26150
- top2.content.push(node2.mark(marks));
26108
+ let nodeMarks = Mark$1.none;
26109
+ for (let m2 of innerMarks.concat(node2.marks))
26110
+ if (top2.type ? top2.type.allowsMarkType(m2.type) : markMayApply(m2.type, node2.type))
26111
+ nodeMarks = m2.addToSet(nodeMarks);
26112
+ top2.content.push(node2.mark(nodeMarks));
26151
26113
  return true;
26152
26114
  }
26153
26115
  return false;
26154
26116
  }
26155
26117
  // Try to start a node of the given type, adjusting the context when
26156
26118
  // necessary.
26157
- enter(type, attrs, preserveWS) {
26158
- let ok = this.findPlace(type.create(attrs));
26159
- if (ok)
26160
- this.enterInner(type, attrs, true, preserveWS);
26161
- return ok;
26119
+ enter(type, attrs, marks, preserveWS) {
26120
+ let innerMarks = this.findPlace(type.create(attrs), marks);
26121
+ if (innerMarks)
26122
+ innerMarks = this.enterInner(type, attrs, marks, true, preserveWS);
26123
+ return innerMarks;
26162
26124
  }
26163
26125
  // Open a node of the given type
26164
- enterInner(type, attrs = null, solid = false, preserveWS) {
26126
+ enterInner(type, attrs, marks, solid = false, preserveWS) {
26165
26127
  this.closeExtra();
26166
26128
  let top2 = this.top;
26167
- top2.applyPending(type);
26168
26129
  top2.match = top2.match && top2.match.matchType(type);
26169
26130
  let options = wsOptionsFor(type, preserveWS, top2.options);
26170
26131
  if (top2.options & OPT_OPEN_LEFT && top2.content.length == 0)
26171
26132
  options |= OPT_OPEN_LEFT;
26172
- this.nodes.push(new NodeContext(type, attrs, top2.activeMarks, top2.pendingMarks, solid, null, options));
26133
+ let applyMarks = Mark$1.none;
26134
+ marks = marks.filter((m2) => {
26135
+ if (top2.type ? top2.type.allowsMarkType(m2.type) : markMayApply(m2.type, type)) {
26136
+ applyMarks = m2.addToSet(applyMarks);
26137
+ return false;
26138
+ }
26139
+ return true;
26140
+ });
26141
+ this.nodes.push(new NodeContext(type, attrs, applyMarks, solid, null, options));
26173
26142
  this.open++;
26143
+ return marks;
26174
26144
  }
26175
26145
  // Make sure all nodes above this.open are finished and added to
26176
26146
  // their parents
@@ -26281,28 +26251,6 @@ class ParseContext {
26281
26251
  return type;
26282
26252
  }
26283
26253
  }
26284
- addPendingMark(mark) {
26285
- let found2 = findSameMarkInSet(mark, this.top.pendingMarks);
26286
- if (found2)
26287
- this.top.stashMarks.push(found2);
26288
- this.top.pendingMarks = mark.addToSet(this.top.pendingMarks);
26289
- }
26290
- removePendingMark(mark, upto) {
26291
- for (let depth = this.open; depth >= 0; depth--) {
26292
- let level = this.nodes[depth];
26293
- let found2 = level.pendingMarks.lastIndexOf(mark);
26294
- if (found2 > -1) {
26295
- level.pendingMarks = mark.removeFromSet(level.pendingMarks);
26296
- } else {
26297
- level.activeMarks = mark.removeFromSet(level.activeMarks);
26298
- let stashMark = level.popFromStashMark(mark);
26299
- if (stashMark && level.type && level.type.allowsMarkType(stashMark.type))
26300
- level.activeMarks = stashMark.addToSet(level.activeMarks);
26301
- }
26302
- if (level == upto)
26303
- break;
26304
- }
26305
- }
26306
26254
  }
26307
26255
  function normalizeList(dom) {
26308
26256
  for (let child = dom.firstChild, prevItem = null; child; child = child.nextSibling) {
@@ -26346,12 +26294,6 @@ function markMayApply(markType, nodeType) {
26346
26294
  return true;
26347
26295
  }
26348
26296
  }
26349
- function findSameMarkInSet(mark, set2) {
26350
- for (let i = 0; i < set2.length; i++) {
26351
- if (mark.eq(set2[i]))
26352
- return set2[i];
26353
- }
26354
- }
26355
26297
  class DOMSerializer {
26356
26298
  /**
26357
26299
  Create a serializer. `nodes` should map node names to functions
@@ -55697,11 +55639,13 @@ const InputCell = ({
55697
55639
  );
55698
55640
  };
55699
55641
  const COSMETIC_ROUNDING_DEFAULT_PRECISION = 14;
55642
+ const safeToString = (value) => String(toString$1(value));
55700
55643
  const roundNumberCosmetic = (value) => {
55701
55644
  const isScientific = isScientificStringNum(value);
55702
- return !isScientific ? roundToPrecision(value, COSMETIC_ROUNDING_DEFAULT_PRECISION) : value;
55645
+ return !isScientific ? safeToString(
55646
+ roundToPrecision(toNum(value), COSMETIC_ROUNDING_DEFAULT_PRECISION)
55647
+ ) : value;
55703
55648
  };
55704
- const safeToString = (value) => String(toString$1(value));
55705
55649
  const getStringName$1 = (name2) => {
55706
55650
  if (!name2) return "";
55707
55651
  if (typeof name2 === "string") {
@@ -55740,11 +55684,6 @@ const NumberInput = ({
55740
55684
  roundDisplayValue,
55741
55685
  disableInternalErrorValidationMessages = false
55742
55686
  }) => {
55743
- const inputRef = useRef(null);
55744
- const [displayValue, setDisplayValue] = useState(safeToString(value));
55745
- const [focus2, setFocus] = useState(false);
55746
- const [pristine, setPristine] = useState(true);
55747
- const stringName = getStringName$1(name2);
55748
55687
  const validateInputValue = (value2) => {
55749
55688
  const validation = validateNumber(value2);
55750
55689
  if (allowEmpty && value2 === "" || validation.valid) {
@@ -55753,11 +55692,26 @@ const NumberInput = ({
55753
55692
  return validation;
55754
55693
  }
55755
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);
55756
55711
  const { valid, errors: errors2 } = validateInputValue(displayValue);
55757
55712
  const firstError = errors2 && errors2.length && !disableInternalErrorValidationMessages ? errors2[0] : null;
55758
55713
  useEffect(() => {
55759
- setDisplayValue(safeToString(value));
55760
- setPristine(true);
55714
+ setDisplayValue(cosmeticRound(safeToString(value)));
55761
55715
  }, [value, enableCosmeticRounding, enableDisplayRounding]);
55762
55716
  useEffect(() => {
55763
55717
  if (!focus2 && !valid) {
@@ -55767,27 +55721,24 @@ const NumberInput = ({
55767
55721
  }
55768
55722
  }, [focus2, valid, error2]);
55769
55723
  const onChangeValue = (evt) => {
55770
- if (valid && !pristine) {
55724
+ var _a2, _b;
55725
+ const value2 = evt instanceof KeyboardEvent ? displayValue : (_a2 = evt == null ? void 0 : evt.target) == null ? void 0 : _a2.value;
55726
+ const inputValue = cleanNumStr(
55727
+ value2.replaceAll(" ", "").replaceAll("|", "")
55728
+ );
55729
+ setDisplayValue(inputValue);
55730
+ if ((_b = validateInputValue(inputValue)) == null ? void 0 : _b.valid) {
55771
55731
  const event = {
55772
55732
  ...evt,
55773
55733
  target: {
55774
55734
  ...evt.target,
55775
- value: stripLeadingZeros(safeToString(displayValue)),
55735
+ value: stripLeadingZeros(safeToString(inputValue)),
55776
55736
  name: stringName
55777
55737
  }
55778
55738
  };
55779
55739
  onChange(event);
55780
55740
  }
55781
55741
  };
55782
- const onSetValue = (evt) => {
55783
- const input2 = evt.target;
55784
- const { value: value2 } = input2;
55785
- const inputValue = cleanNumStr(
55786
- value2.replaceAll(" ", "").replaceAll("|", "")
55787
- );
55788
- setDisplayValue(inputValue);
55789
- setPristine(false);
55790
- };
55791
55742
  useEffect(() => {
55792
55743
  if (inputRef && (inputRef == null ? void 0 : inputRef.current) && enableDisplayRounding && focus2) {
55793
55744
  const textInput = inputRef.current;
@@ -55810,12 +55761,6 @@ const NumberInput = ({
55810
55761
  };
55811
55762
  const shouldDisplayRound = enableDisplayRounding && !focus2 && valid;
55812
55763
  const valueWithDisplayRounding = shouldDisplayRound ? roundDisplayValue ? safeToString(roundDisplayValue(displayValue)) : roundToFixed(displayValue, 2) : displayValue;
55813
- const displayValueEndsWithZero = !!(valueWithDisplayRounding == null ? void 0 : valueWithDisplayRounding.endsWith("0"));
55814
- const shouldCosmeticallyRound = enableCosmeticRounding && // only when prop is enabled
55815
- valueWithDisplayRounding && // not when empty typed value
55816
- !displayValueEndsWithZero && // not when intentionally trying to type trailing zeros as interim values (OW-17109)
55817
- valid;
55818
- const valueWithCosmeticRounding = shouldCosmeticallyRound ? roundNumberCosmetic(valueWithDisplayRounding) : valueWithDisplayRounding;
55819
55764
  return /* @__PURE__ */ jsx(
55820
55765
  KeyboardEventHandler,
55821
55766
  {
@@ -55829,11 +55774,11 @@ const NumberInput = ({
55829
55774
  testId,
55830
55775
  disabled: disabled2,
55831
55776
  placeholder: placeholder3,
55832
- value: valueWithCosmeticRounding,
55833
- onChange: onSetValue,
55777
+ value: valueWithDisplayRounding,
55778
+ onChange: onChangeValue,
55834
55779
  onFocus: onInputFocus,
55835
55780
  onBlur: onInputBlur,
55836
- error: !focus2 && (firstError || error2),
55781
+ error: firstError || error2,
55837
55782
  warning: warning2,
55838
55783
  right: !left2,
55839
55784
  small: small2,
@@ -70222,16 +70167,12 @@ const convertUnit = (stringValue = "", toUnit, defaultFromUnit = "", doNotConver
70222
70167
  } catch (e2) {
70223
70168
  }
70224
70169
  }
70225
- return stringValue;
70226
70170
  };
70227
70171
  const isValueWithUnknownUnit = (value) => {
70228
70172
  if (!value) return false;
70229
70173
  return Boolean(getUnit(value));
70230
70174
  };
70231
70175
  const safeConvertValue = (value = "", toUnit, defaultFromUnit, doNotConvertValue) => {
70232
- if (doNotConvertValue) {
70233
- return value;
70234
- }
70235
70176
  const isWithUnit = isValueWithUnknownUnit(value) || isValueWithUnit(value);
70236
70177
  const rawValue = getValue$1(value);
70237
70178
  const isInvalidInput = isWrongValue(rawValue);
@@ -70335,6 +70276,7 @@ const UnitInput = ({
70335
70276
  );
70336
70277
  const initDisplayLayer = convertedValue !== "" ? { value: convertedValue, unit: initDisplayUnit } : convertedAutoValue !== "" ? { value: convertedAutoValue, unit: initDisplayUnit } : { value: propValue, unit: propUnit };
70337
70278
  const [displayLayer, setDisplayLayer] = useState(initDisplayLayer);
70279
+ const derivedAllowEmpty = (displayLayer == null ? void 0 : displayLayer.value) === void 0;
70338
70280
  const [predefinedOptionsMenuState, setPredefinedOptionsMenuState] = useState(
70339
70281
  initialPredefinedOption ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM
70340
70282
  );
@@ -70532,12 +70474,13 @@ const UnitInput = ({
70532
70474
  error: error2 === null ? void 0 : error2,
70533
70475
  warning: warning2 === null ? void 0 : warning2,
70534
70476
  left: left2,
70535
- allowEmpty,
70477
+ allowEmpty: derivedAllowEmpty,
70536
70478
  validationCallback: (_name, error22) => validationCallback(stringName, error22),
70537
70479
  enableCosmeticRounding,
70538
70480
  enableDisplayRounding,
70539
70481
  groupOrder: predefinedOptions ? "middle" : "first",
70540
- disableInternalErrorValidationMessages
70482
+ disableInternalErrorValidationMessages,
70483
+ small: small2
70541
70484
  },
70542
70485
  stringName
70543
70486
  ) }),
@@ -70554,7 +70497,7 @@ const UnitInput = ({
70554
70497
  small: small2,
70555
70498
  sections: alternativeUnits.map(([value2, altUnit, label2]) => {
70556
70499
  const displayUnit = label2 || altUnit || "";
70557
- const safeValue = !isNaN(Number(value2)) ? value2 : "";
70500
+ const safeValue = isValidNum(value2) ? value2 : "";
70558
70501
  const displayValue = enableCosmeticRounding ? roundNumberCosmetic(safeValue) : safeValue;
70559
70502
  return {
70560
70503
  type: "Option",