@greghowe79/the-lib 1.0.8 → 1.1.0
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/input/input.qwik.cjs +20 -15
- package/lib/components/input/input.qwik.mjs +20 -15
- package/lib/components/modal/modal.qwik.cjs +2 -2
- package/lib/components/modal/modal.qwik.mjs +2 -2
- package/lib/components/modal/styles.css.qwik.cjs +1 -1
- package/lib/components/modal/styles.css.qwik.mjs +1 -1
- package/lib-types/components/input/input.d.ts +6 -2
- package/lib-types/components/modal/modal.d.ts +1 -0
- package/lib-types/stories/input.stories.d.ts +0 -1
- package/lib-types/stories/modal.stories.d.ts +1 -0
- package/package.json +1 -1
|
@@ -26,7 +26,7 @@ const uploadImage = qwik.$(async (_event, input, currentFile, selectedFile, imag
|
|
|
26
26
|
if (selectedFile) selectedFile.value = file.name;
|
|
27
27
|
}
|
|
28
28
|
});
|
|
29
|
-
const Input = qwik.component$(({ id, type, placeholder, value, error, onValidate$, onInput$, bgLight, currentFile, selectedFile, icon, prefix, required = false,
|
|
29
|
+
const Input = qwik.component$(({ id, type, placeholder, value, error, onValidate$, onInput$, bgLight, currentFile, selectedFile, icon, prefix, required = false, color, nameAttribute, label, selectedValue }) => {
|
|
30
30
|
qwik.useStylesScoped$(styles);
|
|
31
31
|
const internalError = qwik.useSignal(null);
|
|
32
32
|
const showError = error ?? internalError;
|
|
@@ -39,12 +39,6 @@ const Input = qwik.component$(({ id, type, placeholder, value, error, onValidate
|
|
|
39
39
|
return;
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
if (type === "radio") {
|
|
43
|
-
if (value) {
|
|
44
|
-
elem.value = value.value;
|
|
45
|
-
}
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
42
|
if (value) value.value = elem.value;
|
|
49
43
|
if (onInput$) {
|
|
50
44
|
await onInput$();
|
|
@@ -119,14 +113,25 @@ const Input = qwik.component$(({ id, type, placeholder, value, error, onValidate
|
|
|
119
113
|
})
|
|
120
114
|
]
|
|
121
115
|
})
|
|
122
|
-
}) : type === "radio" ? /* @__PURE__ */ jsxRuntime.
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
116
|
+
}) : type === "radio" ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
117
|
+
children: [
|
|
118
|
+
/* @__PURE__ */ jsxRuntime.jsx("input", {
|
|
119
|
+
type: "radio",
|
|
120
|
+
id,
|
|
121
|
+
name: nameAttribute,
|
|
122
|
+
value: color,
|
|
123
|
+
checked: selectedValue?.value === color,
|
|
124
|
+
onChange$: (e) => {
|
|
125
|
+
if (selectedValue) {
|
|
126
|
+
selectedValue.value = e.target.value;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}),
|
|
130
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", {
|
|
131
|
+
for: id,
|
|
132
|
+
children: label
|
|
133
|
+
})
|
|
134
|
+
]
|
|
130
135
|
}) : /* @__PURE__ */ jsxRuntime.jsx("label", {
|
|
131
136
|
class: `input-label ${bgLight ? "bg_light" : ""}`,
|
|
132
137
|
children: /* @__PURE__ */ jsxRuntime.jsxs("div", {
|
|
@@ -24,7 +24,7 @@ const uploadImage = $(async (_event, input, currentFile, selectedFile, imageUrl)
|
|
|
24
24
|
if (selectedFile) selectedFile.value = file.name;
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
|
-
const Input = component$(({ id, type, placeholder, value, error, onValidate$, onInput$, bgLight, currentFile, selectedFile, icon, prefix, required = false,
|
|
27
|
+
const Input = component$(({ id, type, placeholder, value, error, onValidate$, onInput$, bgLight, currentFile, selectedFile, icon, prefix, required = false, color, nameAttribute, label, selectedValue }) => {
|
|
28
28
|
useStylesScoped$(styles);
|
|
29
29
|
const internalError = useSignal(null);
|
|
30
30
|
const showError = error ?? internalError;
|
|
@@ -37,12 +37,6 @@ const Input = component$(({ id, type, placeholder, value, error, onValidate$, on
|
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
if (type === "radio") {
|
|
41
|
-
if (value) {
|
|
42
|
-
elem.value = value.value;
|
|
43
|
-
}
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
40
|
if (value) value.value = elem.value;
|
|
47
41
|
if (onInput$) {
|
|
48
42
|
await onInput$();
|
|
@@ -117,14 +111,25 @@ const Input = component$(({ id, type, placeholder, value, error, onValidate$, on
|
|
|
117
111
|
})
|
|
118
112
|
]
|
|
119
113
|
})
|
|
120
|
-
}) : type === "radio" ? /* @__PURE__ */
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
114
|
+
}) : type === "radio" ? /* @__PURE__ */ jsxs(Fragment, {
|
|
115
|
+
children: [
|
|
116
|
+
/* @__PURE__ */ jsx("input", {
|
|
117
|
+
type: "radio",
|
|
118
|
+
id,
|
|
119
|
+
name: nameAttribute,
|
|
120
|
+
value: color,
|
|
121
|
+
checked: selectedValue?.value === color,
|
|
122
|
+
onChange$: (e) => {
|
|
123
|
+
if (selectedValue) {
|
|
124
|
+
selectedValue.value = e.target.value;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}),
|
|
128
|
+
/* @__PURE__ */ jsx("label", {
|
|
129
|
+
for: id,
|
|
130
|
+
children: label
|
|
131
|
+
})
|
|
132
|
+
]
|
|
128
133
|
}) : /* @__PURE__ */ jsx("label", {
|
|
129
134
|
class: `input-label ${bgLight ? "bg_light" : ""}`,
|
|
130
135
|
children: /* @__PURE__ */ jsxs("div", {
|
|
@@ -6,13 +6,13 @@ 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, primaryButtonDisabled, type = "default" }) => {
|
|
9
|
+
const Modal = qwik.component$(({ title, open, primaryButtonLabel, secondaryButtonLabel, primaryAction, secondaryAction, closeButtonVisible = true, isLoading, primaryButtonDisabled, type = "default", light = false }) => {
|
|
10
10
|
qwik.useStylesScoped$(styles);
|
|
11
11
|
const isDisabled = typeof primaryButtonDisabled === "object" ? primaryButtonDisabled.value : primaryButtonDisabled ?? false;
|
|
12
12
|
const modalClass = type === "small" ? "modal small" : "modal";
|
|
13
13
|
return /* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
14
14
|
id: "modal",
|
|
15
|
-
class: "modal-overlay",
|
|
15
|
+
class: light ? "light-overlay" : "modal-overlay",
|
|
16
16
|
"aria-hidden": !open?.value,
|
|
17
17
|
role: "dialog",
|
|
18
18
|
"aria-modal": "true",
|
|
@@ -4,13 +4,13 @@ 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, primaryButtonDisabled, type = "default" }) => {
|
|
7
|
+
const Modal = component$(({ title, open, primaryButtonLabel, secondaryButtonLabel, primaryAction, secondaryAction, closeButtonVisible = true, isLoading, primaryButtonDisabled, type = "default", light = false }) => {
|
|
8
8
|
useStylesScoped$(styles);
|
|
9
9
|
const isDisabled = typeof primaryButtonDisabled === "object" ? primaryButtonDisabled.value : primaryButtonDisabled ?? false;
|
|
10
10
|
const modalClass = type === "small" ? "modal small" : "modal";
|
|
11
11
|
return /* @__PURE__ */ jsx("div", {
|
|
12
12
|
id: "modal",
|
|
13
|
-
class: "modal-overlay",
|
|
13
|
+
class: light ? "light-overlay" : "modal-overlay",
|
|
14
14
|
"aria-hidden": !open?.value,
|
|
15
15
|
role: "dialog",
|
|
16
16
|
"aria-modal": "true",
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const styles = "
|
|
2
|
+
const styles = ".modal-overlay {\r\n position: fixed;\r\n top: 0;\r\n left: 0;\r\n right: 0;\r\n bottom: 0;\r\n background-color: rgba(0, 0, 0, 0.5);\r\n display: flex;\r\n justify-content: center;\r\n align-items: center;\r\n z-index: 1000;\r\n}\r\n.light-overlay {\r\n position: fixed;\r\n top: 0;\r\n left: 0;\r\n right: 0;\r\n bottom: 0;\r\n background-color: rgba(0, 0, 0, 0);\r\n display: flex;\r\n justify-content: center;\r\n align-items: center;\r\n z-index: 1000;\r\n}\r\n\r\n.modal {\r\n background: white;\r\n border-radius: 8px;\r\n width: 90%;\r\n max-width: 800px;\r\n box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);\r\n outline: none;\r\n font-family: 'Roboto Condensed', sans-serif;\r\n color: #333;\r\n}\r\n\r\n.modal-header {\r\n padding: 16px 24px;\r\n border-bottom: 1px solid #e0e0e0;\r\n display: flex;\r\n justify-content: space-between;\r\n align-items: center;\r\n}\r\n\r\n.modal-header h2 {\r\n margin: 0;\r\n font-size: 1.25rem;\r\n}\r\n\r\n.modal-body {\r\n padding: 24px;\r\n max-height: 60vh;\r\n overflow-y: auto;\r\n font-weight: 400;\r\n}\r\n\r\n.modal-footer {\r\n padding: 16px 24px;\r\n /* border-top: 1px solid #e0e0e0; */\r\n display: flex;\r\n justify-content: flex-end;\r\n gap: 12px;\r\n}\r\n\r\n/* Stili per la versione small */\r\n.modal.small {\r\n max-width: 500px;\r\n}\r\n\r\n.modal.small .modal-header {\r\n justify-content: center;\r\n position: relative; /* Per posizionare eventuale bottone chiusura */\r\n}\r\n\r\n.modal.small .modal-header h2 {\r\n text-align: center;\r\n}\r\n\r\n/* Se vuoi mantenere il bottone chiusura a destra */\r\n.modal.small .modal-header .close-button {\r\n position: absolute;\r\n right: 16px;\r\n}\r\n\r\n.modal.small .modal-body {\r\n display: flex;\r\n justify-content: center;\r\n align-items: center;\r\n flex-direction: column;\r\n padding: 20px; /* Riduci il padding se necessario */\r\n}\r\n\r\n.modal.small .modal-footer {\r\n justify-content: center;\r\n}\r\n\r\n/* Stili comuni */\r\n.close-button {\r\n background: none;\r\n border: none;\r\n font-size: 1.5rem;\r\n cursor: pointer;\r\n padding: 4px;\r\n}\r\n\r\n[aria-hidden='true'] {\r\n display: none;\r\n}\r\n\r\nbutton:focus-visible,\r\n[tabindex='0']:focus-visible {\r\n outline: 2px solid #005fcc;\r\n outline-offset: 2px;\r\n}\r\n";
|
|
3
3
|
module.exports = styles;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const styles = "
|
|
1
|
+
const styles = ".modal-overlay {\r\n position: fixed;\r\n top: 0;\r\n left: 0;\r\n right: 0;\r\n bottom: 0;\r\n background-color: rgba(0, 0, 0, 0.5);\r\n display: flex;\r\n justify-content: center;\r\n align-items: center;\r\n z-index: 1000;\r\n}\r\n.light-overlay {\r\n position: fixed;\r\n top: 0;\r\n left: 0;\r\n right: 0;\r\n bottom: 0;\r\n background-color: rgba(0, 0, 0, 0);\r\n display: flex;\r\n justify-content: center;\r\n align-items: center;\r\n z-index: 1000;\r\n}\r\n\r\n.modal {\r\n background: white;\r\n border-radius: 8px;\r\n width: 90%;\r\n max-width: 800px;\r\n box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);\r\n outline: none;\r\n font-family: 'Roboto Condensed', sans-serif;\r\n color: #333;\r\n}\r\n\r\n.modal-header {\r\n padding: 16px 24px;\r\n border-bottom: 1px solid #e0e0e0;\r\n display: flex;\r\n justify-content: space-between;\r\n align-items: center;\r\n}\r\n\r\n.modal-header h2 {\r\n margin: 0;\r\n font-size: 1.25rem;\r\n}\r\n\r\n.modal-body {\r\n padding: 24px;\r\n max-height: 60vh;\r\n overflow-y: auto;\r\n font-weight: 400;\r\n}\r\n\r\n.modal-footer {\r\n padding: 16px 24px;\r\n /* border-top: 1px solid #e0e0e0; */\r\n display: flex;\r\n justify-content: flex-end;\r\n gap: 12px;\r\n}\r\n\r\n/* Stili per la versione small */\r\n.modal.small {\r\n max-width: 500px;\r\n}\r\n\r\n.modal.small .modal-header {\r\n justify-content: center;\r\n position: relative; /* Per posizionare eventuale bottone chiusura */\r\n}\r\n\r\n.modal.small .modal-header h2 {\r\n text-align: center;\r\n}\r\n\r\n/* Se vuoi mantenere il bottone chiusura a destra */\r\n.modal.small .modal-header .close-button {\r\n position: absolute;\r\n right: 16px;\r\n}\r\n\r\n.modal.small .modal-body {\r\n display: flex;\r\n justify-content: center;\r\n align-items: center;\r\n flex-direction: column;\r\n padding: 20px; /* Riduci il padding se necessario */\r\n}\r\n\r\n.modal.small .modal-footer {\r\n justify-content: center;\r\n}\r\n\r\n/* Stili comuni */\r\n.close-button {\r\n background: none;\r\n border: none;\r\n font-size: 1.5rem;\r\n cursor: pointer;\r\n padding: 4px;\r\n}\r\n\r\n[aria-hidden='true'] {\r\n display: none;\r\n}\r\n\r\nbutton:focus-visible,\r\n[tabindex='0']:focus-visible {\r\n outline: 2px solid #005fcc;\r\n outline-offset: 2px;\r\n}\r\n";
|
|
2
2
|
export {
|
|
3
3
|
styles as default
|
|
4
4
|
};
|
|
@@ -5,7 +5,6 @@ export interface InputProps {
|
|
|
5
5
|
id: string;
|
|
6
6
|
type: InputType;
|
|
7
7
|
placeholder?: string;
|
|
8
|
-
name?: string;
|
|
9
8
|
value?: Signal<string>;
|
|
10
9
|
error?: Signal<string | null>;
|
|
11
10
|
onValidate$?: QRL<(value: string) => Promise<string>>;
|
|
@@ -16,7 +15,12 @@ export interface InputProps {
|
|
|
16
15
|
icon?: JSXOutput | Component<unknown>;
|
|
17
16
|
prefix?: string;
|
|
18
17
|
required?: boolean;
|
|
19
|
-
|
|
18
|
+
onChange?: QRL<(_: Event, el: HTMLInputElement) => Promise<void>>;
|
|
19
|
+
checked?: boolean;
|
|
20
|
+
color?: string;
|
|
21
|
+
nameAttribute?: string;
|
|
22
|
+
label?: string;
|
|
23
|
+
selectedValue?: Signal<string>;
|
|
20
24
|
}
|
|
21
25
|
export declare const displayLocalImage: QRL<(file: File, imageUrl?: Signal<string>) => void>;
|
|
22
26
|
export declare const uploadImage: QRL<(_event: Event, input: HTMLInputElement, currentFile?: Signal<any>, selectedFile?: Signal<string>, imageUrl?: Signal<string>) => Promise<void>>;
|