@nr1e/qwik-ui 2.0.19 → 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 -28
- package/lib/components/processing-button.qwik.mjs +4 -29
- package/lib-types/components/button.d.ts +1 -1
- package/lib-types/components/processing-button.d.ts +2 -5
- package/lib-types/components/refresh-button.d.ts +2 -2
- package/lib-types/components/submit-button.d.ts +2 -2
- package/package.json +1 -1
|
@@ -5,37 +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 externalProcessing = qwik.isSignal(props.processing) ? props.processing : void 0;
|
|
9
|
-
const internalProcessing = qwik.useSignal(qwik.isSignal(props.processing) ? props.processing.value : props.processing ?? false);
|
|
10
|
-
const onClick$ = props.onClick$;
|
|
11
|
-
qwik.useTask$(({ track }) => {
|
|
12
|
-
if (externalProcessing) {
|
|
13
|
-
track(() => externalProcessing.value);
|
|
14
|
-
if (externalProcessing.value !== internalProcessing.value) {
|
|
15
|
-
internalProcessing.value = externalProcessing.value;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
qwik.useTask$(({ track }) => {
|
|
20
|
-
if (externalProcessing) {
|
|
21
|
-
track(() => internalProcessing.value);
|
|
22
|
-
if (externalProcessing.value !== internalProcessing.value) {
|
|
23
|
-
externalProcessing.value = internalProcessing.value;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
8
|
return /* @__PURE__ */ jsxRuntime.jsx(button.Button, {
|
|
28
9
|
...props,
|
|
29
10
|
class: `${props.processing || props.disabled ? "disabled" : ""} ${props.class ?? ""}`,
|
|
30
|
-
disabled:
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
if (onClick$) {
|
|
34
|
-
onClick$(e);
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
icon: internalProcessing.value ? qwikIcons.SpinnersBarsFade : props.icon,
|
|
38
|
-
iconClass: internalProcessing.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,
|
|
39
14
|
children: /* @__PURE__ */ jsxRuntime.jsx(qwik.Slot, {})
|
|
40
15
|
});
|
|
41
16
|
});
|
|
@@ -1,39 +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 externalProcessing = isSignal(props.processing) ? props.processing : void 0;
|
|
7
|
-
const internalProcessing = useSignal(isSignal(props.processing) ? props.processing.value : props.processing ?? false);
|
|
8
|
-
const onClick$ = props.onClick$;
|
|
9
|
-
useTask$(({ track }) => {
|
|
10
|
-
if (externalProcessing) {
|
|
11
|
-
track(() => externalProcessing.value);
|
|
12
|
-
if (externalProcessing.value !== internalProcessing.value) {
|
|
13
|
-
internalProcessing.value = externalProcessing.value;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
useTask$(({ track }) => {
|
|
18
|
-
if (externalProcessing) {
|
|
19
|
-
track(() => internalProcessing.value);
|
|
20
|
-
if (externalProcessing.value !== internalProcessing.value) {
|
|
21
|
-
externalProcessing.value = internalProcessing.value;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
6
|
return /* @__PURE__ */ jsx(Button, {
|
|
26
7
|
...props,
|
|
27
8
|
class: `${props.processing || props.disabled ? "disabled" : ""} ${props.class ?? ""}`,
|
|
28
|
-
disabled:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
if (onClick$) {
|
|
32
|
-
onClick$(e);
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
icon: internalProcessing.value ? SpinnersBarsFade : props.icon,
|
|
36
|
-
iconClass: internalProcessing.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,
|
|
37
12
|
children: /* @__PURE__ */ jsx(Slot, {})
|
|
38
13
|
});
|
|
39
14
|
});
|
|
@@ -1,16 +1,13 @@
|
|
|
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
|
|
5
|
-
* with a rotating spinner when
|
|
6
|
-
* automatically set processing to true when the button is clicked. It does
|
|
7
|
-
* not set processing to false when the button is clicked.
|
|
4
|
+
* with a rotating spinner when clicked.
|
|
8
5
|
*/
|
|
9
6
|
export interface ProcessingButtonProps extends ButtonProps {
|
|
10
7
|
/**
|
|
11
8
|
* Whether the button is processing.
|
|
12
9
|
*/
|
|
13
|
-
processing?: boolean
|
|
10
|
+
processing?: boolean;
|
|
14
11
|
}
|
|
15
12
|
/**
|
|
16
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.
|
|
@@ -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>;
|