@greghowe79/the-lib 1.0.7 → 1.0.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.
@@ -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, name, checked }) => {
29
+ const Input = qwik.component$(({ id, type, placeholder, value, error, onValidate$, onInput$, bgLight, currentFile, selectedFile, icon, prefix, required = false, color, nameAttribute, label, selectedValue }) => {
30
30
  qwik.useStylesScoped$(styles);
31
31
  const internalError = qwik.useSignal(null);
32
32
  const showError = error ?? internalError;
@@ -113,13 +113,25 @@ const Input = qwik.component$(({ id, type, placeholder, value, error, onValidate
113
113
  })
114
114
  ]
115
115
  })
116
- }) : type === "radio" ? /* @__PURE__ */ jsxRuntime.jsx("input", {
117
- id,
118
- type: "radio",
119
- name,
120
- checked: checked?.value,
121
- required,
122
- "bind:value": value
116
+ }) : type === "radio" ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
117
+ children: [
118
+ /* @__PURE__ */ jsxRuntime.jsx("input", {
119
+ type: "radio",
120
+ id,
121
+ name: nameAttribute,
122
+ value: color,
123
+ checked: selectedValue?.value === color,
124
+ onChange$: (e) => {
125
+ if (selectedValue) {
126
+ selectedValue.value = e.target.value;
127
+ }
128
+ }
129
+ }),
130
+ /* @__PURE__ */ jsxRuntime.jsx("label", {
131
+ for: id,
132
+ children: label
133
+ })
134
+ ]
123
135
  }) : /* @__PURE__ */ jsxRuntime.jsx("label", {
124
136
  class: `input-label ${bgLight ? "bg_light" : ""}`,
125
137
  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, name, checked }) => {
27
+ const Input = component$(({ id, type, placeholder, value, error, onValidate$, onInput$, bgLight, currentFile, selectedFile, icon, prefix, required = false, color, nameAttribute, label, selectedValue }) => {
28
28
  useStylesScoped$(styles);
29
29
  const internalError = useSignal(null);
30
30
  const showError = error ?? internalError;
@@ -111,13 +111,25 @@ const Input = component$(({ id, type, placeholder, value, error, onValidate$, on
111
111
  })
112
112
  ]
113
113
  })
114
- }) : type === "radio" ? /* @__PURE__ */ jsx("input", {
115
- id,
116
- type: "radio",
117
- name,
118
- checked: checked?.value,
119
- required,
120
- "bind:value": value
114
+ }) : type === "radio" ? /* @__PURE__ */ jsxs(Fragment, {
115
+ children: [
116
+ /* @__PURE__ */ jsx("input", {
117
+ type: "radio",
118
+ id,
119
+ name: nameAttribute,
120
+ value: color,
121
+ checked: selectedValue?.value === color,
122
+ onChange$: (e) => {
123
+ if (selectedValue) {
124
+ selectedValue.value = e.target.value;
125
+ }
126
+ }
127
+ }),
128
+ /* @__PURE__ */ jsx("label", {
129
+ for: id,
130
+ children: label
131
+ })
132
+ ]
121
133
  }) : /* @__PURE__ */ jsx("label", {
122
134
  class: `input-label ${bgLight ? "bg_light" : ""}`,
123
135
  children: /* @__PURE__ */ jsxs("div", {
@@ -5,7 +5,6 @@ export interface InputProps {
5
5
  id: string;
6
6
  type: InputType;
7
7
  placeholder?: string;
8
- name?: string;
9
8
  value?: Signal<string>;
10
9
  error?: Signal<string | null>;
11
10
  onValidate$?: QRL<(value: string) => Promise<string>>;
@@ -16,7 +15,12 @@ export interface InputProps {
16
15
  icon?: JSXOutput | Component<unknown>;
17
16
  prefix?: string;
18
17
  required?: boolean;
19
- checked?: Signal<boolean>;
18
+ onChange?: QRL<(_: Event, el: HTMLInputElement) => Promise<void>>;
19
+ checked?: boolean;
20
+ color?: string;
21
+ nameAttribute?: string;
22
+ label?: string;
23
+ selectedValue?: Signal<string>;
20
24
  }
21
25
  export declare const displayLocalImage: QRL<(file: File, imageUrl?: Signal<string>) => void>;
22
26
  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.7",
3
+ "version": "1.0.9",
4
4
  "description": "Collection of fast components for Qwik",
5
5
  "main": "./lib/index.qwik.mjs",
6
6
  "qwik": "./lib/index.qwik.mjs",