@nr1e/qwik-ui 2.0.21 → 2.1.0
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.
- package/lib/components/button.qwik.cjs +16 -11
- package/lib/components/button.qwik.mjs +16 -11
- package/lib/components/checkbox-field.qwik.cjs +8 -32
- package/lib/components/checkbox-field.qwik.mjs +9 -33
- package/lib/components/refresh-button.qwik.cjs +2 -2
- package/lib/components/refresh-button.qwik.mjs +2 -2
- package/lib/components/select-field.qwik.cjs +9 -36
- package/lib/components/select-field.qwik.mjs +10 -37
- package/lib/components/submit-button.qwik.cjs +2 -2
- package/lib/components/submit-button.qwik.mjs +2 -2
- package/lib/components/text-field.qwik.cjs +10 -33
- package/lib/components/text-field.qwik.mjs +10 -33
- package/lib/components/textarea-field.qwik.cjs +30 -0
- package/lib/components/textarea-field.qwik.mjs +30 -0
- package/lib/index.qwik.cjs +2 -2
- package/lib/index.qwik.mjs +2 -2
- package/lib-types/components/button.d.ts +8 -26
- package/lib-types/components/checkbox-field.d.ts +2 -6
- package/lib-types/components/select-field.d.ts +2 -9
- package/lib-types/components/text-field.d.ts +5 -30
- package/lib-types/components/textarea-field.d.ts +6 -0
- package/lib-types/index.d.ts +1 -1
- package/package.json +1 -1
- package/lib/components/processing-button.qwik.cjs +0 -17
- package/lib/components/processing-button.qwik.mjs +0 -17
- package/lib-types/components/processing-button.d.ts +0 -15
|
@@ -2,26 +2,31 @@
|
|
|
2
2
|
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
|
+
const qwikIcons = require("@nr1e/qwik-icons");
|
|
5
6
|
const Button = qwik.component$((props) => {
|
|
7
|
+
const { icon, iconSize, iconClass, text, processing, disabled, type, onClick$, class: className, children, ...buttonProps } = props;
|
|
8
|
+
const isDisabled = processing || disabled;
|
|
9
|
+
const displayIcon = processing ? qwikIcons.SpinnersBarsFade : icon;
|
|
10
|
+
const displayIconClass = processing ? "animate-spin" : iconClass;
|
|
6
11
|
return /* @__PURE__ */ jsxRuntime.jsxs("button", {
|
|
7
|
-
class: `btn
|
|
8
|
-
disabled:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
+
class: `btn ${isDisabled ? "disabled" : ""} ${className ?? ""}`,
|
|
13
|
+
disabled: isDisabled,
|
|
14
|
+
type: type ?? "button",
|
|
15
|
+
onClick$: !isDisabled && onClick$ ? onClick$ : void 0,
|
|
16
|
+
...buttonProps,
|
|
12
17
|
children: [
|
|
13
18
|
/* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
14
|
-
children:
|
|
15
|
-
class:
|
|
16
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
17
|
-
size:
|
|
19
|
+
children: displayIcon ? /* @__PURE__ */ jsxRuntime.jsx("span", {
|
|
20
|
+
class: displayIconClass,
|
|
21
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("displayIcon", {
|
|
22
|
+
size: iconSize ?? 18
|
|
18
23
|
})
|
|
19
24
|
}) : /* @__PURE__ */ jsxRuntime.jsx("span", {
|
|
20
|
-
class:
|
|
25
|
+
class: displayIconClass,
|
|
21
26
|
"q:slot": "icon"
|
|
22
27
|
})
|
|
23
28
|
}),
|
|
24
|
-
|
|
29
|
+
text ? text : /* @__PURE__ */ jsxRuntime.jsx(qwik.Slot, {})
|
|
25
30
|
]
|
|
26
31
|
});
|
|
27
32
|
});
|
|
@@ -1,25 +1,30 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from "@builder.io/qwik/jsx-runtime";
|
|
2
2
|
import { component$, Slot } from "@builder.io/qwik";
|
|
3
|
+
import { SpinnersBarsFade } from "@nr1e/qwik-icons";
|
|
3
4
|
const Button = component$((props) => {
|
|
5
|
+
const { icon, iconSize, iconClass, text, processing, disabled, type, onClick$, class: className, children, ...buttonProps } = props;
|
|
6
|
+
const isDisabled = processing || disabled;
|
|
7
|
+
const displayIcon = processing ? SpinnersBarsFade : icon;
|
|
8
|
+
const displayIconClass = processing ? "animate-spin" : iconClass;
|
|
4
9
|
return /* @__PURE__ */ jsxs("button", {
|
|
5
|
-
class: `btn
|
|
6
|
-
disabled:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
class: `btn ${isDisabled ? "disabled" : ""} ${className ?? ""}`,
|
|
11
|
+
disabled: isDisabled,
|
|
12
|
+
type: type ?? "button",
|
|
13
|
+
onClick$: !isDisabled && onClick$ ? onClick$ : void 0,
|
|
14
|
+
...buttonProps,
|
|
10
15
|
children: [
|
|
11
16
|
/* @__PURE__ */ jsx(Fragment, {
|
|
12
|
-
children:
|
|
13
|
-
class:
|
|
14
|
-
children: /* @__PURE__ */ jsx(
|
|
15
|
-
size:
|
|
17
|
+
children: displayIcon ? /* @__PURE__ */ jsx("span", {
|
|
18
|
+
class: displayIconClass,
|
|
19
|
+
children: /* @__PURE__ */ jsx("displayIcon", {
|
|
20
|
+
size: iconSize ?? 18
|
|
16
21
|
})
|
|
17
22
|
}) : /* @__PURE__ */ jsx("span", {
|
|
18
|
-
class:
|
|
23
|
+
class: displayIconClass,
|
|
19
24
|
"q:slot": "icon"
|
|
20
25
|
})
|
|
21
26
|
}),
|
|
22
|
-
|
|
27
|
+
text ? text : /* @__PURE__ */ jsx(Slot, {})
|
|
23
28
|
]
|
|
24
29
|
});
|
|
25
30
|
});
|
|
@@ -3,50 +3,26 @@ 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
|
-
const
|
|
7
|
-
qwik.useTask$(({ track }) => {
|
|
8
|
-
if (props.checked && typeof props.checked !== "boolean") {
|
|
9
|
-
track(() => checked.value);
|
|
10
|
-
if (checked.value !== props.checked?.value) {
|
|
11
|
-
props.checked.value = checked.value;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
qwik.useTask$(({ track }) => {
|
|
16
|
-
if (props.checked && typeof props.checked !== "boolean") {
|
|
17
|
-
track(() => props.checked.value);
|
|
18
|
-
if (props.checked && checked.value !== props.checked.value) {
|
|
19
|
-
checked.value = props.checked.value;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
});
|
|
6
|
+
const { label, error, id, class: className, ...inputProps } = props;
|
|
23
7
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", {
|
|
24
8
|
class: "fieldset",
|
|
25
9
|
children: [
|
|
26
10
|
/* @__PURE__ */ jsxRuntime.jsxs("label", {
|
|
27
11
|
class: "label",
|
|
28
|
-
|
|
29
|
-
for: props.id
|
|
30
|
-
},
|
|
12
|
+
for: id,
|
|
31
13
|
children: [
|
|
32
14
|
/* @__PURE__ */ jsxRuntime.jsx("input", {
|
|
33
15
|
type: "checkbox",
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
...props.id && {
|
|
38
|
-
id: props.id
|
|
39
|
-
},
|
|
40
|
-
checked: checked.value,
|
|
41
|
-
class: `checkbox ${props.error ? "checkbox-error" : ""}`,
|
|
42
|
-
onClick$: props.onClick$
|
|
16
|
+
id,
|
|
17
|
+
class: `checkbox ${error ? "checkbox-error" : ""} ${className ?? ""}`,
|
|
18
|
+
...inputProps
|
|
43
19
|
}),
|
|
44
|
-
|
|
20
|
+
label
|
|
45
21
|
]
|
|
46
22
|
}),
|
|
47
|
-
|
|
23
|
+
error && /* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
48
24
|
class: "text-error mt-1 text-xs",
|
|
49
|
-
children:
|
|
25
|
+
children: error
|
|
50
26
|
})
|
|
51
27
|
]
|
|
52
28
|
});
|
|
@@ -1,50 +1,26 @@
|
|
|
1
1
|
import { jsxs, jsx } from "@builder.io/qwik/jsx-runtime";
|
|
2
|
-
import { component
|
|
2
|
+
import { component$ } from "@builder.io/qwik";
|
|
3
3
|
const CheckboxField = component$((props) => {
|
|
4
|
-
const
|
|
5
|
-
useTask$(({ track }) => {
|
|
6
|
-
if (props.checked && typeof props.checked !== "boolean") {
|
|
7
|
-
track(() => checked.value);
|
|
8
|
-
if (checked.value !== props.checked?.value) {
|
|
9
|
-
props.checked.value = checked.value;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
useTask$(({ track }) => {
|
|
14
|
-
if (props.checked && typeof props.checked !== "boolean") {
|
|
15
|
-
track(() => props.checked.value);
|
|
16
|
-
if (props.checked && checked.value !== props.checked.value) {
|
|
17
|
-
checked.value = props.checked.value;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
});
|
|
4
|
+
const { label, error, id, class: className, ...inputProps } = props;
|
|
21
5
|
return /* @__PURE__ */ jsxs("div", {
|
|
22
6
|
class: "fieldset",
|
|
23
7
|
children: [
|
|
24
8
|
/* @__PURE__ */ jsxs("label", {
|
|
25
9
|
class: "label",
|
|
26
|
-
|
|
27
|
-
for: props.id
|
|
28
|
-
},
|
|
10
|
+
for: id,
|
|
29
11
|
children: [
|
|
30
12
|
/* @__PURE__ */ jsx("input", {
|
|
31
13
|
type: "checkbox",
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
...props.id && {
|
|
36
|
-
id: props.id
|
|
37
|
-
},
|
|
38
|
-
checked: checked.value,
|
|
39
|
-
class: `checkbox ${props.error ? "checkbox-error" : ""}`,
|
|
40
|
-
onClick$: props.onClick$
|
|
14
|
+
id,
|
|
15
|
+
class: `checkbox ${error ? "checkbox-error" : ""} ${className ?? ""}`,
|
|
16
|
+
...inputProps
|
|
41
17
|
}),
|
|
42
|
-
|
|
18
|
+
label
|
|
43
19
|
]
|
|
44
20
|
}),
|
|
45
|
-
|
|
21
|
+
error && /* @__PURE__ */ jsx("div", {
|
|
46
22
|
class: "text-error mt-1 text-xs",
|
|
47
|
-
children:
|
|
23
|
+
children: error
|
|
48
24
|
})
|
|
49
25
|
]
|
|
50
26
|
});
|
|
@@ -3,9 +3,9 @@ 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 qwikIcons = require("@nr1e/qwik-icons");
|
|
6
|
-
const
|
|
6
|
+
const button = require("./button.qwik.cjs");
|
|
7
7
|
const RefreshButton = qwik.component$((props) => {
|
|
8
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8
|
+
return /* @__PURE__ */ jsxRuntime.jsx(button.Button, {
|
|
9
9
|
...props,
|
|
10
10
|
class: `btn-primary ${props.class ?? ""}`,
|
|
11
11
|
text: props.text || "Refresh",
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx } from "@builder.io/qwik/jsx-runtime";
|
|
2
2
|
import { component$ } from "@builder.io/qwik";
|
|
3
3
|
import { MdiRefresh } from "@nr1e/qwik-icons";
|
|
4
|
-
import {
|
|
4
|
+
import { Button } from "./button.qwik.mjs";
|
|
5
5
|
const RefreshButton = component$((props) => {
|
|
6
|
-
return /* @__PURE__ */ jsx(
|
|
6
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
7
7
|
...props,
|
|
8
8
|
class: `btn-primary ${props.class ?? ""}`,
|
|
9
9
|
text: props.text || "Refresh",
|
|
@@ -3,54 +3,27 @@ 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
|
|
7
|
-
qwik.useTask$(({ track }) => {
|
|
8
|
-
if (props.value && typeof props.value !== "string") {
|
|
9
|
-
track(() => value.value);
|
|
10
|
-
if (value.value !== props.value?.value) {
|
|
11
|
-
props.value.value = value.value;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
qwik.useTask$(({ track }) => {
|
|
16
|
-
if (props.value && typeof props.value !== "string") {
|
|
17
|
-
track(() => props.value.value);
|
|
18
|
-
if (props.value.value !== value.value) {
|
|
19
|
-
value.value = props.value.value;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
});
|
|
6
|
+
const { label, error, id, class: className, ...selectProps } = props;
|
|
23
7
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", {
|
|
24
8
|
class: "fieldset",
|
|
25
9
|
children: [
|
|
26
|
-
|
|
10
|
+
label && /* @__PURE__ */ jsxRuntime.jsx("label", {
|
|
27
11
|
class: "label",
|
|
28
|
-
|
|
29
|
-
for: props.id
|
|
30
|
-
},
|
|
12
|
+
for: id,
|
|
31
13
|
children: /* @__PURE__ */ jsxRuntime.jsx("span", {
|
|
32
14
|
class: "label-text",
|
|
33
|
-
children:
|
|
15
|
+
children: label
|
|
34
16
|
})
|
|
35
17
|
}),
|
|
36
18
|
/* @__PURE__ */ jsxRuntime.jsx("select", {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
...props.id && {
|
|
41
|
-
id: props.id
|
|
42
|
-
},
|
|
43
|
-
required: props.required,
|
|
44
|
-
"aria-required": props.required,
|
|
45
|
-
disabled: props.disabled,
|
|
46
|
-
class: `select ${props.error ? "select-error" : ""}`,
|
|
47
|
-
onChange$: props.onChange$,
|
|
48
|
-
onBlur$: props.onBlur$,
|
|
19
|
+
id,
|
|
20
|
+
class: `select ${error ? "select-error" : ""} ${className ?? ""}`,
|
|
21
|
+
...selectProps,
|
|
49
22
|
children: /* @__PURE__ */ jsxRuntime.jsx(qwik.Slot, {})
|
|
50
23
|
}),
|
|
51
|
-
|
|
24
|
+
error && /* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
52
25
|
class: "text-error mt-1 text-xs",
|
|
53
|
-
children:
|
|
26
|
+
children: error
|
|
54
27
|
})
|
|
55
28
|
]
|
|
56
29
|
});
|
|
@@ -1,54 +1,27 @@
|
|
|
1
1
|
import { jsxs, jsx } from "@builder.io/qwik/jsx-runtime";
|
|
2
|
-
import { component$,
|
|
2
|
+
import { component$, Slot } from "@builder.io/qwik";
|
|
3
3
|
const SelectField = component$((props) => {
|
|
4
|
-
const
|
|
5
|
-
useTask$(({ track }) => {
|
|
6
|
-
if (props.value && typeof props.value !== "string") {
|
|
7
|
-
track(() => value.value);
|
|
8
|
-
if (value.value !== props.value?.value) {
|
|
9
|
-
props.value.value = value.value;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
useTask$(({ track }) => {
|
|
14
|
-
if (props.value && typeof props.value !== "string") {
|
|
15
|
-
track(() => props.value.value);
|
|
16
|
-
if (props.value.value !== value.value) {
|
|
17
|
-
value.value = props.value.value;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
});
|
|
4
|
+
const { label, error, id, class: className, ...selectProps } = props;
|
|
21
5
|
return /* @__PURE__ */ jsxs("div", {
|
|
22
6
|
class: "fieldset",
|
|
23
7
|
children: [
|
|
24
|
-
|
|
8
|
+
label && /* @__PURE__ */ jsx("label", {
|
|
25
9
|
class: "label",
|
|
26
|
-
|
|
27
|
-
for: props.id
|
|
28
|
-
},
|
|
10
|
+
for: id,
|
|
29
11
|
children: /* @__PURE__ */ jsx("span", {
|
|
30
12
|
class: "label-text",
|
|
31
|
-
children:
|
|
13
|
+
children: label
|
|
32
14
|
})
|
|
33
15
|
}),
|
|
34
16
|
/* @__PURE__ */ jsx("select", {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
...props.id && {
|
|
39
|
-
id: props.id
|
|
40
|
-
},
|
|
41
|
-
required: props.required,
|
|
42
|
-
"aria-required": props.required,
|
|
43
|
-
disabled: props.disabled,
|
|
44
|
-
class: `select ${props.error ? "select-error" : ""}`,
|
|
45
|
-
onChange$: props.onChange$,
|
|
46
|
-
onBlur$: props.onBlur$,
|
|
17
|
+
id,
|
|
18
|
+
class: `select ${error ? "select-error" : ""} ${className ?? ""}`,
|
|
19
|
+
...selectProps,
|
|
47
20
|
children: /* @__PURE__ */ jsx(Slot, {})
|
|
48
21
|
}),
|
|
49
|
-
|
|
22
|
+
error && /* @__PURE__ */ jsx("div", {
|
|
50
23
|
class: "text-error mt-1 text-xs",
|
|
51
|
-
children:
|
|
24
|
+
children: error
|
|
52
25
|
})
|
|
53
26
|
]
|
|
54
27
|
});
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
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
|
-
const
|
|
5
|
+
const button = require("./button.qwik.cjs");
|
|
6
6
|
const SubmitButton = qwik.component$((props) => {
|
|
7
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
7
|
+
return /* @__PURE__ */ jsxRuntime.jsx(button.Button, {
|
|
8
8
|
...props,
|
|
9
9
|
class: `btn-primary ${props.class ?? ""}`,
|
|
10
10
|
text: props.text || "Submit",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx } from "@builder.io/qwik/jsx-runtime";
|
|
2
2
|
import { component$ } from "@builder.io/qwik";
|
|
3
|
-
import {
|
|
3
|
+
import { Button } from "./button.qwik.mjs";
|
|
4
4
|
const SubmitButton = component$((props) => {
|
|
5
|
-
return /* @__PURE__ */ jsx(
|
|
5
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
6
6
|
...props,
|
|
7
7
|
class: `btn-primary ${props.class ?? ""}`,
|
|
8
8
|
text: props.text || "Submit",
|
|
@@ -3,64 +3,41 @@ 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 TextField = qwik.component$((props) => {
|
|
6
|
-
const
|
|
7
|
-
const onInputHandler = props.onInput$;
|
|
6
|
+
const { label, error, icon, id, class: className, children, ...inputProps } = props;
|
|
8
7
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", {
|
|
9
8
|
class: "fieldset",
|
|
10
9
|
children: [
|
|
11
|
-
|
|
10
|
+
label && /* @__PURE__ */ jsxRuntime.jsx("label", {
|
|
12
11
|
class: "label",
|
|
13
|
-
|
|
14
|
-
for: props.id
|
|
15
|
-
},
|
|
12
|
+
for: id,
|
|
16
13
|
children: /* @__PURE__ */ jsxRuntime.jsx("span", {
|
|
17
14
|
class: "label-text",
|
|
18
|
-
children:
|
|
15
|
+
children: label
|
|
19
16
|
})
|
|
20
17
|
}),
|
|
21
18
|
/* @__PURE__ */ jsxRuntime.jsxs("label", {
|
|
22
|
-
class: `input w-full ${
|
|
19
|
+
class: `input w-full ${error ? "input-error" : ""} ${className ?? ""}`,
|
|
23
20
|
children: [
|
|
24
21
|
/* @__PURE__ */ jsxRuntime.jsx(qwik.Slot, {
|
|
25
22
|
name: "left"
|
|
26
23
|
}),
|
|
27
|
-
|
|
24
|
+
icon && /* @__PURE__ */ jsxRuntime.jsx("icon", {
|
|
28
25
|
size: 18,
|
|
29
26
|
class: "opacity-50"
|
|
30
27
|
}),
|
|
31
28
|
/* @__PURE__ */ jsxRuntime.jsx("input", {
|
|
32
|
-
|
|
33
|
-
...props.id && {
|
|
34
|
-
id: props.id
|
|
35
|
-
},
|
|
36
|
-
...props.name && {
|
|
37
|
-
name: props.name
|
|
38
|
-
},
|
|
39
|
-
required: props.required,
|
|
40
|
-
"aria-required": props.required,
|
|
41
|
-
disabled: props.disabled,
|
|
42
|
-
maxLength: props.maxLength,
|
|
43
|
-
value: typeof props.value === "string" ? props.value : props.value?.value,
|
|
29
|
+
id,
|
|
44
30
|
class: "placeholder:opacity-50",
|
|
45
|
-
|
|
46
|
-
onBlur$: props.onBlur$,
|
|
47
|
-
onInput$: (event, element) => {
|
|
48
|
-
if (value && typeof value !== "string") {
|
|
49
|
-
value.value = element.value;
|
|
50
|
-
}
|
|
51
|
-
if (onInputHandler) {
|
|
52
|
-
onInputHandler(event, element);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
31
|
+
...inputProps
|
|
55
32
|
}),
|
|
56
33
|
/* @__PURE__ */ jsxRuntime.jsx(qwik.Slot, {
|
|
57
34
|
name: "right"
|
|
58
35
|
})
|
|
59
36
|
]
|
|
60
37
|
}),
|
|
61
|
-
|
|
38
|
+
error && /* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
62
39
|
class: "text-error mt-1 text-xs",
|
|
63
|
-
children:
|
|
40
|
+
children: error
|
|
64
41
|
})
|
|
65
42
|
]
|
|
66
43
|
});
|
|
@@ -1,64 +1,41 @@
|
|
|
1
1
|
import { jsxs, jsx } from "@builder.io/qwik/jsx-runtime";
|
|
2
2
|
import { component$, Slot } from "@builder.io/qwik";
|
|
3
3
|
const TextField = component$((props) => {
|
|
4
|
-
const
|
|
5
|
-
const onInputHandler = props.onInput$;
|
|
4
|
+
const { label, error, icon, id, class: className, children, ...inputProps } = props;
|
|
6
5
|
return /* @__PURE__ */ jsxs("div", {
|
|
7
6
|
class: "fieldset",
|
|
8
7
|
children: [
|
|
9
|
-
|
|
8
|
+
label && /* @__PURE__ */ jsx("label", {
|
|
10
9
|
class: "label",
|
|
11
|
-
|
|
12
|
-
for: props.id
|
|
13
|
-
},
|
|
10
|
+
for: id,
|
|
14
11
|
children: /* @__PURE__ */ jsx("span", {
|
|
15
12
|
class: "label-text",
|
|
16
|
-
children:
|
|
13
|
+
children: label
|
|
17
14
|
})
|
|
18
15
|
}),
|
|
19
16
|
/* @__PURE__ */ jsxs("label", {
|
|
20
|
-
class: `input w-full ${
|
|
17
|
+
class: `input w-full ${error ? "input-error" : ""} ${className ?? ""}`,
|
|
21
18
|
children: [
|
|
22
19
|
/* @__PURE__ */ jsx(Slot, {
|
|
23
20
|
name: "left"
|
|
24
21
|
}),
|
|
25
|
-
|
|
22
|
+
icon && /* @__PURE__ */ jsx("icon", {
|
|
26
23
|
size: 18,
|
|
27
24
|
class: "opacity-50"
|
|
28
25
|
}),
|
|
29
26
|
/* @__PURE__ */ jsx("input", {
|
|
30
|
-
|
|
31
|
-
...props.id && {
|
|
32
|
-
id: props.id
|
|
33
|
-
},
|
|
34
|
-
...props.name && {
|
|
35
|
-
name: props.name
|
|
36
|
-
},
|
|
37
|
-
required: props.required,
|
|
38
|
-
"aria-required": props.required,
|
|
39
|
-
disabled: props.disabled,
|
|
40
|
-
maxLength: props.maxLength,
|
|
41
|
-
value: typeof props.value === "string" ? props.value : props.value?.value,
|
|
27
|
+
id,
|
|
42
28
|
class: "placeholder:opacity-50",
|
|
43
|
-
|
|
44
|
-
onBlur$: props.onBlur$,
|
|
45
|
-
onInput$: (event, element) => {
|
|
46
|
-
if (value && typeof value !== "string") {
|
|
47
|
-
value.value = element.value;
|
|
48
|
-
}
|
|
49
|
-
if (onInputHandler) {
|
|
50
|
-
onInputHandler(event, element);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
29
|
+
...inputProps
|
|
53
30
|
}),
|
|
54
31
|
/* @__PURE__ */ jsx(Slot, {
|
|
55
32
|
name: "right"
|
|
56
33
|
})
|
|
57
34
|
]
|
|
58
35
|
}),
|
|
59
|
-
|
|
36
|
+
error && /* @__PURE__ */ jsx("div", {
|
|
60
37
|
class: "text-error mt-1 text-xs",
|
|
61
|
-
children:
|
|
38
|
+
children: error
|
|
62
39
|
})
|
|
63
40
|
]
|
|
64
41
|
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("@builder.io/qwik/jsx-runtime");
|
|
4
|
+
const qwik = require("@builder.io/qwik");
|
|
5
|
+
const TextareaField = qwik.component$((props) => {
|
|
6
|
+
const { label, error, id, class: className, ...textareaProps } = props;
|
|
7
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", {
|
|
8
|
+
class: "fieldset",
|
|
9
|
+
children: [
|
|
10
|
+
label && /* @__PURE__ */ jsxRuntime.jsx("label", {
|
|
11
|
+
class: "label",
|
|
12
|
+
for: id,
|
|
13
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("span", {
|
|
14
|
+
class: "label-text",
|
|
15
|
+
children: label
|
|
16
|
+
})
|
|
17
|
+
}),
|
|
18
|
+
/* @__PURE__ */ jsxRuntime.jsx("textarea", {
|
|
19
|
+
id,
|
|
20
|
+
class: `textarea ${error ? "textarea-error" : ""} ${className ?? ""}`,
|
|
21
|
+
...textareaProps
|
|
22
|
+
}),
|
|
23
|
+
error && /* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
24
|
+
class: "text-error mt-1 text-xs",
|
|
25
|
+
children: error
|
|
26
|
+
})
|
|
27
|
+
]
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
exports.TextareaField = TextareaField;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsxs, jsx } from "@builder.io/qwik/jsx-runtime";
|
|
2
|
+
import { component$ } from "@builder.io/qwik";
|
|
3
|
+
const TextareaField = component$((props) => {
|
|
4
|
+
const { label, error, id, class: className, ...textareaProps } = props;
|
|
5
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
6
|
+
class: "fieldset",
|
|
7
|
+
children: [
|
|
8
|
+
label && /* @__PURE__ */ jsx("label", {
|
|
9
|
+
class: "label",
|
|
10
|
+
for: id,
|
|
11
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
12
|
+
class: "label-text",
|
|
13
|
+
children: label
|
|
14
|
+
})
|
|
15
|
+
}),
|
|
16
|
+
/* @__PURE__ */ jsx("textarea", {
|
|
17
|
+
id,
|
|
18
|
+
class: `textarea ${error ? "textarea-error" : ""} ${className ?? ""}`,
|
|
19
|
+
...textareaProps
|
|
20
|
+
}),
|
|
21
|
+
error && /* @__PURE__ */ jsx("div", {
|
|
22
|
+
class: "text-error mt-1 text-xs",
|
|
23
|
+
children: error
|
|
24
|
+
})
|
|
25
|
+
]
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
export {
|
|
29
|
+
TextareaField
|
|
30
|
+
};
|
package/lib/index.qwik.cjs
CHANGED
|
@@ -21,11 +21,11 @@ const gtm = require("./components/gtm.qwik.cjs");
|
|
|
21
21
|
const menu = require("./components/menu.qwik.cjs");
|
|
22
22
|
const microsoftSignInButton = require("./components/microsoft-sign-in-button.qwik.cjs");
|
|
23
23
|
const paceBar = require("./components/pace-bar.qwik.cjs");
|
|
24
|
-
const processingButton = require("./components/processing-button.qwik.cjs");
|
|
25
24
|
const refreshButton = require("./components/refresh-button.qwik.cjs");
|
|
26
25
|
const selectField = require("./components/select-field.qwik.cjs");
|
|
27
26
|
const submitButton = require("./components/submit-button.qwik.cjs");
|
|
28
27
|
const textField = require("./components/text-field.qwik.cjs");
|
|
28
|
+
const textareaField = require("./components/textarea-field.qwik.cjs");
|
|
29
29
|
const themeSelector = require("./components/theme-selector.qwik.cjs");
|
|
30
30
|
const timeZoneSelector = require("./components/time-zone-selector.qwik.cjs");
|
|
31
31
|
const universalLayout = require("./components/universal-layout.qwik.cjs");
|
|
@@ -64,11 +64,11 @@ exports.MenuLink = menu.MenuLink;
|
|
|
64
64
|
exports.Submenu = menu.Submenu;
|
|
65
65
|
exports.MicrosoftSignInButton = microsoftSignInButton.MicrosoftSignInButton;
|
|
66
66
|
exports.PaceBar = paceBar.PaceBar;
|
|
67
|
-
exports.ProcessingButton = processingButton.ProcessingButton;
|
|
68
67
|
exports.RefreshButton = refreshButton.RefreshButton;
|
|
69
68
|
exports.SelectField = selectField.SelectField;
|
|
70
69
|
exports.SubmitButton = submitButton.SubmitButton;
|
|
71
70
|
exports.TextField = textField.TextField;
|
|
71
|
+
exports.TextareaField = textareaField.TextareaField;
|
|
72
72
|
exports.THEMES = themeSelector.THEMES;
|
|
73
73
|
exports.ThemeSelector = themeSelector.ThemeSelector;
|
|
74
74
|
exports.themeToName = themeSelector.themeToName;
|
package/lib/index.qwik.mjs
CHANGED
|
@@ -19,11 +19,11 @@ import { GtmBody, GtmHead } from "./components/gtm.qwik.mjs";
|
|
|
19
19
|
import { Menu, MenuButton, MenuDivider, MenuGroup, MenuGroupSummary, MenuLink, Submenu } from "./components/menu.qwik.mjs";
|
|
20
20
|
import { MicrosoftSignInButton } from "./components/microsoft-sign-in-button.qwik.mjs";
|
|
21
21
|
import { PaceBar } from "./components/pace-bar.qwik.mjs";
|
|
22
|
-
import { ProcessingButton } from "./components/processing-button.qwik.mjs";
|
|
23
22
|
import { RefreshButton } from "./components/refresh-button.qwik.mjs";
|
|
24
23
|
import { SelectField } from "./components/select-field.qwik.mjs";
|
|
25
24
|
import { SubmitButton } from "./components/submit-button.qwik.mjs";
|
|
26
25
|
import { TextField } from "./components/text-field.qwik.mjs";
|
|
26
|
+
import { TextareaField } from "./components/textarea-field.qwik.mjs";
|
|
27
27
|
import { THEMES, ThemeSelector, themeToName } from "./components/theme-selector.qwik.mjs";
|
|
28
28
|
import { TimeZoneSelector, timeZoneToName } from "./components/time-zone-selector.qwik.mjs";
|
|
29
29
|
import { UniversalLayout } from "./components/universal-layout.qwik.mjs";
|
|
@@ -62,13 +62,13 @@ export {
|
|
|
62
62
|
MenuLink,
|
|
63
63
|
MicrosoftSignInButton,
|
|
64
64
|
PaceBar,
|
|
65
|
-
ProcessingButton,
|
|
66
65
|
RefreshButton,
|
|
67
66
|
SelectField,
|
|
68
67
|
Submenu,
|
|
69
68
|
SubmitButton,
|
|
70
69
|
THEMES,
|
|
71
70
|
TextField,
|
|
71
|
+
TextareaField,
|
|
72
72
|
ThemeSelector,
|
|
73
73
|
TimeZoneSelector,
|
|
74
74
|
UniversalLayout,
|
|
@@ -1,25 +1,6 @@
|
|
|
1
|
-
import { Component,
|
|
2
|
-
import { IconProps } from '@nr1e/qwik-icons';
|
|
3
|
-
|
|
4
|
-
* Props for the Button component.
|
|
5
|
-
*/
|
|
6
|
-
export interface ButtonProps {
|
|
7
|
-
/**
|
|
8
|
-
* ID of the button.
|
|
9
|
-
*/
|
|
10
|
-
id?: string;
|
|
11
|
-
/**
|
|
12
|
-
* CSS class to apply to the button.
|
|
13
|
-
*/
|
|
14
|
-
class?: string;
|
|
15
|
-
/**
|
|
16
|
-
* Callback function to be called when the button is clicked.
|
|
17
|
-
*/
|
|
18
|
-
onClick$?: QRL<(event: Event) => void | Promise<void>>;
|
|
19
|
-
/**
|
|
20
|
-
* Whether the button is disabled.
|
|
21
|
-
*/
|
|
22
|
-
disabled?: boolean;
|
|
1
|
+
import { type Component, type JSXChildren, type PropsOf } from '@builder.io/qwik';
|
|
2
|
+
import type { IconProps } from '@nr1e/qwik-icons';
|
|
3
|
+
export interface ButtonProps extends Omit<PropsOf<'button'>, 'children'> {
|
|
23
4
|
/**
|
|
24
5
|
* Icon component to display next to the button text. You can alternatively use the `icon` slot.
|
|
25
6
|
*/
|
|
@@ -32,14 +13,15 @@ export interface ButtonProps {
|
|
|
32
13
|
* CSS class to apply to the icon.
|
|
33
14
|
*/
|
|
34
15
|
iconClass?: string;
|
|
35
|
-
/**
|
|
36
|
-
* Type of the button. Default is 'button'.
|
|
37
|
-
*/
|
|
38
|
-
type?: 'button' | 'submit' | 'reset';
|
|
39
16
|
/**
|
|
40
17
|
* Text to display on the button. Alternative to the `default` slot.
|
|
41
18
|
*/
|
|
42
19
|
text?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Whether the button is processing. This will replace the icon with a rotating spinner when true.
|
|
22
|
+
*/
|
|
23
|
+
processing?: boolean;
|
|
24
|
+
children?: JSXChildren;
|
|
43
25
|
}
|
|
44
26
|
/**
|
|
45
27
|
* Button component.
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export interface CheckboxFieldProps {
|
|
3
|
-
id?: string;
|
|
1
|
+
import type { PropsOf } from '@builder.io/qwik';
|
|
2
|
+
export interface CheckboxFieldProps extends PropsOf<'input'> {
|
|
4
3
|
label: string;
|
|
5
|
-
name?: string;
|
|
6
|
-
checked?: boolean | Signal<boolean>;
|
|
7
4
|
error?: string;
|
|
8
|
-
onClick$?: QRL<(event: Event) => void>;
|
|
9
5
|
}
|
|
10
6
|
export declare const CheckboxField: import("@builder.io/qwik").Component<CheckboxFieldProps>;
|
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export interface SelectFieldProps {
|
|
3
|
-
id?: string;
|
|
1
|
+
import type { PropsOf } from '@builder.io/qwik';
|
|
2
|
+
export interface SelectFieldProps extends Omit<PropsOf<'select'>, 'children'> {
|
|
4
3
|
label?: string;
|
|
5
|
-
name?: string;
|
|
6
|
-
value?: string | null | Signal<string | null | undefined>;
|
|
7
4
|
error?: string;
|
|
8
|
-
required?: boolean;
|
|
9
|
-
disabled?: boolean;
|
|
10
|
-
onChange$?: QRL<(event: Event, element: HTMLSelectElement) => void>;
|
|
11
|
-
onBlur$?: QRL<(event: FocusEvent, element: HTMLSelectElement) => void>;
|
|
12
5
|
}
|
|
13
6
|
export declare const SelectField: import("@builder.io/qwik").Component<SelectFieldProps>;
|
|
@@ -1,35 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
*/
|
|
6
|
-
export type TextFieldType = 'text' | 'date' | 'email' | 'number' | 'tel' | 'url' | 'password';
|
|
7
|
-
/**
|
|
8
|
-
* Properties for the TextField component.
|
|
9
|
-
*/
|
|
10
|
-
export interface TextFieldProps {
|
|
11
|
-
id?: string;
|
|
12
|
-
type?: TextFieldType;
|
|
1
|
+
import { type Component, type JSXChildren } from '@builder.io/qwik';
|
|
2
|
+
import type { PropsOf } from '@builder.io/qwik';
|
|
3
|
+
import type { IconProps } from '@nr1e/qwik-icons';
|
|
4
|
+
export interface TextFieldProps extends Omit<PropsOf<'input'>, 'children'> {
|
|
13
5
|
label?: string;
|
|
14
|
-
name?: string;
|
|
15
|
-
value?: string | null | Signal<string | null | undefined>;
|
|
16
|
-
placeholder?: string;
|
|
17
6
|
error?: string;
|
|
18
|
-
maxLength?: number;
|
|
19
|
-
required?: boolean;
|
|
20
|
-
disabled?: boolean;
|
|
21
|
-
/**
|
|
22
|
-
* Called when the input loses focus.
|
|
23
|
-
*/
|
|
24
|
-
onBlur$?: QRL<(event: FocusEvent, element: HTMLInputElement) => void>;
|
|
25
|
-
/**
|
|
26
|
-
* Called when the input value changes.
|
|
27
|
-
*/
|
|
28
|
-
onInput$?: QRL<(event: InputEvent, element: HTMLInputElement) => void>;
|
|
29
7
|
icon?: Component<IconProps>;
|
|
8
|
+
children?: JSXChildren;
|
|
30
9
|
}
|
|
31
|
-
/**
|
|
32
|
-
* A standardized text input field meant to be used independently or with Qwik
|
|
33
|
-
* Modular Forms.
|
|
34
|
-
*/
|
|
35
10
|
export declare const TextField: Component<TextFieldProps>;
|
package/lib-types/index.d.ts
CHANGED
|
@@ -19,11 +19,11 @@ export * from './components/gtm';
|
|
|
19
19
|
export * from './components/menu';
|
|
20
20
|
export * from './components/microsoft-sign-in-button';
|
|
21
21
|
export * from './components/pace-bar';
|
|
22
|
-
export * from './components/processing-button';
|
|
23
22
|
export * from './components/refresh-button';
|
|
24
23
|
export * from './components/select-field';
|
|
25
24
|
export * from './components/submit-button';
|
|
26
25
|
export * from './components/text-field';
|
|
26
|
+
export * from './components/textarea-field';
|
|
27
27
|
export * from './components/theme-selector';
|
|
28
28
|
export * from './components/time-zone-selector';
|
|
29
29
|
export * from './components/universal-layout';
|
package/package.json
CHANGED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const jsxRuntime = require("@builder.io/qwik/jsx-runtime");
|
|
4
|
-
const qwik = require("@builder.io/qwik");
|
|
5
|
-
const qwikIcons = require("@nr1e/qwik-icons");
|
|
6
|
-
const button = require("./button.qwik.cjs");
|
|
7
|
-
const ProcessingButton = qwik.component$((props) => {
|
|
8
|
-
return /* @__PURE__ */ jsxRuntime.jsx(button.Button, {
|
|
9
|
-
...props,
|
|
10
|
-
class: `${props.processing || props.disabled ? "disabled" : ""} ${props.class ?? ""}`,
|
|
11
|
-
disabled: props.processing || props.disabled,
|
|
12
|
-
icon: props.processing ? qwikIcons.SpinnersBarsFade : props.icon,
|
|
13
|
-
iconClass: props.processing ? "animate-spin" : props.iconClass,
|
|
14
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(qwik.Slot, {})
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
exports.ProcessingButton = ProcessingButton;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { jsx } from "@builder.io/qwik/jsx-runtime";
|
|
2
|
-
import { component$, Slot } from "@builder.io/qwik";
|
|
3
|
-
import { SpinnersBarsFade } from "@nr1e/qwik-icons";
|
|
4
|
-
import { Button } from "./button.qwik.mjs";
|
|
5
|
-
const ProcessingButton = component$((props) => {
|
|
6
|
-
return /* @__PURE__ */ jsx(Button, {
|
|
7
|
-
...props,
|
|
8
|
-
class: `${props.processing || props.disabled ? "disabled" : ""} ${props.class ?? ""}`,
|
|
9
|
-
disabled: props.processing || props.disabled,
|
|
10
|
-
icon: props.processing ? SpinnersBarsFade : props.icon,
|
|
11
|
-
iconClass: props.processing ? "animate-spin" : props.iconClass,
|
|
12
|
-
children: /* @__PURE__ */ jsx(Slot, {})
|
|
13
|
-
});
|
|
14
|
-
});
|
|
15
|
-
export {
|
|
16
|
-
ProcessingButton
|
|
17
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ButtonProps } from './button';
|
|
2
|
-
/**
|
|
3
|
-
* Props for the ProcessingButton component. This class will replace the icon
|
|
4
|
-
* with a rotating spinner when clicked.
|
|
5
|
-
*/
|
|
6
|
-
export interface ProcessingButtonProps extends ButtonProps {
|
|
7
|
-
/**
|
|
8
|
-
* Whether the button is processing.
|
|
9
|
-
*/
|
|
10
|
-
processing?: boolean;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* ProcessingButton component.
|
|
14
|
-
*/
|
|
15
|
-
export declare const ProcessingButton: import("@builder.io/qwik").Component<ProcessingButtonProps>;
|