@codezee/sixtify-brahma 0.2.86 → 0.2.88
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/package.json +1 -1
- package/packages/shared-components/dist/Charts/LineChart.d.ts +30 -0
- package/packages/shared-components/dist/Charts/LineChart.d.ts.map +1 -0
- package/packages/shared-components/dist/Charts/LineChart.js +46 -0
- package/packages/shared-components/dist/Charts/index.d.ts +1 -0
- package/packages/shared-components/dist/Charts/index.d.ts.map +1 -1
- package/packages/shared-components/dist/Charts/index.js +1 -0
- package/packages/shared-components/dist/FormFields/Select/Select.d.ts +29 -0
- package/packages/shared-components/dist/FormFields/Select/Select.d.ts.map +1 -0
- package/packages/shared-components/dist/FormFields/Select/Select.js +157 -0
- package/packages/shared-components/dist/FormFields/Select/Select.styled.d.ts +5 -0
- package/packages/shared-components/dist/FormFields/Select/Select.styled.d.ts.map +1 -0
- package/packages/shared-components/dist/FormFields/Select/Select.styled.js +45 -0
- package/packages/shared-components/dist/FormFields/Select/index.d.ts +2 -0
- package/packages/shared-components/dist/FormFields/Select/index.d.ts.map +1 -0
- package/packages/shared-components/dist/FormFields/Select/index.js +17 -0
- package/packages/shared-components/dist/FormFields/index.d.ts +2 -1
- package/packages/shared-components/dist/FormFields/index.d.ts.map +1 -1
- package/packages/shared-components/dist/FormFields/index.js +2 -1
- package/packages/shared-components/dist/Layouts/FormRow/FormRow.styled.d.ts.map +1 -1
- package/packages/shared-components/dist/Layouts/FormRow/FormRow.styled.js +4 -1
package/package.json
CHANGED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { LineSeriesType } from "@mui/x-charts";
|
|
2
|
+
import type { AnchorPosition } from "@mui/x-charts/ChartsLegend/legend.types";
|
|
3
|
+
import type { MakeOptional } from "@mui/x-charts/internals";
|
|
4
|
+
import type { LineChartProps as MuiLineChartProps } from "@mui/x-charts/LineChart";
|
|
5
|
+
type ExtendedLineSeriesType = MakeOptional<LineSeriesType, "type"> & {
|
|
6
|
+
color?: string;
|
|
7
|
+
colorMap?: {
|
|
8
|
+
[key: string]: string;
|
|
9
|
+
};
|
|
10
|
+
strokeWidth?: number;
|
|
11
|
+
getColor?: (value: number, index: number, data: readonly (number | null)[]) => string;
|
|
12
|
+
};
|
|
13
|
+
type LineChartProps = Omit<MuiLineChartProps, "series"> & {
|
|
14
|
+
series: ExtendedLineSeriesType[];
|
|
15
|
+
xAxisData?: string[];
|
|
16
|
+
yAxisLabel?: string;
|
|
17
|
+
xAxisLabel?: string;
|
|
18
|
+
loading?: boolean;
|
|
19
|
+
height?: MuiLineChartProps["height"];
|
|
20
|
+
width?: MuiLineChartProps["width"];
|
|
21
|
+
hideLegend?: boolean;
|
|
22
|
+
legendPosition?: AnchorPosition;
|
|
23
|
+
grid?: {
|
|
24
|
+
horizontal?: boolean;
|
|
25
|
+
vertical?: boolean;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export declare const LineChart: ({ height, width, skipAnimation, loading, tooltip, series, xAxisData, yAxisLabel, xAxisLabel, hideLegend, legendPosition, grid, ...rest }: LineChartProps) => import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=LineChart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LineChart.d.ts","sourceRoot":"","sources":["../../src/Charts/LineChart.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAC9E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,IAAI,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAGnF,KAAK,sBAAsB,GAAG,YAAY,CAAC,cAAc,EAAE,MAAM,CAAC,GAAG;IACnE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,CACT,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,SAAS,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,KAC7B,MAAM,CAAC;CACb,CAAC;AAEF,KAAK,cAAc,GAAG,IAAI,CAAC,iBAAiB,EAAE,QAAQ,CAAC,GAAG;IACxD,MAAM,EAAE,sBAAsB,EAAE,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IACrC,KAAK,CAAC,EAAE,iBAAiB,CAAC,OAAO,CAAC,CAAC;IACnC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,IAAI,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;CACrD,CAAC;AAkBF,eAAO,MAAM,SAAS,GAAI,0IAcvB,cAAc,4CAsChB,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LineChart = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const material_1 = require("@mui/material");
|
|
6
|
+
const styles_1 = require("@mui/material/styles");
|
|
7
|
+
const LineChart_1 = require("@mui/x-charts/LineChart");
|
|
8
|
+
const StyledLineChart = (0, styles_1.styled)(LineChart_1.LineChart)(({ theme }) => ({
|
|
9
|
+
"& .MuiChartsAxis-tick": {
|
|
10
|
+
stroke: theme.palette.text.secondary,
|
|
11
|
+
},
|
|
12
|
+
"& .MuiChartsAxis-line": {
|
|
13
|
+
stroke: theme.palette.divider,
|
|
14
|
+
},
|
|
15
|
+
"& .MuiChartsAxis-tickLabel": {
|
|
16
|
+
fill: theme.palette.text.secondary,
|
|
17
|
+
fontSize: 12,
|
|
18
|
+
},
|
|
19
|
+
"& .MuiChartsLegend-mark": {
|
|
20
|
+
rx: 4,
|
|
21
|
+
},
|
|
22
|
+
}));
|
|
23
|
+
const LineChart = ({ height = 300, width, skipAnimation = false, loading = false, tooltip, series, xAxisData, yAxisLabel, xAxisLabel, hideLegend = false, legendPosition = { horizontal: "right", vertical: "top" }, grid = { horizontal: false, vertical: false }, ...rest }) => {
|
|
24
|
+
if (loading) {
|
|
25
|
+
return (0, jsx_runtime_1.jsx)(material_1.Skeleton, { height: height, width: width, variant: "rectangular" });
|
|
26
|
+
}
|
|
27
|
+
const xAxisConfig = xAxisData
|
|
28
|
+
? [
|
|
29
|
+
{
|
|
30
|
+
data: xAxisData,
|
|
31
|
+
scaleType: "point",
|
|
32
|
+
label: xAxisLabel,
|
|
33
|
+
},
|
|
34
|
+
]
|
|
35
|
+
: undefined;
|
|
36
|
+
const yAxisConfig = yAxisLabel
|
|
37
|
+
? [
|
|
38
|
+
{
|
|
39
|
+
label: yAxisLabel,
|
|
40
|
+
width: 50,
|
|
41
|
+
},
|
|
42
|
+
]
|
|
43
|
+
: undefined;
|
|
44
|
+
return ((0, jsx_runtime_1.jsx)(StyledLineChart, { height: height, width: width, series: series, xAxis: xAxisConfig, yAxis: yAxisConfig, skipAnimation: skipAnimation, tooltip: tooltip, grid: grid, slotProps: { legend: { hidden: hideLegend, position: legendPosition } }, ...rest }));
|
|
45
|
+
};
|
|
46
|
+
exports.LineChart = LineChart;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Charts/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Charts/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC"}
|
|
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./BarChart"), exports);
|
|
18
|
+
__exportStar(require("./LineChart"), exports);
|
|
18
19
|
__exportStar(require("./PieChart"), exports);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { SelectProps as MuiSelectProps } from "@mui/material";
|
|
2
|
+
import { type ControllerRenderProps, type FieldValues, type UseControllerProps } from "react-hook-form";
|
|
3
|
+
export type SelectOption = {
|
|
4
|
+
heading?: string;
|
|
5
|
+
label: string;
|
|
6
|
+
value: string | number;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
employee_code?: string;
|
|
9
|
+
avatar?: string | null;
|
|
10
|
+
punch_code?: string;
|
|
11
|
+
};
|
|
12
|
+
export type SelectProps<P extends FieldValues> = UseControllerProps<P> & Omit<MuiSelectProps, keyof ControllerRenderProps<P> | "multiple" | "value" | "onChange"> & {
|
|
13
|
+
required?: boolean;
|
|
14
|
+
helperText?: string;
|
|
15
|
+
error?: boolean;
|
|
16
|
+
placeholder?: string;
|
|
17
|
+
multiple?: boolean;
|
|
18
|
+
options?: SelectOption[];
|
|
19
|
+
loading?: boolean;
|
|
20
|
+
isShowAvatar?: boolean;
|
|
21
|
+
onAction?: () => void;
|
|
22
|
+
isShowSelectAll?: boolean;
|
|
23
|
+
maxLimit?: number;
|
|
24
|
+
renderOption?: (option: SelectOption, selected: boolean) => JSX.Element;
|
|
25
|
+
maxDisplayItems?: number;
|
|
26
|
+
disableClearable?: boolean;
|
|
27
|
+
};
|
|
28
|
+
export declare function Select<P extends FieldValues>({ control, defaultValue, name, required, multiple, disabled, options, rules, loading, helperText, error, placeholder, isShowSelectAll, isShowAvatar, onAction, renderOption, maxLimit, maxDisplayItems, disableClearable, ...restProps }: SelectProps<P>): import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
//# sourceMappingURL=Select.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../../src/FormFields/Select/Select.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,IAAI,cAAc,EAAE,MAAM,eAAe,CAAC;AAkBnE,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACxB,MAAM,iBAAiB,CAAC;AAOzB,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,WAAW,IAAI,kBAAkB,CAAC,CAAC,CAAC,GACpE,IAAI,CACF,cAAc,EACd,MAAM,qBAAqB,CAAC,CAAC,CAAC,GAAG,UAAU,GAAG,OAAO,GAAG,UAAU,CACnE,GAAG;IACF,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;IACzB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,KAAK,GAAG,CAAC,OAAO,CAAC;IACxE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEJ,wBAAgB,MAAM,CAAC,CAAC,SAAS,WAAW,EAAE,EAC5C,OAAO,EACP,YAAY,EACZ,IAAI,EACJ,QAAgB,EAChB,QAAgB,EAChB,QAAgB,EAChB,OAAY,EACZ,KAAK,EACL,OAAe,EACf,UAAU,EACV,KAAK,EACL,WAAgB,EAChB,eAAsB,EACtB,YAAoB,EACpB,QAAQ,EACR,YAAY,EACZ,QAAQ,EACR,eAAmB,EACnB,gBAA0C,EAC1C,GAAG,SAAS,EACb,EAAE,WAAW,CAAC,CAAC,CAAC,2CA0UhB"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Select = Select;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const material_1 = require("@mui/material");
|
|
6
|
+
const x_date_pickers_1 = require("@mui/x-date-pickers");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const react_hook_form_1 = require("react-hook-form");
|
|
9
|
+
const react_i18next_1 = require("react-i18next");
|
|
10
|
+
const Actions_1 = require("../../Actions");
|
|
11
|
+
const Toast_1 = require("../../Toast");
|
|
12
|
+
const CheckBox_styled_1 = require("../CheckBox/CheckBox.styled");
|
|
13
|
+
const Select_styled_1 = require("./Select.styled");
|
|
14
|
+
function Select({ control, defaultValue, name, required = false, multiple = false, disabled = false, options = [], rules, loading = false, helperText, error, placeholder = "", isShowSelectAll = true, isShowAvatar = false, onAction, renderOption, maxLimit, maxDisplayItems = 2, disableClearable = required ? true : false, ...restProps }) {
|
|
15
|
+
const { field: { onChange, value, ...restField }, } = (0, react_hook_form_1.useController)({
|
|
16
|
+
name,
|
|
17
|
+
control,
|
|
18
|
+
defaultValue,
|
|
19
|
+
rules,
|
|
20
|
+
});
|
|
21
|
+
const { t } = (0, react_i18next_1.useTranslation)();
|
|
22
|
+
const theme = (0, material_1.useTheme)();
|
|
23
|
+
const { slate } = theme.palette.app.color;
|
|
24
|
+
const handleSelectAll = (isSelected) => {
|
|
25
|
+
if (isSelected) {
|
|
26
|
+
const allValues = options
|
|
27
|
+
.filter((option) => !option.disabled)
|
|
28
|
+
.map((option) => option.value);
|
|
29
|
+
onChange(allValues);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
onChange([]);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
const isAllSelected = (0, react_1.useMemo)(() => {
|
|
36
|
+
if (!multiple || !isShowSelectAll || !Array.isArray(value)) {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
const selectableOptions = options.filter((option) => !option.disabled);
|
|
40
|
+
return value.length === selectableOptions.length;
|
|
41
|
+
}, [multiple, isShowSelectAll, options, value]);
|
|
42
|
+
const selectedOptions = (0, react_1.useMemo)(() => {
|
|
43
|
+
if (!multiple || !Array.isArray(value)) {
|
|
44
|
+
return [];
|
|
45
|
+
}
|
|
46
|
+
return options.filter((option) => value.includes(option.value));
|
|
47
|
+
}, [multiple, options, value]);
|
|
48
|
+
const renderValue = (selected) => {
|
|
49
|
+
if (!multiple) {
|
|
50
|
+
const selectedOption = options.find((option) => option.value === selected);
|
|
51
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [isShowAvatar && selectedOption?.avatar && ((0, jsx_runtime_1.jsx)(material_1.Avatar, { src: selectedOption.avatar ?? "", sx: { width: 20, height: 20 } })), (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", noWrap: true, children: selectedOption ? selectedOption.label : placeholder })] }));
|
|
52
|
+
}
|
|
53
|
+
if (!Array.isArray(selected) || selected.length === 0) {
|
|
54
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", noWrap: true, children: placeholder }));
|
|
55
|
+
}
|
|
56
|
+
const visibleItems = selectedOptions.slice(0, maxDisplayItems);
|
|
57
|
+
const overflowCount = selectedOptions.length - maxDisplayItems;
|
|
58
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
|
|
59
|
+
display: "flex",
|
|
60
|
+
alignItems: "center",
|
|
61
|
+
gap: 0.5,
|
|
62
|
+
overflow: "hidden",
|
|
63
|
+
}, children: [visibleItems.map((option) => ((0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", noWrap: true, sx: {
|
|
64
|
+
backgroundColor: slate[800],
|
|
65
|
+
padding: "2px 5px",
|
|
66
|
+
borderRadius: "12px",
|
|
67
|
+
fontSize: "12px",
|
|
68
|
+
maxWidth: "120px",
|
|
69
|
+
}, children: option.label }, option.value))), overflowCount > 0 && ((0, jsx_runtime_1.jsxs)(material_1.Typography, { variant: "body2", sx: {
|
|
70
|
+
backgroundColor: slate[300],
|
|
71
|
+
padding: "2px 5px",
|
|
72
|
+
borderRadius: "12px",
|
|
73
|
+
fontSize: "12px",
|
|
74
|
+
fontWeight: 500,
|
|
75
|
+
}, children: ["+", overflowCount] }))] }));
|
|
76
|
+
};
|
|
77
|
+
const groupedOptions = (0, react_1.useMemo)(() => {
|
|
78
|
+
const groups = {};
|
|
79
|
+
options.forEach((option) => {
|
|
80
|
+
const groupKey = option.heading ?? "";
|
|
81
|
+
if (!groups[groupKey]) {
|
|
82
|
+
groups[groupKey] = [];
|
|
83
|
+
}
|
|
84
|
+
groups[groupKey].push(option);
|
|
85
|
+
});
|
|
86
|
+
return groups;
|
|
87
|
+
}, [options]);
|
|
88
|
+
if (loading) {
|
|
89
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { height: "40px", sx: {
|
|
90
|
+
transform: "scale(1)",
|
|
91
|
+
} }));
|
|
92
|
+
}
|
|
93
|
+
const renderMenuItems = () => {
|
|
94
|
+
const items = [];
|
|
95
|
+
if (multiple && isShowSelectAll && options.length > 0) {
|
|
96
|
+
items.push((0, jsx_runtime_1.jsxs)(material_1.MenuItem, { value: "select-all", children: [(0, jsx_runtime_1.jsx)(material_1.Checkbox, { icon: (0, jsx_runtime_1.jsx)(CheckBox_styled_1.BoxStyled, { size: "small" }), checkedIcon: (0, jsx_runtime_1.jsx)(CheckBox_styled_1.CheckStyled, { size: "small" }), indeterminate: !isAllSelected && Array.isArray(value) && value.length > 0, checked: isAllSelected, sx: { marginRight: 1 } }), (0, jsx_runtime_1.jsx)(material_1.ListItemText, { primary: "Select All" })] }, "select-all"));
|
|
97
|
+
items.push((0, jsx_runtime_1.jsx)(material_1.Divider, { sx: { margin: "0px !important" } }, "divider-select-all"));
|
|
98
|
+
}
|
|
99
|
+
Object.entries(groupedOptions).forEach(([groupName, groupOptions]) => {
|
|
100
|
+
if (groupName) {
|
|
101
|
+
items.push((0, jsx_runtime_1.jsx)(Select_styled_1.GroupHeader, { children: groupName }, `group-${groupName}`));
|
|
102
|
+
}
|
|
103
|
+
groupOptions.forEach((option) => {
|
|
104
|
+
const isSelected = multiple
|
|
105
|
+
? Array.isArray(value) && value.includes(option.value)
|
|
106
|
+
: value === option.value;
|
|
107
|
+
items.push((0, jsx_runtime_1.jsx)(material_1.MenuItem, { value: option.value, disabled: option.disabled, children: renderOption ? (renderOption(option, isSelected)) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [multiple && ((0, jsx_runtime_1.jsx)(material_1.Checkbox, { icon: (0, jsx_runtime_1.jsx)(CheckBox_styled_1.BoxStyled, { size: "small" }), checkedIcon: (0, jsx_runtime_1.jsx)(CheckBox_styled_1.CheckStyled, { size: "small" }), checked: isSelected, sx: { marginRight: 1 } })), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [isShowAvatar && option.avatar && ((0, jsx_runtime_1.jsx)(material_1.Avatar, { src: option.avatar, alt: option.label, sx: { width: 24, height: 24 } })), (0, jsx_runtime_1.jsx)(material_1.ListItemText, { primary: option.label })] })] })) }, option.value));
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
return items;
|
|
111
|
+
};
|
|
112
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Stack, { gap: "10px", children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", justifyContent: "space-between", gap: "10px", alignItems: "start", children: [(0, jsx_runtime_1.jsxs)(Select_styled_1.StyledFormControl, { fullWidth: true, error: error, disabled: disabled, required: required, children: [(0, jsx_runtime_1.jsx)(material_1.Select, { ...restField, ...restProps, multiple: multiple, value: value || (multiple ? [] : ""), onChange: (event) => {
|
|
113
|
+
const newValue = event.target.value;
|
|
114
|
+
if (multiple && Array.isArray(newValue)) {
|
|
115
|
+
// Handle Select All
|
|
116
|
+
const isSelectAllIncluded = newValue.includes("select-all");
|
|
117
|
+
if (isSelectAllIncluded) {
|
|
118
|
+
handleSelectAll(!isAllSelected);
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
if (maxLimit && newValue.length > maxLimit) {
|
|
122
|
+
Toast_1.toasts.error({
|
|
123
|
+
title: t("common.select.limitExceed", { maxLimit }),
|
|
124
|
+
});
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
onChange(newValue);
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
onChange(newValue);
|
|
131
|
+
}
|
|
132
|
+
}, renderValue: renderValue,
|
|
133
|
+
// eslint-disable-next-line sonarjs/no-unstable-nested-components
|
|
134
|
+
IconComponent: (props) => ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
|
|
135
|
+
display: "flex",
|
|
136
|
+
alignItems: "center",
|
|
137
|
+
gap: 0.5,
|
|
138
|
+
pr: 2.5,
|
|
139
|
+
}, children: [value &&
|
|
140
|
+
((Array.isArray(value) && value.length > 0) ||
|
|
141
|
+
(!Array.isArray(value) && value !== "")) &&
|
|
142
|
+
!disableClearable && ((0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "small", onClick: (e) => {
|
|
143
|
+
e.stopPropagation();
|
|
144
|
+
onChange(multiple ? [] : "");
|
|
145
|
+
}, children: (0, jsx_runtime_1.jsx)(x_date_pickers_1.ClearIcon, { sx: { fontSize: "14px" } }) })), (0, jsx_runtime_1.jsx)(x_date_pickers_1.ArrowDropDownIcon, { ...props })] })), displayEmpty: true, MenuProps: {
|
|
146
|
+
PaperProps: {
|
|
147
|
+
sx: {
|
|
148
|
+
width: "inherit",
|
|
149
|
+
maxHeight: 300,
|
|
150
|
+
"& .MuiList-root": {
|
|
151
|
+
paddingTop: 0,
|
|
152
|
+
paddingBottom: 0,
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
}, children: Object.entries(groupedOptions).length ? (renderMenuItems()) : ((0, jsx_runtime_1.jsx)(material_1.MenuItem, { disabled: true, children: (0, jsx_runtime_1.jsx)(material_1.ListItemText, { primary: "No options" }) })) }), helperText && (0, jsx_runtime_1.jsx)(material_1.FormHelperText, { children: helperText })] }), onAction && (0, jsx_runtime_1.jsx)(Actions_1.EditIconAction, { disabled: disabled, onClick: onAction })] }) }));
|
|
157
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { FormControlProps } from "@mui/material/FormControl";
|
|
2
|
+
import type { TypographyProps } from "@mui/material/Typography";
|
|
3
|
+
export declare const StyledFormControl: React.FC<FormControlProps>;
|
|
4
|
+
export declare const GroupHeader: React.FC<TypographyProps>;
|
|
5
|
+
//# sourceMappingURL=Select.styled.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Select.styled.d.ts","sourceRoot":"","sources":["../../../src/FormFields/Select/Select.styled.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAElE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAEhE,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CA6BvD,CAAC;AAEH,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAiBhD,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GroupHeader = exports.StyledFormControl = void 0;
|
|
4
|
+
const material_1 = require("@mui/material");
|
|
5
|
+
const styles_1 = require("@mui/material/styles");
|
|
6
|
+
exports.StyledFormControl = (0, styles_1.styled)(material_1.FormControl)(({ theme }) => {
|
|
7
|
+
const { lightBlue, iron } = theme.palette.app.color;
|
|
8
|
+
const styles = {
|
|
9
|
+
"& .MuiInputBase-root": {
|
|
10
|
+
backgroundColor: iron[600],
|
|
11
|
+
},
|
|
12
|
+
"& .MuiSelect-select": {
|
|
13
|
+
display: "flex",
|
|
14
|
+
alignItems: "center",
|
|
15
|
+
gap: "8px",
|
|
16
|
+
flexWrap: "nowrap",
|
|
17
|
+
overflow: "hidden",
|
|
18
|
+
},
|
|
19
|
+
"& .MuiList-root": {
|
|
20
|
+
maxHeight: 300,
|
|
21
|
+
overflowY: "auto",
|
|
22
|
+
"&::-webkit-scrollbar": {
|
|
23
|
+
width: "6px",
|
|
24
|
+
},
|
|
25
|
+
"&::-webkit-scrollbar-track": {
|
|
26
|
+
backgroundColor: lightBlue[100],
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
return styles;
|
|
31
|
+
});
|
|
32
|
+
exports.GroupHeader = (0, styles_1.styled)(material_1.Typography)(({ theme, }) => {
|
|
33
|
+
const { butterflyBlue } = theme.palette.app.color;
|
|
34
|
+
const styles = {
|
|
35
|
+
position: "sticky",
|
|
36
|
+
top: 0,
|
|
37
|
+
padding: "8px 16px",
|
|
38
|
+
fontSize: "14px",
|
|
39
|
+
fontWeight: 600,
|
|
40
|
+
color: butterflyBlue[900],
|
|
41
|
+
backgroundColor: butterflyBlue[500],
|
|
42
|
+
zIndex: 1,
|
|
43
|
+
};
|
|
44
|
+
return styles;
|
|
45
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/FormFields/Select/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./Select"), exports);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export * from "./Autocomplete";
|
|
2
2
|
export * from "./CheckBox";
|
|
3
3
|
export * from "./DatePicker";
|
|
4
|
-
export * from "./DateRangeSelector";
|
|
5
4
|
export * from "./DateRangePicker";
|
|
5
|
+
export * from "./DateRangeSelector";
|
|
6
6
|
export * from "./DateTimePicker";
|
|
7
7
|
export * from "./FileUpload";
|
|
8
8
|
export * from "./ImageUpload";
|
|
@@ -11,6 +11,7 @@ export * from "./PasswordField";
|
|
|
11
11
|
export * from "./PhoneInputField";
|
|
12
12
|
export * from "./RadioGroupField";
|
|
13
13
|
export * from "./SearchField";
|
|
14
|
+
export * from "./Select";
|
|
14
15
|
export * from "./SwitchField";
|
|
15
16
|
export * from "./TextField";
|
|
16
17
|
export * from "./TimeField";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/FormFields/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/FormFields/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
|
|
@@ -17,8 +17,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./Autocomplete"), exports);
|
|
18
18
|
__exportStar(require("./CheckBox"), exports);
|
|
19
19
|
__exportStar(require("./DatePicker"), exports);
|
|
20
|
-
__exportStar(require("./DateRangeSelector"), exports);
|
|
21
20
|
__exportStar(require("./DateRangePicker"), exports);
|
|
21
|
+
__exportStar(require("./DateRangeSelector"), exports);
|
|
22
22
|
__exportStar(require("./DateTimePicker"), exports);
|
|
23
23
|
__exportStar(require("./FileUpload"), exports);
|
|
24
24
|
__exportStar(require("./ImageUpload"), exports);
|
|
@@ -27,6 +27,7 @@ __exportStar(require("./PasswordField"), exports);
|
|
|
27
27
|
__exportStar(require("./PhoneInputField"), exports);
|
|
28
28
|
__exportStar(require("./RadioGroupField"), exports);
|
|
29
29
|
__exportStar(require("./SearchField"), exports);
|
|
30
|
+
__exportStar(require("./Select"), exports);
|
|
30
31
|
__exportStar(require("./SwitchField"), exports);
|
|
31
32
|
__exportStar(require("./TextField"), exports);
|
|
32
33
|
__exportStar(require("./TimeField"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormRow.styled.d.ts","sourceRoot":"","sources":["../../../src/Layouts/FormRow/FormRow.styled.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAGhD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAmB3C,KAAK,uBAAuB,GAAG,UAAU,GAAG;IAC1C,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,aAAa,CAAC,uBAAuB,
|
|
1
|
+
{"version":3,"file":"FormRow.styled.d.ts","sourceRoot":"","sources":["../../../src/Layouts/FormRow/FormRow.styled.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAGhD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAmB3C,KAAK,uBAAuB,GAAG,UAAU,GAAG;IAC1C,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,aAAa,CAAC,uBAAuB,CAuBlE,CAAC"}
|
|
@@ -17,12 +17,15 @@ exports.RowContainerStyled = (0, styles_1.styled)(material_1.Stack, {
|
|
|
17
17
|
shouldForwardProp(prop) {
|
|
18
18
|
return prop !== "fullWidth" && prop !== "maxColumn";
|
|
19
19
|
},
|
|
20
|
-
})(({ children, fullWidth, maxColumn, }) => {
|
|
20
|
+
})(({ theme, children, fullWidth, maxColumn, }) => {
|
|
21
21
|
const childrenCount = react_1.Children.toArray(children).length;
|
|
22
22
|
const flexBasis = calculateWidth(childrenCount, fullWidth, maxColumn);
|
|
23
23
|
return {
|
|
24
24
|
"& > *": {
|
|
25
25
|
flexBasis,
|
|
26
|
+
[theme.breakpoints.down("sm")]: {
|
|
27
|
+
flexBasis: "100%",
|
|
28
|
+
},
|
|
26
29
|
},
|
|
27
30
|
};
|
|
28
31
|
});
|