@nebularstreams/libmui 2.5.109 → 2.5.110

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nebularstreams/libmui",
3
3
  "description": "Micro UI based on Mithril",
4
- "version": "2.5.109",
4
+ "version": "2.5.110",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
7
7
  "scripts": {
@@ -196,6 +196,12 @@ const
196
196
  }
197
197
  }
198
198
  },
199
+ onbeforeinput: (e) => {
200
+ if (attrs.subtype === "number" && e.data && !/^[0-9.]$/.test(e.data)) {
201
+ e.preventDefault(); // nothing but 0-9 or “.” gets through
202
+ }
203
+ },
204
+ inputmode: attrs.subtype === "number" ? "decimal" : undefined, // nicer mobile keyboard
199
205
  onkeypress: (event) => {
200
206
  if (!state.showInput && event.key === "Enter") {
201
207
  attrs.onenter && attrs.onenter(event.target.value, event);
@@ -589,6 +589,7 @@ const
589
589
  label: metaDef.label,
590
590
  hint: isObj ? metaDef.hint : metaDef,
591
591
  title: metaDef.title,
592
+ subtype: "number",
592
593
  ...metaDef.final && {
593
594
  oninput: () => {
594
595
  }