@greghowe79/the-lib 1.0.3 → 1.0.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, prefix, required = false }) => {
29
+ const Input = qwik.component$(({ id, type, placeholder, value, error, onValidate$, onInput$, bgLight, currentFile, selectedFile, icon, prefix, required = false, name, checked }) => {
30
30
  qwik.useStylesScoped$(styles);
31
31
  const internalError = qwik.useSignal(null);
32
32
  const showError = error ?? internalError;
@@ -116,14 +116,10 @@ const Input = qwik.component$(({ id, type, placeholder, value, error, onValidate
116
116
  }) : type === "radio" ? /* @__PURE__ */ jsxRuntime.jsx("input", {
117
117
  id,
118
118
  type: "radio",
119
- name: id,
119
+ name,
120
120
  value: placeholder,
121
- checked: value ? value.value === placeholder : false,
122
- required,
123
- onChange$: (event) => {
124
- if (value) value.value = event.target.value;
125
- if (onInput$) onInput$();
126
- }
121
+ "bind:checked": checked,
122
+ required
127
123
  }) : /* @__PURE__ */ jsxRuntime.jsx("label", {
128
124
  class: `input-label ${bgLight ? "bg_light" : ""}`,
129
125
  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, prefix, required = false }) => {
27
+ const Input = component$(({ id, type, placeholder, value, error, onValidate$, onInput$, bgLight, currentFile, selectedFile, icon, prefix, required = false, name, checked }) => {
28
28
  useStylesScoped$(styles);
29
29
  const internalError = useSignal(null);
30
30
  const showError = error ?? internalError;
@@ -114,14 +114,10 @@ const Input = component$(({ id, type, placeholder, value, error, onValidate$, on
114
114
  }) : type === "radio" ? /* @__PURE__ */ jsx("input", {
115
115
  id,
116
116
  type: "radio",
117
- name: id,
117
+ name,
118
118
  value: placeholder,
119
- checked: value ? value.value === placeholder : false,
120
- required,
121
- onChange$: (event) => {
122
- if (value) value.value = event.target.value;
123
- if (onInput$) onInput$();
124
- }
119
+ "bind:checked": checked,
120
+ required
125
121
  }) : /* @__PURE__ */ jsx("label", {
126
122
  class: `input-label ${bgLight ? "bg_light" : ""}`,
127
123
  children: /* @__PURE__ */ jsxs("div", {
@@ -5,6 +5,7 @@ export interface InputProps {
5
5
  id: string;
6
6
  type: InputType;
7
7
  placeholder?: string;
8
+ name?: string;
8
9
  value?: Signal<string>;
9
10
  error?: Signal<string | null>;
10
11
  onValidate$?: QRL<(value: string) => Promise<string>>;
@@ -15,6 +16,7 @@ export interface InputProps {
15
16
  icon?: JSXOutput | Component<unknown>;
16
17
  prefix?: string;
17
18
  required?: boolean;
19
+ checked?: Signal<boolean>;
18
20
  }
19
21
  export declare const displayLocalImage: QRL<(file: File, imageUrl?: Signal<string>) => void>;
20
22
  export declare const uploadImage: QRL<(_event: Event, input: HTMLInputElement, currentFile?: Signal<any>, selectedFile?: Signal<string>, imageUrl?: Signal<string>) => Promise<void>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@greghowe79/the-lib",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "Collection of fast components for Qwik",
5
5
  "main": "./lib/index.qwik.mjs",
6
6
  "qwik": "./lib/index.qwik.mjs",