@greghowe79/the-lib 0.5.1 → 0.5.3

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.
@@ -4,11 +4,14 @@ const jsxRuntime = require("@builder.io/qwik/jsx-runtime");
4
4
  const qwik = require("@builder.io/qwik");
5
5
  const styles = require("./styles.css.qwik.cjs");
6
6
  require("@fontsource/roboto-condensed/500.css");
7
- const Input = qwik.component$(({ id, type, placeholder, value, error, onValidate$ }) => {
7
+ const Input = qwik.component$(({ id, type, placeholder, value, error, onValidate$, onInput$ }) => {
8
8
  qwik.useStylesScoped$(styles);
9
9
  const internalError = qwik.useSignal(null);
10
10
  const showError = error ?? internalError;
11
11
  const inputHandler = qwik.$(async (_, elem) => {
12
+ if (onInput$) {
13
+ await onInput$();
14
+ }
12
15
  if (onValidate$) {
13
16
  const result = await onValidate$(elem.value);
14
17
  if (!error) internalError.value = result;
@@ -2,11 +2,14 @@ import { jsxs, jsx } from "@builder.io/qwik/jsx-runtime";
2
2
  import { component$, useStylesScoped$, useSignal, $ } from "@builder.io/qwik";
3
3
  import styles from "./styles.css.qwik.mjs";
4
4
  import "@fontsource/roboto-condensed/500.css";
5
- const Input = component$(({ id, type, placeholder, value, error, onValidate$ }) => {
5
+ const Input = component$(({ id, type, placeholder, value, error, onValidate$, onInput$ }) => {
6
6
  useStylesScoped$(styles);
7
7
  const internalError = useSignal(null);
8
8
  const showError = error ?? internalError;
9
9
  const inputHandler = $(async (_, elem) => {
10
+ if (onInput$) {
11
+ await onInput$();
12
+ }
10
13
  if (onValidate$) {
11
14
  const result = await onValidate$(elem.value);
12
15
  if (!error) internalError.value = result;
@@ -6,8 +6,9 @@ const styles = require("./styles.css.qwik.cjs");
6
6
  const button = require("../button/button.qwik.cjs");
7
7
  const closeIcon = require("../icons/closeIcon.qwik.cjs");
8
8
  require("@fontsource/roboto-condensed");
9
- const Modal = qwik.component$(({ title, open, primaryButtonLabel, secondaryButtonLabel, primaryAction, secondaryAction, closeButtonVisible = true, isLoading }) => {
9
+ const Modal = qwik.component$(({ title, open, primaryButtonLabel, secondaryButtonLabel, primaryAction, secondaryAction, closeButtonVisible = true, isLoading, primaryButtonDisabled }) => {
10
10
  qwik.useStylesScoped$(styles);
11
+ const isDisabled = typeof primaryButtonDisabled === "object" ? primaryButtonDisabled.value : primaryButtonDisabled ?? false;
11
12
  return /* @__PURE__ */ jsxRuntime.jsx("div", {
12
13
  id: "modal",
13
14
  class: "modal-overlay",
@@ -53,7 +54,8 @@ const Modal = qwik.component$(({ title, open, primaryButtonLabel, secondaryButto
53
54
  id: "confirm-button",
54
55
  label: primaryButtonLabel,
55
56
  onClick$: primaryAction,
56
- isLoading
57
+ isLoading,
58
+ disabled: isDisabled
57
59
  })
58
60
  ]
59
61
  })
@@ -4,8 +4,9 @@ import styles from "./styles.css.qwik.mjs";
4
4
  import { Button } from "../button/button.qwik.mjs";
5
5
  import { CloseIcon } from "../icons/closeIcon.qwik.mjs";
6
6
  import "@fontsource/roboto-condensed";
7
- const Modal = component$(({ title, open, primaryButtonLabel, secondaryButtonLabel, primaryAction, secondaryAction, closeButtonVisible = true, isLoading }) => {
7
+ const Modal = component$(({ title, open, primaryButtonLabel, secondaryButtonLabel, primaryAction, secondaryAction, closeButtonVisible = true, isLoading, primaryButtonDisabled }) => {
8
8
  useStylesScoped$(styles);
9
+ const isDisabled = typeof primaryButtonDisabled === "object" ? primaryButtonDisabled.value : primaryButtonDisabled ?? false;
9
10
  return /* @__PURE__ */ jsx("div", {
10
11
  id: "modal",
11
12
  class: "modal-overlay",
@@ -51,7 +52,8 @@ const Modal = component$(({ title, open, primaryButtonLabel, secondaryButtonLabe
51
52
  id: "confirm-button",
52
53
  label: primaryButtonLabel,
53
54
  onClick$: primaryAction,
54
- isLoading
55
+ isLoading,
56
+ disabled: isDisabled
55
57
  })
56
58
  ]
57
59
  })
@@ -8,5 +8,6 @@ export interface InputProps {
8
8
  value: Signal<string>;
9
9
  error?: Signal<string | null>;
10
10
  onValidate$?: QRL<(value: string) => Promise<string>>;
11
+ onInput$?: QRL<() => void>;
11
12
  }
12
13
  export declare const Input: import("@builder.io/qwik").Component<InputProps>;
@@ -9,5 +9,6 @@ export interface ModalProps {
9
9
  primaryAction?: QRL<() => void> | QRL<() => boolean> | QRL<() => Promise<void>> | QRL<(type: string | unknown) => Promise<void>>;
10
10
  secondaryAction?: QRL<() => void> | QRL<() => boolean> | QRL<() => Promise<void>>;
11
11
  isLoading?: Signal<boolean>;
12
+ primaryButtonDisabled?: Signal<boolean>;
12
13
  }
13
14
  export declare const Modal: import("@builder.io/qwik").Component<ModalProps>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@greghowe79/the-lib",
3
- "version": "0.5.1",
3
+ "version": "0.5.3",
4
4
  "description": "Collection of fast components for Qwik",
5
5
  "main": "./lib/index.qwik.mjs",
6
6
  "qwik": "./lib/index.qwik.mjs",