@nr1e/qwik-ui 2.1.5 → 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,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 { label, error, id, class: className, ...selectProps } = props;
6
+ const { label, error, id, class: className, onChangeValue$, ...selectProps } = props;
7
7
  const optionsEntries = Array.isArray(props.options) ? props.options.map((opt) => [
8
8
  opt,
9
9
  opt
@@ -22,6 +22,13 @@ const SelectField = qwik.component$((props) => {
22
22
  /* @__PURE__ */ jsxRuntime.jsxs("select", {
23
23
  id,
24
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
+ },
25
32
  ...selectProps,
26
33
  children: [
27
34
  props.placeholder && /* @__PURE__ */ jsxRuntime.jsx("option", {
@@ -1,7 +1,7 @@
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
5
  const optionsEntries = Array.isArray(props.options) ? props.options.map((opt) => [
6
6
  opt,
7
7
  opt
@@ -20,6 +20,13 @@ const SelectField = component$((props) => {
20
20
  /* @__PURE__ */ jsxs("select", {
21
21
  id,
22
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
+ },
23
30
  ...selectProps,
24
31
  children: [
25
32
  props.placeholder && /* @__PURE__ */ jsx("option", {
@@ -1,8 +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;
5
6
  placeholder?: string;
6
7
  options?: Record<string, string> | string[];
8
+ onChangeValue$?: QRL<(value: string, target: HTMLSelectElement, event: Event) => void>;
7
9
  }
8
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.5",
3
+ "version": "2.1.6",
4
4
  "description": "NR1E Qwik UI Library",
5
5
  "author": "NR1E, Inc.",
6
6
  "publishConfig": {