@greghowe79/the-lib 0.8.1 → 0.8.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.
@@ -48,6 +48,12 @@ const Input = qwik.component$(({ id, type, placeholder, value, error, onValidate
48
48
  if (!error) internalError.value = result;
49
49
  }
50
50
  });
51
+ const beforeInputHandler = qwik.$((event) => {
52
+ const data = event.data;
53
+ if (data && /[^0-9]/.test(data)) {
54
+ event.preventDefault();
55
+ }
56
+ });
51
57
  return /* @__PURE__ */ jsxRuntime.jsxs("div", {
52
58
  class: "input-container",
53
59
  children: [
@@ -107,7 +113,8 @@ const Input = qwik.component$(({ id, type, placeholder, value, error, onValidate
107
113
  placeholder,
108
114
  "bind:value": value,
109
115
  onInput$: inputHandler,
110
- onBlur$: inputHandler
116
+ onBlur$: inputHandler,
117
+ onBeforeInput$: beforeInputHandler
111
118
  })
112
119
  ]
113
120
  })
@@ -46,6 +46,12 @@ const Input = component$(({ id, type, placeholder, value, error, onValidate$, on
46
46
  if (!error) internalError.value = result;
47
47
  }
48
48
  });
49
+ const beforeInputHandler = $((event) => {
50
+ const data = event.data;
51
+ if (data && /[^0-9]/.test(data)) {
52
+ event.preventDefault();
53
+ }
54
+ });
49
55
  return /* @__PURE__ */ jsxs("div", {
50
56
  class: "input-container",
51
57
  children: [
@@ -105,7 +111,8 @@ const Input = component$(({ id, type, placeholder, value, error, onValidate$, on
105
111
  placeholder,
106
112
  "bind:value": value,
107
113
  onInput$: inputHandler,
108
- onBlur$: inputHandler
114
+ onBlur$: inputHandler,
115
+ onBeforeInput$: beforeInputHandler
109
116
  })
110
117
  ]
111
118
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@greghowe79/the-lib",
3
- "version": "0.8.1",
3
+ "version": "0.8.2",
4
4
  "description": "Collection of fast components for Qwik",
5
5
  "main": "./lib/index.qwik.mjs",
6
6
  "qwik": "./lib/index.qwik.mjs",