sspart-fe-lib 1.0.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/dist/components/alerts.d.ts +9 -0
- package/dist/components/alerts.js +53 -0
- package/dist/components/are-you-sure-model.d.ts +9 -0
- package/dist/components/are-you-sure-model.js +111 -0
- package/dist/components/button.d.ts +16 -0
- package/dist/components/button.js +69 -0
- package/dist/components/checkbox.d.ts +15 -0
- package/dist/components/checkbox.js +30 -0
- package/dist/components/cookie-consent.d.ts +9 -0
- package/dist/components/cookie-consent.js +94 -0
- package/dist/components/currency-textbox.d.ts +23 -0
- package/dist/components/currency-textbox.js +146 -0
- package/dist/components/dropdown-multi.d.ts +23 -0
- package/dist/components/dropdown-multi.js +116 -0
- package/dist/components/dropdown.d.ts +23 -0
- package/dist/components/dropdown.js +106 -0
- package/dist/components/empty-list.d.ts +10 -0
- package/dist/components/empty-list.js +40 -0
- package/dist/components/hide-on-scroll.d.ts +8 -0
- package/dist/components/hide-on-scroll.js +34 -0
- package/dist/components/info-alerts.d.ts +14 -0
- package/dist/components/info-alerts.js +15 -0
- package/dist/components/link-button.d.ts +14 -0
- package/dist/components/link-button.js +56 -0
- package/dist/components/loading.d.ts +8 -0
- package/dist/components/loading.js +29 -0
- package/dist/components/market-textbox.d.ts +23 -0
- package/dist/components/market-textbox.js +231 -0
- package/dist/components/page-spinner.d.ts +5 -0
- package/dist/components/page-spinner.js +36 -0
- package/dist/components/password-textbox.d.ts +16 -0
- package/dist/components/password-textbox.js +125 -0
- package/dist/components/radio-group.d.ts +21 -0
- package/dist/components/radio-group.js +45 -0
- package/dist/components/resize-element.d.ts +10 -0
- package/dist/components/resize-element.js +21 -0
- package/dist/components/small-dropdown.d.ts +14 -0
- package/dist/components/small-dropdown.js +28 -0
- package/dist/components/snackbar.d.ts +7 -0
- package/dist/components/snackbar.js +42 -0
- package/dist/components/switch.d.ts +10 -0
- package/dist/components/switch.js +23 -0
- package/dist/components/tab.d.ts +10 -0
- package/dist/components/tab.js +22 -0
- package/dist/components/tabs.d.ts +14 -0
- package/dist/components/tabs.js +74 -0
- package/dist/components/textbox-autocomplete.d.ts +26 -0
- package/dist/components/textbox-autocomplete.js +104 -0
- package/dist/components/textbox.d.ts +22 -0
- package/dist/components/textbox.js +124 -0
- package/dist/components/toggle.d.ts +18 -0
- package/dist/components/toggle.js +42 -0
- package/dist/components/tooltip.d.ts +9 -0
- package/dist/components/tooltip.js +43 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.js +176 -0
- package/package.json +150 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// src/components/alerts.tsx
|
|
2
|
+
import { useEffect, useState, useCallback } from "react";
|
|
3
|
+
import Collapse from "@mui/material/Collapse";
|
|
4
|
+
import Stack from "@mui/material/Stack";
|
|
5
|
+
import Alert from "@mui/material/Alert";
|
|
6
|
+
import { NOTIFICATION_SERVICES, ns } from "sspart-common-lib";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
var Alerts = ({ id, className }) => {
|
|
9
|
+
const [alertState, setAlertState] = useState({
|
|
10
|
+
open: false,
|
|
11
|
+
alertType: "info",
|
|
12
|
+
alertText: ""
|
|
13
|
+
});
|
|
14
|
+
const onClose = useCallback(() => {
|
|
15
|
+
setAlertState((prevState) => ({ ...prevState, open: false }));
|
|
16
|
+
}, []);
|
|
17
|
+
const renderAlertMessages = useCallback(() => {
|
|
18
|
+
const { alertText } = alertState;
|
|
19
|
+
if (!alertText) return null;
|
|
20
|
+
return Array.isArray(alertText) ? /* @__PURE__ */ jsx("div", { children: alertText.map((alert, index) => /* @__PURE__ */ jsx("li", { children: alert }, `${alertState.alertType}-${index}`)) }) : /* @__PURE__ */ jsx("div", { children: alertText });
|
|
21
|
+
}, [alertState]);
|
|
22
|
+
const showAlert = useCallback(
|
|
23
|
+
(alertData) => {
|
|
24
|
+
if (id) {
|
|
25
|
+
if ((alertData.id === void 0 || alertData.id === id) && alertData.alert) {
|
|
26
|
+
setAlertState({
|
|
27
|
+
open: true,
|
|
28
|
+
alertType: alertData.alert?.alertType ?? "info",
|
|
29
|
+
alertText: alertData.alert?.alertText ?? ""
|
|
30
|
+
});
|
|
31
|
+
} else if (alertData.id === id && !alertData.alert) {
|
|
32
|
+
onClose();
|
|
33
|
+
}
|
|
34
|
+
} else {
|
|
35
|
+
if (!alertData.alert) {
|
|
36
|
+
onClose();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
[id, onClose]
|
|
41
|
+
);
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
ns.addObserver(NOTIFICATION_SERVICES.DISPLAY_ALERT, id, showAlert);
|
|
44
|
+
return () => {
|
|
45
|
+
ns.removeObserver(id, NOTIFICATION_SERVICES.DISPLAY_ALERT);
|
|
46
|
+
};
|
|
47
|
+
}, [id, showAlert]);
|
|
48
|
+
return /* @__PURE__ */ jsx("div", { className, children: /* @__PURE__ */ jsx(Collapse, { in: alertState.open, children: /* @__PURE__ */ jsx(Stack, { sx: { width: "100%" }, spacing: 2, children: /* @__PURE__ */ jsx(Alert, { severity: alertState.alertType, onClose, children: renderAlertMessages() }) }) }) });
|
|
49
|
+
};
|
|
50
|
+
var alerts_default = Alerts;
|
|
51
|
+
export {
|
|
52
|
+
alerts_default as default
|
|
53
|
+
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
// src/components/are-you-sure-model.tsx
|
|
2
|
+
import { useState, useEffect, useCallback as useCallback2 } from "react";
|
|
3
|
+
|
|
4
|
+
// #style-inject:#style-inject
|
|
5
|
+
function styleInject(css, { insertAt } = {}) {
|
|
6
|
+
if (!css || typeof document === "undefined") return;
|
|
7
|
+
const head = document.head || document.getElementsByTagName("head")[0];
|
|
8
|
+
const style = document.createElement("style");
|
|
9
|
+
style.type = "text/css";
|
|
10
|
+
if (insertAt === "top") {
|
|
11
|
+
if (head.firstChild) {
|
|
12
|
+
head.insertBefore(style, head.firstChild);
|
|
13
|
+
} else {
|
|
14
|
+
head.appendChild(style);
|
|
15
|
+
}
|
|
16
|
+
} else {
|
|
17
|
+
head.appendChild(style);
|
|
18
|
+
}
|
|
19
|
+
if (style.styleSheet) {
|
|
20
|
+
style.styleSheet.cssText = css;
|
|
21
|
+
} else {
|
|
22
|
+
style.appendChild(document.createTextNode(css));
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// src/components/css/button.css
|
|
27
|
+
styleInject(".btn-p {\n white-space: nowrap;\n width: 100%;\n font-weight: 600 !important;\n background: var(--primary-color) !important;\n color: var(--neutral-color);\n}\n.btn-p:hover {\n background: var(--primary-color-hover) !important;\n}\n.btn-p:disabled {\n background: var(--disabled-color) !important;\n}\n.btn-p.MuiButton-outlined {\n color: var(--primary-color);\n border-color: var(--primary-color) !important;\n background: var(--background-color) !important;\n}\n.btn-p.MuiButton-outlined:hover {\n color: var(--primary-color-hover);\n border-color: var(--primary-color-hover) !important;\n}\n.btn-p.MuiButton-text {\n color: var(--primary-color);\n border-color: var(--background-color) !important;\n background: var(--background-color) !important;\n}\n.btn-p.MuiButton-text:hover {\n color: var(--primary-color-hover) !important;\n}\n");
|
|
28
|
+
|
|
29
|
+
// src/components/button.tsx
|
|
30
|
+
import Button from "@mui/material/Button";
|
|
31
|
+
import { useCallback, useMemo } from "react";
|
|
32
|
+
import { jsx } from "react/jsx-runtime";
|
|
33
|
+
var ButtonComponent = ({
|
|
34
|
+
id,
|
|
35
|
+
name,
|
|
36
|
+
text,
|
|
37
|
+
className = "",
|
|
38
|
+
variant = "contained",
|
|
39
|
+
disabled = false,
|
|
40
|
+
type = "button",
|
|
41
|
+
onClick,
|
|
42
|
+
...otherProps
|
|
43
|
+
}) => {
|
|
44
|
+
const combinedClassName = useMemo(() => `btn-p noselect ${className || ""}`, [className]);
|
|
45
|
+
const handleClick = useCallback(
|
|
46
|
+
(event) => {
|
|
47
|
+
if (onClick) onClick(name);
|
|
48
|
+
},
|
|
49
|
+
[name, onClick]
|
|
50
|
+
);
|
|
51
|
+
return /* @__PURE__ */ jsx(
|
|
52
|
+
Button,
|
|
53
|
+
{
|
|
54
|
+
id,
|
|
55
|
+
name,
|
|
56
|
+
variant,
|
|
57
|
+
type,
|
|
58
|
+
fullWidth: true,
|
|
59
|
+
disableElevation: true,
|
|
60
|
+
disabled,
|
|
61
|
+
className: combinedClassName,
|
|
62
|
+
onClick: handleClick,
|
|
63
|
+
...otherProps,
|
|
64
|
+
sx: { boxShadow: 0 },
|
|
65
|
+
children: text
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
};
|
|
69
|
+
var button_default = ButtonComponent;
|
|
70
|
+
|
|
71
|
+
// src/components/are-you-sure-model.tsx
|
|
72
|
+
import Dialog from "@mui/material/Dialog";
|
|
73
|
+
import Grid from "@mui/material/Grid";
|
|
74
|
+
import Typography from "@mui/material/Typography";
|
|
75
|
+
import { NOTIFICATION_SERVICES, ns } from "sspart-common-lib";
|
|
76
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
77
|
+
var AreYouSureModal = ({ text, callback }) => {
|
|
78
|
+
const [show, setShow] = useState(false);
|
|
79
|
+
const [data, setData] = useState([]);
|
|
80
|
+
const openModal = useCallback2((modalData) => {
|
|
81
|
+
setShow(true);
|
|
82
|
+
setData(modalData);
|
|
83
|
+
}, []);
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
ns.addObserver(NOTIFICATION_SERVICES.CONFIRM_ACTION_MODAL, null, openModal);
|
|
86
|
+
return () => {
|
|
87
|
+
ns.removeObserver(null, NOTIFICATION_SERVICES.CONFIRM_ACTION_MODAL);
|
|
88
|
+
};
|
|
89
|
+
}, [openModal]);
|
|
90
|
+
const handleClose = () => {
|
|
91
|
+
setShow(false);
|
|
92
|
+
};
|
|
93
|
+
const onSureModal = async () => {
|
|
94
|
+
setShow(false);
|
|
95
|
+
await callback(data);
|
|
96
|
+
};
|
|
97
|
+
return /* @__PURE__ */ jsx2(Dialog, { open: show, onClose: handleClose, fullWidth: true, maxWidth: "xs", children: /* @__PURE__ */ jsxs("div", { className: "modal-content", children: [
|
|
98
|
+
/* @__PURE__ */ jsx2("div", { className: "cloud-modal-header", children: /* @__PURE__ */ jsx2(Typography, { variant: "subtitle2", noWrap: true, children: "Are you sure?" }) }),
|
|
99
|
+
/* @__PURE__ */ jsxs("div", { className: "modal-body", children: [
|
|
100
|
+
text,
|
|
101
|
+
/* @__PURE__ */ jsxs(Grid, { container: true, spacing: 2, marginTop: 2, children: [
|
|
102
|
+
/* @__PURE__ */ jsx2(Grid, { size: { xs: 6 }, children: /* @__PURE__ */ jsx2(button_default, { name: "Cancel", text: "Cancel", onClick: handleClose }) }),
|
|
103
|
+
/* @__PURE__ */ jsx2(Grid, { size: { xs: 6 }, children: /* @__PURE__ */ jsx2(button_default, { name: "Confirm", text: "Confirm", onClick: onSureModal }) })
|
|
104
|
+
] })
|
|
105
|
+
] })
|
|
106
|
+
] }) });
|
|
107
|
+
};
|
|
108
|
+
var are_you_sure_model_default = AreYouSureModal;
|
|
109
|
+
export {
|
|
110
|
+
are_you_sure_model_default as default
|
|
111
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
|
|
3
|
+
interface ButtonComponentProps {
|
|
4
|
+
id?: string;
|
|
5
|
+
name?: string;
|
|
6
|
+
text: string;
|
|
7
|
+
className?: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
variant?: "text" | "contained" | "outlined";
|
|
10
|
+
type?: "button" | "submit";
|
|
11
|
+
onClick?: (name?: string) => void;
|
|
12
|
+
[key: string]: any;
|
|
13
|
+
}
|
|
14
|
+
declare const ButtonComponent: FC<ButtonComponentProps>;
|
|
15
|
+
|
|
16
|
+
export { ButtonComponent as default };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// #style-inject:#style-inject
|
|
2
|
+
function styleInject(css, { insertAt } = {}) {
|
|
3
|
+
if (!css || typeof document === "undefined") return;
|
|
4
|
+
const head = document.head || document.getElementsByTagName("head")[0];
|
|
5
|
+
const style = document.createElement("style");
|
|
6
|
+
style.type = "text/css";
|
|
7
|
+
if (insertAt === "top") {
|
|
8
|
+
if (head.firstChild) {
|
|
9
|
+
head.insertBefore(style, head.firstChild);
|
|
10
|
+
} else {
|
|
11
|
+
head.appendChild(style);
|
|
12
|
+
}
|
|
13
|
+
} else {
|
|
14
|
+
head.appendChild(style);
|
|
15
|
+
}
|
|
16
|
+
if (style.styleSheet) {
|
|
17
|
+
style.styleSheet.cssText = css;
|
|
18
|
+
} else {
|
|
19
|
+
style.appendChild(document.createTextNode(css));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// src/components/css/button.css
|
|
24
|
+
styleInject(".btn-p {\n white-space: nowrap;\n width: 100%;\n font-weight: 600 !important;\n background: var(--primary-color) !important;\n color: var(--neutral-color);\n}\n.btn-p:hover {\n background: var(--primary-color-hover) !important;\n}\n.btn-p:disabled {\n background: var(--disabled-color) !important;\n}\n.btn-p.MuiButton-outlined {\n color: var(--primary-color);\n border-color: var(--primary-color) !important;\n background: var(--background-color) !important;\n}\n.btn-p.MuiButton-outlined:hover {\n color: var(--primary-color-hover);\n border-color: var(--primary-color-hover) !important;\n}\n.btn-p.MuiButton-text {\n color: var(--primary-color);\n border-color: var(--background-color) !important;\n background: var(--background-color) !important;\n}\n.btn-p.MuiButton-text:hover {\n color: var(--primary-color-hover) !important;\n}\n");
|
|
25
|
+
|
|
26
|
+
// src/components/button.tsx
|
|
27
|
+
import Button from "@mui/material/Button";
|
|
28
|
+
import { useCallback, useMemo } from "react";
|
|
29
|
+
import { jsx } from "react/jsx-runtime";
|
|
30
|
+
var ButtonComponent = ({
|
|
31
|
+
id,
|
|
32
|
+
name,
|
|
33
|
+
text,
|
|
34
|
+
className = "",
|
|
35
|
+
variant = "contained",
|
|
36
|
+
disabled = false,
|
|
37
|
+
type = "button",
|
|
38
|
+
onClick,
|
|
39
|
+
...otherProps
|
|
40
|
+
}) => {
|
|
41
|
+
const combinedClassName = useMemo(() => `btn-p noselect ${className || ""}`, [className]);
|
|
42
|
+
const handleClick = useCallback(
|
|
43
|
+
(event) => {
|
|
44
|
+
if (onClick) onClick(name);
|
|
45
|
+
},
|
|
46
|
+
[name, onClick]
|
|
47
|
+
);
|
|
48
|
+
return /* @__PURE__ */ jsx(
|
|
49
|
+
Button,
|
|
50
|
+
{
|
|
51
|
+
id,
|
|
52
|
+
name,
|
|
53
|
+
variant,
|
|
54
|
+
type,
|
|
55
|
+
fullWidth: true,
|
|
56
|
+
disableElevation: true,
|
|
57
|
+
disabled,
|
|
58
|
+
className: combinedClassName,
|
|
59
|
+
onClick: handleClick,
|
|
60
|
+
...otherProps,
|
|
61
|
+
sx: { boxShadow: 0 },
|
|
62
|
+
children: text
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
};
|
|
66
|
+
var button_default = ButtonComponent;
|
|
67
|
+
export {
|
|
68
|
+
button_default as default
|
|
69
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
|
|
3
|
+
interface CheckboxProps {
|
|
4
|
+
name: string;
|
|
5
|
+
value: boolean;
|
|
6
|
+
onChange: (name: string, value: boolean) => void;
|
|
7
|
+
validation?: string;
|
|
8
|
+
label?: any;
|
|
9
|
+
onlyCheckbox?: boolean;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
indeterminate?: boolean;
|
|
12
|
+
}
|
|
13
|
+
declare const CheckboxComponent: FC<CheckboxProps>;
|
|
14
|
+
|
|
15
|
+
export { CheckboxComponent as default };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// src/components/checkbox.tsx
|
|
2
|
+
import Checkbox from "@mui/material/Checkbox";
|
|
3
|
+
import FormControl from "@mui/material/FormControl";
|
|
4
|
+
import FormControlLabel from "@mui/material/FormControlLabel";
|
|
5
|
+
import FormGroup from "@mui/material/FormGroup";
|
|
6
|
+
import FormHelperText from "@mui/material/FormHelperText";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
var styleData = {
|
|
9
|
+
color: "var(--primary-color)",
|
|
10
|
+
"&.Mui-checked": {
|
|
11
|
+
color: "var(--primary-color)"
|
|
12
|
+
},
|
|
13
|
+
"&.MuiCheckbox-indeterminate": {
|
|
14
|
+
color: "var(--primary-color)"
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
var CheckboxComponent = ({ value, onChange, name, validation, label, onlyCheckbox = false, disabled = false, indeterminate = false }) => {
|
|
18
|
+
const handleToggle = (event) => {
|
|
19
|
+
onChange(name, event.target.checked);
|
|
20
|
+
};
|
|
21
|
+
if (onlyCheckbox) return /* @__PURE__ */ jsx(Checkbox, { sx: styleData, disabled, size: "small", checked: value, onChange: handleToggle, indeterminate });
|
|
22
|
+
return /* @__PURE__ */ jsx(FormGroup, { children: /* @__PURE__ */ jsxs(FormControl, { error: !!validation, children: [
|
|
23
|
+
/* @__PURE__ */ jsx(FormControlLabel, { label, control: /* @__PURE__ */ jsx(Checkbox, { sx: styleData, disabled, size: "small", checked: value, onChange: handleToggle, indeterminate }) }),
|
|
24
|
+
validation && /* @__PURE__ */ jsx(FormHelperText, { children: validation })
|
|
25
|
+
] }) });
|
|
26
|
+
};
|
|
27
|
+
var checkbox_default = CheckboxComponent;
|
|
28
|
+
export {
|
|
29
|
+
checkbox_default as default
|
|
30
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { useNavigate } from 'react-router-dom';
|
|
3
|
+
|
|
4
|
+
interface CookieConsentProps {
|
|
5
|
+
navigate: ReturnType<typeof useNavigate>;
|
|
6
|
+
}
|
|
7
|
+
declare const CookieConsent: React__default.FC<CookieConsentProps>;
|
|
8
|
+
|
|
9
|
+
export { CookieConsent as default };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// #style-inject:#style-inject
|
|
2
|
+
function styleInject(css, { insertAt } = {}) {
|
|
3
|
+
if (!css || typeof document === "undefined") return;
|
|
4
|
+
const head = document.head || document.getElementsByTagName("head")[0];
|
|
5
|
+
const style = document.createElement("style");
|
|
6
|
+
style.type = "text/css";
|
|
7
|
+
if (insertAt === "top") {
|
|
8
|
+
if (head.firstChild) {
|
|
9
|
+
head.insertBefore(style, head.firstChild);
|
|
10
|
+
} else {
|
|
11
|
+
head.appendChild(style);
|
|
12
|
+
}
|
|
13
|
+
} else {
|
|
14
|
+
head.appendChild(style);
|
|
15
|
+
}
|
|
16
|
+
if (style.styleSheet) {
|
|
17
|
+
style.styleSheet.cssText = css;
|
|
18
|
+
} else {
|
|
19
|
+
style.appendChild(document.createTextNode(css));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// src/components/css/cookie.css
|
|
24
|
+
styleInject(".cookie-wrapper {\n box-shadow: -1px -1px 20px 0.2px rgba(0, 0, 0, 0.25);\n position: fixed;\n bottom: 0;\n left: 0;\n right: 0;\n z-index: 1000;\n background-color: var(--neutral-color);\n padding: 10px;\n text-align: center;\n color: var(--text-color);\n}\n.cookie {\n position: relative;\n bottom: 0px;\n left: 30px;\n font-size: 18px;\n}\n.second-cookie {\n position: relative;\n bottom: -5px;\n left: 5px;\n font-size: 18px;\n}\n.cookie-button {\n border-radius: 8px;\n padding-top: 4px;\n padding-bottom: 4px;\n padding-left: 12px;\n padding-right: 12px;\n border: none;\n font-weight: 800;\n background: var(--primary-color);\n color: var(--neutral-color);\n box-shadow: 2px 3px 10px 0px rgba(0, 0, 0, 0.15);\n transition: all 0.2s ease-in-out;\n cursor: pointer;\n}\n.cookie-button:hover {\n background-color: var(--primary-color-hover);\n}\n");
|
|
25
|
+
|
|
26
|
+
// src/components/cookie-consent.tsx
|
|
27
|
+
import { useEffect } from "react";
|
|
28
|
+
|
|
29
|
+
// src/components/css/link-button.css
|
|
30
|
+
styleInject(".btn-link-p {\n background: none;\n border: none;\n text-decoration: none;\n cursor: pointer;\n transition: all 0.2s ease-in-out;\n color: var(--primary-color) !important;\n padding: 0;\n font-family: inherit;\n font-size: inherit;\n}\n.btn-link-p:hover {\n color: var(--text-color) !important;\n}\n.btn-link-p:disabled {\n cursor: not-allowed;\n color: var(--disabled-color);\n}\n");
|
|
31
|
+
|
|
32
|
+
// src/components/link-button.tsx
|
|
33
|
+
import { useCallback, useMemo } from "react";
|
|
34
|
+
import { jsxs } from "react/jsx-runtime";
|
|
35
|
+
var LinkButtonComponent = ({ id, name, text, className = "", disabled = false, onClick, children }) => {
|
|
36
|
+
const combinedClassName = useMemo(() => `btn-link-p noselect ${className || ""}`, [className]);
|
|
37
|
+
const handleClick = useCallback(
|
|
38
|
+
(event) => {
|
|
39
|
+
if (onClick) onClick(name);
|
|
40
|
+
},
|
|
41
|
+
[name, onClick]
|
|
42
|
+
);
|
|
43
|
+
return /* @__PURE__ */ jsxs(
|
|
44
|
+
"button",
|
|
45
|
+
{
|
|
46
|
+
id,
|
|
47
|
+
name,
|
|
48
|
+
disabled,
|
|
49
|
+
className: combinedClassName,
|
|
50
|
+
type: "button",
|
|
51
|
+
onClick: handleClick,
|
|
52
|
+
children: [
|
|
53
|
+
text,
|
|
54
|
+
children
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
};
|
|
59
|
+
var link_button_default = LinkButtonComponent;
|
|
60
|
+
|
|
61
|
+
// src/components/cookie-consent.tsx
|
|
62
|
+
import { getCookie, setCookieExpiry } from "sspart-common-lib";
|
|
63
|
+
import { jsx, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
64
|
+
var CookieConsent = ({ navigate }) => {
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
if (getCookie("cnstacptnce") !== "true") {
|
|
67
|
+
closeConsent("block");
|
|
68
|
+
}
|
|
69
|
+
}, []);
|
|
70
|
+
const closeConsent = (display) => {
|
|
71
|
+
const consentElement = document.getElementById("cookie-consent");
|
|
72
|
+
if (consentElement) consentElement.style.display = display;
|
|
73
|
+
};
|
|
74
|
+
const handleAccept = () => {
|
|
75
|
+
setCookieExpiry("cnstacptnce", "true", 86400);
|
|
76
|
+
closeConsent("none");
|
|
77
|
+
};
|
|
78
|
+
const onClick = (name) => {
|
|
79
|
+
if (name) navigate(`/${name}`);
|
|
80
|
+
};
|
|
81
|
+
return /* @__PURE__ */ jsxs2("div", { id: "cookie-consent", className: "cookie-wrapper", style: { display: "none" }, children: [
|
|
82
|
+
/* @__PURE__ */ jsx("span", { className: "me-2 cookie", role: "img", "aria-label": "Cookies", children: "\u{1F36A}" }),
|
|
83
|
+
/* @__PURE__ */ jsx("span", { className: "me-2 second-cookie", role: "img", "aria-label": "Cookies", children: "\u{1F36A}" }),
|
|
84
|
+
"We use cookies to personalize your experience. By continuing to visit our website, you agree to our use of cookies.",
|
|
85
|
+
/* @__PURE__ */ jsxs2("div", { className: "mt-2 mb-2", children: [
|
|
86
|
+
/* @__PURE__ */ jsx("button", { id: "accept-cookie", className: "me-2 cookie-button", onClick: handleAccept, children: "Got it!" }),
|
|
87
|
+
/* @__PURE__ */ jsx(link_button_default, { name: "cookie-policy", text: "Read our cookie policy", onClick })
|
|
88
|
+
] })
|
|
89
|
+
] });
|
|
90
|
+
};
|
|
91
|
+
var cookie_consent_default = CookieConsent;
|
|
92
|
+
export {
|
|
93
|
+
cookie_consent_default as default
|
|
94
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
|
|
3
|
+
interface CurrencyTextBoxProps {
|
|
4
|
+
id?: string;
|
|
5
|
+
name: string;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
mandate?: boolean;
|
|
8
|
+
value?: string;
|
|
9
|
+
onChange: (name: string, value: string) => void;
|
|
10
|
+
size?: 'small' | 'medium';
|
|
11
|
+
className?: string;
|
|
12
|
+
validation?: string;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
autoFocus?: boolean;
|
|
15
|
+
autoComplete?: string;
|
|
16
|
+
currency?: string;
|
|
17
|
+
decimals?: number;
|
|
18
|
+
locale?: string;
|
|
19
|
+
[key: string]: any;
|
|
20
|
+
}
|
|
21
|
+
declare const CurrencyTextBox: FC<CurrencyTextBoxProps>;
|
|
22
|
+
|
|
23
|
+
export { CurrencyTextBox as default };
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
// src/components/currency-textbox.tsx
|
|
2
|
+
import { useCallback, useMemo, useState, useEffect } from "react";
|
|
3
|
+
import TextField from "@mui/material/TextField";
|
|
4
|
+
|
|
5
|
+
// src/components/styles.tsx
|
|
6
|
+
var TEXTBOX_STYLE = {
|
|
7
|
+
"&.txtbox-p": {
|
|
8
|
+
"& label.Mui-focused": {
|
|
9
|
+
color: "var(--primary-color)"
|
|
10
|
+
},
|
|
11
|
+
"& .MuiOutlinedInput-root": {
|
|
12
|
+
"&:hover fieldset": {
|
|
13
|
+
borderColor: "var(--primary-color-hover)"
|
|
14
|
+
},
|
|
15
|
+
"&.Mui-focused fieldset": {
|
|
16
|
+
borderColor: "var(--primary-color)"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"& .MuiInputBase-root ": {
|
|
20
|
+
minHeight: 40,
|
|
21
|
+
"&:hover": {
|
|
22
|
+
borderColor: "var(--primary-color)"
|
|
23
|
+
},
|
|
24
|
+
"&:hover:before": {
|
|
25
|
+
borderBottom: "1px solid var(--primary-color)"
|
|
26
|
+
},
|
|
27
|
+
"&.Mui-focused:before": {
|
|
28
|
+
borderBottom: "2px solid var(--primary-color-hover)"
|
|
29
|
+
},
|
|
30
|
+
"&:after": {
|
|
31
|
+
borderBottom: "none",
|
|
32
|
+
transition: "none"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"& .Mui-disabled": {
|
|
36
|
+
"&:hover fieldset": {
|
|
37
|
+
borderColor: "var(--disabled-color)"
|
|
38
|
+
},
|
|
39
|
+
"&.Mui-focused fieldset": {
|
|
40
|
+
borderColor: "var(--alert-error)"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"&.txtbox-p-validation": {
|
|
45
|
+
"& label.Mui-focused": {
|
|
46
|
+
color: "var(--alert-error)"
|
|
47
|
+
},
|
|
48
|
+
"& .MuiOutlinedInput-root": {
|
|
49
|
+
"&:hover fieldset": {
|
|
50
|
+
borderColor: "var(--alert-error-hover)"
|
|
51
|
+
},
|
|
52
|
+
"&.Mui-focused fieldset": {
|
|
53
|
+
borderColor: "var(--alert-error)"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"& .MuiInputBase-root": {
|
|
57
|
+
"&:before": {
|
|
58
|
+
borderBottom: "2px solid var(--alert-error-hover)"
|
|
59
|
+
},
|
|
60
|
+
"&.Mui-focused:before": {
|
|
61
|
+
borderBottom: "2px solid var(--alert-error)"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
// src/components/currency-textbox.tsx
|
|
68
|
+
import { jsx } from "react/jsx-runtime";
|
|
69
|
+
var localStringToNumber = (s) => {
|
|
70
|
+
const num = Number(s.replace(/[^0-9.-]+/g, ""));
|
|
71
|
+
return isNaN(num) ? 0 : num;
|
|
72
|
+
};
|
|
73
|
+
var CurrencyTextBox = ({
|
|
74
|
+
id,
|
|
75
|
+
name,
|
|
76
|
+
placeholder,
|
|
77
|
+
mandate,
|
|
78
|
+
value = "0",
|
|
79
|
+
onChange,
|
|
80
|
+
className = "",
|
|
81
|
+
decimals = 2,
|
|
82
|
+
locale = "en-IN",
|
|
83
|
+
validation,
|
|
84
|
+
size = "small",
|
|
85
|
+
disabled,
|
|
86
|
+
autoFocus,
|
|
87
|
+
autoComplete,
|
|
88
|
+
currency = "INR",
|
|
89
|
+
...otherProps
|
|
90
|
+
}) => {
|
|
91
|
+
const options = useMemo(() => ({
|
|
92
|
+
maximumFractionDigits: decimals,
|
|
93
|
+
currency,
|
|
94
|
+
style: "currency",
|
|
95
|
+
currencyDisplay: "symbol"
|
|
96
|
+
}), [currency, decimals]);
|
|
97
|
+
const [formattedValue, setFormattedValue] = useState(localStringToNumber(value).toLocaleString(locale, options));
|
|
98
|
+
useEffect(() => {
|
|
99
|
+
const formatted = localStringToNumber(value).toLocaleString(locale, options);
|
|
100
|
+
setFormattedValue(formatted);
|
|
101
|
+
}, [value, options]);
|
|
102
|
+
const combinedClassName = useMemo(
|
|
103
|
+
() => `txtbox-p ${className || ""} ${validation ? "txtbox-p-validation" : ""}`,
|
|
104
|
+
[className, validation]
|
|
105
|
+
);
|
|
106
|
+
const handleFocus = useCallback((e) => {
|
|
107
|
+
setFormattedValue(localStringToNumber(e.target.value).toString());
|
|
108
|
+
}, []);
|
|
109
|
+
const handleBlur = useCallback((e) => {
|
|
110
|
+
const { name: name2, value: value2 } = e.target;
|
|
111
|
+
onChange(name2, localStringToNumber(value2).toFixed(decimals));
|
|
112
|
+
setFormattedValue(localStringToNumber(value2).toLocaleString(locale, options));
|
|
113
|
+
}, [decimals, options, onChange]);
|
|
114
|
+
const handleChange = useCallback((event) => {
|
|
115
|
+
const { value: value2 } = event.target;
|
|
116
|
+
setFormattedValue(value2);
|
|
117
|
+
}, []);
|
|
118
|
+
return /* @__PURE__ */ jsx(
|
|
119
|
+
TextField,
|
|
120
|
+
{
|
|
121
|
+
id,
|
|
122
|
+
name,
|
|
123
|
+
label: placeholder,
|
|
124
|
+
required: mandate,
|
|
125
|
+
value: formattedValue,
|
|
126
|
+
onChange: handleChange,
|
|
127
|
+
className: combinedClassName,
|
|
128
|
+
error: !!validation,
|
|
129
|
+
disabled,
|
|
130
|
+
helperText: validation,
|
|
131
|
+
fullWidth: true,
|
|
132
|
+
size,
|
|
133
|
+
variant: "outlined",
|
|
134
|
+
onFocus: handleFocus,
|
|
135
|
+
onBlur: handleBlur,
|
|
136
|
+
autoFocus,
|
|
137
|
+
sx: TEXTBOX_STYLE,
|
|
138
|
+
autoComplete,
|
|
139
|
+
...otherProps
|
|
140
|
+
}
|
|
141
|
+
);
|
|
142
|
+
};
|
|
143
|
+
var currency_textbox_default = CurrencyTextBox;
|
|
144
|
+
export {
|
|
145
|
+
currency_textbox_default as default
|
|
146
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
|
|
3
|
+
interface MultiDropdownProps {
|
|
4
|
+
id?: string;
|
|
5
|
+
name: string;
|
|
6
|
+
options: Array<{
|
|
7
|
+
[key: string]: string;
|
|
8
|
+
}>;
|
|
9
|
+
texts?: string[];
|
|
10
|
+
optionKey: string;
|
|
11
|
+
optionValue: string;
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
mandate?: boolean;
|
|
14
|
+
value: string[];
|
|
15
|
+
onChange: (name: string, value: string[]) => void;
|
|
16
|
+
className?: string;
|
|
17
|
+
validation?: string;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
[key: string]: any;
|
|
20
|
+
}
|
|
21
|
+
declare const MultiDropdown: FC<MultiDropdownProps>;
|
|
22
|
+
|
|
23
|
+
export { MultiDropdown as default };
|