@greghowe79/the-lib 0.7.4 → 0.7.5

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.
@@ -26,7 +26,7 @@ const uploadImage = qwik.$(async (_event, input, currentFile, selectedFile, imag
26
26
  if (selectedFile) selectedFile.value = file.name;
27
27
  }
28
28
  });
29
- const Input = qwik.component$(({ id, type, placeholder, value, error, onValidate$, onInput$, bgLight, currentFile, selectedFile, icon }) => {
29
+ const Input = qwik.component$(({ id, type, placeholder, value, error, onValidate$, onInput$, bgLight, currentFile, selectedFile, icon, prefix }) => {
30
30
  qwik.useStylesScoped$(styles);
31
31
  const internalError = qwik.useSignal(null);
32
32
  const showError = error ?? internalError;
@@ -80,6 +80,35 @@ const Input = qwik.component$(({ id, type, placeholder, value, error, onValidate
80
80
  })
81
81
  ]
82
82
  })
83
+ }) : type === "tel" ? /* @__PURE__ */ jsxRuntime.jsx("label", {
84
+ class: `input-label ${bgLight ? "bg_light" : ""}`,
85
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", {
86
+ class: "input-wrapper",
87
+ children: [
88
+ /* @__PURE__ */ jsxRuntime.jsx("span", {
89
+ class: "input-icon",
90
+ "aria-hidden": "true",
91
+ children: prefix
92
+ }),
93
+ /* @__PURE__ */ jsxRuntime.jsx("input", {
94
+ id,
95
+ type,
96
+ inputMode: "tel",
97
+ pattern: "[0-9]*",
98
+ class: `input ${showError.value ? "error" : ""}`,
99
+ placeholder,
100
+ "bind:value": value,
101
+ onInput$: inputHandler,
102
+ onBlur$: inputHandler,
103
+ onKeyDown$: (e) => {
104
+ const allowed = /[0-9]/;
105
+ if (!allowed.test(e.key) && e.key.length === 1) {
106
+ e.preventDefault();
107
+ }
108
+ }
109
+ })
110
+ ]
111
+ })
83
112
  }) : /* @__PURE__ */ jsxRuntime.jsx("label", {
84
113
  class: `input-label ${bgLight ? "bg_light" : ""}`,
85
114
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", {
@@ -24,7 +24,7 @@ const uploadImage = $(async (_event, input, currentFile, selectedFile, imageUrl)
24
24
  if (selectedFile) selectedFile.value = file.name;
25
25
  }
26
26
  });
27
- const Input = component$(({ id, type, placeholder, value, error, onValidate$, onInput$, bgLight, currentFile, selectedFile, icon }) => {
27
+ const Input = component$(({ id, type, placeholder, value, error, onValidate$, onInput$, bgLight, currentFile, selectedFile, icon, prefix }) => {
28
28
  useStylesScoped$(styles);
29
29
  const internalError = useSignal(null);
30
30
  const showError = error ?? internalError;
@@ -78,6 +78,35 @@ const Input = component$(({ id, type, placeholder, value, error, onValidate$, on
78
78
  })
79
79
  ]
80
80
  })
81
+ }) : type === "tel" ? /* @__PURE__ */ jsx("label", {
82
+ class: `input-label ${bgLight ? "bg_light" : ""}`,
83
+ children: /* @__PURE__ */ jsxs("div", {
84
+ class: "input-wrapper",
85
+ children: [
86
+ /* @__PURE__ */ jsx("span", {
87
+ class: "input-icon",
88
+ "aria-hidden": "true",
89
+ children: prefix
90
+ }),
91
+ /* @__PURE__ */ jsx("input", {
92
+ id,
93
+ type,
94
+ inputMode: "tel",
95
+ pattern: "[0-9]*",
96
+ class: `input ${showError.value ? "error" : ""}`,
97
+ placeholder,
98
+ "bind:value": value,
99
+ onInput$: inputHandler,
100
+ onBlur$: inputHandler,
101
+ onKeyDown$: (e) => {
102
+ const allowed = /[0-9]/;
103
+ if (!allowed.test(e.key) && e.key.length === 1) {
104
+ e.preventDefault();
105
+ }
106
+ }
107
+ })
108
+ ]
109
+ })
81
110
  }) : /* @__PURE__ */ jsx("label", {
82
111
  class: `input-label ${bgLight ? "bg_light" : ""}`,
83
112
  children: /* @__PURE__ */ jsxs("div", {
@@ -13,6 +13,7 @@ export interface InputProps {
13
13
  currentFile?: Signal<any>;
14
14
  selectedFile?: Signal<string>;
15
15
  icon?: JSXOutput | Component<unknown>;
16
+ prefix?: Signal<string>;
16
17
  }
17
18
  export declare const displayLocalImage: QRL<(file: File, imageUrl?: Signal<string>) => void>;
18
19
  export declare const uploadImage: QRL<(_event: Event, input: HTMLInputElement, currentFile?: Signal<any>, selectedFile?: Signal<string>, imageUrl?: Signal<string>) => Promise<void>>;
@@ -6,4 +6,5 @@ type Story = StoryObj<InputProps>;
6
6
  export declare const Email: Story;
7
7
  export declare const InputLightBackground: Story;
8
8
  export declare const InputWithIcon: Story;
9
+ export declare const PhoneInput: Story;
9
10
  export declare const FileUpload: Story;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@greghowe79/the-lib",
3
- "version": "0.7.4",
3
+ "version": "0.7.5",
4
4
  "description": "Collection of fast components for Qwik",
5
5
  "main": "./lib/index.qwik.mjs",
6
6
  "qwik": "./lib/index.qwik.mjs",