react-better-html 1.1.102 → 1.1.104
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 +78 -16
- package/dist/index.d.ts +78 -16
- package/dist/index.js +737 -138
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +852 -244
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1416,6 +1416,26 @@ var icons = {
|
|
|
1416
1416
|
}
|
|
1417
1417
|
]
|
|
1418
1418
|
},
|
|
1419
|
+
doubleChevronLeft: {
|
|
1420
|
+
width: 512,
|
|
1421
|
+
height: 512,
|
|
1422
|
+
paths: [
|
|
1423
|
+
{
|
|
1424
|
+
d: "M41.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L109.3 256 246.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-160 160zm352-160l-160 160c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L301.3 256 438.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0z",
|
|
1425
|
+
type: "fill"
|
|
1426
|
+
}
|
|
1427
|
+
]
|
|
1428
|
+
},
|
|
1429
|
+
doubleChevronRight: {
|
|
1430
|
+
width: 512,
|
|
1431
|
+
height: 512,
|
|
1432
|
+
paths: [
|
|
1433
|
+
{
|
|
1434
|
+
d: "M470.6 278.6c12.5-12.5 12.5-32.8 0-45.3l-160-160c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L402.7 256 265.4 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l160-160zm-352 160l160-160c12.5-12.5 12.5-32.8 0-45.3l-160-160c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L210.7 256 73.4 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0z",
|
|
1435
|
+
type: "fill"
|
|
1436
|
+
}
|
|
1437
|
+
]
|
|
1438
|
+
},
|
|
1419
1439
|
eye: {
|
|
1420
1440
|
width: 576,
|
|
1421
1441
|
height: 512,
|
|
@@ -1455,6 +1475,16 @@ var icons = {
|
|
|
1455
1475
|
type: "fill"
|
|
1456
1476
|
}
|
|
1457
1477
|
]
|
|
1478
|
+
},
|
|
1479
|
+
filter: {
|
|
1480
|
+
width: 512,
|
|
1481
|
+
height: 512,
|
|
1482
|
+
paths: [
|
|
1483
|
+
{
|
|
1484
|
+
d: "M3.9 54.9C10.5 40.9 24.5 32 40 32l432 0c15.5 0 29.5 8.9 36.1 22.9s4.6 30.5-5.2 42.5L320 320.9 320 448c0 12.1-6.8 23.2-17.7 28.6s-23.8 4.3-33.5-3l-64-48c-8.1-6-12.8-15.5-12.8-25.6l0-79.1L9 97.3C-.7 85.4-2.8 68.8 3.9 54.9z",
|
|
1485
|
+
type: "fill"
|
|
1486
|
+
}
|
|
1487
|
+
]
|
|
1458
1488
|
}
|
|
1459
1489
|
};
|
|
1460
1490
|
|
|
@@ -2236,14 +2266,19 @@ DivComponent.column = forwardRef(function Column({ flexReverse, invertFlexDirect
|
|
|
2236
2266
|
DivComponent.grid = forwardRef(function Grid(props, ref) {
|
|
2237
2267
|
return /* @__PURE__ */ jsx2(DivComponent, { display: "grid", ref, ...props });
|
|
2238
2268
|
});
|
|
2239
|
-
DivComponent.box = forwardRef(function Box(props, ref) {
|
|
2269
|
+
DivComponent.box = forwardRef(function Box({ isActive, ...props }, ref) {
|
|
2240
2270
|
const theme2 = useTheme();
|
|
2271
|
+
const withClick = props.onClick || props.onClickWithValue;
|
|
2241
2272
|
return /* @__PURE__ */ jsx2(
|
|
2242
2273
|
DivComponent,
|
|
2243
2274
|
{
|
|
2244
|
-
|
|
2245
|
-
|
|
2275
|
+
color: isActive ? theme2.colors.base : void 0,
|
|
2276
|
+
backgroundColor: isActive ? theme2.colors.primary : theme2.colors.backgroundContent,
|
|
2277
|
+
border: `1px solid ${isActive ? theme2.colors.primary : theme2.colors.border}`,
|
|
2246
2278
|
borderRadius: theme2.styles.borderRadius,
|
|
2279
|
+
borderColorHover: withClick && !isActive ? theme2.colors.primary : void 0,
|
|
2280
|
+
filterHover: withClick && isActive ? "brightness(0.9)" : void 0,
|
|
2281
|
+
cursor: withClick ? "pointer" : void 0,
|
|
2247
2282
|
paddingBlock: theme2.styles.gap,
|
|
2248
2283
|
paddingInline: theme2.styles.space,
|
|
2249
2284
|
ref,
|
|
@@ -2751,40 +2786,39 @@ Button2.upload = ButtonComponent.upload;
|
|
|
2751
2786
|
var Button_default = Button2;
|
|
2752
2787
|
|
|
2753
2788
|
// src/components/Divider.tsx
|
|
2754
|
-
import { memo as memo8 } from "react";
|
|
2789
|
+
import { forwardRef as forwardRef5, memo as memo8 } from "react";
|
|
2755
2790
|
import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
2756
2791
|
var Divider_default = {
|
|
2757
|
-
vertical: memo8(
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
textColor,
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
})
|
|
2792
|
+
vertical: memo8(
|
|
2793
|
+
forwardRef5(function Divider({ width = 1, backgroundColor, height, ...props }, ref) {
|
|
2794
|
+
const theme2 = useTheme();
|
|
2795
|
+
return /* @__PURE__ */ jsx8(
|
|
2796
|
+
Div_default,
|
|
2797
|
+
{
|
|
2798
|
+
width,
|
|
2799
|
+
height: height ?? "100%",
|
|
2800
|
+
flexShrink: 0,
|
|
2801
|
+
backgroundColor: backgroundColor ?? theme2.colors.border,
|
|
2802
|
+
...props,
|
|
2803
|
+
ref
|
|
2804
|
+
}
|
|
2805
|
+
);
|
|
2806
|
+
})
|
|
2807
|
+
),
|
|
2808
|
+
horizontal: memo8(
|
|
2809
|
+
forwardRef5(function Divider2({ width = 1, backgroundColor, text, textColor, ...props }, ref) {
|
|
2810
|
+
const theme2 = useTheme();
|
|
2811
|
+
return /* @__PURE__ */ jsxs4(Div_default.row, { width: "100%", alignItems: "center", gap: text ? theme2.styles.space : void 0, ...props, ref, children: [
|
|
2812
|
+
/* @__PURE__ */ jsx8(Div_default, { flex: 1, height: width, flexShrink: 0, backgroundColor: backgroundColor ?? theme2.colors.border }),
|
|
2813
|
+
text && /* @__PURE__ */ jsx8(Text_default, { color: textColor ?? theme2.colors.textSecondary, children: text }),
|
|
2814
|
+
/* @__PURE__ */ jsx8(Div_default, { flex: 1, height: width, flexShrink: 0, backgroundColor: backgroundColor ?? theme2.colors.border })
|
|
2815
|
+
] });
|
|
2816
|
+
})
|
|
2817
|
+
)
|
|
2784
2818
|
};
|
|
2785
2819
|
|
|
2786
2820
|
// src/components/Modal.tsx
|
|
2787
|
-
import { memo as memo9, useCallback as useCallback5, forwardRef as
|
|
2821
|
+
import { memo as memo9, useCallback as useCallback5, forwardRef as forwardRef6, useImperativeHandle, useRef as useRef2, useState as useState3 } from "react";
|
|
2788
2822
|
import styled7 from "styled-components";
|
|
2789
2823
|
import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
2790
2824
|
var DialogStylesElement = styled7.dialog.withConfig({
|
|
@@ -2827,7 +2861,7 @@ var DialogStylesElement = styled7.dialog.withConfig({
|
|
|
2827
2861
|
}
|
|
2828
2862
|
}
|
|
2829
2863
|
`;
|
|
2830
|
-
var ModalComponent =
|
|
2864
|
+
var ModalComponent = forwardRef6(function Modal({
|
|
2831
2865
|
maxWidth,
|
|
2832
2866
|
title,
|
|
2833
2867
|
titleColor,
|
|
@@ -2978,7 +3012,7 @@ var ModalComponent = forwardRef5(function Modal({
|
|
|
2978
3012
|
}
|
|
2979
3013
|
);
|
|
2980
3014
|
});
|
|
2981
|
-
ModalComponent.confirmation =
|
|
3015
|
+
ModalComponent.confirmation = forwardRef6(function Confirmation({ continueButtonLoaderName, onContinue, onCancel, ...props }, ref) {
|
|
2982
3016
|
const theme2 = useTheme();
|
|
2983
3017
|
const modalRef = useRef2(null);
|
|
2984
3018
|
const onCancelElement = useCallback5(() => {
|
|
@@ -3007,7 +3041,7 @@ ModalComponent.confirmation = forwardRef5(function Confirmation({ continueButton
|
|
|
3007
3041
|
)
|
|
3008
3042
|
] });
|
|
3009
3043
|
});
|
|
3010
|
-
ModalComponent.destructive =
|
|
3044
|
+
ModalComponent.destructive = forwardRef6(function Destructive2({ deleteButtonLoaderName, onDelete, onCancel, ...props }, ref) {
|
|
3011
3045
|
const theme2 = useTheme();
|
|
3012
3046
|
const modalRef = useRef2(null);
|
|
3013
3047
|
const onCancelElement = useCallback5(() => {
|
|
@@ -3050,9 +3084,9 @@ Modal2.destructive = ModalComponent.destructive;
|
|
|
3050
3084
|
var Modal_default = Modal2;
|
|
3051
3085
|
|
|
3052
3086
|
// src/components/PageHolder.tsx
|
|
3053
|
-
import { memo as memo10 } from "react";
|
|
3054
|
-
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
3055
|
-
function PageHolder({ noMaxContentWidth, children, ...props }) {
|
|
3087
|
+
import { forwardRef as forwardRef7, memo as memo10 } from "react";
|
|
3088
|
+
import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
3089
|
+
var PageHolderComponent = forwardRef7(function PageHolder({ noMaxContentWidth, children, ...props }, ref) {
|
|
3056
3090
|
const theme2 = useTheme();
|
|
3057
3091
|
const { app } = useBetterHtmlContextInternal();
|
|
3058
3092
|
return /* @__PURE__ */ jsx10(
|
|
@@ -3064,16 +3098,69 @@ function PageHolder({ noMaxContentWidth, children, ...props }) {
|
|
|
3064
3098
|
margin: "0px auto",
|
|
3065
3099
|
padding: theme2.styles.space,
|
|
3066
3100
|
...props,
|
|
3101
|
+
ref,
|
|
3067
3102
|
children
|
|
3068
3103
|
}
|
|
3069
3104
|
);
|
|
3070
|
-
}
|
|
3071
|
-
|
|
3105
|
+
});
|
|
3106
|
+
PageHolderComponent.center = forwardRef7(function Center({
|
|
3107
|
+
decorationImageSrc,
|
|
3108
|
+
decorationImageName,
|
|
3109
|
+
decorationImagePosition = "right",
|
|
3110
|
+
noMaxContentWidth,
|
|
3111
|
+
children,
|
|
3112
|
+
...props
|
|
3113
|
+
}, ref) {
|
|
3114
|
+
const theme2 = useTheme();
|
|
3115
|
+
const mediaQuery = useMediaQuery();
|
|
3116
|
+
const { app } = useBetterHtmlContextInternal();
|
|
3117
|
+
const breakingPoint = mediaQuery.size1000;
|
|
3118
|
+
return /* @__PURE__ */ jsxs6(Div_default.row, { width: "100%", minHeight: "100svh", alignItems: "center", justifyContent: "center", children: [
|
|
3119
|
+
decorationImagePosition === "left" && !breakingPoint && /* @__PURE__ */ jsx10(Div_default, { width: "50%" }),
|
|
3120
|
+
/* @__PURE__ */ jsx10(
|
|
3121
|
+
Div_default.column,
|
|
3122
|
+
{
|
|
3123
|
+
width: `${!breakingPoint && (decorationImageSrc || decorationImageName) ? 50 : 100}%`,
|
|
3124
|
+
alignItems: "center",
|
|
3125
|
+
children: /* @__PURE__ */ jsx10(
|
|
3126
|
+
Div_default.box,
|
|
3127
|
+
{
|
|
3128
|
+
width: `calc(100% - ${theme2.styles.space}px * 2)`,
|
|
3129
|
+
maxWidth: !noMaxContentWidth ? app.contentMaxWidth / 2 : void 0,
|
|
3130
|
+
marginInline: theme2.styles.space,
|
|
3131
|
+
marginBlock: theme2.styles.space,
|
|
3132
|
+
...props,
|
|
3133
|
+
ref,
|
|
3134
|
+
children
|
|
3135
|
+
}
|
|
3136
|
+
)
|
|
3137
|
+
}
|
|
3138
|
+
),
|
|
3139
|
+
decorationImagePosition === "right" && !breakingPoint && /* @__PURE__ */ jsx10(Div_default, { width: "50%" }),
|
|
3140
|
+
(decorationImageSrc || decorationImageName) && !breakingPoint && /* @__PURE__ */ jsx10(
|
|
3141
|
+
Image_default,
|
|
3142
|
+
{
|
|
3143
|
+
position: "fixed",
|
|
3144
|
+
name: decorationImageName,
|
|
3145
|
+
src: decorationImageSrc,
|
|
3146
|
+
width: "50%",
|
|
3147
|
+
height: "100svh",
|
|
3148
|
+
top: 0,
|
|
3149
|
+
left: decorationImagePosition === "left" ? 0 : "auto",
|
|
3150
|
+
right: decorationImagePosition === "right" ? 0 : "auto",
|
|
3151
|
+
objectFit: "cover"
|
|
3152
|
+
}
|
|
3153
|
+
)
|
|
3154
|
+
] });
|
|
3155
|
+
});
|
|
3156
|
+
var PageHolder2 = memo10(PageHolderComponent);
|
|
3157
|
+
PageHolder2.center = PageHolderComponent.center;
|
|
3158
|
+
var PageHolder_default = PageHolder2;
|
|
3072
3159
|
|
|
3073
3160
|
// src/components/PageHeader.tsx
|
|
3074
|
-
import { memo as memo11 } from "react";
|
|
3075
|
-
import { jsx as jsx11, jsxs as
|
|
3076
|
-
function PageHeader({
|
|
3161
|
+
import { forwardRef as forwardRef8, memo as memo11 } from "react";
|
|
3162
|
+
import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
3163
|
+
var PageHeaderComponent = forwardRef8(function PageHeader({
|
|
3077
3164
|
imageUrl,
|
|
3078
3165
|
imageSize = 60,
|
|
3079
3166
|
title,
|
|
@@ -3084,59 +3171,69 @@ function PageHeader({
|
|
|
3084
3171
|
rightElement,
|
|
3085
3172
|
lightMode,
|
|
3086
3173
|
marginBottom
|
|
3087
|
-
}) {
|
|
3174
|
+
}, ref) {
|
|
3088
3175
|
const theme2 = useTheme();
|
|
3089
3176
|
const { app } = useBetterHtmlContextInternal();
|
|
3090
3177
|
const mediaQuery = useMediaQuery();
|
|
3091
|
-
return /* @__PURE__ */
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
}
|
|
3136
|
-
|
|
3178
|
+
return /* @__PURE__ */ jsxs7(
|
|
3179
|
+
Div_default.row,
|
|
3180
|
+
{
|
|
3181
|
+
alignItems: "center",
|
|
3182
|
+
gap: theme2.styles.space,
|
|
3183
|
+
marginBottom: marginBottom ?? theme2.styles.space * 2,
|
|
3184
|
+
ref,
|
|
3185
|
+
children: [
|
|
3186
|
+
imageUrl && /* @__PURE__ */ jsx11(Image_default.profileImage, { src: imageUrl, size: imageSize ?? (mediaQuery.size600 ? 46 : 60) }),
|
|
3187
|
+
/* @__PURE__ */ jsxs7(
|
|
3188
|
+
Div_default.column,
|
|
3189
|
+
{
|
|
3190
|
+
alignItems: textAlign === "center" ? "center" : textAlign === "right" ? "flex-end" : void 0,
|
|
3191
|
+
flex: 1,
|
|
3192
|
+
gap: theme2.styles.gap / 2,
|
|
3193
|
+
children: [
|
|
3194
|
+
/* @__PURE__ */ jsxs7(
|
|
3195
|
+
Div_default.row,
|
|
3196
|
+
{
|
|
3197
|
+
alignItems: "center",
|
|
3198
|
+
justifyContent: textAlign === "center" ? "center" : textAlign === "right" ? "flex-end" : void 0,
|
|
3199
|
+
gap: theme2.styles.space,
|
|
3200
|
+
children: [
|
|
3201
|
+
/* @__PURE__ */ jsx11(
|
|
3202
|
+
Text_default,
|
|
3203
|
+
{
|
|
3204
|
+
as: titleAs ?? "h1",
|
|
3205
|
+
textAlign,
|
|
3206
|
+
color: lightMode ? theme2.colors.base : theme2.colors.textPrimary,
|
|
3207
|
+
children: title
|
|
3208
|
+
}
|
|
3209
|
+
),
|
|
3210
|
+
titleRightElement
|
|
3211
|
+
]
|
|
3212
|
+
}
|
|
3213
|
+
),
|
|
3214
|
+
description && /* @__PURE__ */ jsx11(
|
|
3215
|
+
Text_default,
|
|
3216
|
+
{
|
|
3217
|
+
maxWidth: !mediaQuery.size600 ? app.contentMaxWidth * 0.6 : void 0,
|
|
3218
|
+
textAlign,
|
|
3219
|
+
color: lightMode ? theme2.colors.base : theme2.colors.textSecondary,
|
|
3220
|
+
opacity: lightMode ? 0.7 : void 0,
|
|
3221
|
+
children: description
|
|
3222
|
+
}
|
|
3223
|
+
)
|
|
3224
|
+
]
|
|
3225
|
+
}
|
|
3226
|
+
),
|
|
3227
|
+
rightElement
|
|
3228
|
+
]
|
|
3229
|
+
}
|
|
3230
|
+
);
|
|
3231
|
+
});
|
|
3232
|
+
var PageHeader2 = memo11(PageHeaderComponent);
|
|
3233
|
+
var PageHeader_default = PageHeader2;
|
|
3137
3234
|
|
|
3138
3235
|
// src/components/Chip.tsx
|
|
3139
|
-
import { forwardRef as
|
|
3236
|
+
import { forwardRef as forwardRef9, memo as memo12 } from "react";
|
|
3140
3237
|
|
|
3141
3238
|
// src/utils/colorManipulation.ts
|
|
3142
3239
|
var rgbToHsl = (r, g, b) => {
|
|
@@ -3258,7 +3355,7 @@ var desaturateColor = (hexColor, amount) => {
|
|
|
3258
3355
|
|
|
3259
3356
|
// src/components/Chip.tsx
|
|
3260
3357
|
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
3261
|
-
var ChipComponent =
|
|
3358
|
+
var ChipComponent = forwardRef9(function Chip({ text, color, backgroundColor, borderRadius, isCircle, ...props }, ref) {
|
|
3262
3359
|
const theme2 = useTheme();
|
|
3263
3360
|
return /* @__PURE__ */ jsx12(
|
|
3264
3361
|
Div_default,
|
|
@@ -3274,7 +3371,7 @@ var ChipComponent = forwardRef6(function Chip({ text, color, backgroundColor, bo
|
|
|
3274
3371
|
}
|
|
3275
3372
|
);
|
|
3276
3373
|
});
|
|
3277
|
-
ChipComponent.colored =
|
|
3374
|
+
ChipComponent.colored = forwardRef9(function Colored({ color, ...props }, ref) {
|
|
3278
3375
|
const theme2 = useTheme();
|
|
3279
3376
|
const { colorTheme } = useBetterHtmlContextInternal();
|
|
3280
3377
|
const readyColor = color ?? theme2.colors.textSecondary;
|
|
@@ -3294,7 +3391,7 @@ Chip2.colored = ChipComponent.colored;
|
|
|
3294
3391
|
var Chip_default = Chip2;
|
|
3295
3392
|
|
|
3296
3393
|
// src/components/InputField.tsx
|
|
3297
|
-
import { forwardRef as
|
|
3394
|
+
import { forwardRef as forwardRef11, memo as memo16, useCallback as useCallback8, useState as useState6, useEffect as useEffect7, useMemo as useMemo5, useRef as useRef4, useId } from "react";
|
|
3298
3395
|
import styled8 from "styled-components";
|
|
3299
3396
|
|
|
3300
3397
|
// src/constants/countries.ts
|
|
@@ -4842,10 +4939,10 @@ var getFormErrorObject = (formValues) => {
|
|
|
4842
4939
|
|
|
4843
4940
|
// src/components/Label.tsx
|
|
4844
4941
|
import { memo as memo13 } from "react";
|
|
4845
|
-
import { jsxs as
|
|
4942
|
+
import { jsxs as jsxs8 } from "react/jsx-runtime";
|
|
4846
4943
|
function Label({ text, required, isError, color, htmlFor }) {
|
|
4847
4944
|
const theme2 = useTheme();
|
|
4848
|
-
return /* @__PURE__ */
|
|
4945
|
+
return /* @__PURE__ */ jsxs8(
|
|
4849
4946
|
Text_default,
|
|
4850
4947
|
{
|
|
4851
4948
|
as: "label",
|
|
@@ -4857,7 +4954,7 @@ function Label({ text, required, isError, color, htmlFor }) {
|
|
|
4857
4954
|
"aria-required": required,
|
|
4858
4955
|
children: [
|
|
4859
4956
|
text,
|
|
4860
|
-
required && /* @__PURE__ */
|
|
4957
|
+
required && /* @__PURE__ */ jsxs8(Text_default, { as: "span", fontSize: 16, color: theme2.colors.error, children: [
|
|
4861
4958
|
" ",
|
|
4862
4959
|
"*"
|
|
4863
4960
|
] })
|
|
@@ -4868,9 +4965,9 @@ function Label({ text, required, isError, color, htmlFor }) {
|
|
|
4868
4965
|
var Label_default = memo13(Label);
|
|
4869
4966
|
|
|
4870
4967
|
// src/components/Dropdown.tsx
|
|
4871
|
-
import { forwardRef as
|
|
4872
|
-
import { Fragment as Fragment3, jsx as jsx13, jsxs as
|
|
4873
|
-
var DropdownComponent =
|
|
4968
|
+
import { forwardRef as forwardRef10, memo as memo14, useCallback as useCallback6, useEffect as useEffect5, useMemo as useMemo3, useRef as useRef3, useState as useState4 } from "react";
|
|
4969
|
+
import { Fragment as Fragment3, jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
4970
|
+
var DropdownComponent = forwardRef10(function Dropdown({
|
|
4874
4971
|
label,
|
|
4875
4972
|
labelColor,
|
|
4876
4973
|
errorText,
|
|
@@ -5057,7 +5154,7 @@ var DropdownComponent = forwardRef7(function Dropdown({
|
|
|
5057
5154
|
const displayValue = withSearch && isFocused ? searchQuery : selectedOption?.label ?? "";
|
|
5058
5155
|
const withClearButton = isOpen && selectedOption;
|
|
5059
5156
|
const readyPlaceholder = placeholder ? placeholder : `Select an ${label?.toLowerCase() ?? "option"}`;
|
|
5060
|
-
return /* @__PURE__ */ jsx13(Div_default.column, { width: "100%", position: "relative", userSelect: "none", ...props, children: /* @__PURE__ */
|
|
5157
|
+
return /* @__PURE__ */ jsx13(Div_default.column, { width: "100%", position: "relative", userSelect: "none", ...props, children: /* @__PURE__ */ jsxs9(Div_default.row, { position: "relative", width: "100%", children: [
|
|
5061
5158
|
/* @__PURE__ */ jsx13(
|
|
5062
5159
|
InputField_default,
|
|
5063
5160
|
{
|
|
@@ -5115,7 +5212,7 @@ var DropdownComponent = forwardRef7(function Dropdown({
|
|
|
5115
5212
|
ref: inputRef
|
|
5116
5213
|
}
|
|
5117
5214
|
),
|
|
5118
|
-
/* @__PURE__ */
|
|
5215
|
+
/* @__PURE__ */ jsxs9(
|
|
5119
5216
|
Div_default.row,
|
|
5120
5217
|
{
|
|
5121
5218
|
position: "absolute",
|
|
@@ -5161,10 +5258,10 @@ var DropdownComponent = forwardRef7(function Dropdown({
|
|
|
5161
5258
|
)
|
|
5162
5259
|
] }) });
|
|
5163
5260
|
});
|
|
5164
|
-
DropdownComponent.countries =
|
|
5261
|
+
DropdownComponent.countries = forwardRef10(function Countries({ ...props }, ref) {
|
|
5165
5262
|
const theme2 = useTheme();
|
|
5166
5263
|
const renderOption = useCallback6(
|
|
5167
|
-
(option, index, isSelected) => /* @__PURE__ */
|
|
5264
|
+
(option, index, isSelected) => /* @__PURE__ */ jsxs9(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: [
|
|
5168
5265
|
/* @__PURE__ */ jsx13(Image_default, { src: `https://flagcdn.com/w80/${option.data?.code.toString().toLowerCase()}.webp`, width: 20 }),
|
|
5169
5266
|
/* @__PURE__ */ jsx13(Text_default, { children: option.label })
|
|
5170
5267
|
] }),
|
|
@@ -5199,7 +5296,7 @@ var Dropdown_default = Dropdown2;
|
|
|
5199
5296
|
|
|
5200
5297
|
// src/components/Calendar.tsx
|
|
5201
5298
|
import { useCallback as useCallback7, useMemo as useMemo4, useState as useState5, memo as memo15, useEffect as useEffect6 } from "react";
|
|
5202
|
-
import { jsx as jsx14, jsxs as
|
|
5299
|
+
import { jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
5203
5300
|
var getMonthName = (month, short = false) => {
|
|
5204
5301
|
return [
|
|
5205
5302
|
short ? "Jan" : "January",
|
|
@@ -5289,24 +5386,24 @@ function Calendar({ value, minDate, maxDate, onChange }) {
|
|
|
5289
5386
|
setCurrentMonth(date.getMonth());
|
|
5290
5387
|
setCurrentYear(date.getFullYear());
|
|
5291
5388
|
}, [value]);
|
|
5292
|
-
return /* @__PURE__ */
|
|
5293
|
-
/* @__PURE__ */
|
|
5389
|
+
return /* @__PURE__ */ jsxs10(Div_default.column, { width: "100%", maxWidth: 320, gap: theme2.styles.gap, padding: theme2.styles.space / 2, userSelect: "none", children: [
|
|
5390
|
+
/* @__PURE__ */ jsxs10(Div_default.row, { width: "100%", justifyContent: "space-between", alignItems: "center", children: [
|
|
5294
5391
|
/* @__PURE__ */ jsx14(Button_default.icon, { icon: "chevronLeft", onClick: onClickPreviousMonthButton }),
|
|
5295
|
-
/* @__PURE__ */
|
|
5392
|
+
/* @__PURE__ */ jsxs10(Text_default, { fontWeight: 700, children: [
|
|
5296
5393
|
getMonthName(currentMonth),
|
|
5297
5394
|
" ",
|
|
5298
5395
|
currentYear
|
|
5299
5396
|
] }),
|
|
5300
5397
|
/* @__PURE__ */ jsx14(Button_default.icon, { icon: "chevronRight", onClick: onClickNextMonthButton })
|
|
5301
5398
|
] }),
|
|
5302
|
-
/* @__PURE__ */
|
|
5399
|
+
/* @__PURE__ */ jsxs10(Div_default.grid, { width: "100%", gridTemplateColumns: "repeat(7, 1fr)", gap: theme2.styles.gap / 2, children: [
|
|
5303
5400
|
weekDaysIndex.map((day) => /* @__PURE__ */ jsx14(Div_default.row, { alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsx14(Text_default, { fontSize: 14, fontWeight: 700, textAlign: "center", children: getWeekDayName(day, true) }) }, day)),
|
|
5304
5401
|
days.map((day, index) => {
|
|
5305
5402
|
const thisDayDate = new Date(currentYear, currentMonth, day);
|
|
5306
5403
|
const isSelected = day !== void 0 && day === currentDate?.getDate() && currentMonth === currentDate.getMonth() && currentYear === currentDate.getFullYear();
|
|
5307
5404
|
const isWeekend = thisDayDate.getDay() === 6 || thisDayDate.getDay() === 0;
|
|
5308
5405
|
const isDisabled = minDate && thisDayDate.getTime() < minDate.getTime() || maxDate && thisDayDate.getTime() > maxDate.getTime();
|
|
5309
|
-
return /* @__PURE__ */
|
|
5406
|
+
return /* @__PURE__ */ jsxs10(
|
|
5310
5407
|
Div_default.row,
|
|
5311
5408
|
{
|
|
5312
5409
|
position: "relative",
|
|
@@ -5350,7 +5447,7 @@ function Calendar({ value, minDate, maxDate, onChange }) {
|
|
|
5350
5447
|
);
|
|
5351
5448
|
})
|
|
5352
5449
|
] }),
|
|
5353
|
-
/* @__PURE__ */
|
|
5450
|
+
/* @__PURE__ */ jsxs10(Div_default.row, { width: "100%", justifyContent: "space-between", alignItems: "center", children: [
|
|
5354
5451
|
/* @__PURE__ */ jsx14(Div_default, { isTabAccessed: true, cursor: "pointer", onClick: onClickClear, children: /* @__PURE__ */ jsx14(
|
|
5355
5452
|
Text_default,
|
|
5356
5453
|
{
|
|
@@ -5377,7 +5474,7 @@ function Calendar({ value, minDate, maxDate, onChange }) {
|
|
|
5377
5474
|
var Calendar_default = memo15(Calendar);
|
|
5378
5475
|
|
|
5379
5476
|
// src/components/InputField.tsx
|
|
5380
|
-
import { jsx as jsx15, jsxs as
|
|
5477
|
+
import { jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
5381
5478
|
var buttonWidth = 50;
|
|
5382
5479
|
var colorPickerSpacing = 4;
|
|
5383
5480
|
var colorPickerColorWidth = 12 + 27 + colorPickerSpacing;
|
|
@@ -5413,10 +5510,19 @@ var InputElement = styled8.input.withConfig({
|
|
|
5413
5510
|
cursor: not-allowed;
|
|
5414
5511
|
}
|
|
5415
5512
|
|
|
5513
|
+
&::-webkit-outer-spin-button,
|
|
5514
|
+
&::-webkit-inner-spin-button {
|
|
5515
|
+
-webkit-appearance: none;
|
|
5516
|
+
margin: 0;
|
|
5517
|
+
}
|
|
5518
|
+
|
|
5519
|
+
&[type="number"] {
|
|
5520
|
+
-moz-appearance: textfield;
|
|
5521
|
+
}
|
|
5522
|
+
|
|
5416
5523
|
&[type="date"],
|
|
5417
5524
|
&[type="datetime-local"],
|
|
5418
5525
|
&[type="time"] {
|
|
5419
|
-
// min-height: 46px;
|
|
5420
5526
|
-webkit-appearance: none;
|
|
5421
5527
|
-moz-appearance: textfield;
|
|
5422
5528
|
|
|
@@ -5516,7 +5622,7 @@ var TextareaElement = styled8.textarea.withConfig({
|
|
|
5516
5622
|
`;
|
|
5517
5623
|
var hours = Array.from({ length: 24 }, (_, index) => index);
|
|
5518
5624
|
var minutes = Array.from({ length: 60 }, (_, index) => index);
|
|
5519
|
-
var InputFieldComponent =
|
|
5625
|
+
var InputFieldComponent = forwardRef11(function InputField({
|
|
5520
5626
|
label,
|
|
5521
5627
|
labelColor,
|
|
5522
5628
|
errorText,
|
|
@@ -5570,9 +5676,9 @@ var InputFieldComponent = forwardRef8(function InputField({
|
|
|
5570
5676
|
onChangeValue?.(debouncedValue);
|
|
5571
5677
|
}, [withDebounce, onChangeValue, debouncedValue]);
|
|
5572
5678
|
const readyId = id ?? internalId;
|
|
5573
|
-
return /* @__PURE__ */
|
|
5679
|
+
return /* @__PURE__ */ jsxs11(Div_default.column, { width: "100%", gap: theme2.styles.gap / 2, ...styledComponentStylesWithExcluded, children: [
|
|
5574
5680
|
label && /* @__PURE__ */ jsx15(Label_default, { text: label, color: labelColor, required, isError: !!errorText, htmlFor: readyId }),
|
|
5575
|
-
/* @__PURE__ */
|
|
5681
|
+
/* @__PURE__ */ jsxs11(Div_default, { position: "relative", width: "100%", ref: holderRef, children: [
|
|
5576
5682
|
leftIcon && /* @__PURE__ */ jsx15(
|
|
5577
5683
|
Icon_default,
|
|
5578
5684
|
{
|
|
@@ -5637,7 +5743,7 @@ var InputFieldComponent = forwardRef8(function InputField({
|
|
|
5637
5743
|
)
|
|
5638
5744
|
] });
|
|
5639
5745
|
});
|
|
5640
|
-
InputFieldComponent.multiline =
|
|
5746
|
+
InputFieldComponent.multiline = forwardRef11(function Multiline({
|
|
5641
5747
|
label,
|
|
5642
5748
|
placeholder,
|
|
5643
5749
|
errorText,
|
|
@@ -5665,9 +5771,9 @@ InputFieldComponent.multiline = forwardRef8(function Multiline({
|
|
|
5665
5771
|
[onChange, onChangeValue]
|
|
5666
5772
|
);
|
|
5667
5773
|
const readyId = id ?? internalId;
|
|
5668
|
-
return /* @__PURE__ */
|
|
5774
|
+
return /* @__PURE__ */ jsxs11(Div_default.column, { gap: theme2.styles.gap / 2, children: [
|
|
5669
5775
|
label && /* @__PURE__ */ jsx15(Label_default, { text: label, required, isError: !!errorText, htmlFor: readyId }),
|
|
5670
|
-
/* @__PURE__ */
|
|
5776
|
+
/* @__PURE__ */ jsxs11(Div_default, { position: "relative", width: "100%", children: [
|
|
5671
5777
|
leftIcon && /* @__PURE__ */ jsx15(
|
|
5672
5778
|
Icon_default,
|
|
5673
5779
|
{
|
|
@@ -5731,7 +5837,7 @@ InputFieldComponent.multiline = forwardRef8(function Multiline({
|
|
|
5731
5837
|
)
|
|
5732
5838
|
] });
|
|
5733
5839
|
});
|
|
5734
|
-
InputFieldComponent.email =
|
|
5840
|
+
InputFieldComponent.email = forwardRef11(function Email({ ...props }, ref) {
|
|
5735
5841
|
return /* @__PURE__ */ jsx15(
|
|
5736
5842
|
InputFieldComponent,
|
|
5737
5843
|
{
|
|
@@ -5745,7 +5851,7 @@ InputFieldComponent.email = forwardRef8(function Email({ ...props }, ref) {
|
|
|
5745
5851
|
}
|
|
5746
5852
|
);
|
|
5747
5853
|
});
|
|
5748
|
-
InputFieldComponent.password =
|
|
5854
|
+
InputFieldComponent.password = forwardRef11(function Password({ ...props }, ref) {
|
|
5749
5855
|
const [isPassword, setIsPassword] = useBooleanState(true);
|
|
5750
5856
|
return /* @__PURE__ */ jsx15(
|
|
5751
5857
|
InputFieldComponent,
|
|
@@ -5762,16 +5868,16 @@ InputFieldComponent.password = forwardRef8(function Password({ ...props }, ref)
|
|
|
5762
5868
|
}
|
|
5763
5869
|
);
|
|
5764
5870
|
});
|
|
5765
|
-
InputFieldComponent.search =
|
|
5871
|
+
InputFieldComponent.search = forwardRef11(function Search({ ...props }, ref) {
|
|
5766
5872
|
return /* @__PURE__ */ jsx15(InputFieldComponent, { leftIcon: "magnifyingGlass", placeholder: "Search...", ref, ...props });
|
|
5767
5873
|
});
|
|
5768
|
-
InputFieldComponent.phoneNumber =
|
|
5874
|
+
InputFieldComponent.phoneNumber = forwardRef11(function PhoneNumber({ label, value, onChangeValue, labelColor, id, ...props }, ref) {
|
|
5769
5875
|
const theme2 = useTheme();
|
|
5770
5876
|
const internalId = useId();
|
|
5771
5877
|
const [dropdownValue, setDropdownValue] = useState6();
|
|
5772
5878
|
const [inputFieldValue, setInputFieldValue] = useState6(value?.toString() ?? "");
|
|
5773
5879
|
const renderOption = useCallback8(
|
|
5774
|
-
(option, index, isSelected) => /* @__PURE__ */
|
|
5880
|
+
(option, index, isSelected) => /* @__PURE__ */ jsxs11(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: [
|
|
5775
5881
|
/* @__PURE__ */ jsx15(Image_default, { src: `https://flagcdn.com/w80/${option.data?.code.toString().toLowerCase()}.webp`, width: 20 }),
|
|
5776
5882
|
/* @__PURE__ */ jsx15(Text_default, { children: option.label })
|
|
5777
5883
|
] }),
|
|
@@ -5816,7 +5922,7 @@ InputFieldComponent.phoneNumber = forwardRef8(function PhoneNumber({ label, valu
|
|
|
5816
5922
|
setInputFieldValue(newValue.slice(country?.phoneNumberExtension.length + 1));
|
|
5817
5923
|
}, [value]);
|
|
5818
5924
|
const readyId = id ?? internalId;
|
|
5819
|
-
return /* @__PURE__ */
|
|
5925
|
+
return /* @__PURE__ */ jsxs11(Div_default.column, { width: "100%", gap: theme2.styles.gap / 2, children: [
|
|
5820
5926
|
label && /* @__PURE__ */ jsx15(
|
|
5821
5927
|
Label_default,
|
|
5822
5928
|
{
|
|
@@ -5827,7 +5933,7 @@ InputFieldComponent.phoneNumber = forwardRef8(function PhoneNumber({ label, valu
|
|
|
5827
5933
|
htmlFor: readyId
|
|
5828
5934
|
}
|
|
5829
5935
|
),
|
|
5830
|
-
/* @__PURE__ */
|
|
5936
|
+
/* @__PURE__ */ jsxs11(Div_default.row, { children: [
|
|
5831
5937
|
/* @__PURE__ */ jsx15(
|
|
5832
5938
|
Dropdown_default,
|
|
5833
5939
|
{
|
|
@@ -5840,8 +5946,10 @@ InputFieldComponent.phoneNumber = forwardRef8(function PhoneNumber({ label, valu
|
|
|
5840
5946
|
inputFieldClassName: "react-better-html-phone-number-holder",
|
|
5841
5947
|
defaultValue,
|
|
5842
5948
|
value: dropdownValue,
|
|
5949
|
+
disabled: props.disabled,
|
|
5843
5950
|
onChange: setDropdownValue,
|
|
5844
|
-
withoutClearButton: true
|
|
5951
|
+
withoutClearButton: true,
|
|
5952
|
+
withoutRenderingOptionsWhenClosed: true
|
|
5845
5953
|
}
|
|
5846
5954
|
),
|
|
5847
5955
|
/* @__PURE__ */ jsx15(
|
|
@@ -5859,7 +5967,7 @@ InputFieldComponent.phoneNumber = forwardRef8(function PhoneNumber({ label, valu
|
|
|
5859
5967
|
] })
|
|
5860
5968
|
] });
|
|
5861
5969
|
});
|
|
5862
|
-
InputFieldComponent.date =
|
|
5970
|
+
InputFieldComponent.date = forwardRef11(function Date2({ minDate, maxDate, ...props }, ref) {
|
|
5863
5971
|
const theme2 = useTheme();
|
|
5864
5972
|
const holderRef = useRef4(null);
|
|
5865
5973
|
const isMobileIOS = isMobileDevice && getBrowser() === "safari";
|
|
@@ -5898,7 +6006,7 @@ InputFieldComponent.date = forwardRef8(function Date2({ minDate, maxDate, ...pro
|
|
|
5898
6006
|
}
|
|
5899
6007
|
);
|
|
5900
6008
|
});
|
|
5901
|
-
InputFieldComponent.dateTime =
|
|
6009
|
+
InputFieldComponent.dateTime = forwardRef11(function DateTime({ minDate, maxDate, ...props }, ref) {
|
|
5902
6010
|
const theme2 = useTheme();
|
|
5903
6011
|
const holderRef = useRef4(null);
|
|
5904
6012
|
const selectedHourRef = useRef4(null);
|
|
@@ -5961,9 +6069,9 @@ InputFieldComponent.dateTime = forwardRef8(function DateTime({ minDate, maxDate,
|
|
|
5961
6069
|
overflow: "hidden",
|
|
5962
6070
|
userSelect: "none",
|
|
5963
6071
|
...insideInputFieldComponentProps,
|
|
5964
|
-
children: /* @__PURE__ */
|
|
6072
|
+
children: /* @__PURE__ */ jsxs11(Div_default.row, { gap: theme2.styles.space, children: [
|
|
5965
6073
|
/* @__PURE__ */ jsx15(Calendar_default, { value: internalValue, minDate, maxDate, onChange }),
|
|
5966
|
-
/* @__PURE__ */
|
|
6074
|
+
/* @__PURE__ */ jsxs11(
|
|
5967
6075
|
Div_default.row,
|
|
5968
6076
|
{
|
|
5969
6077
|
height: 276,
|
|
@@ -5972,7 +6080,7 @@ InputFieldComponent.dateTime = forwardRef8(function DateTime({ minDate, maxDate,
|
|
|
5972
6080
|
paddingBottom: theme2.styles.space / 2,
|
|
5973
6081
|
paddingRight: theme2.styles.space / 2,
|
|
5974
6082
|
children: [
|
|
5975
|
-
/* @__PURE__ */
|
|
6083
|
+
/* @__PURE__ */ jsxs11(Div_default, { height: "100%", children: [
|
|
5976
6084
|
/* @__PURE__ */ jsx15(Text_default, { fontSize: 14, fontWeight: 700, textAlign: "center", marginBottom: theme2.styles.gap / 2, children: "H" }),
|
|
5977
6085
|
/* @__PURE__ */ jsx15(
|
|
5978
6086
|
Div_default,
|
|
@@ -6005,7 +6113,7 @@ InputFieldComponent.dateTime = forwardRef8(function DateTime({ minDate, maxDate,
|
|
|
6005
6113
|
}
|
|
6006
6114
|
)
|
|
6007
6115
|
] }),
|
|
6008
|
-
/* @__PURE__ */
|
|
6116
|
+
/* @__PURE__ */ jsxs11(Div_default, { height: "100%", children: [
|
|
6009
6117
|
/* @__PURE__ */ jsx15(Text_default, { fontSize: 14, fontWeight: 700, textAlign: "center", marginBottom: theme2.styles.gap / 2, children: "M" }),
|
|
6010
6118
|
/* @__PURE__ */ jsx15(
|
|
6011
6119
|
Div_default,
|
|
@@ -6051,7 +6159,7 @@ InputFieldComponent.dateTime = forwardRef8(function DateTime({ minDate, maxDate,
|
|
|
6051
6159
|
}
|
|
6052
6160
|
);
|
|
6053
6161
|
});
|
|
6054
|
-
InputFieldComponent.time =
|
|
6162
|
+
InputFieldComponent.time = forwardRef11(function Time({ ...props }, ref) {
|
|
6055
6163
|
const theme2 = useTheme();
|
|
6056
6164
|
const holderRef = useRef4(null);
|
|
6057
6165
|
const selectedHourRef = useRef4(null);
|
|
@@ -6101,7 +6209,7 @@ InputFieldComponent.time = forwardRef8(function Time({ ...props }, ref) {
|
|
|
6101
6209
|
overflowY: "auto",
|
|
6102
6210
|
userSelect: "none",
|
|
6103
6211
|
...insideInputFieldComponentProps,
|
|
6104
|
-
children: /* @__PURE__ */
|
|
6212
|
+
children: /* @__PURE__ */ jsxs11(Div_default.row, { height: "100%", children: [
|
|
6105
6213
|
/* @__PURE__ */ jsx15(Div_default, { className: "react-better-html-no-scrollbar", width: buttonWidth, height: "100%", overflowY: "auto", children: hours.map((hour) => {
|
|
6106
6214
|
const isSelected = hour.toString() === valueHour;
|
|
6107
6215
|
return /* @__PURE__ */ jsx15(
|
|
@@ -6153,7 +6261,7 @@ InputFieldComponent.time = forwardRef8(function Time({ ...props }, ref) {
|
|
|
6153
6261
|
}
|
|
6154
6262
|
);
|
|
6155
6263
|
});
|
|
6156
|
-
InputFieldComponent.color =
|
|
6264
|
+
InputFieldComponent.color = forwardRef11(function Color2({ value, onChangeValue, ...props }, ref) {
|
|
6157
6265
|
const [inputFieldValue, setInputFieldValue] = useState6(value ?? "#000000");
|
|
6158
6266
|
const onChangeValueElement = useCallback8(
|
|
6159
6267
|
(value2) => {
|
|
@@ -6204,9 +6312,9 @@ InputField2.color = InputFieldComponent.color;
|
|
|
6204
6312
|
var InputField_default = InputField2;
|
|
6205
6313
|
|
|
6206
6314
|
// src/components/ToggleInput.tsx
|
|
6207
|
-
import { forwardRef as
|
|
6315
|
+
import { forwardRef as forwardRef12, useCallback as useCallback9, useId as useId2, useState as useState7 } from "react";
|
|
6208
6316
|
import styled9 from "styled-components";
|
|
6209
|
-
import { jsx as jsx16, jsxs as
|
|
6317
|
+
import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
6210
6318
|
var componentSize = 26;
|
|
6211
6319
|
var switchComponentBallGap = 3;
|
|
6212
6320
|
var switchComponentMouseDownDifference = 4;
|
|
@@ -6299,7 +6407,7 @@ var SwitchElement = styled9.div.withConfig({
|
|
|
6299
6407
|
${(props) => props.hoverStyle}
|
|
6300
6408
|
}
|
|
6301
6409
|
`;
|
|
6302
|
-
var ToggleInputComponent =
|
|
6410
|
+
var ToggleInputComponent = forwardRef12(function ToggleInput({
|
|
6303
6411
|
label,
|
|
6304
6412
|
labelColor,
|
|
6305
6413
|
text,
|
|
@@ -6336,10 +6444,10 @@ var ToggleInputComponent = forwardRef9(function ToggleInput({
|
|
|
6336
6444
|
onChange?.(newIsChecked, value);
|
|
6337
6445
|
}, [checked, controlledChecked, onChange, value]);
|
|
6338
6446
|
const readyId = id ?? internalId;
|
|
6339
|
-
return /* @__PURE__ */
|
|
6447
|
+
return /* @__PURE__ */ jsxs12(Div_default.column, { width: "100%", gap: theme2.styles.gap, ...styledComponentStylesWithExcluded, children: [
|
|
6340
6448
|
label && /* @__PURE__ */ jsx16(Label_default, { text: label, color: labelColor, required, isError: !!errorText, htmlFor: readyId }),
|
|
6341
|
-
/* @__PURE__ */
|
|
6342
|
-
/* @__PURE__ */
|
|
6449
|
+
/* @__PURE__ */ jsxs12(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: [
|
|
6450
|
+
/* @__PURE__ */ jsxs12(Div_default.row, { position: "relative", alignItems: "center", children: [
|
|
6343
6451
|
/* @__PURE__ */ jsx16(
|
|
6344
6452
|
InputElement2,
|
|
6345
6453
|
{
|
|
@@ -6384,9 +6492,9 @@ var ToggleInputComponent = forwardRef9(function ToggleInput({
|
|
|
6384
6492
|
}
|
|
6385
6493
|
) : void 0
|
|
6386
6494
|
] }),
|
|
6387
|
-
text && /* @__PURE__ */
|
|
6495
|
+
text && /* @__PURE__ */ jsxs12(Text_default, { color, userSelect: "none", cursor: "pointer", onClick: onClickText, children: [
|
|
6388
6496
|
text,
|
|
6389
|
-
required && !label && /* @__PURE__ */
|
|
6497
|
+
required && !label && /* @__PURE__ */ jsxs12(Text_default, { as: "span", fontSize: 16, color: theme2.colors.error, children: [
|
|
6390
6498
|
" ",
|
|
6391
6499
|
"*"
|
|
6392
6500
|
] })
|
|
@@ -6405,13 +6513,13 @@ var ToggleInputComponent = forwardRef9(function ToggleInput({
|
|
|
6405
6513
|
] });
|
|
6406
6514
|
});
|
|
6407
6515
|
var ToggleInput_default = {
|
|
6408
|
-
checkbox:
|
|
6516
|
+
checkbox: forwardRef12(function Checkbox(props, ref) {
|
|
6409
6517
|
return /* @__PURE__ */ jsx16(ToggleInputComponent, { type: "checkbox", ref, ...props });
|
|
6410
6518
|
}),
|
|
6411
|
-
radiobutton:
|
|
6519
|
+
radiobutton: forwardRef12(function RadioButton(props, ref) {
|
|
6412
6520
|
return /* @__PURE__ */ jsx16(ToggleInputComponent, { type: "radio", ref, ...props });
|
|
6413
6521
|
}),
|
|
6414
|
-
switch:
|
|
6522
|
+
switch: forwardRef12(function Switch({
|
|
6415
6523
|
label,
|
|
6416
6524
|
labelColor,
|
|
6417
6525
|
errorText,
|
|
@@ -6441,7 +6549,7 @@ var ToggleInput_default = {
|
|
|
6441
6549
|
onChange?.(newIsChecked, value);
|
|
6442
6550
|
}, [disabled, checked, onChange, controlledChecked, value]);
|
|
6443
6551
|
const readyId = id ?? internalId;
|
|
6444
|
-
return /* @__PURE__ */
|
|
6552
|
+
return /* @__PURE__ */ jsxs12(Div_default.column, { width: "fit-content", gap: theme2.styles.gap, ...styledComponentStylesWithExcluded, children: [
|
|
6445
6553
|
label && /* @__PURE__ */ jsx16(Label_default, { text: label, color: labelColor, required, isError: !!errorText, htmlFor: readyId }),
|
|
6446
6554
|
/* @__PURE__ */ jsx16(
|
|
6447
6555
|
Div_default.row,
|
|
@@ -6489,24 +6597,26 @@ var ToggleInput_default = {
|
|
|
6489
6597
|
};
|
|
6490
6598
|
|
|
6491
6599
|
// src/components/Form.tsx
|
|
6492
|
-
import { Children, Fragment as Fragment4, memo as memo17, useMemo as useMemo6 } from "react";
|
|
6493
|
-
import { jsx as jsx17, jsxs as
|
|
6494
|
-
function Form({
|
|
6600
|
+
import { Children, forwardRef as forwardRef13, Fragment as Fragment4, memo as memo17, useMemo as useMemo6 } from "react";
|
|
6601
|
+
import { jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
6602
|
+
var FormComponent = forwardRef13(function Form({
|
|
6495
6603
|
form,
|
|
6496
6604
|
submitButtonText,
|
|
6497
6605
|
submitButtonLoaderName,
|
|
6498
6606
|
submitButtonId,
|
|
6499
6607
|
submitButtonIsDisabled,
|
|
6608
|
+
cancelButtonText,
|
|
6500
6609
|
actionButtonsLocation = "right",
|
|
6501
6610
|
gap,
|
|
6502
6611
|
isSubmitting,
|
|
6503
6612
|
isDestructive,
|
|
6504
6613
|
withDividers,
|
|
6614
|
+
renderActionButtons,
|
|
6505
6615
|
onClickCancel,
|
|
6506
6616
|
onSubmit,
|
|
6507
6617
|
children,
|
|
6508
6618
|
...props
|
|
6509
|
-
}) {
|
|
6619
|
+
}, ref) {
|
|
6510
6620
|
const theme2 = useTheme();
|
|
6511
6621
|
const submitButtonIsDisabledInternal = useMemo6(() => {
|
|
6512
6622
|
if (!form || !form.requiredFields) return false;
|
|
@@ -6516,12 +6626,12 @@ function Form({
|
|
|
6516
6626
|
}, [form]);
|
|
6517
6627
|
const SubmitButtonTag = isDestructive ? Button_default.destructive : Button_default;
|
|
6518
6628
|
const submitButtonIsDisabledFinal = submitButtonIsDisabled || submitButtonIsDisabledInternal;
|
|
6519
|
-
return /* @__PURE__ */ jsx17(Div_default, { width: "100%", ...props, children: /* @__PURE__ */
|
|
6520
|
-
gap !== void 0 || withDividers ? /* @__PURE__ */ jsx17(Div_default.column, { gap: gap ?? (withDividers ? theme2.styles.space : theme2.styles.gap), children: withDividers ? Children.toArray(children).map((child, index) => /* @__PURE__ */
|
|
6629
|
+
return /* @__PURE__ */ jsx17(Div_default, { width: "100%", ...props, children: /* @__PURE__ */ jsxs13("form", { onSubmit: onSubmit ?? form?.onSubmit, ref, children: [
|
|
6630
|
+
gap !== void 0 || withDividers ? /* @__PURE__ */ jsx17(Div_default.column, { gap: gap ?? (withDividers ? theme2.styles.space : theme2.styles.gap), children: withDividers ? Children.toArray(children).map((child, index) => /* @__PURE__ */ jsxs13(Fragment4, { children: [
|
|
6521
6631
|
child,
|
|
6522
6632
|
index < Children.toArray(children).length - 1 && /* @__PURE__ */ jsx17(Divider_default.horizontal, {})
|
|
6523
6633
|
] }, index)) : children }) : children,
|
|
6524
|
-
submitButtonText && /* @__PURE__ */
|
|
6634
|
+
submitButtonText && /* @__PURE__ */ jsxs13(
|
|
6525
6635
|
Div_default.row,
|
|
6526
6636
|
{
|
|
6527
6637
|
alignItems: "center",
|
|
@@ -6529,7 +6639,8 @@ function Form({
|
|
|
6529
6639
|
gap: theme2.styles.gap,
|
|
6530
6640
|
marginTop: theme2.styles.space,
|
|
6531
6641
|
children: [
|
|
6532
|
-
|
|
6642
|
+
renderActionButtons,
|
|
6643
|
+
onClickCancel && /* @__PURE__ */ jsx17(Button_default.secondary, { text: cancelButtonText ?? "Cancel", onClick: onClickCancel }),
|
|
6533
6644
|
/* @__PURE__ */ jsx17(
|
|
6534
6645
|
SubmitButtonTag,
|
|
6535
6646
|
{
|
|
@@ -6545,23 +6656,24 @@ function Form({
|
|
|
6545
6656
|
}
|
|
6546
6657
|
)
|
|
6547
6658
|
] }) });
|
|
6548
|
-
}
|
|
6549
|
-
var
|
|
6659
|
+
});
|
|
6660
|
+
var Form2 = memo17(FormComponent);
|
|
6661
|
+
var Form_default = Form2;
|
|
6550
6662
|
|
|
6551
6663
|
// src/components/FormRow.tsx
|
|
6552
|
-
import { forwardRef as
|
|
6553
|
-
import { jsx as jsx18, jsxs as
|
|
6554
|
-
var FormRowComponent =
|
|
6664
|
+
import { forwardRef as forwardRef14, memo as memo18 } from "react";
|
|
6665
|
+
import { jsx as jsx18, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
6666
|
+
var FormRowComponent = forwardRef14(function FormRow({ oneItemOnly, noBreakingPoint, gap, children, ...props }, ref) {
|
|
6555
6667
|
const theme2 = useTheme();
|
|
6556
6668
|
const mediaQuery = useMediaQuery();
|
|
6557
6669
|
const breakingPoint = !noBreakingPoint ? mediaQuery.size900 : false;
|
|
6558
6670
|
const readyGap = breakingPoint || noBreakingPoint && mediaQuery.size900 ? theme2.styles.gap : theme2.styles.space * 2;
|
|
6559
|
-
return /* @__PURE__ */
|
|
6671
|
+
return /* @__PURE__ */ jsxs14(Div_default.row, { alignItems: "center", gap: gap ?? readyGap, invertFlexDirection: breakingPoint, ...props, ref, children: [
|
|
6560
6672
|
children,
|
|
6561
6673
|
oneItemOnly && /* @__PURE__ */ jsx18(Div_default, { width: "100%" })
|
|
6562
6674
|
] });
|
|
6563
6675
|
});
|
|
6564
|
-
FormRowComponent.withTitle =
|
|
6676
|
+
FormRowComponent.withTitle = forwardRef14(function WithTitle({
|
|
6565
6677
|
icon,
|
|
6566
6678
|
title,
|
|
6567
6679
|
description,
|
|
@@ -6575,15 +6687,15 @@ FormRowComponent.withTitle = forwardRef10(function WithTitle({
|
|
|
6575
6687
|
}, ref) {
|
|
6576
6688
|
const theme2 = useTheme();
|
|
6577
6689
|
const mediaQuery = useMediaQuery();
|
|
6578
|
-
return /* @__PURE__ */
|
|
6579
|
-
/* @__PURE__ */
|
|
6690
|
+
return /* @__PURE__ */ jsxs14(FormRowComponent, { ...props, ref, children: [
|
|
6691
|
+
/* @__PURE__ */ jsxs14(Div_default.row, { width: "100%", alignItems: "center", gap: theme2.styles.space, children: [
|
|
6580
6692
|
icon && /* @__PURE__ */ jsx18(Icon_default, { name: icon }),
|
|
6581
|
-
/* @__PURE__ */
|
|
6693
|
+
/* @__PURE__ */ jsxs14(Div_default.column, { flex: 1, gap: theme2.styles.gap / 2, children: [
|
|
6582
6694
|
/* @__PURE__ */ jsx18(Text_default, { as: "h3", children: title }),
|
|
6583
6695
|
description && /* @__PURE__ */ jsx18(Text_default, { color: theme2.colors.textSecondary, children: description })
|
|
6584
6696
|
] })
|
|
6585
6697
|
] }),
|
|
6586
|
-
/* @__PURE__ */
|
|
6698
|
+
/* @__PURE__ */ jsxs14(
|
|
6587
6699
|
Div_default.row,
|
|
6588
6700
|
{
|
|
6589
6701
|
width: props.noBreakingPoint && mediaQuery.size900 ? void 0 : "100%",
|
|
@@ -6591,7 +6703,7 @@ FormRowComponent.withTitle = forwardRef10(function WithTitle({
|
|
|
6591
6703
|
gap: theme2.styles.gap,
|
|
6592
6704
|
children: [
|
|
6593
6705
|
children,
|
|
6594
|
-
withActions && /* @__PURE__ */
|
|
6706
|
+
withActions && /* @__PURE__ */ jsxs14(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: [
|
|
6595
6707
|
onClickReset && /* @__PURE__ */ jsx18(Button_default.icon, { icon: "XMark", loaderName: resetButtonLoaderName, onClick: onClickReset }),
|
|
6596
6708
|
/* @__PURE__ */ jsx18(Button_default.icon, { icon: "check", loaderName: saveButtonLoaderName, onClick: onClickSave })
|
|
6597
6709
|
] })
|
|
@@ -6606,7 +6718,7 @@ var FormRow_default = FormRow2;
|
|
|
6606
6718
|
|
|
6607
6719
|
// src/components/ColorThemeSwitch.tsx
|
|
6608
6720
|
import { memo as memo19, useEffect as useEffect8 } from "react";
|
|
6609
|
-
import { jsx as jsx19, jsxs as
|
|
6721
|
+
import { jsx as jsx19, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
6610
6722
|
var ColorThemeSwitchComponent = function ColorThemeSwitch({
|
|
6611
6723
|
withMoon,
|
|
6612
6724
|
className,
|
|
@@ -6654,7 +6766,7 @@ var ColorThemeSwitchComponent = function ColorThemeSwitch({
|
|
|
6654
6766
|
};
|
|
6655
6767
|
ColorThemeSwitchComponent.withText = function WithText({ withMoon, className, ...props }) {
|
|
6656
6768
|
const theme2 = useTheme();
|
|
6657
|
-
return /* @__PURE__ */
|
|
6769
|
+
return /* @__PURE__ */ jsxs15(Div_default.row, { width: "fit-content", alignItems: "center", gap: theme2.styles.gap, userSelect: "none", ...props, children: [
|
|
6658
6770
|
/* @__PURE__ */ jsx19(Text_default, { children: "Light" }),
|
|
6659
6771
|
/* @__PURE__ */ jsx19(ColorThemeSwitchComponent, { withMoon, className }),
|
|
6660
6772
|
/* @__PURE__ */ jsx19(Text_default, { children: "Dark" })
|
|
@@ -6665,10 +6777,20 @@ ColorThemeSwitch2.withText = ColorThemeSwitchComponent.withText;
|
|
|
6665
6777
|
var ColorThemeSwitch_default = ColorThemeSwitch2;
|
|
6666
6778
|
|
|
6667
6779
|
// src/components/Table.tsx
|
|
6668
|
-
import {
|
|
6780
|
+
import {
|
|
6781
|
+
forwardRef as forwardRef15,
|
|
6782
|
+
memo as memo20,
|
|
6783
|
+
useCallback as useCallback10,
|
|
6784
|
+
useMemo as useMemo7,
|
|
6785
|
+
useState as useState8,
|
|
6786
|
+
useImperativeHandle as useImperativeHandle2,
|
|
6787
|
+
useRef as useRef5,
|
|
6788
|
+
useEffect as useEffect9
|
|
6789
|
+
} from "react";
|
|
6669
6790
|
import styled10, { css as css2 } from "styled-components";
|
|
6670
|
-
import { Fragment as Fragment5, jsx as jsx20, jsxs as
|
|
6791
|
+
import { Fragment as Fragment5, jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
6671
6792
|
var defaultImageWidth = 120;
|
|
6793
|
+
var maximumVisiblePages = 11;
|
|
6672
6794
|
var TableStyledComponent = styled10.table.withConfig({
|
|
6673
6795
|
shouldForwardProp: (prop) => !["isStriped", "withHover", "withStickyHeader", "colorTheme", "theme"].includes(prop)
|
|
6674
6796
|
})`
|
|
@@ -6684,6 +6806,10 @@ var TableStyledComponent = styled10.table.withConfig({
|
|
|
6684
6806
|
font-weight: 700;
|
|
6685
6807
|
}
|
|
6686
6808
|
|
|
6809
|
+
&.isFooter {
|
|
6810
|
+
background-color: ${(props) => props.theme.colors.backgroundSecondary};
|
|
6811
|
+
}
|
|
6812
|
+
|
|
6687
6813
|
&.isClickable {
|
|
6688
6814
|
cursor: pointer;
|
|
6689
6815
|
}
|
|
@@ -6732,20 +6858,70 @@ var TdStyledComponent = styled10.td.withConfig({
|
|
|
6732
6858
|
})`
|
|
6733
6859
|
${(props) => props.textAlign ? `text-align: ${props.textAlign} !important;` : ""}
|
|
6734
6860
|
`;
|
|
6735
|
-
var
|
|
6861
|
+
var filterPresetsText = {
|
|
6862
|
+
today: "Today",
|
|
6863
|
+
yesterday: "Yesterday",
|
|
6864
|
+
thisWeek: "This week",
|
|
6865
|
+
thisMonth: "This month",
|
|
6866
|
+
thisYear: "This year",
|
|
6867
|
+
lastWeek: "Last week",
|
|
6868
|
+
lastMonth: "Last month",
|
|
6869
|
+
lastYear: "Last year",
|
|
6870
|
+
nextWeek: "Next week",
|
|
6871
|
+
nextMonth: "Next month",
|
|
6872
|
+
nextYear: "Next year"
|
|
6873
|
+
};
|
|
6874
|
+
var TableComponent = forwardRef15(function Table({
|
|
6736
6875
|
columns,
|
|
6737
6876
|
data,
|
|
6738
6877
|
isStriped,
|
|
6739
6878
|
isLoading,
|
|
6740
6879
|
withStickyHeader,
|
|
6741
6880
|
noDataItemsMessage = "No data available",
|
|
6881
|
+
pageSize,
|
|
6742
6882
|
onClickRow,
|
|
6743
6883
|
onClickAllCheckboxes,
|
|
6884
|
+
onChangePage,
|
|
6885
|
+
onChangeFilter,
|
|
6744
6886
|
...props
|
|
6745
6887
|
}, ref) {
|
|
6746
|
-
const { colorTheme } = useBetterHtmlContextInternal();
|
|
6747
6888
|
const theme2 = useTheme();
|
|
6889
|
+
const mediumScreen = useMediaQuery();
|
|
6890
|
+
const { colorTheme } = useBetterHtmlContextInternal();
|
|
6891
|
+
const filterModalRef = useRef5(null);
|
|
6748
6892
|
const [checkedItems, setCheckedItems] = useState8([]);
|
|
6893
|
+
const [currentPage, setCurrentPage] = useState8(1);
|
|
6894
|
+
const [filterData, setFilterData] = useState8({});
|
|
6895
|
+
const [openedFilterColumnIndex, setOpenedFilterColumnIndex] = useState8();
|
|
6896
|
+
const [filterListSelectedItems, setFilterListSelectedItems] = useState8();
|
|
6897
|
+
const openedFilterData = openedFilterColumnIndex ? filterData[openedFilterColumnIndex] : void 0;
|
|
6898
|
+
const openedFilterColumn = openedFilterColumnIndex ? columns[openedFilterColumnIndex] : void 0;
|
|
6899
|
+
const filterForm = useForm({
|
|
6900
|
+
defaultValues: {
|
|
6901
|
+
min: void 0,
|
|
6902
|
+
max: void 0
|
|
6903
|
+
},
|
|
6904
|
+
onSubmit: (values) => {
|
|
6905
|
+
if (!openedFilterColumn?.filter) return;
|
|
6906
|
+
if (openedFilterColumnIndex === void 0) return;
|
|
6907
|
+
setFilterData((oldValue) => ({
|
|
6908
|
+
...oldValue,
|
|
6909
|
+
[openedFilterColumnIndex]: openedFilterColumn.filter === "number" ? {
|
|
6910
|
+
type: openedFilterColumn.filter,
|
|
6911
|
+
min: values.min,
|
|
6912
|
+
max: values.max
|
|
6913
|
+
} : openedFilterColumn.filter === "date" || openedFilterColumn.filter === "date-time" ? {
|
|
6914
|
+
type: openedFilterColumn.filter,
|
|
6915
|
+
min: values.min,
|
|
6916
|
+
max: values.max
|
|
6917
|
+
} : openedFilterColumn.filter === "list" ? {
|
|
6918
|
+
type: openedFilterColumn.filter,
|
|
6919
|
+
list: filterListSelectedItems
|
|
6920
|
+
} : void 0
|
|
6921
|
+
}));
|
|
6922
|
+
filterModalRef.current?.close();
|
|
6923
|
+
}
|
|
6924
|
+
});
|
|
6749
6925
|
const renderCellContent = useCallback10(
|
|
6750
6926
|
(column, item, index) => {
|
|
6751
6927
|
switch (column.type) {
|
|
@@ -6798,74 +6974,506 @@ var TableComponent = forwardRef11(function Table({
|
|
|
6798
6974
|
},
|
|
6799
6975
|
[onClickAllCheckboxes, data]
|
|
6800
6976
|
);
|
|
6977
|
+
const onClickFilterButton = useCallback10(
|
|
6978
|
+
(columnIndex) => {
|
|
6979
|
+
const thisFilterData = filterData[columnIndex];
|
|
6980
|
+
if (thisFilterData?.type === "number" || thisFilterData?.type === "date" || thisFilterData?.type === "date-time") {
|
|
6981
|
+
filterForm.setFieldsValue({
|
|
6982
|
+
min: thisFilterData.min ?? void 0,
|
|
6983
|
+
max: thisFilterData.max ?? void 0
|
|
6984
|
+
});
|
|
6985
|
+
} else if (thisFilterData?.type === "list") {
|
|
6986
|
+
setFilterListSelectedItems(thisFilterData.list);
|
|
6987
|
+
}
|
|
6988
|
+
setOpenedFilterColumnIndex(columnIndex);
|
|
6989
|
+
filterModalRef.current?.open();
|
|
6990
|
+
},
|
|
6991
|
+
[filterData]
|
|
6992
|
+
);
|
|
6993
|
+
const onCloseFilterModal = useCallback10(() => {
|
|
6994
|
+
setTimeout(() => setOpenedFilterColumnIndex(void 0), 0.2 * 1e3);
|
|
6995
|
+
setFilterListSelectedItems(void 0);
|
|
6996
|
+
filterForm.reset();
|
|
6997
|
+
}, []);
|
|
6998
|
+
const onClickCancelFormFilter = useCallback10(() => {
|
|
6999
|
+
if (openedFilterColumnIndex === void 0) return;
|
|
7000
|
+
setFilterData((oldValue) => ({
|
|
7001
|
+
...oldValue,
|
|
7002
|
+
[openedFilterColumnIndex]: void 0
|
|
7003
|
+
}));
|
|
7004
|
+
filterModalRef.current?.close();
|
|
7005
|
+
}, [openedFilterColumnIndex]);
|
|
7006
|
+
const onClickFilterListItem = useCallback10(
|
|
7007
|
+
(value) => setFilterListSelectedItems((oldValue) => {
|
|
7008
|
+
if (!oldValue) return [value];
|
|
7009
|
+
if (oldValue.includes(value)) return oldValue.filter((item) => item !== value);
|
|
7010
|
+
return [...oldValue, value];
|
|
7011
|
+
}),
|
|
7012
|
+
[]
|
|
7013
|
+
);
|
|
7014
|
+
const onClickFilterPreset = useCallback10(
|
|
7015
|
+
(preset) => {
|
|
7016
|
+
const getValueForDate = (date) => {
|
|
7017
|
+
if (openedFilterColumn?.filter === "date") return date.toISOString().split("T")[0];
|
|
7018
|
+
return date.toISOString();
|
|
7019
|
+
};
|
|
7020
|
+
switch (preset) {
|
|
7021
|
+
case "today":
|
|
7022
|
+
filterForm.setFieldsValue({
|
|
7023
|
+
min: getValueForDate(/* @__PURE__ */ new Date()),
|
|
7024
|
+
max: getValueForDate(/* @__PURE__ */ new Date())
|
|
7025
|
+
});
|
|
7026
|
+
break;
|
|
7027
|
+
case "yesterday":
|
|
7028
|
+
filterForm.setFieldsValue({
|
|
7029
|
+
min: getValueForDate(new Date((/* @__PURE__ */ new Date()).setDate((/* @__PURE__ */ new Date()).getDate() - 1))),
|
|
7030
|
+
max: getValueForDate(new Date((/* @__PURE__ */ new Date()).setDate((/* @__PURE__ */ new Date()).getDate() - 1)))
|
|
7031
|
+
});
|
|
7032
|
+
break;
|
|
7033
|
+
case "thisWeek":
|
|
7034
|
+
filterForm.setFieldsValue({
|
|
7035
|
+
min: getValueForDate(new Date((/* @__PURE__ */ new Date()).setDate((/* @__PURE__ */ new Date()).getDate() - 7))),
|
|
7036
|
+
max: getValueForDate(/* @__PURE__ */ new Date())
|
|
7037
|
+
});
|
|
7038
|
+
break;
|
|
7039
|
+
case "thisMonth":
|
|
7040
|
+
filterForm.setFieldsValue({
|
|
7041
|
+
min: getValueForDate(new Date((/* @__PURE__ */ new Date()).setMonth((/* @__PURE__ */ new Date()).getMonth() - 1))),
|
|
7042
|
+
max: getValueForDate(/* @__PURE__ */ new Date())
|
|
7043
|
+
});
|
|
7044
|
+
break;
|
|
7045
|
+
case "thisYear":
|
|
7046
|
+
filterForm.setFieldsValue({
|
|
7047
|
+
min: getValueForDate(new Date((/* @__PURE__ */ new Date()).setFullYear((/* @__PURE__ */ new Date()).getFullYear() - 1))),
|
|
7048
|
+
max: getValueForDate(/* @__PURE__ */ new Date())
|
|
7049
|
+
});
|
|
7050
|
+
break;
|
|
7051
|
+
case "lastWeek":
|
|
7052
|
+
filterForm.setFieldsValue({
|
|
7053
|
+
min: getValueForDate(new Date((/* @__PURE__ */ new Date()).setDate((/* @__PURE__ */ new Date()).getDate() - 7))),
|
|
7054
|
+
max: getValueForDate(new Date((/* @__PURE__ */ new Date()).setDate((/* @__PURE__ */ new Date()).getDate() - 1)))
|
|
7055
|
+
});
|
|
7056
|
+
break;
|
|
7057
|
+
case "lastMonth":
|
|
7058
|
+
filterForm.setFieldsValue({
|
|
7059
|
+
min: getValueForDate(new Date((/* @__PURE__ */ new Date()).setMonth((/* @__PURE__ */ new Date()).getMonth() - 1))),
|
|
7060
|
+
max: getValueForDate(new Date((/* @__PURE__ */ new Date()).setDate((/* @__PURE__ */ new Date()).getDate() - 1)))
|
|
7061
|
+
});
|
|
7062
|
+
break;
|
|
7063
|
+
case "lastYear":
|
|
7064
|
+
filterForm.setFieldsValue({
|
|
7065
|
+
min: getValueForDate(new Date((/* @__PURE__ */ new Date()).setFullYear((/* @__PURE__ */ new Date()).getFullYear() - 1))),
|
|
7066
|
+
max: getValueForDate(new Date((/* @__PURE__ */ new Date()).setDate((/* @__PURE__ */ new Date()).getDate() - 1)))
|
|
7067
|
+
});
|
|
7068
|
+
break;
|
|
7069
|
+
case "nextWeek":
|
|
7070
|
+
filterForm.setFieldsValue({
|
|
7071
|
+
min: getValueForDate(new Date((/* @__PURE__ */ new Date()).setDate((/* @__PURE__ */ new Date()).getDate() + 7))),
|
|
7072
|
+
max: getValueForDate(new Date((/* @__PURE__ */ new Date()).setDate((/* @__PURE__ */ new Date()).getDate() + 7)))
|
|
7073
|
+
});
|
|
7074
|
+
break;
|
|
7075
|
+
case "nextMonth":
|
|
7076
|
+
filterForm.setFieldsValue({
|
|
7077
|
+
min: getValueForDate(new Date((/* @__PURE__ */ new Date()).setMonth((/* @__PURE__ */ new Date()).getMonth() + 1))),
|
|
7078
|
+
max: getValueForDate(new Date((/* @__PURE__ */ new Date()).setMonth((/* @__PURE__ */ new Date()).getMonth() + 1)))
|
|
7079
|
+
});
|
|
7080
|
+
break;
|
|
7081
|
+
case "nextYear":
|
|
7082
|
+
filterForm.setFieldsValue({
|
|
7083
|
+
min: getValueForDate(new Date((/* @__PURE__ */ new Date()).setFullYear((/* @__PURE__ */ new Date()).getFullYear() + 1))),
|
|
7084
|
+
max: getValueForDate(new Date((/* @__PURE__ */ new Date()).setFullYear((/* @__PURE__ */ new Date()).getFullYear() + 1)))
|
|
7085
|
+
});
|
|
7086
|
+
break;
|
|
7087
|
+
default:
|
|
7088
|
+
break;
|
|
7089
|
+
}
|
|
7090
|
+
},
|
|
7091
|
+
[openedFilterColumn]
|
|
7092
|
+
);
|
|
7093
|
+
const dataAfterFilter = useMemo7(
|
|
7094
|
+
() => data.filter(
|
|
7095
|
+
(item) => Object.entries(filterData).every(([columnIndex, filter]) => {
|
|
7096
|
+
if (!filter) return true;
|
|
7097
|
+
const column = columns[parseInt(columnIndex)];
|
|
7098
|
+
if (!column) return true;
|
|
7099
|
+
if (column.filter === "number" && filter.type === "number") {
|
|
7100
|
+
const itemValue = column.getValue?.(item) ?? (column.type === "text" && column.keyName ? Number(item[column.keyName]) : 0);
|
|
7101
|
+
if (filter.min !== void 0 && itemValue < filter.min) return false;
|
|
7102
|
+
if (filter.max !== void 0 && itemValue > filter.max) return false;
|
|
7103
|
+
} else if (column.filter === "date" && filter.type === "date" || column.filter === "date-time" && filter.type === "date-time") {
|
|
7104
|
+
const minDate = filter.min ? new Date(filter.min) : void 0;
|
|
7105
|
+
const maxDate = filter.max ? new Date(filter.max) : void 0;
|
|
7106
|
+
const itemValue = column.getValue?.(item) ?? new Date(column.type === "text" && column.keyName ? String(item[column.keyName]) : "");
|
|
7107
|
+
if (filter.min !== void 0 && minDate && itemValue < minDate) return false;
|
|
7108
|
+
if (filter.max !== void 0 && maxDate && itemValue > maxDate) return false;
|
|
7109
|
+
} else if (column.filter === "list" && filter.type === "list") {
|
|
7110
|
+
const itemValue = column.getValueForList?.(item) ?? (column.type === "text" && column.keyName ? String(item[column.keyName]) : "");
|
|
7111
|
+
if (!filter.list?.includes(itemValue)) return false;
|
|
7112
|
+
}
|
|
7113
|
+
return true;
|
|
7114
|
+
})
|
|
7115
|
+
),
|
|
7116
|
+
[data, filterData, columns]
|
|
7117
|
+
);
|
|
7118
|
+
const dataAfterPagination = useMemo7(() => {
|
|
7119
|
+
if (pageSize === void 0) return dataAfterFilter;
|
|
7120
|
+
const pageStartItemIndex = (currentPage - 1) * (pageSize ?? 0);
|
|
7121
|
+
const pageEndItemIndex = pageStartItemIndex + (pageSize ?? 0);
|
|
7122
|
+
return dataAfterFilter.slice(pageStartItemIndex, pageEndItemIndex);
|
|
7123
|
+
}, [dataAfterFilter, pageSize, currentPage]);
|
|
6801
7124
|
const everythingIsChecked = useMemo7(() => {
|
|
6802
7125
|
return checkedItems.every((checked) => checked) && checkedItems.length === data.length;
|
|
6803
7126
|
}, [data, checkedItems]);
|
|
6804
|
-
|
|
6805
|
-
|
|
6806
|
-
|
|
6807
|
-
|
|
6808
|
-
|
|
6809
|
-
|
|
6810
|
-
|
|
6811
|
-
|
|
6812
|
-
|
|
6813
|
-
|
|
6814
|
-
|
|
6815
|
-
|
|
6816
|
-
|
|
6817
|
-
|
|
6818
|
-
|
|
6819
|
-
|
|
6820
|
-
|
|
6821
|
-
|
|
6822
|
-
ThStyledComponent,
|
|
6823
|
-
{
|
|
6824
|
-
width: column.type === "image" ? defaultImageWidth : column.type === "checkbox" ? 26 : column.width,
|
|
6825
|
-
minWidth: column.minWidth,
|
|
6826
|
-
maxWidth: column.maxWidth,
|
|
6827
|
-
textAlign: column.align,
|
|
6828
|
-
children: column.label ?? (column.type === "checkbox" && onClickAllCheckboxes ? /* @__PURE__ */ jsx20(
|
|
6829
|
-
ToggleInput_default.checkbox,
|
|
6830
|
-
{
|
|
6831
|
-
checked: everythingIsChecked,
|
|
6832
|
-
onChange: onClickAllCheckboxesElement
|
|
6833
|
-
}
|
|
6834
|
-
) : "")
|
|
6835
|
-
},
|
|
6836
|
-
column.type + column.label + index
|
|
6837
|
-
)) }) }),
|
|
6838
|
-
/* @__PURE__ */ jsx20("tbody", { children: isLoading ? /* @__PURE__ */ jsx20("tr", { children: /* @__PURE__ */ jsx20("td", { className: "noData", colSpan: columns.length, children: /* @__PURE__ */ jsx20(Loader_default.box, {}) }) }) : data.length > 0 ? data.map((item, rowIndex) => /* @__PURE__ */ jsx20(
|
|
6839
|
-
"tr",
|
|
6840
|
-
{
|
|
6841
|
-
className: onClickRow ? "isClickable" : void 0,
|
|
6842
|
-
onClick: () => onClickRowElement(item, rowIndex),
|
|
6843
|
-
children: columns.map((column, colIndex) => /* @__PURE__ */ jsx20(TdStyledComponent, { textAlign: column.align, children: renderCellContent(column, item, rowIndex) }, column.type + column.label + colIndex))
|
|
6844
|
-
},
|
|
6845
|
-
JSON.stringify(item) + rowIndex
|
|
6846
|
-
)) : /* @__PURE__ */ jsx20("tr", { children: /* @__PURE__ */ jsx20("td", { className: "noData", colSpan: columns.length, children: /* @__PURE__ */ jsx20(Text_default.unknown, { children: noDataItemsMessage }) }) }) })
|
|
6847
|
-
]
|
|
7127
|
+
const possibleFilterListValues = useMemo7(() => {
|
|
7128
|
+
if (!openedFilterColumn) return [];
|
|
7129
|
+
return data.reduce(
|
|
7130
|
+
(previousValue, currentValue) => {
|
|
7131
|
+
const value = openedFilterColumn.type === "text" && openedFilterColumn.keyName ? String(currentValue[openedFilterColumn.keyName]) : void 0;
|
|
7132
|
+
if (value !== void 0) {
|
|
7133
|
+
if (previousValue.some((item) => item.value === value)) {
|
|
7134
|
+
previousValue = previousValue.map(
|
|
7135
|
+
(item) => item.value === value ? {
|
|
7136
|
+
...item,
|
|
7137
|
+
count: item.count + 1
|
|
7138
|
+
} : item
|
|
7139
|
+
);
|
|
7140
|
+
} else
|
|
7141
|
+
previousValue.push({
|
|
7142
|
+
value,
|
|
7143
|
+
count: 1
|
|
7144
|
+
});
|
|
6848
7145
|
}
|
|
6849
|
-
|
|
7146
|
+
return previousValue;
|
|
7147
|
+
},
|
|
7148
|
+
[]
|
|
7149
|
+
);
|
|
7150
|
+
}, [data, openedFilterColumn]);
|
|
7151
|
+
const pagesCount = pageSize !== void 0 ? Math.ceil(dataAfterPagination.length / pageSize) : 1;
|
|
7152
|
+
const paginationItems = useMemo7(() => {
|
|
7153
|
+
const halfRange = Math.floor(maximumVisiblePages / 2);
|
|
7154
|
+
let startPage = Math.max(1, currentPage - halfRange);
|
|
7155
|
+
let endPage = Math.min(pagesCount, currentPage + halfRange);
|
|
7156
|
+
if (endPage - startPage + 1 < maximumVisiblePages) {
|
|
7157
|
+
startPage = Math.max(1, endPage - maximumVisiblePages + 1);
|
|
7158
|
+
endPage = Math.min(pagesCount, startPage + maximumVisiblePages - 1);
|
|
6850
7159
|
}
|
|
7160
|
+
return Array.from(
|
|
7161
|
+
{
|
|
7162
|
+
length: endPage - startPage + 1
|
|
7163
|
+
},
|
|
7164
|
+
(_, index) => startPage + index
|
|
7165
|
+
);
|
|
7166
|
+
}, [pagesCount, currentPage]);
|
|
7167
|
+
const onClickNextPage = useCallback10(() => {
|
|
7168
|
+
setCurrentPage((oldValue) => oldValue >= pagesCount ? pagesCount : oldValue + 1);
|
|
7169
|
+
}, [pagesCount]);
|
|
7170
|
+
const onClickPreviousPage = useCallback10(() => {
|
|
7171
|
+
setCurrentPage((oldValue) => oldValue <= 1 ? 1 : oldValue - 1);
|
|
7172
|
+
}, []);
|
|
7173
|
+
const onClickSelectAllFilterListItems = useCallback10(
|
|
7174
|
+
() => setFilterListSelectedItems(possibleFilterListValues.map((item) => item.value)),
|
|
7175
|
+
[possibleFilterListValues]
|
|
6851
7176
|
);
|
|
7177
|
+
const onClickDeselectAllFilterListItems = useCallback10(() => setFilterListSelectedItems([]), []);
|
|
7178
|
+
useEffect9(() => {
|
|
7179
|
+
onChangePage?.(currentPage);
|
|
7180
|
+
}, [onChangePage, currentPage]);
|
|
7181
|
+
useEffect9(() => {
|
|
7182
|
+
onChangeFilter?.(filterData);
|
|
7183
|
+
}, [onChangeFilter, filterData]);
|
|
7184
|
+
useImperativeHandle2(
|
|
7185
|
+
ref,
|
|
7186
|
+
() => {
|
|
7187
|
+
return {
|
|
7188
|
+
currentPage,
|
|
7189
|
+
setCurrentPage,
|
|
7190
|
+
pagesCount,
|
|
7191
|
+
setCheckedItems
|
|
7192
|
+
};
|
|
7193
|
+
},
|
|
7194
|
+
[currentPage, setCurrentPage, pagesCount, setCheckedItems]
|
|
7195
|
+
);
|
|
7196
|
+
const mobileFooterBreakingPoint = mediumScreen.size700 && pagesCount > maximumVisiblePages / 1.4;
|
|
7197
|
+
return /* @__PURE__ */ jsxs16(Fragment5, { children: [
|
|
7198
|
+
/* @__PURE__ */ jsx20(
|
|
7199
|
+
Div_default,
|
|
7200
|
+
{
|
|
7201
|
+
border: `1px solid ${theme2.colors.border}`,
|
|
7202
|
+
borderRadius: theme2.styles.borderRadius * 2,
|
|
7203
|
+
overflow: "auto",
|
|
7204
|
+
...props,
|
|
7205
|
+
children: /* @__PURE__ */ jsxs16(
|
|
7206
|
+
TableStyledComponent,
|
|
7207
|
+
{
|
|
7208
|
+
isStriped,
|
|
7209
|
+
withHover: onClickRow !== void 0,
|
|
7210
|
+
withStickyHeader,
|
|
7211
|
+
colorTheme,
|
|
7212
|
+
theme: theme2,
|
|
7213
|
+
children: [
|
|
7214
|
+
/* @__PURE__ */ jsx20("thead", { children: /* @__PURE__ */ jsx20("tr", { className: "isHeader", children: columns.map((column, index) => /* @__PURE__ */ jsx20(
|
|
7215
|
+
ThStyledComponent,
|
|
7216
|
+
{
|
|
7217
|
+
width: column.type === "image" ? defaultImageWidth : column.type === "checkbox" ? 26 : column.width,
|
|
7218
|
+
minWidth: column.minWidth,
|
|
7219
|
+
maxWidth: column.maxWidth,
|
|
7220
|
+
textAlign: column.align,
|
|
7221
|
+
children: /* @__PURE__ */ jsxs16(
|
|
7222
|
+
Div_default.row,
|
|
7223
|
+
{
|
|
7224
|
+
width: "100%",
|
|
7225
|
+
alignItems: "center",
|
|
7226
|
+
justifyContent: "space-between",
|
|
7227
|
+
gap: theme2.styles.gap,
|
|
7228
|
+
children: [
|
|
7229
|
+
column.type === "checkbox" && onClickAllCheckboxes ? /* @__PURE__ */ jsx20(
|
|
7230
|
+
ToggleInput_default.checkbox,
|
|
7231
|
+
{
|
|
7232
|
+
checked: everythingIsChecked,
|
|
7233
|
+
onChange: onClickAllCheckboxesElement
|
|
7234
|
+
}
|
|
7235
|
+
) : column.label ? /* @__PURE__ */ jsx20(Text_default, { children: column.label }) : void 0,
|
|
7236
|
+
column.filter && /* @__PURE__ */ jsx20(
|
|
7237
|
+
Button_default.icon,
|
|
7238
|
+
{
|
|
7239
|
+
icon: "filter",
|
|
7240
|
+
color: filterData[index] ? theme2.colors.primary : theme2.colors.textSecondary,
|
|
7241
|
+
value: index,
|
|
7242
|
+
onClickWithValue: onClickFilterButton
|
|
7243
|
+
}
|
|
7244
|
+
)
|
|
7245
|
+
]
|
|
7246
|
+
}
|
|
7247
|
+
)
|
|
7248
|
+
},
|
|
7249
|
+
column.type + column.label + index
|
|
7250
|
+
)) }) }),
|
|
7251
|
+
/* @__PURE__ */ jsx20("tbody", { children: isLoading ? /* @__PURE__ */ jsx20("tr", { children: /* @__PURE__ */ jsx20("td", { className: "noData", colSpan: columns.length, children: /* @__PURE__ */ jsx20(Loader_default.box, {}) }) }) : dataAfterPagination.length > 0 ? dataAfterPagination.map((item, rowIndex) => /* @__PURE__ */ jsx20(
|
|
7252
|
+
"tr",
|
|
7253
|
+
{
|
|
7254
|
+
className: onClickRow ? "isClickable" : void 0,
|
|
7255
|
+
onClick: () => onClickRowElement(item, rowIndex),
|
|
7256
|
+
children: columns.map((column, colIndex) => /* @__PURE__ */ jsx20(TdStyledComponent, { textAlign: column.align, children: renderCellContent(column, item, rowIndex) }, column.type + column.label + colIndex))
|
|
7257
|
+
},
|
|
7258
|
+
JSON.stringify(item) + rowIndex
|
|
7259
|
+
)) : /* @__PURE__ */ jsx20("tr", { children: /* @__PURE__ */ jsx20("td", { className: "noData", colSpan: columns.length, children: /* @__PURE__ */ jsx20(Text_default.unknown, { children: noDataItemsMessage }) }) }) }),
|
|
7260
|
+
pageSize !== void 0 && /* @__PURE__ */ jsx20("tfoot", { children: /* @__PURE__ */ jsx20("tr", { className: "isFooter", children: /* @__PURE__ */ jsx20("td", { colSpan: columns.length, children: /* @__PURE__ */ jsxs16(
|
|
7261
|
+
Div_default.column,
|
|
7262
|
+
{
|
|
7263
|
+
position: "relative",
|
|
7264
|
+
width: "100%",
|
|
7265
|
+
justifyContent: "center",
|
|
7266
|
+
flexReverse: true,
|
|
7267
|
+
gap: theme2.styles.gap / 2,
|
|
7268
|
+
children: [
|
|
7269
|
+
/* @__PURE__ */ jsxs16(
|
|
7270
|
+
Text_default,
|
|
7271
|
+
{
|
|
7272
|
+
position: mobileFooterBreakingPoint ? "relative" : "absolute",
|
|
7273
|
+
top: !mobileFooterBreakingPoint ? "50%" : void 0,
|
|
7274
|
+
color: theme2.colors.textSecondary,
|
|
7275
|
+
transform: !mobileFooterBreakingPoint ? "translateY(-50%)" : void 0,
|
|
7276
|
+
userSelect: "none",
|
|
7277
|
+
children: [
|
|
7278
|
+
currentPage,
|
|
7279
|
+
" / ",
|
|
7280
|
+
pagesCount
|
|
7281
|
+
]
|
|
7282
|
+
}
|
|
7283
|
+
),
|
|
7284
|
+
/* @__PURE__ */ jsxs16(Div_default.row, { alignItems: "center", justifyContent: "center", gap: theme2.styles.gap * 2, children: [
|
|
7285
|
+
pagesCount > maximumVisiblePages && /* @__PURE__ */ jsx20(
|
|
7286
|
+
Button_default.icon,
|
|
7287
|
+
{
|
|
7288
|
+
icon: "doubleChevronLeft",
|
|
7289
|
+
disabled: currentPage === 1,
|
|
7290
|
+
value: 1,
|
|
7291
|
+
onClickWithValue: setCurrentPage
|
|
7292
|
+
}
|
|
7293
|
+
),
|
|
7294
|
+
/* @__PURE__ */ jsx20(
|
|
7295
|
+
Button_default.icon,
|
|
7296
|
+
{
|
|
7297
|
+
icon: "chevronLeft",
|
|
7298
|
+
disabled: currentPage === 1,
|
|
7299
|
+
onClick: onClickPreviousPage
|
|
7300
|
+
}
|
|
7301
|
+
),
|
|
7302
|
+
/* @__PURE__ */ jsx20(
|
|
7303
|
+
Div_default.row,
|
|
7304
|
+
{
|
|
7305
|
+
alignItems: "center",
|
|
7306
|
+
justifyContent: "center",
|
|
7307
|
+
flexWrap: mobileFooterBreakingPoint ? "wrap" : void 0,
|
|
7308
|
+
gap: theme2.styles.gap,
|
|
7309
|
+
children: paginationItems.map((pageIndex) => {
|
|
7310
|
+
const isActive = currentPage === pageIndex;
|
|
7311
|
+
return /* @__PURE__ */ jsx20(
|
|
7312
|
+
Div_default,
|
|
7313
|
+
{
|
|
7314
|
+
cursor: "pointer",
|
|
7315
|
+
userSelect: "none",
|
|
7316
|
+
value: pageIndex,
|
|
7317
|
+
onClickWithValue: setCurrentPage,
|
|
7318
|
+
children: /* @__PURE__ */ jsx20(
|
|
7319
|
+
Text_default,
|
|
7320
|
+
{
|
|
7321
|
+
fontWeight: isActive ? 700 : 400,
|
|
7322
|
+
color: isActive ? theme2.colors.primary : theme2.colors.textSecondary,
|
|
7323
|
+
transition: theme2.styles.transition,
|
|
7324
|
+
children: pageIndex
|
|
7325
|
+
}
|
|
7326
|
+
)
|
|
7327
|
+
},
|
|
7328
|
+
pageIndex
|
|
7329
|
+
);
|
|
7330
|
+
})
|
|
7331
|
+
}
|
|
7332
|
+
),
|
|
7333
|
+
/* @__PURE__ */ jsx20(
|
|
7334
|
+
Button_default.icon,
|
|
7335
|
+
{
|
|
7336
|
+
icon: "chevronRight",
|
|
7337
|
+
disabled: currentPage === pagesCount,
|
|
7338
|
+
onClick: onClickNextPage
|
|
7339
|
+
}
|
|
7340
|
+
),
|
|
7341
|
+
pagesCount > maximumVisiblePages && /* @__PURE__ */ jsx20(
|
|
7342
|
+
Button_default.icon,
|
|
7343
|
+
{
|
|
7344
|
+
icon: "doubleChevronRight",
|
|
7345
|
+
disabled: currentPage === pagesCount,
|
|
7346
|
+
onClickWithValue: setCurrentPage,
|
|
7347
|
+
value: pagesCount
|
|
7348
|
+
}
|
|
7349
|
+
)
|
|
7350
|
+
] })
|
|
7351
|
+
]
|
|
7352
|
+
}
|
|
7353
|
+
) }) }) })
|
|
7354
|
+
]
|
|
7355
|
+
}
|
|
7356
|
+
)
|
|
7357
|
+
}
|
|
7358
|
+
),
|
|
7359
|
+
/* @__PURE__ */ jsx20(
|
|
7360
|
+
Modal_default,
|
|
7361
|
+
{
|
|
7362
|
+
title: `Filter ${openedFilterColumn?.label}`,
|
|
7363
|
+
description: openedFilterColumn?.filter === "number" ? "Enter minimum and maximum values to filter" : openedFilterColumn?.filter === "date" || openedFilterColumn?.filter === "date-time" ? "Enter minimum and maximum dates to filter" : openedFilterColumn?.filter === "list" ? "Select values to filter from the list bellow" : "",
|
|
7364
|
+
onClose: onCloseFilterModal,
|
|
7365
|
+
ref: filterModalRef,
|
|
7366
|
+
children: openedFilterColumn ? openedFilterColumn.filter === "number" ? /* @__PURE__ */ jsx20(
|
|
7367
|
+
Form_default,
|
|
7368
|
+
{
|
|
7369
|
+
form: filterForm,
|
|
7370
|
+
submitButtonText: "Filter",
|
|
7371
|
+
cancelButtonText: "Clear",
|
|
7372
|
+
onClickCancel: openedFilterData ? onClickCancelFormFilter : void 0,
|
|
7373
|
+
children: /* @__PURE__ */ jsxs16(FormRow_default, { children: [
|
|
7374
|
+
/* @__PURE__ */ jsx20(InputField_default, { type: "number", label: "Min", ...filterForm.getInputFieldProps("min") }),
|
|
7375
|
+
/* @__PURE__ */ jsx20(InputField_default, { type: "number", label: "Max", ...filterForm.getInputFieldProps("max") })
|
|
7376
|
+
] })
|
|
7377
|
+
}
|
|
7378
|
+
) : openedFilterColumn.filter === "date" || openedFilterColumn.filter === "date-time" ? /* @__PURE__ */ jsxs16(
|
|
7379
|
+
Form_default,
|
|
7380
|
+
{
|
|
7381
|
+
form: filterForm,
|
|
7382
|
+
gap: theme2.styles.gap,
|
|
7383
|
+
submitButtonText: "Filter",
|
|
7384
|
+
cancelButtonText: "Clear",
|
|
7385
|
+
onClickCancel: openedFilterData ? onClickCancelFormFilter : void 0,
|
|
7386
|
+
children: [
|
|
7387
|
+
/* @__PURE__ */ jsxs16(FormRow_default, { children: [
|
|
7388
|
+
/* @__PURE__ */ jsx20(InputField_default.date, { label: "Min", ...filterForm.getInputFieldProps("min") }),
|
|
7389
|
+
/* @__PURE__ */ jsx20(InputField_default.date, { label: "Max", ...filterForm.getInputFieldProps("max") })
|
|
7390
|
+
] }),
|
|
7391
|
+
openedFilterColumn.presets && /* @__PURE__ */ jsxs16(Div_default.column, { gap: theme2.styles.gap / 2, children: [
|
|
7392
|
+
/* @__PURE__ */ jsx20(Label_default, { text: "Presets" }),
|
|
7393
|
+
/* @__PURE__ */ jsx20(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: openedFilterColumn.presets.map((preset) => {
|
|
7394
|
+
return /* @__PURE__ */ jsx20(
|
|
7395
|
+
Button_default.secondary,
|
|
7396
|
+
{
|
|
7397
|
+
text: filterPresetsText[preset],
|
|
7398
|
+
value: preset,
|
|
7399
|
+
onClickWithValue: onClickFilterPreset
|
|
7400
|
+
},
|
|
7401
|
+
preset
|
|
7402
|
+
);
|
|
7403
|
+
}) })
|
|
7404
|
+
] })
|
|
7405
|
+
]
|
|
7406
|
+
}
|
|
7407
|
+
) : openedFilterColumn.filter === "list" ? /* @__PURE__ */ jsx20(
|
|
7408
|
+
Form_default,
|
|
7409
|
+
{
|
|
7410
|
+
submitButtonText: "Filter",
|
|
7411
|
+
cancelButtonText: "Clear",
|
|
7412
|
+
renderActionButtons: /* @__PURE__ */ jsxs16(Div_default.row, { marginRight: "auto", alignItems: "center", gap: theme2.styles.gap, children: [
|
|
7413
|
+
/* @__PURE__ */ jsx20(
|
|
7414
|
+
Button_default.secondary,
|
|
7415
|
+
{
|
|
7416
|
+
text: "Select All",
|
|
7417
|
+
disabled: possibleFilterListValues.length === filterListSelectedItems?.length,
|
|
7418
|
+
onClick: onClickSelectAllFilterListItems
|
|
7419
|
+
}
|
|
7420
|
+
),
|
|
7421
|
+
/* @__PURE__ */ jsx20(
|
|
7422
|
+
Button_default.secondary,
|
|
7423
|
+
{
|
|
7424
|
+
text: "Deselect All",
|
|
7425
|
+
disabled: !filterListSelectedItems?.length,
|
|
7426
|
+
onClick: onClickDeselectAllFilterListItems
|
|
7427
|
+
}
|
|
7428
|
+
)
|
|
7429
|
+
] }),
|
|
7430
|
+
onClickCancel: openedFilterData ? onClickCancelFormFilter : void 0,
|
|
7431
|
+
onSubmit: filterForm.onSubmit,
|
|
7432
|
+
children: /* @__PURE__ */ jsxs16(Div_default.column, { gap: theme2.styles.gap / 2, marginBottom: theme2.styles.space, children: [
|
|
7433
|
+
/* @__PURE__ */ jsx20(Label_default, { text: "Possible values" }),
|
|
7434
|
+
/* @__PURE__ */ jsx20(Div_default.row, { flexWrap: "wrap", gap: theme2.styles.gap, children: possibleFilterListValues.map((value) => {
|
|
7435
|
+
const isActive = filterListSelectedItems?.includes(value.value);
|
|
7436
|
+
return /* @__PURE__ */ jsx20(
|
|
7437
|
+
Div_default.box,
|
|
7438
|
+
{
|
|
7439
|
+
isActive,
|
|
7440
|
+
value: value.value,
|
|
7441
|
+
onClickWithValue: onClickFilterListItem,
|
|
7442
|
+
children: /* @__PURE__ */ jsxs16(Div_default.row, { alignItems: "center", gap: theme2.styles.gap / 2, children: [
|
|
7443
|
+
/* @__PURE__ */ jsx20(Text_default, { children: value.value }),
|
|
7444
|
+
openedFilterColumn.withTotalNumber && /* @__PURE__ */ jsxs16(Text_default, { fontSize: 14, color: theme2.colors.textSecondary, children: [
|
|
7445
|
+
"(",
|
|
7446
|
+
value.count,
|
|
7447
|
+
")"
|
|
7448
|
+
] })
|
|
7449
|
+
] })
|
|
7450
|
+
},
|
|
7451
|
+
value.value
|
|
7452
|
+
);
|
|
7453
|
+
}) })
|
|
7454
|
+
] })
|
|
7455
|
+
}
|
|
7456
|
+
) : /* @__PURE__ */ jsx20(Text_default.unknown, { children: "Unknown filter" }) : /* @__PURE__ */ jsx20(Loader_default.box, {})
|
|
7457
|
+
}
|
|
7458
|
+
)
|
|
7459
|
+
] });
|
|
6852
7460
|
});
|
|
6853
7461
|
var Table2 = memo20(TableComponent);
|
|
6854
7462
|
var Table_default = Table2;
|
|
6855
7463
|
|
|
6856
7464
|
// src/components/Tabs.tsx
|
|
6857
|
-
import { forwardRef as
|
|
6858
|
-
import { jsx as jsx21, jsxs as
|
|
7465
|
+
import { forwardRef as forwardRef16, memo as memo21, useCallback as useCallback11, useEffect as useEffect10, useImperativeHandle as useImperativeHandle3, useMemo as useMemo8, useRef as useRef6, useState as useState9 } from "react";
|
|
7466
|
+
import { jsx as jsx21, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
6859
7467
|
var tabBottomLineWidth = 2;
|
|
6860
7468
|
var tabDotSize = 6;
|
|
6861
7469
|
var defaultTabName = "tab";
|
|
6862
|
-
var TabsComponent =
|
|
7470
|
+
var TabsComponent = forwardRef16(function Tabs({ tabs, name, accentColor, style = "default", onChange, children, ...props }, ref) {
|
|
6863
7471
|
const reactRouterDomPlugin2 = usePlugin("react-router-dom");
|
|
6864
7472
|
const theme2 = useTheme();
|
|
6865
7473
|
const urlQuery = reactRouterDomPlugin2 ? useUrlQuery() : void 0;
|
|
6866
7474
|
const { colorTheme, componentsState } = useBetterHtmlContextInternal();
|
|
6867
|
-
const firstRenderPassedRef =
|
|
6868
|
-
const tabsRef =
|
|
7475
|
+
const firstRenderPassedRef = useRef6(false);
|
|
7476
|
+
const tabsRef = useRef6({});
|
|
6869
7477
|
const [selectedTab, setSelectedTab] = useState9(() => {
|
|
6870
7478
|
const selectedTabValue = tabs[0] ?? "";
|
|
6871
7479
|
if (urlQuery) {
|
|
@@ -6901,7 +7509,7 @@ var TabsComponent = forwardRef12(function Tabs({ tabs, name, accentColor, style
|
|
|
6901
7509
|
});
|
|
6902
7510
|
return spacing;
|
|
6903
7511
|
}, [selectedTab, tabs, tabsGap]);
|
|
6904
|
-
|
|
7512
|
+
useEffect10(() => {
|
|
6905
7513
|
const timeout = setTimeout(() => {
|
|
6906
7514
|
setRerenderState(Math.random());
|
|
6907
7515
|
firstRenderPassedRef.current = true;
|
|
@@ -6910,7 +7518,7 @@ var TabsComponent = forwardRef12(function Tabs({ tabs, name, accentColor, style
|
|
|
6910
7518
|
clearTimeout(timeout);
|
|
6911
7519
|
};
|
|
6912
7520
|
}, []);
|
|
6913
|
-
|
|
7521
|
+
useEffect10(() => {
|
|
6914
7522
|
componentsState.tabs.setTabGroups((oldValue) => {
|
|
6915
7523
|
const thisTabGroup = oldValue.find((item) => item.name === (name ?? defaultTabName));
|
|
6916
7524
|
if (thisTabGroup) {
|
|
@@ -6931,20 +7539,20 @@ var TabsComponent = forwardRef12(function Tabs({ tabs, name, accentColor, style
|
|
|
6931
7539
|
}
|
|
6932
7540
|
});
|
|
6933
7541
|
}, [selectedTab, name]);
|
|
6934
|
-
|
|
7542
|
+
useEffect10(() => {
|
|
6935
7543
|
tabsRef.current[selectedTab]?.scrollIntoView({
|
|
6936
7544
|
behavior: firstRenderPassedRef.current ? "smooth" : void 0,
|
|
6937
7545
|
block: "nearest"
|
|
6938
7546
|
});
|
|
6939
7547
|
}, [selectedTab]);
|
|
6940
|
-
|
|
7548
|
+
useEffect10(() => {
|
|
6941
7549
|
return () => {
|
|
6942
7550
|
componentsState.tabs.setTabGroups(
|
|
6943
7551
|
(oldValue) => oldValue.filter((item) => item.name !== (name ?? defaultTabName))
|
|
6944
7552
|
);
|
|
6945
7553
|
};
|
|
6946
7554
|
}, []);
|
|
6947
|
-
|
|
7555
|
+
useImperativeHandle3(
|
|
6948
7556
|
ref,
|
|
6949
7557
|
() => {
|
|
6950
7558
|
return {
|
|
@@ -6954,11 +7562,11 @@ var TabsComponent = forwardRef12(function Tabs({ tabs, name, accentColor, style
|
|
|
6954
7562
|
},
|
|
6955
7563
|
[selectedTab, onClickTab]
|
|
6956
7564
|
);
|
|
6957
|
-
return /* @__PURE__ */
|
|
6958
|
-
/* @__PURE__ */
|
|
7565
|
+
return /* @__PURE__ */ jsxs17(Div_default.column, { width: "100%", gap: theme2.styles.space, ...props, children: [
|
|
7566
|
+
/* @__PURE__ */ jsxs17(Div_default, { position: "relative", className: "react-better-html-no-scrollbar", overflowY: "auto", children: [
|
|
6959
7567
|
/* @__PURE__ */ jsx21(Div_default.row, { position: "relative", width: "fit-content", gap: tabsGap, userSelect: "none", children: tabs.map((tab) => {
|
|
6960
7568
|
const selected = tab === selectedTab;
|
|
6961
|
-
return /* @__PURE__ */
|
|
7569
|
+
return /* @__PURE__ */ jsxs17(
|
|
6962
7570
|
Div_default,
|
|
6963
7571
|
{
|
|
6964
7572
|
position: "relative",
|
|
@@ -7029,7 +7637,7 @@ TabsComponent.content = function Content({ tab, tabWithDot, tabsGroupName, isIni
|
|
|
7029
7637
|
() => componentsState.tabs.tabGroups.find((item) => item.name === (tabsGroupName ?? defaultTabName)),
|
|
7030
7638
|
[componentsState.tabs, tabsGroupName]
|
|
7031
7639
|
);
|
|
7032
|
-
|
|
7640
|
+
useEffect10(() => {
|
|
7033
7641
|
if (tabWithDot) {
|
|
7034
7642
|
componentsState.tabs.setTabsWithDots?.((oldValue) => oldValue.includes(tab) ? oldValue : [...oldValue, tab]);
|
|
7035
7643
|
} else {
|
|
@@ -7045,11 +7653,11 @@ Tabs2.content = TabsComponent.content;
|
|
|
7045
7653
|
var Tabs_default = Tabs2;
|
|
7046
7654
|
|
|
7047
7655
|
// src/components/Foldable.tsx
|
|
7048
|
-
import { forwardRef as
|
|
7049
|
-
import { jsx as jsx22, jsxs as
|
|
7656
|
+
import { forwardRef as forwardRef17, memo as memo22, useCallback as useCallback12, useEffect as useEffect11, useImperativeHandle as useImperativeHandle4, useRef as useRef7, useState as useState10 } from "react";
|
|
7657
|
+
import { jsx as jsx22, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
7050
7658
|
var animationDurationClose = 0.15;
|
|
7051
7659
|
var animationDurationOpen = animationDurationClose * 2;
|
|
7052
|
-
var FoldableComponent =
|
|
7660
|
+
var FoldableComponent = forwardRef17(function Foldable({
|
|
7053
7661
|
isOpen: controlledIsOpen,
|
|
7054
7662
|
defaultOpen = false,
|
|
7055
7663
|
title,
|
|
@@ -7064,7 +7672,7 @@ var FoldableComponent = forwardRef13(function Foldable({
|
|
|
7064
7672
|
...props
|
|
7065
7673
|
}, ref) {
|
|
7066
7674
|
const theme2 = useTheme();
|
|
7067
|
-
const bodyRef =
|
|
7675
|
+
const bodyRef = useRef7(null);
|
|
7068
7676
|
const [internalIsOpen, setInternalIsOpen] = useBooleanState(defaultOpen);
|
|
7069
7677
|
const [bodyVirtualHeight, setBodyVirtualHeight] = useState10(500);
|
|
7070
7678
|
const isOpen = controlledIsOpen !== void 0 ? controlledIsOpen : internalIsOpen;
|
|
@@ -7080,11 +7688,11 @@ var FoldableComponent = forwardRef13(function Foldable({
|
|
|
7080
7688
|
if (controlledIsOpen === void 0) setInternalIsOpen.toggle();
|
|
7081
7689
|
onOpenChange?.(!isOpen);
|
|
7082
7690
|
}, [controlledIsOpen, isOpen, onOpenChange]);
|
|
7083
|
-
|
|
7691
|
+
useEffect11(() => {
|
|
7084
7692
|
if (!bodyRef.current) return;
|
|
7085
7693
|
setBodyVirtualHeight(Math.min(500, bodyRef.current.scrollHeight * 2));
|
|
7086
7694
|
}, [isOpen]);
|
|
7087
|
-
|
|
7695
|
+
useImperativeHandle4(
|
|
7088
7696
|
ref,
|
|
7089
7697
|
() => {
|
|
7090
7698
|
return {
|
|
@@ -7096,8 +7704,8 @@ var FoldableComponent = forwardRef13(function Foldable({
|
|
|
7096
7704
|
},
|
|
7097
7705
|
[open, close, toggleOpen, isOpen]
|
|
7098
7706
|
);
|
|
7099
|
-
return /* @__PURE__ */
|
|
7100
|
-
renderHeader ? renderHeader(isOpen, toggleOpen) : /* @__PURE__ */
|
|
7707
|
+
return /* @__PURE__ */ jsxs18(Div_default.column, { width: "100%", ...props, children: [
|
|
7708
|
+
renderHeader ? renderHeader(isOpen, toggleOpen) : /* @__PURE__ */ jsxs18(
|
|
7101
7709
|
Div_default.row,
|
|
7102
7710
|
{
|
|
7103
7711
|
width: "100%",
|
|
@@ -7109,10 +7717,10 @@ var FoldableComponent = forwardRef13(function Foldable({
|
|
|
7109
7717
|
onClick: toggleOpen,
|
|
7110
7718
|
userSelect: "none",
|
|
7111
7719
|
children: [
|
|
7112
|
-
/* @__PURE__ */
|
|
7720
|
+
/* @__PURE__ */ jsxs18(Div_default.row, { flex: 1, alignItems: "center", gap: theme2.styles.space, children: [
|
|
7113
7721
|
icon && /* @__PURE__ */ jsx22(Icon_default, { name: icon, size: 20, flexShrink: 0 }),
|
|
7114
7722
|
image && /* @__PURE__ */ jsx22(Image_default.profileImage, { name: image, size: 24, flexShrink: 0 }),
|
|
7115
|
-
/* @__PURE__ */
|
|
7723
|
+
/* @__PURE__ */ jsxs18(Div_default.column, { gap: theme2.styles.gap / 2, children: [
|
|
7116
7724
|
title && /* @__PURE__ */ jsx22(Text_default, { as: "h3", fontWeight: 700, lineHeight: "20px", children: title }),
|
|
7117
7725
|
description && /* @__PURE__ */ jsx22(Text_default, { color: theme2.colors.textSecondary, children: description })
|
|
7118
7726
|
] })
|
|
@@ -7143,7 +7751,7 @@ var FoldableComponent = forwardRef13(function Foldable({
|
|
|
7143
7751
|
)
|
|
7144
7752
|
] });
|
|
7145
7753
|
});
|
|
7146
|
-
FoldableComponent.box =
|
|
7754
|
+
FoldableComponent.box = forwardRef17(function Box3({ ...props }, ref) {
|
|
7147
7755
|
const theme2 = useTheme();
|
|
7148
7756
|
return /* @__PURE__ */ jsx22(
|
|
7149
7757
|
FoldableComponent,
|