@nr1e/qwik-ui 2.0.20 → 2.0.21
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/processing-button.qwik.cjs +3 -17
- package/lib/components/processing-button.qwik.mjs +4 -18
- package/lib-types/components/processing-button.d.ts +1 -2
- package/lib-types/components/refresh-button.d.ts +3 -3
- package/lib-types/components/submit-button.d.ts +2 -2
- package/package.json +1 -1
|
@@ -5,26 +5,12 @@ const qwik = require("@builder.io/qwik");
|
|
|
5
5
|
const qwikIcons = require("@nr1e/qwik-icons");
|
|
6
6
|
const button = require("./button.qwik.cjs");
|
|
7
7
|
const ProcessingButton = qwik.component$((props) => {
|
|
8
|
-
const internalProcessing = qwik.useSignal(qwik.isSignal(props.processing) ? props.processing.value : props.processing ?? false);
|
|
9
|
-
const processing = qwik.isSignal(props.processing) ? props.processing : internalProcessing;
|
|
10
|
-
const onClick$ = props.onClick$;
|
|
11
8
|
return /* @__PURE__ */ jsxRuntime.jsx(button.Button, {
|
|
12
9
|
...props,
|
|
13
10
|
class: `${props.processing || props.disabled ? "disabled" : ""} ${props.class ?? ""}`,
|
|
14
|
-
disabled: processing
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
if (onClick$) {
|
|
18
|
-
const result = onClick$(e);
|
|
19
|
-
if (result instanceof Promise) {
|
|
20
|
-
result.finally(() => {
|
|
21
|
-
processing.value = false;
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
icon: processing.value ? qwikIcons.SpinnersBarsFade : props.icon,
|
|
27
|
-
iconClass: processing.value ? "animate-spin" : props.iconClass,
|
|
11
|
+
disabled: props.processing || props.disabled,
|
|
12
|
+
icon: props.processing ? qwikIcons.SpinnersBarsFade : props.icon,
|
|
13
|
+
iconClass: props.processing ? "animate-spin" : props.iconClass,
|
|
28
14
|
children: /* @__PURE__ */ jsxRuntime.jsx(qwik.Slot, {})
|
|
29
15
|
});
|
|
30
16
|
});
|
|
@@ -1,28 +1,14 @@
|
|
|
1
1
|
import { jsx } from "@builder.io/qwik/jsx-runtime";
|
|
2
|
-
import { component$,
|
|
2
|
+
import { component$, Slot } from "@builder.io/qwik";
|
|
3
3
|
import { SpinnersBarsFade } from "@nr1e/qwik-icons";
|
|
4
4
|
import { Button } from "./button.qwik.mjs";
|
|
5
5
|
const ProcessingButton = component$((props) => {
|
|
6
|
-
const internalProcessing = useSignal(isSignal(props.processing) ? props.processing.value : props.processing ?? false);
|
|
7
|
-
const processing = isSignal(props.processing) ? props.processing : internalProcessing;
|
|
8
|
-
const onClick$ = props.onClick$;
|
|
9
6
|
return /* @__PURE__ */ jsx(Button, {
|
|
10
7
|
...props,
|
|
11
8
|
class: `${props.processing || props.disabled ? "disabled" : ""} ${props.class ?? ""}`,
|
|
12
|
-
disabled: processing
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
if (onClick$) {
|
|
16
|
-
const result = onClick$(e);
|
|
17
|
-
if (result instanceof Promise) {
|
|
18
|
-
result.finally(() => {
|
|
19
|
-
processing.value = false;
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
icon: processing.value ? SpinnersBarsFade : props.icon,
|
|
25
|
-
iconClass: processing.value ? "animate-spin" : props.iconClass,
|
|
9
|
+
disabled: props.processing || props.disabled,
|
|
10
|
+
icon: props.processing ? SpinnersBarsFade : props.icon,
|
|
11
|
+
iconClass: props.processing ? "animate-spin" : props.iconClass,
|
|
26
12
|
children: /* @__PURE__ */ jsx(Slot, {})
|
|
27
13
|
});
|
|
28
14
|
});
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Signal } from '@builder.io/qwik';
|
|
2
1
|
import { ButtonProps } from './button';
|
|
3
2
|
/**
|
|
4
3
|
* Props for the ProcessingButton component. This class will replace the icon
|
|
@@ -8,7 +7,7 @@ export interface ProcessingButtonProps extends ButtonProps {
|
|
|
8
7
|
/**
|
|
9
8
|
* Whether the button is processing.
|
|
10
9
|
*/
|
|
11
|
-
processing?: boolean
|
|
10
|
+
processing?: boolean;
|
|
12
11
|
}
|
|
13
12
|
/**
|
|
14
13
|
* ProcessingButton component.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { QRL
|
|
1
|
+
import { QRL } from '@builder.io/qwik';
|
|
2
2
|
export interface RefreshButtonProps {
|
|
3
3
|
/**
|
|
4
4
|
* ID of the button.
|
|
@@ -11,7 +11,7 @@ export interface RefreshButtonProps {
|
|
|
11
11
|
/**
|
|
12
12
|
* Callback function to be called when the button is clicked.
|
|
13
13
|
*/
|
|
14
|
-
onClick$?: QRL<(event: Event) => void
|
|
14
|
+
onClick$?: QRL<(event: Event) => void>;
|
|
15
15
|
/**
|
|
16
16
|
* Whether the button is disabled.
|
|
17
17
|
*/
|
|
@@ -27,7 +27,7 @@ export interface RefreshButtonProps {
|
|
|
27
27
|
/**
|
|
28
28
|
* Whether the button is processing.
|
|
29
29
|
*/
|
|
30
|
-
refreshing?: boolean
|
|
30
|
+
refreshing?: boolean;
|
|
31
31
|
/**
|
|
32
32
|
* Size of the icon in pixels if icon is provided in the props. Default is 18.
|
|
33
33
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { QRL
|
|
1
|
+
import { QRL } from '@builder.io/qwik';
|
|
2
2
|
export interface SubmitButtonProps {
|
|
3
3
|
/**
|
|
4
4
|
* ID of the button.
|
|
@@ -23,6 +23,6 @@ export interface SubmitButtonProps {
|
|
|
23
23
|
/**
|
|
24
24
|
* Whether the button is processing.
|
|
25
25
|
*/
|
|
26
|
-
submitting?: boolean
|
|
26
|
+
submitting?: boolean;
|
|
27
27
|
}
|
|
28
28
|
export declare const SubmitButton: import("@builder.io/qwik").Component<SubmitButtonProps>;
|