@greghowe79/the-lib 0.7.8 → 0.7.9

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.
@@ -49,6 +49,13 @@ const Input = qwik.component$(({ id, type, placeholder, value, error, onValidate
49
49
  e.preventDefault();
50
50
  }
51
51
  });
52
+ const changeHandler = qwik.$((event) => {
53
+ const elem = event.target;
54
+ if (!/^[0-9]*$/.test(elem.value)) {
55
+ return;
56
+ }
57
+ if (value) value.value = elem.value;
58
+ });
52
59
  return /* @__PURE__ */ jsxRuntime.jsxs("div", {
53
60
  class: "input-container",
54
61
  children: [
@@ -115,7 +122,8 @@ const Input = qwik.component$(({ id, type, placeholder, value, error, onValidate
115
122
  e.preventDefault();
116
123
  }
117
124
  },
118
- onBeforeInput$: beforeInputHandler
125
+ onBeforeInput$: beforeInputHandler,
126
+ onChange$: changeHandler
119
127
  })
120
128
  ]
121
129
  })
@@ -47,6 +47,13 @@ const Input = component$(({ id, type, placeholder, value, error, onValidate$, on
47
47
  e.preventDefault();
48
48
  }
49
49
  });
50
+ const changeHandler = $((event) => {
51
+ const elem = event.target;
52
+ if (!/^[0-9]*$/.test(elem.value)) {
53
+ return;
54
+ }
55
+ if (value) value.value = elem.value;
56
+ });
50
57
  return /* @__PURE__ */ jsxs("div", {
51
58
  class: "input-container",
52
59
  children: [
@@ -113,7 +120,8 @@ const Input = component$(({ id, type, placeholder, value, error, onValidate$, on
113
120
  e.preventDefault();
114
121
  }
115
122
  },
116
- onBeforeInput$: beforeInputHandler
123
+ onBeforeInput$: beforeInputHandler,
124
+ onChange$: changeHandler
117
125
  })
118
126
  ]
119
127
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@greghowe79/the-lib",
3
- "version": "0.7.8",
3
+ "version": "0.7.9",
4
4
  "description": "Collection of fast components for Qwik",
5
5
  "main": "./lib/index.qwik.mjs",
6
6
  "qwik": "./lib/index.qwik.mjs",