@nr1e/qwik-ui 2.1.4 → 2.1.6
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,7 +3,11 @@ 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 { label, error, id, class: className, ...selectProps } = props;
|
|
6
|
+
const { label, error, id, class: className, onChangeValue$, ...selectProps } = props;
|
|
7
|
+
const optionsEntries = Array.isArray(props.options) ? props.options.map((opt) => [
|
|
8
|
+
opt,
|
|
9
|
+
opt
|
|
10
|
+
]) : Object.entries(props.options ?? {});
|
|
7
11
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", {
|
|
8
12
|
class: "fieldset",
|
|
9
13
|
children: [
|
|
@@ -15,11 +19,30 @@ const SelectField = qwik.component$((props) => {
|
|
|
15
19
|
children: label
|
|
16
20
|
})
|
|
17
21
|
}),
|
|
18
|
-
/* @__PURE__ */ jsxRuntime.
|
|
22
|
+
/* @__PURE__ */ jsxRuntime.jsxs("select", {
|
|
19
23
|
id,
|
|
20
24
|
class: `select ${error ? "select-error" : ""} ${className ?? ""}`,
|
|
25
|
+
onChange$: (e) => {
|
|
26
|
+
const target = e.target;
|
|
27
|
+
const value = target.value;
|
|
28
|
+
if (onChangeValue$) {
|
|
29
|
+
onChangeValue$(value, target, e);
|
|
30
|
+
}
|
|
31
|
+
},
|
|
21
32
|
...selectProps,
|
|
22
|
-
children:
|
|
33
|
+
children: [
|
|
34
|
+
props.placeholder && /* @__PURE__ */ jsxRuntime.jsx("option", {
|
|
35
|
+
disabled: true,
|
|
36
|
+
selected: !props.value || props.value === "",
|
|
37
|
+
children: props.placeholder
|
|
38
|
+
}),
|
|
39
|
+
optionsEntries.map(([k, v]) => /* @__PURE__ */ jsxRuntime.jsx("option", {
|
|
40
|
+
value: v,
|
|
41
|
+
selected: v === props.value,
|
|
42
|
+
children: k
|
|
43
|
+
}, k)),
|
|
44
|
+
/* @__PURE__ */ jsxRuntime.jsx(qwik.Slot, {})
|
|
45
|
+
]
|
|
23
46
|
}),
|
|
24
47
|
error && /* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
25
48
|
class: "text-error mt-1 text-xs",
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { jsxs, jsx } from "@builder.io/qwik/jsx-runtime";
|
|
2
2
|
import { component$, Slot } from "@builder.io/qwik";
|
|
3
3
|
const SelectField = component$((props) => {
|
|
4
|
-
const { label, error, id, class: className, ...selectProps } = props;
|
|
4
|
+
const { label, error, id, class: className, onChangeValue$, ...selectProps } = props;
|
|
5
|
+
const optionsEntries = Array.isArray(props.options) ? props.options.map((opt) => [
|
|
6
|
+
opt,
|
|
7
|
+
opt
|
|
8
|
+
]) : Object.entries(props.options ?? {});
|
|
5
9
|
return /* @__PURE__ */ jsxs("div", {
|
|
6
10
|
class: "fieldset",
|
|
7
11
|
children: [
|
|
@@ -13,11 +17,30 @@ const SelectField = component$((props) => {
|
|
|
13
17
|
children: label
|
|
14
18
|
})
|
|
15
19
|
}),
|
|
16
|
-
/* @__PURE__ */
|
|
20
|
+
/* @__PURE__ */ jsxs("select", {
|
|
17
21
|
id,
|
|
18
22
|
class: `select ${error ? "select-error" : ""} ${className ?? ""}`,
|
|
23
|
+
onChange$: (e) => {
|
|
24
|
+
const target = e.target;
|
|
25
|
+
const value = target.value;
|
|
26
|
+
if (onChangeValue$) {
|
|
27
|
+
onChangeValue$(value, target, e);
|
|
28
|
+
}
|
|
29
|
+
},
|
|
19
30
|
...selectProps,
|
|
20
|
-
children:
|
|
31
|
+
children: [
|
|
32
|
+
props.placeholder && /* @__PURE__ */ jsx("option", {
|
|
33
|
+
disabled: true,
|
|
34
|
+
selected: !props.value || props.value === "",
|
|
35
|
+
children: props.placeholder
|
|
36
|
+
}),
|
|
37
|
+
optionsEntries.map(([k, v]) => /* @__PURE__ */ jsx("option", {
|
|
38
|
+
value: v,
|
|
39
|
+
selected: v === props.value,
|
|
40
|
+
children: k
|
|
41
|
+
}, k)),
|
|
42
|
+
/* @__PURE__ */ jsx(Slot, {})
|
|
43
|
+
]
|
|
21
44
|
}),
|
|
22
45
|
error && /* @__PURE__ */ jsx("div", {
|
|
23
46
|
class: "text-error mt-1 text-xs",
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import { type QRL } from '@builder.io/qwik';
|
|
1
2
|
import type { PropsOf } from '@builder.io/qwik';
|
|
2
3
|
export interface SelectFieldProps extends Omit<PropsOf<'select'>, 'children'> {
|
|
3
4
|
label?: string;
|
|
4
5
|
error?: string;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
options?: Record<string, string> | string[];
|
|
8
|
+
onChangeValue$?: QRL<(value: string, target: HTMLSelectElement, event: Event) => void>;
|
|
5
9
|
}
|
|
6
10
|
export declare const SelectField: import("@builder.io/qwik").Component<SelectFieldProps>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nr1e/qwik-ui",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.6",
|
|
4
4
|
"description": "NR1E Qwik UI Library",
|
|
5
5
|
"author": "NR1E, Inc.",
|
|
6
6
|
"publishConfig": {
|
|
@@ -36,12 +36,12 @@
|
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"@builder.io/qwik-city": "1.19.2",
|
|
38
38
|
"tailwindcss-animated": "2.0.0",
|
|
39
|
-
"@nr1e/qwik-icons": "0.0.
|
|
39
|
+
"@nr1e/qwik-icons": "0.0.34"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@builder.io/qwik": "1.19.
|
|
42
|
+
"@builder.io/qwik": "1.19.2",
|
|
43
43
|
"@eslint/js": "^9.39.4",
|
|
44
|
-
"@tailwindcss/vite": "^4.2.
|
|
44
|
+
"@tailwindcss/vite": "^4.2.2",
|
|
45
45
|
"@types/node": "^24.10.13",
|
|
46
46
|
"daisyui": "^5.5.19",
|
|
47
47
|
"eslint": "9.39.4",
|
|
@@ -50,15 +50,15 @@
|
|
|
50
50
|
"np": "^11.0.2",
|
|
51
51
|
"prettier": "3.8.1",
|
|
52
52
|
"prettier-plugin-tailwindcss": "^0.7.1",
|
|
53
|
-
"tailwindcss": "^4.2.
|
|
53
|
+
"tailwindcss": "^4.2.2",
|
|
54
54
|
"typescript": "5.9.3",
|
|
55
|
-
"typescript-eslint": "8.57.
|
|
55
|
+
"typescript-eslint": "8.57.1",
|
|
56
56
|
"undici": "*",
|
|
57
57
|
"vite": "7.3.1",
|
|
58
58
|
"vite-tsconfig-paths": "^6.1.1",
|
|
59
59
|
"vitest": "4.1.0",
|
|
60
60
|
"@inlang/paraglide-js": "^2.15.0",
|
|
61
|
-
"@inlang/cli": "^3.
|
|
61
|
+
"@inlang/cli": "^3.1.9"
|
|
62
62
|
},
|
|
63
63
|
"scripts": {
|
|
64
64
|
"prebuild": "prettier --check . && eslint . && pnpx @inlang/paraglide-js compile --project ./project.inlang --outdir ./src/paraglide",
|