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.
Files changed (57) hide show
  1. package/dist/components/alerts.d.ts +9 -0
  2. package/dist/components/alerts.js +53 -0
  3. package/dist/components/are-you-sure-model.d.ts +9 -0
  4. package/dist/components/are-you-sure-model.js +111 -0
  5. package/dist/components/button.d.ts +16 -0
  6. package/dist/components/button.js +69 -0
  7. package/dist/components/checkbox.d.ts +15 -0
  8. package/dist/components/checkbox.js +30 -0
  9. package/dist/components/cookie-consent.d.ts +9 -0
  10. package/dist/components/cookie-consent.js +94 -0
  11. package/dist/components/currency-textbox.d.ts +23 -0
  12. package/dist/components/currency-textbox.js +146 -0
  13. package/dist/components/dropdown-multi.d.ts +23 -0
  14. package/dist/components/dropdown-multi.js +116 -0
  15. package/dist/components/dropdown.d.ts +23 -0
  16. package/dist/components/dropdown.js +106 -0
  17. package/dist/components/empty-list.d.ts +10 -0
  18. package/dist/components/empty-list.js +40 -0
  19. package/dist/components/hide-on-scroll.d.ts +8 -0
  20. package/dist/components/hide-on-scroll.js +34 -0
  21. package/dist/components/info-alerts.d.ts +14 -0
  22. package/dist/components/info-alerts.js +15 -0
  23. package/dist/components/link-button.d.ts +14 -0
  24. package/dist/components/link-button.js +56 -0
  25. package/dist/components/loading.d.ts +8 -0
  26. package/dist/components/loading.js +29 -0
  27. package/dist/components/market-textbox.d.ts +23 -0
  28. package/dist/components/market-textbox.js +231 -0
  29. package/dist/components/page-spinner.d.ts +5 -0
  30. package/dist/components/page-spinner.js +36 -0
  31. package/dist/components/password-textbox.d.ts +16 -0
  32. package/dist/components/password-textbox.js +125 -0
  33. package/dist/components/radio-group.d.ts +21 -0
  34. package/dist/components/radio-group.js +45 -0
  35. package/dist/components/resize-element.d.ts +10 -0
  36. package/dist/components/resize-element.js +21 -0
  37. package/dist/components/small-dropdown.d.ts +14 -0
  38. package/dist/components/small-dropdown.js +28 -0
  39. package/dist/components/snackbar.d.ts +7 -0
  40. package/dist/components/snackbar.js +42 -0
  41. package/dist/components/switch.d.ts +10 -0
  42. package/dist/components/switch.js +23 -0
  43. package/dist/components/tab.d.ts +10 -0
  44. package/dist/components/tab.js +22 -0
  45. package/dist/components/tabs.d.ts +14 -0
  46. package/dist/components/tabs.js +74 -0
  47. package/dist/components/textbox-autocomplete.d.ts +26 -0
  48. package/dist/components/textbox-autocomplete.js +104 -0
  49. package/dist/components/textbox.d.ts +22 -0
  50. package/dist/components/textbox.js +124 -0
  51. package/dist/components/toggle.d.ts +18 -0
  52. package/dist/components/toggle.js +42 -0
  53. package/dist/components/tooltip.d.ts +9 -0
  54. package/dist/components/tooltip.js +43 -0
  55. package/dist/index.d.ts +31 -0
  56. package/dist/index.js +176 -0
  57. package/package.json +150 -0
@@ -0,0 +1,231 @@
1
+ // src/components/market-textbox.tsx
2
+ import { useCallback as useCallback2 } from "react";
3
+ import Checkbox from "@mui/material/Checkbox";
4
+ import FormControlLabel from "@mui/material/FormControlLabel";
5
+ import Typography from "@mui/material/Typography";
6
+ import CircleOutlinedIcon from "@mui/icons-material/CircleOutlined";
7
+ import CheckCircleIcon from "@mui/icons-material/CheckCircle";
8
+
9
+ // src/components/currency-textbox.tsx
10
+ import { useCallback, useMemo, useState, useEffect } from "react";
11
+ import TextField from "@mui/material/TextField";
12
+
13
+ // src/components/styles.tsx
14
+ var TEXTBOX_STYLE = {
15
+ "&.txtbox-p": {
16
+ "& label.Mui-focused": {
17
+ color: "var(--primary-color)"
18
+ },
19
+ "& .MuiOutlinedInput-root": {
20
+ "&:hover fieldset": {
21
+ borderColor: "var(--primary-color-hover)"
22
+ },
23
+ "&.Mui-focused fieldset": {
24
+ borderColor: "var(--primary-color)"
25
+ }
26
+ },
27
+ "& .MuiInputBase-root ": {
28
+ minHeight: 40,
29
+ "&:hover": {
30
+ borderColor: "var(--primary-color)"
31
+ },
32
+ "&:hover:before": {
33
+ borderBottom: "1px solid var(--primary-color)"
34
+ },
35
+ "&.Mui-focused:before": {
36
+ borderBottom: "2px solid var(--primary-color-hover)"
37
+ },
38
+ "&:after": {
39
+ borderBottom: "none",
40
+ transition: "none"
41
+ }
42
+ },
43
+ "& .Mui-disabled": {
44
+ "&:hover fieldset": {
45
+ borderColor: "var(--disabled-color)"
46
+ },
47
+ "&.Mui-focused fieldset": {
48
+ borderColor: "var(--alert-error)"
49
+ }
50
+ }
51
+ },
52
+ "&.txtbox-p-validation": {
53
+ "& label.Mui-focused": {
54
+ color: "var(--alert-error)"
55
+ },
56
+ "& .MuiOutlinedInput-root": {
57
+ "&:hover fieldset": {
58
+ borderColor: "var(--alert-error-hover)"
59
+ },
60
+ "&.Mui-focused fieldset": {
61
+ borderColor: "var(--alert-error)"
62
+ }
63
+ },
64
+ "& .MuiInputBase-root": {
65
+ "&:before": {
66
+ borderBottom: "2px solid var(--alert-error-hover)"
67
+ },
68
+ "&.Mui-focused:before": {
69
+ borderBottom: "2px solid var(--alert-error)"
70
+ }
71
+ }
72
+ }
73
+ };
74
+
75
+ // src/components/currency-textbox.tsx
76
+ import { jsx } from "react/jsx-runtime";
77
+ var localStringToNumber = (s) => {
78
+ const num = Number(s.replace(/[^0-9.-]+/g, ""));
79
+ return isNaN(num) ? 0 : num;
80
+ };
81
+ var CurrencyTextBox = ({
82
+ id,
83
+ name,
84
+ placeholder,
85
+ mandate,
86
+ value = "0",
87
+ onChange,
88
+ className = "",
89
+ decimals = 2,
90
+ locale = "en-IN",
91
+ validation,
92
+ size = "small",
93
+ disabled,
94
+ autoFocus,
95
+ autoComplete,
96
+ currency = "INR",
97
+ ...otherProps
98
+ }) => {
99
+ const options = useMemo(() => ({
100
+ maximumFractionDigits: decimals,
101
+ currency,
102
+ style: "currency",
103
+ currencyDisplay: "symbol"
104
+ }), [currency, decimals]);
105
+ const [formattedValue, setFormattedValue] = useState(localStringToNumber(value).toLocaleString(locale, options));
106
+ useEffect(() => {
107
+ const formatted = localStringToNumber(value).toLocaleString(locale, options);
108
+ setFormattedValue(formatted);
109
+ }, [value, options]);
110
+ const combinedClassName = useMemo(
111
+ () => `txtbox-p ${className || ""} ${validation ? "txtbox-p-validation" : ""}`,
112
+ [className, validation]
113
+ );
114
+ const handleFocus = useCallback((e) => {
115
+ setFormattedValue(localStringToNumber(e.target.value).toString());
116
+ }, []);
117
+ const handleBlur = useCallback((e) => {
118
+ const { name: name2, value: value2 } = e.target;
119
+ onChange(name2, localStringToNumber(value2).toFixed(decimals));
120
+ setFormattedValue(localStringToNumber(value2).toLocaleString(locale, options));
121
+ }, [decimals, options, onChange]);
122
+ const handleChange = useCallback((event) => {
123
+ const { value: value2 } = event.target;
124
+ setFormattedValue(value2);
125
+ }, []);
126
+ return /* @__PURE__ */ jsx(
127
+ TextField,
128
+ {
129
+ id,
130
+ name,
131
+ label: placeholder,
132
+ required: mandate,
133
+ value: formattedValue,
134
+ onChange: handleChange,
135
+ className: combinedClassName,
136
+ error: !!validation,
137
+ disabled,
138
+ helperText: validation,
139
+ fullWidth: true,
140
+ size,
141
+ variant: "outlined",
142
+ onFocus: handleFocus,
143
+ onBlur: handleBlur,
144
+ autoFocus,
145
+ sx: TEXTBOX_STYLE,
146
+ autoComplete,
147
+ ...otherProps
148
+ }
149
+ );
150
+ };
151
+ var currency_textbox_default = CurrencyTextBox;
152
+
153
+ // src/components/market-textbox.tsx
154
+ import { setCookieExpiry, STOCK_ORDER_TYPES } from "sspart-common-lib";
155
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
156
+ var styleData = {
157
+ color: "var(--primary-color)",
158
+ "&.Mui-checked": {
159
+ color: "var(--primary-color)"
160
+ }
161
+ };
162
+ var MarketTextBox = ({
163
+ id,
164
+ name,
165
+ placeholder,
166
+ mandate,
167
+ value = "0",
168
+ checked = true,
169
+ onChange,
170
+ size = "small",
171
+ className = "",
172
+ decimals = 2,
173
+ locale = "en-IN",
174
+ currency = "INR",
175
+ validation,
176
+ autoFocus,
177
+ autoComplete
178
+ }) => {
179
+ const handleValueChange = useCallback2((name2, val) => {
180
+ onChange(name2, checked, val);
181
+ }, [checked, onChange]);
182
+ const handleToggle = useCallback2((event) => {
183
+ const isChecked = event.target.checked;
184
+ const type = isChecked ? STOCK_ORDER_TYPES.MARKET : STOCK_ORDER_TYPES.LIMIT;
185
+ setCookieExpiry("ordertype", type, 1e5);
186
+ onChange(name, isChecked, isChecked ? "0" : value);
187
+ }, [name, value, onChange]);
188
+ return /* @__PURE__ */ jsxs("div", { children: [
189
+ /* @__PURE__ */ jsx2(
190
+ currency_textbox_default,
191
+ {
192
+ id,
193
+ className,
194
+ mandate,
195
+ validation,
196
+ size,
197
+ autoFocus,
198
+ name,
199
+ value,
200
+ placeholder,
201
+ decimals,
202
+ locale,
203
+ currency,
204
+ onChange: handleValueChange,
205
+ autoComplete,
206
+ disabled: checked
207
+ }
208
+ ),
209
+ /* @__PURE__ */ jsx2(
210
+ FormControlLabel,
211
+ {
212
+ control: /* @__PURE__ */ jsx2(
213
+ Checkbox,
214
+ {
215
+ sx: styleData,
216
+ size: "small",
217
+ checked,
218
+ onChange: handleToggle,
219
+ icon: /* @__PURE__ */ jsx2(CircleOutlinedIcon, {}),
220
+ checkedIcon: /* @__PURE__ */ jsx2(CheckCircleIcon, {})
221
+ }
222
+ ),
223
+ label: /* @__PURE__ */ jsx2(Typography, { paddingTop: "3px", variant: "caption", fontSize: "9px", fontWeight: "800", display: "block", gutterBottom: true, children: "Place at MKT" })
224
+ }
225
+ )
226
+ ] });
227
+ };
228
+ var market_textbox_default = MarketTextBox;
229
+ export {
230
+ market_textbox_default as default
231
+ };
@@ -0,0 +1,5 @@
1
+ import { FC } from 'react';
2
+
3
+ declare const PageSpinner: FC;
4
+
5
+ export { PageSpinner as default };
@@ -0,0 +1,36 @@
1
+ // src/components/page-spinner.tsx
2
+ import { useEffect, useState, useCallback } from "react";
3
+ import CircularProgress from "@mui/material/CircularProgress";
4
+ import { NOTIFICATION_SERVICES, ns } from "sspart-common-lib";
5
+ import { jsx } from "react/jsx-runtime";
6
+ var observerId = "PageSpinnerObserver";
7
+ var PAGE_SPINNER_STYLE = {
8
+ position: "fixed",
9
+ top: 0,
10
+ left: 0,
11
+ width: "100vw",
12
+ height: "100vh",
13
+ display: "flex",
14
+ justifyContent: "center",
15
+ alignItems: "center",
16
+ backgroundColor: "rgba(255, 255, 255, 0.7)",
17
+ zIndex: 9999
18
+ };
19
+ var PageSpinner = () => {
20
+ const [show, setShow] = useState(false);
21
+ const toggleSpinner = useCallback((isVisible) => {
22
+ setShow(isVisible);
23
+ }, []);
24
+ useEffect(() => {
25
+ ns.addObserver(NOTIFICATION_SERVICES.PAGE_SPINNER, observerId, toggleSpinner);
26
+ return () => {
27
+ ns.removeObserver(observerId, NOTIFICATION_SERVICES.PAGE_SPINNER);
28
+ };
29
+ }, [toggleSpinner]);
30
+ if (!show) return null;
31
+ return /* @__PURE__ */ jsx("div", { style: PAGE_SPINNER_STYLE, children: /* @__PURE__ */ jsx(CircularProgress, {}) });
32
+ };
33
+ var page_spinner_default = PageSpinner;
34
+ export {
35
+ page_spinner_default as default
36
+ };
@@ -0,0 +1,16 @@
1
+ import { FC } from 'react';
2
+
3
+ interface PasswordTextBoxProps {
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
+ }
14
+ declare const PasswordTextBox: FC<PasswordTextBoxProps>;
15
+
16
+ export { PasswordTextBox as default };
@@ -0,0 +1,125 @@
1
+ // src/components/password-textbox.tsx
2
+ import { useCallback, useMemo, useState } from "react";
3
+ import FormControl from "@mui/material/FormControl";
4
+ import FormHelperText from "@mui/material/FormHelperText";
5
+ import InputLabel from "@mui/material/InputLabel";
6
+ import IconButton from "@mui/material/IconButton";
7
+ import InputAdornment from "@mui/material/InputAdornment";
8
+ import OutlinedInput from "@mui/material/OutlinedInput";
9
+ import VisibilityIcon from "@mui/icons-material/Visibility";
10
+ import VisibilityOffIcon from "@mui/icons-material/VisibilityOff";
11
+
12
+ // src/components/styles.tsx
13
+ var TEXTBOX_STYLE = {
14
+ "&.txtbox-p": {
15
+ "& label.Mui-focused": {
16
+ color: "var(--primary-color)"
17
+ },
18
+ "& .MuiOutlinedInput-root": {
19
+ "&:hover fieldset": {
20
+ borderColor: "var(--primary-color-hover)"
21
+ },
22
+ "&.Mui-focused fieldset": {
23
+ borderColor: "var(--primary-color)"
24
+ }
25
+ },
26
+ "& .MuiInputBase-root ": {
27
+ minHeight: 40,
28
+ "&:hover": {
29
+ borderColor: "var(--primary-color)"
30
+ },
31
+ "&:hover:before": {
32
+ borderBottom: "1px solid var(--primary-color)"
33
+ },
34
+ "&.Mui-focused:before": {
35
+ borderBottom: "2px solid var(--primary-color-hover)"
36
+ },
37
+ "&:after": {
38
+ borderBottom: "none",
39
+ transition: "none"
40
+ }
41
+ },
42
+ "& .Mui-disabled": {
43
+ "&:hover fieldset": {
44
+ borderColor: "var(--disabled-color)"
45
+ },
46
+ "&.Mui-focused fieldset": {
47
+ borderColor: "var(--alert-error)"
48
+ }
49
+ }
50
+ },
51
+ "&.txtbox-p-validation": {
52
+ "& label.Mui-focused": {
53
+ color: "var(--alert-error)"
54
+ },
55
+ "& .MuiOutlinedInput-root": {
56
+ "&:hover fieldset": {
57
+ borderColor: "var(--alert-error-hover)"
58
+ },
59
+ "&.Mui-focused fieldset": {
60
+ borderColor: "var(--alert-error)"
61
+ }
62
+ },
63
+ "& .MuiInputBase-root": {
64
+ "&:before": {
65
+ borderBottom: "2px solid var(--alert-error-hover)"
66
+ },
67
+ "&.Mui-focused:before": {
68
+ borderBottom: "2px solid var(--alert-error)"
69
+ }
70
+ }
71
+ }
72
+ };
73
+
74
+ // src/components/password-textbox.tsx
75
+ import { jsx, jsxs } from "react/jsx-runtime";
76
+ var PasswordTextBox = ({
77
+ id,
78
+ name,
79
+ placeholder,
80
+ mandate,
81
+ value,
82
+ onChange,
83
+ className = "",
84
+ size = "small",
85
+ validation
86
+ }) => {
87
+ const [showPassword, setShowPassword] = useState(false);
88
+ const combinedClassName = useMemo(
89
+ () => `txtbox-p ${className || ""} ${validation ? "txtbox-p-validation" : ""}`,
90
+ [className, validation]
91
+ );
92
+ const handleChange = useCallback(
93
+ (event) => {
94
+ const { name: name2, value: value2 } = event.target;
95
+ onChange(name2, value2);
96
+ },
97
+ [onChange]
98
+ );
99
+ const handleClickShowPassword = useCallback(() => {
100
+ setShowPassword((prev) => !prev);
101
+ }, []);
102
+ const handleMouseDownPassword = useCallback((event) => {
103
+ event.preventDefault();
104
+ }, []);
105
+ return /* @__PURE__ */ jsxs(FormControl, { className: combinedClassName, error: !!validation, variant: "outlined", size, required: mandate, fullWidth: true, sx: TEXTBOX_STYLE, children: [
106
+ /* @__PURE__ */ jsx(InputLabel, { htmlFor: id, children: placeholder }),
107
+ /* @__PURE__ */ jsx(
108
+ OutlinedInput,
109
+ {
110
+ name,
111
+ id,
112
+ type: showPassword ? "text" : "password",
113
+ value,
114
+ label: placeholder,
115
+ onChange: handleChange,
116
+ endAdornment: /* @__PURE__ */ jsx(InputAdornment, { position: "end", children: /* @__PURE__ */ jsx(IconButton, { onClick: handleClickShowPassword, onMouseDown: handleMouseDownPassword, edge: "end", children: showPassword ? /* @__PURE__ */ jsx(VisibilityOffIcon, {}) : /* @__PURE__ */ jsx(VisibilityIcon, {}) }) })
117
+ }
118
+ ),
119
+ /* @__PURE__ */ jsx(FormHelperText, { children: validation })
120
+ ] });
121
+ };
122
+ var password_textbox_default = PasswordTextBox;
123
+ export {
124
+ password_textbox_default as default
125
+ };
@@ -0,0 +1,21 @@
1
+ import { FC } from 'react';
2
+
3
+ interface RadioOption {
4
+ value: string;
5
+ text: string;
6
+ }
7
+ interface RadioGroupBoxProps {
8
+ name: string;
9
+ label?: string;
10
+ value: string;
11
+ options: RadioOption[];
12
+ onChange: (name: string, value: string) => void;
13
+ mandate?: boolean;
14
+ validation?: string;
15
+ row?: boolean;
16
+ disabled?: boolean;
17
+ [key: string]: any;
18
+ }
19
+ declare const RadioGroupBox: FC<RadioGroupBoxProps>;
20
+
21
+ export { RadioGroupBox as default };
@@ -0,0 +1,45 @@
1
+ // src/components/radio-group.tsx
2
+ import { useCallback } from "react";
3
+ import FormControl from "@mui/material/FormControl";
4
+ import FormControlLabel from "@mui/material/FormControlLabel";
5
+ import FormLabel from "@mui/material/FormLabel";
6
+ import Radio from "@mui/material/Radio";
7
+ import RadioGroup from "@mui/material/RadioGroup";
8
+ import FormHelperText from "@mui/material/FormHelperText";
9
+ import { jsx, jsxs } from "react/jsx-runtime";
10
+ var labelStyle = {
11
+ color: "var(--text-color)",
12
+ "&.Mui-focused": { color: "var(--text-color)" }
13
+ };
14
+ var radioStyle = {
15
+ color: "var(--primary-color)",
16
+ "&.Mui-checked": { color: "var(--primary-color)" }
17
+ };
18
+ var RadioGroupBox = ({
19
+ name,
20
+ label,
21
+ value,
22
+ options,
23
+ onChange,
24
+ mandate,
25
+ validation,
26
+ row = false,
27
+ disabled = false,
28
+ ...otherProps
29
+ }) => {
30
+ const handleChange = useCallback((event) => {
31
+ onChange(name, event.target.value);
32
+ }, [name, onChange]);
33
+ return /* @__PURE__ */ jsxs(FormControl, { component: "fieldset", error: !!validation, disabled, ...otherProps, children: [
34
+ label && /* @__PURE__ */ jsxs(FormLabel, { component: "legend", sx: labelStyle, children: [
35
+ label,
36
+ mandate && " *"
37
+ ] }),
38
+ /* @__PURE__ */ jsx(RadioGroup, { row, name, value, onChange: handleChange, children: options.map(({ value: value2, text }) => /* @__PURE__ */ jsx(FormControlLabel, { value: value2, control: /* @__PURE__ */ jsx(Radio, { size: "small", sx: radioStyle }), label: text }, value2)) }),
39
+ validation && /* @__PURE__ */ jsx(FormHelperText, { children: validation })
40
+ ] });
41
+ };
42
+ var radio_group_default = RadioGroupBox;
43
+ export {
44
+ radio_group_default as default
45
+ };
@@ -0,0 +1,10 @@
1
+ import { FC, ReactNode } from 'react';
2
+
3
+ interface ResizeElementProps {
4
+ maxWidth: number;
5
+ ShortElement: ReactNode;
6
+ LongElement: ReactNode;
7
+ }
8
+ declare const ResizeElement: FC<ResizeElementProps>;
9
+
10
+ export { ResizeElement as default };
@@ -0,0 +1,21 @@
1
+ // src/components/resize-element.tsx
2
+ import { useState, useEffect } from "react";
3
+ import { Fragment, jsx } from "react/jsx-runtime";
4
+ var ResizeElement = ({ maxWidth, ShortElement, LongElement }) => {
5
+ const [showElement, setShowElement] = useState(window.innerWidth > maxWidth);
6
+ useEffect(() => {
7
+ const mediaQuery = window.matchMedia(`(min-width: ${maxWidth}px)`);
8
+ const handleResize = (e) => {
9
+ setShowElement(e.matches);
10
+ };
11
+ mediaQuery.addEventListener("change", handleResize);
12
+ return () => {
13
+ mediaQuery.removeEventListener("change", handleResize);
14
+ };
15
+ }, [maxWidth]);
16
+ return /* @__PURE__ */ jsx(Fragment, { children: showElement ? LongElement : ShortElement });
17
+ };
18
+ var resize_element_default = ResizeElement;
19
+ export {
20
+ resize_element_default as default
21
+ };
@@ -0,0 +1,14 @@
1
+ import React__default from 'react';
2
+
3
+ interface DropdownProps {
4
+ name: string;
5
+ value: string;
6
+ options: {
7
+ value: string;
8
+ text: string;
9
+ }[];
10
+ onChange: (name: string, value: string) => void;
11
+ }
12
+ declare const Dropdown: React__default.FC<DropdownProps>;
13
+
14
+ export { Dropdown as default };
@@ -0,0 +1,28 @@
1
+ // src/components/small-dropdown.tsx
2
+ import { useCallback } from "react";
3
+ import { jsx } from "react/jsx-runtime";
4
+ var dropdownStyle = {
5
+ width: "80px",
6
+ height: "20px",
7
+ fontSize: "10px",
8
+ border: "1px solid rgba(0, 0, 0, 0.3)",
9
+ borderRadius: "4px",
10
+ color: "var(--text-color)",
11
+ whiteSpace: "nowrap",
12
+ overflow: "hidden",
13
+ textOverflow: "ellipsis",
14
+ padding: "0 4px"
15
+ };
16
+ var Dropdown = ({ name, value, options, onChange }) => {
17
+ const handleChange = useCallback(
18
+ (event) => {
19
+ onChange(name, event.target.value);
20
+ },
21
+ [onChange, name]
22
+ );
23
+ return /* @__PURE__ */ jsx("select", { style: dropdownStyle, value, onChange: handleChange, children: options.map((option) => /* @__PURE__ */ jsx("option", { value: option.value, children: option.text }, option.value)) });
24
+ };
25
+ var small_dropdown_default = Dropdown;
26
+ export {
27
+ small_dropdown_default as default
28
+ };
@@ -0,0 +1,7 @@
1
+ import { FC } from 'react';
2
+
3
+ interface SnackbarProps {
4
+ }
5
+ declare const SnackbarComponent: FC<SnackbarProps>;
6
+
7
+ export { SnackbarComponent as default };
@@ -0,0 +1,42 @@
1
+ // src/components/snackbar.tsx
2
+ import { useEffect, useState, useCallback } from "react";
3
+ import Alert from "@mui/material/Alert";
4
+ import Snackbar from "@mui/material/Snackbar";
5
+ import { NOTIFICATION_SERVICES, ns } from "sspart-common-lib";
6
+ import { jsx } from "react/jsx-runtime";
7
+ var observerId = "SnackbarObserver";
8
+ var SnackbarComponent = () => {
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 showAlert = useCallback(
18
+ (alertData) => {
19
+ if (!alertData.alert) {
20
+ onClose();
21
+ } else {
22
+ setAlertState({
23
+ open: true,
24
+ alertType: alertData.alert.alertType,
25
+ alertText: alertData.alert.alertText
26
+ });
27
+ }
28
+ },
29
+ [onClose]
30
+ );
31
+ useEffect(() => {
32
+ ns.addObserver(NOTIFICATION_SERVICES.DISPLAY_SNACKBAR, observerId, showAlert);
33
+ return () => {
34
+ ns.removeObserver(observerId, NOTIFICATION_SERVICES.DISPLAY_SNACKBAR);
35
+ };
36
+ }, [showAlert]);
37
+ return /* @__PURE__ */ jsx(Snackbar, { open: alertState.open, autoHideDuration: 3e3, onClose, children: /* @__PURE__ */ jsx(Alert, { onClose, severity: alertState.alertType, sx: { width: "100%" }, children: alertState.alertText }) });
38
+ };
39
+ var snackbar_default = SnackbarComponent;
40
+ export {
41
+ snackbar_default as default
42
+ };
@@ -0,0 +1,10 @@
1
+ import { FC } from 'react';
2
+
3
+ interface SwitchProps {
4
+ name: string;
5
+ value: boolean;
6
+ onChange: (name: string, value: boolean) => void;
7
+ }
8
+ declare const SwitchComponent: FC<SwitchProps>;
9
+
10
+ export { SwitchComponent as default };
@@ -0,0 +1,23 @@
1
+ // src/components/switch.tsx
2
+ import Switch from "@mui/material/Switch";
3
+ import { jsx } from "react/jsx-runtime";
4
+ var styleData = {
5
+ "& .MuiSwitch-switchBase": {
6
+ "&.Mui-checked": {
7
+ color: "var(--primary-color)"
8
+ },
9
+ "&.Mui-checked + .MuiSwitch-track": {
10
+ backgroundColor: "var(--primary-color)"
11
+ }
12
+ }
13
+ };
14
+ var SwitchComponent = ({ value, onChange, name }) => {
15
+ const handleToggle = (event) => {
16
+ onChange(name, event.target.checked);
17
+ };
18
+ return /* @__PURE__ */ jsx(Switch, { sx: styleData, size: "small", checked: value, onChange: handleToggle });
19
+ };
20
+ var switch_default = SwitchComponent;
21
+ export {
22
+ switch_default as default
23
+ };
@@ -0,0 +1,10 @@
1
+ import React__default from 'react';
2
+
3
+ interface CloudTabProps {
4
+ children?: React__default.ReactNode;
5
+ value: number;
6
+ index: number;
7
+ }
8
+ declare const _default: React__default.NamedExoticComponent<CloudTabProps>;
9
+
10
+ export { _default as default };
@@ -0,0 +1,22 @@
1
+ // src/components/tab.tsx
2
+ import React from "react";
3
+ import Box from "@mui/material/Box";
4
+ import { jsx } from "react/jsx-runtime";
5
+ var CloudTab = ({ children, value, index, ...other }) => {
6
+ const isActive = value === index;
7
+ return /* @__PURE__ */ jsx(
8
+ "div",
9
+ {
10
+ role: "tabpanel",
11
+ hidden: !isActive,
12
+ id: `cloud-tabpanel-${index}`,
13
+ "aria-labelledby": `cloud-tab-${index}`,
14
+ ...other,
15
+ children: isActive && /* @__PURE__ */ jsx(Box, { children })
16
+ }
17
+ );
18
+ };
19
+ var tab_default = React.memo(CloudTab);
20
+ export {
21
+ tab_default as default
22
+ };