@mamrp/components 1.0.6 → 1.0.9
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/index.d.mts +18 -9
- package/dist/index.d.ts +18 -9
- package/dist/index.js +181 -125
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +174 -119
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -570,7 +570,6 @@ function MultipleSelectChip({
|
|
|
570
570
|
{
|
|
571
571
|
disableClearable: clear,
|
|
572
572
|
disabled: disabled || isLoading,
|
|
573
|
-
disablePortal: true,
|
|
574
573
|
size,
|
|
575
574
|
disableCloseOnSelect: multipleitems,
|
|
576
575
|
options: combinedOptions,
|
|
@@ -2964,91 +2963,15 @@ function HorizontalStepper({
|
|
|
2964
2963
|
)))));
|
|
2965
2964
|
}
|
|
2966
2965
|
|
|
2967
|
-
// src/switch-button/index.tsx
|
|
2968
|
-
import { Box as Box16, FormControlLabel as FormControlLabel3, Switch } from "@mui/material";
|
|
2969
|
-
import { styled as styled2 } from "@mui/system";
|
|
2970
|
-
import React21 from "react";
|
|
2971
|
-
var CustomSwitch = styled2(Switch)(({ theme }) => ({
|
|
2972
|
-
"& .MuiSwitch-switchBase.Mui-checked": {
|
|
2973
|
-
color: theme.palette.primary.main
|
|
2974
|
-
},
|
|
2975
|
-
"& .MuiSwitch-switchBase": {
|
|
2976
|
-
color: "#757575"
|
|
2977
|
-
},
|
|
2978
|
-
"& .MuiSwitch-track": {
|
|
2979
|
-
backgroundColor: "#E0E0E0"
|
|
2980
|
-
},
|
|
2981
|
-
"& .MuiSwitch-track.Mui-checked": {
|
|
2982
|
-
backgroundColor: theme.palette.primary.light
|
|
2983
|
-
}
|
|
2984
|
-
}));
|
|
2985
|
-
var BoxContainer = styled2(Box16)(({ theme }) => ({
|
|
2986
|
-
display: "flex",
|
|
2987
|
-
alignItems: "center",
|
|
2988
|
-
padding: "5px",
|
|
2989
|
-
backgroundColor: "#fafafa",
|
|
2990
|
-
borderRadius: "10px",
|
|
2991
|
-
transition: "all 0.3s ease",
|
|
2992
|
-
"&:hover": {
|
|
2993
|
-
backgroundColor: theme.palette.action.hover
|
|
2994
|
-
},
|
|
2995
|
-
// Conditionally apply smaller padding for mobile devices
|
|
2996
|
-
"@media (max-width:700px)": {
|
|
2997
|
-
padding: "0px"
|
|
2998
|
-
// Smaller padding for mobile
|
|
2999
|
-
}
|
|
3000
|
-
}));
|
|
3001
|
-
var LabelContainer = styled2("div")({
|
|
3002
|
-
display: "flex",
|
|
3003
|
-
alignItems: "center",
|
|
3004
|
-
justifyContent: "center",
|
|
3005
|
-
fontSize: "16px",
|
|
3006
|
-
fontWeight: "100",
|
|
3007
|
-
color: "#333",
|
|
3008
|
-
marginLeft: "8px",
|
|
3009
|
-
transition: "all 0.2s ease",
|
|
3010
|
-
// Conditionally apply smaller font size and margin for mobile devices
|
|
3011
|
-
"@media (max-width:700px)": {
|
|
3012
|
-
fontSize: "14px",
|
|
3013
|
-
// Smaller font size for mobile
|
|
3014
|
-
marginLeft: "2px",
|
|
3015
|
-
// Smaller margin for mobile
|
|
3016
|
-
marginRight: "0px"
|
|
3017
|
-
// Smaller
|
|
3018
|
-
}
|
|
3019
|
-
});
|
|
3020
|
-
var SwitchWithIcons = ({
|
|
3021
|
-
checked,
|
|
3022
|
-
handleChange,
|
|
3023
|
-
iconChecked,
|
|
3024
|
-
iconUnchecked
|
|
3025
|
-
}) => {
|
|
3026
|
-
return /* @__PURE__ */ React21.createElement(BoxContainer, null, /* @__PURE__ */ React21.createElement(
|
|
3027
|
-
FormControlLabel3,
|
|
3028
|
-
{
|
|
3029
|
-
control: /* @__PURE__ */ React21.createElement(
|
|
3030
|
-
CustomSwitch,
|
|
3031
|
-
{
|
|
3032
|
-
checked,
|
|
3033
|
-
onChange: handleChange,
|
|
3034
|
-
name: "switch"
|
|
3035
|
-
}
|
|
3036
|
-
),
|
|
3037
|
-
label: /* @__PURE__ */ React21.createElement(LabelContainer, null, checked ? iconChecked ? iconChecked : /* @__PURE__ */ React21.createElement("div", { style: { fontSize: 22, color: "#4CAF50" } }, "\u2714") : iconUnchecked ? iconUnchecked : /* @__PURE__ */ React21.createElement("div", { style: { fontSize: 20, color: "#757575" } }, "\u2718"))
|
|
3038
|
-
}
|
|
3039
|
-
));
|
|
3040
|
-
};
|
|
3041
|
-
var switch_button_default = SwitchWithIcons;
|
|
3042
|
-
|
|
3043
2966
|
// src/table/index.tsx
|
|
3044
2967
|
import { Typography as Typography11 } from "@mui/material";
|
|
3045
2968
|
import Skeleton2 from "@mui/material/Skeleton";
|
|
3046
|
-
import { styled as
|
|
2969
|
+
import { styled as styled2 } from "@mui/material/styles";
|
|
3047
2970
|
import {
|
|
3048
2971
|
DataGrid
|
|
3049
2972
|
} from "@mui/x-data-grid";
|
|
3050
|
-
import
|
|
3051
|
-
var ScrollableContainer =
|
|
2973
|
+
import React21, { useEffect as useEffect8 } from "react";
|
|
2974
|
+
var ScrollableContainer = styled2("div")({
|
|
3052
2975
|
width: "100%",
|
|
3053
2976
|
overflowX: "auto"
|
|
3054
2977
|
// Enable horizontal scrolling
|
|
@@ -3073,7 +2996,7 @@ var Table = ({
|
|
|
3073
2996
|
fontSize,
|
|
3074
2997
|
...rest
|
|
3075
2998
|
}) => {
|
|
3076
|
-
const [sortModel, setSortModel] =
|
|
2999
|
+
const [sortModel, setSortModel] = React21.useState([]);
|
|
3077
3000
|
const handleSetQueryOptions = (options) => {
|
|
3078
3001
|
if (!Array.isArray(options)) return;
|
|
3079
3002
|
const formattedOptions = options.reduce((acc, item) => {
|
|
@@ -3101,7 +3024,7 @@ var Table = ({
|
|
|
3101
3024
|
setSortModel([]);
|
|
3102
3025
|
}
|
|
3103
3026
|
}, [sortQuery]);
|
|
3104
|
-
const handleSortModelChange =
|
|
3027
|
+
const handleSortModelChange = React21.useCallback(
|
|
3105
3028
|
(sortModel2) => {
|
|
3106
3029
|
handleSetQueryOptions(
|
|
3107
3030
|
sortModel2.map((item) => ({
|
|
@@ -3141,7 +3064,7 @@ var Table = ({
|
|
|
3141
3064
|
// Connect paginationModel to DataGrid
|
|
3142
3065
|
}
|
|
3143
3066
|
};
|
|
3144
|
-
return /* @__PURE__ */
|
|
3067
|
+
return /* @__PURE__ */ React21.createElement(ScrollableContainer, null, /* @__PURE__ */ React21.createElement(
|
|
3145
3068
|
DataGrid,
|
|
3146
3069
|
{
|
|
3147
3070
|
rows,
|
|
@@ -3186,14 +3109,14 @@ var Table = ({
|
|
|
3186
3109
|
noRowsLabel: "\u0647\u06CC\u0686 \u062F\u0627\u062F\u0647\u200C\u0627\u06CC \u06CC\u0627\u0641\u062A \u0646\u0634\u062F!",
|
|
3187
3110
|
noResultsOverlayLabel: "\u0647\u06CC\u0686 \u062F\u0627\u062F\u0647\u200C\u0627\u06CC \u06CC\u0627\u0641\u062A \u0646\u0634\u062F!",
|
|
3188
3111
|
MuiTablePagination: {
|
|
3189
|
-
labelDisplayedRows: ({ from, to, count }) => loading ? /* @__PURE__ */
|
|
3112
|
+
labelDisplayedRows: ({ from, to, count }) => loading ? /* @__PURE__ */ React21.createElement(React21.Fragment, null, /* @__PURE__ */ React21.createElement(
|
|
3190
3113
|
Skeleton2,
|
|
3191
3114
|
{
|
|
3192
3115
|
variant: "text",
|
|
3193
3116
|
width: 30,
|
|
3194
3117
|
style: { display: "inline-block" }
|
|
3195
3118
|
}
|
|
3196
|
-
), " ", /* @__PURE__ */
|
|
3119
|
+
), " ", /* @__PURE__ */ React21.createElement(
|
|
3197
3120
|
Skeleton2,
|
|
3198
3121
|
{
|
|
3199
3122
|
variant: "text",
|
|
@@ -3202,7 +3125,7 @@ var Table = ({
|
|
|
3202
3125
|
}
|
|
3203
3126
|
)) : `${from} - ${!isNaN(to) ? to : "..."} \u0627\u0632 ${count !== void 0 ? count : "..."}`
|
|
3204
3127
|
},
|
|
3205
|
-
footerRowSelected: (count) => /* @__PURE__ */
|
|
3128
|
+
footerRowSelected: (count) => /* @__PURE__ */ React21.createElement(Typography11, null, "\u0633\u0637\u0631 \u0647\u0627\u06CC \u0627\u0646\u062A\u062E\u0627\u0628 \u0634\u062F\u0647 : ", count)
|
|
3206
3129
|
},
|
|
3207
3130
|
...rest
|
|
3208
3131
|
}
|
|
@@ -3217,7 +3140,7 @@ import { Controller as Controller8 } from "react-hook-form";
|
|
|
3217
3140
|
import { NumericFormat } from "react-number-format";
|
|
3218
3141
|
import CircularProgress3 from "@mui/material/CircularProgress";
|
|
3219
3142
|
import InputAdornment2 from "@mui/material/InputAdornment";
|
|
3220
|
-
import
|
|
3143
|
+
import React22 from "react";
|
|
3221
3144
|
var FormInputNumber = ({
|
|
3222
3145
|
name,
|
|
3223
3146
|
control,
|
|
@@ -3235,13 +3158,13 @@ var FormInputNumber = ({
|
|
|
3235
3158
|
decimalScale = 2,
|
|
3236
3159
|
...rest
|
|
3237
3160
|
}) => {
|
|
3238
|
-
return /* @__PURE__ */
|
|
3161
|
+
return /* @__PURE__ */ React22.createElement(
|
|
3239
3162
|
Controller8,
|
|
3240
3163
|
{
|
|
3241
3164
|
rules,
|
|
3242
3165
|
name,
|
|
3243
3166
|
control,
|
|
3244
|
-
render: ({ field: { onChange, value, ref }, fieldState: { error } }) => /* @__PURE__ */
|
|
3167
|
+
render: ({ field: { onChange, value, ref }, fieldState: { error } }) => /* @__PURE__ */ React22.createElement(
|
|
3245
3168
|
TextField3,
|
|
3246
3169
|
{
|
|
3247
3170
|
disabled: isLoading,
|
|
@@ -3281,7 +3204,7 @@ var FormInputNumber = ({
|
|
|
3281
3204
|
maxLength,
|
|
3282
3205
|
decimalScale
|
|
3283
3206
|
},
|
|
3284
|
-
endAdornment: isLoading ? /* @__PURE__ */
|
|
3207
|
+
endAdornment: isLoading ? /* @__PURE__ */ React22.createElement(InputAdornment2, { position: "end" }, /* @__PURE__ */ React22.createElement(CircularProgress3, { size: 20 })) : null,
|
|
3285
3208
|
startAdornment
|
|
3286
3209
|
},
|
|
3287
3210
|
...rest
|
|
@@ -3301,7 +3224,7 @@ var NumericFormatCustom = forwardRef(
|
|
|
3301
3224
|
decimalScale,
|
|
3302
3225
|
...other
|
|
3303
3226
|
} = props;
|
|
3304
|
-
return /* @__PURE__ */
|
|
3227
|
+
return /* @__PURE__ */ React22.createElement(
|
|
3305
3228
|
NumericFormat,
|
|
3306
3229
|
{
|
|
3307
3230
|
...other,
|
|
@@ -3332,7 +3255,7 @@ var number_type_default = FormInputNumber;
|
|
|
3332
3255
|
import CircularProgress4 from "@mui/material/CircularProgress";
|
|
3333
3256
|
import InputAdornment3 from "@mui/material/InputAdornment";
|
|
3334
3257
|
import TextField4 from "@mui/material/TextField";
|
|
3335
|
-
import
|
|
3258
|
+
import React23 from "react";
|
|
3336
3259
|
import { Controller as Controller9 } from "react-hook-form";
|
|
3337
3260
|
var FormInputText = ({
|
|
3338
3261
|
name,
|
|
@@ -3349,13 +3272,13 @@ var FormInputText = ({
|
|
|
3349
3272
|
rows,
|
|
3350
3273
|
...rest
|
|
3351
3274
|
}) => {
|
|
3352
|
-
return /* @__PURE__ */
|
|
3275
|
+
return /* @__PURE__ */ React23.createElement(
|
|
3353
3276
|
Controller9,
|
|
3354
3277
|
{
|
|
3355
3278
|
name,
|
|
3356
3279
|
control,
|
|
3357
3280
|
rules,
|
|
3358
|
-
render: ({ field: { onChange, value, ref }, fieldState: { error } }) => /* @__PURE__ */
|
|
3281
|
+
render: ({ field: { onChange, value, ref }, fieldState: { error } }) => /* @__PURE__ */ React23.createElement(
|
|
3359
3282
|
TextField4,
|
|
3360
3283
|
{
|
|
3361
3284
|
disabled: disabled || isLoading,
|
|
@@ -3375,7 +3298,7 @@ var FormInputText = ({
|
|
|
3375
3298
|
readOnly
|
|
3376
3299
|
},
|
|
3377
3300
|
InputProps: {
|
|
3378
|
-
endAdornment: isLoading ? /* @__PURE__ */
|
|
3301
|
+
endAdornment: isLoading ? /* @__PURE__ */ React23.createElement(InputAdornment3, { position: "end" }, /* @__PURE__ */ React23.createElement(CircularProgress4, { size: 20 })) : null
|
|
3379
3302
|
},
|
|
3380
3303
|
InputLabelProps: { shrink: true },
|
|
3381
3304
|
inputRef: ref,
|
|
@@ -3388,11 +3311,11 @@ var FormInputText = ({
|
|
|
3388
3311
|
var text_type_default = FormInputText;
|
|
3389
3312
|
|
|
3390
3313
|
// src/upload-image/index.tsx
|
|
3391
|
-
import
|
|
3314
|
+
import React24 from "react";
|
|
3392
3315
|
import {
|
|
3393
3316
|
Controller as Controller10
|
|
3394
3317
|
} from "react-hook-form";
|
|
3395
|
-
import { Box as
|
|
3318
|
+
import { Box as Box16, Button as Button11, Stack as Stack5, Typography as Typography12 } from "@mui/material";
|
|
3396
3319
|
import { GrUpload, GrGallery } from "react-icons/gr";
|
|
3397
3320
|
import { MdOutlineCameraAlt } from "react-icons/md";
|
|
3398
3321
|
import Image3 from "next/image";
|
|
@@ -3465,12 +3388,12 @@ var UploadImage = ({
|
|
|
3465
3388
|
}
|
|
3466
3389
|
}
|
|
3467
3390
|
};
|
|
3468
|
-
return /* @__PURE__ */
|
|
3391
|
+
return /* @__PURE__ */ React24.createElement(
|
|
3469
3392
|
Controller10,
|
|
3470
3393
|
{
|
|
3471
3394
|
name,
|
|
3472
3395
|
control,
|
|
3473
|
-
render: ({ field }) => /* @__PURE__ */
|
|
3396
|
+
render: ({ field }) => /* @__PURE__ */ React24.createElement(React24.Fragment, null, /* @__PURE__ */ React24.createElement(
|
|
3474
3397
|
"label",
|
|
3475
3398
|
{
|
|
3476
3399
|
htmlFor: "file-upload",
|
|
@@ -3490,7 +3413,7 @@ var UploadImage = ({
|
|
|
3490
3413
|
overflow: "hidden"
|
|
3491
3414
|
}
|
|
3492
3415
|
},
|
|
3493
|
-
selectedImage ? /* @__PURE__ */
|
|
3416
|
+
selectedImage ? /* @__PURE__ */ React24.createElement(
|
|
3494
3417
|
Image3,
|
|
3495
3418
|
{
|
|
3496
3419
|
src: selectedImage,
|
|
@@ -3498,14 +3421,14 @@ var UploadImage = ({
|
|
|
3498
3421
|
fill: true,
|
|
3499
3422
|
objectFit: imageFit
|
|
3500
3423
|
}
|
|
3501
|
-
) : /* @__PURE__ */
|
|
3424
|
+
) : /* @__PURE__ */ React24.createElement(
|
|
3502
3425
|
Stack5,
|
|
3503
3426
|
{
|
|
3504
3427
|
spacing: allowGallery ? 2 : 0,
|
|
3505
3428
|
sx: { pt: allowGallery ? 2 : 0 }
|
|
3506
3429
|
},
|
|
3507
|
-
/* @__PURE__ */
|
|
3508
|
-
|
|
3430
|
+
/* @__PURE__ */ React24.createElement(
|
|
3431
|
+
Box16,
|
|
3509
3432
|
{
|
|
3510
3433
|
sx: {
|
|
3511
3434
|
display: "flex",
|
|
@@ -3514,31 +3437,31 @@ var UploadImage = ({
|
|
|
3514
3437
|
gap: 1.5
|
|
3515
3438
|
}
|
|
3516
3439
|
},
|
|
3517
|
-
/* @__PURE__ */
|
|
3440
|
+
/* @__PURE__ */ React24.createElement(Box16, { sx: { paddingBottom: "0.5rem" } }, /* @__PURE__ */ React24.createElement(GrUpload, null)),
|
|
3518
3441
|
placeholder
|
|
3519
3442
|
),
|
|
3520
|
-
allowGallery && /* @__PURE__ */
|
|
3443
|
+
allowGallery && /* @__PURE__ */ React24.createElement(Stack5, { spacing: 1.5 }, /* @__PURE__ */ React24.createElement(
|
|
3521
3444
|
Button11,
|
|
3522
3445
|
{
|
|
3523
3446
|
sx: { width: "9rem" },
|
|
3524
3447
|
variant: "outlined",
|
|
3525
3448
|
color: "info",
|
|
3526
|
-
startIcon: /* @__PURE__ */
|
|
3449
|
+
startIcon: /* @__PURE__ */ React24.createElement(MdOutlineCameraAlt, { size: 16 }),
|
|
3527
3450
|
onClick: () => document.getElementById("camera-upload")?.click()
|
|
3528
3451
|
},
|
|
3529
3452
|
"\u0628\u0627\u0631\u06AF\u0630\u0627\u0631\u06CC \u0627\u0632 \u062F\u0648\u0631\u0628\u06CC\u0646"
|
|
3530
|
-
), /* @__PURE__ */
|
|
3453
|
+
), /* @__PURE__ */ React24.createElement(
|
|
3531
3454
|
Button11,
|
|
3532
3455
|
{
|
|
3533
3456
|
sx: { width: "9rem" },
|
|
3534
3457
|
variant: "outlined",
|
|
3535
3458
|
color: "info",
|
|
3536
|
-
startIcon: /* @__PURE__ */
|
|
3459
|
+
startIcon: /* @__PURE__ */ React24.createElement(GrGallery, { size: 16 }),
|
|
3537
3460
|
onClick: () => document.getElementById("gallery-upload")?.click()
|
|
3538
3461
|
},
|
|
3539
3462
|
"\u0628\u0627\u0631\u06AF\u0630\u0627\u0631\u06CC \u0627\u0632 \u06AF\u0627\u0644\u0631\u06CC"
|
|
3540
3463
|
)),
|
|
3541
|
-
!allowGallery && /* @__PURE__ */
|
|
3464
|
+
!allowGallery && /* @__PURE__ */ React24.createElement(
|
|
3542
3465
|
"input",
|
|
3543
3466
|
{
|
|
3544
3467
|
id: "file-upload",
|
|
@@ -3553,7 +3476,7 @@ var UploadImage = ({
|
|
|
3553
3476
|
}
|
|
3554
3477
|
)
|
|
3555
3478
|
)
|
|
3556
|
-
), /* @__PURE__ */
|
|
3479
|
+
), /* @__PURE__ */ React24.createElement(
|
|
3557
3480
|
"input",
|
|
3558
3481
|
{
|
|
3559
3482
|
id: "gallery-upload",
|
|
@@ -3565,7 +3488,7 @@ var UploadImage = ({
|
|
|
3565
3488
|
},
|
|
3566
3489
|
style: { display: "none" }
|
|
3567
3490
|
}
|
|
3568
|
-
), /* @__PURE__ */
|
|
3491
|
+
), /* @__PURE__ */ React24.createElement(
|
|
3569
3492
|
"input",
|
|
3570
3493
|
{
|
|
3571
3494
|
id: "camera-upload",
|
|
@@ -3578,12 +3501,12 @@ var UploadImage = ({
|
|
|
3578
3501
|
},
|
|
3579
3502
|
style: { display: "none" }
|
|
3580
3503
|
}
|
|
3581
|
-
), selectedImage && /* @__PURE__ */
|
|
3582
|
-
|
|
3504
|
+
), selectedImage && /* @__PURE__ */ React24.createElement(
|
|
3505
|
+
Box16,
|
|
3583
3506
|
{
|
|
3584
3507
|
sx: { display: "flex", justifyContent: "center", marginTop: 2 }
|
|
3585
3508
|
},
|
|
3586
|
-
/* @__PURE__ */
|
|
3509
|
+
/* @__PURE__ */ React24.createElement(
|
|
3587
3510
|
Button11,
|
|
3588
3511
|
{
|
|
3589
3512
|
onClick: () => {
|
|
@@ -3603,14 +3526,14 @@ var UploadImage = ({
|
|
|
3603
3526
|
},
|
|
3604
3527
|
"\u062D\u0630\u0641 \u062A\u0635\u0648\u06CC\u0631"
|
|
3605
3528
|
)
|
|
3606
|
-
), errors[name] && /* @__PURE__ */
|
|
3529
|
+
), errors[name] && /* @__PURE__ */ React24.createElement(Typography12, { color: "error", variant: "body2", sx: { mt: 1.5, ml: 1 } }, String(errors[name]?.message || "")))
|
|
3607
3530
|
}
|
|
3608
3531
|
);
|
|
3609
3532
|
};
|
|
3610
3533
|
var upload_image_default = UploadImage;
|
|
3611
3534
|
|
|
3612
3535
|
// src/accordion/index.tsx
|
|
3613
|
-
import { styled as
|
|
3536
|
+
import { styled as styled3 } from "@mui/material/styles";
|
|
3614
3537
|
import { IoIosArrowForward } from "react-icons/io";
|
|
3615
3538
|
import MuiAccordion from "@mui/material/Accordion";
|
|
3616
3539
|
import MuiAccordionSummary, {
|
|
@@ -3624,7 +3547,7 @@ import { useState as useState11 } from "react";
|
|
|
3624
3547
|
function Page({
|
|
3625
3548
|
data
|
|
3626
3549
|
}) {
|
|
3627
|
-
const Accordion =
|
|
3550
|
+
const Accordion = styled3((props) => /* @__PURE__ */ React.createElement(MuiAccordion, { disableGutters: true, elevation: 0, square: true, ...props }))(({ theme }) => ({
|
|
3628
3551
|
border: `1px solid ${theme.palette.divider}`,
|
|
3629
3552
|
"&:not(:last-child)": {
|
|
3630
3553
|
borderBottom: 0
|
|
@@ -3633,7 +3556,7 @@ function Page({
|
|
|
3633
3556
|
display: "none"
|
|
3634
3557
|
}
|
|
3635
3558
|
}));
|
|
3636
|
-
const AccordionSummary =
|
|
3559
|
+
const AccordionSummary = styled3((props) => /* @__PURE__ */ React.createElement(MuiAccordionSummary, { expandIcon: /* @__PURE__ */ React.createElement(IoIosArrowForward, null), ...props }))(({ theme }) => ({
|
|
3637
3560
|
backgroundColor: "rgba(0, 0, 0, .03)",
|
|
3638
3561
|
flexDirection: "row-reverse",
|
|
3639
3562
|
[`& .${accordionSummaryClasses.expandIconWrapper}.${accordionSummaryClasses.expanded}`]: {
|
|
@@ -3646,7 +3569,7 @@ function Page({
|
|
|
3646
3569
|
backgroundColor: "rgba(255, 255, 255, .05)"
|
|
3647
3570
|
})
|
|
3648
3571
|
}));
|
|
3649
|
-
const AccordionDetails =
|
|
3572
|
+
const AccordionDetails = styled3(MuiAccordionDetails)(({ theme }) => ({
|
|
3650
3573
|
padding: theme.spacing(2),
|
|
3651
3574
|
borderTop: "1px solid rgba(0, 0, 0, .125)"
|
|
3652
3575
|
}));
|
|
@@ -3680,10 +3603,142 @@ function Page({
|
|
|
3680
3603
|
);
|
|
3681
3604
|
}));
|
|
3682
3605
|
}
|
|
3606
|
+
|
|
3607
|
+
// src/switch-button/index.tsx
|
|
3608
|
+
import { Box as Box17, FormControlLabel as FormControlLabel3, Switch } from "@mui/material";
|
|
3609
|
+
import { styled as styled4 } from "@mui/system";
|
|
3610
|
+
import React25 from "react";
|
|
3611
|
+
import { PiCardsDuotone, PiTableDuotone } from "react-icons/pi";
|
|
3612
|
+
import { useTheme as useTheme5 } from "@mui/material";
|
|
3613
|
+
var SwitchButton = ({
|
|
3614
|
+
checked,
|
|
3615
|
+
handleChange,
|
|
3616
|
+
iconChecked,
|
|
3617
|
+
iconUnchecked
|
|
3618
|
+
}) => {
|
|
3619
|
+
const theme = useTheme5();
|
|
3620
|
+
const isDarkMode = theme.palette.mode === "dark";
|
|
3621
|
+
const CustomSwitch = styled4(Switch)(({ theme: theme2 }) => ({
|
|
3622
|
+
"& .MuiSwitch-switchBase.Mui-checked": {
|
|
3623
|
+
color: theme2.palette.primary.main
|
|
3624
|
+
},
|
|
3625
|
+
"& .MuiSwitch-switchBase": {
|
|
3626
|
+
color: isDarkMode ? "rgba(220,220,220,1)" : "rgba(188,188,188,1)"
|
|
3627
|
+
},
|
|
3628
|
+
"& .MuiSwitch-track": {
|
|
3629
|
+
// backgroundColor: "rgba(160,160,160, 0.1)",
|
|
3630
|
+
backgroundColor: "#fff",
|
|
3631
|
+
border: isDarkMode ? "2px solid white" : "2px solid rgba(80,80,80, 1)"
|
|
3632
|
+
}
|
|
3633
|
+
}));
|
|
3634
|
+
const BoxContainer = styled4(Box17)(({ theme: theme2 }) => ({
|
|
3635
|
+
display: "flex",
|
|
3636
|
+
alignItems: "center",
|
|
3637
|
+
backgroundColor: "rgba(188,188,188, 0.1)",
|
|
3638
|
+
border: "2px solid rgba(200,200,200, 1)",
|
|
3639
|
+
borderRadius: 10,
|
|
3640
|
+
transition: "all 0.3s ease",
|
|
3641
|
+
paddingTop: theme2.spacing(0.1),
|
|
3642
|
+
paddingBottom: theme2.spacing(0.1),
|
|
3643
|
+
paddingLeft: theme2.spacing(1)
|
|
3644
|
+
}));
|
|
3645
|
+
const LabelContainer = styled4("div")({
|
|
3646
|
+
transition: "all 0.2s ease",
|
|
3647
|
+
color: isDarkMode ? "rgba(220,220,220, 1)" : "rgba(160,160,160, 1)"
|
|
3648
|
+
});
|
|
3649
|
+
return /* @__PURE__ */ React25.createElement(BoxContainer, null, /* @__PURE__ */ React25.createElement(
|
|
3650
|
+
FormControlLabel3,
|
|
3651
|
+
{
|
|
3652
|
+
control: /* @__PURE__ */ React25.createElement(
|
|
3653
|
+
CustomSwitch,
|
|
3654
|
+
{
|
|
3655
|
+
checked,
|
|
3656
|
+
onChange: handleChange,
|
|
3657
|
+
name: "switch"
|
|
3658
|
+
}
|
|
3659
|
+
),
|
|
3660
|
+
label: /* @__PURE__ */ React25.createElement(LabelContainer, null, checked ? iconChecked ? iconChecked : /* @__PURE__ */ React25.createElement(PiTableDuotone, { size: 30 }) : iconUnchecked ? iconUnchecked : /* @__PURE__ */ React25.createElement(PiCardsDuotone, { size: 30 }))
|
|
3661
|
+
}
|
|
3662
|
+
));
|
|
3663
|
+
};
|
|
3664
|
+
var switch_button_default = SwitchButton;
|
|
3665
|
+
|
|
3666
|
+
// src/bascule-connection-button/index.tsx
|
|
3667
|
+
import { Box as Box18, Button as Button12 } from "@mui/material";
|
|
3668
|
+
import React26, { useRef as useRef4, useState as useState12 } from "react";
|
|
3669
|
+
import toast from "react-hot-toast";
|
|
3670
|
+
import { PiPlugs, PiPlugsConnected } from "react-icons/pi";
|
|
3671
|
+
var ConnectToBasculeButton = ({
|
|
3672
|
+
baudRate,
|
|
3673
|
+
dataBits = 8,
|
|
3674
|
+
stopBits = 1,
|
|
3675
|
+
parity = "none",
|
|
3676
|
+
flowControl = "none"
|
|
3677
|
+
}) => {
|
|
3678
|
+
const [connected, setConnected] = useState12(false);
|
|
3679
|
+
const portRef = useRef4(null);
|
|
3680
|
+
const connectToBascule = async () => {
|
|
3681
|
+
if (!("serial" in navigator)) {
|
|
3682
|
+
toast.error("Web Serial API \u062A\u0648\u0633\u0637 \u0627\u06CC\u0646 \u0645\u0631\u0648\u0631\u06AF\u0631 \u067E\u0634\u062A\u06CC\u0628\u0627\u0646\u06CC \u0646\u0645\u06CC\u200C\u0634\u0648\u062F.");
|
|
3683
|
+
return;
|
|
3684
|
+
}
|
|
3685
|
+
try {
|
|
3686
|
+
const serial = navigator.serial;
|
|
3687
|
+
const port = await serial.requestPort();
|
|
3688
|
+
await port.open({ baudRate, dataBits, stopBits, parity, flowControl });
|
|
3689
|
+
portRef.current = port;
|
|
3690
|
+
setConnected(true);
|
|
3691
|
+
toast.success("\u0627\u062A\u0635\u0627\u0644 \u0628\u0647 \u0628\u0627\u0633\u06A9\u0648\u0644 \u0628\u0627 \u0645\u0648\u0641\u0642\u06CC\u062A \u0627\u0646\u062C\u0627\u0645 \u0634\u062F.");
|
|
3692
|
+
} catch (error) {
|
|
3693
|
+
console.error(error);
|
|
3694
|
+
toast.error("\u062E\u0637\u0627 \u062F\u0631 \u0627\u062A\u0635\u0627\u0644 \u0628\u0647 \u0628\u0627\u0633\u06A9\u0648\u0644. \u0644\u0637\u0641\u0627\u064B \u062F\u0648\u0628\u0627\u0631\u0647 \u062A\u0644\u0627\u0634 \u06A9\u0646\u06CC\u062F.");
|
|
3695
|
+
}
|
|
3696
|
+
};
|
|
3697
|
+
return /* @__PURE__ */ React26.createElement(React26.Fragment, null, /* @__PURE__ */ React26.createElement("style", null, `
|
|
3698
|
+
@keyframes jumpAnimation {
|
|
3699
|
+
0% { transform: translateY(1px); }
|
|
3700
|
+
12.5% { transform: translateY(-2px); }
|
|
3701
|
+
25% { transform: translateY(1px); }
|
|
3702
|
+
37.5% { transform: translateY(-2px); }
|
|
3703
|
+
50% { transform: translateY(0); }
|
|
3704
|
+
100% { transform: translateY(0); }
|
|
3705
|
+
}
|
|
3706
|
+
`), /* @__PURE__ */ React26.createElement(
|
|
3707
|
+
Button12,
|
|
3708
|
+
{
|
|
3709
|
+
variant: "contained",
|
|
3710
|
+
onClick: connectToBascule,
|
|
3711
|
+
disabled: connected,
|
|
3712
|
+
sx: { minWidth: "11rem" }
|
|
3713
|
+
},
|
|
3714
|
+
/* @__PURE__ */ React26.createElement(
|
|
3715
|
+
Box18,
|
|
3716
|
+
{
|
|
3717
|
+
sx: {
|
|
3718
|
+
display: "flex",
|
|
3719
|
+
alignItems: "center",
|
|
3720
|
+
gap: 1,
|
|
3721
|
+
fontSize: 16
|
|
3722
|
+
}
|
|
3723
|
+
},
|
|
3724
|
+
connected ? /* @__PURE__ */ React26.createElement(React26.Fragment, null, "\u0645\u062A\u0635\u0644 \u0628\u0647 \u0628\u0627\u0633\u06A9\u0648\u0644", /* @__PURE__ */ React26.createElement(PiPlugsConnected, { size: 20 })) : /* @__PURE__ */ React26.createElement(React26.Fragment, null, "\u0627\u062A\u0635\u0627\u0644 \u0628\u0647 \u0628\u0627\u0633\u06A9\u0648\u0644", /* @__PURE__ */ React26.createElement(
|
|
3725
|
+
PiPlugs,
|
|
3726
|
+
{
|
|
3727
|
+
size: 20,
|
|
3728
|
+
style: {
|
|
3729
|
+
animation: "jumpAnimation 2s ease-in-out infinite"
|
|
3730
|
+
}
|
|
3731
|
+
}
|
|
3732
|
+
))
|
|
3733
|
+
)
|
|
3734
|
+
));
|
|
3735
|
+
};
|
|
3736
|
+
var bascule_connection_button_default = ConnectToBasculeButton;
|
|
3683
3737
|
export {
|
|
3684
3738
|
Page as Accordion,
|
|
3685
3739
|
AdvancedSearchButton,
|
|
3686
3740
|
ConfirmationDialog,
|
|
3741
|
+
bascule_connection_button_default as ConnectToBasculeButton,
|
|
3687
3742
|
CustomCheckbox,
|
|
3688
3743
|
CustomTimePicker,
|
|
3689
3744
|
DateFilter,
|