@nr1e/qwik-ui 0.0.13 → 0.0.15

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.
@@ -3,30 +3,38 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("@builder.io/qwik/jsx-runtime");
4
4
  const qwik = require("@builder.io/qwik");
5
5
  const CheckboxField = qwik.component$((props) => {
6
- return /* @__PURE__ */ jsxRuntime.jsx("div", {
6
+ const error = qwik.useSignal(props.error);
7
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", {
7
8
  class: "fieldset",
8
- children: /* @__PURE__ */ jsxRuntime.jsxs("label", {
9
- class: "label",
10
- ...props.id && {
11
- for: props.id
12
- },
13
- children: [
14
- /* @__PURE__ */ jsxRuntime.jsx("input", {
15
- type: "checkbox",
16
- ...props.name && {
17
- name: props.name
18
- },
19
- ...props.id && {
20
- id: props.id
21
- },
22
- ...props.checked && {
23
- checked: props.checked
24
- },
25
- class: "checkbox"
26
- }),
27
- props.label
28
- ]
29
- })
9
+ children: [
10
+ /* @__PURE__ */ jsxRuntime.jsxs("label", {
11
+ class: "label",
12
+ ...props.id && {
13
+ for: props.id
14
+ },
15
+ children: [
16
+ /* @__PURE__ */ jsxRuntime.jsx("input", {
17
+ type: "checkbox",
18
+ ...props.name && {
19
+ name: props.name
20
+ },
21
+ ...props.id && {
22
+ id: props.id
23
+ },
24
+ ...props.checked && {
25
+ checked: props.checked
26
+ },
27
+ class: `checkbox ${error.value ? "checkbox-error" : ""}`,
28
+ onClick$: (e) => props.onClick$ && props.onClick$(e, e.target.checked, error)
29
+ }),
30
+ props.label
31
+ ]
32
+ }),
33
+ error.value && /* @__PURE__ */ jsxRuntime.jsx("div", {
34
+ class: "text-error mt-1 text-xs",
35
+ children: error.value
36
+ })
37
+ ]
30
38
  });
31
39
  });
32
40
  exports.CheckboxField = CheckboxField;
@@ -1,30 +1,38 @@
1
- import { jsx, jsxs } from "@builder.io/qwik/jsx-runtime";
2
- import { component$ } from "@builder.io/qwik";
1
+ import { jsxs, jsx } from "@builder.io/qwik/jsx-runtime";
2
+ import { component$, useSignal } from "@builder.io/qwik";
3
3
  const CheckboxField = component$((props) => {
4
- return /* @__PURE__ */ jsx("div", {
4
+ const error = useSignal(props.error);
5
+ return /* @__PURE__ */ jsxs("div", {
5
6
  class: "fieldset",
6
- children: /* @__PURE__ */ jsxs("label", {
7
- class: "label",
8
- ...props.id && {
9
- for: props.id
10
- },
11
- children: [
12
- /* @__PURE__ */ jsx("input", {
13
- type: "checkbox",
14
- ...props.name && {
15
- name: props.name
16
- },
17
- ...props.id && {
18
- id: props.id
19
- },
20
- ...props.checked && {
21
- checked: props.checked
22
- },
23
- class: "checkbox"
24
- }),
25
- props.label
26
- ]
27
- })
7
+ children: [
8
+ /* @__PURE__ */ jsxs("label", {
9
+ class: "label",
10
+ ...props.id && {
11
+ for: props.id
12
+ },
13
+ children: [
14
+ /* @__PURE__ */ jsx("input", {
15
+ type: "checkbox",
16
+ ...props.name && {
17
+ name: props.name
18
+ },
19
+ ...props.id && {
20
+ id: props.id
21
+ },
22
+ ...props.checked && {
23
+ checked: props.checked
24
+ },
25
+ class: `checkbox ${error.value ? "checkbox-error" : ""}`,
26
+ onClick$: (e) => props.onClick$ && props.onClick$(e, e.target.checked, error)
27
+ }),
28
+ props.label
29
+ ]
30
+ }),
31
+ error.value && /* @__PURE__ */ jsx("div", {
32
+ class: "text-error mt-1 text-xs",
33
+ children: error.value
34
+ })
35
+ ]
28
36
  });
29
37
  });
30
38
  export {
@@ -3,6 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("@builder.io/qwik/jsx-runtime");
4
4
  const qwik = require("@builder.io/qwik");
5
5
  const SelectField = qwik.component$((props) => {
6
+ const error = qwik.useSignal(props.error);
6
7
  return /* @__PURE__ */ jsxRuntime.jsxs("div", {
7
8
  class: "fieldset",
8
9
  children: [
@@ -13,7 +14,7 @@ const SelectField = qwik.component$((props) => {
13
14
  },
14
15
  children: /* @__PURE__ */ jsxRuntime.jsx("span", {
15
16
  class: "label-text",
16
- children: props.title
17
+ children: props.label
17
18
  })
18
19
  }),
19
20
  /* @__PURE__ */ jsxRuntime.jsx("select", {
@@ -23,8 +24,13 @@ const SelectField = qwik.component$((props) => {
23
24
  ...props.id && {
24
25
  id: props.id
25
26
  },
26
- class: "select",
27
+ class: `select ${error.value ? "select-error" : ""}`,
28
+ onChange$: (e) => props.onChange$ && props.onChange$(e, e.target.value, error),
27
29
  children: /* @__PURE__ */ jsxRuntime.jsx(qwik.Slot, {})
30
+ }),
31
+ error.value && /* @__PURE__ */ jsxRuntime.jsx("div", {
32
+ class: "text-error mt-1 text-xs",
33
+ children: error.value
28
34
  })
29
35
  ]
30
36
  });
@@ -1,6 +1,7 @@
1
1
  import { jsxs, jsx } from "@builder.io/qwik/jsx-runtime";
2
- import { component$, Slot } from "@builder.io/qwik";
2
+ import { component$, useSignal, Slot } from "@builder.io/qwik";
3
3
  const SelectField = component$((props) => {
4
+ const error = useSignal(props.error);
4
5
  return /* @__PURE__ */ jsxs("div", {
5
6
  class: "fieldset",
6
7
  children: [
@@ -11,7 +12,7 @@ const SelectField = component$((props) => {
11
12
  },
12
13
  children: /* @__PURE__ */ jsx("span", {
13
14
  class: "label-text",
14
- children: props.title
15
+ children: props.label
15
16
  })
16
17
  }),
17
18
  /* @__PURE__ */ jsx("select", {
@@ -21,8 +22,13 @@ const SelectField = component$((props) => {
21
22
  ...props.id && {
22
23
  id: props.id
23
24
  },
24
- class: "select",
25
+ class: `select ${error.value ? "select-error" : ""}`,
26
+ onChange$: (e) => props.onChange$ && props.onChange$(e, e.target.value, error),
25
27
  children: /* @__PURE__ */ jsx(Slot, {})
28
+ }),
29
+ error.value && /* @__PURE__ */ jsx("div", {
30
+ class: "text-error mt-1 text-xs",
31
+ children: error.value
26
32
  })
27
33
  ]
28
34
  });
@@ -33,8 +33,8 @@ const TextField = qwik.component$((props) => {
33
33
  },
34
34
  class: "placeholder:opacity-50",
35
35
  placeholder: props.placeholder,
36
- onBlur$: (e) => props.onBlur$ && props.onBlur$(e, error),
37
- onInput$: (e) => props.onInput$ && props.onInput$(e, error)
36
+ onBlur$: (e) => props.onBlur$ && props.onBlur$(e, e.target.value, error),
37
+ onInput$: (e) => props.onInput$ && props.onInput$(e, e.target.value, error)
38
38
  }),
39
39
  /* @__PURE__ */ jsxRuntime.jsx(qwik.Slot, {
40
40
  name: "right"
@@ -31,8 +31,8 @@ const TextField = component$((props) => {
31
31
  },
32
32
  class: "placeholder:opacity-50",
33
33
  placeholder: props.placeholder,
34
- onBlur$: (e) => props.onBlur$ && props.onBlur$(e, error),
35
- onInput$: (e) => props.onInput$ && props.onInput$(e, error)
34
+ onBlur$: (e) => props.onBlur$ && props.onBlur$(e, e.target.value, error),
35
+ onInput$: (e) => props.onInput$ && props.onInput$(e, e.target.value, error)
36
36
  }),
37
37
  /* @__PURE__ */ jsx(Slot, {
38
38
  name: "right"
@@ -1,7 +1,10 @@
1
+ import { QRL, Signal } from '@builder.io/qwik';
1
2
  export interface CheckboxFieldProps {
2
3
  id?: string;
3
4
  label: string;
4
5
  name?: string;
5
6
  checked?: boolean;
7
+ error?: string;
8
+ onClick$?: QRL<(event: Event, checked: boolean, error: Signal<string | undefined>) => void>;
6
9
  }
7
10
  export declare const CheckboxField: import("@builder.io/qwik").Component<CheckboxFieldProps>;
@@ -1,6 +1,9 @@
1
+ import { QRL, Signal } from '@builder.io/qwik';
1
2
  export interface SelectFieldProps {
2
3
  id?: string;
3
- title: string;
4
+ label: string;
4
5
  name?: string;
6
+ error?: string;
7
+ onChange$?: QRL<(event: Event, value: string, error: Signal<string | undefined>) => void>;
5
8
  }
6
9
  export declare const SelectField: import("@builder.io/qwik").Component<SelectFieldProps>;
@@ -6,7 +6,7 @@ export interface TextFieldProps {
6
6
  placeholder?: string;
7
7
  error?: string;
8
8
  maxLength?: number;
9
- onBlur$?: QRL<(event: FocusEvent, error: Signal<string | undefined | null>) => void>;
10
- onInput$?: QRL<(event: InputEvent, error: Signal<string | undefined | null>) => void>;
9
+ onBlur$?: QRL<(event: FocusEvent, value: string, error: Signal<string | undefined>) => void>;
10
+ onInput$?: QRL<(event: InputEvent, value: string, error: Signal<string | undefined>) => void>;
11
11
  }
12
12
  export declare const TextField: import("@builder.io/qwik").Component<TextFieldProps>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nr1e/qwik-ui",
3
- "version": "0.0.13",
3
+ "version": "0.0.15",
4
4
  "description": "NR1E Qwik UI Library",
5
5
  "author": "NR1E, Inc.",
6
6
  "publishConfig": {
@@ -60,7 +60,7 @@
60
60
  "build.lib": "vite build --mode lib",
61
61
  "build.types": "tsc --emitDeclarationOnly",
62
62
  "clean": "rm -rf lib lib-types",
63
- "dev": "vite --mode ssr",
63
+ "dev": "vite --mode ssr --port 5175",
64
64
  "dev.debug": "node --inspect-brk ./node_modules/vite/bin/vite.js --mode ssr --force",
65
65
  "fmt": "prettier --write .",
66
66
  "fmt.check": "prettier --check .",